@joplo-app/kit 0.2.7 → 0.2.8
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/dist/index.d.ts +52 -0
- package/dist/index.js +31 -0
- package/dist/ui.d.ts +170 -8
- package/dist/ui.js +67 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export type StateInit = {
|
|
|
21
21
|
inputs?: Record<string, Json>;
|
|
22
22
|
};
|
|
23
23
|
/** theme:默认主题名——内置主题(sketch、clean、blueprint、nord、dracula、solarized-light、terminal、kraft、contrast)或项目 themes/<name>.css(D51)。 */
|
|
24
|
+
/**
|
|
25
|
+
* autoFocus(D70):默认焦点行为(结果揭晓:本步新出现或变化的元素轻轻脉冲一次;进入新的一层时先全景再推近)。
|
|
26
|
+
* 缺省开启;写 false 整体关掉,演示只按作者写的 shot / trace / spotlight 等呈现。
|
|
27
|
+
*/
|
|
24
28
|
export type ConfigDef = {
|
|
25
29
|
kind: 'config';
|
|
26
30
|
name: string;
|
|
@@ -28,6 +32,7 @@ export type ConfigDef = {
|
|
|
28
32
|
theme?: string;
|
|
29
33
|
layout?: string;
|
|
30
34
|
home?: string;
|
|
35
|
+
autoFocus?: boolean;
|
|
31
36
|
source?: string;
|
|
32
37
|
};
|
|
33
38
|
export declare const config: (c: Omit<ConfigDef, "kind" | "source">) => ConfigDef;
|
|
@@ -188,7 +193,24 @@ export type EffectDef = {
|
|
|
188
193
|
target: string;
|
|
189
194
|
kindOf: 'circle' | 'underline' | 'box' | 'arrow';
|
|
190
195
|
note?: string;
|
|
196
|
+
} | {
|
|
197
|
+
kind: 'effect';
|
|
198
|
+
type: 'cue';
|
|
199
|
+
cue: 'spotlight' | 'highlight' | 'number';
|
|
200
|
+
targets: string[];
|
|
201
|
+
} | {
|
|
202
|
+
kind: 'effect';
|
|
203
|
+
type: 'callout';
|
|
204
|
+
target: string;
|
|
205
|
+
text: string;
|
|
206
|
+
side?: CalloutSide;
|
|
207
|
+
} | {
|
|
208
|
+
kind: 'effect';
|
|
209
|
+
type: 'hold';
|
|
210
|
+
seconds: number;
|
|
191
211
|
};
|
|
212
|
+
/** 标注气泡放在目标的哪一侧;不写时自动选画面里放得下的一侧(右、左、下、上)。 */
|
|
213
|
+
export type CalloutSide = 'top' | 'right' | 'bottom' | 'left';
|
|
192
214
|
export declare const set: (target: Bind, value: Json) => EffectDef;
|
|
193
215
|
export declare const push: (target: Bind, value: Json) => EffectDef;
|
|
194
216
|
/** 与 sonner 一致:toast('…')、toast.success('…')、toast.error('…')。 */
|
|
@@ -228,6 +250,36 @@ export declare const shot: (...targets: string[]) => EffectDef;
|
|
|
228
250
|
* .system('额度预检', '调用模型之前先预检额度', shot('billing'), explain('额度不足时在这里就拦下,不会产生模型费用'))
|
|
229
251
|
*/
|
|
230
252
|
export declare const explain: (text: string) => EffectDef;
|
|
253
|
+
/**
|
|
254
|
+
* 聚光:这一步只照亮这些元素,画面其余部分压暗(不遮挡、不拦截点击,下一步要点的元素也保持明亮)。
|
|
255
|
+
* 用于“这一屏信息很多,此刻只看这一块”。
|
|
256
|
+
* .system('额度不足', '额度不足,先拦下', spotlight('quota_alert'))
|
|
257
|
+
*/
|
|
258
|
+
export declare const spotlight: (...targets: string[]) => EffectDef;
|
|
259
|
+
/**
|
|
260
|
+
* 强调:给元素加一圈强调框并脉冲一次,画面其他部分不变。比 spotlight 轻,适合“注意这里变了 / 这里是关键”。
|
|
261
|
+
* .system('席位更新', '席位变成 12 / 15', highlight('seat_card'))
|
|
262
|
+
*/
|
|
263
|
+
export declare const highlight: (...targets: string[]) => EffectDef;
|
|
264
|
+
/**
|
|
265
|
+
* 编号:按参数顺序给元素标 1、2、3…,讲“这一屏由几部分组成 / 先后顺序”。建议一步不超过 5 个。
|
|
266
|
+
* .system('页面结构', '先看三块:输入、预览、发送', numbered('in_emails', 'mail_preview', 'btn_send'))
|
|
267
|
+
*/
|
|
268
|
+
export declare const numbered: (...targets: string[]) => EffectDef;
|
|
269
|
+
/**
|
|
270
|
+
* 标注气泡:指向元素的一句话(便签式说明),建议和字幕一样不超过 24 个字。字幕讲“发生了什么”,气泡讲“为什么在这里”。
|
|
271
|
+
* .system('行程单完成', '行程单生成完毕', callout('share', '生成完才能分享'))
|
|
272
|
+
* callout('btn_pay', '按比例只收 18 天', { side: 'left' })
|
|
273
|
+
*/
|
|
274
|
+
export declare const callout: (target: string, text: string, opts?: {
|
|
275
|
+
side?: CalloutSide;
|
|
276
|
+
}) => EffectDef;
|
|
277
|
+
/**
|
|
278
|
+
* 停留:自动播放时这一步至少停 seconds 秒(0.5–30,按播放速度缩放),给观众时间看画面(图表、对比、一大段结果)。
|
|
279
|
+
* 不写时按字幕字数自动计算。
|
|
280
|
+
* .system('对比两种结果', '左边是旧流程,右边是新流程', hold(5))
|
|
281
|
+
*/
|
|
282
|
+
export declare const hold: (seconds: number) => EffectDef;
|
|
231
283
|
/**
|
|
232
284
|
* 调用链(D48):这一步沿 Diagram 的连线走了哪条路径。节点与连线的 state 由每一步的 trace 自动推算,不用再手写 set / state 绑定:
|
|
233
285
|
* 本步 trace 到的是 active,之前 trace 过、本步没再 trace 的是 ok,trace.fail 的是 error(保持到之后又被 trace 成功),
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,37 @@ export const shot = (...targets) => ({ kind: 'effect', type: 'shot', targets });
|
|
|
80
80
|
* .system('额度预检', '调用模型之前先预检额度', shot('billing'), explain('额度不足时在这里就拦下,不会产生模型费用'))
|
|
81
81
|
*/
|
|
82
82
|
export const explain = (text) => ({ kind: 'effect', type: 'explain', text });
|
|
83
|
+
// ---------- 焦点与呈现形式(D70):这一步观众看哪里、用什么形式看 ----------
|
|
84
|
+
// 镜头(shot)负责“取景”:推近、跟随。下面这些只负责“强调”:都不推近镜头;目标不在当前镜头里时,镜头先退回整层。
|
|
85
|
+
// 都只作用于这一步(下一步消失),跳到任意一步、前后翻、回放结果一致。
|
|
86
|
+
/**
|
|
87
|
+
* 聚光:这一步只照亮这些元素,画面其余部分压暗(不遮挡、不拦截点击,下一步要点的元素也保持明亮)。
|
|
88
|
+
* 用于“这一屏信息很多,此刻只看这一块”。
|
|
89
|
+
* .system('额度不足', '额度不足,先拦下', spotlight('quota_alert'))
|
|
90
|
+
*/
|
|
91
|
+
export const spotlight = (...targets) => ({ kind: 'effect', type: 'cue', cue: 'spotlight', targets });
|
|
92
|
+
/**
|
|
93
|
+
* 强调:给元素加一圈强调框并脉冲一次,画面其他部分不变。比 spotlight 轻,适合“注意这里变了 / 这里是关键”。
|
|
94
|
+
* .system('席位更新', '席位变成 12 / 15', highlight('seat_card'))
|
|
95
|
+
*/
|
|
96
|
+
export const highlight = (...targets) => ({ kind: 'effect', type: 'cue', cue: 'highlight', targets });
|
|
97
|
+
/**
|
|
98
|
+
* 编号:按参数顺序给元素标 1、2、3…,讲“这一屏由几部分组成 / 先后顺序”。建议一步不超过 5 个。
|
|
99
|
+
* .system('页面结构', '先看三块:输入、预览、发送', numbered('in_emails', 'mail_preview', 'btn_send'))
|
|
100
|
+
*/
|
|
101
|
+
export const numbered = (...targets) => ({ kind: 'effect', type: 'cue', cue: 'number', targets });
|
|
102
|
+
/**
|
|
103
|
+
* 标注气泡:指向元素的一句话(便签式说明),建议和字幕一样不超过 24 个字。字幕讲“发生了什么”,气泡讲“为什么在这里”。
|
|
104
|
+
* .system('行程单完成', '行程单生成完毕', callout('share', '生成完才能分享'))
|
|
105
|
+
* callout('btn_pay', '按比例只收 18 天', { side: 'left' })
|
|
106
|
+
*/
|
|
107
|
+
export const callout = (target, text, opts = {}) => ({ kind: 'effect', type: 'callout', target, text, ...(opts.side ? { side: opts.side } : {}) });
|
|
108
|
+
/**
|
|
109
|
+
* 停留:自动播放时这一步至少停 seconds 秒(0.5–30,按播放速度缩放),给观众时间看画面(图表、对比、一大段结果)。
|
|
110
|
+
* 不写时按字幕字数自动计算。
|
|
111
|
+
* .system('对比两种结果', '左边是旧流程,右边是新流程', hold(5))
|
|
112
|
+
*/
|
|
113
|
+
export const hold = (seconds) => ({ kind: 'effect', type: 'hold', seconds });
|
|
83
114
|
/**
|
|
84
115
|
* 调用链(D48):这一步沿 Diagram 的连线走了哪条路径。节点与连线的 state 由每一步的 trace 自动推算,不用再手写 set / state 绑定:
|
|
85
116
|
* 本步 trace 到的是 active,之前 trace 过、本步没再 trace 的是 ok,trace.fail 的是 error(保持到之后又被 trace 成功),
|
package/dist/ui.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* 布局写成属性:<Stack gap="md">、<Group justify="space-between">、<SimpleGrid cols={{ base: 1, md: 3 }}>,
|
|
4
4
|
* 不需要 className;响应式对象与 visibleFrom / hiddenFrom 按舞台宽度生效。
|
|
5
5
|
*
|
|
6
|
-
* 另可加 Joplo 属性:id(可操作元素必填)、when(可见条件)、disabled(布尔或条件)、disabledReason、unmodeled、note
|
|
6
|
+
* 另可加 Joplo 属性:id(可操作元素必填)、when(可见条件)、disabled(布尔或条件)、disabledReason、unmodeled、note、
|
|
7
|
+
* redact(布尔或条件:内容模糊显示,用于密钥、隐私信息,D70)。
|
|
7
8
|
* 行为(点击后发生什么)不写在组件上,写在 option 的 flow 步骤里。浮层用 Modal / Drawer 的 opened={$.ui.x} 控制。
|
|
8
9
|
*
|
|
9
10
|
* 组件清单与 @joplo-app/core 的 COMPONENT_TYPES 一一对应(core/test/catalog.test.ts 检查)。
|
|
@@ -26,6 +27,8 @@ export type JoploProps = {
|
|
|
26
27
|
disabledReason?: string | Bind;
|
|
27
28
|
unmodeled?: boolean;
|
|
28
29
|
note?: string;
|
|
30
|
+
/** 敏感信息(D70):内容模糊显示、布局不变;可以写条件(redact={not($.ui.revealed)}),点“显示”后再看清。 */
|
|
31
|
+
redact?: boolean | Bind | CondExpr;
|
|
29
32
|
visibleFrom?: Size;
|
|
30
33
|
hiddenFrom?: Size;
|
|
31
34
|
/** 逃生口:Tailwind 类名。优先使用布局组件与样式属性。 */
|
|
@@ -68,7 +71,9 @@ export declare const List: C & {
|
|
|
68
71
|
Item: C;
|
|
69
72
|
};
|
|
70
73
|
export declare const Badge: C;
|
|
71
|
-
export declare const Avatar: C
|
|
74
|
+
export declare const Avatar: C & {
|
|
75
|
+
Group: C;
|
|
76
|
+
};
|
|
72
77
|
export declare const Image: C;
|
|
73
78
|
export declare const ThemeIcon: C;
|
|
74
79
|
export declare const Indicator: C;
|
|
@@ -100,6 +105,7 @@ export declare const MultiSelect: C;
|
|
|
100
105
|
export declare const Checkbox: C;
|
|
101
106
|
export declare const Radio: C & {
|
|
102
107
|
Group: C;
|
|
108
|
+
Card: C;
|
|
103
109
|
};
|
|
104
110
|
export declare const Switch: C;
|
|
105
111
|
export declare const SegmentedControl: C;
|
|
@@ -155,14 +161,170 @@ export declare const Terminal: C & {
|
|
|
155
161
|
};
|
|
156
162
|
/** 手机外框:子节点按手机宽度排版。页面写 viewport: 'mobile' 时舞台会自动套上,不用写它。 */
|
|
157
163
|
export declare const Phone: C;
|
|
164
|
+
/** 节点 kind(决定图标与外形)。 */
|
|
165
|
+
export type DiagramKind = 'client' | 'service' | 'model' | 'database' | 'queue' | 'storage' | 'external' | 'tool' | 'user';
|
|
166
|
+
/** 分组图标:节点 kind 之外再加几种常用的“域”图标。 */
|
|
167
|
+
export type DiagramIcon = DiagramKind | 'cloud' | 'gateway' | 'lock' | 'network' | 'device' | 'box' | 'brain';
|
|
168
|
+
/** 分组色调(跟随主题:blue = --jp-info,green = --jp-ok,orange = --jp-warn,red = --jp-danger)。 */
|
|
169
|
+
export type DiagramTone = 'gray' | 'blue' | 'green' | 'orange' | 'red' | 'purple' | 'teal';
|
|
170
|
+
type DState = 'idle' | 'active' | 'ok' | 'error' | 'dim';
|
|
171
|
+
type Common = JoploProps;
|
|
172
|
+
/** 布局提示:pin 把元素放到所在分组(或整张图)的第一层 / 最后一层;同层顺序就是源码顺序。 */
|
|
173
|
+
type Hints = {
|
|
174
|
+
pin?: 'start' | 'end';
|
|
175
|
+
};
|
|
176
|
+
/** direction 不写 = 按舞台比例自动选(D69 补充);aspect = 想要的外框宽高比(缺省按舞台与 h 推算)。 */
|
|
177
|
+
export type DiagramProps = Common & {
|
|
178
|
+
id?: string;
|
|
179
|
+
direction?: 'right' | 'down';
|
|
180
|
+
h?: number | string;
|
|
181
|
+
aspect?: number;
|
|
182
|
+
};
|
|
183
|
+
export type DiagramGroupProps = Common & Hints & {
|
|
184
|
+
id?: string;
|
|
185
|
+
label?: string;
|
|
186
|
+
icon?: DiagramIcon;
|
|
187
|
+
tone?: DiagramTone;
|
|
188
|
+
group?: string;
|
|
189
|
+
};
|
|
190
|
+
export type DiagramNodeProps = Common & Hints & {
|
|
191
|
+
id: string;
|
|
192
|
+
label?: string | Bind;
|
|
193
|
+
description?: string | Bind;
|
|
194
|
+
kind?: DiagramKind;
|
|
195
|
+
group?: string;
|
|
196
|
+
state?: DState | Bind;
|
|
197
|
+
};
|
|
198
|
+
export type DiagramEdgeProps = Common & {
|
|
199
|
+
id?: string;
|
|
200
|
+
from: string;
|
|
201
|
+
to: string;
|
|
202
|
+
label?: string | Bind;
|
|
203
|
+
async?: boolean;
|
|
204
|
+
state?: DState | Bind;
|
|
205
|
+
};
|
|
158
206
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
207
|
+
* 架构图(D41 / D69):布局在编译期算好(ELK 分层 + 分组 + 正交走线),每一步坐标都相同。按业务域分组:
|
|
208
|
+
* <Diagram id="arch" h="100%"> // 不写 direction:按舞台比例自动选
|
|
209
|
+
* <Diagram.Group id="gw" label="网关" icon="gateway" tone="blue"><Diagram.Node id="api" label="API" kind="service" /></Diagram.Group>
|
|
210
|
+
* <Diagram.Group id="data" label="存储" icon="database"><Diagram.Node id="pg" label="PostgreSQL" kind="database" /></Diagram.Group>
|
|
211
|
+
* <Diagram.Edge from="api" to="pg" label="读写" /> // 连线也可以连到分组:to="data"
|
|
212
|
+
* </Diagram>
|
|
213
|
+
* 节点也可以不嵌套、用 group="data" 归到分组里。调用链用步骤里的 trace('api', 'pg'),不要手写 state。
|
|
161
214
|
*/
|
|
162
|
-
export declare const Diagram:
|
|
163
|
-
Group:
|
|
164
|
-
Node:
|
|
165
|
-
Edge:
|
|
215
|
+
export declare const Diagram: ((p: DiagramProps) => any) & {
|
|
216
|
+
Group: (p: DiagramGroupProps) => any;
|
|
217
|
+
Node: (p: DiagramNodeProps) => any;
|
|
218
|
+
Edge: (p: DiagramEdgeProps) => any;
|
|
219
|
+
};
|
|
220
|
+
export type StateMachineProps = Common & {
|
|
221
|
+
id?: string;
|
|
222
|
+
direction?: 'right' | 'down';
|
|
223
|
+
h?: number | string;
|
|
224
|
+
aspect?: number;
|
|
225
|
+
value?: string | Bind;
|
|
226
|
+
};
|
|
227
|
+
export type StateProps = Common & Hints & {
|
|
228
|
+
id: string;
|
|
229
|
+
label?: string | Bind;
|
|
230
|
+
description?: string | Bind;
|
|
231
|
+
initial?: boolean;
|
|
232
|
+
final?: boolean;
|
|
233
|
+
group?: string;
|
|
234
|
+
state?: DState | Bind;
|
|
235
|
+
};
|
|
236
|
+
export type TransitionProps = Common & {
|
|
237
|
+
id?: string;
|
|
238
|
+
from: string;
|
|
239
|
+
to: string;
|
|
240
|
+
label?: string | Bind;
|
|
241
|
+
state?: DState | Bind;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* 状态机(D69):实体的生命周期。value 绑定当前状态(高亮);这一步 value 变化时,对应的转换自动点亮。
|
|
245
|
+
* <StateMachine id="order" value={$.data.order.status}>
|
|
246
|
+
* <StateMachine.State id="created" label="已创建" initial />
|
|
247
|
+
* <StateMachine.State id="paid" label="已支付" />
|
|
248
|
+
* <StateMachine.State id="closed" label="已关闭" final />
|
|
249
|
+
* <StateMachine.Transition from="created" to="paid" label="支付成功" />
|
|
250
|
+
* <StateMachine.Transition from="created" to="closed" label="超时 30 分钟" />
|
|
251
|
+
* </StateMachine>
|
|
252
|
+
*/
|
|
253
|
+
export declare const StateMachine: ((p: StateMachineProps) => any) & {
|
|
254
|
+
Group: (p: DiagramGroupProps) => any;
|
|
255
|
+
State: (p: StateProps) => any;
|
|
256
|
+
Transition: (p: TransitionProps) => any;
|
|
257
|
+
};
|
|
258
|
+
export type SequenceProps = Common & {
|
|
259
|
+
id?: string;
|
|
260
|
+
h?: number | string;
|
|
261
|
+
numbered?: boolean;
|
|
262
|
+
};
|
|
263
|
+
export type ActorProps = Common & {
|
|
264
|
+
id: string;
|
|
265
|
+
label?: string | Bind;
|
|
266
|
+
description?: string | Bind;
|
|
267
|
+
kind?: DiagramKind;
|
|
268
|
+
state?: DState | Bind;
|
|
269
|
+
};
|
|
270
|
+
export type MessageProps = Common & {
|
|
271
|
+
id?: string;
|
|
272
|
+
from: string;
|
|
273
|
+
to: string;
|
|
274
|
+
label?: string | Bind;
|
|
275
|
+
reply?: boolean;
|
|
276
|
+
async?: boolean;
|
|
277
|
+
state?: DState | Bind;
|
|
278
|
+
};
|
|
279
|
+
export type BlockProps = Common & {
|
|
280
|
+
id?: string;
|
|
281
|
+
label?: string;
|
|
282
|
+
kind?: 'alt' | 'opt' | 'loop' | 'par' | 'break' | 'critical';
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* 时序图(D69):一次调用链按时间先后。参与者按源码顺序成列,消息按源码顺序成行,自动编号;
|
|
286
|
+
* 步骤里 trace('m_login') 点亮这一行(之前的变为完成),镜头对准这一行。
|
|
287
|
+
* <Sequence id="login">
|
|
288
|
+
* <Sequence.Group label="客户端"><Sequence.Actor id="web" label="Web" kind="client" /></Sequence.Group>
|
|
289
|
+
* <Sequence.Actor id="api" label="API" /><Sequence.Actor id="db" label="DB" kind="database" />
|
|
290
|
+
* <Sequence.Message id="m_login" from="web" to="api" label="POST /login" />
|
|
291
|
+
* <Sequence.Block kind="alt" label="密码错误"><Sequence.Message id="m_401" from="api" to="web" label="401" reply /></Sequence.Block>
|
|
292
|
+
* </Sequence>
|
|
293
|
+
*/
|
|
294
|
+
export declare const Sequence: ((p: SequenceProps) => any) & {
|
|
295
|
+
Group: (p: Common & {
|
|
296
|
+
id?: string;
|
|
297
|
+
label?: string;
|
|
298
|
+
icon?: DiagramIcon;
|
|
299
|
+
}) => any;
|
|
300
|
+
Actor: (p: ActorProps) => any;
|
|
301
|
+
Message: (p: MessageProps) => any;
|
|
302
|
+
Block: (p: BlockProps) => any;
|
|
303
|
+
};
|
|
304
|
+
/** 空状态 / 结果页:`<EmptyState icon="✉" title="还没有成员" description="邀请同事一起协作"><Button id="invite">邀请成员</Button></EmptyState>`。 */
|
|
305
|
+
export declare const EmptyState: C;
|
|
306
|
+
/** 列表行:`<ListRow avatar="阿杰" title="阿杰" description="已确认"><Badge>成员</Badge></ListRow>`;右侧内容放在子节点里。 */
|
|
307
|
+
export declare const ListRow: C;
|
|
308
|
+
/** 指标卡:`<Stat label="本月注册" value={$.data.signups} diff="+12%" />`。 */
|
|
309
|
+
export declare const Stat: C;
|
|
310
|
+
/** 键值清单:`<KeyValue items={[{ label: '席位', value: '5 个' }, { label: '合计', value: '¥ 450' }]} total />`。 */
|
|
311
|
+
export declare const KeyValue: C;
|
|
312
|
+
/** 低保真图表(对齐 @mantine/charts):`<BarChart data={$.data.weeks} dataKey="week" series={[{ name: 'signups', label: '注册' }]} />`。 */
|
|
313
|
+
export declare const BarChart: C;
|
|
314
|
+
export declare const LineChart: C;
|
|
315
|
+
/**
|
|
316
|
+
* 菜单(对齐 Mantine):opened 写在 Menu 上,下拉只在为真时出现。
|
|
317
|
+
* `<Menu opened={$.ui.rowMenu}><Menu.Target><ActionIcon id="row_more" aria-label="更多">⋯</ActionIcon></Menu.Target>
|
|
318
|
+
* <Menu.Dropdown><Menu.Item id="revoke" color="red">撤销邀请</Menu.Item></Menu.Dropdown></Menu>`
|
|
319
|
+
*/
|
|
320
|
+
export declare const Menu: C & {
|
|
321
|
+
Target: C;
|
|
322
|
+
Dropdown: C;
|
|
323
|
+
Item: C;
|
|
324
|
+
Label: C;
|
|
325
|
+
Divider: C;
|
|
166
326
|
};
|
|
327
|
+
/** 手机底部标签栏:`<TabBar id="tabs" aria-label="底部导航" value={$.ui.tab} data={[{ value: 'home', label: '首页', icon: '⌂' }]} />`,select 切换。 */
|
|
328
|
+
export declare const TabBar: C;
|
|
167
329
|
export declare const Placeholder: C;
|
|
168
330
|
export declare const Custom: C;
|
package/dist/ui.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* 布局写成属性:<Stack gap="md">、<Group justify="space-between">、<SimpleGrid cols={{ base: 1, md: 3 }}>,
|
|
4
4
|
* 不需要 className;响应式对象与 visibleFrom / hiddenFrom 按舞台宽度生效。
|
|
5
5
|
*
|
|
6
|
-
* 另可加 Joplo 属性:id(可操作元素必填)、when(可见条件)、disabled(布尔或条件)、disabledReason、unmodeled、note
|
|
6
|
+
* 另可加 Joplo 属性:id(可操作元素必填)、when(可见条件)、disabled(布尔或条件)、disabledReason、unmodeled、note、
|
|
7
|
+
* redact(布尔或条件:内容模糊显示,用于密钥、隐私信息,D70)。
|
|
7
8
|
* 行为(点击后发生什么)不写在组件上,写在 option 的 flow 步骤里。浮层用 Modal / Drawer 的 opened={$.ui.x} 控制。
|
|
8
9
|
*
|
|
9
10
|
* 组件清单与 @joplo-app/core 的 COMPONENT_TYPES 一一对应(core/test/catalog.test.ts 检查)。
|
|
@@ -39,7 +40,7 @@ export const Kbd = c('Kbd');
|
|
|
39
40
|
export const Blockquote = c('Blockquote');
|
|
40
41
|
export const List = Object.assign(c('List'), { Item: c('List.Item') });
|
|
41
42
|
export const Badge = c('Badge');
|
|
42
|
-
export const Avatar = c('Avatar');
|
|
43
|
+
export const Avatar = Object.assign(c('Avatar'), { Group: c('Avatar.Group') });
|
|
43
44
|
export const Image = c('Image');
|
|
44
45
|
export const ThemeIcon = c('ThemeIcon');
|
|
45
46
|
export const Indicator = c('Indicator');
|
|
@@ -68,7 +69,7 @@ export const Textarea = c('Textarea');
|
|
|
68
69
|
export const Select = c('Select');
|
|
69
70
|
export const MultiSelect = c('MultiSelect');
|
|
70
71
|
export const Checkbox = c('Checkbox');
|
|
71
|
-
export const Radio = Object.assign(c('Radio'), { Group: c('Radio.Group') });
|
|
72
|
+
export const Radio = Object.assign(c('Radio'), { Group: c('Radio.Group'), Card: c('Radio.Card') });
|
|
72
73
|
export const Switch = c('Switch');
|
|
73
74
|
export const SegmentedControl = c('SegmentedControl');
|
|
74
75
|
export const FileInput = c('FileInput');
|
|
@@ -115,12 +116,71 @@ export const Artifact = Object.assign(c('Artifact'), { Ref: c('Artifact.Ref') })
|
|
|
115
116
|
export const Terminal = Object.assign(c('Terminal'), { Command: c('Terminal.Command'), Output: c('Terminal.Output'), Input: c('Terminal.Input') });
|
|
116
117
|
/** 手机外框:子节点按手机宽度排版。页面写 viewport: 'mobile' 时舞台会自动套上,不用写它。 */
|
|
117
118
|
export const Phone = c('Phone');
|
|
118
|
-
// ---------- 架构图(Joplo 自有,D41) ----------
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
120
|
+
* 架构图(D41 / D69):布局在编译期算好(ELK 分层 + 分组 + 正交走线),每一步坐标都相同。按业务域分组:
|
|
121
|
+
* <Diagram id="arch" h="100%"> // 不写 direction:按舞台比例自动选
|
|
122
|
+
* <Diagram.Group id="gw" label="网关" icon="gateway" tone="blue"><Diagram.Node id="api" label="API" kind="service" /></Diagram.Group>
|
|
123
|
+
* <Diagram.Group id="data" label="存储" icon="database"><Diagram.Node id="pg" label="PostgreSQL" kind="database" /></Diagram.Group>
|
|
124
|
+
* <Diagram.Edge from="api" to="pg" label="读写" /> // 连线也可以连到分组:to="data"
|
|
125
|
+
* </Diagram>
|
|
126
|
+
* 节点也可以不嵌套、用 group="data" 归到分组里。调用链用步骤里的 trace('api', 'pg'),不要手写 state。
|
|
122
127
|
*/
|
|
123
|
-
export const Diagram = Object.assign(c('Diagram'), {
|
|
128
|
+
export const Diagram = Object.assign(c('Diagram'), {
|
|
129
|
+
Group: c('Diagram.Group'),
|
|
130
|
+
Node: c('Diagram.Node'),
|
|
131
|
+
Edge: c('Diagram.Edge'),
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* 状态机(D69):实体的生命周期。value 绑定当前状态(高亮);这一步 value 变化时,对应的转换自动点亮。
|
|
135
|
+
* <StateMachine id="order" value={$.data.order.status}>
|
|
136
|
+
* <StateMachine.State id="created" label="已创建" initial />
|
|
137
|
+
* <StateMachine.State id="paid" label="已支付" />
|
|
138
|
+
* <StateMachine.State id="closed" label="已关闭" final />
|
|
139
|
+
* <StateMachine.Transition from="created" to="paid" label="支付成功" />
|
|
140
|
+
* <StateMachine.Transition from="created" to="closed" label="超时 30 分钟" />
|
|
141
|
+
* </StateMachine>
|
|
142
|
+
*/
|
|
143
|
+
export const StateMachine = Object.assign(c('StateMachine'), {
|
|
144
|
+
Group: c('StateMachine.Group'),
|
|
145
|
+
State: c('StateMachine.State'),
|
|
146
|
+
Transition: c('StateMachine.Transition'),
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* 时序图(D69):一次调用链按时间先后。参与者按源码顺序成列,消息按源码顺序成行,自动编号;
|
|
150
|
+
* 步骤里 trace('m_login') 点亮这一行(之前的变为完成),镜头对准这一行。
|
|
151
|
+
* <Sequence id="login">
|
|
152
|
+
* <Sequence.Group label="客户端"><Sequence.Actor id="web" label="Web" kind="client" /></Sequence.Group>
|
|
153
|
+
* <Sequence.Actor id="api" label="API" /><Sequence.Actor id="db" label="DB" kind="database" />
|
|
154
|
+
* <Sequence.Message id="m_login" from="web" to="api" label="POST /login" />
|
|
155
|
+
* <Sequence.Block kind="alt" label="密码错误"><Sequence.Message id="m_401" from="api" to="web" label="401" reply /></Sequence.Block>
|
|
156
|
+
* </Sequence>
|
|
157
|
+
*/
|
|
158
|
+
export const Sequence = Object.assign(c('Sequence'), {
|
|
159
|
+
Group: c('Sequence.Group'),
|
|
160
|
+
Actor: c('Sequence.Actor'),
|
|
161
|
+
Message: c('Sequence.Message'),
|
|
162
|
+
Block: c('Sequence.Block'),
|
|
163
|
+
});
|
|
164
|
+
// ---------- 产品界面(D68) ----------
|
|
165
|
+
/** 空状态 / 结果页:`<EmptyState icon="✉" title="还没有成员" description="邀请同事一起协作"><Button id="invite">邀请成员</Button></EmptyState>`。 */
|
|
166
|
+
export const EmptyState = c('EmptyState');
|
|
167
|
+
/** 列表行:`<ListRow avatar="阿杰" title="阿杰" description="已确认"><Badge>成员</Badge></ListRow>`;右侧内容放在子节点里。 */
|
|
168
|
+
export const ListRow = c('ListRow');
|
|
169
|
+
/** 指标卡:`<Stat label="本月注册" value={$.data.signups} diff="+12%" />`。 */
|
|
170
|
+
export const Stat = c('Stat');
|
|
171
|
+
/** 键值清单:`<KeyValue items={[{ label: '席位', value: '5 个' }, { label: '合计', value: '¥ 450' }]} total />`。 */
|
|
172
|
+
export const KeyValue = c('KeyValue');
|
|
173
|
+
/** 低保真图表(对齐 @mantine/charts):`<BarChart data={$.data.weeks} dataKey="week" series={[{ name: 'signups', label: '注册' }]} />`。 */
|
|
174
|
+
export const BarChart = c('BarChart');
|
|
175
|
+
export const LineChart = c('LineChart');
|
|
176
|
+
/**
|
|
177
|
+
* 菜单(对齐 Mantine):opened 写在 Menu 上,下拉只在为真时出现。
|
|
178
|
+
* `<Menu opened={$.ui.rowMenu}><Menu.Target><ActionIcon id="row_more" aria-label="更多">⋯</ActionIcon></Menu.Target>
|
|
179
|
+
* <Menu.Dropdown><Menu.Item id="revoke" color="red">撤销邀请</Menu.Item></Menu.Dropdown></Menu>`
|
|
180
|
+
*/
|
|
181
|
+
export const Menu = Object.assign(c('Menu'), { Target: c('Menu.Target'), Dropdown: c('Menu.Dropdown'), Item: c('Menu.Item'), Label: c('Menu.Label'), Divider: c('Menu.Divider') });
|
|
182
|
+
/** 手机底部标签栏:`<TabBar id="tabs" aria-label="底部导航" value={$.ui.tab} data={[{ value: 'home', label: '首页', icon: '⌂' }]} />`,select 切换。 */
|
|
183
|
+
export const TabBar = c('TabBar');
|
|
124
184
|
// ---------- Joplo ----------
|
|
125
185
|
export const Placeholder = c('Placeholder');
|
|
126
186
|
export const Custom = c('Custom');
|