@toon-ui/core 1.1.0 → 1.2.1

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/prompts.js CHANGED
@@ -4,7 +4,9 @@ export function createComponentPrompt(rules) {
4
4
  `Button variants: ${rules.buttonVariants.join(', ')}`,
5
5
  `Badge variants: ${rules.badgeVariants.join(', ')}`,
6
6
  `Alert variants: ${rules.alertVariants.join(', ')}`,
7
+ `Confirm variants: ${rules.confirmVariants.join(', ')}`,
7
8
  `Field types: ${rules.fieldTypes.join(', ')}`,
9
+ `Chart types: ${rules.chartTypes.join(', ')}`,
8
10
  ].join('\n');
9
11
  }
10
12
  export function createSyntaxPrompt() {
@@ -15,12 +17,26 @@ export function createSyntaxPrompt() {
15
17
  '- form MUST be: form "Title": followed by one or more field nodes and one submit button',
16
18
  '- field MUST be: field <name> <fieldType> "Label" [placeholder="..."] [required]',
17
19
  '- button MUST be: button <variant> "Label" reply="Value" OR button <variant> "Label" submit',
18
- '- confirm MUST be: confirm "Title": followed by indented child nodes',
20
+ '- confirm MUST be: confirm <variant> "Title": followed by indented child nodes',
19
21
  '- list MUST be: list "Title": followed only by item nodes',
20
22
  '- item MUST be: item "Title": followed by indented child nodes',
21
23
  '- badge MUST be: badge "Label" <variant>',
22
24
  '- alert MUST be: alert <variant> "Title": followed by indented child nodes',
23
25
  '- table MUST be: table "Title": followed by columns: ... and one or more row: ... lines',
26
+ '- heading MUST be: heading <1-6> "Visible text"',
27
+ '- separator MUST be: separator OR separator horizontal|vertical',
28
+ '- empty MUST be: empty "Title": followed by indented child nodes',
29
+ '- tabs MUST be: tabs "Title": followed by one or more tab "Label": blocks',
30
+ '- accordion MUST be: accordion "Title": followed by one or more section "Title": blocks',
31
+ '- dialog, sheet, and popover MUST be: <component> "Title": followed by indented child nodes',
32
+ '- tooltip MUST be: tooltip "Visible text"',
33
+ '- progress MUST be: progress "Label" value=<number> max=<number>',
34
+ '- loading MUST be: loading "Visible text"',
35
+ '- toast MUST be: toast <variant> "Visible text"',
36
+ '- breadcrumb MUST be: breadcrumb: followed by one or more crumb "Label" [reply="..."] lines',
37
+ '- pagination MUST be: pagination page=<number> totalPages=<number>',
38
+ '- menu and command MUST be: <component> "Title": followed by one or more action "Label" reply="..." or submit lines',
39
+ '- chart MUST be: chart <type> "Title": followed by one or more series "Label": blocks with point "Label" <number> rows',
24
40
  '- In tables, quote every column name and every row cell, especially when values may contain commas like currency or large numbers',
25
41
  '- card, form, confirm, list, item, alert, and table ALWAYS require a quoted title',
26
42
  '- badge NEVER has children and NEVER has a title prop',
@@ -29,10 +45,11 @@ export function createSyntaxPrompt() {
29
45
  export function createFallbackPrompt() {
30
46
  return [
31
47
  'Fallback rules:',
32
- '- If you are unsure, use only: card, text, badge, button, form, field, confirm, list, item, alert, table.',
33
- '- If you need a section heading inside a card, use text "..." instead of inventing header, subtitle, section, or footer.',
48
+ '- If you are unsure, use only: card, text, heading, badge, button, form, field, confirm, list, item, alert, table, empty.',
49
+ '- Use heading for hierarchy instead of inventing header, subtitle, or title props on random nodes.',
34
50
  '- If you need secondary information, use more text nodes instead of inventing props or components.',
35
- '- NEVER invent components such as header, section, footer, subtitle, description, input, modal, stack, grid, or divider.',
51
+ '- Use section only inside accordion, tab only inside tabs, action only inside menu/command, crumb only inside breadcrumb, series only inside chart, and point only inside series.',
52
+ '- NEVER invent components such as header, footer, subtitle, description, input, modal, stack, grid, or divider.',
36
53
  ].join('\n');
37
54
  }
38
55
  export function createSafetyPrompt() {
@@ -46,17 +63,69 @@ export function createSafetyPrompt() {
46
63
  '- The prompt instructions stay in English, but visible UI labels, titles, button text, and field labels should follow the user language and conversation context.',
47
64
  ].join('\n');
48
65
  }
66
+ export function createCompositionPrompt() {
67
+ return [
68
+ 'Composition best practices:',
69
+ '- Lead with the most useful UI, not with an explanation about the UI.',
70
+ '- Use ONE focused ToonUI block per intent unless the user truly needs multiple separate blocks.',
71
+ '- Keep actions close to the data they affect.',
72
+ '- Prefer simple trees over deeply nested trees.',
73
+ '- Use heading and separator to improve scanability when a card or dialog has multiple sections.',
74
+ '- Use empty for zero-result states instead of plain prose.',
75
+ '- Use loading, progress, and toast for system state and feedback when relevant.',
76
+ '- Use breadcrumb and pagination only when the user is navigating a larger result space.',
77
+ '- Use chart only when the user needs trend or comparison understanding; otherwise prefer table for precise values.',
78
+ '- For strict components like alert, empty, progress, and pagination, prefer copying the canonical example shape exactly instead of improvising shorthand.',
79
+ ].join('\n');
80
+ }
81
+ export function createFormBestPracticesPrompt() {
82
+ return [
83
+ 'Form and data-capture best practices:',
84
+ '- If the assistant needs 2 or more structured inputs, prefer a form instead of asking one question at a time.',
85
+ '- If the user must fill several loose values, emit one complete form so the user can answer everything at once.',
86
+ '- Prefer field over ad-hoc text instructions whenever the data is structured.',
87
+ '- Use required only for truly mandatory fields.',
88
+ '- Add placeholder when it helps the user understand the expected format.',
89
+ '- Add helper text for constraints, formatting, or business rules that might be missed.',
90
+ '- Use select, radio, checkbox, switch, slider, or multiselect when the valid values are constrained.',
91
+ '- Use combobox when the user must search within a known set of options.',
92
+ '- Use textarea only for long-form text.',
93
+ '- Use otp only for verification codes, not generic numeric input.',
94
+ '- Group related fields in one form instead of scattering separate forms across the response.',
95
+ '- A form should usually end with exactly one primary submit button and optional secondary reply buttons only when needed.',
96
+ ].join('\n');
97
+ }
49
98
  export function createDecisionPrompt() {
50
99
  return [
51
100
  'UI decision policy:',
52
- '- Prefer ToonUI over plain markdown when the user needs to choose, confirm, fill structured data, or scan structured business results.',
101
+ '- Prefer ToonUI over plain markdown whenever the user needs to choose, confirm, fill structured data, scan structured business results, compare values, or navigate options.',
102
+ '- Default toward UI when it can reduce back-and-forth.',
53
103
  '- Use form blocks immediately for create, edit, register, capture, or update flows that need multiple structured fields.',
54
- '- Use confirm blocks immediately for destructive, risky, or irreversible actions.',
55
- '- Use table, list, or card blocks for structured business data such as products, sales, inventory, customers, search results, or status summaries.',
56
- '- Do NOT ask the user whether they want a UI if a form, confirm, table, list, or card is clearly useful. Emit the ToonUI directly.',
104
+ '- If collecting several loose pieces of information, do NOT ask for them in separate prose questions; emit a form immediately.',
105
+ '- Use confirm danger blocks for destructive actions, confirm warning blocks for risky actions, and confirm neutral blocks for basic confirmations.',
106
+ '- Use table, list, card, chart, tabs, accordion, dialog, sheet, menu, or command when they are a better semantic fit than prose.',
107
+ '- Do NOT ask the user whether they want a UI if a form, confirm, table, list, card, chart, or command block is clearly useful. Emit the ToonUI directly.',
57
108
  '- Do NOT ask for form fields one by one in plain prose when a form can capture them better.',
58
109
  '- If tool results return multiple records, prefer table or list instead of markdown bullets or ad-hoc prose.',
59
110
  '- If a single entity is found and the user may want a next action, prefer card plus buttons.',
111
+ '- If the user must choose among actions, prefer menu or command over prose bullet lists.',
112
+ '- If the user needs hierarchical or dense detail, prefer tabs or accordion over a wall of text.',
113
+ '- If the user asks for analytics, trends, or comparison, prefer chart plus optional supporting table.',
114
+ '- If you need a callout block with explanation, use alert <variant> "Title": with nested children, not a one-line shorthand.',
115
+ '- If you need an empty state, use empty "Title": with at least one nested text or action node.',
116
+ '- If you need numeric progress, use progress "Label" value=<number> max=<number> exactly.',
117
+ '- If you need page navigation, use pagination page=<number> totalPages=<number> exactly.',
118
+ ].join('\n');
119
+ }
120
+ export function createSelfCheckPrompt() {
121
+ return [
122
+ 'Before emitting ToonUI, run this syntax self-check:',
123
+ '- alert always needs: variant + quoted title + trailing colon + nested children',
124
+ '- empty always needs: quoted title + trailing colon + nested children',
125
+ '- progress always needs: quoted label + value=<number> + max=<number>',
126
+ '- pagination always needs: page=<number> + totalPages=<number>',
127
+ '- If a node requires children, do NOT emit it as a one-line leaf node.',
128
+ '- If you are unsure about a new component syntax, fall back to card, text, table, form, confirm, or list instead of inventing invalid shorthand.',
60
129
  ].join('\n');
61
130
  }
62
131
  export function createExamplesPrompt() {
@@ -77,13 +146,20 @@ export function createExamplesPrompt() {
77
146
  '```',
78
147
  '',
79
148
  '```toon-ui',
80
- 'confirm "Delete customer?":',
149
+ 'confirm danger "Delete customer?":',
81
150
  ' text "This action cannot be undone."',
82
151
  ' button secondary "Cancel" reply="Cancel"',
83
152
  ' button danger "Yes, delete" reply="Yes, delete customer"',
84
153
  '```',
85
154
  '',
86
155
  '```toon-ui',
156
+ 'confirm neutral "Continue with selected customer?":',
157
+ ' text "We will use this customer for the current sale."',
158
+ ' button secondary "Cancel" reply="Cancel"',
159
+ ' button primary "Continue" reply="Continue with selected customer"',
160
+ '```',
161
+ '',
162
+ '```toon-ui',
87
163
  'table "Sales":',
88
164
  ' columns: "Date", "Sale number", "Total", "Status"',
89
165
  ' row: "May 14", "177877222574876", "$ 387.45", "Completed"',
@@ -91,6 +167,32 @@ export function createExamplesPrompt() {
91
167
  '```',
92
168
  '',
93
169
  '```toon-ui',
170
+ 'alert warning "Low stock":',
171
+ ' text "Only 3 units remain in the warehouse."',
172
+ '```',
173
+ '',
174
+ '```toon-ui',
175
+ 'empty "No customers found":',
176
+ ' text "Try another search term or create a new customer."',
177
+ ' button secondary "Create customer" reply="Create customer"',
178
+ '```',
179
+ '',
180
+ '```toon-ui',
181
+ 'progress "Inventory sync" value=65 max=100',
182
+ '```',
183
+ '',
184
+ '```toon-ui',
185
+ 'pagination page=2 totalPages=8',
186
+ '```',
187
+ '',
188
+ '```toon-ui',
189
+ 'chart bar "Weekly sales" x="Day" y="Revenue":',
190
+ ' series "Store A":',
191
+ ' point "Mon" 1200',
192
+ ' point "Tue" 980',
193
+ '```',
194
+ '',
195
+ '```toon-ui',
94
196
  'form "Create product":',
95
197
  ' field name text "Name" placeholder="Ex: Coca-Cola" required',
96
198
  ' field sku text "SKU" placeholder="Ex: COCA-355" required',
@@ -104,6 +206,11 @@ export function createExamplesPrompt() {
104
206
  '- header "Customer" -> INVALID because header is not an allowed component',
105
207
  '- card: -> INVALID because card requires a quoted title',
106
208
  '- badge success "Customer" -> INVALID because badge syntax is badge "Label" variant',
209
+ '- alert "Low stock" -> INVALID because alert requires a variant and nested block',
210
+ '- empty "No data" -> INVALID because empty requires a nested block after :',
211
+ '- progress 65 -> INVALID because progress requires a quoted label plus value= and max=',
212
+ '- pagination 2/8 -> INVALID because pagination requires page= and totalPages=',
213
+ '- confirm "Delete customer?": -> VALID for backward compatibility, but prefer confirm danger|warning|neutral "Title":',
107
214
  '- form "Customer": with no submit button -> INVALID',
108
215
  '- row: May 09, $ 8,155.35, Completed -> RISKY because commas inside values can break the table unless cells are quoted',
109
216
  '- "Do you want me to build a UI for this?" -> BAD when a form, confirm, table, list, or card is already the obvious best response',
@@ -112,6 +219,7 @@ export function createExamplesPrompt() {
112
219
  export function createPrompt(rules) {
113
220
  return [
114
221
  'You are generating ToonUI for an AI-native app.',
222
+ 'Your job is to reduce friction for the user by turning structured intent into structured UI whenever it helps.',
115
223
  createComponentPrompt(rules),
116
224
  '',
117
225
  createSyntaxPrompt(),
@@ -119,9 +227,14 @@ export function createPrompt(rules) {
119
227
  'Interaction rules:',
120
228
  '- Every button must include variant, label, and reply="..." or submit.',
121
229
  '- Every form must include a title, fields, and a submit button.',
122
- '- Use confirm blocks for destructive actions.',
230
+ '- Prefer confirm danger for destructive actions, confirm warning for risky actions, and confirm neutral for normal confirmations.',
123
231
  '- Reply protocol: emit user intent through compact ui_reply messages only.',
124
232
  '- Submit protocol: emit compact ui_submit payloads with intent and field values only.',
233
+ '- Visible UI copy must match the user language and the business context.',
234
+ '',
235
+ createCompositionPrompt(),
236
+ '',
237
+ createFormBestPracticesPrompt(),
125
238
  '',
126
239
  createFallbackPrompt(),
127
240
  '',
@@ -129,6 +242,8 @@ export function createPrompt(rules) {
129
242
  '',
130
243
  createDecisionPrompt(),
131
244
  '',
245
+ createSelfCheckPrompt(),
246
+ '',
132
247
  createExamplesPrompt(),
133
248
  ].join('\n');
134
249
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CAAC,KAAgB;IACpD,OAAO;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AAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAkBvH;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,sBAAsB,EAAE,OAAO,EAAE,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAY3H;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAWjD;AAED,wBAAgB,qBAAqB,CAAC,WAAW,SAAS,qBAAqB,GAAG,qBAAqB,EAAE,OAAO,GAAE,mBAAmB,CAAC,WAAW,CAAM,GAAG,WAAW,CAAC,WAAW,CAAC,CASjL"}
package/dist/runtime.js CHANGED
@@ -2,7 +2,7 @@ import { createPrompt } from './prompts';
2
2
  import { parseToonUI } from './parser';
3
3
  import { validateToonUI } from './validator';
4
4
  import { extractToonBlocks } from './formatter';
5
- import { ALERT_VARIANTS, BADGE_VARIANTS, BUTTON_VARIANTS, FIELD_TYPES, OFFICIAL_COMPONENT_KEYS } from './types';
5
+ import { ALERT_VARIANTS, BADGE_VARIANTS, BUTTON_VARIANTS, CHART_TYPES, CONFIRM_VARIANTS, FIELD_TYPES, OFFICIAL_COMPONENT_KEYS } from './types';
6
6
  function createEventId(prefix) {
7
7
  return `${prefix}_${Math.random().toString(36).slice(2, 10)}`;
8
8
  }
@@ -12,7 +12,9 @@ export function createRules() {
12
12
  buttonVariants: BUTTON_VARIANTS,
13
13
  badgeVariants: BADGE_VARIANTS,
14
14
  alertVariants: ALERT_VARIANTS,
15
+ confirmVariants: CONFIRM_VARIANTS,
15
16
  fieldTypes: FIELD_TYPES,
17
+ chartTypes: CHART_TYPES,
16
18
  };
17
19
  }
18
20
  export function formatSubmitMessage(intentOrPayload, values) {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,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C3B,KAAK;QACL,mBAAmB;QACnB,kBAAkB;QAClB,iBAAiB;QACjB,mBAAmB;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAoE,UAA4C,EAAE;IACrJ,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,OAAO;QACL,UAAU,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAgB;QACrD,GAAG,QAAQ;QACX,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,iBAAiB;KACjC,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,87 +1,230 @@
1
- export declare const OFFICIAL_COMPONENT_KEYS: readonly ["text", "card", "form", "field", "button", "confirm", "list", "item", "badge", "alert", "table"];
1
+ export declare const OFFICIAL_COMPONENT_KEYS: readonly ["text", "heading", "separator", "card", "form", "field", "button", "confirm", "list", "item", "badge", "alert", "table", "empty", "tabs", "accordion", "dialog", "sheet", "popover", "tooltip", "progress", "loading", "toast", "breadcrumb", "pagination", "menu", "command", "chart"];
2
2
  export declare const BUTTON_VARIANTS: readonly ["primary", "secondary", "danger", "ghost", "outline"];
3
3
  export declare const BADGE_VARIANTS: readonly ["success", "warning", "danger", "neutral", "info"];
4
4
  export declare const ALERT_VARIANTS: readonly ["info", "success", "warning", "danger"];
5
- export declare const FIELD_TYPES: readonly ["text", "email", "number", "password", "date", "time", "textarea", "select", "checkbox"];
5
+ export declare const CONFIRM_VARIANTS: readonly ["neutral", "info", "warning", "danger", "success"];
6
+ export declare const FIELD_TYPES: readonly ["text", "email", "number", "password", "date", "time", "textarea", "select", "checkbox", "radio", "switch", "combobox", "otp", "slider", "multiselect"];
7
+ export declare const CHART_TYPES: readonly ["bar", "line", "area", "pie"];
8
+ export declare const SHEET_SIDES: readonly ["left", "right", "top", "bottom"];
9
+ export declare const SEPARATOR_ORIENTATIONS: readonly ["horizontal", "vertical"];
6
10
  export type ToonComponentKey = (typeof OFFICIAL_COMPONENT_KEYS)[number];
7
11
  export type ButtonVariant = (typeof BUTTON_VARIANTS)[number];
8
12
  export type BadgeVariant = (typeof BADGE_VARIANTS)[number];
9
13
  export type AlertVariant = (typeof ALERT_VARIANTS)[number];
14
+ export type ConfirmVariant = (typeof CONFIRM_VARIANTS)[number];
10
15
  export type FieldType = (typeof FIELD_TYPES)[number];
11
- export type SubmitValue = string | number | boolean;
12
- export type ToonErrorCode = "INVALID_COMPONENT" | "INVALID_PROP" | "INVALID_VARIANT" | "MISSING_REQUIRED_FIELD" | "INVALID_NESTING" | "INVALID_SYNTAX" | "UNSAFE_CONTENT";
16
+ export type ChartType = (typeof CHART_TYPES)[number];
17
+ export type SheetSide = (typeof SHEET_SIDES)[number];
18
+ export type SeparatorOrientation = (typeof SEPARATOR_ORIENTATIONS)[number];
19
+ export type SubmitScalar = string | number | boolean;
20
+ export type SubmitValue = SubmitScalar | SubmitScalar[];
21
+ export type ToonErrorCode = 'INVALID_COMPONENT' | 'INVALID_PROP' | 'INVALID_VARIANT' | 'MISSING_REQUIRED_FIELD' | 'INVALID_NESTING' | 'INVALID_SYNTAX' | 'UNSAFE_CONTENT';
13
22
  export interface BaseNode {
14
- type: ToonComponentKey;
23
+ type: string;
15
24
  line: number;
16
25
  column: number;
17
26
  }
18
27
  export interface TextNode extends BaseNode {
19
- type: "text";
28
+ type: 'text';
20
29
  value: string;
21
30
  }
31
+ export interface HeadingNode extends BaseNode {
32
+ type: 'heading';
33
+ level: 1 | 2 | 3 | 4 | 5 | 6;
34
+ text: string;
35
+ }
36
+ export interface SeparatorNode extends BaseNode {
37
+ type: 'separator';
38
+ orientation: SeparatorOrientation;
39
+ }
22
40
  export interface BadgeNode extends BaseNode {
23
- type: "badge";
41
+ type: 'badge';
24
42
  label: string;
25
43
  variant: BadgeVariant;
26
44
  }
27
45
  export interface ButtonNode extends BaseNode {
28
- type: "button";
46
+ type: 'button';
29
47
  variant: ButtonVariant;
30
48
  label: string;
31
49
  action: {
32
- kind: "reply";
50
+ kind: 'reply';
33
51
  value: string;
34
52
  } | {
35
- kind: "submit";
53
+ kind: 'submit';
36
54
  };
37
55
  }
38
56
  export interface FieldNode extends BaseNode {
39
- type: "field";
57
+ type: 'field';
40
58
  name: string;
41
59
  fieldType: FieldType;
42
60
  label: string;
43
61
  placeholder?: string;
62
+ helper?: string;
44
63
  required: boolean;
64
+ options?: string[];
65
+ min?: number;
66
+ max?: number;
67
+ step?: number;
68
+ value?: SubmitValue;
45
69
  }
46
70
  export interface CardNode extends BaseNode {
47
- type: "card";
71
+ type: 'card';
48
72
  title: string;
49
73
  children: ToonNode[];
50
74
  }
51
75
  export interface ConfirmNode extends BaseNode {
52
- type: "confirm";
76
+ type: 'confirm';
77
+ variant: ConfirmVariant;
53
78
  title: string;
54
79
  children: ToonNode[];
55
80
  }
56
81
  export interface ItemNode extends BaseNode {
57
- type: "item";
82
+ type: 'item';
58
83
  title: string;
59
84
  children: ToonNode[];
60
85
  }
61
86
  export interface ListNode extends BaseNode {
62
- type: "list";
87
+ type: 'list';
63
88
  title: string;
64
- children: ItemNode[];
89
+ children: ToonNode[];
65
90
  }
66
91
  export interface AlertNode extends BaseNode {
67
- type: "alert";
92
+ type: 'alert';
68
93
  variant: AlertVariant;
69
94
  title: string;
70
95
  children: ToonNode[];
71
96
  }
72
97
  export interface TableNode extends BaseNode {
73
- type: "table";
98
+ type: 'table';
74
99
  title: string;
75
100
  columns: string[];
76
101
  rows: string[][];
77
102
  }
78
103
  export interface FormNode extends BaseNode {
79
- type: "form";
104
+ type: 'form';
105
+ title: string;
106
+ children: ToonNode[];
107
+ }
108
+ export interface EmptyNode extends BaseNode {
109
+ type: 'empty';
110
+ title: string;
111
+ children: ToonNode[];
112
+ }
113
+ export interface TabNode extends BaseNode {
114
+ type: 'tab';
115
+ label: string;
116
+ children: ToonNode[];
117
+ }
118
+ export interface TabsNode extends BaseNode {
119
+ type: 'tabs';
120
+ title: string;
121
+ children: TabNode[];
122
+ }
123
+ export interface SectionNode extends BaseNode {
124
+ type: 'section';
80
125
  title: string;
81
126
  children: ToonNode[];
82
127
  }
128
+ export interface AccordionNode extends BaseNode {
129
+ type: 'accordion';
130
+ title: string;
131
+ children: SectionNode[];
132
+ }
133
+ export interface DialogNode extends BaseNode {
134
+ type: 'dialog';
135
+ title: string;
136
+ children: ToonNode[];
137
+ }
138
+ export interface SheetNode extends BaseNode {
139
+ type: 'sheet';
140
+ title: string;
141
+ side: SheetSide;
142
+ children: ToonNode[];
143
+ }
144
+ export interface PopoverNode extends BaseNode {
145
+ type: 'popover';
146
+ title: string;
147
+ children: ToonNode[];
148
+ }
149
+ export interface TooltipNode extends BaseNode {
150
+ type: 'tooltip';
151
+ text: string;
152
+ }
153
+ export interface ProgressNode extends BaseNode {
154
+ type: 'progress';
155
+ label: string;
156
+ value: number;
157
+ max: number;
158
+ }
159
+ export interface LoadingNode extends BaseNode {
160
+ type: 'loading';
161
+ text: string;
162
+ }
163
+ export interface ToastNode extends BaseNode {
164
+ type: 'toast';
165
+ variant: AlertVariant;
166
+ text: string;
167
+ }
168
+ export interface CrumbNode extends BaseNode {
169
+ type: 'crumb';
170
+ label: string;
171
+ action?: {
172
+ kind: 'reply';
173
+ value: string;
174
+ };
175
+ }
176
+ export interface BreadcrumbNode extends BaseNode {
177
+ type: 'breadcrumb';
178
+ children: CrumbNode[];
179
+ }
180
+ export interface PaginationNode extends BaseNode {
181
+ type: 'pagination';
182
+ page: number;
183
+ totalPages: number;
184
+ }
185
+ export interface ActionNode extends BaseNode {
186
+ type: 'action';
187
+ label: string;
188
+ action: {
189
+ kind: 'reply';
190
+ value: string;
191
+ } | {
192
+ kind: 'submit';
193
+ };
194
+ variant?: ButtonVariant;
195
+ }
196
+ export interface MenuNode extends BaseNode {
197
+ type: 'menu';
198
+ title: string;
199
+ children: ActionNode[];
200
+ }
201
+ export interface CommandNode extends BaseNode {
202
+ type: 'command';
203
+ title: string;
204
+ children: ActionNode[];
205
+ }
206
+ export interface ChartPointNode extends BaseNode {
207
+ type: 'point';
208
+ label: string;
209
+ value: number;
210
+ }
211
+ export interface ChartSeriesNode extends BaseNode {
212
+ type: 'series';
213
+ label: string;
214
+ children: ChartPointNode[];
215
+ }
216
+ export interface ChartNode extends BaseNode {
217
+ type: 'chart';
218
+ chartType: ChartType;
219
+ title: string;
220
+ xLabel?: string;
221
+ yLabel?: string;
222
+ children: ChartSeriesNode[];
223
+ }
83
224
  export interface ToonNodeByType {
84
225
  text: TextNode;
226
+ heading: HeadingNode;
227
+ separator: SeparatorNode;
85
228
  card: CardNode;
86
229
  form: FormNode;
87
230
  field: FieldNode;
@@ -92,15 +235,36 @@ export interface ToonNodeByType {
92
235
  badge: BadgeNode;
93
236
  alert: AlertNode;
94
237
  table: TableNode;
238
+ empty: EmptyNode;
239
+ tabs: TabsNode;
240
+ tab: TabNode;
241
+ accordion: AccordionNode;
242
+ section: SectionNode;
243
+ dialog: DialogNode;
244
+ sheet: SheetNode;
245
+ popover: PopoverNode;
246
+ tooltip: TooltipNode;
247
+ progress: ProgressNode;
248
+ loading: LoadingNode;
249
+ toast: ToastNode;
250
+ breadcrumb: BreadcrumbNode;
251
+ crumb: CrumbNode;
252
+ pagination: PaginationNode;
253
+ menu: MenuNode;
254
+ command: CommandNode;
255
+ action: ActionNode;
256
+ chart: ChartNode;
257
+ series: ChartSeriesNode;
258
+ point: ChartPointNode;
95
259
  }
96
260
  export type ToonNode = ToonNodeByType[keyof ToonNodeByType];
97
261
  export interface ToonDocument {
98
- type: "document";
262
+ type: 'document';
99
263
  body: ToonNode[];
100
264
  }
101
265
  export interface ToonBlock {
102
266
  raw: string;
103
- language: "toon-ui";
267
+ language: 'toon-ui';
104
268
  start: number;
105
269
  end: number;
106
270
  complete: boolean;
@@ -121,21 +285,23 @@ export interface ToonRules {
121
285
  buttonVariants: readonly ButtonVariant[];
122
286
  badgeVariants: readonly BadgeVariant[];
123
287
  alertVariants: readonly AlertVariant[];
288
+ confirmVariants: readonly ConfirmVariant[];
124
289
  fieldTypes: readonly FieldType[];
290
+ chartTypes: readonly ChartType[];
125
291
  }
126
292
  export interface ReplyPayload {
127
- kind: "ui_reply";
293
+ kind: 'ui_reply';
128
294
  eventId: string;
129
- source: "button";
295
+ source: 'button';
130
296
  value: string;
131
- component: "button";
297
+ component: 'button';
132
298
  line?: number;
133
299
  context?: Record<string, SubmitValue>;
134
300
  }
135
301
  export interface SubmitPayload {
136
- kind: "ui_submit";
302
+ kind: 'ui_submit';
137
303
  eventId: string;
138
- source: "form";
304
+ source: 'form';
139
305
  intent: string;
140
306
  formTitle: string;
141
307
  values: Record<string, SubmitValue>;
@@ -143,23 +309,23 @@ export interface SubmitPayload {
143
309
  }
144
310
  export type ToonInteractionPayload = ReplyPayload | SubmitPayload;
145
311
  export interface ToonChatMessage<TPayload extends ToonInteractionPayload = ToonInteractionPayload> {
146
- role: "user";
147
- kind: TPayload["kind"];
312
+ role: 'user';
313
+ kind: TPayload['kind'];
148
314
  content: string;
149
315
  displayContent: string;
150
316
  payload: TPayload;
151
317
  }
152
318
  export interface ToonChatUIMessageMetadata<TPayload extends ToonInteractionPayload = ToonInteractionPayload> {
153
319
  displayContent: string;
154
- kind: TPayload["kind"];
320
+ kind: TPayload['kind'];
155
321
  }
156
322
  export interface ToonChatUIMessagePart {
157
- type: "text";
323
+ type: 'text';
158
324
  text: string;
159
325
  }
160
326
  export interface ToonChatUIMessage<TPayload extends ToonInteractionPayload = ToonInteractionPayload> {
161
327
  id: string;
162
- role: "user";
328
+ role: 'user';
163
329
  parts: [ToonChatUIMessagePart];
164
330
  metadata: ToonChatUIMessageMetadata<TPayload>;
165
331
  }