Skip to content

Commit bebadf3

Browse files
committed
chore: init docs
0 parents  commit bebadf3

File tree

723 files changed

+41212
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

723 files changed

+41212
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# deps
2+
/node_modules
3+
4+
# generated content
5+
.contentlayer
6+
.content-collections
7+
.source
8+
9+
# test & build
10+
/coverage
11+
/.next/
12+
/build
13+
*.tsbuildinfo
14+
15+
# misc
16+
.DS_Store
17+
*.pem
18+
/.pnp
19+
.pnp.js
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*
23+
24+
# others
25+
.env*.local
26+
.vercel
27+
next-env.d.ts

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# form-docs
2+
3+
This is a Next.js application generated with
4+
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
5+
6+
Run development server:
7+
8+
```bash
9+
npm run dev
10+
# or
11+
pnpm dev
12+
# or
13+
yarn dev
14+
```
15+
16+
Open http://localhost:3000 with your browser to see the result.
17+
18+
## Learn More
19+
20+
To learn more about Next.js and Fumadocs, take a look at the following
21+
resources:
22+
23+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
24+
features and API.
25+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
26+
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs

components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "",
8+
"css": "src/app/global.css",
9+
"baseColor": "neutral",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "ApiReference"
3+
---
4+
5+
🚧 正在建设中
6+
7+
我们正在努力生成更详细的参考资料。
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Quick Start
3+
---
4+
5+
🚧 Under Construction
6+
7+
We are working on generating a more detailed reference.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"title": "Api 文档",
3+
"description": "Signals Form 的 API 文档",
4+
"icon": "NotebookText",
5+
"root": true,
6+
"pages": [
7+
"---Introduction---",
8+
"index"
9+
]
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"title": "Api Reference",
3+
"description": "Api Reference for Signals Form",
4+
"icon": "NotebookText",
5+
"root": true,
6+
"pages": [
7+
"---Introduction---",
8+
"index"
9+
]
10+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: 自定义操作符
3+
---
4+
5+
- `nand`:与非操作符,只有当所有条件都为 `false` 时,结果才为 `true`
6+
- `nor`:或非操作符,只有当所有条件都为 `false` 时,结果才为 `true`
7+
8+
## `nand`
9+
- 操作符用于判断所有条件是否都为 `false`,即只有当所有条件都为 `false` 时,结果才为 `true`
10+
11+
12+
```ts
13+
import { D, registerCustomOperator } from "@signals-from/core"
14+
const model = {
15+
isA: true,
16+
isB: false,
17+
}
18+
registerCustomOperator(
19+
"nand",
20+
function (...bools: boolean[]) {
21+
return !bools.every(Boolean);
22+
}
23+
)
24+
25+
D.nand('isA', 'isB').execute(model) // !(isA && isB) true
26+
```
27+
## `nor`
28+
- 操作符用于判断所有条件是否都为 `false`,即只有当所有条件都为 `false` 时,结果才为 `true`
29+
30+
```ts
31+
import { D, registerCustomOperator} from "@signals-from/core"
32+
const model = {
33+
isA: true,
34+
isB: false,
35+
}
36+
37+
registerCustomOperator(
38+
"nor",
39+
function (...bools: boolean[]) {
40+
return !bools.some(Boolean);
41+
}
42+
)
43+
D.nor('isA', 'isB').execute(model) // !(isA || isB) false
44+
```
45+
46+
## 注:
47+
- 此等操作符,是一个二次计算的过程,会导致开发者在使用时,增加了很大的复杂度,心智负担大,请谨慎使用。
48+
- 建议使用基础的操作符,如 `and``or``not``use`,以简化决策逻辑。 `nand` 可以使用 `not``and` 组合实现,`nor` 可以使用 `not``or` 组合实现。
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Custom Operators
3+
description: Advanced logical operators for complex decision making
4+
---
5+
6+
- `nand`: NAND operator, only returns `true` when all conditions are `false`.
7+
- `nor`: NOR operator, only returns `true` when all conditions are `false`.
8+
9+
## `nand`
10+
- The `nand` operator is used to determine whether all conditions are `false`, i.e., only when all conditions are `false`, the result is `true`.
11+
12+
```ts
13+
import { D, registerCustomOperator } from "@signals-form/core"
14+
const model = {
15+
isA: true,
16+
isB: false,
17+
}
18+
registerCustomOperator(
19+
"nand",
20+
function (...bools: boolean[]) {
21+
return !bools.every(Boolean);
22+
}
23+
)
24+
25+
D.nand('isA', 'isB').execute(model) // !(isA && isB) true
26+
```
27+
28+
## `nor`
29+
- The `nor` operator is used to determine whether all conditions are `false`, i.e., only when all conditions are `false`, the result is `true`.
30+
31+
```ts
32+
import { D, registerCustomOperator} from "@signals-form/core"
33+
const model = {
34+
isA: true,
35+
isB: false,
36+
}
37+
38+
registerCustomOperator(
39+
"nor",
40+
function (...bools: boolean[]) {
41+
return !bools.some(Boolean);
42+
}
43+
)
44+
D.nor('isA', 'isB').execute(model) // !(isA || isB) false
45+
```
46+
47+
## Note:
48+
- These operators involve a secondary calculation process, which can significantly increase complexity and mental burden for developers when using them. Please use with caution.
49+
- It's recommended to use basic operators such as `and`, `or`, `not`, `use` to simplify decision logic. `nand` can be implemented using `not` and `and` combination, `nor` can be implemented using `not` and `or` combination.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: 决策对象
3+
description: 表单系统中的条件渲染和逻辑判断
4+
---
5+
`Decision` 是一个决策对象。常用于字段的显示与隐藏,以及业务逻辑的处理。
6+
7+
## 基本用法
8+
```ts
9+
import { setup, D } from "@signals-from/core"
10+
11+
const boolConfig = {
12+
isDisabled: false,
13+
isHidden: () => true,
14+
isA:(model) => model.data === 'a',
15+
}
16+
17+
// 注册 布尔配置
18+
setup(boolConfig)
19+
20+
const ds = D.and(
21+
D.or(
22+
'isDisabled',
23+
'isHidden'
24+
),
25+
D.use('isA')
26+
)
27+
28+
const model = {
29+
data: 'a'
30+
}
31+
32+
ds.execute(model) // true
33+
```

0 commit comments

Comments
 (0)