@chobantonov/jsonforms-react-extended-renderers 0.0.0-stage → 0.1.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 (193) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +17 -2
  3. package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js +2 -0
  4. package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js.map +1 -0
  5. package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs +429 -0
  6. package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs.map +1 -0
  7. package/lib/DynamicJSXRenderer-Cyw40Kz0.js +2 -0
  8. package/lib/DynamicJSXRenderer-Cyw40Kz0.js.map +1 -0
  9. package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs +109 -0
  10. package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs.map +1 -0
  11. package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs +12 -0
  12. package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs.map +1 -0
  13. package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js +2 -0
  14. package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js.map +1 -0
  15. package/lib/MonacoControlRenderer.impl-BwgLGNMK.js +3 -0
  16. package/lib/MonacoControlRenderer.impl-BwgLGNMK.js.map +1 -0
  17. package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs +186 -0
  18. package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs.map +1 -0
  19. package/lib/RactiveTemplate-7L44A38e.js +2 -0
  20. package/lib/RactiveTemplate-7L44A38e.js.map +1 -0
  21. package/lib/RactiveTemplate-Cat7CxUp.mjs +74 -0
  22. package/lib/RactiveTemplate-Cat7CxUp.mjs.map +1 -0
  23. package/lib/ajv-localizers.cjs.js +2 -0
  24. package/lib/ajv-localizers.cjs.js.map +1 -0
  25. package/lib/ajv-localizers.esm.js +7 -0
  26. package/lib/ajv-localizers.esm.js.map +1 -0
  27. package/lib/ajvI18n-2UTyJv5g.js +2 -0
  28. package/lib/ajvI18n-2UTyJv5g.js.map +1 -0
  29. package/lib/ajvI18n-DO8FFvx1.mjs +227 -0
  30. package/lib/ajvI18n-DO8FFvx1.mjs.map +1 -0
  31. package/lib/celTemplate-Cl0alaCz.js +3 -0
  32. package/lib/celTemplate-Cl0alaCz.js.map +1 -0
  33. package/lib/celTemplate-D_AGhaIL.mjs +137 -0
  34. package/lib/celTemplate-D_AGhaIL.mjs.map +1 -0
  35. package/lib/components/DynamicJSXRenderer.d.ts +7 -0
  36. package/lib/components/ExtendedJsonForms.d.ts +80 -0
  37. package/lib/components/GenericAdditionalProperties.d.ts +4 -0
  38. package/lib/components/InterpolatedText.d.ts +34 -0
  39. package/lib/components/RactiveTemplate.d.ts +37 -0
  40. package/lib/components/editorRendererTypes.d.ts +139 -0
  41. package/lib/components/elementRender.d.ts +15 -0
  42. package/lib/configNamespaces-BFclHtB8.mjs +1 -0
  43. package/lib/configNamespaces-sboXDudL.js +1 -0
  44. package/lib/core/ajv.d.ts +82 -0
  45. package/lib/core/ajvI18n/bg.d.ts +2 -0
  46. package/lib/core/ajvI18n/index.d.ts +118 -0
  47. package/lib/core/ajvI18n/localizers.d.ts +20 -0
  48. package/lib/core/dynamicDefaults.d.ts +34 -0
  49. package/lib/core/keywords.d.ts +24 -0
  50. package/lib/core/transform.d.ts +29 -0
  51. package/lib/core/uiSchema.d.ts +48 -0
  52. package/lib/elementRender-Dbp2e-Cc.js +2 -0
  53. package/lib/elementRender-Dbp2e-Cc.js.map +1 -0
  54. package/lib/elementRender-y8MK9CCE.mjs +5 -0
  55. package/lib/elementRender-y8MK9CCE.mjs.map +1 -0
  56. package/lib/index.d.ts +41 -0
  57. package/lib/jsonforms-react-extended.cjs.js +16 -0
  58. package/lib/jsonforms-react-extended.cjs.js.map +1 -0
  59. package/lib/jsonforms-react-extended.esm.js +2335 -0
  60. package/lib/jsonforms-react-extended.esm.js.map +1 -0
  61. package/lib/locale/bg.d.ts +14 -0
  62. package/lib/markdown-C_y73Q0w.mjs +123 -0
  63. package/lib/markdown-C_y73Q0w.mjs.map +1 -0
  64. package/lib/markdown-CuqtpGVd.js +2 -0
  65. package/lib/markdown-CuqtpGVd.js.map +1 -0
  66. package/lib/objectWithoutProperties-6zedhz76.js +2 -0
  67. package/lib/objectWithoutProperties-6zedhz76.js.map +1 -0
  68. package/lib/objectWithoutProperties-yjQMyZ0y.mjs +58 -0
  69. package/lib/objectWithoutProperties-yjQMyZ0y.mjs.map +1 -0
  70. package/lib/renderers/AgGridControlRenderer.d.ts +10 -0
  71. package/lib/renderers/AgGridControlRenderer.impl.d.ts +4 -0
  72. package/lib/renderers/ButtonRenderer.d.ts +83 -0
  73. package/lib/renderers/GenericMixedRenderer.d.ts +9 -0
  74. package/lib/renderers/HorizontalLayoutRenderer.d.ts +5 -0
  75. package/lib/renderers/ImageViewRenderer.d.ts +48 -0
  76. package/lib/renderers/LinkRenderer.d.ts +23 -0
  77. package/lib/renderers/MarkupLabelRenderer.d.ts +35 -0
  78. package/lib/renderers/MarkupLabelRenderer.impl.d.ts +17 -0
  79. package/lib/renderers/MonacoControlRenderer.d.ts +8 -0
  80. package/lib/renderers/MonacoControlRenderer.impl.d.ts +4 -0
  81. package/lib/renderers/RactiveTemplateLayoutRenderer.d.ts +6 -0
  82. package/lib/renderers/SeparatorRenderer.d.ts +17 -0
  83. package/lib/renderers/SlotRenderer.d.ts +5 -0
  84. package/lib/renderers/SpacerRenderer.d.ts +5 -0
  85. package/lib/renderers/SplitLayoutRenderer.d.ts +18 -0
  86. package/lib/renderers/TemplateLayoutRenderer.d.ts +13 -0
  87. package/lib/renderers/TemplateRenderer.d.ts +17 -0
  88. package/lib/renderers/TsxTemplateLayoutRenderer.d.ts +111 -0
  89. package/lib/renderers/index.d.ts +13 -0
  90. package/lib/renderers/templateEngines.d.ts +43 -0
  91. package/lib/util/actionContext.d.ts +23 -0
  92. package/lib/util/additionalErrors.d.ts +77 -0
  93. package/lib/util/celEnvironment.d.ts +23 -0
  94. package/lib/util/celTemplate.d.ts +47 -0
  95. package/lib/util/childNames.d.ts +46 -0
  96. package/lib/util/configNamespaces.d.ts +1 -0
  97. package/lib/util/cron.d.ts +122 -0
  98. package/lib/util/editorControls.d.ts +8 -0
  99. package/lib/util/editorDiagnostics.d.ts +56 -0
  100. package/lib/util/extendedControls.d.ts +4 -0
  101. package/lib/util/extendedLocale.d.ts +32 -0
  102. package/lib/util/fileFilterValue.d.ts +3 -0
  103. package/lib/util/formContext.d.ts +54 -0
  104. package/lib/util/gridColumns.d.ts +6 -0
  105. package/lib/util/horizontalLayout.d.ts +10 -0
  106. package/lib/util/i18nDefaults.d.ts +45 -0
  107. package/lib/util/interpolate.d.ts +105 -0
  108. package/lib/util/labelFilterValue.d.ts +2 -0
  109. package/lib/util/lazyControl.d.ts +36 -0
  110. package/lib/util/lazyTemplate.d.ts +18 -0
  111. package/lib/util/markdown.d.ts +55 -0
  112. package/lib/util/markdownEscape.d.ts +27 -0
  113. package/lib/util/markup.d.ts +74 -0
  114. package/lib/util/maskControls.d.ts +2 -0
  115. package/lib/util/templateLang.d.ts +87 -0
  116. package/lib/util/templateUrls.d.ts +40 -0
  117. package/lib/util/urlPolicy.d.ts +42 -0
  118. package/lib/util/useCronPicker.d.ts +24 -0
  119. package/lib/util/useDurationControl.d.ts +99 -0
  120. package/lib/util/useEditorAppearance.d.ts +21 -0
  121. package/lib/util/useExtendedTranslator.d.ts +10 -0
  122. package/lib/util/useMonacoShadowStyles.d.ts +2 -0
  123. package/package.json +110 -3
  124. package/src/components/DynamicJSXRenderer.tsx +274 -0
  125. package/src/components/ExtendedJsonForms.tsx +329 -0
  126. package/src/components/GenericAdditionalProperties.tsx +362 -0
  127. package/src/components/InterpolatedText.tsx +114 -0
  128. package/src/components/RactiveTemplate.tsx +161 -0
  129. package/src/components/editorRendererTypes.ts +135 -0
  130. package/src/components/elementRender.ts +15 -0
  131. package/src/core/ajv.ts +177 -0
  132. package/src/core/ajvI18n/bg.ts +203 -0
  133. package/src/core/ajvI18n/index.ts +267 -0
  134. package/src/core/ajvI18n/localizers.ts +25 -0
  135. package/src/core/dynamicDefaults.ts +170 -0
  136. package/src/core/keywords.ts +71 -0
  137. package/src/core/transform.ts +137 -0
  138. package/src/core/uiSchema.ts +53 -0
  139. package/src/index.tsx +196 -0
  140. package/src/locale/bg.ts +51 -0
  141. package/src/renderers/AgGridControlRenderer.impl.tsx +788 -0
  142. package/src/renderers/AgGridControlRenderer.tsx +24 -0
  143. package/src/renderers/ButtonRenderer.tsx +328 -0
  144. package/src/renderers/GenericMixedRenderer.tsx +224 -0
  145. package/src/renderers/HorizontalLayoutRenderer.tsx +93 -0
  146. package/src/renderers/ImageViewRenderer.tsx +328 -0
  147. package/src/renderers/LinkRenderer.tsx +92 -0
  148. package/src/renderers/MarkupLabelRenderer.impl.tsx +26 -0
  149. package/src/renderers/MarkupLabelRenderer.tsx +327 -0
  150. package/src/renderers/MonacoControlRenderer.impl.tsx +351 -0
  151. package/src/renderers/MonacoControlRenderer.tsx +24 -0
  152. package/src/renderers/RactiveTemplateLayoutRenderer.tsx +172 -0
  153. package/src/renderers/SeparatorRenderer.tsx +55 -0
  154. package/src/renderers/SlotRenderer.tsx +34 -0
  155. package/src/renderers/SpacerRenderer.tsx +69 -0
  156. package/src/renderers/SplitLayoutRenderer.tsx +220 -0
  157. package/src/renderers/TemplateLayoutRenderer.tsx +394 -0
  158. package/src/renderers/TemplateRenderer.tsx +71 -0
  159. package/src/renderers/TsxTemplateLayoutRenderer.tsx +258 -0
  160. package/src/renderers/index.ts +14 -0
  161. package/src/renderers/templateEngines.tsx +100 -0
  162. package/src/util/actionContext.ts +29 -0
  163. package/src/util/additionalErrors.tsx +391 -0
  164. package/src/util/celEnvironment.ts +300 -0
  165. package/src/util/celTemplate.ts +267 -0
  166. package/src/util/childNames.ts +135 -0
  167. package/src/util/configNamespaces.ts +6 -0
  168. package/src/util/cron.ts +433 -0
  169. package/src/util/editorControls.ts +58 -0
  170. package/src/util/editorDiagnostics.ts +103 -0
  171. package/src/util/extendedControls.ts +34 -0
  172. package/src/util/extendedLocale.ts +67 -0
  173. package/src/util/fileFilterValue.ts +28 -0
  174. package/src/util/formContext.ts +74 -0
  175. package/src/util/gridColumns.ts +80 -0
  176. package/src/util/horizontalLayout.ts +59 -0
  177. package/src/util/i18nDefaults.ts +80 -0
  178. package/src/util/interpolate.ts +218 -0
  179. package/src/util/labelFilterValue.ts +49 -0
  180. package/src/util/lazyControl.tsx +66 -0
  181. package/src/util/lazyTemplate.tsx +110 -0
  182. package/src/util/markdown.tsx +345 -0
  183. package/src/util/markdownEscape.ts +29 -0
  184. package/src/util/markup.ts +144 -0
  185. package/src/util/maskControls.ts +6 -0
  186. package/src/util/templateLang.ts +145 -0
  187. package/src/util/templateUrls.ts +274 -0
  188. package/src/util/urlPolicy.ts +115 -0
  189. package/src/util/useCronPicker.ts +102 -0
  190. package/src/util/useDurationControl.ts +272 -0
  191. package/src/util/useEditorAppearance.ts +86 -0
  192. package/src/util/useExtendedTranslator.ts +25 -0
  193. package/src/util/useMonacoShadowStyles.ts +47 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"celTemplate-Cl0alaCz.js","names":["Environment","splitTemplate","hasExpressions","require_ajvI18n","require_jsonforms_react_extended","_marcbachmann_cel_js","DATE_ONLY","TIME_ONLY","toInstant","value","text","parse","date","iso","UTC","toNumeric","build","locale","v","d","code","environments","environmentFor","key","existing","created","toMaps","child","isUnsupportedObject","error","withTranslator","env","_translate","translate","_translate2","fallback","evaluateWith","declared","name","values","scope","expression","repaired","celTemplate_exports","renderTemplate","resolveTextParams","messageOf","isAbsentData","CONSTRUCTOR_KEY_LIMIT","findsConstructorKey","depth","explain","message","display","failures","segment","segments","rendered","failure","escape","params","raw","namespaceScope"],"sources":["../src/util/celEnvironment.ts","../src/util/celTemplate.ts"],"sourcesContent":["import { Environment } from '@marcbachmann/cel-js';\n\n/**\n * The evaluator, with locale-aware formatting.\n *\n * ## Why formatting is functions rather than automatic\n *\n * A locale decides more than which words are shown: `148.5` is `148,50 €` in\n * German and `€148.50` in English, and a date reads differently in every\n * language. An expression language has none of that built in, so it is\n * supplied here as functions the author calls explicitly.\n *\n * Explicit, because the alternative - formatting every number on its way into\n * the text - cannot tell a price from an order number, a year or an id, and\n * would render `2026` as `2,026`. There is no way to opt out of an implicit\n * rule; there is nothing to opt out of with a function.\n *\n * They are part of the published contract: an author writing\n * `{currency(amount, \"EUR\")}` in a catalog string is relying on them, and a\n * renderer set that drops one breaks that string in every language.\n *\n * ## The locale comes from the form\n *\n * One environment per locale, cached, so switching language re-formats\n * without re-parsing anything. `Intl` does the work, so there is no data to\n * ship and the result matches the platform's own rendering.\n */\n\n/**\n * A temporal value out of the form's data is **always a string**: `data` holds\n * JSON, so a date is whatever the schema's `format` said it was, never a\n * JavaScript `Date`. The three formats parse very differently, and treating\n * them alike is wrong in two of the three cases.\n *\n * | value | `new Date(...)` | formatted in the viewer's zone |\n * | --- | --- | --- |\n * | `2026-10-01` | UTC midnight | **30 September** west of the meridian |\n * | `14:30:00` | **Invalid Date** | - |\n * | `2026-10-01T14:30:00+02:00` | the right instant | correct |\n *\n * So a **calendar date** is read and formatted in UTC, because it denotes a\n * day rather than a moment and must not slide into the day before. A\n * **time-only** value has no date to anchor it and is given one. A\n * **date-time** denotes an instant, and an instant is shown in the reader's\n * own zone - pinning it to UTC would display a time nobody asked for.\n */\nconst DATE_ONLY = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst TIME_ONLY = /^\\d{2}:\\d{2}(:\\d{2})?(\\.\\d+)?$/;\n\ninterface Instant {\n date: Date;\n /** `UTC` where the value denotes a day or a clock time rather than a moment. */\n timeZone?: string;\n}\n\nconst toInstant = (value: unknown): Instant => {\n /*\n A `Date` is accepted because host `context` may legitimately carry one.\n It never comes from `data`.\n */\n if (value instanceof Date) {\n return { date: value };\n }\n const text = String(value);\n const parse = (iso: string, timeZone?: string): Instant => {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`not a date: ${text}`);\n }\n return { date, timeZone };\n };\n if (DATE_ONLY.test(text)) {\n return parse(`${text}T00:00:00Z`, UTC);\n }\n if (TIME_ONLY.test(text)) {\n // Any date will do; only the clock is shown.\n return parse(`1970-01-01T${text}Z`, UTC);\n }\n return parse(text);\n};\n\nconst UTC = 'UTC';\n\n/** CEL integers arrive as `bigint`; `Intl` handles both, `Number()` is for safety. */\nconst toNumeric = (value: unknown): number | bigint =>\n typeof value === 'bigint' ? value : Number(value);\n\nconst build = (locale: string): Environment =>\n new Environment()\n /*\n Registered per numeric CEL type. A value read out of the form's data is\n a `double` to CEL whether or not it has a fraction; a literal or the\n result of `size()` is an `int`. Both have to be accepted or an author\n has to know which is which, which is not knowable from the schema.\n */\n .registerFunction('number(double): string', (v: unknown) =>\n new Intl.NumberFormat(locale).format(toNumeric(v)),\n )\n .registerFunction('number(int): string', (v: unknown) =>\n new Intl.NumberFormat(locale).format(toNumeric(v)),\n )\n .registerFunction('number(double, int): string', (v: unknown, d: unknown) =>\n new Intl.NumberFormat(locale, {\n minimumFractionDigits: Number(d),\n maximumFractionDigits: Number(d),\n }).format(toNumeric(v)),\n )\n .registerFunction(\n 'currency(double, string): string',\n (v: unknown, code: unknown) =>\n new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: String(code),\n }).format(toNumeric(v)),\n )\n .registerFunction(\n 'currency(int, string): string',\n (v: unknown, code: unknown) =>\n new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: String(code),\n }).format(toNumeric(v)),\n )\n .registerFunction('percent(double): string', (v: unknown) =>\n new Intl.NumberFormat(locale, { style: 'percent' }).format(toNumeric(v)),\n )\n .registerFunction('date(string): string', (v: unknown) => {\n const { date, timeZone } = toInstant(v);\n return new Intl.DateTimeFormat(locale, {\n dateStyle: 'medium',\n timeZone,\n }).format(date);\n })\n .registerFunction('time(string): string', (v: unknown) => {\n const { date, timeZone } = toInstant(v);\n return new Intl.DateTimeFormat(locale, {\n timeStyle: 'short',\n timeZone,\n }).format(date);\n })\n .registerFunction('dateTime(string): string', (v: unknown) => {\n const { date, timeZone } = toInstant(v);\n return new Intl.DateTimeFormat(locale, {\n dateStyle: 'medium',\n timeStyle: 'short',\n timeZone,\n }).format(date);\n });\n\nconst environments = new Map<string, Environment>();\n\n/** The base environment for a locale, built once. */\nconst environmentFor = (locale: string | undefined): Environment => {\n const key = locale ?? 'en';\n const existing = environments.get(key);\n if (existing) {\n return existing;\n }\n const created = build(key);\n environments.set(key, created);\n return created;\n};\n\n/**\n * Evaluates one expression against a scope.\n *\n * Every name in the scope is declared as `dyn`, which is what an untyped\n * evaluation already gives: measured against this library's own\n * `evaluate()`, a `dyn` declaration accepts everything it accepts and refuses\n * the same things - including `seats + 1`, where CEL will not mix a\n * double-typed value with an integer literal. (`seats + 1.0` works.) So the\n * typed environment costs nothing and is what makes the formatting functions\n * reachable.\n *\n * Declaring the names also keeps the refusal: an identifier that is not in\n * the scope is an error rather than a silent `undefined`.\n */\n/**\n * `constructor` is a legal JSON key, and the evaluator cannot read an object\n * that has one.\n *\n * Its type check is `switch (v.constructor)` with cases `undefined | Object |\n * Map`, so a data property of that name shadows the constructor and the\n * **whole map** is rejected - every sibling field becomes unreadable with it.\n * Measured: only `constructor` does this; `__proto__`, `toString`, `valueOf`\n * and `hasOwnProperty` as data keys are fine.\n *\n * A `Map` is the repair, because its entries live in an internal slot and\n * cannot shadow `.constructor` - `Map` is already one of the accepted cases,\n * and a key called `constructor` then reads like any other.\n */\nconst toMaps = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n return value.map(toMaps);\n }\n if (\n value !== null &&\n typeof value === 'object' &&\n !(value instanceof Date) &&\n !(value instanceof Map)\n ) {\n return new Map(\n Object.entries(value as Record<string, unknown>).map(([key, child]) => [\n key,\n toMaps(child),\n ]),\n );\n }\n return value;\n};\n\nconst isUnsupportedObject = (error: unknown): boolean =>\n error instanceof Error &&\n error.message.startsWith('Unsupported type: object');\n\n/**\n * Evaluates one expression against a scope.\n *\n * Every name in the scope is declared as `dyn`, which is what an untyped\n * evaluation already gives: measured against this library's own\n * `evaluate()`, a `dyn` declaration accepts everything it accepts and refuses\n * the same things - including `seats + 1`, where CEL will not mix a\n * double-typed value with an integer literal. (`seats + 1.0` works.) So the\n * typed environment costs nothing and is what makes the formatting functions\n * reachable.\n *\n * Declaring the names also keeps the refusal: an identifier that is not in\n * the scope is an error rather than a silent `undefined`.\n *\n * **The repair runs only after the one failure it fixes.** Data is read as\n * it arrives, so the ordinary path converts nothing; an object carrying a\n * `constructor` key is rebuilt as maps and the expression is tried once\n * more. Converting up front would mean walking the whole form's data on\n * every label of every render to serve a case almost no schema has.\n */\n/** The form's translator, as JSON Forms supplies it. */\nexport type Translate = (\n key: string,\n defaultMessage?: string,\n) => string | undefined;\n\n/**\n * Registers `translate`, bound to this form's translator.\n *\n * It has to be **registered** rather than passed in the scope, and that is\n * the whole point: a function placed in `context` is not callable, is not\n * even readable, and no expression can reach it. Measured - a member call\n * finds no overload, a bare call finds no overload, and reading it is an\n * unsupported type. So a host cannot widen what an expression can do by\n * putting a callback in the data, deliberately or by accident. Capability is\n * granted here, in one place, on purpose.\n *\n * What it buys: a value out of the data is often a **key**, not a word.\n * `data.plan` is `\"Team\"` in every language, and `{translate(\"plan.\" + plan)}`\n * turns it into the language's own word for it - which a catalog can do for\n * itself, without the UI schema knowing the set of plans.\n *\n * Registered on the per-call clone rather than the cached environment,\n * because the translator belongs to the form while the environment is shared\n * by locale.\n */\nconst withTranslator = (env: Environment, translate: Translate): Environment =>\n env\n .registerFunction('translate(string): string', (key: unknown) =>\n String(translate(String(key), String(key)) ?? String(key)),\n )\n .registerFunction(\n 'translate(string, string): string',\n (key: unknown, fallback: unknown) =>\n String(translate(String(key), String(fallback)) ?? String(fallback)),\n );\n\nexport const evaluateWith = (\n expression: string,\n scope: Record<string, unknown>,\n locale: string | undefined,\n translate?: Translate,\n): unknown => {\n const declared = (values: Record<string, unknown>) => {\n let env = environmentFor(locale).clone();\n if (translate) {\n env = withTranslator(env, translate);\n }\n for (const name of Object.keys(values)) {\n env.registerVariable(name, 'dyn');\n }\n return env;\n };\n try {\n return declared(scope).evaluate(expression, scope);\n } catch (error) {\n if (!isUnsupportedObject(error)) {\n throw error;\n }\n const repaired = Object.fromEntries(\n Object.entries(scope).map(([name, value]) => [name, toMaps(value)]),\n );\n return declared(repaired).evaluate(expression, repaired);\n }\n};\n","import { Translate, evaluateWith } from './celEnvironment';\nimport { TemplateSegment, hasExpressions, splitTemplate } from './interpolate';\n\n/**\n * Evaluating a split template with CEL.\n *\n * The only module that imports the evaluator, so it is the only thing a\n * dynamic import has to pull in. Nothing here decides *whether* to\n * interpolate - that is settled before the chunk is ever requested.\n */\n\n/** The evaluator's own first line, which names the cause better than we could. */\nconst messageOf = (error: unknown): string =>\n error instanceof Error ? error.message.split('\\n')[0] : String(error);\n\n/**\n * Whether a failure is the data simply not being there.\n *\n * The distinction this draws is the difference between a bug in the form and\n * a fact about the record being edited:\n *\n * - **An authoring error** is wrong however the form is filled in. A name the\n * text does not declare, a function that does not exist, a type mismatch -\n * these are reported, because someone has to fix the UI schema.\n * - **Absent data is normal.** A record without a middle name, an empty list,\n * an optional object that has not been filled in yet: the expression is\n * correct and the value is not there *at the moment*. Reporting it would\n * put a developer-facing message on the page for every half-filled form,\n * which trains people to ignore diagnostics.\n *\n * The evaluator separates the two cleanly and this is the whole basis for\n * telling them apart: reaching a key that is not present - at any depth, and\n * including an index past the end of a list - is always `No such key`, while\n * an identifier that is not in scope at all is `Unknown variable`.\n *\n * Note this is about keys *beneath* a namespace. A root that is not a\n * namespace at all is `Unknown variable` and stays an error.\n */\nconst isAbsentData = (error: unknown): boolean =>\n messageOf(error).startsWith('No such key:');\n\n/**\n * Explains the one failure whose own message explains nothing.\n *\n * A JSON object may have a property called `constructor` - it is a legal key\n * and a schema may well declare one. The evaluator cannot read such an\n * object: its type check is defeated by the shadowed `constructor`, and it\n * rejects the **whole map** with `Unsupported type: object`, so every other\n * field of that object becomes unreadable too. Measured: `__proto__`,\n * `toString`, `valueOf` and `hasOwnProperty` as data keys are all fine; only\n * `constructor` does this.\n *\n * The search runs **only after a failure**, so the common path pays nothing,\n * and it is depth-limited because it exists to name a cause rather than to\n * audit the data.\n */\nconst CONSTRUCTOR_KEY_LIMIT = 4;\n\nconst findsConstructorKey = (value: unknown, depth = 0): boolean => {\n if (\n depth > CONSTRUCTOR_KEY_LIMIT ||\n value === null ||\n typeof value !== 'object'\n ) {\n return false;\n }\n if (Object.prototype.hasOwnProperty.call(value, 'constructor')) {\n return true;\n }\n return Object.values(value as Record<string, unknown>).some((child) =>\n findsConstructorKey(child, depth + 1),\n );\n};\n\nconst explain = (error: unknown, scope: Record<string, unknown>): string => {\n const message = messageOf(error);\n if (\n message.startsWith('Unsupported type: object') &&\n findsConstructorKey(scope)\n ) {\n return `${message} - a value in scope has a property named \"constructor\", which this evaluator cannot read`;\n }\n return message;\n};\n\nexport interface TemplateResult {\n text: string;\n /** One per expression that could not be rendered. Never thrown. */\n failures: string[];\n}\n\n/**\n * A CEL value as display text.\n *\n * CEL integers are int64 and arrive as `bigint`, which `String` handles;\n * values taken straight from the form's data keep their JavaScript types.\n *\n * An object or a list has **no** sensible one-line form, so it is refused\n * rather than rendered: `[object Object]` in the middle of a sentence is\n * worse than a diagnostic, because it looks like data and is not.\n */\nconst display = (value: unknown): { text: string; failure?: string } => {\n if (value === null || value === undefined) {\n /*\n Empty, and silent. By the time a value reaches the text its absence is\n a fact about the data rather than a mistake in the form - an optional\n field that has not been filled in renders as nothing, which is what a\n reader expects and what a half-filled form is full of.\n */\n return { text: '' };\n }\n switch (typeof value) {\n case 'string':\n return { text: value };\n case 'number':\n case 'bigint':\n case 'boolean':\n return { text: String(value) };\n default:\n return {\n text: '',\n failure: `resolved to a ${\n Array.isArray(value) ? 'list' : 'structure'\n }, which has no text form`,\n };\n }\n};\n\n/**\n * Renders the segments, substituting each expression's value.\n *\n * `escape` is applied to **substituted values only**, never to the literal\n * segments. That distinction is the whole security property when the result\n * is about to be parsed as Markdown: a value containing\n * `[click](javascript:alert(1))` has to render as those characters, while the\n * author's own `**bold**` in the surrounding literal must still work.\n * Escaping the finished string would break the second; escaping nothing would\n * break the first. It is also why the template is split into segments rather\n * than evaluated with a regex replace.\n *\n * An expression that throws does not take the label down: it contributes\n * empty text and a failure, and the caller decides what to show.\n */\nexport const renderTemplate = (\n segments: TemplateSegment[],\n scope: Record<string, unknown>,\n escape: (text: string) => string = (text) => text,\n locale?: string,\n translate?: Translate,\n): TemplateResult => {\n const failures: string[] = [];\n let text = '';\n for (const segment of segments) {\n if (segment.kind === 'literal') {\n text += segment.text;\n continue;\n }\n try {\n const { text: rendered, failure } = display(\n evaluateWith(segment.source, scope, locale, translate),\n );\n if (failure) {\n failures.push(`${segment.source.trim()} ${failure}`);\n }\n text += escape(rendered);\n } catch (error) {\n /*\n Absent data contributes empty text and nothing else; anything else is\n an authoring error, and the evaluator's own message names the cause\n better than this layer could. It is developer-facing text, reported\n beside the label rather than thrown.\n */\n if (!isAbsentData(error)) {\n failures.push(`${segment.source.trim()}: ${explain(error, scope)}`);\n }\n }\n }\n return { text, failures };\n};\n\n/**\n * Resolves the declared `textParams` against the namespaces.\n *\n * This is the **only** place the form's data is read. A parameter's value is\n * the right-hand side of a declaration in the UI schema, which is where\n * knowledge of the data model belongs; the text it feeds knows only the\n * parameter's name, which is what makes that text translatable.\n *\n * A value is treated as a template, so the same grammar applies one level\n * down: `\"Atlas\"` is a literal, `\"{data.plan}\"` resolves, and\n * `\"Plan {data.plan}\"` does both. A non-string value - a number, a boolean,\n * an object to navigate with `{user.name}` - passes through untouched.\n *\n * Parameters see the namespaces and **not each other**. Allowing one to\n * reference another would need an evaluation order and a cycle check, for a\n * capability that an extra parameter already covers.\n *\n * Values are not escaped here. Escaping belongs to the moment a value is\n * substituted into the text, because that is the string a parser will see.\n */\nexport const resolveTextParams = (\n raw: Record<string, unknown> | undefined,\n namespaceScope: Record<string, unknown>,\n locale?: string,\n translate?: Translate,\n): { params: Record<string, unknown>; failures: string[] } => {\n const params: Record<string, unknown> = {};\n const failures: string[] = [];\n for (const [name, value] of Object.entries(raw ?? {})) {\n if (typeof value !== 'string') {\n params[name] = value;\n continue;\n }\n const segments = splitTemplate(value);\n if (!hasExpressions(segments)) {\n /*\n A literal, but still run through the split so the grammar's brace\n escaping applies: `{{x}}` is the literal `{x}` here exactly as it is\n in the text.\n */\n params[name] = segments\n .map((segment) => (segment.kind === 'literal' ? segment.text : ''))\n .join('');\n continue;\n }\n /*\n A value that is exactly one expression keeps the expression's own type,\n so `{data.seats}` stays a number and a comparison against it in the text\n still works. Anything else is string concatenation.\n */\n if (segments.length === 1 && segments[0].kind === 'expression') {\n try {\n params[name] = evaluateWith(\n segments[0].source,\n namespaceScope,\n locale,\n translate,\n );\n } catch (error) {\n if (!isAbsentData(error)) {\n failures.push(`${name}: ${explain(error, namespaceScope)}`);\n }\n /*\n Empty either way. Where it was an authoring error the cause has just\n been reported at the level it happened, and leaving the name\n unresolved would make the text report it again - one problem, one\n diagnostic. Where the data was simply absent there is nothing to\n report and nothing to show.\n */\n params[name] = '';\n }\n continue;\n }\n const rendered = renderTemplate(\n segments,\n namespaceScope,\n undefined,\n locale,\n translate,\n );\n for (const failure of rendered.failures) {\n failures.push(`${name}: ${failure}`);\n }\n params[name] = rendered.text;\n }\n return { params, failures };\n};\n"],"mappings":"A,8HA8CA,IAAMM,EAAY,sBACZC,EAAY,iCAQZC,EAAa,GAA4B,CAK7C,GAAIC,aAAiB,KACnB,MAAO,CAAE,KAAMA,CAAM,EAEvB,IAAMC,EAAO,OAAOD,CAAK,EACnBE,GAAS,EAAa,IAA+B,CACzD,IAAMC,EAAO,IAAI,KAAKC,CAAG,EACzB,GAAI,OAAO,MAAMD,EAAK,QAAQ,CAAC,EAC7B,MAAU,MAAM,eAAeF,GAAM,EAEvC,MAAO,CAAE,OAAM,UAAS,CAC1B,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QkB,EACZ,IAAK,GAAaD,EAAQ,OAAS,UAAYA,EAAQ,KAAO,EAAG,CAAC,CAClE,KAAK,EAAE,EACV,QACF,CAMA,GAAIC,EAAS,SAAW,GAAKA,EAAS,EAAE,CAAC,OAAS,aAAc,CAC9D,GAAI,CACF,EAAOlB,GAAQF,EACboB,EAAS,EAAE,CAAC,OACZM,EACA7C,EACAgB,CACF,CACF,OAASJ,EAAO,CACTkB,EAAalB,CAAK,GACrByB,EAAS,KAAK,GAAGhB,EAAK,IAAIa,EAAQtB,EAAOiC,CAAc,GAAG,EAS5D,EAAOxB,GAAQ,EACjB,CACA,QACF,CACA,IAAMmB,EAAWb,EACfY,EACAM,EACA,IAAA,GACA7C,EACAgB,CACF,EACA,IAAK,IAAMyB,KAAWD,EAAS,SAC7BH,EAAS,KAAK,GAAGhB,EAAK,IAAIoB,GAAS,EAErC,EAAOpB,GAAQmB,EAAS,IAC1B,CACA,MAAO,CAAE,SAAQ,UAAS,CAC5B,E"}
@@ -0,0 +1,137 @@
1
+ import { hasExpressions as e, splitTemplate as t } from "./jsonforms-react-extended.esm.js";
2
+ import { Environment as n } from "@marcbachmann/cel-js";
3
+ // \0rolldown/runtime.js
4
+ var r = Object.defineProperty, i = (e, t) => {
5
+ let n = {};
6
+ for (var i in e) r(n, i, {
7
+ get: e[i],
8
+ enumerable: !0
9
+ });
10
+ return t || r(n, Symbol.toStringTag, { value: "Module" }), n;
11
+ }, a = /^\d{4}-\d{2}-\d{2}$/, o = /^\d{2}:\d{2}(:\d{2})?(\.\d+)?$/, s = (e) => {
12
+ if (e instanceof Date) return { date: e };
13
+ let t = String(e), n = (e, n) => {
14
+ let r = new Date(e);
15
+ if (Number.isNaN(r.getTime())) throw Error(`not a date: ${t}`);
16
+ return {
17
+ date: r,
18
+ timeZone: n
19
+ };
20
+ };
21
+ return a.test(t) ? n(`${t}T00:00:00Z`, c) : o.test(t) ? n(`1970-01-01T${t}Z`, c) : n(t);
22
+ }, c = "UTC", l = (e) => typeof e == "bigint" ? e : Number(e), u = (e) => new n().registerFunction("number(double): string", (t) => new Intl.NumberFormat(e).format(l(t))).registerFunction("number(int): string", (t) => new Intl.NumberFormat(e).format(l(t))).registerFunction("number(double, int): string", (t, n) => new Intl.NumberFormat(e, {
23
+ minimumFractionDigits: Number(n),
24
+ maximumFractionDigits: Number(n)
25
+ }).format(l(t))).registerFunction("currency(double, string): string", (t, n) => new Intl.NumberFormat(e, {
26
+ style: "currency",
27
+ currency: String(n)
28
+ }).format(l(t))).registerFunction("currency(int, string): string", (t, n) => new Intl.NumberFormat(e, {
29
+ style: "currency",
30
+ currency: String(n)
31
+ }).format(l(t))).registerFunction("percent(double): string", (t) => new Intl.NumberFormat(e, { style: "percent" }).format(l(t))).registerFunction("date(string): string", (t) => {
32
+ let { date: n, timeZone: r } = s(t);
33
+ return new Intl.DateTimeFormat(e, {
34
+ dateStyle: "medium",
35
+ timeZone: r
36
+ }).format(n);
37
+ }).registerFunction("time(string): string", (t) => {
38
+ let { date: n, timeZone: r } = s(t);
39
+ return new Intl.DateTimeFormat(e, {
40
+ timeStyle: "short",
41
+ timeZone: r
42
+ }).format(n);
43
+ }).registerFunction("dateTime(string): string", (t) => {
44
+ let { date: n, timeZone: r } = s(t);
45
+ return new Intl.DateTimeFormat(e, {
46
+ dateStyle: "medium",
47
+ timeStyle: "short",
48
+ timeZone: r
49
+ }).format(n);
50
+ }), d = /* @__PURE__ */ new Map(), f = (e) => {
51
+ let t = e == null ? "en" : e, n = d.get(t);
52
+ if (n) return n;
53
+ let r = u(t);
54
+ return d.set(t, r), r;
55
+ }, p = (e) => Array.isArray(e) ? e.map(p) : typeof e == "object" && e && !(e instanceof Date) && !(e instanceof Map) ? new Map(Object.entries(e).map(([e, t]) => [e, p(t)])) : e, m = (e) => e instanceof Error && e.message.startsWith("Unsupported type: object"), h = (e, t) => e.registerFunction("translate(string): string", (e) => {
56
+ var n;
57
+ return String((n = t(String(e), String(e))) == null ? String(e) : n);
58
+ }).registerFunction("translate(string, string): string", (e, n) => {
59
+ var r;
60
+ return String((r = t(String(e), String(n))) == null ? String(n) : r);
61
+ }), g = (e, t, n, r) => {
62
+ let i = (e) => {
63
+ let t = f(n).clone();
64
+ r && (t = h(t, r));
65
+ for (let n of Object.keys(e)) t.registerVariable(n, "dyn");
66
+ return t;
67
+ };
68
+ try {
69
+ return i(t).evaluate(e, t);
70
+ } catch (n) {
71
+ if (!m(n)) throw n;
72
+ let r = Object.fromEntries(Object.entries(t).map(([e, t]) => [e, p(t)]));
73
+ return i(r).evaluate(e, r);
74
+ }
75
+ }, _ = /* @__PURE__ */ i({
76
+ renderTemplate: () => w,
77
+ resolveTextParams: () => T
78
+ }), v = (e) => e instanceof Error ? e.message.split("\n")[0] : String(e), y = (e) => v(e).startsWith("No such key:"), b = 4, x = (e, t = 0) => t > b || typeof e != "object" || !e ? !1 : Object.prototype.hasOwnProperty.call(e, "constructor") ? !0 : Object.values(e).some((e) => x(e, t + 1)), S = (e, t) => {
79
+ let n = v(e);
80
+ return n.startsWith("Unsupported type: object") && x(t) ? `${n} - a value in scope has a property named "constructor", which this evaluator cannot read` : n;
81
+ }, C = (e) => {
82
+ if (e == null) return { text: "" };
83
+ switch (typeof e) {
84
+ case "string": return { text: e };
85
+ case "number":
86
+ case "bigint":
87
+ case "boolean": return { text: String(e) };
88
+ default: return {
89
+ text: "",
90
+ failure: `resolved to a ${Array.isArray(e) ? "list" : "structure"}, which has no text form`
91
+ };
92
+ }
93
+ }, w = (e, t, n = (e) => e, r, i) => {
94
+ let a = [], o = "";
95
+ for (let s of e) if (s.kind === "literal") o += s.text;
96
+ else try {
97
+ let { text: e, failure: c } = C(g(s.source, t, r, i));
98
+ c && a.push(`${s.source.trim()} ${c}`), o += n(e);
99
+ } catch (e) {
100
+ y(e) || a.push(`${s.source.trim()}: ${S(e, t)}`);
101
+ }
102
+ return {
103
+ text: o,
104
+ failures: a
105
+ };
106
+ }, T = (n, r, i, a) => {
107
+ let o = {}, s = [];
108
+ for (let [c, l] of Object.entries(n == null ? {} : n)) {
109
+ if (typeof l != "string") {
110
+ o[c] = l;
111
+ continue;
112
+ }
113
+ let n = t(l);
114
+ if (!e(n)) {
115
+ o[c] = n.map((e) => e.kind === "literal" ? e.text : "").join("");
116
+ continue;
117
+ }
118
+ if (n.length === 1 && n[0].kind === "expression") {
119
+ try {
120
+ o[c] = g(n[0].source, r, i, a);
121
+ } catch (e) {
122
+ y(e) || s.push(`${c}: ${S(e, r)}`), o[c] = "";
123
+ }
124
+ continue;
125
+ }
126
+ let u = w(n, r, void 0, i, a);
127
+ for (let e of u.failures) s.push(`${c}: ${e}`);
128
+ o[c] = u.text;
129
+ }
130
+ return {
131
+ params: o,
132
+ failures: s
133
+ };
134
+ };
135
+ export { w as n, T as r, _ as t };
136
+
137
+ //# sourceMappingURL=celTemplate-D_AGhaIL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"celTemplate-D_AGhaIL.mjs","names":["__defProp","__exportAll","target","name","all","no_symbols","DATE_ONLY","TIME_ONLY","toInstant","value","text","parse","date","iso","UTC","toNumeric","build","Environment","locale","v","d","code","environments","environmentFor","key","existing","created","toMaps","child","isUnsupportedObject","error","withTranslator","env","_translate","translate","_translate2","fallback","evaluateWith","declared","values","scope","expression","repaired","celTemplate_exports","renderTemplate","resolveTextParams","messageOf","isAbsentData","CONSTRUCTOR_KEY_LIMIT","findsConstructorKey","depth","explain","message","display","failures","segment","segments","rendered","failure","escape","params","raw","splitTemplate","hasExpressions","namespaceScope"],"sources":["../src/util/celEnvironment.ts","../src/util/celTemplate.ts"],"sourcesContent":["import { Environment } from '@marcbachmann/cel-js';\n\n/**\n * The evaluator, with locale-aware formatting.\n *\n * ## Why formatting is functions rather than automatic\n *\n * A locale decides more than which words are shown: `148.5` is `148,50 €` in\n * German and `€148.50` in English, and a date reads differently in every\n * language. An expression language has none of that built in, so it is\n * supplied here as functions the author calls explicitly.\n *\n * Explicit, because the alternative - formatting every number on its way into\n * the text - cannot tell a price from an order number, a year or an id, and\n * would render `2026` as `2,026`. There is no way to opt out of an implicit\n * rule; there is nothing to opt out of with a function.\n *\n * They are part of the published contract: an author writing\n * `{currency(amount, \"EUR\")}` in a catalog string is relying on them, and a\n * renderer set that drops one breaks that string in every language.\n *\n * ## The locale comes from the form\n *\n * One environment per locale, cached, so switching language re-formats\n * without re-parsing anything. `Intl` does the work, so there is no data to\n * ship and the result matches the platform's own rendering.\n */\n\n/**\n * A temporal value out of the form's data is **always a string**: `data` holds\n * JSON, so a date is whatever the schema's `format` said it was, never a\n * JavaScript `Date`. The three formats parse very differently, and treating\n * them alike is wrong in two of the three cases.\n *\n * | value | `new Date(...)` | formatted in the viewer's zone |\n * | --- | --- | --- |\n * | `2026-10-01` | UTC midnight | **30 September** west of the meridian |\n * | `14:30:00` | **Invalid Date** | - |\n * | `2026-10-01T14:30:00+02:00` | the right instant | correct |\n *\n * So a **calendar date** is read and formatted in UTC, because it denotes a\n * day rather than a moment and must not slide into the day before. A\n * **time-only** value has no date to anchor it and is given one. A\n * **date-time** denotes an instant, and an instant is shown in the reader's\n * own zone - pinning it to UTC would display a time nobody asked for.\n */\nconst DATE_ONLY = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst TIME_ONLY = /^\\d{2}:\\d{2}(:\\d{2})?(\\.\\d+)?$/;\n\ninterface Instant {\n date: Date;\n /** `UTC` where the value denotes a day or a clock time rather than a moment. */\n timeZone?: string;\n}\n\nconst toInstant = (value: unknown): Instant => {\n /*\n A `Date` is accepted because host `context` may legitimately carry one.\n It never comes from `data`.\n */\n if (value instanceof Date) {\n return { date: value };\n }\n const text = String(value);\n const parse = (iso: string, timeZone?: string): Instant => {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`not a date: ${text}`);\n }\n return { date, timeZone };\n };\n if (DATE_ONLY.test(text)) {\n return parse(`${text}T00:00:00Z`, UTC);\n }\n if (TIME_ONLY.test(text)) {\n // Any date will do; only the clock is shown.\n return parse(`1970-01-01T${text}Z`, UTC);\n }\n return parse(text);\n};\n\nconst UTC = 'UTC';\n\n/** CEL integers arrive as `bigint`; `Intl` handles both, `Number()` is for safety. */\nconst toNumeric = (value: unknown): number | bigint =>\n typeof value === 'bigint' ? value : Number(value);\n\nconst build = (locale: string): Environment =>\n new Environment()\n /*\n Registered per numeric CEL type. A value read out of the form's data is\n a `double` to CEL whether or not it has a fraction; a literal or the\n result of `size()` is an `int`. Both have to be accepted or an author\n has to know which is which, which is not knowable from the schema.\n */\n .registerFunction('number(double): string', (v: unknown) =>\n new Intl.NumberFormat(locale).format(toNumeric(v)),\n )\n .registerFunction('number(int): string', (v: unknown) =>\n new Intl.NumberFormat(locale).format(toNumeric(v)),\n )\n .registerFunction('number(double, int): string', (v: unknown, d: unknown) =>\n new Intl.NumberFormat(locale, {\n minimumFractionDigits: Number(d),\n maximumFractionDigits: Number(d),\n }).format(toNumeric(v)),\n )\n .registerFunction(\n 'currency(double, string): string',\n (v: unknown, code: unknown) =>\n new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: String(code),\n }).format(toNumeric(v)),\n )\n .registerFunction(\n 'currency(int, string): string',\n (v: unknown, code: unknown) =>\n new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: String(code),\n }).format(toNumeric(v)),\n )\n .registerFunction('percent(double): string', (v: unknown) =>\n new Intl.NumberFormat(locale, { style: 'percent' }).format(toNumeric(v)),\n )\n .registerFunction('date(string): string', (v: unknown) => {\n const { date, timeZone } = toInstant(v);\n return new Intl.DateTimeFormat(locale, {\n dateStyle: 'medium',\n timeZone,\n }).format(date);\n })\n .registerFunction('time(string): string', (v: unknown) => {\n const { date, timeZone } = toInstant(v);\n return new Intl.DateTimeFormat(locale, {\n timeStyle: 'short',\n timeZone,\n }).format(date);\n })\n .registerFunction('dateTime(string): string', (v: unknown) => {\n const { date, timeZone } = toInstant(v);\n return new Intl.DateTimeFormat(locale, {\n dateStyle: 'medium',\n timeStyle: 'short',\n timeZone,\n }).format(date);\n });\n\nconst environments = new Map<string, Environment>();\n\n/** The base environment for a locale, built once. */\nconst environmentFor = (locale: string | undefined): Environment => {\n const key = locale ?? 'en';\n const existing = environments.get(key);\n if (existing) {\n return existing;\n }\n const created = build(key);\n environments.set(key, created);\n return created;\n};\n\n/**\n * Evaluates one expression against a scope.\n *\n * Every name in the scope is declared as `dyn`, which is what an untyped\n * evaluation already gives: measured against this library's own\n * `evaluate()`, a `dyn` declaration accepts everything it accepts and refuses\n * the same things - including `seats + 1`, where CEL will not mix a\n * double-typed value with an integer literal. (`seats + 1.0` works.) So the\n * typed environment costs nothing and is what makes the formatting functions\n * reachable.\n *\n * Declaring the names also keeps the refusal: an identifier that is not in\n * the scope is an error rather than a silent `undefined`.\n */\n/**\n * `constructor` is a legal JSON key, and the evaluator cannot read an object\n * that has one.\n *\n * Its type check is `switch (v.constructor)` with cases `undefined | Object |\n * Map`, so a data property of that name shadows the constructor and the\n * **whole map** is rejected - every sibling field becomes unreadable with it.\n * Measured: only `constructor` does this; `__proto__`, `toString`, `valueOf`\n * and `hasOwnProperty` as data keys are fine.\n *\n * A `Map` is the repair, because its entries live in an internal slot and\n * cannot shadow `.constructor` - `Map` is already one of the accepted cases,\n * and a key called `constructor` then reads like any other.\n */\nconst toMaps = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n return value.map(toMaps);\n }\n if (\n value !== null &&\n typeof value === 'object' &&\n !(value instanceof Date) &&\n !(value instanceof Map)\n ) {\n return new Map(\n Object.entries(value as Record<string, unknown>).map(([key, child]) => [\n key,\n toMaps(child),\n ]),\n );\n }\n return value;\n};\n\nconst isUnsupportedObject = (error: unknown): boolean =>\n error instanceof Error &&\n error.message.startsWith('Unsupported type: object');\n\n/**\n * Evaluates one expression against a scope.\n *\n * Every name in the scope is declared as `dyn`, which is what an untyped\n * evaluation already gives: measured against this library's own\n * `evaluate()`, a `dyn` declaration accepts everything it accepts and refuses\n * the same things - including `seats + 1`, where CEL will not mix a\n * double-typed value with an integer literal. (`seats + 1.0` works.) So the\n * typed environment costs nothing and is what makes the formatting functions\n * reachable.\n *\n * Declaring the names also keeps the refusal: an identifier that is not in\n * the scope is an error rather than a silent `undefined`.\n *\n * **The repair runs only after the one failure it fixes.** Data is read as\n * it arrives, so the ordinary path converts nothing; an object carrying a\n * `constructor` key is rebuilt as maps and the expression is tried once\n * more. Converting up front would mean walking the whole form's data on\n * every label of every render to serve a case almost no schema has.\n */\n/** The form's translator, as JSON Forms supplies it. */\nexport type Translate = (\n key: string,\n defaultMessage?: string,\n) => string | undefined;\n\n/**\n * Registers `translate`, bound to this form's translator.\n *\n * It has to be **registered** rather than passed in the scope, and that is\n * the whole point: a function placed in `context` is not callable, is not\n * even readable, and no expression can reach it. Measured - a member call\n * finds no overload, a bare call finds no overload, and reading it is an\n * unsupported type. So a host cannot widen what an expression can do by\n * putting a callback in the data, deliberately or by accident. Capability is\n * granted here, in one place, on purpose.\n *\n * What it buys: a value out of the data is often a **key**, not a word.\n * `data.plan` is `\"Team\"` in every language, and `{translate(\"plan.\" + plan)}`\n * turns it into the language's own word for it - which a catalog can do for\n * itself, without the UI schema knowing the set of plans.\n *\n * Registered on the per-call clone rather than the cached environment,\n * because the translator belongs to the form while the environment is shared\n * by locale.\n */\nconst withTranslator = (env: Environment, translate: Translate): Environment =>\n env\n .registerFunction('translate(string): string', (key: unknown) =>\n String(translate(String(key), String(key)) ?? String(key)),\n )\n .registerFunction(\n 'translate(string, string): string',\n (key: unknown, fallback: unknown) =>\n String(translate(String(key), String(fallback)) ?? String(fallback)),\n );\n\nexport const evaluateWith = (\n expression: string,\n scope: Record<string, unknown>,\n locale: string | undefined,\n translate?: Translate,\n): unknown => {\n const declared = (values: Record<string, unknown>) => {\n let env = environmentFor(locale).clone();\n if (translate) {\n env = withTranslator(env, translate);\n }\n for (const name of Object.keys(values)) {\n env.registerVariable(name, 'dyn');\n }\n return env;\n };\n try {\n return declared(scope).evaluate(expression, scope);\n } catch (error) {\n if (!isUnsupportedObject(error)) {\n throw error;\n }\n const repaired = Object.fromEntries(\n Object.entries(scope).map(([name, value]) => [name, toMaps(value)]),\n );\n return declared(repaired).evaluate(expression, repaired);\n }\n};\n","import { Translate, evaluateWith } from './celEnvironment';\nimport { TemplateSegment, hasExpressions, splitTemplate } from './interpolate';\n\n/**\n * Evaluating a split template with CEL.\n *\n * The only module that imports the evaluator, so it is the only thing a\n * dynamic import has to pull in. Nothing here decides *whether* to\n * interpolate - that is settled before the chunk is ever requested.\n */\n\n/** The evaluator's own first line, which names the cause better than we could. */\nconst messageOf = (error: unknown): string =>\n error instanceof Error ? error.message.split('\\n')[0] : String(error);\n\n/**\n * Whether a failure is the data simply not being there.\n *\n * The distinction this draws is the difference between a bug in the form and\n * a fact about the record being edited:\n *\n * - **An authoring error** is wrong however the form is filled in. A name the\n * text does not declare, a function that does not exist, a type mismatch -\n * these are reported, because someone has to fix the UI schema.\n * - **Absent data is normal.** A record without a middle name, an empty list,\n * an optional object that has not been filled in yet: the expression is\n * correct and the value is not there *at the moment*. Reporting it would\n * put a developer-facing message on the page for every half-filled form,\n * which trains people to ignore diagnostics.\n *\n * The evaluator separates the two cleanly and this is the whole basis for\n * telling them apart: reaching a key that is not present - at any depth, and\n * including an index past the end of a list - is always `No such key`, while\n * an identifier that is not in scope at all is `Unknown variable`.\n *\n * Note this is about keys *beneath* a namespace. A root that is not a\n * namespace at all is `Unknown variable` and stays an error.\n */\nconst isAbsentData = (error: unknown): boolean =>\n messageOf(error).startsWith('No such key:');\n\n/**\n * Explains the one failure whose own message explains nothing.\n *\n * A JSON object may have a property called `constructor` - it is a legal key\n * and a schema may well declare one. The evaluator cannot read such an\n * object: its type check is defeated by the shadowed `constructor`, and it\n * rejects the **whole map** with `Unsupported type: object`, so every other\n * field of that object becomes unreadable too. Measured: `__proto__`,\n * `toString`, `valueOf` and `hasOwnProperty` as data keys are all fine; only\n * `constructor` does this.\n *\n * The search runs **only after a failure**, so the common path pays nothing,\n * and it is depth-limited because it exists to name a cause rather than to\n * audit the data.\n */\nconst CONSTRUCTOR_KEY_LIMIT = 4;\n\nconst findsConstructorKey = (value: unknown, depth = 0): boolean => {\n if (\n depth > CONSTRUCTOR_KEY_LIMIT ||\n value === null ||\n typeof value !== 'object'\n ) {\n return false;\n }\n if (Object.prototype.hasOwnProperty.call(value, 'constructor')) {\n return true;\n }\n return Object.values(value as Record<string, unknown>).some((child) =>\n findsConstructorKey(child, depth + 1),\n );\n};\n\nconst explain = (error: unknown, scope: Record<string, unknown>): string => {\n const message = messageOf(error);\n if (\n message.startsWith('Unsupported type: object') &&\n findsConstructorKey(scope)\n ) {\n return `${message} - a value in scope has a property named \"constructor\", which this evaluator cannot read`;\n }\n return message;\n};\n\nexport interface TemplateResult {\n text: string;\n /** One per expression that could not be rendered. Never thrown. */\n failures: string[];\n}\n\n/**\n * A CEL value as display text.\n *\n * CEL integers are int64 and arrive as `bigint`, which `String` handles;\n * values taken straight from the form's data keep their JavaScript types.\n *\n * An object or a list has **no** sensible one-line form, so it is refused\n * rather than rendered: `[object Object]` in the middle of a sentence is\n * worse than a diagnostic, because it looks like data and is not.\n */\nconst display = (value: unknown): { text: string; failure?: string } => {\n if (value === null || value === undefined) {\n /*\n Empty, and silent. By the time a value reaches the text its absence is\n a fact about the data rather than a mistake in the form - an optional\n field that has not been filled in renders as nothing, which is what a\n reader expects and what a half-filled form is full of.\n */\n return { text: '' };\n }\n switch (typeof value) {\n case 'string':\n return { text: value };\n case 'number':\n case 'bigint':\n case 'boolean':\n return { text: String(value) };\n default:\n return {\n text: '',\n failure: `resolved to a ${\n Array.isArray(value) ? 'list' : 'structure'\n }, which has no text form`,\n };\n }\n};\n\n/**\n * Renders the segments, substituting each expression's value.\n *\n * `escape` is applied to **substituted values only**, never to the literal\n * segments. That distinction is the whole security property when the result\n * is about to be parsed as Markdown: a value containing\n * `[click](javascript:alert(1))` has to render as those characters, while the\n * author's own `**bold**` in the surrounding literal must still work.\n * Escaping the finished string would break the second; escaping nothing would\n * break the first. It is also why the template is split into segments rather\n * than evaluated with a regex replace.\n *\n * An expression that throws does not take the label down: it contributes\n * empty text and a failure, and the caller decides what to show.\n */\nexport const renderTemplate = (\n segments: TemplateSegment[],\n scope: Record<string, unknown>,\n escape: (text: string) => string = (text) => text,\n locale?: string,\n translate?: Translate,\n): TemplateResult => {\n const failures: string[] = [];\n let text = '';\n for (const segment of segments) {\n if (segment.kind === 'literal') {\n text += segment.text;\n continue;\n }\n try {\n const { text: rendered, failure } = display(\n evaluateWith(segment.source, scope, locale, translate),\n );\n if (failure) {\n failures.push(`${segment.source.trim()} ${failure}`);\n }\n text += escape(rendered);\n } catch (error) {\n /*\n Absent data contributes empty text and nothing else; anything else is\n an authoring error, and the evaluator's own message names the cause\n better than this layer could. It is developer-facing text, reported\n beside the label rather than thrown.\n */\n if (!isAbsentData(error)) {\n failures.push(`${segment.source.trim()}: ${explain(error, scope)}`);\n }\n }\n }\n return { text, failures };\n};\n\n/**\n * Resolves the declared `textParams` against the namespaces.\n *\n * This is the **only** place the form's data is read. A parameter's value is\n * the right-hand side of a declaration in the UI schema, which is where\n * knowledge of the data model belongs; the text it feeds knows only the\n * parameter's name, which is what makes that text translatable.\n *\n * A value is treated as a template, so the same grammar applies one level\n * down: `\"Atlas\"` is a literal, `\"{data.plan}\"` resolves, and\n * `\"Plan {data.plan}\"` does both. A non-string value - a number, a boolean,\n * an object to navigate with `{user.name}` - passes through untouched.\n *\n * Parameters see the namespaces and **not each other**. Allowing one to\n * reference another would need an evaluation order and a cycle check, for a\n * capability that an extra parameter already covers.\n *\n * Values are not escaped here. Escaping belongs to the moment a value is\n * substituted into the text, because that is the string a parser will see.\n */\nexport const resolveTextParams = (\n raw: Record<string, unknown> | undefined,\n namespaceScope: Record<string, unknown>,\n locale?: string,\n translate?: Translate,\n): { params: Record<string, unknown>; failures: string[] } => {\n const params: Record<string, unknown> = {};\n const failures: string[] = [];\n for (const [name, value] of Object.entries(raw ?? {})) {\n if (typeof value !== 'string') {\n params[name] = value;\n continue;\n }\n const segments = splitTemplate(value);\n if (!hasExpressions(segments)) {\n /*\n A literal, but still run through the split so the grammar's brace\n escaping applies: `{{x}}` is the literal `{x}` here exactly as it is\n in the text.\n */\n params[name] = segments\n .map((segment) => (segment.kind === 'literal' ? segment.text : ''))\n .join('');\n continue;\n }\n /*\n A value that is exactly one expression keeps the expression's own type,\n so `{data.seats}` stays a number and a comparison against it in the text\n still works. Anything else is string concatenation.\n */\n if (segments.length === 1 && segments[0].kind === 'expression') {\n try {\n params[name] = evaluateWith(\n segments[0].source,\n namespaceScope,\n locale,\n translate,\n );\n } catch (error) {\n if (!isAbsentData(error)) {\n failures.push(`${name}: ${explain(error, namespaceScope)}`);\n }\n /*\n Empty either way. Where it was an authoring error the cause has just\n been reported at the level it happened, and leaving the name\n unresolved would make the text report it again - one problem, one\n diagnostic. Where the data was simply absent there is nothing to\n report and nothing to show.\n */\n params[name] = '';\n }\n continue;\n }\n const rendered = renderTemplate(\n segments,\n namespaceScope,\n undefined,\n locale,\n translate,\n );\n for (const failure of rendered.failures) {\n failures.push(`${name}: ${failure}`);\n }\n params[name] = rendered.text;\n }\n return { params, failures };\n};\n"],"mappings":";;;;;;;;;;A,GA8CMM,IAAY,uBACZC,IAAY,kCAQZC,KAAa,MAA4B;CAK7C,IAAIC,aAAiB,MACnB,OAAO,EAAE,MAAMA,EAAM;CAEvB,IAAMC,IAAO,OAAOD,CAAK,GACnBE,KAAS,GAAa,MAA+B;EACzD,IAAMC,IAAO,IAAI,KAAKC,CAAG;EACzB,IAAI,OAAO,MAAMD,EAAK,QAAQ,CAAC,GAC7B,MAAU,MAAM,eAAeF,GAAM;EAEvC,OAAO;GAAE;GAAM;EAAS;CAC1B;CAQA,OAPIJ,EAAU,KAAKI,CAAI,IACdC,EAAM,GAAGD,EAAK,aAAaI,CAAG,IAEnCP,EAAU,KAAKG,CAAI,IAEdC,EAAM,cAAcD,EAAK,IAAII,CAAG,IAElCH,EAAMD,CAAI;AACnB,GAEMI,IAAM,OAGNC,KAAa,MACjB,OAAON,KAA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AE,CAAC,QACZQ,GACA9C,GACAgB,CACF;GACF,SAASJ,GAAO;IAWd,AAVKiB,EAAajB,CAAK,KACrBwB,EAAS,KAAK,GAAGnD,EAAK,IAAIgD,EAAQrB,GAAOkC,CAAc,GAAG,GAS5D,EAAO7D,KAAQ;GACjB;GACA;EACF;EACA,IAAMsD,IAAWb,EACfY,GACAQ,GACA,KAAA,GACA9C,GACAgB,CACF;EACA,KAAK,IAAMwB,KAAWD,EAAS,UAC7B,EAAS,KAAK,GAAGtD,EAAK,IAAIuD,GAAS;EAErC,EAAOvD,KAAQsD,EAAS;CAC1B;CACA,OAAO;EAAE;EAAQ;CAAS;AAC5B"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * Custom hook that only re-renders when accessed properties change.
4
+ * Supports special proxies: objects, arrays, or { _value: primitive }.
5
+ */
6
+ export declare function useTrackedSnapshot(proxy: any): any;
7
+ export default function DynamicJSXRenderer({ jsxTemplate, props, urlPolicy, }: any): React.JSX.Element;
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { JsonFormsInitStateProps } from '@jsonforms/react';
3
+ import type { JsonFormsReactProps } from '@jsonforms/react';
4
+ import { AdditionalErrorStore } from '../util/additionalErrors';
5
+ import { HandleAction } from '../util/actionContext';
6
+ export declare const canonicalUiOptions: <T>(value: T) => T;
7
+ /**
8
+ * `<JsonForms>` with this renderer set's integration already wired.
9
+ *
10
+ * The React counterpart of the Vue 2 `ResolvedJsonForms`, and it exists for
11
+ * the same reason: the extended renderers need things a bare `<JsonForms>`
12
+ * does not provide, and an application should not have to know what they are.
13
+ *
14
+ * | | Without this |
15
+ * | --- | --- |
16
+ * | The additional-error store | Two props that are only useful together, plus a provider |
17
+ * | The action handler | A `HandleActionContext.Provider` around the form, or every `Button` is a no-op |
18
+ *
19
+ * ```tsx
20
+ * <ExtendedJsonForms schema={schema} uischema={uischema} data={data}
21
+ * renderers={renderers} cells={cells} onChange={onChange} />
22
+ * ```
23
+ *
24
+ * A form using the Monaco control with `propagateErrors` and a plain
25
+ * `<JsonForms>` publishes into nothing. It now says so - `additionalErrors.noStore`
26
+ * - rather than going quiet, but this is the fix rather than the warning.
27
+ *
28
+ * **Bring your own store** when the application needs to publish too, which is
29
+ * the ordinary case for server-side validation:
30
+ *
31
+ * ```tsx
32
+ * const store = useRef(createAdditionalErrorStore()).current;
33
+ *
34
+ * <ExtendedJsonForms store={store} … />
35
+ *
36
+ * // after a rejected submit
37
+ * store.publish('server', response.validationErrors);
38
+ * ```
39
+ *
40
+ * ## What it deliberately does not do
41
+ *
42
+ * **Resolve `$ref`.** The Vue 2 wrapper does, and it is tempting to copy, but
43
+ * the two cases are not the same:
44
+ *
45
+ * - A **local** `$ref` - `#/$defs/x`, `#/definitions/x` - already works.
46
+ * JSON Forms resolves it while rendering and Ajv while validating; verified
47
+ * against both spellings.
48
+ * - A **remote** one, or a `schemaUrl`, does not. Resolving it is asynchronous,
49
+ * so a wrapper that did it would have to hold the form unmounted while it
50
+ * fetched, and would own a loading and a failure state.
51
+ *
52
+ * That is a different component with a different lifecycle, and putting it
53
+ * here would make every form pay a mount delay for a capability most do not
54
+ * use. If remote schemas are needed, they belong in a `ResolvedJsonForms` of
55
+ * their own, wrapping this.
56
+ */
57
+ export interface ExtendedJsonFormsProps extends JsonFormsInitStateProps, JsonFormsReactProps {
58
+ /**
59
+ * A store the application also publishes into.
60
+ *
61
+ * Absent, an enclosing `AdditionalErrorStoreProvider` is used if there is
62
+ * one - it can only have been put there deliberately - and otherwise a store
63
+ * is created for this form. Several forms under one provider therefore share
64
+ * a store, which is the host's decision to make and means they see each
65
+ * other's published errors.
66
+ */
67
+ store?: AdditionalErrorStore;
68
+ /** Host-owned immutable values, independent of overlay activation. */
69
+ external?: Readonly<Record<string, unknown>>;
70
+ /**
71
+ * What a `Button` hands its command to.
72
+ *
73
+ * Absent, an enclosing `HandleActionContext` is left in place rather than
74
+ * shadowed with `undefined` - so a container that provides one for several
75
+ * forms keeps working, and only a host that actually passes a handler
76
+ * replaces it.
77
+ */
78
+ onAction?: HandleAction;
79
+ }
80
+ export declare const ExtendedJsonForms: ({ external, store, onAction, ajv, data, schema, uischema, renderers, cells, config, uischemas, readonly, validationMode, i18n, additionalErrors, middleware, onChange, }: ExtendedJsonFormsProps) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { type AdditionalPropertiesProps } from '@chobantonov/jsonforms-react-renderer-common/objects/useAdditionalPropertyEntries';
2
+ import React from 'react';
3
+ export type GenericAdditionalPropertiesProps = Omit<AdditionalPropertiesProps, 'embedded'>;
4
+ export declare const GenericAdditionalProperties: ({ cells, config, data, enabled, handleChange, label, path, readonly, renderers, rootSchema, schema, uischema, }: GenericAdditionalPropertiesProps) => React.JSX.Element | null;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { TemplateSegment } from '../util/interpolate';
3
+ import type { TemplateResult } from '../util/celTemplate';
4
+ /**
5
+ * Resolves a split template, loading the evaluator only if there is one to
6
+ * resolve.
7
+ *
8
+ * The chunk boundary is the point of this component. A label that asks for
9
+ * interpolation but whose text contains no placeholder never requests the
10
+ * evaluator, because the split has already happened - see `interpolate.ts`,
11
+ * which is deliberately free of any CEL import so that the decision can be
12
+ * made before the chunk is.
13
+ *
14
+ * Children are a render prop rather than an element, so the caller decides
15
+ * what to do with the resolved string. That is what keeps the Markdown chunk
16
+ * independent of this one: a label that interpolates without Markdown never
17
+ * touches the parser, and one that does both loads two chunks rather than a
18
+ * combined one.
19
+ */
20
+ export interface InterpolatedTextProps {
21
+ segments: TemplateSegment[];
22
+ /** Declared parameters, unresolved: their values may be expressions. */
23
+ textParams?: Record<string, unknown>;
24
+ /** What a parameter's value may see - the namespaces, subject to the gate. */
25
+ namespaceScope: Record<string, unknown>;
26
+ locale?: string;
27
+ /** The form's translator, so an expression can look a key up (§9). */
28
+ translate?: (key: string, defaultMessage?: string) => string | undefined;
29
+ escape?: (text: string) => string;
30
+ children: (result: TemplateResult) => React.ReactNode;
31
+ /** The unresolved text, shown while the chunk is in flight or if it fails. */
32
+ fallback: string;
33
+ }
34
+ export declare const InterpolatedText: ({ segments, textParams, namespaceScope, locale, translate, escape, children, fallback, }: InterpolatedTextProps) => React.JSX.Element;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { UrlPolicy } from '../util/urlPolicy';
3
+ /**
4
+ * The Ractive template profile, rendered inside React.
5
+ *
6
+ * Ractive owns a DOM subtree and patches it surgically: `ractive.set('data.x',
7
+ * v)` updates the bound text nodes and nothing else. React cannot render into
8
+ * that subtree directly, so each named child is a **placeholder element** in
9
+ * the template, and React portals the delegated renderer into it.
10
+ *
11
+ * That division is what makes this worth having: a data change repaints the
12
+ * bound text without the template function re-running and without the slotted
13
+ * controls remounting, so focus, caret and local state survive.
14
+ *
15
+ * Two things this has to get right, both learned the hard way:
16
+ *
17
+ * - **Placeholders are re-reported after every update.** A placeholder inside
18
+ * `{{#if}}` or `{{#each}}` is a different DOM node after the condition
19
+ * changes, and a portal aimed at the old node renders into a detached
20
+ * element - visibly nothing. The slot list is therefore refreshed on every
21
+ * `set`, not captured once on mount.
22
+ * - **Portals are keyed by slot name**, so a child keeps its React identity
23
+ * across those refreshes and is not remounted.
24
+ */
25
+ export interface RactiveTemplateProps {
26
+ template: string;
27
+ /** Generated placeholder partials, one per named child. */
28
+ partials?: Record<string, string>;
29
+ /** Bindings the specification names: data, errors, context, elements, translate. */
30
+ data: Record<string, unknown>;
31
+ /** Delegated child renderers, by name. */
32
+ slots: Record<string, React.ReactNode>;
33
+ /** Section 12's URL policy, applied to whatever the template rendered. */
34
+ urlPolicy?: UrlPolicy;
35
+ onError?: (message: string) => void;
36
+ }
37
+ export declare const RactiveTemplate: ({ template, partials, data, slots, urlPolicy, onError, }: RactiveTemplateProps) => React.JSX.Element;
@@ -0,0 +1,139 @@
1
+ import { ControlProps, JsonSchema, UISchemaElement } from '@jsonforms/core';
2
+ import React from 'react';
3
+ import type { RowDetailState } from '@chobantonov/jsonforms-react-renderer-common/collections/rowDetail';
4
+ export type EditorControlFrameProps = React.PropsWithChildren<ControlProps>;
5
+ export type EditorActionProps = React.PropsWithChildren<{
6
+ disabled?: boolean;
7
+ onClick?: React.MouseEventHandler<any>;
8
+ title?: string;
9
+ 'aria-label'?: string;
10
+ /** Renderer sets map this onto their own button emphasis. */
11
+ variant?: 'default' | 'primary' | 'danger';
12
+ icon?: React.ReactNode;
13
+ }>;
14
+ /**
15
+ * Chrome drawn around the editor. A renderer set supplies one so the control
16
+ * matches its own text-input styling (border, radius, hover/focus/error states).
17
+ */
18
+ export type EditorSurfaceProps = React.PropsWithChildren<{
19
+ hovered?: boolean;
20
+ focused?: boolean;
21
+ disabled?: boolean;
22
+ invalid?: boolean;
23
+ maximized?: boolean;
24
+ }>;
25
+ /**
26
+ * Palette read from the host design system. Every field is optional: renderers
27
+ * fall back to neutral light-dark() defaults when a value is missing.
28
+ */
29
+ export type EditorTheme = {
30
+ isDark?: boolean;
31
+ /** Background of the surface, so the editor canvas can match it exactly. */
32
+ background?: string;
33
+ foreground?: string;
34
+ border?: string;
35
+ accent?: string;
36
+ headerBackground?: string;
37
+ headerForeground?: string;
38
+ rowHover?: string;
39
+ selectedRowBackground?: string;
40
+ fontFamily?: string;
41
+ };
42
+ /** One toolbar action, rendered by the renderer set in its own house style. */
43
+ export type EditorArrayAction = {
44
+ key: string;
45
+ /** Tooltip and accessible name. */
46
+ label: string;
47
+ icon?: React.ReactNode;
48
+ danger?: boolean;
49
+ disabled?: boolean;
50
+ onClick: () => void;
51
+ };
52
+ /**
53
+ * Chrome around an array control: title, validation indicator and toolbar
54
+ * actions. Supplying one lets the grid share the header of the renderer set's
55
+ * other array renderers instead of inventing its own.
56
+ */
57
+ export type EditorArrayFrameProps = React.PropsWithChildren<{
58
+ options?: Record<string, any>;
59
+ config?: any;
60
+ label?: string;
61
+ description?: string;
62
+ errors?: string;
63
+ actions?: EditorArrayAction[];
64
+ }>;
65
+ export type EditorRendererComponents = {
66
+ Frame: React.ComponentType<EditorControlFrameProps>;
67
+ Button: React.ComponentType<EditorActionProps>;
68
+ RowErrorIndicator?: React.ComponentType<{
69
+ message: string;
70
+ }>;
71
+ RowDetailButton?: React.ComponentType<EditorActionProps>;
72
+ /**
73
+ * Optional icons for the editor's maximize/restore toggle. When omitted the
74
+ * toggle falls back to a text label, so existing renderer sets keep working.
75
+ */
76
+ MaximizeIcon?: React.ComponentType;
77
+ MinimizeIcon?: React.ComponentType;
78
+ /** Icons for the array toolbar; omitted icons fall back to text labels. */
79
+ AddIcon?: React.ComponentType;
80
+ RemoveIcon?: React.ComponentType;
81
+ EditIcon?: React.ComponentType;
82
+ ShowDetailsIcon?: React.ComponentType;
83
+ HideDetailsIcon?: React.ComponentType;
84
+ /** Whole-row detail chrome shared with the renderer set's normal table. */
85
+ RowDetailFrame?: React.ComponentType<React.PropsWithChildren<{
86
+ state: RowDetailState;
87
+ }>>;
88
+ /** Optional chrome around the editor; defaults to an unstyled container. */
89
+ Surface?: React.ComponentType<EditorSurfaceProps>;
90
+ /** Optional chrome around array controls (title + validation + actions). */
91
+ ArrayFrame?: React.ComponentType<EditorArrayFrameProps>;
92
+ /**
93
+ * Wraps each grid cell. Renderer sets use it to put their controls into
94
+ * "cell mode" - same renderers, without the label and inline message.
95
+ */
96
+ CellFrame?: React.ComponentType<React.PropsWithChildren<{
97
+ schema?: JsonSchema;
98
+ uischema?: UISchemaElement;
99
+ path: string;
100
+ }>>;
101
+ /**
102
+ * Placeholder while the renderer's heavy dependency (Monaco, AG Grid) is
103
+ * still being fetched. Renderer sets supply their own skeleton/spinner.
104
+ */
105
+ Loading?: React.ComponentType<{
106
+ label?: string;
107
+ }>;
108
+ /** Shown when that dependency fails to load. */
109
+ LoadError?: React.ComponentType<{
110
+ label?: string;
111
+ }>;
112
+ /**
113
+ * Routes a destructive array action through the host's confirmation policy.
114
+ *
115
+ * Deliberately **policy-free**: this package is framework-agnostic and must
116
+ * not know the catalog ids, the `always`/`never`/`complex` vocabulary or the
117
+ * dialog. It says what would be discarded and what to do if the host agrees;
118
+ * the renderer set that registers this renderer supplies the rest, because
119
+ * that is where the renderer's catalog identity actually lives.
120
+ *
121
+ * Omitted, the action runs immediately - which is what every renderer set
122
+ * did before, so nothing changes for one that has not opted in.
123
+ */
124
+ useRemoveConfirmation?: () => {
125
+ request: (input: {
126
+ discarded: unknown[];
127
+ options?: Record<string, unknown>;
128
+ config?: unknown;
129
+ perform: () => void;
130
+ }) => void;
131
+ dialog?: React.ReactNode;
132
+ };
133
+ /**
134
+ * Optional hook returning the host design system's active theme (e.g. antd's
135
+ * theme algorithm). Supplying it makes the editors follow the design system
136
+ * instead of guessing from DOM background luminance.
137
+ */
138
+ useEditorTheme?: () => EditorTheme | undefined;
139
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The marker a template layout puts on a child so the JSX engine's
3
+ * `createElement` knows to render it.
4
+ *
5
+ * It lives in its own module, apart from the engine that reads it, purely so
6
+ * that importing the marker does not import the engine. `DynamicJSXRenderer`
7
+ * pulls in Sucrase at module scope; a renderer that only needed this symbol
8
+ * would otherwise drag the whole compiler into the initial bundle and defeat
9
+ * the code split around it.
10
+ *
11
+ * `Symbol.for` rather than `Symbol()`: the marker has to match across module
12
+ * instances, which a duplicated dependency or a separately bundled chunk can
13
+ * produce.
14
+ */
15
+ export declare const ElementRender: unique symbol;
@@ -0,0 +1 @@
1
+ export { resolveExtendedOption as i, JSONFORMS_EXTENDED_CONFIG_KEY as n, extendedConfig as r, JSONFORMS_CONFIG_KEY as t } from "@chobantonov/jsonforms-react-renderer-common/core/configNamespaces";
@@ -0,0 +1 @@
1
+ require("@chobantonov/jsonforms-react-renderer-common/core/configNamespaces");