@sparkelf/dsh-genui 0.0.0-stage → 0.11.4-patch.2
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/CHANGELOG.md +597 -0
- package/LICENSE +21 -0
- package/README.md +292 -2
- package/README.zh-CN.md +307 -0
- package/SKILL.md +261 -0
- package/cordis.patch.yml +9 -0
- package/demo-prompts.md +118 -0
- package/lib/assets/echarts-core.js +43 -0
- package/lib/assets/echarts-full.js +72 -0
- package/lib/assets/mermaid.js +3591 -0
- package/lib/assets/standalone-runtime.js +1506 -0
- package/lib/assets/three.js +3844 -0
- package/lib/client.js +405 -0
- package/lib/index.js +5187 -0
- package/lib/invariant.js +19 -0
- package/lib/types/client/EChartNode.d.ts +13 -0
- package/lib/types/client/ErrorBoundary.d.ts +30 -0
- package/lib/types/client/GenuiBlock.d.ts +9 -0
- package/lib/types/client/PlotBlock.d.ts +44 -0
- package/lib/types/client/TemplateDrawer.d.ts +7 -0
- package/lib/types/client/achievement-store.d.ts +35 -0
- package/lib/types/client/achievement-toast.d.ts +2 -0
- package/lib/types/client/achievements.d.ts +63 -0
- package/lib/types/client/action-context.d.ts +7 -0
- package/lib/types/client/artifact/ExportableGenuiBlock.d.ts +6 -0
- package/lib/types/client/artifact/create.d.ts +5 -0
- package/lib/types/client/artifact/download.d.ts +9 -0
- package/lib/types/client/artifact/html.d.ts +5 -0
- package/lib/types/client/artifact/index.d.ts +8 -0
- package/lib/types/client/artifact/json.d.ts +3 -0
- package/lib/types/client/artifact/parse.d.ts +3 -0
- package/lib/types/client/artifact/portability.d.ts +4 -0
- package/lib/types/client/artifact/standalone-theme.d.ts +2 -0
- package/lib/types/client/artifact/types.d.ts +33 -0
- package/lib/types/client/asset-echarts-core.d.ts +1 -0
- package/lib/types/client/asset-echarts.d.ts +17 -0
- package/lib/types/client/asset-loader.d.ts +33 -0
- package/lib/types/client/asset-mermaid.d.ts +1 -0
- package/lib/types/client/asset-three.d.ts +1 -0
- package/lib/types/client/blocks/advanced.d.ts +101 -0
- package/lib/types/client/blocks/basic.d.ts +22 -0
- package/lib/types/client/blocks/charts.d.ts +53 -0
- package/lib/types/client/blocks/checkbox.d.ts +17 -0
- package/lib/types/client/blocks/diagram/geometry.d.ts +73 -0
- package/lib/types/client/blocks/diagram/index.d.ts +5 -0
- package/lib/types/client/blocks/diagram/layout.d.ts +41 -0
- package/lib/types/client/blocks/diagram/theme.d.ts +37 -0
- package/lib/types/client/blocks/forms.d.ts +77 -0
- package/lib/types/client/blocks/image.d.ts +6 -0
- package/lib/types/client/blocks/render-node.d.ts +10 -0
- package/lib/types/client/blocks/state.d.ts +63 -0
- package/lib/types/client/blocks/svg.d.ts +4 -0
- package/lib/types/client/dom-fence.d.ts +30 -0
- package/lib/types/client/echarts-engine.d.ts +4 -0
- package/lib/types/client/echarts-lazy.d.ts +18 -0
- package/lib/types/client/embed.d.ts +10 -0
- package/lib/types/client/fence-render.d.ts +106 -0
- package/lib/types/client/gallery.d.ts +7 -0
- package/lib/types/client/genui-runtime/diagnostics.d.ts +18 -0
- package/lib/types/client/genui-runtime/index.d.ts +1 -0
- package/lib/types/client/genui-runtime/limits.d.ts +54 -0
- package/lib/types/client/genui-runtime/normalize.d.ts +15 -0
- package/lib/types/client/genui-runtime/schema.d.ts +87 -0
- package/lib/types/client/genui-runtime/value-utils.d.ts +18 -0
- package/lib/types/client/guard.d.ts +144 -0
- package/lib/types/client/i18n/en.d.ts +307 -0
- package/lib/types/client/i18n/index.d.ts +44 -0
- package/lib/types/client/i18n/runtime.d.ts +64 -0
- package/lib/types/client/i18n/zh.d.ts +8 -0
- package/lib/types/client/index.d.ts +36 -0
- package/lib/types/client/inline.d.ts +5 -0
- package/lib/types/client/interaction-store.d.ts +48 -0
- package/lib/types/client/mermaid-core.d.ts +8 -0
- package/lib/types/client/mermaid-lazy.d.ts +9 -0
- package/lib/types/client/mermaid-safe.d.ts +52 -0
- package/lib/types/client/panel-command.d.ts +34 -0
- package/lib/types/client/panel-store.d.ts +94 -0
- package/lib/types/client/panel.d.ts +18 -0
- package/lib/types/client/parse-partial.d.ts +63 -0
- package/lib/types/client/primitive-adapter.d.ts +4 -0
- package/lib/types/client/primitive-labels.d.ts +18 -0
- package/lib/types/client/safe-math.d.ts +43 -0
- package/lib/types/client/scene3d-core.d.ts +21 -0
- package/lib/types/client/scene3d-lazy.d.ts +8 -0
- package/lib/types/client/session-resolver.d.ts +8 -0
- package/lib/types/client/source-fence.d.ts +29 -0
- package/lib/types/client/spec.d.ts +709 -0
- package/lib/types/client/standalone/asset-loader.d.ts +2 -0
- package/lib/types/client/standalone/bootstrap-types.d.ts +9 -0
- package/lib/types/client/standalone/katex-style.d.ts +1 -0
- package/lib/types/client/standalone/primitive-adapter.d.ts +54 -0
- package/lib/types/client/standalone/runtime.d.ts +2 -0
- package/lib/types/client/submission-registry.d.ts +51 -0
- package/lib/types/client/svg-fence.d.ts +2 -0
- package/lib/types/client/table-details.d.ts +20 -0
- package/lib/types/client/templates.d.ts +41 -0
- package/lib/types/client/toolview.d.ts +7 -0
- package/lib/types/client/walk-spec.d.ts +3 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/plugin/chart-contract.d.ts +9 -0
- package/lib/types/plugin/fence-feedback.d.ts +151 -0
- package/lib/types/plugin/genui-diagnostic.d.ts +13 -0
- package/lib/types/plugin/index.d.ts +35 -0
- package/lib/types/plugin/inline-content-diagnostic.d.ts +8 -0
- package/lib/types/plugin/invariant.d.ts +15 -0
- package/lib/types/plugin/tool.d.ts +27 -0
- package/lib/types/shared/fence-repair.d.ts +78 -0
- package/lib/types/shared/fence-resolve.d.ts +39 -0
- package/package.json +249 -4
- package/src/client/EChartNode.tsx +466 -0
- package/src/client/ErrorBoundary.tsx +67 -0
- package/src/client/GenuiBlock.module.css +2221 -0
- package/src/client/GenuiBlock.tsx +235 -0
- package/src/client/PlotBlock.module.css +171 -0
- package/src/client/PlotBlock.tsx +492 -0
- package/src/client/TemplateDrawer.module.css +152 -0
- package/src/client/TemplateDrawer.tsx +147 -0
- package/src/client/achievement-store.ts +151 -0
- package/src/client/achievement-toast.tsx +71 -0
- package/src/client/achievements.ts +160 -0
- package/src/client/action-context.ts +32 -0
- package/src/client/artifact/ArtifactExport.module.css +64 -0
- package/src/client/artifact/ExportableGenuiBlock.tsx +100 -0
- package/src/client/artifact/create.ts +69 -0
- package/src/client/artifact/download.ts +42 -0
- package/src/client/artifact/html.ts +157 -0
- package/src/client/artifact/index.ts +15 -0
- package/src/client/artifact/json.ts +6 -0
- package/src/client/artifact/parse.ts +32 -0
- package/src/client/artifact/portability.ts +47 -0
- package/src/client/artifact/standalone-theme.ts +94 -0
- package/src/client/artifact/types.ts +44 -0
- package/src/client/asset-echarts-core.ts +39 -0
- package/src/client/asset-echarts.ts +27 -0
- package/src/client/asset-loader.ts +96 -0
- package/src/client/asset-mermaid.ts +13 -0
- package/src/client/asset-three.ts +12 -0
- package/src/client/blocks/advanced.tsx +537 -0
- package/src/client/blocks/basic.tsx +121 -0
- package/src/client/blocks/charts.tsx +999 -0
- package/src/client/blocks/checkbox.tsx +61 -0
- package/src/client/blocks/diagram/geometry.ts +151 -0
- package/src/client/blocks/diagram/index.tsx +293 -0
- package/src/client/blocks/diagram/layout.ts +202 -0
- package/src/client/blocks/diagram/theme.ts +127 -0
- package/src/client/blocks/forms.tsx +531 -0
- package/src/client/blocks/image.tsx +28 -0
- package/src/client/blocks/render-node.tsx +494 -0
- package/src/client/blocks/state.ts +65 -0
- package/src/client/blocks/svg.tsx +66 -0
- package/src/client/dom-fence.tsx +1123 -0
- package/src/client/echarts-engine.ts +9 -0
- package/src/client/echarts-lazy.ts +41 -0
- package/src/client/embed.ts +19 -0
- package/src/client/fence-render.tsx +266 -0
- package/src/client/gallery.ts +215 -0
- package/src/client/genui-runtime/diagnostics.ts +165 -0
- package/src/client/genui-runtime/index.ts +1 -0
- package/src/client/genui-runtime/limits.ts +54 -0
- package/src/client/genui-runtime/normalize.ts +329 -0
- package/src/client/genui-runtime/schema.ts +352 -0
- package/src/client/genui-runtime/value-utils.ts +67 -0
- package/src/client/guard.ts +1965 -0
- package/src/client/i18n/en.ts +335 -0
- package/src/client/i18n/index.ts +125 -0
- package/src/client/i18n/runtime.ts +130 -0
- package/src/client/i18n/zh.ts +330 -0
- package/src/client/index.tsx +228 -0
- package/src/client/inline.ts +106 -0
- package/src/client/interaction-store.ts +127 -0
- package/src/client/mermaid-core.ts +158 -0
- package/src/client/mermaid-lazy.ts +31 -0
- package/src/client/mermaid-safe.ts +122 -0
- package/src/client/panel-command.ts +138 -0
- package/src/client/panel-store.ts +471 -0
- package/src/client/panel.tsx +287 -0
- package/src/client/parse-partial.ts +170 -0
- package/src/client/primitive-adapter.ts +13 -0
- package/src/client/primitive-labels.ts +55 -0
- package/src/client/safe-math.ts +298 -0
- package/src/client/scene3d-core.ts +195 -0
- package/src/client/scene3d-lazy.ts +26 -0
- package/src/client/session-resolver.ts +33 -0
- package/src/client/source-fence.ts +70 -0
- package/src/client/spec.ts +896 -0
- package/src/client/standalone/asset-loader.ts +9 -0
- package/src/client/standalone/bootstrap-types.ts +11 -0
- package/src/client/standalone/katex-style.ts +1 -0
- package/src/client/standalone/primitive-adapter.tsx +94 -0
- package/src/client/standalone/runtime.tsx +27 -0
- package/src/client/submission-registry.ts +150 -0
- package/src/client/svg-fence.tsx +39 -0
- package/src/client/table-details.ts +151 -0
- package/src/client/templates.ts +322 -0
- package/src/client/toolview.tsx +67 -0
- package/src/client/walk-spec.ts +43 -0
- package/src/css-modules.d.ts +5 -0
- package/src/index.ts +9 -0
- package/src/plugin/chart-contract.ts +13 -0
- package/src/plugin/fence-feedback.ts +655 -0
- package/src/plugin/genui-diagnostic.ts +112 -0
- package/src/plugin/index.ts +224 -0
- package/src/plugin/inline-content-diagnostic.ts +178 -0
- package/src/plugin/invariant.ts +30 -0
- package/src/plugin/node-shims.d.ts +31 -0
- package/src/plugin/tool.ts +424 -0
- package/src/shared/fence-repair.ts +536 -0
- package/src/shared/fence-resolve.ts +80 -0
- package/tsconfig.json +35 -0
- package/tsdown.config.ts +275 -0
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
/** One node in the component tree. */
|
|
2
|
+
/** Layout hints accepted by every node: `span` is how many columns the node
|
|
3
|
+
* occupies as a direct child of a `grid` (bento layouts). */
|
|
4
|
+
export interface GenuiLayoutHints {
|
|
5
|
+
span?: number;
|
|
6
|
+
}
|
|
7
|
+
export type GenuiNode = (GenuiText | GenuiRow | GenuiCol | GenuiGrid | GenuiCard | GenuiButton | GenuiInput | GenuiSelect | GenuiCheckbox | GenuiLink | GenuiImage | GenuiAudio | GenuiVideo | GenuiBadge | GenuiStat | GenuiHero | GenuiProgress | GenuiDivider | GenuiList | GenuiTable | GenuiChart | GenuiTabs | GenuiAvatar | GenuiSpacer | GenuiPlot | GenuiCallout | GenuiSteps | GenuiKeyValue | GenuiDiff | GenuiJson | GenuiCode | GenuiRadio | GenuiSubmit | GenuiSwitch | GenuiSlider | GenuiTextarea | GenuiAccordion | GenuiCopy | GenuiMermaid | GenuiSvg | GenuiScene3D | GenuiTimeline | GenuiFileTree | GenuiBreadcrumb | GenuiQuiz | GenuiDiagram) & GenuiLayoutHints | GenuiEChart;
|
|
8
|
+
export interface GenuiSpec {
|
|
9
|
+
/** Short title shown as the card banner. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Vertical gap between root items in px. */
|
|
12
|
+
gap?: number;
|
|
13
|
+
/** Panel-only flag: `true` routes the fence to the session panel dock
|
|
14
|
+
* instead of the message flow (rendered by the same block, updated in
|
|
15
|
+
* place on every publish). */
|
|
16
|
+
panel?: boolean;
|
|
17
|
+
/** Panel APPEND flag (meaningful only with `panel: true`): instead of
|
|
18
|
+
* replacing the session panel, merge this spec INTO the existing one —
|
|
19
|
+
* same-labelled tabs get their items appended, new tabs are added, plain
|
|
20
|
+
* item lists are appended to the tail. Lets the model grow a panel
|
|
21
|
+
* incrementally without resending (or truncating) the accumulated content.
|
|
22
|
+
* Applies only when the fence body is fully complete, so a streaming
|
|
23
|
+
* partial parse never double-merges. */
|
|
24
|
+
append?: boolean;
|
|
25
|
+
/** Root component list. */
|
|
26
|
+
items: GenuiNode[];
|
|
27
|
+
}
|
|
28
|
+
export interface GenuiText {
|
|
29
|
+
type: 'text';
|
|
30
|
+
size?: 'h1' | 'h2' | 'h3' | 'body' | 'muted' | 'caption';
|
|
31
|
+
content: string;
|
|
32
|
+
center?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface GenuiButton {
|
|
35
|
+
type: 'button';
|
|
36
|
+
label: string;
|
|
37
|
+
tone?: 'primary' | 'danger' | 'success' | 'ghost';
|
|
38
|
+
full?: boolean;
|
|
39
|
+
small?: boolean;
|
|
40
|
+
icon?: string;
|
|
41
|
+
/** v2: when set, clicking sends this action back to the model. */
|
|
42
|
+
action?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface GenuiInput {
|
|
45
|
+
type: 'input';
|
|
46
|
+
label?: string;
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
value?: string;
|
|
49
|
+
inputType?: 'text' | 'email' | 'password' | 'color';
|
|
50
|
+
/** v2: when set, interaction sends this action back to the model. */
|
|
51
|
+
action?: string;
|
|
52
|
+
/**
|
|
53
|
+
* v2.7: stable field id — the value is persisted across refresh/re-render
|
|
54
|
+
* and collected by a sibling `submit` node (`fields: {id: value}`).
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface GenuiSelect {
|
|
59
|
+
type: 'select';
|
|
60
|
+
label?: string;
|
|
61
|
+
options: string[];
|
|
62
|
+
/** v2: when set, interaction sends this action back to the model. */
|
|
63
|
+
action?: string;
|
|
64
|
+
/**
|
|
65
|
+
* v2.8: default-selected option index (a placeholder option shows instead
|
|
66
|
+
* when absent, so nothing is silently pre-registered).
|
|
67
|
+
*/
|
|
68
|
+
selected?: number;
|
|
69
|
+
/**
|
|
70
|
+
* v2.8: stable field id — the chosen option persists across refresh and is
|
|
71
|
+
* collected by a sibling `submit` node (`fields: {id: value}`), like
|
|
72
|
+
* input/textarea ids.
|
|
73
|
+
*/
|
|
74
|
+
id?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface GenuiCheckbox {
|
|
77
|
+
type: 'checkbox';
|
|
78
|
+
label: string;
|
|
79
|
+
checked?: boolean;
|
|
80
|
+
/** v2: when set, interaction sends this action back to the model. */
|
|
81
|
+
action?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Aggregation group name. When set, toggles stay local and update the
|
|
84
|
+
* block-wide multi-answer registry instead of firing the per-click action;
|
|
85
|
+
* a sibling `submit` collects the selected labels as a string array.
|
|
86
|
+
*/
|
|
87
|
+
group?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface GenuiLink {
|
|
90
|
+
type: 'link';
|
|
91
|
+
label: string;
|
|
92
|
+
/**
|
|
93
|
+
* Optional http(s)/mailto target. With `href` the node renders a REAL
|
|
94
|
+
* anchor (target=_blank + noopener); without it the node renders as plain
|
|
95
|
+
* styled text — never a dead clickable-looking control.
|
|
96
|
+
*/
|
|
97
|
+
href?: string;
|
|
98
|
+
}
|
|
99
|
+
/** User-controlled image from a browser-reachable URL. */
|
|
100
|
+
export interface GenuiImage {
|
|
101
|
+
type: 'image';
|
|
102
|
+
src: string;
|
|
103
|
+
/** Visible caption and accessible image description. */
|
|
104
|
+
alt?: string;
|
|
105
|
+
}
|
|
106
|
+
/** User-controlled audio from a browser-reachable URL. */
|
|
107
|
+
export interface GenuiAudio {
|
|
108
|
+
type: 'audio';
|
|
109
|
+
src: string;
|
|
110
|
+
/** Visible caption and accessible player name. */
|
|
111
|
+
alt?: string;
|
|
112
|
+
loop?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/** User-controlled video from a browser-reachable URL. */
|
|
115
|
+
export interface GenuiVideo {
|
|
116
|
+
type: 'video';
|
|
117
|
+
src: string;
|
|
118
|
+
/** Visible caption and accessible player name. */
|
|
119
|
+
alt?: string;
|
|
120
|
+
poster?: string;
|
|
121
|
+
loop?: boolean;
|
|
122
|
+
muted?: boolean;
|
|
123
|
+
aspectRatio?: '16:9' | '4:3' | '1:1' | '9:16';
|
|
124
|
+
}
|
|
125
|
+
export interface GenuiBadge {
|
|
126
|
+
type: 'badge';
|
|
127
|
+
label: string;
|
|
128
|
+
tone?: 'success' | 'warn' | 'danger' | 'accent';
|
|
129
|
+
icon?: string;
|
|
130
|
+
}
|
|
131
|
+
/** Cover band: the answer's focal point. One per fence — an eyebrow label, an
|
|
132
|
+
* oversized metric, a title and a subtitle on a soft tinted surface. */
|
|
133
|
+
export interface GenuiHero {
|
|
134
|
+
type: 'hero';
|
|
135
|
+
title: string;
|
|
136
|
+
subtitle?: string;
|
|
137
|
+
/** Oversized metric, e.g. "99.96%" / "3.2x". */
|
|
138
|
+
value?: string;
|
|
139
|
+
/** Eyebrow label above the metric. */
|
|
140
|
+
label?: string;
|
|
141
|
+
delta?: string;
|
|
142
|
+
spark?: number[];
|
|
143
|
+
tone?: 'accent' | 'success' | 'warning' | 'danger';
|
|
144
|
+
}
|
|
145
|
+
export interface GenuiStat {
|
|
146
|
+
type: 'stat';
|
|
147
|
+
label: string;
|
|
148
|
+
value: string;
|
|
149
|
+
delta?: string;
|
|
150
|
+
/** Optional micro trend line (finite numbers, 2..60 points). */
|
|
151
|
+
spark?: number[];
|
|
152
|
+
/** `hero` renders one oversized number — use it once per fence as the anchor. */
|
|
153
|
+
size?: 'hero';
|
|
154
|
+
}
|
|
155
|
+
export interface GenuiProgress {
|
|
156
|
+
type: 'progress';
|
|
157
|
+
value: number;
|
|
158
|
+
label?: string;
|
|
159
|
+
valueLabel?: string;
|
|
160
|
+
/** `bar` (default) draws a track; `ring` draws a circular gauge. */
|
|
161
|
+
variant?: 'bar' | 'ring';
|
|
162
|
+
/** Optional target marker on the bar track (0-100). */
|
|
163
|
+
target?: number;
|
|
164
|
+
}
|
|
165
|
+
export interface GenuiDivider {
|
|
166
|
+
type: 'divider';
|
|
167
|
+
}
|
|
168
|
+
export interface GenuiAvatar {
|
|
169
|
+
type: 'avatar';
|
|
170
|
+
name: string;
|
|
171
|
+
color?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface GenuiSpacer {
|
|
174
|
+
type: 'spacer';
|
|
175
|
+
}
|
|
176
|
+
export interface GenuiRow {
|
|
177
|
+
type: 'row';
|
|
178
|
+
items: GenuiNode[];
|
|
179
|
+
wrap?: boolean;
|
|
180
|
+
spacer?: boolean;
|
|
181
|
+
}
|
|
182
|
+
export interface GenuiCol {
|
|
183
|
+
type: 'col';
|
|
184
|
+
items: GenuiNode[];
|
|
185
|
+
gap?: number;
|
|
186
|
+
}
|
|
187
|
+
export interface GenuiGrid {
|
|
188
|
+
type: 'grid';
|
|
189
|
+
cols: number;
|
|
190
|
+
items: GenuiNode[];
|
|
191
|
+
}
|
|
192
|
+
export interface GenuiCard {
|
|
193
|
+
type: 'card';
|
|
194
|
+
title?: string;
|
|
195
|
+
/** Semantic tint for the card surface (default: neutral). */
|
|
196
|
+
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
197
|
+
/** Explicit accent (hex) driving the border, title and wash. */
|
|
198
|
+
accent?: string;
|
|
199
|
+
items: GenuiNode[];
|
|
200
|
+
}
|
|
201
|
+
export interface GenuiList {
|
|
202
|
+
type: 'list';
|
|
203
|
+
/** Field id of an input/select: its value filters the items locally. */
|
|
204
|
+
filter?: string;
|
|
205
|
+
items: Array<string | {
|
|
206
|
+
title: string;
|
|
207
|
+
desc?: string;
|
|
208
|
+
} | GenuiNode>;
|
|
209
|
+
}
|
|
210
|
+
export interface GenuiTable {
|
|
211
|
+
type: 'table';
|
|
212
|
+
columns: string[];
|
|
213
|
+
rows: Array<Array<string | number>>;
|
|
214
|
+
/** Per-column cell type; missing = auto (numeric right-align, signed delta). */
|
|
215
|
+
types?: TableCellType[];
|
|
216
|
+
/** Append a 合计 footer row (numeric columns are summed). */
|
|
217
|
+
total?: boolean;
|
|
218
|
+
/** Show 复制 Markdown / 复制 CSV chips above the table. */
|
|
219
|
+
export?: boolean;
|
|
220
|
+
/** Optional master-detail payload, positionally aligned with `rows`:
|
|
221
|
+
* `details[i]` is what row i expands into (omit / empty = not expandable). */
|
|
222
|
+
details?: Array<GenuiNode[] | null>;
|
|
223
|
+
/** Field id of an input/select: its live value filters the rows locally
|
|
224
|
+
* (substring match), so the table is searchable without a model round trip. */
|
|
225
|
+
filter?: string;
|
|
226
|
+
/** Restrict `filter` to one column index (default: every column). */
|
|
227
|
+
filterColumn?: number;
|
|
228
|
+
/** Field id of a select whose value is a column header: sorts by it locally. */
|
|
229
|
+
sortField?: string;
|
|
230
|
+
}
|
|
231
|
+
/** How a table column's cells render.
|
|
232
|
+
* - `bar` / `ring`: the cell is read as 0-100
|
|
233
|
+
* - `spark`: the cell is a number list ("3,5,4,8") drawn as a mini trend
|
|
234
|
+
* - `index`: the 1-based row number (cell content is ignored)
|
|
235
|
+
* - `delta` / `num` / `badge` / `text`: text treatments. */
|
|
236
|
+
export type TableCellType = 'text' | 'num' | 'delta' | 'bar' | 'badge' | 'spark' | 'ring' | 'index' | 'group';
|
|
237
|
+
export interface GenuiChartDatum {
|
|
238
|
+
label: string;
|
|
239
|
+
value: number;
|
|
240
|
+
color?: string;
|
|
241
|
+
}
|
|
242
|
+
export interface GenuiChart {
|
|
243
|
+
type: 'chart';
|
|
244
|
+
/** Chart shape: bars (default), line (trend), donut (share). */
|
|
245
|
+
kind?: 'bars' | 'line' | 'donut';
|
|
246
|
+
data: GenuiChartDatum[];
|
|
247
|
+
/** Multi-series: grouped bars, or one line per entry when kind is line. */
|
|
248
|
+
series?: Array<{
|
|
249
|
+
label: string;
|
|
250
|
+
color?: string;
|
|
251
|
+
data: GenuiChartDatum[];
|
|
252
|
+
}>;
|
|
253
|
+
/** Bars only: horizontal bars (rankings, long category labels). */
|
|
254
|
+
horizontal?: boolean;
|
|
255
|
+
/** Bars + series: stack the series instead of grouping them. */
|
|
256
|
+
stacked?: boolean;
|
|
257
|
+
/** Explicit categorical palette (hex) — overrides the host theme colours. */
|
|
258
|
+
palette?: string[];
|
|
259
|
+
/** Field id of an input/select: its value filters the categories locally. */
|
|
260
|
+
filter?: string;
|
|
261
|
+
}
|
|
262
|
+
export interface GenuiTab {
|
|
263
|
+
label: string;
|
|
264
|
+
items: GenuiNode[];
|
|
265
|
+
}
|
|
266
|
+
export interface GenuiTabs {
|
|
267
|
+
type: 'tabs';
|
|
268
|
+
tabs: GenuiTab[];
|
|
269
|
+
}
|
|
270
|
+
export interface GenuiPlotSeries {
|
|
271
|
+
/** Math expression in x (safe evaluator: sin/cos/tan/pow/sqrt/log/exp/abs/floor/ceil/round/min/max/pi/e). */
|
|
272
|
+
expr: string;
|
|
273
|
+
/** Legend label; defaults to the expression. */
|
|
274
|
+
label?: string;
|
|
275
|
+
/** Stroke color. */
|
|
276
|
+
color?: string;
|
|
277
|
+
/** v2.9 draw shape: line (default), area (fill to the baseline), scatter
|
|
278
|
+
* (dots only). */
|
|
279
|
+
kind?: 'line' | 'area' | 'scatter';
|
|
280
|
+
/** v2: adjustable parameters (e.g. {a: 2} in "a*sin(x)") — one slider each, live re-render. */
|
|
281
|
+
params?: Array<{
|
|
282
|
+
name: string;
|
|
283
|
+
value: number;
|
|
284
|
+
min?: number;
|
|
285
|
+
max?: number;
|
|
286
|
+
step?: number;
|
|
287
|
+
/** v1.5: animate this parameter (auto-play) from `value` to `animateTo`. */
|
|
288
|
+
animateTo?: number;
|
|
289
|
+
/** Animation duration in ms (default 4000). */
|
|
290
|
+
durationMs?: number;
|
|
291
|
+
/** Loop the animation (default false). */
|
|
292
|
+
loop?: boolean;
|
|
293
|
+
}>;
|
|
294
|
+
}
|
|
295
|
+
export interface GenuiPlot {
|
|
296
|
+
type: 'plot';
|
|
297
|
+
/** Functions to draw, in draw order. */
|
|
298
|
+
series: GenuiPlotSeries[];
|
|
299
|
+
xMin?: number;
|
|
300
|
+
xMax?: number;
|
|
301
|
+
yMin?: number;
|
|
302
|
+
yMax?: number;
|
|
303
|
+
title?: string;
|
|
304
|
+
}
|
|
305
|
+
export interface GenuiCallout {
|
|
306
|
+
type: 'callout';
|
|
307
|
+
tone?: 'info' | 'success' | 'warning' | 'error';
|
|
308
|
+
/** Short heading above the body. */
|
|
309
|
+
title?: string;
|
|
310
|
+
content: string;
|
|
311
|
+
}
|
|
312
|
+
export interface GenuiStep {
|
|
313
|
+
title: string;
|
|
314
|
+
desc?: string;
|
|
315
|
+
}
|
|
316
|
+
export interface GenuiSteps {
|
|
317
|
+
type: 'steps';
|
|
318
|
+
/** Completed steps are rendered in the accent color, the rest muted. */
|
|
319
|
+
current?: number;
|
|
320
|
+
steps: GenuiStep[];
|
|
321
|
+
}
|
|
322
|
+
export interface GenuiKeyValue {
|
|
323
|
+
type: 'keyvalue';
|
|
324
|
+
pairs: Array<{
|
|
325
|
+
key: string;
|
|
326
|
+
value: string;
|
|
327
|
+
}>;
|
|
328
|
+
}
|
|
329
|
+
/** 收编 dsh DiffBlock: file mutations as an inline diff. */
|
|
330
|
+
export interface GenuiDiff {
|
|
331
|
+
type: 'diff';
|
|
332
|
+
diffs: Array<{
|
|
333
|
+
path: string;
|
|
334
|
+
oldText: string | null;
|
|
335
|
+
newText: string;
|
|
336
|
+
}>;
|
|
337
|
+
}
|
|
338
|
+
/** 收编 dsh JsonTree: a structured JSON value for inspection. */
|
|
339
|
+
export interface GenuiJson {
|
|
340
|
+
type: 'json';
|
|
341
|
+
/** Any JSON value to render as a tree. */
|
|
342
|
+
value: unknown;
|
|
343
|
+
}
|
|
344
|
+
/** 收编 dsh CodeBlock: syntax-highlighted code with an explicit language. */
|
|
345
|
+
export interface GenuiCode {
|
|
346
|
+
type: 'code';
|
|
347
|
+
lang?: string;
|
|
348
|
+
code: string;
|
|
349
|
+
}
|
|
350
|
+
export interface GenuiRadio {
|
|
351
|
+
type: 'radio';
|
|
352
|
+
label?: string;
|
|
353
|
+
options: string[];
|
|
354
|
+
/** Default-selected option index. */
|
|
355
|
+
selected?: number;
|
|
356
|
+
/** v2: when set, interaction sends this action back to the model. */
|
|
357
|
+
action?: string;
|
|
358
|
+
/**
|
|
359
|
+
* v2.5: aggregation group name. When set, the selection is recorded into
|
|
360
|
+
* the block-wide answers registry instead of firing a per-click action — a
|
|
361
|
+
* sibling `submit` node then collects ALL groups ("交卷" pattern). Without
|
|
362
|
+
* `group`, the legacy per-click behavior applies.
|
|
363
|
+
*/
|
|
364
|
+
group?: string;
|
|
365
|
+
/**
|
|
366
|
+
* v2.6: correct option for LOCAL grading — the option index (number) or
|
|
367
|
+
* its label (string). When the group's radio carries this, the `submit`
|
|
368
|
+
* button grades IN PLACE on click (score + per-question right/wrong +
|
|
369
|
+
* explanations, zero model round trip).
|
|
370
|
+
*/
|
|
371
|
+
answer?: number | string;
|
|
372
|
+
/** v2.6: per-question explanation shown after local grading. */
|
|
373
|
+
explanation?: string;
|
|
374
|
+
}
|
|
375
|
+
/** 提交节点收集当前 block 的答案和字段值;纯 radio 范围可在本地判卷。 */
|
|
376
|
+
export interface GenuiSubmit {
|
|
377
|
+
type: 'submit';
|
|
378
|
+
label: string;
|
|
379
|
+
/**
|
|
380
|
+
* 可选 action 名称。纯 radio 范围满足本地判卷条件时无需 action;其他提交
|
|
381
|
+
* 通过 action 发送 `answers`、可选的 `fields`、`total` 和 `answered`。
|
|
382
|
+
*/
|
|
383
|
+
action?: string;
|
|
384
|
+
/**
|
|
385
|
+
* v2.6: optional action fired when the user clicks "重新作答" after a
|
|
386
|
+
* local grading (e.g. to tell the model the paper was redone). Absent =
|
|
387
|
+
* reset stays fully local.
|
|
388
|
+
*/
|
|
389
|
+
resetAction?: string;
|
|
390
|
+
/**
|
|
391
|
+
* `groups` 引用当前 block 中的 submission member key,来源为 radio.group、
|
|
392
|
+
* checkbox.group 以及 input/textarea/select/slider.id。radio 需已选择,
|
|
393
|
+
* checkbox 需至少选择一项,普通 field 需在 trim 后非空。`groups` 控制提交
|
|
394
|
+
* 所需成员与完成进度;payload 仍收集当前 block 中已填写的表单状态。
|
|
395
|
+
* 未设置时,只要存在至少一个已完成成员即可提交。
|
|
396
|
+
*/
|
|
397
|
+
groups?: string[];
|
|
398
|
+
}
|
|
399
|
+
export interface GenuiSwitch {
|
|
400
|
+
type: 'switch';
|
|
401
|
+
label: string;
|
|
402
|
+
checked?: boolean;
|
|
403
|
+
/** v2: when set, interaction sends this action back to the model. */
|
|
404
|
+
action?: string;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Slider: a range input for numeric form values (v2.9). The current value
|
|
408
|
+
* shows next to the track; dragging fires the action (debounced by the
|
|
409
|
+
* block) and, with an `id`, persists across refresh and joins the sibling
|
|
410
|
+
* submit's `fields` collection (the value is the numeric string).
|
|
411
|
+
*/
|
|
412
|
+
export interface GenuiSlider {
|
|
413
|
+
type: 'slider';
|
|
414
|
+
label?: string;
|
|
415
|
+
min?: number;
|
|
416
|
+
max?: number;
|
|
417
|
+
step?: number;
|
|
418
|
+
/** Default value; defaults to `min` (or 0). */
|
|
419
|
+
value?: number;
|
|
420
|
+
/** v2: when set, interaction sends this action back to the model. */
|
|
421
|
+
action?: string;
|
|
422
|
+
/** v2.9: stable field id — durable value + submit collection. */
|
|
423
|
+
id?: string;
|
|
424
|
+
}
|
|
425
|
+
export interface GenuiTextarea {
|
|
426
|
+
type: 'textarea';
|
|
427
|
+
label?: string;
|
|
428
|
+
placeholder?: string;
|
|
429
|
+
rows?: number;
|
|
430
|
+
value?: string;
|
|
431
|
+
/** v2.5: when set, blurring the field sends this action with the value. */
|
|
432
|
+
action?: string;
|
|
433
|
+
/**
|
|
434
|
+
* v2.7: stable field id — the value is persisted across refresh/re-render
|
|
435
|
+
* and collected by a sibling `submit` node (`fields: {id: value}`).
|
|
436
|
+
*/
|
|
437
|
+
id?: string;
|
|
438
|
+
}
|
|
439
|
+
export interface GenuiAccordionItem {
|
|
440
|
+
title: string;
|
|
441
|
+
items: GenuiNode[];
|
|
442
|
+
}
|
|
443
|
+
export interface GenuiAccordion {
|
|
444
|
+
type: 'accordion';
|
|
445
|
+
items: GenuiAccordionItem[];
|
|
446
|
+
}
|
|
447
|
+
export interface GenuiCopy {
|
|
448
|
+
type: 'copy';
|
|
449
|
+
label?: string;
|
|
450
|
+
text: string;
|
|
451
|
+
}
|
|
452
|
+
export interface GenuiSvg {
|
|
453
|
+
type: 'svg';
|
|
454
|
+
/** Standalone SVG document, displayed in an isolated image context. */
|
|
455
|
+
code: string;
|
|
456
|
+
title?: string;
|
|
457
|
+
height?: number;
|
|
458
|
+
}
|
|
459
|
+
/** Mermaid diagram: flowchart/sequence/class/gantt source rendered lazily. */
|
|
460
|
+
export interface GenuiMermaid {
|
|
461
|
+
type: 'mermaid';
|
|
462
|
+
/** Mermaid diagram source (whitelisted diagram kinds at render time). */
|
|
463
|
+
code: string;
|
|
464
|
+
}
|
|
465
|
+
/** One mesh in a 3D scene. */
|
|
466
|
+
export interface GenuiMesh {
|
|
467
|
+
/** Primitive geometry, white-listed. */
|
|
468
|
+
shape: 'box' | 'sphere' | 'cone' | 'cylinder' | 'torus';
|
|
469
|
+
/** Mesh color. */
|
|
470
|
+
color?: string;
|
|
471
|
+
/** [x, y, z] position. */
|
|
472
|
+
position?: [number, number, number];
|
|
473
|
+
/** [x, y, z] rotation in radians. */
|
|
474
|
+
rotation?: [number, number, number];
|
|
475
|
+
/** Uniform scale, or [sx, sy, sz]. */
|
|
476
|
+
scale?: number | [number, number, number];
|
|
477
|
+
/** Box size [w, h, d] or sphere/cone/cylinder radius. */
|
|
478
|
+
size?: number | [number, number, number];
|
|
479
|
+
}
|
|
480
|
+
/** 3D scene rendered with three.js (lazily imported). */
|
|
481
|
+
export interface GenuiScene3D {
|
|
482
|
+
type: 'scene3d';
|
|
483
|
+
title?: string;
|
|
484
|
+
meshes: GenuiMesh[];
|
|
485
|
+
/** Ambient light intensity (0..2). */
|
|
486
|
+
ambient?: number;
|
|
487
|
+
/** Background color; default transparent. */
|
|
488
|
+
background?: string;
|
|
489
|
+
}
|
|
490
|
+
export interface GenuiTimelineItem {
|
|
491
|
+
/** Title of the event. */
|
|
492
|
+
title: string;
|
|
493
|
+
/** Secondary description. */
|
|
494
|
+
desc?: string;
|
|
495
|
+
/** Optional timestamp label. */
|
|
496
|
+
time?: string;
|
|
497
|
+
}
|
|
498
|
+
export interface GenuiTimeline {
|
|
499
|
+
type: 'timeline';
|
|
500
|
+
items: GenuiTimelineItem[];
|
|
501
|
+
}
|
|
502
|
+
export interface GenuiFileTreeNode {
|
|
503
|
+
/** File or directory name. */
|
|
504
|
+
name: string;
|
|
505
|
+
/** Directory when true (collapsible children). */
|
|
506
|
+
type?: 'file' | 'dir';
|
|
507
|
+
/** Child nodes (dirs only). */
|
|
508
|
+
children?: GenuiFileTreeNode[];
|
|
509
|
+
}
|
|
510
|
+
export interface GenuiFileTree {
|
|
511
|
+
type: 'file-tree';
|
|
512
|
+
items: GenuiFileTreeNode[];
|
|
513
|
+
}
|
|
514
|
+
export interface GenuiBreadcrumb {
|
|
515
|
+
type: 'breadcrumb';
|
|
516
|
+
items: string[];
|
|
517
|
+
}
|
|
518
|
+
export interface GenuiQuizOption {
|
|
519
|
+
label: string;
|
|
520
|
+
/** True when this option is the correct answer. */
|
|
521
|
+
correct?: boolean;
|
|
522
|
+
/** Per-option feedback shown after selection. */
|
|
523
|
+
feedback?: string;
|
|
524
|
+
}
|
|
525
|
+
export interface GenuiQuiz {
|
|
526
|
+
type: 'quiz';
|
|
527
|
+
/** The question text. */
|
|
528
|
+
question: string;
|
|
529
|
+
/** Answer options; exactly one should be correct. */
|
|
530
|
+
options: GenuiQuizOption[];
|
|
531
|
+
/** Shown after answering (either way). */
|
|
532
|
+
explanation?: string;
|
|
533
|
+
/** Reset the quiz when this value changes (e.g. a question id). */
|
|
534
|
+
id?: string;
|
|
535
|
+
/** v2.5: when set, answering sends this action with the chosen answer
|
|
536
|
+
* (`{type:'quiz', question, answer, correct}`) so the model can collect
|
|
537
|
+
* or grade it. */
|
|
538
|
+
action?: string;
|
|
539
|
+
}
|
|
540
|
+
/** Editorial diagram kinds, ported from cathrynlavery/diagram-design (27 types). */
|
|
541
|
+
export declare const DIAGRAM_KINDS: readonly ["architecture", "it-state", "flowchart", "sequence", "state", "er", "timeline", "swimlane", "quadrant", "radar", "loop", "nested", "tree", "org-chart", "layers", "venn", "pyramid", "bar", "line", "gantt", "scatter", "high-level", "process", "medallion", "data-flow", "dp-integration", "dp-security-matrix"];
|
|
542
|
+
export type GenuiDiagramKind = typeof DIAGRAM_KINDS[number];
|
|
543
|
+
/** Diagram surface variant: light / dark follow the host theme; editorial is the full skin. */
|
|
544
|
+
export type GenuiDiagramVariant = 'light' | 'dark' | 'editorial';
|
|
545
|
+
/** Node treatment classes (map to the diagram-design semantic fills/strokes). */
|
|
546
|
+
export type GenuiDiagramNodeType = 'focal' | 'backend' | 'store' | 'external' | 'input' | 'optional' | 'security';
|
|
547
|
+
/** One positioned node in a coordinate-mode diagram. */
|
|
548
|
+
export interface GenuiDiagramNode {
|
|
549
|
+
/** Stable node id referenced by edges. */
|
|
550
|
+
id: string;
|
|
551
|
+
/** Human-readable label (Geist sans in the renderer). */
|
|
552
|
+
label: string;
|
|
553
|
+
/** Optional technical sublabel (Geist mono in the renderer). */
|
|
554
|
+
sub?: string;
|
|
555
|
+
/** Semantic treatment; `focal` is budgeted (max 2 per diagram). */
|
|
556
|
+
type?: GenuiDiagramNodeType;
|
|
557
|
+
/** Position / size (coordinate-mode kinds only). 4px grid is enforced at render. */
|
|
558
|
+
x?: number;
|
|
559
|
+
y?: number;
|
|
560
|
+
w?: number;
|
|
561
|
+
h?: number;
|
|
562
|
+
/** Optional rectangular type tag (e.g. `API`). */
|
|
563
|
+
tag?: string;
|
|
564
|
+
}
|
|
565
|
+
/** One connector between two nodes. */
|
|
566
|
+
export interface GenuiDiagramEdge {
|
|
567
|
+
/** Source node id. */
|
|
568
|
+
from: string;
|
|
569
|
+
/** Target node id. */
|
|
570
|
+
to: string;
|
|
571
|
+
/** Optional edge label (all-caps, <=14 chars in the renderer). */
|
|
572
|
+
label?: string;
|
|
573
|
+
/** Stroke semantics: solid (default), dashed (optional/async), accent, link (HTTP/API). */
|
|
574
|
+
kind?: 'solid' | 'dashed' | 'accent' | 'link';
|
|
575
|
+
/** Route hint; `auto` (default) lets the renderer choose orthogonal routing. */
|
|
576
|
+
route?: 'auto' | 'orthogonal' | 'straight';
|
|
577
|
+
}
|
|
578
|
+
/** Optional brand override; every key maps to a diagram-design semantic token. */
|
|
579
|
+
export interface GenuiDiagramTheme {
|
|
580
|
+
paper?: string;
|
|
581
|
+
'paper-2'?: string;
|
|
582
|
+
ink?: string;
|
|
583
|
+
muted?: string;
|
|
584
|
+
soft?: string;
|
|
585
|
+
rule?: string;
|
|
586
|
+
accent?: string;
|
|
587
|
+
'accent-tint'?: string;
|
|
588
|
+
link?: string;
|
|
589
|
+
}
|
|
590
|
+
/** Zone container: a labelled region grouping related nodes (max 3). */
|
|
591
|
+
export interface GenuiDiagramZone {
|
|
592
|
+
/** Zone label (mono uppercase eyebrow in the renderer). */
|
|
593
|
+
label: string;
|
|
594
|
+
/** Bounding box in the same canvas space as the nodes. */
|
|
595
|
+
x?: number;
|
|
596
|
+
y?: number;
|
|
597
|
+
w?: number;
|
|
598
|
+
h?: number;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Editorial diagram (diagram-design port): a white-listed declarative diagram
|
|
602
|
+
* rendered as inline SVG by the browser. `kind` selects the layout grammar
|
|
603
|
+
* (coordinate kinds place nodes via x/y; rule kinds auto-layout from data),
|
|
604
|
+
* `variant` selects the skin, and `theme` overrides semantic tokens. The
|
|
605
|
+
* renderer enforces the editorial constraints — orthogonal connectors, 4px
|
|
606
|
+
* grid, complexity budget, focal accent budget — so the model cannot emit
|
|
607
|
+
* "AI slop" schematics.
|
|
608
|
+
*/
|
|
609
|
+
export interface GenuiDiagram {
|
|
610
|
+
type: 'diagram';
|
|
611
|
+
/** The 27-type editorial vocabulary. */
|
|
612
|
+
kind: GenuiDiagramKind;
|
|
613
|
+
/** Surface skin; default follows the host theme. */
|
|
614
|
+
variant?: GenuiDiagramVariant;
|
|
615
|
+
/** Optional diagram title (Instrument Serif in the renderer). */
|
|
616
|
+
title?: string;
|
|
617
|
+
/** Nodes (coordinate kinds use x/y/w/h; rule kinds may omit positions). */
|
|
618
|
+
nodes: GenuiDiagramNode[];
|
|
619
|
+
/** Connectors. */
|
|
620
|
+
edges?: GenuiDiagramEdge[];
|
|
621
|
+
/** Optional labelled regions grouping nodes (max 3). */
|
|
622
|
+
zones?: GenuiDiagramZone[];
|
|
623
|
+
/** Optional semantic-token overrides. */
|
|
624
|
+
theme?: GenuiDiagramTheme;
|
|
625
|
+
}
|
|
626
|
+
/** Preset chart kinds the `echart` node can build from `data`/`series` without
|
|
627
|
+
* a full ECharts option. Each maps to a themed option template. */
|
|
628
|
+
export type EChartPreset = 'bar' | 'line' | 'area' | 'pie' | 'scatter' | 'radar' | 'gauge' | 'funnel' | 'treemap' | 'sankey' | 'graph' | 'heatmap' | 'bigline' | 'wordCloud';
|
|
629
|
+
/** ECharts node: renders a full ECharts chart. Two modes:
|
|
630
|
+
*
|
|
631
|
+
* 1. **Full option** (`option` set): the model provides a standard ECharts
|
|
632
|
+
* `EChartsCoreOption` object directly. This is the escape hatch for
|
|
633
|
+
* custom chart types, complex series, or advanced features (dataZoom,
|
|
634
|
+
* visualMap, etc.).
|
|
635
|
+
* 2. **Preset shorthand** (`preset` + `data`/`series`): the model provides
|
|
636
|
+
* the same simple `data`/`series` shape as the `chart` node, and the
|
|
637
|
+
* component builds a themed ECharts option automatically. This is the
|
|
638
|
+
* easy upgrade path: change `type: 'chart'` to `type: 'echart'` and add
|
|
639
|
+
* `preset`.
|
|
640
|
+
*
|
|
641
|
+
* The echarts engine is lazy-loaded (lib/assets/echarts.js) only when an
|
|
642
|
+
* `echart` node appears in a spec. */
|
|
643
|
+
export interface GenuiEChart {
|
|
644
|
+
type: 'echart';
|
|
645
|
+
/** Optional title shown above the chart. */
|
|
646
|
+
title?: string;
|
|
647
|
+
/** Chart height in pixels (default 300). */
|
|
648
|
+
height?: number;
|
|
649
|
+
/** Preset: builds the ECharts option from `data`/`series` when `option`
|
|
650
|
+
* is absent. */
|
|
651
|
+
preset?: EChartPreset;
|
|
652
|
+
/** Simple data for preset mode (same shape as `chart.data`). */
|
|
653
|
+
data?: GenuiChartDatum[];
|
|
654
|
+
/** Multi-series for preset mode (same shape as `chart.series`). */
|
|
655
|
+
series?: Array<{
|
|
656
|
+
label: string;
|
|
657
|
+
color?: string;
|
|
658
|
+
data: GenuiChartDatum[];
|
|
659
|
+
}>;
|
|
660
|
+
/** Node/edge data for the `sankey` and `graph` presets. */
|
|
661
|
+
links?: Array<{
|
|
662
|
+
from: string;
|
|
663
|
+
to: string;
|
|
664
|
+
value?: number;
|
|
665
|
+
}>;
|
|
666
|
+
/** Explicit categorical palette (hex) for preset mode. */
|
|
667
|
+
palette?: string[];
|
|
668
|
+
/** Full ECharts option object. When present, `preset`/`data`/`series` are
|
|
669
|
+
* ignored. This is a pass-through to `echarts.setOption`. */
|
|
670
|
+
option?: Record<string, unknown>;
|
|
671
|
+
}
|
|
672
|
+
/** Parse the raw fence body as a GenuiSpec, or null when it is not one. */
|
|
673
|
+
export declare function parseGenuiSpec(raw: string): GenuiSpec | null;
|
|
674
|
+
/**
|
|
675
|
+
* Is `value` a bare component root rather than an envelope spec?
|
|
676
|
+
*
|
|
677
|
+
* A root object carrying a `type` is the documented single-component
|
|
678
|
+
* shorthand. `items` alone cannot decide the root shape: for container
|
|
679
|
+
* components it holds children (row/col/grid/card/accordion) and for data
|
|
680
|
+
* components it holds records (steps/list/timeline/file-tree/breadcrumb), so
|
|
681
|
+
* both readings are components. A whitelisted `type` therefore wins over the
|
|
682
|
+
* envelope reading — `{"type":"steps","items":[{"title":"…"}]}` is a bare
|
|
683
|
+
* steps node, never a spec whose `items` are the step records (issue #172).
|
|
684
|
+
* A non-native `type` keeps the envelope reading, so a stray `type` field
|
|
685
|
+
* (`{"type":"genui","items":[…]}`) cannot swallow a real spec root.
|
|
686
|
+
*/
|
|
687
|
+
export declare function isComponentRoot(value: unknown): boolean;
|
|
688
|
+
/**
|
|
689
|
+
* Wrap a bare component object into a one-item spec. Returns null when
|
|
690
|
+
* `value` is not component-shaped (no usable `type`). Root-level spec fields
|
|
691
|
+
* found on the component are hoisted onto the wrapper: `panel`/`append` (so
|
|
692
|
+
* panel routing keeps working) and `title` when the component has no title of
|
|
693
|
+
* its own (`{"type":"steps","title":"…"}` means a titled block, not a steps
|
|
694
|
+
* field the schema would drop).
|
|
695
|
+
*
|
|
696
|
+
* The wrapper is a plain spec rather than a `col` node: a spec root is
|
|
697
|
+
* already rendered as a column by GenuiBlock, and leaving the wrapper free of
|
|
698
|
+
* a component `type` is what stops the guard from reading it as one more bare
|
|
699
|
+
* component root and nesting every fence inside a second column (issue #172).
|
|
700
|
+
*/
|
|
701
|
+
export declare function wrapSingleComponentRoot(value: unknown): GenuiSpec | null;
|
|
702
|
+
/**
|
|
703
|
+
* Basic structural guard: is this object a valid GenuiSpec?
|
|
704
|
+
*
|
|
705
|
+
* A bare component root is not a spec (it is wrapped instead), so
|
|
706
|
+
* `{"type":"steps","items":[…]}` answers false and `parseGenuiSpec` routes it
|
|
707
|
+
* through `wrapSingleComponentRoot` (issue #172).
|
|
708
|
+
*/
|
|
709
|
+
export declare function isGenuiSpec(value: unknown): value is GenuiSpec;
|