hd-garden 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/lib/garden-docs-meta.ts +2 -0
- package/docs/handbook/components/compose.md +11 -231
- package/docs/handbook/en/components/compose.md +43 -272
- package/docs/handbook/en/reference/compose-icons.md +863 -0
- package/docs/handbook/en/reference/compose.md +153 -75
- package/docs/handbook/en/reference.md +1 -0
- package/docs/handbook/reference/compose-icons.md +863 -0
- package/docs/handbook/reference/compose.md +156 -78
- package/docs/handbook/reference.md +2 -1
- package/editors/dist/typora/main.js +233 -233
- package/editors/dist/vscode/garden-ui-0.1.0.vsix +0 -0
- package/package.json +1 -1
- package/scripts/gen-compose-handbook.mjs +427 -0
- package/scripts/gen-compose-icons.mjs +236 -0
- package/ui/compose/compose.css +530 -12
- package/ui/compose/icons.mjs +774 -0
- package/ui/compose/index.mjs +2 -1
- package/ui/compose/markup.mjs +392 -29
- package/ui/compose/parse.mjs +8 -1
- package/ui/compose/render.mjs +155 -17
- package/ui/compose/tokens.mjs +50 -0
- package/ui/preview/dist/garden-ui.esm.js +234 -234
- package/ui/preview/dist/garden-ui.iife.js +234 -234
|
@@ -96,6 +96,7 @@ export const COMPONENT_BADGE: Record<string, string> = {
|
|
|
96
96
|
"reference/timeline": "timeline",
|
|
97
97
|
"reference/chart": "chart",
|
|
98
98
|
"reference/compose": "compose",
|
|
99
|
+
"reference/compose-icons": "compose",
|
|
99
100
|
"reference/html": "html",
|
|
100
101
|
"reference/interactive": "interactive",
|
|
101
102
|
"reference/file": "file",
|
|
@@ -118,6 +119,7 @@ export const NAV_SHORT_TITLE: Record<string, string> = {
|
|
|
118
119
|
"components/timeline": "时间线",
|
|
119
120
|
"components/chart": "条形图表",
|
|
120
121
|
"components/compose": "说明图",
|
|
122
|
+
"reference/compose-icons": "compose 图标",
|
|
121
123
|
"components/html": "嵌入网页片段",
|
|
122
124
|
"components/interactive": "可调公式与参数",
|
|
123
125
|
"components/file": "文件下载与预览",
|
|
@@ -20,17 +20,15 @@ badge: compose
|
|
|
20
20
|
- **谁连谁**:谁先到谁、从一处散开,还是几处收到一起。没有先后顺序,就直接写「这几块没有先后」。
|
|
21
21
|
- **哪块是重点**:直接点名,比如「中间那列是重点」「下面一行才是重点」。
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
不要写颜色、圆角、灰胶囊、字重、间距、阴影、要不要撑满。外观由组件默认样式决定,写了反而乱。
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**完整标签与属性**见 [组件参考 · compose](/garden/reference/compose);**全部图标名**见 [compose 图标](/garden/reference/compose-icons)。
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## 写法对照
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
只写「画一张权限图」,AI 不知道分几列、每列放什么;写成「三列等宽,中间用浅灰圆角,字重轻一点」,又全在规定外观。
|
|
29
|
+
写围栏时,最常见的失误有两个:一是只写一个主题词,没给结构;二是把精力花在规定颜色、圆角和字重上。下面按五种常见结构,列出改写后的写法。
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
**三列并排,中间接起来**
|
|
34
32
|
|
|
35
33
|
````markdown
|
|
36
34
|
```garden compose
|
|
@@ -42,8 +40,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
42
40
|
|
|
43
41
|
**先到一处,再散开**
|
|
44
42
|
|
|
45
|
-
不要写「画个单点登录,箭头好看一点,间距均匀」。把谁先连向哪里、再同时分给哪几个系统写清楚:
|
|
46
|
-
|
|
47
43
|
````markdown
|
|
48
44
|
```garden compose
|
|
49
45
|
用户浏览器先到身份提供方,再同时连到 HR、Finance、Project 三个系统。
|
|
@@ -53,8 +49,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
53
49
|
|
|
54
50
|
**自上而下分层**
|
|
55
51
|
|
|
56
|
-
不要写「五张通栏卡片,第二张和第五张上色,箭头画细」。直接列出五层的名字、哪两层需要突出,以及是不是每次请求都按顺序走完:
|
|
57
|
-
|
|
58
52
|
````markdown
|
|
59
53
|
```garden compose
|
|
60
54
|
从上到下五层:浏览器、身份服务、BFF、业务服务、授权决策。
|
|
@@ -65,8 +59,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
65
59
|
|
|
66
60
|
**一件事的多个切面**
|
|
67
61
|
|
|
68
|
-
不要写「两行两列加下面两张卡片,标题不要加粗」。把六个切面的短名、每块要回答的问题,以及「没有先后顺序」交代清楚:
|
|
69
|
-
|
|
70
62
|
````markdown
|
|
71
63
|
```garden compose
|
|
72
64
|
用户发起请求后,先看四件事:认证(你是谁)、凭证(怎么证明)、
|
|
@@ -77,8 +69,6 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
77
69
|
|
|
78
70
|
**上下两行对比**
|
|
79
71
|
|
|
80
|
-
不要写「上面无框,下面灰色胶囊,贴着内容,不要撑满」。直接写哪一行是常规背景、哪一行是真正要强调的循环:
|
|
81
|
-
|
|
82
72
|
````markdown
|
|
83
73
|
```garden compose
|
|
84
74
|
上面一行是常规交付:理解需求 → 设计方案 → 开发上线。
|
|
@@ -87,13 +77,13 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
87
77
|
```
|
|
88
78
|
````
|
|
89
79
|
|
|
90
|
-
##
|
|
80
|
+
## 图标与表面
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
状态符号用 `<icon name="check-circle"/>` 一类具名图标,不要塞 emoji。小格子、浅底、圆角用 `padding`、`background`、`radius` 组合,不要为单张图发明专用标签。
|
|
93
83
|
|
|
94
|
-
|
|
84
|
+
## 一张示例
|
|
95
85
|
|
|
96
|
-
|
|
86
|
+
下面只留一张图;更多对照见仓库示例文,标签全表见参考页。
|
|
97
87
|
|
|
98
88
|
```garden compose
|
|
99
89
|
<intent>
|
|
@@ -120,218 +110,9 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
120
110
|
<text tone="muted" align="center">概念关系:User ↔ Role ↔ Permission</text>
|
|
121
111
|
```
|
|
122
112
|
|
|
123
|
-
### 先汇再散
|
|
124
|
-
|
|
125
|
-
先流向中间那一层,再用 `<fan>` 同时分到下面几列。
|
|
126
|
-
|
|
127
|
-
```garden compose
|
|
128
|
-
<intent>
|
|
129
|
-
用户浏览器先到身份提供方。身份提供方再同时连到 HR、Finance、Project。三个系统信任同一个身份提供方。身份提供方是要先看见的一层。
|
|
130
|
-
</intent>
|
|
131
|
-
<stack align="center">
|
|
132
|
-
<pill>用户浏览器</pill>
|
|
133
|
-
<arrow dir="down"/>
|
|
134
|
-
<band tone="accent" align="center">
|
|
135
|
-
<title>Identity Provider(IdP)</title>
|
|
136
|
-
<text>统一完成身份验证、维护登录状态、签发身份断言</text>
|
|
137
|
-
</band>
|
|
138
|
-
<fan n="3"/>
|
|
139
|
-
<row align="center">
|
|
140
|
-
<title>HR 系统</title>
|
|
141
|
-
<title>Finance 系统</title>
|
|
142
|
-
<title>Project 系统</title>
|
|
143
|
-
</row>
|
|
144
|
-
<text tone="muted" align="center">三个系统都信任同一个身份提供方</text>
|
|
145
|
-
</stack>
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### 自上而下分层
|
|
149
|
-
|
|
150
|
-
几层按顺序往下走,重点层用 `<band>`,经过的层只留文字。
|
|
151
|
-
|
|
152
|
-
```garden compose
|
|
153
|
-
<intent>
|
|
154
|
-
从上到下五层:浏览器、身份服务、BFF、业务服务、授权决策。身份服务和授权决策是要强调的两层,其余是经过的路径。不是每次请求都按这个顺序走完。
|
|
155
|
-
</intent>
|
|
156
|
-
<stack align="center">
|
|
157
|
-
<box frame="text" align="center">
|
|
158
|
-
<badge>①</badge>
|
|
159
|
-
<title>浏览器 / App</title>
|
|
160
|
-
<text>Cookie、Session、OAuth Client</text>
|
|
161
|
-
</box>
|
|
162
|
-
<arrow dir="down"/>
|
|
163
|
-
<band tone="accent" align="center">
|
|
164
|
-
<badge>②</badge>
|
|
165
|
-
<title>身份服务 IdP / IAM</title>
|
|
166
|
-
<text>Passkey、MFA、OIDC、会话管理</text>
|
|
167
|
-
</band>
|
|
168
|
-
<arrow dir="down"/>
|
|
169
|
-
<box frame="text" align="center">
|
|
170
|
-
<badge>③</badge>
|
|
171
|
-
<title>BFF / API Gateway</title>
|
|
172
|
-
<text>会话验证、Token 校验、入口授权控制</text>
|
|
173
|
-
</box>
|
|
174
|
-
<arrow dir="down"/>
|
|
175
|
-
<box frame="text" align="center">
|
|
176
|
-
<badge>④</badge>
|
|
177
|
-
<title>业务服务</title>
|
|
178
|
-
<text>订单、支付、账户、资源对象</text>
|
|
179
|
-
</box>
|
|
180
|
-
<arrow dir="down"/>
|
|
181
|
-
<band tone="tip" align="center">
|
|
182
|
-
<badge>⑤</badge>
|
|
183
|
-
<title>授权决策系统</title>
|
|
184
|
-
<text>RBAC + ABAC + ReBAC + Policy Engine</text>
|
|
185
|
-
</band>
|
|
186
|
-
<text tone="muted" align="start">逻辑职责示意:并非所有请求都按此顺序经过各层。身份服务通常在登录阶段交互,业务服务则在请求执行时调用授权决策能力。</text>
|
|
187
|
-
</stack>
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### 一件事的多个切面
|
|
191
|
-
|
|
192
|
-
没有严格先后的几块内容,用 `<row>` 和 `<box>` 分成上下两组并排摆开。
|
|
193
|
-
|
|
194
|
-
```garden compose
|
|
195
|
-
<intent>
|
|
196
|
-
用户要改订单地址。先分成认证、凭证、授权、验证,每块一个问题。然后再看传输和保密。这六块不是严格的先后步骤。
|
|
197
|
-
</intent>
|
|
198
|
-
<stack align="center">
|
|
199
|
-
<title>用户发起 API 请求</title>
|
|
200
|
-
<text tone="muted">例如:修改订单收货地址</text>
|
|
201
|
-
</stack>
|
|
202
|
-
<arrow dir="down"/>
|
|
203
|
-
<row>
|
|
204
|
-
<box>
|
|
205
|
-
<title>认证</title>
|
|
206
|
-
<text>你是谁?</text>
|
|
207
|
-
<text tone="muted">Authentication</text>
|
|
208
|
-
</box>
|
|
209
|
-
<box>
|
|
210
|
-
<title>凭证</title>
|
|
211
|
-
<text>如何证明你的身份?</text>
|
|
212
|
-
<text tone="muted">Credential</text>
|
|
213
|
-
</box>
|
|
214
|
-
</row>
|
|
215
|
-
<row>
|
|
216
|
-
<box>
|
|
217
|
-
<title>授权</title>
|
|
218
|
-
<text>你有权修改这笔订单吗?</text>
|
|
219
|
-
<text tone="muted">Authorization</text>
|
|
220
|
-
</box>
|
|
221
|
-
<box>
|
|
222
|
-
<title>验证</title>
|
|
223
|
-
<text>提交的数据是否合法?</text>
|
|
224
|
-
<text tone="muted">Verification</text>
|
|
225
|
-
</box>
|
|
226
|
-
</row>
|
|
227
|
-
<arrow dir="down"/>
|
|
228
|
-
<stack align="center">
|
|
229
|
-
<title>业务操作与数据存储</title>
|
|
230
|
-
</stack>
|
|
231
|
-
<row>
|
|
232
|
-
<box>
|
|
233
|
-
<title>传输</title>
|
|
234
|
-
<text>网络中能否被窃听、篡改、冒充?</text>
|
|
235
|
-
</box>
|
|
236
|
-
<box>
|
|
237
|
-
<title>保密</title>
|
|
238
|
-
<text>敏感数据泄露后能否被读取?</text>
|
|
239
|
-
</box>
|
|
240
|
-
</row>
|
|
241
|
-
<text tone="muted">概念示意:六者并不是严格串行的执行阶段,传输保护贯穿网络通信,保密措施也可能覆盖客户端与服务端。</text>
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### 外框套子项
|
|
245
|
-
|
|
246
|
-
大框里再摆一排徽章或两列要点,适合画「一层里面包含几条检查」。
|
|
247
|
-
|
|
248
|
-
```garden compose
|
|
249
|
-
<intent>
|
|
250
|
-
用户意图经过 Agent,再经过策略执行点,最后到工具执行器。策略点里是四条约束。策略点是要先看见的一层。
|
|
251
|
-
</intent>
|
|
252
|
-
<stack align="center">
|
|
253
|
-
<title>User Intent + Authorization</title>
|
|
254
|
-
<text tone="muted">明确任务目标、用户身份与授权范围</text>
|
|
255
|
-
<arrow dir="down"/>
|
|
256
|
-
<band align="center">
|
|
257
|
-
<title>Agent / LLM</title>
|
|
258
|
-
<text>负责理解、推理、规划和提出执行意图</text>
|
|
259
|
-
<row align="center">
|
|
260
|
-
<badge>Untrusted Context</badge>
|
|
261
|
-
<badge>Memory</badge>
|
|
262
|
-
<badge>Tool Results</badge>
|
|
263
|
-
</row>
|
|
264
|
-
</band>
|
|
265
|
-
<arrow dir="down"/>
|
|
266
|
-
<box align="center" mark="shield">
|
|
267
|
-
<title>Policy Enforcement Point</title>
|
|
268
|
-
<text tone="muted" align="center">独立于 LLM 的确定性执行控制</text>
|
|
269
|
-
<row align="center">
|
|
270
|
-
<text>权限与资源范围</text>
|
|
271
|
-
<text>操作参数校验</text>
|
|
272
|
-
</row>
|
|
273
|
-
<row align="center">
|
|
274
|
-
<text>任务意图约束</text>
|
|
275
|
-
<text>高风险操作审批</text>
|
|
276
|
-
</row>
|
|
277
|
-
</box>
|
|
278
|
-
<arrow dir="down"/>
|
|
279
|
-
<title>Tool Executor</title>
|
|
280
|
-
<text tone="muted">按最小权限执行、记录审计、支持中断</text>
|
|
281
|
-
</stack>
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 多角色来回交互
|
|
285
|
-
|
|
286
|
-
几个角色按先后发消息、退回结果时,用 `<lanes>` 画成泳道。
|
|
287
|
-
|
|
288
|
-
```garden compose
|
|
289
|
-
<intent>
|
|
290
|
-
用户、客户端、授权服务器三条泳道,六步授权码加 PKCE。
|
|
291
|
-
</intent>
|
|
292
|
-
<lanes>
|
|
293
|
-
<actor>用户</actor>
|
|
294
|
-
<actor>客户端</actor>
|
|
295
|
-
<actor>授权服务器</actor>
|
|
296
|
-
<message from="1" to="2" tone="forward">点击登录 / 授权</message>
|
|
297
|
-
<message from="2" to="3" tone="forward">发起授权请求 + PKCE</message>
|
|
298
|
-
<message from="3" to="1" tone="back">用户身份验证与授权</message>
|
|
299
|
-
<message from="3" to="2" tone="back">重定向返回 Code</message>
|
|
300
|
-
<message from="2" to="3" tone="forward">Code + Verifier 换 Token</message>
|
|
301
|
-
<message from="3" to="2" tone="back">返回 Token</message>
|
|
302
|
-
</lanes>
|
|
303
|
-
<text tone="muted">简化示意:真实流程还包含浏览器跳转、回调绑定、授权码及令牌校验等细节。</text>
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### 两行流程对比
|
|
307
|
-
|
|
308
|
-
上面一行放常规做法当背景,中间加 `<divider/>`,下面一行用胶囊突出真正想讲的循环。
|
|
309
|
-
|
|
310
|
-
```garden compose
|
|
311
|
-
<intent>
|
|
312
|
-
上面一行是交付顺序:理解需求、设计方案、开发上线。下面一行才是要强调的决策循环:提出假设、低成本验证、迭代或放弃。上面是背景,下面是重点。
|
|
313
|
-
</intent>
|
|
314
|
-
<row align="center">
|
|
315
|
-
<title align="center">理解需求</title>
|
|
316
|
-
<arrow dir="right"/>
|
|
317
|
-
<title align="center">设计方案</title>
|
|
318
|
-
<arrow dir="right"/>
|
|
319
|
-
<title align="center">开发上线</title>
|
|
320
|
-
</row>
|
|
321
|
-
<divider/>
|
|
322
|
-
<row align="center">
|
|
323
|
-
<pill tone="muted">提出假设</pill>
|
|
324
|
-
<arrow dir="right"/>
|
|
325
|
-
<pill tone="muted">低成本验证</pill>
|
|
326
|
-
<arrow dir="right"/>
|
|
327
|
-
<pill tone="muted">迭代或放弃</pill>
|
|
328
|
-
</row>
|
|
329
|
-
<text tone="muted">第二行才是产品探索更强调的决策循环。</text>
|
|
330
|
-
```
|
|
331
|
-
|
|
332
113
|
## 可调参数(play)
|
|
333
114
|
|
|
334
|
-
静态说明图还差一步、读者要拧参数时,仍写 `garden compose
|
|
115
|
+
静态说明图还差一步、读者要拧参数时,仍写 `garden compose`:
|
|
335
116
|
|
|
336
117
|
- `{@body const [n, setN] = DIL.useState(3)}` 声明状态
|
|
337
118
|
- `{@body const total = n * 24}` 派生值
|
|
@@ -339,7 +120,7 @@ Role 在中间,把用户和权限接起来。Role 是重点。
|
|
|
339
120
|
- `{#if …}{:else}{/if}`、`{#each … as item, i}{/each}` 控制流
|
|
340
121
|
- 小写控件:`<slider>`、`<choice>`、`<button>`、`<pie>` / `<chart>`、`<stat>`
|
|
341
122
|
|
|
342
|
-
旧的 `garden interactive` 与 PascalCase
|
|
123
|
+
旧的 `garden interactive` 与 PascalCase 仅作兼容。完整映射见仓库 `docs/compose-dil.md`。
|
|
343
124
|
|
|
344
125
|
```garden compose #compose-play-demo
|
|
345
126
|
caption: 拧一下席位,看月费。
|
|
@@ -351,4 +132,3 @@ intent: |
|
|
|
351
132
|
<slider min={1} max={12} value={seats} onChange={setSeats} label="席位" />
|
|
352
133
|
<stat label="月费" value={total} unit="USD" />
|
|
353
134
|
```
|
|
354
|
-
|