orbital-ds 0.31.1 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/AGENTS.md +1 -1
  2. package/components.manifest.json +61 -4
  3. package/dist/hooks/use-ds-messages.d.ts +39 -0
  4. package/dist/lib/i18n.d.ts +39 -0
  5. package/dist/lib/i18n.js +117 -0
  6. package/dist/lib/template-syntax.d.ts +22 -0
  7. package/dist/lib/template-syntax.js +66 -0
  8. package/dist/styles.css +1699 -1678
  9. package/dist/themes/chocolate.css +259 -259
  10. package/dist/themes/chocolate.scoped.css +259 -259
  11. package/dist/themes/fractalia.css +2 -2
  12. package/dist/themes/fractalia.scoped.css +2 -2
  13. package/dist/themes/friendly.css +8 -8
  14. package/dist/themes/friendly.scoped.css +8 -8
  15. package/dist/themes/lagoon.css +11 -11
  16. package/dist/themes/lagoon.scoped.css +11 -11
  17. package/dist/themes/liquid.css +7 -7
  18. package/dist/themes/liquid.scoped.css +7 -7
  19. package/dist/themes/matcha.css +259 -259
  20. package/dist/themes/matcha.scoped.css +259 -259
  21. package/dist/themes/qratia.css +6 -6
  22. package/dist/themes/qratia.scoped.css +6 -6
  23. package/dist/themes/stone.css +263 -263
  24. package/dist/themes/stone.guide.md +30 -30
  25. package/dist/themes/stone.meta.json +47 -47
  26. package/dist/themes/stone.scoped.css +263 -263
  27. package/dist/themes/tactile.css +596 -596
  28. package/dist/themes/tactile.scoped.css +596 -596
  29. package/dist/themes/y2k.css +259 -259
  30. package/dist/themes/y2k.scoped.css +259 -259
  31. package/dist/themes/zyro.css +8 -8
  32. package/dist/themes/zyro.scoped.css +8 -8
  33. package/dist/ui/accordion.js +1 -1
  34. package/dist/ui/alert-dialog.js +1 -1
  35. package/dist/ui/alert.js +2 -2
  36. package/dist/ui/attachment.js +1 -1
  37. package/dist/ui/auth-form.js +4 -4
  38. package/dist/ui/auth-layout.d.ts +3 -1
  39. package/dist/ui/auth-layout.js +7 -4
  40. package/dist/ui/auth-parts.js +4 -4
  41. package/dist/ui/avatar.js +1 -1
  42. package/dist/ui/ayuda.js +1 -1
  43. package/dist/ui/badge.d.ts +1 -1
  44. package/dist/ui/badge.js +1 -1
  45. package/dist/ui/banner.js +1 -1
  46. package/dist/ui/bottom-nav.js +1 -1
  47. package/dist/ui/breadcrumb.js +1 -1
  48. package/dist/ui/bubble.d.ts +1 -1
  49. package/dist/ui/bubble.js +3 -3
  50. package/dist/ui/button-group.js +1 -1
  51. package/dist/ui/button.d.ts +1 -1
  52. package/dist/ui/button.js +4 -4
  53. package/dist/ui/calendar.js +6 -6
  54. package/dist/ui/carousel.js +4 -4
  55. package/dist/ui/choice-card.js +1 -1
  56. package/dist/ui/combobox.js +4 -4
  57. package/dist/ui/command.js +2 -2
  58. package/dist/ui/content-card.js +2 -2
  59. package/dist/ui/context-menu.js +9 -9
  60. package/dist/ui/data-table.d.ts +13 -3
  61. package/dist/ui/data-table.js +164 -71
  62. package/dist/ui/date-picker.js +1 -1
  63. package/dist/ui/dialog.js +1 -1
  64. package/dist/ui/drawer.js +5 -5
  65. package/dist/ui/dropdown-menu.js +9 -9
  66. package/dist/ui/field.js +3 -3
  67. package/dist/ui/heatmap-grid.js +2 -2
  68. package/dist/ui/input-group.js +3 -3
  69. package/dist/ui/input-otp.js +1 -1
  70. package/dist/ui/instruction-editor.d.ts +51 -0
  71. package/dist/ui/instruction-editor.js +327 -0
  72. package/dist/ui/item.d.ts +1 -1
  73. package/dist/ui/item.js +1 -1
  74. package/dist/ui/marker.d.ts +1 -1
  75. package/dist/ui/marker.js +2 -2
  76. package/dist/ui/menubar.js +8 -8
  77. package/dist/ui/mfa-challenge.js +3 -3
  78. package/dist/ui/mfa-setup.js +1 -1
  79. package/dist/ui/navigation-menu.js +2 -2
  80. package/dist/ui/oauth-consent.js +3 -3
  81. package/dist/ui/pagination.js +2 -2
  82. package/dist/ui/panel.d.ts +1 -1
  83. package/dist/ui/panel.js +1 -0
  84. package/dist/ui/passkey-list.js +1 -1
  85. package/dist/ui/resizable.js +1 -1
  86. package/dist/ui/scroll-area.js +1 -1
  87. package/dist/ui/session-timeout.js +1 -1
  88. package/dist/ui/sheet.js +2 -2
  89. package/dist/ui/sidebar.js +7 -7
  90. package/dist/ui/sign-out-dialog.js +1 -1
  91. package/dist/ui/sparkline.d.ts +1 -1
  92. package/dist/ui/status-badge.d.ts +2 -2
  93. package/dist/ui/switch.js +1 -1
  94. package/dist/ui/table.js +2 -2
  95. package/dist/ui/tabs.d.ts +1 -1
  96. package/dist/ui/tabs.js +2 -2
  97. package/dist/ui/toast.js +3 -3
  98. package/dist/ui/toggle-group.js +1 -1
  99. package/dist/ui/toggle.js +3 -3
  100. package/dist/ui/tooltip.js +2 -2
  101. package/docs/CONTRACT.md +224 -224
  102. package/package.json +218 -188
  103. package/scripts/cli.mjs +457 -457
  104. package/scripts/doctor.mjs +2 -0
  105. package/scripts/manifest.mjs +100 -100
package/AGENTS.md CHANGED
@@ -175,7 +175,7 @@ en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`,
175
175
  4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
176
176
  5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
177
177
  6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
178
- 7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `Sidebar` (app · workspace · admin · focus, con `density`), `ChartCard` (glance · standard · focus · dense), `ContentCard` (basic · feature · media · horizontal, con `emphasis` elevated · outlined · filled · ghost), `Mosaic` (even · bento · trio), `PageShell` (content · detail · canvas), `PageHeader` (page · compact · canvas), `FilterBar` (inline · compact · stacked), `DataTable` (browse · manage · compact), `LoadingState` (list · card · table · detail), `PageLoader` (splash · route · section · overlay), `CommandPalette` (go · actions · search), `FileUpload` (drop · button), `ErrorPage` (not-found · forbidden · server-error · offline · maintenance, con `tone` neutral · playful), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
178
+ 7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `Sidebar` (app · workspace · admin · focus, con `density`), `ChartCard` (glance · standard · focus · dense), `ContentCard` (basic · feature · media · horizontal, con `emphasis` elevated · outlined · filled · ghost), `Mosaic` (even · bento · trio), `PageShell` (content · detail · canvas), `PageHeader` (page · compact · canvas), `FilterBar` (inline · compact · stacked), `DataTable` (browse · manage · compact · grouped · tree), `LoadingState` (list · card · table · detail), `PageLoader` (splash · route · section · overlay), `CommandPalette` (go · actions · search), `FileUpload` (drop · button), `ErrorPage` (not-found · forbidden · server-error · offline · maintenance, con `tone` neutral · playful), `DetailPanel` (side · bottom · full), `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
179
179
  (inline · sectioned · settings), `NoticeReview` (read · acknowledge · resolve · respond), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
180
180
  compact · comparison · strip) `ConfirmAction` (simple · typed) y, en el acceso (P13), `AuthLayout` (centered · split · cover · banner · minimal),
181
181
  `AuthForm` (sign-in · social · sign-up · magic-link · email-code · sso · forgot-password · reset-password),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "orbital-ds",
3
- "version": "0.31.1",
3
+ "version": "0.36.0",
4
4
  "engine": "@base-ui/react",
5
5
  "docs": [
6
6
  "README.md",
@@ -303,6 +303,8 @@
303
303
  },
304
304
  "notes": [
305
305
  "Presets: `centered` por defecto (cualquier app); `split` para producto con historia de marca (SaaS, portales: panel con propuesta de valor o testimonio); `cover` cuando hay una imagen potente (consumo, eventos); `banner` para portales corporativos con logo protagonista; `minimal` para herramientas internas o incrustado en otra página.",
306
+ "`AuthAside align=\"center\"` agrupa logo y texto centrados en vertical (portal corporativo con titular, texto y 3 puntos); por defecto reparte logo arriba y texto abajo.",
307
+ "Degradado primario → secundario en el panel: en brand.css `--ds-auth-aside-from: var(--primary); --ds-auth-aside-to: var(--secondary);` (el doctor mide el contraste del texto sobre el panel).",
306
308
  "La marca va en brand.css: --ds-auth-aside-bg/-fg/-image (panel), --ds-auth-fx-1/2/3 (fondos), --ds-auth-radius, --ds-auth-glass. El doctor mide el contraste del texto del panel (AA).",
307
309
  "`motion=\"full\"` aplica siempre los fondos animados; `entrance` deja solo la entrada; `off` lo para todo. Con movimiento reducido del sistema, todo queda quieto (WCAG 2.3.3).",
308
310
  "`toolbar` es para idioma y tema, siempre visibles; `footer` para enlaces legales y soporte."
@@ -963,6 +965,7 @@
963
965
  "data-table-empty-row",
964
966
  "data-table-filter",
965
967
  "data-table-footer",
968
+ "data-table-group",
966
969
  "data-table-head",
967
970
  "data-table-header",
968
971
  "data-table-no-data",
@@ -984,18 +987,23 @@
984
987
  "values": [
985
988
  "browse",
986
989
  "manage",
987
- "compact"
990
+ "compact",
991
+ "grouped",
992
+ "tree"
988
993
  ],
989
994
  "default": "browse",
990
995
  "intent": {
991
996
  "browse": "consultar datos: búsqueda y columnas visibles, filas cómodas, sin selección",
992
997
  "manage": "gestionar registros: añade selección de filas para acciones en lote",
993
- "compact": "tabla dentro de un panel o una tarjeta: filas densas, sin selector de columnas"
998
+ "compact": "tabla dentro de un panel o una tarjeta: filas densas, sin selector de columnas",
999
+ "grouped": "filas agrupadas bajo cabeceras plegables (`groupBy`): ordena antes por la clave del grupo",
1000
+ "tree": "filas anidadas y expandibles (`getSubRows`): la búsqueda y el orden valen para toda la jerarquía"
994
1001
  }
995
1002
  },
996
1003
  "notes": [
997
1004
  "Presets: `browse` consulta, `manage` añade selección para actuar, `compact` es denso y sin menú de columnas; cualquier prop explícita los sobrescribe.",
998
1005
  "Para muchas filas, comparar y ordenar; para 3–5 elementos usa Item variant=\"card\". Estado en la URL con dataTableStateToSearch.",
1006
+ "`grouped`: `groupBy` agrupa la página en cabeceras plegables (ordena antes por esa clave para que cada grupo no se parta entre páginas). `tree`: `getSubRows` da jerarquía; la búsqueda, el filtro y el orden valen para toda ella, la paginación cuenta las filas raíz.",
999
1007
  "Cifras con DataTableNumber (alineadas, tabular-nums); acciones por fila en un menú; sin resultados con Empty y «Limpiar filtros»."
1000
1008
  ]
1001
1009
  },
@@ -1603,6 +1611,52 @@
1603
1611
  ],
1604
1612
  "optionalPeers": []
1605
1613
  },
1614
+ "instruction-editor": {
1615
+ "import": "orbital-ds/ui/instruction-editor",
1616
+ "exports": [
1617
+ "InstructionEditor"
1618
+ ],
1619
+ "slots": [
1620
+ "instruction-editor",
1621
+ "instruction-editor-body",
1622
+ "instruction-editor-count",
1623
+ "instruction-editor-issues",
1624
+ "instruction-editor-preview",
1625
+ "instruction-editor-snippets",
1626
+ "instruction-editor-stats",
1627
+ "instruction-editor-toolbar",
1628
+ "instruction-editor-variables"
1629
+ ],
1630
+ "optionalPeers": [
1631
+ "@tiptap/extension-placeholder",
1632
+ "@tiptap/markdown",
1633
+ "@tiptap/react",
1634
+ "@tiptap/starter-kit"
1635
+ ],
1636
+ "presets": {
1637
+ "values": [
1638
+ "prompt",
1639
+ "document",
1640
+ "compact"
1641
+ ],
1642
+ "default": "prompt",
1643
+ "intent": {
1644
+ "prompt": "instrucciones o prompt de sistema: visual + markdown + vista previa, variables y contador",
1645
+ "document": "documento largo: las cuatro vistas y la barra completa",
1646
+ "compact": "comentario o nota corta: solo visual, barra mínima, área baja"
1647
+ }
1648
+ },
1649
+ "notes": [
1650
+ "Preset `prompt` para instrucciones o prompts de sistema (el modelo recibe el Markdown); `document` para texto largo con vista HTML; `compact` para notas y comentarios.",
1651
+ "Tiptap es dependencia opcional: instala `@tiptap/react @tiptap/pm @tiptap/starter-kit @tiptap/markdown @tiptap/extension-placeholder`. Carga el componente con `React.lazy` si quieres que no pese en el resto de la app.",
1652
+ "En la vista Markdown la barra inserta la sintaxis en el texto (##, **, listas, citas, bloque de código) sobre la selección y la quita si ya está; sin deshacer/rehacer propios (usa el del navegador).",
1653
+ "La vista HTML es solo de lectura (no se edita HTML ni se inyecta con innerHTML): la fuente de verdad es el Markdown.",
1654
+ "Las variables se insertan como texto `{{nombre}}`; sustituirlas al enviar el prompt es cosa de la app.",
1655
+ "`syntax=\"template\"` reconoce `{{v | \"x\"}}`, `{{v ? \"a\" : \"b\"}}`, `[[IF]]/[[ELSE]]/[[UNLESS]]`: añade fragmentos a la barra y avisa de condiciones que el motor trataría como falsas, bloques sin cerrar y variables fuera de `variables`. El editor no renderiza plantillas.",
1656
+ "`renderPreview` la pone la app (con su motor y variables de ejemplo) y alimenta la vista «Vista previa»; `stats` muestra, por ejemplo, tokens TOON frente a JSON. Sin ella, la vista previa es el documento de solo lectura.",
1657
+ "Medidas en --ds-editor-min-h, -max-h y -p; la tipografía del contenido usa los pesos del tema."
1658
+ ]
1659
+ },
1606
1660
  "item": {
1607
1661
  "import": "orbital-ds/ui/item",
1608
1662
  "exports": [
@@ -2262,7 +2316,10 @@
2262
2316
  "panelVariants"
2263
2317
  ],
2264
2318
  "slots": [],
2265
- "optionalPeers": []
2319
+ "optionalPeers": [],
2320
+ "notes": [
2321
+ "`variant=\"glass\"` es el envoltorio de cristal esmerilado y flotante para agrupar tarjetas o KPI (con `size` mayor y las tarjetas dentro, sin repetir el efecto). Se ajusta con --ds-panel-glass-bg/-border/-blur/-saturate/-shadow. Úsalo sobre un fondo con color o imagen: sobre blanco liso no se nota el cristal."
2322
+ ]
2266
2323
  },
2267
2324
  "passkey-list": {
2268
2325
  "import": "orbital-ds/ui/passkey-list",
@@ -148,6 +148,45 @@ declare const DsMessagesContext: React.Context<{
148
148
  heatmapHigh: string;
149
149
  dataTableFilter: string;
150
150
  dataTableLoading: string;
151
+ editorToolbar: string;
152
+ editorBold: string;
153
+ editorItalic: string;
154
+ editorStrike: string;
155
+ editorCode: string;
156
+ editorHeading: string;
157
+ editorBulletList: string;
158
+ editorOrderedList: string;
159
+ editorQuote: string;
160
+ editorCodeBlock: string;
161
+ editorUndo: string;
162
+ editorRedo: string;
163
+ editorVariables: string;
164
+ editorModes: string;
165
+ editorModeVisual: string;
166
+ editorModeMarkdown: string;
167
+ editorModeHtml: string;
168
+ editorModePreview: string;
169
+ editorPlaceholder: string;
170
+ editorCount: string;
171
+ editorSnippets: string;
172
+ editorSnippetDefault: string;
173
+ editorSnippetTernary: string;
174
+ editorSnippetIf: string;
175
+ editorSnippetIfElse: string;
176
+ editorSnippetUnless: string;
177
+ editorIssues: string;
178
+ editorIssueCondition: string;
179
+ editorIssueUnclosed: string;
180
+ editorIssueStray: string;
181
+ editorIssueSyntax: string;
182
+ editorIssueVariable: string;
183
+ editorPreviewSent: string;
184
+ editorPreviewEmpty: string;
185
+ editorStats: string;
186
+ dataTableExpandRow: string;
187
+ dataTableCollapseRow: string;
188
+ dataTableExpandGroup: string;
189
+ dataTableCollapseGroup: string;
151
190
  dropzoneTooMany: string;
152
191
  calendarPrevious: string;
153
192
  calendarNext: string;
@@ -147,6 +147,45 @@ declare const en: {
147
147
  heatmapHigh: string;
148
148
  dataTableFilter: string;
149
149
  dataTableLoading: string;
150
+ editorToolbar: string;
151
+ editorBold: string;
152
+ editorItalic: string;
153
+ editorStrike: string;
154
+ editorCode: string;
155
+ editorHeading: string;
156
+ editorBulletList: string;
157
+ editorOrderedList: string;
158
+ editorQuote: string;
159
+ editorCodeBlock: string;
160
+ editorUndo: string;
161
+ editorRedo: string;
162
+ editorVariables: string;
163
+ editorModes: string;
164
+ editorModeVisual: string;
165
+ editorModeMarkdown: string;
166
+ editorModeHtml: string;
167
+ editorModePreview: string;
168
+ editorPlaceholder: string;
169
+ editorCount: string;
170
+ editorSnippets: string;
171
+ editorSnippetDefault: string;
172
+ editorSnippetTernary: string;
173
+ editorSnippetIf: string;
174
+ editorSnippetIfElse: string;
175
+ editorSnippetUnless: string;
176
+ editorIssues: string;
177
+ editorIssueCondition: string;
178
+ editorIssueUnclosed: string;
179
+ editorIssueStray: string;
180
+ editorIssueSyntax: string;
181
+ editorIssueVariable: string;
182
+ editorPreviewSent: string;
183
+ editorPreviewEmpty: string;
184
+ editorStats: string;
185
+ dataTableExpandRow: string;
186
+ dataTableCollapseRow: string;
187
+ dataTableExpandGroup: string;
188
+ dataTableCollapseGroup: string;
150
189
  dropzoneTooMany: string;
151
190
  calendarPrevious: string;
152
191
  calendarNext: string;
package/dist/lib/i18n.js CHANGED
@@ -146,6 +146,45 @@ const en = {
146
146
  heatmapHigh: "High",
147
147
  dataTableFilter: "Filter",
148
148
  dataTableLoading: "Loading data",
149
+ editorToolbar: "Formatting",
150
+ editorBold: "Bold",
151
+ editorItalic: "Italic",
152
+ editorStrike: "Strikethrough",
153
+ editorCode: "Inline code",
154
+ editorHeading: "Heading",
155
+ editorBulletList: "Bulleted list",
156
+ editorOrderedList: "Numbered list",
157
+ editorQuote: "Quote",
158
+ editorCodeBlock: "Code block",
159
+ editorUndo: "Undo",
160
+ editorRedo: "Redo",
161
+ editorVariables: "Variables",
162
+ editorModes: "Editor view",
163
+ editorModeVisual: "Visual",
164
+ editorModeMarkdown: "Markdown",
165
+ editorModeHtml: "HTML",
166
+ editorModePreview: "Preview",
167
+ editorPlaceholder: "Write here\u2026",
168
+ editorCount: "{count} characters",
169
+ editorSnippets: "Logic",
170
+ editorSnippetDefault: "Default value",
171
+ editorSnippetTernary: "Yes/no value",
172
+ editorSnippetIf: "If",
173
+ editorSnippetIfElse: "If / else",
174
+ editorSnippetUnless: "Unless",
175
+ editorIssues: "Template warnings",
176
+ editorIssueCondition: "Line {line}: condition \xAB{text}\xBB is not recognized; it is evaluated as false.",
177
+ editorIssueUnclosed: "Line {line}: {text} is never closed.",
178
+ editorIssueStray: "Line {line}: {text} has no matching opening.",
179
+ editorIssueSyntax: "Line {line}: {text} is not valid and is left as written.",
180
+ editorIssueVariable: "Line {line}: variable \xAB{text}\xBB is not in the list.",
181
+ editorPreviewSent: "What the model receives",
182
+ editorPreviewEmpty: "Nothing to show yet.",
183
+ editorStats: "Size",
184
+ dataTableExpandRow: "Expand row",
185
+ dataTableCollapseRow: "Collapse row",
186
+ dataTableExpandGroup: "Expand group {group}",
187
+ dataTableCollapseGroup: "Collapse group {group}",
149
188
  dropzoneTooMany: "{name}: up to {n} files",
150
189
  calendarPrevious: "Previous month",
151
190
  calendarNext: "Next month",
@@ -527,6 +566,45 @@ const es = {
527
566
  heatmapHigh: "Alto",
528
567
  dataTableFilter: "Filtrar",
529
568
  dataTableLoading: "Cargando datos",
569
+ editorToolbar: "Formato",
570
+ editorBold: "Negrita",
571
+ editorItalic: "Cursiva",
572
+ editorStrike: "Tachado",
573
+ editorCode: "C\xF3digo en l\xEDnea",
574
+ editorHeading: "T\xEDtulo",
575
+ editorBulletList: "Lista con vi\xF1etas",
576
+ editorOrderedList: "Lista numerada",
577
+ editorQuote: "Cita",
578
+ editorCodeBlock: "Bloque de c\xF3digo",
579
+ editorUndo: "Deshacer",
580
+ editorRedo: "Rehacer",
581
+ editorVariables: "Variables",
582
+ editorModes: "Vista del editor",
583
+ editorModeVisual: "Visual",
584
+ editorModeMarkdown: "Markdown",
585
+ editorModeHtml: "HTML",
586
+ editorModePreview: "Vista previa",
587
+ editorPlaceholder: "Escribe aqu\xED\u2026",
588
+ editorCount: "{count} caracteres",
589
+ editorSnippets: "L\xF3gica",
590
+ editorSnippetDefault: "Valor por defecto",
591
+ editorSnippetTernary: "Valor s\xED/no",
592
+ editorSnippetIf: "Si",
593
+ editorSnippetIfElse: "Si / si no",
594
+ editorSnippetUnless: "Salvo si",
595
+ editorIssues: "Avisos de la plantilla",
596
+ editorIssueCondition: "L\xEDnea {line}: la condici\xF3n \xAB{text}\xBB no se reconoce; se eval\xFAa como falsa.",
597
+ editorIssueUnclosed: "L\xEDnea {line}: {text} no se cierra nunca.",
598
+ editorIssueStray: "L\xEDnea {line}: {text} no tiene su apertura.",
599
+ editorIssueSyntax: "L\xEDnea {line}: {text} no es v\xE1lido y se deja tal cual.",
600
+ editorIssueVariable: "L\xEDnea {line}: la variable \xAB{text}\xBB no est\xE1 en la lista.",
601
+ editorPreviewSent: "Lo que recibe el modelo",
602
+ editorPreviewEmpty: "A\xFAn no hay nada que mostrar.",
603
+ editorStats: "Tama\xF1o",
604
+ dataTableExpandRow: "Expandir fila",
605
+ dataTableCollapseRow: "Contraer fila",
606
+ dataTableExpandGroup: "Expandir grupo {group}",
607
+ dataTableCollapseGroup: "Contraer grupo {group}",
530
608
  dropzoneTooMany: "{name}: m\xE1ximo {n} ficheros",
531
609
  calendarPrevious: "Mes anterior",
532
610
  calendarNext: "Mes siguiente",
@@ -908,6 +986,45 @@ const ptBR = {
908
986
  heatmapHigh: "Alto",
909
987
  dataTableFilter: "Filtrar",
910
988
  dataTableLoading: "Carregando dados",
989
+ editorToolbar: "Formata\xE7\xE3o",
990
+ editorBold: "Negrito",
991
+ editorItalic: "It\xE1lico",
992
+ editorStrike: "Tachado",
993
+ editorCode: "C\xF3digo em linha",
994
+ editorHeading: "T\xEDtulo",
995
+ editorBulletList: "Lista com marcadores",
996
+ editorOrderedList: "Lista numerada",
997
+ editorQuote: "Cita\xE7\xE3o",
998
+ editorCodeBlock: "Bloco de c\xF3digo",
999
+ editorUndo: "Desfazer",
1000
+ editorRedo: "Refazer",
1001
+ editorVariables: "Vari\xE1veis",
1002
+ editorModes: "Visualiza\xE7\xE3o do editor",
1003
+ editorModeVisual: "Visual",
1004
+ editorModeMarkdown: "Markdown",
1005
+ editorModeHtml: "HTML",
1006
+ editorModePreview: "Pr\xE9-visualiza\xE7\xE3o",
1007
+ editorPlaceholder: "Escreva aqui\u2026",
1008
+ editorCount: "{count} caracteres",
1009
+ editorSnippets: "L\xF3gica",
1010
+ editorSnippetDefault: "Valor padr\xE3o",
1011
+ editorSnippetTernary: "Valor sim/n\xE3o",
1012
+ editorSnippetIf: "Se",
1013
+ editorSnippetIfElse: "Se / sen\xE3o",
1014
+ editorSnippetUnless: "Exceto se",
1015
+ editorIssues: "Avisos do modelo",
1016
+ editorIssueCondition: "Linha {line}: a condi\xE7\xE3o \xAB{text}\xBB n\xE3o \xE9 reconhecida; \xE9 avaliada como falsa.",
1017
+ editorIssueUnclosed: "Linha {line}: {text} nunca \xE9 fechado.",
1018
+ editorIssueStray: "Linha {line}: {text} n\xE3o tem a abertura correspondente.",
1019
+ editorIssueSyntax: "Linha {line}: {text} n\xE3o \xE9 v\xE1lido e fica como est\xE1.",
1020
+ editorIssueVariable: "Linha {line}: a vari\xE1vel \xAB{text}\xBB n\xE3o est\xE1 na lista.",
1021
+ editorPreviewSent: "O que o modelo recebe",
1022
+ editorPreviewEmpty: "Ainda n\xE3o h\xE1 nada para mostrar.",
1023
+ editorStats: "Tamanho",
1024
+ dataTableExpandRow: "Expandir linha",
1025
+ dataTableCollapseRow: "Recolher linha",
1026
+ dataTableExpandGroup: "Expandir grupo {group}",
1027
+ dataTableCollapseGroup: "Recolher grupo {group}",
911
1028
  dropzoneTooMany: "{name}: m\xE1ximo de {n} arquivos",
912
1029
  calendarPrevious: "M\xEAs anterior",
913
1030
  calendarNext: "Pr\xF3ximo m\xEAs",
@@ -0,0 +1,22 @@
1
+ type TemplateIssueCode = "condition" | "unclosed" | "stray" | "syntax" | "variable";
2
+ interface TemplateIssue {
3
+ code: TemplateIssueCode;
4
+ /** Texto que causa el aviso (condición, marcador o variable). */
5
+ text: string;
6
+ /** Línea, desde 1. */
7
+ line: number;
8
+ }
9
+ declare function isValidCondition(cond: string): boolean;
10
+ /** Revisa una plantilla. `variables` (opcional) activa el aviso de variables desconocidas. */
11
+ declare function analyzeTemplate(source: string, variables?: readonly string[]): TemplateIssue[];
12
+ /** Fragmentos que la barra puede insertar. */
13
+ declare const TEMPLATE_SNIPPETS: {
14
+ readonly default: "{{variable | \"default\"}}";
15
+ readonly ternary: "{{variable ? \"yes\" : \"no\"}}";
16
+ readonly if: "[[IF variable]]\n\n[[/IF]]";
17
+ readonly ifElse: "[[IF variable]]\n\n[[ELSE]]\n\n[[/IF]]";
18
+ readonly unless: "[[UNLESS variable]]\n\n[[/UNLESS]]";
19
+ };
20
+ type TemplateSnippet = keyof typeof TEMPLATE_SNIPPETS;
21
+
22
+ export { TEMPLATE_SNIPPETS, type TemplateIssue, type TemplateIssueCode, type TemplateSnippet, analyzeTemplate, isValidCondition };
@@ -0,0 +1,66 @@
1
+ const COND_RES = [
2
+ /^\w+$/,
3
+ /^(\w+)\s*(==|!=)\s*(true|false)$/,
4
+ /^(\w+)\s*(==|!=)\s*"(.+)"$/,
5
+ /^(\w+)\s*(>=|<=|>|<)\s*(\d+)$/
6
+ ];
7
+ function isValidCondition(cond) {
8
+ const c = cond.trim();
9
+ return COND_RES.some((re) => re.test(c));
10
+ }
11
+ const lineOf = (src, index) => src.slice(0, index).split("\n").length;
12
+ function analyzeTemplate(source, variables) {
13
+ const issues = [];
14
+ const known = variables ? new Set(variables) : null;
15
+ const checkVar = (name, index) => {
16
+ if (known && !known.has(name)) issues.push({ code: "variable", text: name, line: lineOf(source, index) });
17
+ };
18
+ const stack = [];
19
+ const blockRe = /\[\[(IF\s+(.+?)|UNLESS\s+(\w+)|ELSE|\/IF|\/UNLESS)\]\]/gi;
20
+ for (const m of source.matchAll(blockRe)) {
21
+ const tag = m[1].toUpperCase();
22
+ const index = m.index ?? 0;
23
+ if (tag.startsWith("IF")) {
24
+ const cond = m[2].trim();
25
+ stack.push({ kind: "IF", index, text: cond });
26
+ if (!isValidCondition(cond)) issues.push({ code: "condition", text: cond, line: lineOf(source, index) });
27
+ const v = cond.match(/^\w+/)?.[0];
28
+ if (v && isValidCondition(cond)) checkVar(v, index);
29
+ } else if (tag.startsWith("UNLESS")) {
30
+ stack.push({ kind: "UNLESS", index, text: m[3] });
31
+ checkVar(m[3], index);
32
+ } else if (tag === "ELSE") {
33
+ if (stack.at(-1)?.kind !== "IF") issues.push({ code: "stray", text: "[[ELSE]]", line: lineOf(source, index) });
34
+ } else {
35
+ const kind = tag === "/IF" ? "IF" : "UNLESS";
36
+ if (stack.at(-1)?.kind === kind) stack.pop();
37
+ else issues.push({ code: "stray", text: `[[${tag}]]`, line: lineOf(source, index) });
38
+ }
39
+ }
40
+ for (const open of stack) {
41
+ issues.push({ code: "unclosed", text: `[[${open.kind} ${open.text}]]`, line: lineOf(source, open.index) });
42
+ }
43
+ for (const m of source.matchAll(/\[\[(?:IF|UNLESS)\b(?![^\]\n]*\]\])/gi)) {
44
+ issues.push({ code: "syntax", text: m[0], line: lineOf(source, m.index ?? 0) });
45
+ }
46
+ for (const m of source.matchAll(/\{\{([^{}\n]*)\}\}/g)) {
47
+ const body = m[1];
48
+ const index = m.index ?? 0;
49
+ const name = body.match(/^(\w+)\s*(?:$|\?\s*"[^"]*"\s*:\s*"[^"]*"$|\|\s*"[^"]*"$)/)?.[1];
50
+ if (name) checkVar(name, index);
51
+ else issues.push({ code: "syntax", text: m[0], line: lineOf(source, index) });
52
+ }
53
+ return issues.sort((a, b) => a.line - b.line);
54
+ }
55
+ const TEMPLATE_SNIPPETS = {
56
+ default: '{{variable | "default"}}',
57
+ ternary: '{{variable ? "yes" : "no"}}',
58
+ if: "[[IF variable]]\n\n[[/IF]]",
59
+ ifElse: "[[IF variable]]\n\n[[ELSE]]\n\n[[/IF]]",
60
+ unless: "[[UNLESS variable]]\n\n[[/UNLESS]]"
61
+ };
62
+ export {
63
+ TEMPLATE_SNIPPETS,
64
+ analyzeTemplate,
65
+ isValidCondition
66
+ };