orbital-ds 0.40.0 → 0.44.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.
Files changed (197) hide show
  1. package/AGENTS.md +29 -10
  2. package/components.manifest.json +6469 -3349
  3. package/dist/auth-form-B1hgbXkI.d.ts +144 -0
  4. package/dist/hooks/use-ds-messages.d.ts +89 -0
  5. package/dist/lib/a2ui-catalog.d.ts +42 -0
  6. package/dist/lib/a2ui-catalog.js +558 -0
  7. package/dist/lib/a2ui.d.ts +289 -0
  8. package/dist/lib/a2ui.js +215 -0
  9. package/dist/lib/ai-events.d.ts +15 -0
  10. package/dist/lib/ai-events.js +202 -0
  11. package/dist/lib/auth-flow.d.ts +3 -1
  12. package/dist/lib/auth-flow.js +24 -3
  13. package/dist/lib/format.d.ts +57 -0
  14. package/dist/lib/format.js +177 -0
  15. package/dist/lib/i18n.d.ts +96 -2
  16. package/dist/lib/i18n.js +278 -2
  17. package/dist/lib/locales/de.d.ts +7 -0
  18. package/dist/lib/locales/de.js +535 -0
  19. package/dist/lib/locales/fr.d.ts +7 -0
  20. package/dist/lib/locales/fr.js +535 -0
  21. package/dist/lib/locales/he.d.ts +7 -0
  22. package/dist/lib/locales/he.js +535 -0
  23. package/dist/lib/locales/it.d.ts +7 -0
  24. package/dist/lib/locales/it.js +535 -0
  25. package/dist/styles.css +62 -2
  26. package/dist/ui/a2ui-renderer.d.ts +44 -0
  27. package/dist/ui/a2ui-renderer.js +793 -0
  28. package/dist/ui/agent-events.d.ts +49 -0
  29. package/dist/ui/agent-events.js +108 -0
  30. package/dist/ui/ai-tag.d.ts +16 -0
  31. package/dist/ui/alert-dialog.d.ts +37 -0
  32. package/dist/ui/alert.d.ts +1 -1
  33. package/dist/ui/animated-number.d.ts +11 -0
  34. package/dist/ui/app-bar.d.ts +22 -0
  35. package/dist/ui/attachment.d.ts +1 -1
  36. package/dist/ui/auth-backdrop.d.ts +17 -0
  37. package/dist/ui/auth-form.d.ts +3 -110
  38. package/dist/ui/auth-form.js +46 -11
  39. package/dist/ui/auth-layout.d.ts +38 -0
  40. package/dist/ui/avatar.d.ts +27 -0
  41. package/dist/ui/ayuda.d.ts +1 -1
  42. package/dist/ui/ayuda.js +4 -1
  43. package/dist/ui/badge.d.ts +1 -1
  44. package/dist/ui/banner.d.ts +1 -1
  45. package/dist/ui/bottom-nav.d.ts +22 -0
  46. package/dist/ui/breadcrumb.d.ts +22 -0
  47. package/dist/ui/breadcrumb.js +1 -1
  48. package/dist/ui/bubble.d.ts +1 -1
  49. package/dist/ui/button.d.ts +2 -2
  50. package/dist/ui/calendar.d.ts +13 -0
  51. package/dist/ui/calendar.js +3 -0
  52. package/dist/ui/card-stack.d.ts +27 -0
  53. package/dist/ui/card.d.ts +33 -0
  54. package/dist/ui/carousel.d.ts +35 -0
  55. package/dist/ui/carousel.js +10 -5
  56. package/dist/ui/chain-of-thought.d.ts +34 -0
  57. package/dist/ui/chain-of-thought.js +90 -0
  58. package/dist/ui/chart-card.d.ts +19 -0
  59. package/dist/ui/chart.d.ts +19 -0
  60. package/dist/ui/chat-composer.d.ts +58 -0
  61. package/dist/ui/chat-composer.js +192 -0
  62. package/dist/ui/choice-card.d.ts +33 -0
  63. package/dist/ui/code-block.d.ts +15 -0
  64. package/dist/ui/combobox.d.ts +48 -0
  65. package/dist/ui/command-palette.d.ts +18 -0
  66. package/dist/ui/command.d.ts +34 -0
  67. package/dist/ui/confirm-action.d.ts +30 -0
  68. package/dist/ui/confirm-dialog.d.ts +23 -0
  69. package/dist/ui/content-card.d.ts +14 -0
  70. package/dist/ui/context-menu.d.ts +35 -0
  71. package/dist/ui/context-menu.js +1 -1
  72. package/dist/ui/conversation-list.d.ts +44 -0
  73. package/dist/ui/conversation-list.js +141 -0
  74. package/dist/ui/copy-button.d.ts +11 -0
  75. package/dist/ui/date-time.d.ts +40 -0
  76. package/dist/ui/date-time.js +55 -0
  77. package/dist/ui/description-list.d.ts +49 -0
  78. package/dist/ui/description-list.js +86 -0
  79. package/dist/ui/detail-panel.d.ts +22 -0
  80. package/dist/ui/dialog.d.ts +35 -0
  81. package/dist/ui/dock.d.ts +17 -0
  82. package/dist/ui/drawer.d.ts +41 -0
  83. package/dist/ui/dropdown-menu.d.ts +32 -0
  84. package/dist/ui/dropdown-menu.js +1 -1
  85. package/dist/ui/echart.d.ts +15 -0
  86. package/dist/ui/empty.d.ts +1 -1
  87. package/dist/ui/entity-list.d.ts +32 -0
  88. package/dist/ui/form-layout.d.ts +24 -0
  89. package/dist/ui/gauge.d.ts +26 -0
  90. package/dist/ui/generated-image.d.ts +33 -0
  91. package/dist/ui/generated-image.js +65 -0
  92. package/dist/ui/generated-table.d.ts +29 -0
  93. package/dist/ui/generated-table.js +59 -0
  94. package/dist/ui/heatmap-grid.d.ts +20 -0
  95. package/dist/ui/hero.d.ts +58 -0
  96. package/dist/ui/hero.js +145 -0
  97. package/dist/ui/i18n-provider.d.ts +16 -0
  98. package/dist/ui/icon-tile.d.ts +2 -2
  99. package/dist/ui/input-group.d.ts +1 -1
  100. package/dist/ui/input-otp.d.ts +23 -0
  101. package/dist/ui/input.d.ts +16 -0
  102. package/dist/ui/instruction-editor.d.ts +17 -0
  103. package/dist/ui/item.d.ts +3 -3
  104. package/dist/ui/label.d.ts +17 -0
  105. package/dist/ui/legend.d.ts +25 -0
  106. package/dist/ui/level-meter.d.ts +12 -0
  107. package/dist/ui/load-more.d.ts +17 -0
  108. package/dist/ui/loading-state.d.ts +12 -0
  109. package/dist/ui/markdown.d.ts +29 -0
  110. package/dist/ui/markdown.js +123 -0
  111. package/dist/ui/media-card.d.ts +16 -0
  112. package/dist/ui/menubar.d.ts +39 -0
  113. package/dist/ui/message-actions.d.ts +21 -0
  114. package/dist/ui/message-actions.js +79 -0
  115. package/dist/ui/message-scroller.d.ts +30 -0
  116. package/dist/ui/message.d.ts +33 -0
  117. package/dist/ui/mfa-challenge.d.ts +3 -32
  118. package/dist/ui/mfa-challenge.js +1 -1
  119. package/dist/ui/mfa-setup.d.ts +1 -1
  120. package/dist/ui/mosaic.d.ts +23 -0
  121. package/dist/ui/motion-provider.d.ts +17 -0
  122. package/dist/ui/native-select.d.ts +22 -0
  123. package/dist/ui/next-step-card.d.ts +55 -0
  124. package/dist/ui/next-step-card.js +92 -0
  125. package/dist/ui/notice-review.d.ts +32 -0
  126. package/dist/ui/oauth-consent.d.ts +1 -1
  127. package/dist/ui/page-header.d.ts +46 -4
  128. package/dist/ui/page-header.js +20 -11
  129. package/dist/ui/page-loader.d.ts +17 -0
  130. package/dist/ui/page-shell.d.ts +17 -0
  131. package/dist/ui/pagination.d.ts +20 -0
  132. package/dist/ui/pagination.js +2 -2
  133. package/dist/ui/panel.d.ts +1 -1
  134. package/dist/ui/password-strength.d.ts +14 -0
  135. package/dist/ui/popover.d.ts +32 -0
  136. package/dist/ui/proportion-bar.d.ts +25 -0
  137. package/dist/ui/quantity.d.ts +25 -0
  138. package/dist/ui/quantity.js +27 -0
  139. package/dist/ui/questionnaire.d.ts +38 -0
  140. package/dist/ui/reasoning.d.ts +24 -0
  141. package/dist/ui/reasoning.js +62 -0
  142. package/dist/ui/reveal.d.ts +17 -0
  143. package/dist/ui/sheet.d.ts +39 -2
  144. package/dist/ui/sheet.js +6 -2
  145. package/dist/ui/shield.d.ts +14 -0
  146. package/dist/ui/show-more.d.ts +14 -0
  147. package/dist/ui/sidebar.d.ts +4 -2
  148. package/dist/ui/sidebar.js +7 -3
  149. package/dist/ui/sparkline.d.ts +1 -1
  150. package/dist/ui/stat-group.d.ts +32 -0
  151. package/dist/ui/stat.d.ts +1 -1
  152. package/dist/ui/status-badge.d.ts +3 -3
  153. package/dist/ui/status-hero.d.ts +18 -0
  154. package/dist/ui/step-dots.d.ts +12 -0
  155. package/dist/ui/step-ring.d.ts +14 -0
  156. package/dist/ui/suggestions.d.ts +17 -0
  157. package/dist/ui/suggestions.js +39 -0
  158. package/dist/ui/table.d.ts +26 -0
  159. package/dist/ui/tag-input.d.ts +21 -0
  160. package/dist/ui/tag-input.js +169 -0
  161. package/dist/ui/task-loader.d.ts +15 -0
  162. package/dist/ui/task-progress.d.ts +14 -0
  163. package/dist/ui/textarea.d.ts +22 -1
  164. package/dist/ui/textarea.js +7 -1
  165. package/dist/ui/timeline.d.ts +26 -0
  166. package/dist/ui/toggle-group.d.ts +24 -0
  167. package/dist/ui/tool-call.d.ts +27 -0
  168. package/dist/ui/tool-call.js +74 -0
  169. package/dist/ui/usage-meter.d.ts +42 -0
  170. package/dist/ui/usage-meter.js +116 -0
  171. package/dist/ui/week-strip.d.ts +11 -0
  172. package/dist/ui/week-strip.js +2 -2
  173. package/dist/ui/workflow-run.d.ts +51 -0
  174. package/dist/ui/workflow-run.js +185 -0
  175. package/docs/adr/0001-rtl-clases-logicas.md +14 -1
  176. package/docs/designer/criterio.md +87 -87
  177. package/docs/designer/flujo.md +1 -1
  178. package/docs/designer/patrones.md +43 -2
  179. package/manifest/actions.json +364 -0
  180. package/manifest/agents.json +399 -0
  181. package/manifest/ai.json +128 -0
  182. package/manifest/auth.json +1547 -0
  183. package/manifest/chat.json +612 -0
  184. package/manifest/content.json +2298 -0
  185. package/manifest/data.json +2904 -0
  186. package/manifest/feedback.json +1005 -0
  187. package/manifest/forms.json +1954 -0
  188. package/manifest/motion.json +196 -0
  189. package/manifest/navigation.json +1792 -0
  190. package/manifest/overlays.json +931 -0
  191. package/package.json +35 -21
  192. package/scripts/cli.mjs +105 -8
  193. package/scripts/doctor.mjs +126 -1
  194. package/scripts/eslint-plugin.mjs +93 -0
  195. package/scripts/i18n.mjs +1 -1
  196. package/scripts/manifest.mjs +159 -7
  197. package/skill/SKILL.md +8 -3
@@ -0,0 +1,558 @@
1
+ import { A2UI_VERSION, ORBITAL_CATALOG_ID, isFunctionCall, isPathBinding } from "./a2ui.js";
2
+ const TONES = ["neutral", "primary", "info", "success", "warning", "danger"];
3
+ const JUSTIFY = ["start", "center", "end", "stretch", "spaceBetween", "spaceAround", "spaceEvenly"];
4
+ const ALIGN = ["start", "center", "end", "stretch"];
5
+ const weight = { type: "number", description: "Reparto del espacio sobrante; solo si el padre es Row o Column." };
6
+ const checks = { type: "object[]", description: "[{ condition: <@call devuelve booleano>, message }]: si falla, se muestra el mensaje (y el bot\xF3n se desactiva)." };
7
+ const A2UI_ICON_NAMES = [
8
+ "accountCircle",
9
+ "add",
10
+ "arrowBack",
11
+ "arrowForward",
12
+ "attachFile",
13
+ "calendarToday",
14
+ "call",
15
+ "camera",
16
+ "check",
17
+ "close",
18
+ "delete",
19
+ "download",
20
+ "edit",
21
+ "event",
22
+ "error",
23
+ "favorite",
24
+ "favoriteOff",
25
+ "folder",
26
+ "help",
27
+ "home",
28
+ "info",
29
+ "locationOn",
30
+ "lock",
31
+ "lockOpen",
32
+ "mail",
33
+ "menu",
34
+ "moreVert",
35
+ "moreHoriz",
36
+ "notifications",
37
+ "notificationsOff",
38
+ "pause",
39
+ "payment",
40
+ "person",
41
+ "phone",
42
+ "photo",
43
+ "play",
44
+ "print",
45
+ "refresh",
46
+ "search",
47
+ "send",
48
+ "settings",
49
+ "share",
50
+ "shoppingCart",
51
+ "star",
52
+ "starOff",
53
+ "upload",
54
+ "visibility",
55
+ "visibilityOff",
56
+ "warning",
57
+ "volumeUp",
58
+ "volumeOff",
59
+ // Extras de Orbital
60
+ "file",
61
+ "clock",
62
+ "shield",
63
+ "sparkles",
64
+ "bolt",
65
+ "bot",
66
+ "trendingUp",
67
+ "activity",
68
+ "wrench",
69
+ "users"
70
+ ];
71
+ const A2UI_CATALOG = [
72
+ {
73
+ name: "Row",
74
+ origin: "basic",
75
+ description: "Fila horizontal de hijos.",
76
+ use: "Agrupar elementos en l\xEDnea (acciones, etiqueta + valor).",
77
+ props: {
78
+ children: { type: "children", required: true, description: "Lista de ids, o { componentId, path } para repetir por cada elemento de una lista de datos." },
79
+ justify: { type: "string", values: JUSTIFY, description: "Eje horizontal (def. start)." },
80
+ align: { type: "string", values: ALIGN, description: "Eje vertical (def. stretch)." },
81
+ weight
82
+ }
83
+ },
84
+ {
85
+ name: "Column",
86
+ origin: "basic",
87
+ description: "Columna vertical de hijos.",
88
+ use: "Apilar contenido; es el contenedor por defecto de una tarjeta.",
89
+ props: {
90
+ children: { type: "children", required: true, description: "Igual que en Row." },
91
+ justify: { type: "string", values: JUSTIFY, description: "Eje vertical (def. start)." },
92
+ align: { type: "string", values: ALIGN, description: "Eje horizontal (def. stretch)." },
93
+ weight
94
+ }
95
+ },
96
+ {
97
+ name: "List",
98
+ origin: "basic",
99
+ description: "Lista de hijos, vertical u horizontal.",
100
+ use: "Colecciones de datos con plantilla { componentId, path }.",
101
+ props: {
102
+ children: { type: "children", required: true, description: "Igual que en Row." },
103
+ direction: { type: "string", values: ["vertical", "horizontal"], description: "Def. vertical." },
104
+ align: { type: "string", values: ALIGN, description: "Eje transversal." },
105
+ weight
106
+ }
107
+ },
108
+ {
109
+ name: "Card",
110
+ origin: "basic",
111
+ description: "Tarjeta con UN solo hijo.",
112
+ use: "Superficie sencilla; para cabecera, icono y pie usa Panel.",
113
+ props: { child: { type: "id", required: true, description: "Un \xFAnico hijo (usa Column para varios)." }, weight }
114
+ },
115
+ {
116
+ name: "Tabs",
117
+ origin: "basic",
118
+ description: "Pesta\xF1as.",
119
+ use: "Separar vistas del mismo asunto (m\xE1x. 4).",
120
+ props: { tabs: { type: "object[]", required: true, description: "[{ title, child }]." }, weight }
121
+ },
122
+ {
123
+ name: "Modal",
124
+ origin: "basic",
125
+ description: "Di\xE1logo que se abre desde un disparador.",
126
+ use: "Ayuda o detalle que no debe ocupar la pantalla.",
127
+ props: { trigger: { type: "id", required: true, description: "Componente que lo abre (un Button)." }, content: { type: "id", required: true, description: "Contenido del di\xE1logo." }, weight }
128
+ },
129
+ {
130
+ name: "Divider",
131
+ origin: "basic",
132
+ description: "Separador.",
133
+ use: "Solo para separar grupos con significado distinto.",
134
+ props: { axis: { type: "string", values: ["horizontal", "vertical"], description: "Def. horizontal." } }
135
+ },
136
+ {
137
+ name: "Text",
138
+ origin: "basic",
139
+ description: "Texto con Markdown sencillo (negrita, listas, enlaces, t\xEDtulos #).",
140
+ use: "Cuerpo y notas; para t\xEDtulos de secci\xF3n usa Heading.",
141
+ props: {
142
+ text: { type: "dynamic-string", required: true, description: "Texto o enlace a datos." },
143
+ variant: { type: "string", values: ["body", "caption"], description: "caption = m\xE1s peque\xF1o y atenuado." },
144
+ weight
145
+ }
146
+ },
147
+ {
148
+ name: "Image",
149
+ origin: "basic",
150
+ description: "Imagen (solo http(s), data:image, blob o ruta relativa).",
151
+ use: "Avatares, cabeceras y miniaturas.",
152
+ props: {
153
+ url: { type: "dynamic-string", required: true, description: "Direcci\xF3n." },
154
+ description: { type: "dynamic-string", description: "Texto alternativo (obligatorio si es informativa)." },
155
+ fit: { type: "string", values: ["contain", "cover", "fill", "none", "scaleDown"], description: "Ajuste." },
156
+ variant: { type: "string", values: ["icon", "avatar", "smallFeature", "mediumFeature", "largeFeature", "header"], description: "Tama\xF1o y forma." },
157
+ weight
158
+ }
159
+ },
160
+ {
161
+ name: "Icon",
162
+ origin: "basic",
163
+ description: "Icono suelto.",
164
+ use: "Reforzar un texto; no como \xFAnico portador de significado.",
165
+ props: { name: { type: "string", required: true, values: A2UI_ICON_NAMES, description: "Nombre del icono." }, weight }
166
+ },
167
+ {
168
+ name: "Video",
169
+ origin: "basic",
170
+ description: "V\xEDdeo con controles.",
171
+ use: "Contenido multimedia.",
172
+ props: { url: { type: "dynamic-string", required: true, description: "Direcci\xF3n." }, posterUrl: { type: "dynamic-string", description: "Portada." }, weight }
173
+ },
174
+ {
175
+ name: "AudioPlayer",
176
+ origin: "basic",
177
+ description: "Audio con controles.",
178
+ use: "Notas de voz.",
179
+ props: { url: { type: "dynamic-string", required: true, description: "Direcci\xF3n." }, description: { type: "dynamic-string", description: "T\xEDtulo." }, weight }
180
+ },
181
+ {
182
+ name: "Button",
183
+ origin: "basic",
184
+ description: "Bot\xF3n que dispara una acci\xF3n.",
185
+ use: "Una sola acci\xF3n principal (primary) por superficie.",
186
+ props: {
187
+ child: { type: "id", required: true, description: "Contenido (un Text, a veces con un Icon en un Row)." },
188
+ action: { type: "action", required: true, description: "{ event: { name, userMessage?, context? } } o { functionCall: { @call, args } }." },
189
+ variant: { type: "string", values: ["default", "primary", "borderless"], description: "primary = acci\xF3n principal; borderless = acci\xF3n secundaria discreta." },
190
+ "@checks": checks,
191
+ weight
192
+ }
193
+ },
194
+ {
195
+ name: "TextField",
196
+ origin: "basic",
197
+ description: "Campo de texto.",
198
+ use: "Entrada libre; enlaza `value` a un @path para recogerlo.",
199
+ props: {
200
+ label: { type: "dynamic-string", required: true, description: "Etiqueta visible." },
201
+ value: { type: "dynamic-string", required: true, description: "Normalmente { @path }." },
202
+ placeholder: { type: "dynamic-string", description: "Ejemplo, no sustituye a la etiqueta." },
203
+ variant: { type: "string", values: ["shortText", "longText", "number", "obscured"], description: "Tipo de campo." },
204
+ "@checks": checks,
205
+ weight
206
+ }
207
+ },
208
+ {
209
+ name: "CheckBox",
210
+ origin: "basic",
211
+ description: "Casilla.",
212
+ use: "S\xED/no independiente.",
213
+ props: { label: { type: "dynamic-string", required: true, description: "Etiqueta." }, value: { type: "dynamic-boolean", required: true, description: "Normalmente { @path }." }, "@checks": checks, weight }
214
+ },
215
+ {
216
+ name: "ChoicePicker",
217
+ origin: "basic",
218
+ description: "Elecci\xF3n entre opciones.",
219
+ use: "2\u20135 opciones: chips o casillas; m\xE1s, mejor un buscador.",
220
+ props: {
221
+ label: { type: "dynamic-string", description: "Etiqueta del grupo." },
222
+ options: { type: "object[]", required: true, description: "[{ label, value }]." },
223
+ value: { type: "dynamic-string-list", required: true, description: "{ @path } a una lista de valores elegidos." },
224
+ variant: { type: "string", values: ["multipleSelection", "mutuallyExclusive"], description: "Cu\xE1ntas se pueden elegir." },
225
+ displayStyle: { type: "string", values: ["checkbox", "chips"], description: "Aspecto." },
226
+ filterable: { type: "boolean", description: "Reservado." },
227
+ "@checks": checks,
228
+ weight
229
+ }
230
+ },
231
+ {
232
+ name: "Slider",
233
+ origin: "basic",
234
+ description: "Deslizador num\xE9rico.",
235
+ use: "Valores en un rango peque\xF1o (prioridad, nivel).",
236
+ props: {
237
+ value: { type: "dynamic-number", required: true, description: "Normalmente { @path }." },
238
+ max: { type: "number", required: true, description: "M\xE1ximo." },
239
+ min: { type: "number", description: "M\xEDnimo (def. 0)." },
240
+ steps: { type: "number", description: "N\xFAmero de pasos discretos (\u2265 1)." },
241
+ label: { type: "dynamic-string", description: "Etiqueta." },
242
+ "@checks": checks,
243
+ weight
244
+ }
245
+ },
246
+ {
247
+ name: "DateTimeInput",
248
+ origin: "basic",
249
+ description: "Fecha y/o hora.",
250
+ use: "Plazos y citas.",
251
+ props: {
252
+ value: { type: "dynamic-string", required: true, description: "Normalmente { @path } (ISO 8601)." },
253
+ enableDate: { type: "boolean", description: "Permite fecha (def. true)." },
254
+ enableTime: { type: "boolean", description: "Permite hora." },
255
+ min: { type: "dynamic-string", description: "M\xEDnimo." },
256
+ max: { type: "dynamic-string", description: "M\xE1ximo." },
257
+ label: { type: "dynamic-string", description: "Etiqueta." },
258
+ "@checks": checks,
259
+ weight
260
+ }
261
+ },
262
+ /* ── Orbital ── */
263
+ {
264
+ name: "Panel",
265
+ origin: "orbital",
266
+ description: "Tarjeta con cabecera (icono, t\xEDtulo, descripci\xF3n) y pie de acciones.",
267
+ use: "Contenedor principal de una secci\xF3n; da jerarqu\xEDa donde Card es plana.",
268
+ props: {
269
+ child: { type: "id", required: true, description: "Contenido (un Column)." },
270
+ title: { type: "dynamic-string", description: "T\xEDtulo de la cabecera." },
271
+ description: { type: "dynamic-string", description: "Subt\xEDtulo." },
272
+ icon: { type: "string", values: A2UI_ICON_NAMES, description: "Icono de la cabecera." },
273
+ tone: { type: "string", values: TONES, description: "Color del icono." },
274
+ footer: { type: "id", description: "Pie, normalmente un Row de Button con justify end." },
275
+ weight
276
+ }
277
+ },
278
+ {
279
+ name: "Heading",
280
+ origin: "orbital",
281
+ description: "T\xEDtulo de secci\xF3n.",
282
+ use: "Dar jerarqu\xEDa dentro de una superficie.",
283
+ props: {
284
+ text: { type: "dynamic-string", required: true, description: "T\xEDtulo." },
285
+ level: { type: "number", values: ["1", "2", "3"], description: "1 grande, 2 secci\xF3n (def.), 3 apartado." },
286
+ description: { type: "dynamic-string", description: "L\xEDnea de apoyo bajo el t\xEDtulo." },
287
+ weight
288
+ }
289
+ },
290
+ {
291
+ name: "IconTile",
292
+ origin: "orbital",
293
+ description: "Icono en una baldosa de color.",
294
+ use: "Identificar un elemento o estado de un vistazo.",
295
+ props: {
296
+ name: { type: "string", required: true, values: A2UI_ICON_NAMES, description: "Icono." },
297
+ tone: { type: "string", values: TONES, description: "Color (def. primary)." },
298
+ size: { type: "string", values: ["sm", "md", "lg"], description: "Tama\xF1o (def. md)." },
299
+ weight
300
+ }
301
+ },
302
+ {
303
+ name: "Badge",
304
+ origin: "orbital",
305
+ description: "Etiqueta corta de estado.",
306
+ use: "Estado de un elemento (\u2264 2 palabras).",
307
+ props: { text: { type: "dynamic-string", required: true, description: "Texto." }, tone: { type: "string", values: TONES, description: "Color sem\xE1ntico." }, weight }
308
+ },
309
+ {
310
+ name: "Progress",
311
+ origin: "orbital",
312
+ description: "Barra de avance con etiqueta y porcentaje.",
313
+ use: "Avance hacia un objetivo.",
314
+ props: {
315
+ value: { type: "dynamic-number", required: true, description: "Valor actual." },
316
+ max: { type: "number", description: "Objetivo (def. 100)." },
317
+ label: { type: "dynamic-string", description: "Qu\xE9 se mide." },
318
+ tone: { type: "string", values: TONES, description: "Color sem\xE1ntico." },
319
+ weight
320
+ }
321
+ },
322
+ {
323
+ name: "Stat",
324
+ origin: "orbital",
325
+ description: "Cifra clave con variaci\xF3n y descripci\xF3n.",
326
+ use: "Resumen num\xE9rico al inicio; 2\u20134 en un Row con weight 1.",
327
+ props: {
328
+ label: { type: "dynamic-string", required: true, description: "Qu\xE9 mide." },
329
+ value: { type: "dynamic-string", required: true, description: "Cifra (n\xFAmero o texto ya formateado)." },
330
+ delta: { type: "dynamic-number", description: "Variaci\xF3n en % frente al periodo anterior." },
331
+ description: { type: "dynamic-string", description: "Contexto." },
332
+ icon: { type: "string", values: A2UI_ICON_NAMES, description: "Icono." },
333
+ tone: { type: "string", values: ["neutral", "good", "warn", "bad"], description: "Estado de la cifra." },
334
+ weight
335
+ }
336
+ },
337
+ {
338
+ name: "Alert",
339
+ origin: "orbital",
340
+ description: "Aviso de la secci\xF3n.",
341
+ use: "Algo que la persona debe saber antes de actuar.",
342
+ props: {
343
+ text: { type: "dynamic-string", required: true, description: "Mensaje." },
344
+ title: { type: "dynamic-string", description: "T\xEDtulo breve." },
345
+ tone: { type: "string", values: ["info", "success", "warning", "danger"], description: "Gravedad (def. info)." },
346
+ weight
347
+ }
348
+ },
349
+ {
350
+ name: "ListItem",
351
+ origin: "orbital",
352
+ description: "Fila de lista con icono, t\xEDtulo, descripci\xF3n, etiqueta y acci\xF3n.",
353
+ use: "Colecci\xF3n de entidades (incidencias, tareas, archivos); \xFAsala con plantilla.",
354
+ props: {
355
+ title: { type: "dynamic-string", required: true, description: "T\xEDtulo." },
356
+ description: { type: "dynamic-string", description: "Detalle." },
357
+ icon: { type: "string", values: A2UI_ICON_NAMES, description: "Icono en baldosa." },
358
+ tone: { type: "string", values: TONES, description: "Color del icono." },
359
+ badge: { type: "dynamic-string", description: "Estado a la derecha." },
360
+ badgeTone: { type: "string", values: TONES, description: "Color de la etiqueta." },
361
+ action: { type: "id", description: "Componente a la derecha (un Button borderless)." },
362
+ weight
363
+ }
364
+ },
365
+ {
366
+ name: "Chart",
367
+ origin: "orbital",
368
+ description: "Gr\xE1fico (Apache ECharts) con los colores y la tipograf\xEDa del tema; solo datos, nunca opciones de ECharts.",
369
+ use: "Evoluci\xF3n (line/area), comparaci\xF3n (bar/horizontalBar), reparto (donut/pie) o un indicador (gauge). Los datos van en el modelo de datos para actualizarlos con updateDataModel.",
370
+ props: {
371
+ kind: { type: "string", required: true, values: ["line", "area", "bar", "horizontalBar", "donut", "pie", "gauge"], description: "Tipo de gr\xE1fico." },
372
+ title: { type: "dynamic-string", description: "T\xEDtulo de la tarjeta." },
373
+ description: { type: "dynamic-string", description: "Subt\xEDtulo (periodo, unidad)." },
374
+ categories: { type: "object[]", description: "line/area/bar: etiquetas del eje, lista o { @path }." },
375
+ series: { type: "object[]", description: "line/area/bar: [{ name, data: number[] }] (mismo largo que categories) o { @path }. M\xE1x. 12 series y 500 puntos." },
376
+ slices: { type: "object[]", description: "donut/pie: [{ name, value }] o { @path }." },
377
+ value: { type: "dynamic-number", description: "gauge: valor actual." },
378
+ min: { type: "number", description: "gauge: m\xEDnimo (0)." },
379
+ max: { type: "number", description: "gauge: m\xE1ximo (100)." },
380
+ stacked: { type: "boolean", description: "line/area/bar: apila las series." },
381
+ size: { type: "string", values: ["glance", "standard", "focus"], description: "Alto: glance (vistazo), standard, focus (gr\xE1fico principal)." },
382
+ weight
383
+ }
384
+ }
385
+ ];
386
+ const A2UI_DESIGN_RULES = [
387
+ 'La pintura empieza en el componente con id "root". Todos los dem\xE1s cuelgan de \xE9l.',
388
+ "Estructura: un Panel por secci\xF3n; dentro, un Column con gap; Heading para jerarqu\xEDa; Stat/Progress para cifras; ListItem para colecciones.",
389
+ "Una sola acci\xF3n principal por superficie (Button variant primary); las dem\xE1s, default o borderless. Pon las acciones al final, en un Row con justify end.",
390
+ 'Los datos vivos van en el modelo de datos y se enlazan con { "@path": "/ruta" }; no repitas el valor dentro del componente.',
391
+ 'Para colecciones usa children: { componentId, path } y, dentro de la plantilla, rutas relativas (sin barra inicial), p. ej. { "@path": "title" }.',
392
+ "Texto de la persona (formularios): recoge los valores con @path y devu\xE9lvelos con el `context` del evento del bot\xF3n.",
393
+ "No escribas colores, medidas ni estilos: usa `tone`, `variant` y `weight`; el tema de la app viste el resultado.",
394
+ "Cifras y fechas con funciones (formatNumber, formatCurrency, formatDate, pluralize), nunca como texto fijo si cambian.",
395
+ "Campos obligatorios: @checks con required/regex/email y un `message` claro; el bot\xF3n de env\xEDo se desactiva solo.",
396
+ "M\xE1ximo 3 niveles de anidaci\xF3n visual; no pongas una Card dentro de otra; Divider solo entre grupos distintos.",
397
+ "Texto breve, en el idioma de la persona; etiquetas con verbo en los botones (\xABEnviar solicitud\xBB, no \xABOK\xBB)."
398
+ ];
399
+ function a2uiAgentPrompt(options = {}) {
400
+ const catalog = options.catalog ?? "orbital";
401
+ const specs = A2UI_CATALOG.filter((c) => catalog === "orbital" || c.origin === "basic");
402
+ const lines = [];
403
+ lines.push(`You build user interfaces with A2UI ${A2UI_VERSION}. Reply with JSON messages only (a JSON array of messages).`);
404
+ lines.push("");
405
+ lines.push('MESSAGES (every message has "version": "1.0"):');
406
+ lines.push(`- createSurface: { surfaceId, catalogId: "${catalog === "orbital" ? ORBITAL_CATALOG_ID : "basic"}", components?, dataModel?, sendDataModel? } \u2014 components and dataModel let you paint the surface in one message.`);
407
+ lines.push("- updateComponents: { surfaceId, components: [...] } \u2014 adds or replaces components by id.");
408
+ lines.push("- updateDataModel: { surfaceId, path?, value? } \u2014 sets a value at a JSON Pointer; a null value deletes the key.");
409
+ lines.push("- deleteSurface: { surfaceId }.");
410
+ lines.push("");
411
+ lines.push('Components are a flat list: { id, component, ...props }. Children are referenced by id (never nested inline). Rendering starts at id "root".');
412
+ lines.push('Bindings: { "@path": "/a/b" } reads the data model; { "@call": "formatString", args: { value: "Hello ${/name}" } } computes a value.');
413
+ lines.push("Functions: formatString, formatNumber(value, decimals), formatCurrency(value, currency), formatDate(value), pluralize(value, one, other), required, regex(value, pattern), length(value, min, max), numeric(value, min, max), email, and, or, not.");
414
+ lines.push('Actions: { event: { name, userMessage?, context? } } (context values may be bindings) or { functionCall: { "@call": "openUrl", args: { url } } }.');
415
+ lines.push("");
416
+ lines.push("COMPONENTS:");
417
+ for (const c of specs) {
418
+ const props = Object.entries(c.props).filter(([k]) => k !== "weight").map(([k, p]) => `${k}${p.required ? "*" : ""}${p.values && p.values.length <= 8 ? `: ${p.values.join("|")}` : `: ${p.type}`}`).join(", ");
419
+ lines.push(`- ${c.name} \u2014 ${c.description} ${c.use} Props: ${props}.`);
420
+ }
421
+ lines.push("(* = required. Any component inside a Row or Column accepts weight.)");
422
+ lines.push(`Icon names: ${A2UI_ICON_NAMES.join(", ")}.`);
423
+ lines.push("");
424
+ lines.push("DESIGN RULES:");
425
+ A2UI_DESIGN_RULES.forEach((r, i) => lines.push(`${i + 1}. ${r}`));
426
+ return lines.join("\n");
427
+ }
428
+ const BY_NAME = new Map(A2UI_CATALOG.map((c) => [c.name, c]));
429
+ const MAX_COMPONENTS = 400;
430
+ function isObject(v) {
431
+ return typeof v === "object" && v !== null && !Array.isArray(v);
432
+ }
433
+ function refsOf(props, spec) {
434
+ const out = [];
435
+ for (const [key, p] of Object.entries(spec.props)) {
436
+ const value = props[key];
437
+ if (value === void 0) continue;
438
+ if (p.type === "id" && typeof value === "string") out.push(value);
439
+ if (p.type === "children") {
440
+ if (Array.isArray(value)) out.push(...value.filter((v) => typeof v === "string"));
441
+ else if (isObject(value) && typeof value.componentId === "string") out.push(value.componentId);
442
+ }
443
+ if (key === "tabs" && Array.isArray(value)) {
444
+ for (const t of value) if (isObject(t) && typeof t.child === "string") out.push(t.child);
445
+ }
446
+ }
447
+ return out;
448
+ }
449
+ function validateA2UI(messages, options = {}) {
450
+ const issues = [];
451
+ const allowBasicOnly = options.catalog === "basic";
452
+ const surfaces = /* @__PURE__ */ new Map();
453
+ const add = (level, message, surfaceId, componentId) => issues.push({ level, message, ...surfaceId !== void 0 ? { surfaceId } : {}, ...componentId !== void 0 ? { componentId } : {} });
454
+ const ingest = (surfaceId, components) => {
455
+ if (!Array.isArray(components)) return add("error", "components must be an array", surfaceId);
456
+ const map = surfaces.get(surfaceId) ?? /* @__PURE__ */ new Map();
457
+ surfaces.set(surfaceId, map);
458
+ for (const c of components) {
459
+ if (!isObject(c) || typeof c.id !== "string" || typeof c.component !== "string") {
460
+ add("error", "each component needs a string id and a string component name", surfaceId);
461
+ continue;
462
+ }
463
+ map.set(c.id, c);
464
+ }
465
+ if (map.size > MAX_COMPONENTS) add("warning", `more than ${MAX_COMPONENTS} components: simplify the interface`, surfaceId);
466
+ };
467
+ messages.forEach((raw, index) => {
468
+ if (!isObject(raw)) return add("error", `message ${index} is not an object`);
469
+ if (raw.version !== A2UI_VERSION) add("error", `message ${index}: version must be "1.0"`);
470
+ if (isObject(raw.createSurface)) {
471
+ const cs = raw.createSurface;
472
+ if (typeof cs.surfaceId !== "string") return add("error", `message ${index}: createSurface needs surfaceId`);
473
+ if ("theme" in cs) add("error", "theme is not allowed in A2UI 1.0: styling belongs to the app", cs.surfaceId);
474
+ surfaces.set(cs.surfaceId, /* @__PURE__ */ new Map());
475
+ if (cs.components !== void 0) ingest(cs.surfaceId, cs.components);
476
+ } else if (isObject(raw.updateComponents)) {
477
+ const uc = raw.updateComponents;
478
+ if (typeof uc.surfaceId !== "string") return add("error", `message ${index}: updateComponents needs surfaceId`);
479
+ if (!surfaces.has(uc.surfaceId)) add("warning", "updateComponents before createSurface", uc.surfaceId);
480
+ ingest(uc.surfaceId, uc.components);
481
+ } else if (isObject(raw.updateDataModel)) {
482
+ if (typeof raw.updateDataModel.surfaceId !== "string") add("error", `message ${index}: updateDataModel needs surfaceId`);
483
+ } else if (isObject(raw.deleteSurface)) {
484
+ const id = raw.deleteSurface.surfaceId;
485
+ if (typeof id === "string") surfaces.delete(id);
486
+ } else add("error", `message ${index}: expected createSurface, updateComponents, updateDataModel or deleteSurface`);
487
+ });
488
+ for (const [surfaceId, comps] of surfaces) {
489
+ if (comps.size > 0 && !comps.has("root")) add("error", 'no component with id "root": nothing will be painted', surfaceId);
490
+ const parents = /* @__PURE__ */ new Map();
491
+ for (const [id, c] of comps) {
492
+ const name = c.component;
493
+ const spec = BY_NAME.get(name);
494
+ if (!spec || allowBasicOnly && spec.origin !== "basic") {
495
+ add("error", `unknown component "${name}" in this catalog`, surfaceId, id);
496
+ continue;
497
+ }
498
+ for (const [key, p] of Object.entries(spec.props)) {
499
+ const v = c[key];
500
+ if (p.required && v === void 0) add("error", `${name}.${key} is required`, surfaceId, id);
501
+ if (v !== void 0 && p.values && p.type === "string" && typeof v === "string" && !p.values.includes(v)) {
502
+ add(key === "name" || key === "icon" ? "warning" : "error", `${name}.${key}="${v}" is not valid (use: ${p.values.slice(0, 10).join(", ")}${p.values.length > 10 ? ", \u2026" : ""})`, surfaceId, id);
503
+ }
504
+ if (v !== void 0 && p.type === "id" && typeof v !== "string") add("error", `${name}.${key} must be a component id`, surfaceId, id);
505
+ if (v !== void 0 && p.type === "children" && !Array.isArray(v) && !(isObject(v) && typeof v.componentId === "string" && typeof v.path === "string")) {
506
+ add("error", `${name}.${key} must be an id list or { componentId, path }`, surfaceId, id);
507
+ }
508
+ }
509
+ for (const key of Object.keys(c)) {
510
+ if (key === "id" || key === "component" || key.startsWith("@") || key === "weight") continue;
511
+ if (!(key in spec.props)) add("warning", `${name} has no property "${key}" (ignored)`, surfaceId, id);
512
+ }
513
+ if (c.action !== void 0 && spec.props.action?.type === "action" && !(isObject(c.action) && (isObject(c.action.event) || isFunctionCall(c.action.functionCall)))) {
514
+ if (!(isObject(c.action) && isObject(c.action.functionCall))) add("error", `${name}.action must be { event } or { functionCall }`, surfaceId, id);
515
+ }
516
+ for (const key of ["text", "label", "title", "value"]) {
517
+ const v = c[key];
518
+ if (isObject(v) && !isPathBinding(v) && !isFunctionCall(v)) add("error", `${name}.${key}: use a string, { "@path" } or { "@call" }`, surfaceId, id);
519
+ }
520
+ for (const ref of refsOf(c, spec)) {
521
+ if (!comps.has(ref)) add("error", `references missing component "${ref}"`, surfaceId, id);
522
+ else parents.set(ref, id);
523
+ }
524
+ }
525
+ for (const [id, c] of comps) {
526
+ if (typeof c.weight === "number") {
527
+ const parent = parents.get(id);
528
+ const parentName = parent ? comps.get(parent)?.component : void 0;
529
+ if (parentName !== "Row" && parentName !== "Column") add("warning", "weight only works when the parent is a Row or Column", surfaceId, id);
530
+ }
531
+ }
532
+ const state = /* @__PURE__ */ new Map();
533
+ const visit = (id) => {
534
+ if (state.get(id) === 2) return false;
535
+ if (state.get(id) === 1) return true;
536
+ state.set(id, 1);
537
+ const c = comps.get(id);
538
+ const spec = c ? BY_NAME.get(c.component) : void 0;
539
+ if (c && spec) {
540
+ for (const ref of refsOf(c, spec)) if (comps.has(ref) && visit(ref)) return true;
541
+ }
542
+ state.set(id, 2);
543
+ return false;
544
+ };
545
+ if (comps.has("root") && visit("root")) add("error", "the component tree has a cycle", surfaceId);
546
+ for (const id of comps.keys()) {
547
+ if (id !== "root" && !parents.has(id)) add("warning", "unreachable component (nothing references it)", surfaceId, id);
548
+ }
549
+ }
550
+ return issues;
551
+ }
552
+ export {
553
+ A2UI_CATALOG,
554
+ A2UI_DESIGN_RULES,
555
+ A2UI_ICON_NAMES,
556
+ a2uiAgentPrompt,
557
+ validateA2UI
558
+ };