@axzydev/axzy_ui_system 1.6.0 → 1.7.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 (71) hide show
  1. package/dist/index.cjs +7842 -4676
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.d.cts +883 -3
  6. package/dist/index.d.ts +883 -3
  7. package/dist/index.js +9118 -5971
  8. package/dist/index.js.map +1 -1
  9. package/dist/layered.css +1 -1
  10. package/package.json +14 -7
  11. package/src/App.tsx +70 -2
  12. package/src/components/atoms/image/image.props.ts +2 -0
  13. package/src/components/atoms/image/image.tsx +3 -2
  14. package/src/components/molecules/json-editor/json-editor-tree.tsx +235 -0
  15. package/src/components/molecules/json-editor/json-editor.index.ts +2 -0
  16. package/src/components/molecules/json-editor/json-editor.props.ts +82 -0
  17. package/src/components/molecules/json-editor/json-editor.tsx +972 -0
  18. package/src/components/molecules/json-editor/json-editor.utils.ts +717 -0
  19. package/src/components/molecules/json-editor/useJsonEditorKeyboard.ts +256 -0
  20. package/src/components/molecules/json-renderer/json-renderer.index.ts +2 -0
  21. package/src/components/molecules/json-renderer/json-renderer.props.ts +31 -0
  22. package/src/components/molecules/json-renderer/json-renderer.tsx +79 -0
  23. package/src/components/organisms/dialog/dialog.props.ts +2 -0
  24. package/src/components/organisms/dialog/dialog.tsx +4 -3
  25. package/src/dev.css +30 -1
  26. package/src/hooks/useJsonRender.tsx +9 -0
  27. package/src/i18n/locales/en.ts +54 -0
  28. package/src/i18n/locales/es.ts +54 -0
  29. package/src/index.css +414 -0
  30. package/src/index.ts +99 -2
  31. package/src/json-renderer/catalog/axzyCatalog.ts +362 -0
  32. package/src/json-renderer/catalog/catalog.props.ts +128 -0
  33. package/src/json-renderer/catalog/resolve.ts +225 -0
  34. package/src/json-renderer/index.ts +70 -0
  35. package/src/json-renderer/kernel/NodeBoundary.tsx +53 -0
  36. package/src/json-renderer/kernel/SchemaRenderer.tsx +197 -0
  37. package/src/json-renderer/kernel/kernel.test.tsx +341 -0
  38. package/src/json-renderer/kernel/partial.ts +92 -0
  39. package/src/json-renderer/kernel/renderNode.tsx +113 -0
  40. package/src/json-renderer/kernel/schemaRenderer.props.ts +42 -0
  41. package/src/json-renderer/kernel/types.ts +159 -0
  42. package/src/json-renderer/shared/errors.ts +92 -0
  43. package/src/json-renderer/shared/limits.ts +87 -0
  44. package/src/json-renderer/shared/paths.ts +66 -0
  45. package/src/json-renderer/shared/shared.test.ts +108 -0
  46. package/src/json-renderer/stream/tolerantParse.test.ts +152 -0
  47. package/src/json-renderer/stream/tolerantParse.ts +449 -0
  48. package/src/json-renderer/test/setup.ts +38 -0
  49. package/src/json-renderer/validation/migrate.ts +83 -0
  50. package/src/json-renderer/validation/validate.ts +161 -0
  51. package/src/json-renderer/validation/validation.test.ts +165 -0
  52. package/src/json-renderer/vocabulary/buildContract.ts +158 -0
  53. package/src/sandbox/AxzyLogo.tsx +139 -0
  54. package/src/sandbox/axzyConfig.test.ts +40 -0
  55. package/src/sandbox/axzyConfig.ts +77 -0
  56. package/src/sandbox/i18n.ts +220 -0
  57. package/src/sandbox/navigation.ts +3 -0
  58. package/src/sandbox/useHashRoute.ts +39 -9
  59. package/src/showcases/DemoJsonDashboard.tsx +489 -0
  60. package/src/showcases/DemoJsonDocs.tsx +339 -0
  61. package/src/showcases/DemoJsonPortfolio.tsx +257 -0
  62. package/src/showcases/FeedbackShowcases.tsx +16 -5
  63. package/src/showcases/HomeShowcase.tsx +16 -9
  64. package/src/showcases/JsonEditorShowcase.tsx +150 -0
  65. package/src/showcases/JsonRendererShowcase.tsx +70 -0
  66. package/src/showcases/JsonScreenShowcase.tsx +341 -0
  67. package/src/showcases/StructureShowcases.tsx +6 -1
  68. package/src/showcases/demoApp/demoData.ts +181 -0
  69. package/src/showcases/demoApp/nodeTree.test.ts +39 -0
  70. package/src/showcases/demoApp/nodeTree.ts +35 -0
  71. package/src/showcases/demoApp/schemas.test.ts +54 -0
package/dist/index.d.cts CHANGED
@@ -314,6 +314,29 @@ interface UseTableStateResult {
314
314
  }
315
315
  declare function useTableState({ defaultItemsPerPage, initialSort, }?: UseTableStateOptions): UseTableStateResult;
316
316
 
317
+ type JsonComponentType = "button" | "text" | "card" | "flex" | "stack" | "grid" | "alert" | "div";
318
+ interface JsonProps {
319
+ [key: string]: any;
320
+ }
321
+ interface JsonComponentNode {
322
+ /** Component type to render */
323
+ type: JsonComponentType;
324
+ /** Props to pass to the component */
325
+ props?: JsonProps;
326
+ /** Children nodes */
327
+ children?: JsonComponentNode[] | React.ReactNode;
328
+ /** Text content (shorthand for text children) */
329
+ text?: string;
330
+ }
331
+ interface ITJsonRendererProps {
332
+ /** JSON structure to render */
333
+ json: JsonComponentNode | JsonComponentNode[];
334
+ /** Additional CSS class names */
335
+ className?: string;
336
+ }
337
+
338
+ declare function useJsonRender(json: JsonComponentNode | JsonComponentNode[]): react_jsx_runtime.JSX.Element;
339
+
317
340
  /** A single collapsible section inside {@link ITAccordionProps}. */
318
341
  interface ITAccordionItem {
319
342
  /** Unique identifier for the item. */
@@ -1699,6 +1722,8 @@ interface ITDialogProps {
1699
1722
  title?: string;
1700
1723
  /** When true and `title` is provided, renders an ITFormHeader instead of the default title bar. @default false */
1701
1724
  useFormHeader?: boolean;
1725
+ /** When false, the card has no padding: the title row and body are flush to the edges, so the content can draw its own sections. @default true */
1726
+ padded?: boolean;
1702
1727
  /** Makes the dialog fill the entire viewport. @default false */
1703
1728
  fullScreen?: boolean;
1704
1729
  }
@@ -1729,7 +1754,7 @@ interface ITDialogProps {
1729
1754
  * </ITDialog>
1730
1755
  * ```
1731
1756
  */
1732
- declare function ITDialog({ isOpen, onClose, children, className, title, useFormHeader, fullScreen, }: ITDialogProps): React$1.ReactPortal;
1757
+ declare function ITDialog({ isOpen, onClose, children, className, title, useFormHeader, fullScreen, padded, }: ITDialogProps): React$1.ReactPortal;
1733
1758
 
1734
1759
  /** Direction the divider flows: "horizontal" | "vertical". */
1735
1760
  type DividerOrientation = "horizontal" | "vertical";
@@ -2293,6 +2318,8 @@ interface ITImageProps {
2293
2318
  className?: string;
2294
2319
  /** Fallback image URL shown when the primary `src` fails to load */
2295
2320
  fallback?: string;
2321
+ /** How the image fills its box: "cover" crops to fill (default), "contain" shows the whole image */
2322
+ fit?: "cover" | "contain";
2296
2323
  /** Click handler */
2297
2324
  onClick?: () => void;
2298
2325
  }
@@ -2316,7 +2343,7 @@ interface ITImageProps {
2316
2343
  * className="w-32 h-32 rounded-full"
2317
2344
  * />
2318
2345
  */
2319
- declare const ITImage: ({ src, alt, className, fallback, }: ITImageProps) => react_jsx_runtime.JSX.Element;
2346
+ declare const ITImage: ({ src, alt, className, fallback, fit, }: ITImageProps) => react_jsx_runtime.JSX.Element;
2320
2347
 
2321
2348
  interface ITInputProps {
2322
2349
  /** Field name used for form identification */
@@ -3807,6 +3834,859 @@ interface ITWysiwygProps {
3807
3834
  */
3808
3835
  declare function ITWysiwyg({ value, onChange, label, placeholder, error, disabled, readOnly, name, size, minHeight, highlightColor, toolbar, className, }: ITWysiwygProps): react_jsx_runtime.JSX.Element;
3809
3836
 
3837
+ /**
3838
+ * Render UI from JSON schema using AXZY UI System components.
3839
+ *
3840
+ * @example
3841
+ * <ITJsonRenderer json={{ type: "button", props: { label: "Click me" } }} />
3842
+ *
3843
+ * @example
3844
+ * <ITJsonRenderer json={[
3845
+ * { type: "alert", props: { variant: "info", title: "Info" }, children: "Hello" },
3846
+ * { type: "card", props: { title: "Card" }, children: { type: "text", text: "Content" } }
3847
+ * ]} />
3848
+ */
3849
+ declare function ITJsonRenderer({ json, className, }: ITJsonRendererProps): react_jsx_runtime.JSX.Element;
3850
+
3851
+ /**
3852
+ * Modo de presentación del documento.
3853
+ *
3854
+ * - `"text"`: editor de código con resaltado, gutter y plegado.
3855
+ * - `"tree"`: árbol navegable de solo lectura sobre el mismo JSON.
3856
+ */
3857
+ type ITJSONEditorMode = "text" | "tree";
3858
+ /** Paleta del lienzo de código. */
3859
+ type ITJSONEditorTheme = "ink" | "light";
3860
+ /**
3861
+ * Props de `ITJSONEditor`.
3862
+ *
3863
+ * @example
3864
+ * ```tsx
3865
+ * <ITJSONEditor value={json} onChange={setJson} height={420} mode="text" />
3866
+ * ```
3867
+ */
3868
+ interface ITJSONEditorProps {
3869
+ /** Documento JSON como cadena. Si es `undefined`, el editor arranca vacío. @default "" */
3870
+ value?: string;
3871
+ /** Se dispara con el texto completo cada vez que cambia (teclado, pegado o barra de acciones). */
3872
+ onChange?: (value: string) => void;
3873
+ /** Se dispara tras cada validación con el valor parseado y su estado. */
3874
+ onParse?: (parsed: unknown, isValid: boolean, error?: string) => void;
3875
+ /** Texto de ayuda que se muestra cuando el documento está vacío. */
3876
+ placeholder?: string;
3877
+ /** Bloquea la edición: desaparecen las acciones que modifican el texto. @default false */
3878
+ readOnly?: boolean;
3879
+ /** Modo inicial: `"text"` (código) o `"tree"` (árbol navegable). @default "text" */
3880
+ mode?: ITJSONEditorMode;
3881
+ /** Permite alternar entre texto y árbol desde la barra. @default true */
3882
+ showModeSwitch?: boolean;
3883
+ /** Muestra la barra superior de acciones. @default true */
3884
+ showToolbar?: boolean;
3885
+ /** Muestra el indicador de válido/ inválido con línea y columna del error. @default true */
3886
+ showValidation?: boolean;
3887
+ /** Estadísticas del pie: líneas, nodos, profundidad y tamaño. @default true */
3888
+ showStatusBar?: boolean;
3889
+ /** Muestra los números de línea del gutter. @default true */
3890
+ showLineNumbers?: boolean;
3891
+ /** Muestra el gutter de plegado de bloques `{…}` / `[…]`. @default true */
3892
+ showFoldGutter?: boolean;
3893
+ /** Habilita las acciones de la barra (formatear, minificar, ordenar, escapar). @default true */
3894
+ showTransformActions?: boolean;
3895
+ /** Habilita el botón de copiar el documento completo. @default true */
3896
+ showCopyButton?: boolean;
3897
+ /** Habilita la carga de un `.json` desde disco. @default true */
3898
+ showImportButton?: boolean;
3899
+ /** Habilita la descarga del documento como `.json`. @default true */
3900
+ showDownloadButton?: boolean;
3901
+ /** Muestra la fila de ajustes de vista (ajuste de línea, números, plegado, indentación). @default true */
3902
+ showViewSettings?: boolean;
3903
+ /** Espacios por nivel de indentación, entre 0 y 8. @default 2 */
3904
+ indentSize?: number;
3905
+ /** Ajusta las líneas largas al ancho del editor. Desactivado mantiene el scroll horizontal y el gutter sincronizado. @default false */
3906
+ wrapLines?: boolean;
3907
+ /** Ofrece números de línea y plegado también en la vista de árbol. @default false */
3908
+ treeShowLines?: boolean;
3909
+ /** Paleta del lienzo: `"ink"` (tinta oscura, por defecto) o `"light"`. @default "ink" */
3910
+ canvasTheme?: ITJSONEditorTheme;
3911
+ /** Altura del área de edición: número en píxeles o cualquier medida CSS. @default 340 */
3912
+ height?: number | string;
3913
+ /** Ancho mínimo del editor. Útil dentro de layouts que comprimen. */
3914
+ minWidth?: number | string;
3915
+ /** Acciones extra que se añaden al final de la barra, antes de copiar/descargar. */
3916
+ actions?: ReactNode;
3917
+ /** Clases para el contenedor raíz. */
3918
+ className?: string;
3919
+ /** Identificador HTML del contenedor raíz, para anclarlo desde fuera o en pruebas. */
3920
+ id?: string;
3921
+ /** Clases para el `<textarea>`, por si hay que afinar la tipografía. */
3922
+ textareaClassName?: string;
3923
+ /**
3924
+ * Línea (1-based) que hay que marcar como errónea cuando el fallo lo detecta
3925
+ * la aplicación y no el propio editor.
3926
+ */
3927
+ errorLine?: number;
3928
+ }
3929
+
3930
+ /**
3931
+ * Editor de JSON con resaltado de sintaxis, gutter con números y plegado,
3932
+ * errores señalados por línea y columna, árbol navegable y acciones de formato.
3933
+ *
3934
+ * No añade dependencias: el resaltado se pinta en una capa bajo el `<textarea>`
3935
+ * nativo, así que se conservan el deshacer del navegador, el pegado, el dictado
3936
+ * y el corrector. La validación la hace `JSON.parse`, de modo que el coloreado
3937
+ * funciona igual mientras el documento está a medio escribir.
3938
+ *
3939
+ * @example
3940
+ * ```tsx
3941
+ * <ITJSONEditor value={json} onChange={setJson} onParse={handleParse} height={420} />
3942
+ * ```
3943
+ *
3944
+ * @example
3945
+ * ```tsx
3946
+ * <ITJSONEditor
3947
+ * value={json}
3948
+ * onChange={setJson}
3949
+ * mode="tree"
3950
+ * indentSize={4}
3951
+ * showFoldGutter
3952
+ * showStatusBar
3953
+ * />
3954
+ * ```
3955
+ */
3956
+ declare function ITJSONEditor({ value, onChange, onParse, placeholder, readOnly, mode, showModeSwitch, showToolbar, showValidation, showStatusBar, showLineNumbers, showFoldGutter, showTransformActions, showCopyButton, showImportButton, showDownloadButton, showViewSettings, indentSize: indentSizeProp, wrapLines: wrapLinesProp, treeShowLines, canvasTheme, height, minWidth, actions, className, id, textareaClassName, errorLine, }: ITJSONEditorProps): react_jsx_runtime.JSX.Element;
3957
+
3958
+ /**
3959
+ * Catálogo del motor: qué componentes y qué props están permitidos.
3960
+ *
3961
+ * Es una **lista blanca**. Todo lo que no esté aquí declarado se ignora y se
3962
+ * avisa (`JR010` / `JR011`), porque el esquema se trata siempre como entrada no
3963
+ * confiable: puede venir de un backend con un bug o de un modelo que alucina.
3964
+ *
3965
+ * Cada prop declara su tipo, si es obligatoria, sus valores admitidos y si su
3966
+ * valor es una acción registrada por el host (`kind: "action"`).
3967
+ */
3968
+ /** Tipo de un valor admitido en una prop. */
3969
+ type PropKind = "string" | "number" | "integer" | "boolean" | "enum" | "node" | "nodes" | "data" | "columns" | "action" | "i18n" | "object" | "array";
3970
+ /** Especificación de una prop dentro del catálogo. */
3971
+ interface PropSpec {
3972
+ /** Tipo admitido. */
3973
+ kind: PropKind;
3974
+ /** `true` cuando el componente no funciona sin ella. */
3975
+ required?: boolean;
3976
+ /** Valores admitidos cuando `kind: "enum"`. */
3977
+ values?: readonly string[];
3978
+ /** Valor por defecto que aplica el motor. */
3979
+ default?: unknown;
3980
+ /** Descripción para el autor del esquema y para el contrato del emisor. */
3981
+ doc?: string;
3982
+ }
3983
+ /** Entrada de un componente en el catálogo. */
3984
+ interface CatalogEntry {
3985
+ /** Nombre del componente tal cual (`ITCard`). */
3986
+ type: string;
3987
+ /**
3988
+ * Componente React que se monta.
3989
+ *
3990
+ * El tipo es deliberadamente laxo (`any`): las props se validan y coaccionan
3991
+ * en runtime contra `props`, así que exigir el tipo exacto de cada componente
3992
+ * solo serviría para obligar a un cast por entrada.
3993
+ */
3994
+ component: React__default.ComponentType<any>;
3995
+ /** Props permitidas. Todo lo demás se descarta con aviso. */
3996
+ props?: Record<string, PropSpec>;
3997
+ /** `true` cuando el nodo admite `children`. @default false */
3998
+ children?: boolean;
3999
+ /** `true` cuando el nodo admite el atajo `text`. @default false */
4000
+ text?: boolean;
4001
+ /** Props prohibidas explícitamente (para mensajes más claros). */
4002
+ forbidden?: readonly string[];
4003
+ /** Descripción breve para el contrato de vocabulario. */
4004
+ summary?: string;
4005
+ }
4006
+ /** Catálogo completo. */
4007
+ interface Catalog {
4008
+ /** Entradas indexadas por `type`. */
4009
+ entries: Record<string, CatalogEntry>;
4010
+ /** Tipos excluidos a propósito, con su motivo (se avisa distinto). */
4011
+ excluded?: Record<string, string>;
4012
+ }
4013
+ /**
4014
+ * Props prohibidas en **cualquier** componente, por seguridad.
4015
+ *
4016
+ * Solo entran las que inyectan nodos React, HTML o comportamiento: los valores
4017
+ * enumerados y seguros (`as`, `className`…) se declaran componente a componente.
4018
+ */
4019
+ declare const GLOBALLY_FORBIDDEN_PROPS: readonly string[];
4020
+ /** Crea un catálogo a partir de una lista de entradas. */
4021
+ declare function createCatalog(entries: CatalogEntry[], excluded?: Record<string, string>): Catalog;
4022
+ /** Devuelve la entrada de un tipo, o `undefined` si no está en el catálogo. */
4023
+ declare function getCatalogEntry(catalog: Catalog, type: string): CatalogEntry | undefined;
4024
+ /** `true` cuando el tipo está excluido a propósito (recursión, ejecución de entrada…). */
4025
+ declare function isExcludedType(catalog: Catalog, type: string): boolean;
4026
+ /** Motivo por el que un tipo está excluido. */
4027
+ declare function getExclusionReason(catalog: Catalog, type: string): string | undefined;
4028
+
4029
+ /**
4030
+ * Errores y avisos del motor de pantallas declarativas.
4031
+ *
4032
+ * Todo lo que el motor detecta (nodo desconocido, prop prohibida, acción no
4033
+ * registrada, permiso insuficiente…) se expresa con un **código estable** y el
4034
+ * `path` exacto dentro del esquema. Los códigos son contrato público: están
4035
+ * documentados en `docs/json-renderer/PLAN-IMPLEMENTACION.md` §11 y no cambian
4036
+ * sin migración.
4037
+ */
4038
+ /** Gravedad de un aviso del motor. */
4039
+ type JsonEngineSeverity = "error" | "warning" | "info";
4040
+ /** Códigos de aviso del motor. Contrato estable. */
4041
+ type JsonEngineCode = "JR010" | "JR011" | "JR012" | "JR013" | "JR014" | "JR020" | "JR021" | "JR030" | "JR031" | "JR040" | "JR041" | "JR042" | "JR050" | "JR060" | "JR061" | "JR070" | "JR080" | "JR081";
4042
+ /** Aviso del motor: lo que pasó, dónde y qué hacer. */
4043
+ interface JsonEngineIssue {
4044
+ /** Código estable (`JR010`…). */
4045
+ code: JsonEngineCode;
4046
+ /** Gravedad: `error` impide pintar el nodo, `warning` lo pinta con reservas. */
4047
+ severity: JsonEngineSeverity;
4048
+ /** Mensaje legible, ya traducido por el motor. */
4049
+ message: string;
4050
+ /** Ruta exacta dentro del esquema (`content[0].children[2].props.onClick`). */
4051
+ path: string;
4052
+ /** Sugerencia accionable, cuando la hay. */
4053
+ hint?: string;
4054
+ }
4055
+ /** Error interno del motor: siempre lleva código y ruta. */
4056
+ declare class JsonEngineError extends Error {
4057
+ /** Código estable del catálogo de avisos. */
4058
+ readonly code: JsonEngineCode;
4059
+ /** Ruta del esquema donde se produjo. */
4060
+ readonly path: string;
4061
+ /** Sugerencia accionable. */
4062
+ readonly hint?: string;
4063
+ constructor(code: JsonEngineCode, message: string, path: string, hint?: string);
4064
+ /** Convierte el error en el aviso que consume la interfaz y el informe. */
4065
+ toIssue(severity?: JsonEngineSeverity): JsonEngineIssue;
4066
+ }
4067
+ /** Crea un aviso sin lanzar excepción (para flujos tolerantes). */
4068
+ declare function issue(code: JsonEngineCode, message: string, path?: string, options?: {
4069
+ severity?: JsonEngineSeverity;
4070
+ hint?: string;
4071
+ }): JsonEngineIssue;
4072
+
4073
+ /**
4074
+ * Presupuestos del motor.
4075
+ *
4076
+ * Un esquema puede venir de un modelo que alucina o de un backend con un bug: el
4077
+ * motor no puede confiar en que el árbol sea razonable. Estos techos son la red
4078
+ * que evita que una pantalla congele el hilo o agote la memoria.
4079
+ */
4080
+ /** Techos de trabajo del motor. */
4081
+ interface EngineLimits {
4082
+ /** Número máximo de nodos que se pintan en una pantalla. @default 5000 */
4083
+ maxNodes: number;
4084
+ /** Profundidad máxima de anidación. @default 40 */
4085
+ maxDepth: number;
4086
+ /** Milisegundos de trabajo por fragmento de stream antes de diferir al siguiente frame. @default 8 */
4087
+ maxMsPerChunk: number;
4088
+ /** Milisegundos máximos de una acción antes de considerarla colgada. @default 15000 */
4089
+ actionTimeoutMs: number;
4090
+ /** Profundidad máxima de encadenado de efectos (`then`/`onError`). @default 5 */
4091
+ maxEffectChain: number;
4092
+ }
4093
+ /** Presupuesto por defecto. */
4094
+ declare const DEFAULT_LIMITS: EngineLimits;
4095
+ /** Resuelve un presupuesto parcial sobre los valores por defecto. */
4096
+ declare function resolveLimits(overrides?: Partial<EngineLimits>): EngineLimits;
4097
+ /** Consumidor de presupuesto: cuenta nodos y profundidad y avisa al agotarse. */
4098
+ interface LimitTracker {
4099
+ /** Registra un nodo en la profundidad indicada. `false` si ya no cabe. */
4100
+ visit(depth: number): boolean;
4101
+ /** Nodos contados hasta ahora. */
4102
+ readonly nodes: number;
4103
+ /** Profundidad máxima vista. */
4104
+ readonly deepest: number;
4105
+ /** `true` cuando se agotó el presupuesto y se recortó el árbol. */
4106
+ readonly exceeded: boolean;
4107
+ }
4108
+ /**
4109
+ * Crea un consumidor de presupuesto para un render.
4110
+ *
4111
+ * @example
4112
+ * const tracker = createLimitTracker({ maxNodes: 100 });
4113
+ * tracker.visit(0); // true
4114
+ */
4115
+ declare function createLimitTracker(limits?: EngineLimits): LimitTracker;
4116
+
4117
+ /**
4118
+ * Rutas dentro de un esquema.
4119
+ *
4120
+ * Un aviso del motor tiene que poder señalar **exactamente** dónde está el
4121
+ * problema: `content[2].children[0].props.onClick`. Estas utilidades construyen,
4122
+ * leen y renderizan esas rutas sin depender de nada externo.
4123
+ */
4124
+ /** Un segmento de ruta: clave de objeto o índice de array. */
4125
+ type PathSegment = string | number;
4126
+ /** Ruta de un nodo o valor dentro del esquema. */
4127
+ type SchemaPath = readonly PathSegment[];
4128
+ /** Añade un segmento a una ruta sin mutarla. */
4129
+ declare function pushPath(path: SchemaPath, segment: PathSegment): SchemaPath;
4130
+ /** Renderiza una ruta en la forma legible `content[0].children[2].props`. */
4131
+ declare function formatPath(path: SchemaPath): string;
4132
+ /** Parsea una ruta renderizada (`content[0].children`) de vuelta a segmentos. */
4133
+ declare function parsePath(rendered: string): PathSegment[];
4134
+ /** Lee un valor del esquema siguiendo una ruta. Devuelve `undefined` si no existe. */
4135
+ declare function readPath(source: unknown, path: SchemaPath): unknown;
4136
+ /** `true` cuando la ruta apunta a un valor que existe (aunque sea `null`). */
4137
+ declare function hasPath(source: unknown, path: SchemaPath): boolean;
4138
+ /** Añade el sufijo de una prop a la ruta de un nodo. */
4139
+ declare function propPath(nodePath: SchemaPath, prop: string): SchemaPath;
4140
+
4141
+ /**
4142
+ * Contrato de datos del motor de pantallas.
4143
+ *
4144
+ * Un esquema describe **qué** pintar; nunca **cómo** comportarse: no hay código,
4145
+ * ni expresiones, ni URLs. Todo lo que exige autoridad (componentes, props,
4146
+ * datos, acciones, permisos) se resuelve contra registros del host.
4147
+ */
4148
+ /** Estado de un nodo respecto al stream. */
4149
+ type NodeStatus = "complete" | "pending";
4150
+ /** Valor de una prop: literal, referencia a datos o texto traducible. */
4151
+ type SchemaValue = string | number | boolean | null | SchemaValue[] | {
4152
+ [key: string]: SchemaValue;
4153
+ };
4154
+ /** Referencia declarativa a un dato. Ninguna provoca red por sí misma. */
4155
+ interface SchemaReference {
4156
+ /** Valor de una fuente de datos declarada en `data`. */
4157
+ $source?: string;
4158
+ /** Valor del estado de pantalla. */
4159
+ $state?: string;
4160
+ /** Parámetro de la ruta. */
4161
+ $param?: string;
4162
+ /** Campo de la fila actual (dentro de una tabla). */
4163
+ $row?: string;
4164
+ /** Campo del formulario actual (dentro de un `form`). */
4165
+ $form?: string;
4166
+ /** Concatenación de valores ya resueltos. */
4167
+ $concat?: SchemaValue[];
4168
+ /** Proyección de un array: se queda con la clave indicada. */
4169
+ $map?: {
4170
+ $source?: string;
4171
+ $state?: string;
4172
+ $param?: string;
4173
+ pick: string;
4174
+ };
4175
+ /** Longitud de un array o número de claves de un objeto. */
4176
+ $count?: SchemaValue;
4177
+ /** Primer valor definido y no nulo. */
4178
+ $coalesce?: SchemaValue[];
4179
+ }
4180
+ /** Condicional declarativo, sin lógica libre. */
4181
+ interface WhenSchema {
4182
+ /** Compara el valor de una fuente o del estado. */
4183
+ state?: string;
4184
+ /** Compara el estado de una fuente de datos. */
4185
+ source?: string;
4186
+ /** Igualdad estricta contra este valor. */
4187
+ equals?: SchemaValue;
4188
+ /** Pertenencia a esta lista. */
4189
+ in?: SchemaValue[];
4190
+ /** Estado de la fuente (`loading` | `empty` | `error` | `ok`). */
4191
+ status?: "loading" | "empty" | "error" | "ok";
4192
+ /** Capacidad del host que debe estar presente. */
4193
+ capability?: string;
4194
+ /** Niega la condición. */
4195
+ not?: WhenSchema;
4196
+ /** Todas deben cumplirse. */
4197
+ all?: WhenSchema[];
4198
+ /** Al menos una debe cumplirse. */
4199
+ any?: WhenSchema[];
4200
+ }
4201
+ /** Efecto declarativo que ejecuta el motor tras una acción. */
4202
+ interface EffectSchema {
4203
+ /** Acción registrada por el host. */
4204
+ action?: string;
4205
+ /** Argumentos explícitos del efecto. */
4206
+ args?: Record<string, SchemaValue>;
4207
+ /** Aviso al usuario. */
4208
+ toast?: {
4209
+ variant?: "success" | "error" | "info" | "warning";
4210
+ message: SchemaValue;
4211
+ };
4212
+ /** Navegación a otra ruta. */
4213
+ navigate?: string;
4214
+ /** Abre un overlay declarado en `overlays`. */
4215
+ openOverlay?: string;
4216
+ /** Cierra el overlay indicado, o el que esté abierto si se omite. */
4217
+ closeOverlay?: string;
4218
+ /** Refresca una fuente de datos. */
4219
+ refresh?: string;
4220
+ }
4221
+ /** Acción declarada en un nodo: nombre registrado + argumentos + reacciones. */
4222
+ interface ActionSchema extends EffectSchema {
4223
+ /** Confirmación previa obligatoria. */
4224
+ confirm?: {
4225
+ title: SchemaValue;
4226
+ message?: SchemaValue;
4227
+ };
4228
+ /** Efectos que se ejecutan si la acción termina bien. */
4229
+ then?: EffectSchema[];
4230
+ /** Efectos que se ejecutan si la acción falla. */
4231
+ onError?: EffectSchema;
4232
+ }
4233
+ /** Nodo del esquema. */
4234
+ interface NodeSchema {
4235
+ /** Tipo de componente del catálogo (`ITCard`, `ITButton`…) o nodo del motor (`form`, `table`). */
4236
+ type: string;
4237
+ /** Identificador opcional, para depuración y binding. */
4238
+ id?: string;
4239
+ /** Props del componente, ya filtradas por el catálogo. */
4240
+ props?: Record<string, SchemaValue>;
4241
+ /** Hijos: nodo, lista de nodos o nada. */
4242
+ children?: NodeSchema | NodeSchema[];
4243
+ /**
4244
+ * Atajo de contenido para componentes textuales (`ITText`, `ITButton`…).
4245
+ * Admite una referencia (`{ i18n: "clave" }`), que el host resuelve.
4246
+ */
4247
+ text?: SchemaValue;
4248
+ /** Capacidad o capacidades que exige el nodo. */
4249
+ requires?: string | string[];
4250
+ /** Qué pintar cuando falla o no hay permiso. */
4251
+ fallback?: NodeSchema;
4252
+ /** Condición para pintar el nodo. */
4253
+ when?: WhenSchema;
4254
+ /**
4255
+ * Estado respecto al stream. Lo rellena el parser tolerante; el autor no lo
4256
+ * escribe.
4257
+ */
4258
+ $status?: NodeStatus;
4259
+ }
4260
+ /** Definición de una fuente de datos. El host aporta el `handler`. */
4261
+ interface DataSourceSchema {
4262
+ /** Nombre de un handler registrado por el host. Nunca una URL. */
4263
+ handler: string;
4264
+ /** Parámetros, normalmente con referencias. */
4265
+ params?: Record<string, SchemaValue>;
4266
+ /** Fuentes o acciones que invalidan esta fuente. */
4267
+ refreshOn?: string[];
4268
+ }
4269
+ /** Esquema de pantalla completo. */
4270
+ interface ScreenSchema {
4271
+ /** Identificador del formato. */
4272
+ $schema?: "axzy/screen";
4273
+ /** Versión del formato; obligatoria para poder migrar. */
4274
+ version: number;
4275
+ /** Identificador de la pantalla. */
4276
+ id: string;
4277
+ /** Título, normalmente traducible. */
4278
+ title?: SchemaValue;
4279
+ /** Descripción corta de la pantalla, para la cabecera que ponga el host. */
4280
+ description?: SchemaValue;
4281
+ /** Capacidades que exige la pantalla completa. */
4282
+ requires?: string | string[];
4283
+ /** Fuentes de datos que el host resolverá. */
4284
+ data?: Record<string, DataSourceSchema>;
4285
+ /** Estado local de la pantalla. */
4286
+ state?: Record<string, SchemaValue>;
4287
+ /** Contenido raíz. */
4288
+ content: NodeSchema | NodeSchema[];
4289
+ }
4290
+
4291
+ /**
4292
+ * Props de `ITSchemaRenderer`.
4293
+ *
4294
+ * El renderizador es el núcleo del motor: pinta un esquema contra un catálogo y
4295
+ * entrega los avisos sin lanzar nunca por culpa del esquema.
4296
+ */
4297
+ interface ITJsonRenderEngineProps {
4298
+ /** Esquema de pantalla a pintar. Admite un árbol parcial (streaming). */
4299
+ schema: ScreenSchema | null | undefined;
4300
+ /** Catálogo de componentes permitidos. Por defecto, el de AXZY. */
4301
+ catalog?: Catalog;
4302
+ /** Presupuesto de nodos, profundidad y tiempos. */
4303
+ limits?: Partial<EngineLimits>;
4304
+ /**
4305
+ * Resuelve un valor declarativo del esquema (`$state`, `$param`, `$source`…) al
4306
+ * valor real. Sin esta prop, los valores se pasan tal cual (útil para pruebas).
4307
+ */
4308
+ resolveValue?: (value: unknown, path: SchemaPath) => unknown;
4309
+ /**
4310
+ * Traduce una acción declarada a un handler ejecutable. Sin esta prop, las
4311
+ * acciones se ignoran y se avisa una sola vez por nodo.
4312
+ */
4313
+ resolveAction?: (node: NodeSchema, prop: string, action: unknown, path: SchemaPath) => ((...args: unknown[]) => void) | undefined;
4314
+ /** Qué pintar mientras un nodo está pendiente (streaming). */
4315
+ pendingFallback?: ReactNode;
4316
+ /** Se llama por cada aviso del motor, con código y ruta. */
4317
+ onIssue?: (issue: JsonEngineIssue) => void;
4318
+ /** Clases del contenedor raíz. */
4319
+ className?: string;
4320
+ }
4321
+
4322
+ /**
4323
+ * Pinta una pantalla completa a partir de un esquema.
4324
+ *
4325
+ * Nunca lanza por culpa del esquema: los problemas se convierten en avisos que
4326
+ * se entregan por `onIssue` (y se acumulan en `issuesRef` si quieres leerlos).
4327
+ *
4328
+ * @example
4329
+ * <ITSchemaRenderer schema={{ version: 1, id: "demo", content: { type: "ITText", text: "Hola" } }} />
4330
+ *
4331
+ * @example
4332
+ * <ITSchemaRenderer schema={schema} onIssue={(issue) => console.warn(issue.code, issue.path)} />
4333
+ */
4334
+ declare function ITSchemaRenderer({ schema, catalog, limits, resolveValue, resolveAction, pendingFallback, onIssue, className, }: ITJsonRenderEngineProps): react_jsx_runtime.JSX.Element;
4335
+
4336
+ /** Props de `NodeBoundary`. */
4337
+ interface NodeBoundaryProps {
4338
+ /** Ruta del nodo dentro del esquema, para el aviso. */
4339
+ path: string;
4340
+ /** Qué pintar si el subárbol falla. */
4341
+ fallback?: React__default.ReactNode;
4342
+ /** Se llama con el error y su ruta para acumularlo en el informe. */
4343
+ onError?: (error: Error, path: string) => void;
4344
+ /** Subárbol del nodo. */
4345
+ children: React__default.ReactNode;
4346
+ }
4347
+ /** Estado interno del boundary. */
4348
+ interface NodeBoundaryState {
4349
+ failed: boolean;
4350
+ }
4351
+ /**
4352
+ * Aísla el fallo de un nodo: si un componente del catálogo lanza durante el
4353
+ * render, solo se pierde ese subárbol y el resto de la pantalla sigue viva
4354
+ * (aviso `JR012`).
4355
+ *
4356
+ * @example
4357
+ * <NodeBoundary path="content[0]" fallback={<p>No se pudo pintar</p>}>
4358
+ * <ITCard />
4359
+ * </NodeBoundary>
4360
+ */
4361
+ declare class NodeBoundary extends React__default.Component<NodeBoundaryProps, NodeBoundaryState> {
4362
+ state: NodeBoundaryState;
4363
+ static getDerivedStateFromError(): NodeBoundaryState;
4364
+ componentDidCatch(error: Error): void;
4365
+ render(): React__default.ReactNode;
4366
+ }
4367
+
4368
+ /**
4369
+ * Renderizado de un nodo del esquema.
4370
+ *
4371
+ * Toma un `NodeSchema`, lo resuelve contra el catálogo y devuelve el elemento
4372
+ * React. Todo lo que no puede resolverse se convierte en avisos, nunca en una
4373
+ * excepción: el motor tiene que poder pintar un esquema a medias sin caerse.
4374
+ */
4375
+
4376
+ /** Opciones de render de un nodo. */
4377
+ interface RenderNodeOptions {
4378
+ /** Catálogo contra el que se resuelve el tipo. */
4379
+ catalog: Catalog;
4380
+ /** Ruta del nodo dentro del esquema (para avisos). */
4381
+ path: SchemaPath;
4382
+ /** Acumulador de avisos del render en curso. */
4383
+ issues: JsonEngineIssue[];
4384
+ /** Resuelve un valor del esquema (binding). Por defecto, identidad. */
4385
+ resolveValue?: (value: unknown, path: SchemaPath) => unknown;
4386
+ /** Resuelve el handler de una acción declarada. */
4387
+ resolveAction?: (node: NodeSchema, prop: string, action: unknown, path: SchemaPath) => ((...args: unknown[]) => void) | undefined;
4388
+ /** Renderiza los hijos de un nodo (lo aporta el recorrido del árbol). */
4389
+ renderChildren?: (node: NodeSchema, path: SchemaPath) => React__default.ReactNode;
4390
+ /** Qué pintar mientras un nodo está pendiente (streaming). */
4391
+ pendingFallback?: React__default.ReactNode;
4392
+ /** Componente para envolver cada nodo. Por defecto, `NodeBoundary`. */
4393
+ wrap?: (node: NodeSchema, path: SchemaPath, content: React__default.ReactNode) => React__default.ReactNode;
4394
+ }
4395
+ /**
4396
+ * Pinta un nodo del esquema.
4397
+ *
4398
+ * @example
4399
+ * renderNode({ type: "ITText", text: "Hola" }, { catalog: axzyCatalog, path: ["content", 0], issues: [] });
4400
+ */
4401
+ declare function renderNode(node: NodeSchema, options: RenderNodeOptions): React__default.ReactNode;
4402
+
4403
+ /**
4404
+ * Presupuesto y nodos pendientes.
4405
+ *
4406
+ * Dos responsabilidades que van juntas porque las dos protegen el render:
4407
+ * contar lo que se va a pintar (para no colgar el hilo con un esquema enorme) y
4408
+ * saber cuánto falta por llegar (para no pintar nodos a medias).
4409
+ */
4410
+
4411
+ /** Recuento de un esquema antes de pintarlo. */
4412
+ interface TreeAudit {
4413
+ /** Nodos con `type` contados. */
4414
+ nodes: number;
4415
+ /** Profundidad máxima alcanzada. */
4416
+ depth: number;
4417
+ /** Nodos marcados como pendientes por el stream. */
4418
+ pending: number;
4419
+ /** `true` cuando se recortó por presupuesto. */
4420
+ exceeded: boolean;
4421
+ /** Avisos derivados del recuento. */
4422
+ issues: JsonEngineIssue[];
4423
+ }
4424
+ /**
4425
+ * Recorre el esquema sin pintarlo para saber su tamaño.
4426
+ *
4427
+ * Se hace antes del render a propósito: así el motor puede decidir recortar y
4428
+ * avisar sin que React haya empezado a montar nada.
4429
+ *
4430
+ * @example
4431
+ * auditTree({ version: 1, id: "x", content: [] }, resolveLimits()).nodes; // 0
4432
+ */
4433
+ declare function auditTree(schema: ScreenSchema, limits: EngineLimits): TreeAudit;
4434
+ /** Cuenta los nodos pendientes de un esquema ya parseado. */
4435
+ declare function countPendingNodes(schema: ScreenSchema | null): number;
4436
+
4437
+ /** Entradas del catálogo por defecto. */
4438
+ declare const AXZY_CATALOG_ENTRIES: CatalogEntry[];
4439
+ /** Tipos excluidos a propósito, con el motivo que se muestra en el aviso. */
4440
+ declare const AXZY_EXCLUDED_TYPES: Record<string, string>;
4441
+ /** Catálogo AXZY por defecto. */
4442
+ declare const axzyCatalog: Catalog;
4443
+ /** Tipos disponibles en esta fase. */
4444
+ declare const axzyCatalogTypes: string[];
4445
+
4446
+ /**
4447
+ * Resolución de un nodo contra el catálogo.
4448
+ *
4449
+ * Aquí es donde el esquema deja de ser texto libre y se convierte en props
4450
+ * seguras: se comprueba el tipo, se filtran las props permitidas, se aplican los
4451
+ * valores por defecto, se coaccionan los tipos y se acumulan los avisos con su
4452
+ * ruta exacta. Nada de esto lanza: un nodo mal formado produce avisos y se pinta
4453
+ * lo que se pueda.
4454
+ */
4455
+
4456
+ /** Resultado de resolver un nodo: props listas para el componente + avisos. */
4457
+ interface ResolvedNode {
4458
+ /** Discriminante: el nodo se pudo resolver. */
4459
+ ok: true;
4460
+ /** Entrada del catálogo que se va a montar. */
4461
+ entry: CatalogEntry;
4462
+ /** Props ya filtradas, con defaults aplicados y tipos coaccionados. */
4463
+ props: Record<string, unknown>;
4464
+ /** Acciones declaradas en el nodo, por nombre de prop (`onClick` → esquema). */
4465
+ actions: Record<string, unknown>;
4466
+ /** Avisos acumulados (tipo desconocido, prop ignorada, valor inválido…). */
4467
+ issues: JsonEngineIssue[];
4468
+ }
4469
+ /** Resultado cuando el nodo no se puede resolver. */
4470
+ interface UnresolvedNode {
4471
+ /** Discriminante: el nodo no se pudo resolver. */
4472
+ ok: false;
4473
+ /** Avisos que explican por qué. */
4474
+ issues: JsonEngineIssue[];
4475
+ }
4476
+ /**
4477
+ * Resuelve un nodo contra el catálogo.
4478
+ *
4479
+ * @example
4480
+ * const resolved = resolveNode({ type: "ITButton", props: { label: "Ir" } }, axzyCatalog, ["content", 0]);
4481
+ * resolved.props.label; // "Ir"
4482
+ */
4483
+ declare function resolveNode(node: NodeSchema, catalog: Catalog, path: SchemaPath): ResolvedNode | UnresolvedNode;
4484
+
4485
+ /**
4486
+ * Validación de esquemas con **tres veredictos**.
4487
+ *
4488
+ * Un esquema a medio llegar no es un esquema roto: `partial` significa "válido
4489
+ * hasta donde ha llegado", y es el estado normal mientras un emisor (una IA, por
4490
+ * ejemplo) sigue escribiendo. `invalid` es lo que no se puede pintar ni esperar.
4491
+ */
4492
+
4493
+ /** Veredicto de la validación. */
4494
+ type ValidationVerdict = "valid" | "partial" | "invalid";
4495
+ /** Informe de validación. */
4496
+ interface ValidationReport {
4497
+ /** Veredicto global. */
4498
+ verdict: ValidationVerdict;
4499
+ /** Errores que impiden pintar. */
4500
+ errors: JsonEngineIssue[];
4501
+ /** Avisos que no impiden pintar. */
4502
+ warnings: JsonEngineIssue[];
4503
+ /** Nodos que aún no están cerrados. */
4504
+ pendingNodes: number;
4505
+ /** Versión del esquema, si la declara. */
4506
+ version?: number;
4507
+ }
4508
+ /** Opciones de validación. */
4509
+ interface ValidateOptions {
4510
+ /** Catálogo contra el que se validan tipos y props. @default axzyCatalog */
4511
+ catalog?: Catalog;
4512
+ /** Versión máxima admitida del formato. @default 1 */
4513
+ maxVersion?: number;
4514
+ }
4515
+ /** Versión actual del formato de pantalla. */
4516
+ declare const CURRENT_SCHEMA_VERSION = 1;
4517
+ /**
4518
+ * Valida un esquema de pantalla.
4519
+ *
4520
+ * No lanza nunca: devuelve un informe con el veredicto y los avisos, cada uno con
4521
+ * su código y su ruta.
4522
+ *
4523
+ * @example
4524
+ * validateSchema({ version: 1, id: "x", content: { type: "ITText", text: "ok" } }).verdict; // "valid"
4525
+ *
4526
+ * @example
4527
+ * validateSchema(parsePartialSchema(tokens).tree).verdict; // "partial" mientras llega
4528
+ */
4529
+ declare function validateSchema(schema: unknown, options?: ValidateOptions): ValidationReport;
4530
+
4531
+ /**
4532
+ * Versionado y migraciones del formato de pantalla.
4533
+ *
4534
+ * Un esquema declara `version`. Cuando el formato cambia, el motor aplica la
4535
+ * migración registrada para cada salto; si falta, avisa (`JR070`) en lugar de
4536
+ * intentar adivinar. Sin este mecanismo, actualizar el motor rompería esquemas
4537
+ * guardados por el host.
4538
+ */
4539
+
4540
+ /** Migra un esquema de una versión a la siguiente. */
4541
+ type SchemaMigration = (schema: ScreenSchema) => ScreenSchema;
4542
+ /** Resultado de migrar un esquema. */
4543
+ interface MigrationResult {
4544
+ /** Esquema migrado (o el original si ya estaba al día). */
4545
+ schema: ScreenSchema;
4546
+ /** `true` cuando se aplicó alguna migración. */
4547
+ migrated: boolean;
4548
+ /** Versión de origen. */
4549
+ from: number;
4550
+ /** Versión de destino. */
4551
+ to: number;
4552
+ /** Avisos, incluido el de migración ausente. */
4553
+ issues: JsonEngineIssue[];
4554
+ }
4555
+ /** Migraciones registradas, indexadas por versión de origen. */
4556
+ type MigrationRegistry = Record<number, SchemaMigration>;
4557
+ /** Registro por defecto: vacío (solo existe la versión 1). */
4558
+ declare const DEFAULT_MIGRATIONS: MigrationRegistry;
4559
+ /**
4560
+ * Lleva un esquema hasta la versión objetivo aplicando migraciones en cadena.
4561
+ *
4562
+ * @example
4563
+ * migrateSchema({ version: 1, id: "x", content: [] }, 1); // migrated: false
4564
+ */
4565
+ declare function migrateSchema(schema: ScreenSchema, targetVersion: number, migrations?: MigrationRegistry): MigrationResult;
4566
+
4567
+ /**
4568
+ * Contrato de vocabulario para el emisor.
4569
+ *
4570
+ * Para que un modelo (o un backend) acierte con el esquema, necesita saber qué
4571
+ * `type` existen, qué props acepta cada uno, qué valores admiten los enums y cuál
4572
+ * es el nodo mínimo que funciona. Ese contrato **se genera desde el catálogo**,
4573
+ * no se escribe a mano: así el prompt nunca se desincroniza del motor.
4574
+ *
4575
+ * Se publica como artefacto versionado (`pnpm docs:json-renderer`) y se puede
4576
+ * entregar tal cual en el prompt del sistema.
4577
+ */
4578
+
4579
+ /** Descripción de una prop en el contrato. */
4580
+ interface PropContract {
4581
+ /** Nombre de la prop. */
4582
+ name: string;
4583
+ /** Tipo admitido. */
4584
+ kind: PropKind;
4585
+ /** `true` si el componente no funciona sin ella. */
4586
+ required: boolean;
4587
+ /** Valores admitidos en los enums. */
4588
+ values?: string[];
4589
+ /** Valor por defecto que aplica el motor. */
4590
+ default?: unknown;
4591
+ /** Nota para el emisor. */
4592
+ doc?: string;
4593
+ }
4594
+ /** Descripción de un componente en el contrato. */
4595
+ interface ComponentContract {
4596
+ /** Tipo a emitir (`ITCard`). */
4597
+ type: string;
4598
+ /** Para qué sirve, en una línea. */
4599
+ summary?: string;
4600
+ /** `true` si admite `children`. */
4601
+ children: boolean;
4602
+ /** `true` si admite el atajo `text`. */
4603
+ text: boolean;
4604
+ /** Props permitidas. */
4605
+ props: PropContract[];
4606
+ /** Props prohibidas (los nodos React no viajan en JSON). */
4607
+ forbidden: string[];
4608
+ /** Nodo mínimo que se puede emitir y funciona. */
4609
+ minimal: Record<string, unknown>;
4610
+ }
4611
+ /** Contrato completo, listo para serializar. */
4612
+ interface VocabularyContract {
4613
+ /** Identificador del formato. */
4614
+ $schema: "axzy/vocabulary";
4615
+ /** Versión del formato de pantalla al que corresponde. */
4616
+ schemaVersion: number;
4617
+ /** Reglas que el emisor debe respetar. */
4618
+ rules: string[];
4619
+ /** Componentes disponibles, ordenados por nombre. */
4620
+ components: ComponentContract[];
4621
+ /** Tipos excluidos y su motivo (el emisor no debe usarlos). */
4622
+ excluded: Record<string, string>;
4623
+ }
4624
+ /** Deriva el contrato de vocabulario de un catálogo. */
4625
+ declare function buildVocabularyContract(catalog?: Catalog, schemaVersion?: number): VocabularyContract;
4626
+ /** Serializa el contrato como texto compacto para el prompt. */
4627
+ declare function formatVocabularyForPrompt(contract: VocabularyContract): string;
4628
+
4629
+ /**
4630
+ * Parser tolerante de esquemas a medio llegar.
4631
+ *
4632
+ * Es la pieza que hace posible el streaming: en vez de esperar a que el JSON esté
4633
+ * completo (y fallar mientras tanto), se construye el árbol **hasta donde es
4634
+ * válido** y se marcan como `pending` los nodos que aún no están cerrados.
4635
+ *
4636
+ * No pretende ser un parser JSON general: entiende la gramática de un esquema
4637
+ * (objetos, arrays, cadenas, números, booleanos y `null`) y, cuando algo no
4638
+ * cierra, devuelve el punto exacto donde se quedó para poder seguir desde ahí.
4639
+ *
4640
+ * @example
4641
+ * const { tree, status } = parsePartialSchema('{"version":1,"content":[{"type":"ITCard"');
4642
+ * // tree.content[0].$status === "pending"
4643
+ */
4644
+
4645
+ /** Resultado de parsear un texto posiblemente incompleto. */
4646
+ interface PartialParseResult {
4647
+ /** Árbol resuelto hasta donde el texto es válido. `null` si aún no hay nada. */
4648
+ tree: ScreenSchema | null;
4649
+ /** `complete` si el documento está entero; `pending` si falta cerrar algo. */
4650
+ status: NodeStatus;
4651
+ /** Offset donde terminó el consumo (punto de continuación). */
4652
+ offset: number;
4653
+ /** `true` cuando el texto no es recuperable (basura al principio). */
4654
+ broken: boolean;
4655
+ /** Cuántos nodos quedaron pendientes. */
4656
+ pendingNodes: number;
4657
+ }
4658
+ /**
4659
+ * Parsea un esquema que puede estar incompleto.
4660
+ *
4661
+ * Nunca lanza: si el texto no es recuperable devuelve `broken: true` y un árbol
4662
+ * vacío, para que el motor pueda avisar (`JR080`) sin romper la pantalla.
4663
+ *
4664
+ * @example
4665
+ * parsePartialSchema('{"version":1,"content":[]}').status; // "complete"
4666
+ */
4667
+ declare function parsePartialSchema(text: string): PartialParseResult;
4668
+ /**
4669
+ * Estado del stream de un esquema, listo para pintar.
4670
+ *
4671
+ * @example
4672
+ * const state = useSchemaStream(tokens);
4673
+ * state.tree; // ScreenSchema | null
4674
+ */
4675
+ interface StreamState {
4676
+ /** Árbol pintable (parcial mientras llega). */
4677
+ tree: ScreenSchema | null;
4678
+ /** `pending` mientras el emisor sigue escribiendo. */
4679
+ status: NodeStatus;
4680
+ /** `true` cuando el texto no es recuperable. */
4681
+ broken: boolean;
4682
+ /** Nodos que aún no están cerrados. */
4683
+ pendingNodes: number;
4684
+ /** `true` cuando el emisor está activo. */
4685
+ streaming: boolean;
4686
+ }
4687
+ /** `true` cuando un nodo está pendiente según el parser. */
4688
+ declare function isNodePending(node: NodeSchema | undefined): boolean;
4689
+
3810
4690
  /** Allowed file MIME types for the dropzone */
3811
4691
  declare enum FileTypeEnum {
3812
4692
  PDF = "application/pdf",
@@ -4526,4 +5406,4 @@ declare const es: ITMessages;
4526
5406
  */
4527
5407
  declare const en: ITMessages;
4528
5408
 
4529
- export { type Column, type ColumnFilterMode, type ColumnFilterValue, type ColumnFilters, type FieldConfig, type FieldConfigV2, FileTypeEnum, ITAccordion, type ITAccordionItem, type ITAccordionProps, ITAlert, type ITAlertProps, ITAvatar, type ITAvatarProps, ITBadget, type ITBadgetProps, type ITBreadcrumbItem, ITBreadcrumbs, type ITBreadcrumbsProps, ITButton, type ITButtonProps, ITCalendar, type ITCalendarProps, ITCard, type ITCardProps, ITCheckbox, type ITCheckboxProps, ITChip, ITChipInput, type ITChipInputProps, type ITChipProps, ITConfirmDialog, type ITConfirmDialogProps, ITDataTable, type ITDataTableFetchParams, type ITDataTableProps, type ITDataTableResponse, ITDatePicker, type ITDatePickerProps, ITDialog, type ITDialogProps, ITDivider, type ITDividerProps, ITDrawer, type ITDrawerProps, ITDropdownMenu, type ITDropdownMenuItem, type ITDropdownMenuProps, ITDropfile, ITEmptyState, type ITEmptyStateProps, ITField, type ITFieldProps, ITFlex, type ITFlexProps, ITFormBuilder, type ITFormBuilderProps, ITFormHeader, type ITFormHeaderProps, ITGrid, type ITGridProps, ITI18nProvider, type ITI18nProviderProps, type ITI18nValue, ITImage, type ITImageProps, ITInput, ITInputNumber, type ITInputNumberProps, type ITInputProps, ITLayout, type ITLayoutProps, ITLineBarChart, type ITLineBarChartProps, type ITLineBarDatum, ITLoader, type LoaderProps as ITLoaderProps, type ITLocale, ITMaskedInput, type ITMaskedInputProps, type ITMessages, type ITMessagesByLocale, ITMultiSelect, type ITMultiSelectOption, type ITMultiSelectProps, ITNavbar, type ITNavbarProps, type ITNavigationItem, type ITNavigationSubItem, type ITNavigationSubItemEntry, type ITNavigationSubItemGroup, ITPage, ITPageHeader, type ITPageHeaderProps, type ITPageProps, ITPagination, type ITPaginationProps, ITPopover, type ITPopoverProps, ITProgress, type ITProgressProps, ITRadioGroup, type ITRadioGroupProps, type ITRadioOption, ITSearchSelect, type ITSearchSelectProps, ITSearchTable, type ITSearchTableProps, ITSegmentedControl, type ITSegmentedControlProps, ITSelect, type ITSelectProps, ITSidebar, type ITSidebarBrand, type ITSidebarNotification, type ITSidebarProps, ITSkeleton, type ITSkeletonProps, ITSlideToggle, type ITSlideToggleProps, ITSlider, type ITSliderProps, ITStack, type ITStackProps, ITStatCard, type ITStatCardProps, ITStepper, type ITStepperProps, type ITTabItem, ITTable, type ITTableProps, ITTabs, type ITTabsProps, ITText, type ITTextProps, ITTextarea, type ITTextareaProps, type ITThemeAppearance, type ITThemeConfig, type ITThemePalette, ITThemeProvider, type ITThemeProviderProps, ITTimePicker, type ITTimePickerProps, ITToast, type ITToastProps, ITTripleFilter, type ITTripleFilterOption, type ITTripleFilterProps, ITWysiwyg, type ITWysiwygProps, type TableColors, type TableDensity, type TableDesign, type TableDesignProps, type TableDesignSlot, UploadStatus, type UseTableStateOptions, type UseTableStateResult, createValidationSchema, en as enMessages, es as esMessages, getContrastTextColor, isLightColor, resolveCssColor, useClickOutside, useDebouncedSearch, useEditableRow, useFloatingPanel, useITFlatAppearance, useITTheme, useITThemeSafe, useITTranslation, useTableState };
5409
+ export { AXZY_CATALOG_ENTRIES, AXZY_EXCLUDED_TYPES, type ActionSchema, CURRENT_SCHEMA_VERSION, type Catalog, type CatalogEntry, type Column, type ColumnFilterMode, type ColumnFilterValue, type ColumnFilters, type ComponentContract, DEFAULT_LIMITS, DEFAULT_MIGRATIONS, type DataSourceSchema, type EffectSchema, type EngineLimits, type FieldConfig, type FieldConfigV2, FileTypeEnum, GLOBALLY_FORBIDDEN_PROPS, ITAccordion, type ITAccordionItem, type ITAccordionProps, ITAlert, type ITAlertProps, ITAvatar, type ITAvatarProps, ITBadget, type ITBadgetProps, type ITBreadcrumbItem, ITBreadcrumbs, type ITBreadcrumbsProps, ITButton, type ITButtonProps, ITCalendar, type ITCalendarProps, ITCard, type ITCardProps, ITCheckbox, type ITCheckboxProps, ITChip, ITChipInput, type ITChipInputProps, type ITChipProps, ITConfirmDialog, type ITConfirmDialogProps, ITDataTable, type ITDataTableFetchParams, type ITDataTableProps, type ITDataTableResponse, ITDatePicker, type ITDatePickerProps, ITDialog, type ITDialogProps, ITDivider, type ITDividerProps, ITDrawer, type ITDrawerProps, ITDropdownMenu, type ITDropdownMenuItem, type ITDropdownMenuProps, ITDropfile, ITEmptyState, type ITEmptyStateProps, ITField, type ITFieldProps, ITFlex, type ITFlexProps, ITFormBuilder, type ITFormBuilderProps, ITFormHeader, type ITFormHeaderProps, ITGrid, type ITGridProps, ITI18nProvider, type ITI18nProviderProps, type ITI18nValue, ITImage, type ITImageProps, ITInput, ITInputNumber, type ITInputNumberProps, type ITInputProps, ITJSONEditor, type ITJSONEditorProps, type ITJsonRenderEngineProps, ITJsonRenderer, type ITJsonRendererProps, ITLayout, type ITLayoutProps, ITLineBarChart, type ITLineBarChartProps, type ITLineBarDatum, ITLoader, type LoaderProps as ITLoaderProps, type ITLocale, ITMaskedInput, type ITMaskedInputProps, type ITMessages, type ITMessagesByLocale, ITMultiSelect, type ITMultiSelectOption, type ITMultiSelectProps, ITNavbar, type ITNavbarProps, type ITNavigationItem, type ITNavigationSubItem, type ITNavigationSubItemEntry, type ITNavigationSubItemGroup, ITPage, ITPageHeader, type ITPageHeaderProps, type ITPageProps, ITPagination, type ITPaginationProps, ITPopover, type ITPopoverProps, ITProgress, type ITProgressProps, ITRadioGroup, type ITRadioGroupProps, type ITRadioOption, ITSchemaRenderer, ITSearchSelect, type ITSearchSelectProps, ITSearchTable, type ITSearchTableProps, ITSegmentedControl, type ITSegmentedControlProps, ITSelect, type ITSelectProps, ITSidebar, type ITSidebarBrand, type ITSidebarNotification, type ITSidebarProps, ITSkeleton, type ITSkeletonProps, ITSlideToggle, type ITSlideToggleProps, ITSlider, type ITSliderProps, ITStack, type ITStackProps, ITStatCard, type ITStatCardProps, ITStepper, type ITStepperProps, type ITTabItem, ITTable, type ITTableProps, ITTabs, type ITTabsProps, ITText, type ITTextProps, ITTextarea, type ITTextareaProps, type ITThemeAppearance, type ITThemeConfig, type ITThemePalette, ITThemeProvider, type ITThemeProviderProps, ITTimePicker, type ITTimePickerProps, ITToast, type ITToastProps, ITTripleFilter, type ITTripleFilterOption, type ITTripleFilterProps, ITWysiwyg, type ITWysiwygProps, type JsonComponentNode, type JsonComponentType, type JsonEngineCode, JsonEngineError, type JsonEngineIssue, type JsonEngineSeverity, type LimitTracker, type MigrationRegistry, type MigrationResult, NodeBoundary, type NodeSchema, type NodeStatus, type PartialParseResult, type PathSegment, type PropContract, type PropKind, type PropSpec, type ResolvedNode, type SchemaMigration, type SchemaPath, type SchemaReference, type SchemaValue, type ScreenSchema, type StreamState, type TableColors, type TableDensity, type TableDesign, type TableDesignProps, type TableDesignSlot, type UnresolvedNode, UploadStatus, type UseTableStateOptions, type UseTableStateResult, type ValidateOptions, type ValidationReport, type ValidationVerdict, type VocabularyContract, type WhenSchema, auditTree, axzyCatalog, axzyCatalogTypes, buildVocabularyContract, countPendingNodes, createCatalog, createLimitTracker, createValidationSchema, en as enMessages, es as esMessages, formatPath, formatVocabularyForPrompt, getCatalogEntry, getContrastTextColor, getExclusionReason, hasPath, isExcludedType, isLightColor, isNodePending, issue, migrateSchema, parsePartialSchema, parsePath, propPath, pushPath, readPath, renderNode, resolveCssColor, resolveLimits, resolveNode, useClickOutside, useDebouncedSearch, useEditableRow, useFloatingPanel, useITFlatAppearance, useITTheme, useITThemeSafe, useITTranslation, useJsonRender, useTableState, validateSchema };