@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":"AgGridControlRenderer.impl-BZS8_ocu.mjs","names":["_Fragment","_objectSpread2","renderTemplate","resolveTextParams","markdownPlainText","resolveMarkup","markdownProfile","escapeMarkdown","_objectWithoutProperties","isColumnGroup","column","resolveGridColumns","portableFields","tableColumnFields","columns","portable","mergeColumn","generated","_definition$field","definition","nativeColumns","definitions","resolvedColumns","nativeDefinitions","field","tableColumnStyle","markRequiredHeaders","_items$required","_cellOptions$definiti","_cellOptions$definiti2","items","cellOptions","hideRequiredAsterisk","_definition$headerNam","fileFilterValue","_attachmentName","resolved","schema","Resolve","rootSchema","isFileString","attachmentName","value","fileItemSchema","_attachmentName2","item","labelFilterValue","_ref","_translate","_label$text","_label$text2","_label$options","text","label","translate","markup","config","plain","params","buildNamespaceScope","dynamicValuesEnabled","locale","splitTemplate","buildTextScope","_excluded","createSummaryValue","cache","values","summaryData","summaryConfig","summaryI18n","PlainArrayFrame","actions","_action$icon","action","children","ModuleRegistry","AllCommunityModule","gridTheme","themeQuartz","createAgGridControl","Button","useHostTheme","useEditorTheme","useConfirm","useRemoveConfirmation","DetailShell","RowDetailFrame","Fragment","ArrayShell","ArrayFrame","CellShell","CellFrame","_props$uischema$optio","_detail$selection2","_detail$options2","_formContext$core","_props$uischema$optio5","_options$agGridOption","_props$uischema$optio6","_props$uischema$optio7","_detail$options3","_detail$options4","_options$height","collectionErrors","usePathErrorIndicator","props","anchor","useRef","gridApi","formContext","useJsonForms","hostTheme","confirmation","t","useExtendedTranslator","summaryDefault","useI18nDefault","useEditorAppearance","gridVars","useMemo","entries","selected","setSelected","useState","sorted","setSorted","filtered","setFiltered","addedHidden","setAddedHidden","rows","object","options","editable","detail","useRowDetail","detailRef","useLayoutEffect","useEffect","_detail$options","host","markCurrent","_detail$selection","row","observer","detailColumn","EditIcon","RowDetailButton","click","event","RowErrorCount","RowErrorIndicator","showSortButtons","summaryValue","controlSummary","_formContext$i18n$tra","_formContext$i18n","compositeSummary","summary","fallback","controlSummaryRef","summaryValueRef","_props$uischema$optio2","_props$uischema$optio3","c","_schema$title","_cellOptions$field","_fileFilterValue","data","_props$uischema$optio4","rowBound","cellSchema","cellUiSchema","cellPath","composePaths","ItemProvider","DispatchCell","agGridOptions","pagination","resolvePagination","hasDragColumn","columnDefs","_ignored","userSortChanged","userFilterChanged","userRowDragEnd","userRowClicked","userRowDataUpdated","userSuppressRowDrag","gridOptions","pendingAddedRow","addDisabled","removeDisabled","RemoveIcon","_props$uischema","remove","index","AddIcon","createDefaultValue","HideDetailsIcon","ShowDetailsIcon","open","_gridApi$current","isDark","AgGridReact","_anchor$current","node","_detail$options5","_event$event","_event$node$data$inde","_event$node$data","_event$overNode$data$","_event$overNode","from","to","next","_agGridOptions$onGrid","CollectionErrorNavigation","api"],"sources":["../src/util/gridColumns.ts","../src/util/fileFilterValue.ts","../src/util/labelFilterValue.ts","../src/renderers/AgGridControlRenderer.impl.tsx"],"sourcesContent":["import type { ColDef, ColGroupDef } from 'ag-grid-community';\nimport type { JsonSchema } from '@jsonforms/core';\nimport {\n tableColumnFields,\n tableColumnStyle,\n type TableColumnDefinition,\n} from '@chobantonov/jsonforms-react-renderer-common/collections/tableColumns';\n\ntype GridColumn = ColDef | ColGroupDef;\n\nfunction isColumnGroup(column: GridColumn): column is ColGroupDef {\n return 'children' in column && Array.isArray(column.children);\n}\n\nexport function resolveGridColumns(\n columns: ColDef[],\n portable: TableColumnDefinition[] | undefined,\n nativeDefinitions: GridColumn[] | undefined,\n items: JsonSchema | undefined,\n cellOptions: Record<string, Record<string, unknown>>,\n hideRequiredAsterisk: boolean,\n) {\n const portableFields = tableColumnFields(\n Object.fromEntries(columns.map((column) => [column.colId!, true])),\n portable,\n columns.map((column) => column.colId!),\n );\n const mergeColumn = (definition: ColDef): ColDef => {\n const generated = columns.find(\n (column) => column.colId === (definition.field ?? definition.colId),\n );\n return {\n ...generated,\n ...(definition.width !== undefined && definition.flex === undefined\n ? { flex: 0 }\n : {}),\n ...definition,\n };\n };\n // Native definitions replace the portable list as a whole, including groups\n // and computed columns. Known fields retain their JSON Forms cell editor.\n const nativeColumns = (definitions: GridColumn[]): GridColumn[] =>\n definitions.map((definition) =>\n isColumnGroup(definition)\n ? { ...definition, children: nativeColumns(definition.children) }\n : mergeColumn(definition),\n );\n const resolvedColumns: GridColumn[] =\n nativeDefinitions !== undefined\n ? nativeColumns(nativeDefinitions)\n : portableFields.map((field) => {\n const definition = portable?.find((column) => column.field === field);\n return mergeColumn({\n field,\n ...(definition?.headerName\n ? { headerName: definition.headerName }\n : {}),\n ...tableColumnStyle(definition),\n } as ColDef);\n });\n const markRequiredHeaders = (definitions: GridColumn[]) => {\n definitions.forEach((definition) => {\n if (isColumnGroup(definition)) markRequiredHeaders(definition.children);\n else if (\n definition.field !== undefined &&\n items?.required?.includes(definition.field) &&\n !(\n cellOptions?.[definition.field]?.hideRequiredAsterisk ??\n hideRequiredAsterisk\n )\n ) {\n definition.headerName = `${\n definition.headerName ?? definition.field\n } *`;\n }\n });\n };\n markRequiredHeaders(resolvedColumns);\n return resolvedColumns;\n}\n","import { JsonSchema, Resolve } from '@jsonforms/core';\nimport {\n attachmentName,\n fileItemSchema,\n isFileString,\n} from '@chobantonov/jsonforms-react-renderer-common/controls/FileArrayInput';\n\n/** Undefined means this is not a file column; nameless files have no search text. */\nexport const fileFilterValue = (\n value: unknown,\n schema: JsonSchema,\n rootSchema: JsonSchema,\n): string | undefined => {\n const resolved = schema.$ref\n ? Resolve.schema(rootSchema, schema.$ref, rootSchema)\n : schema;\n if (!resolved) return undefined;\n if (isFileString(resolved)) return attachmentName(value) ?? '';\n if (fileItemSchema(resolved, rootSchema)) {\n return Array.isArray(value)\n ? value\n .map((item) => attachmentName(item) ?? '')\n .filter(Boolean)\n .join(' ')\n : '';\n }\n return undefined;\n};\n","import {\n buildNamespaceScope,\n buildTextScope,\n dynamicValuesEnabled,\n splitTemplate,\n} from './interpolate';\nimport { renderTemplate, resolveTextParams } from './celTemplate';\nimport { markdownPlainText } from './markdown';\nimport { escapeMarkdown } from './markdownEscape';\nimport { markdownProfile, resolveMarkup } from './markup';\n\n/** Resolve the authored Label text without exposing data beyond the Label's own gates. */\nexport const labelFilterValue = (\n label: any,\n data: unknown,\n item: unknown,\n config: unknown,\n locale?: string,\n translate?: (key: string, fallback?: string) => string | undefined,\n): string => {\n const text = label.i18n\n ? (translate?.(label.i18n + '.text', label.text ?? '') ?? label.text ?? '')\n : (label.text ?? '');\n const markup = resolveMarkup(label.options, config);\n const plain = (value: string) =>\n markup.markdown ? markdownPlainText(value, markdownProfile(config)) : value;\n if (!markup.interpolate) return plain(text);\n const params = resolveTextParams(\n label.options?.textParams,\n buildNamespaceScope({\n data,\n item,\n config,\n locale,\n dynamicAllowed: dynamicValuesEnabled(config),\n }),\n locale,\n translate,\n );\n return plain(\n renderTemplate(\n splitTemplate(text),\n buildTextScope(params.params, locale),\n markup.markdown ? escapeMarkdown : undefined,\n locale,\n translate,\n ).text,\n );\n};\n","import React, {\n useLayoutEffect,\n useState,\n useRef,\n useMemo,\n useEffect,\n} from 'react';\nimport { compositeSummary } from '@chobantonov/jsonforms-react-renderer-common/cells/compositeSummary';\nimport { useI18nDefault } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport { usePathErrorIndicator } from '@chobantonov/jsonforms-react-renderer-common/validation/errorSummary';\nimport {\n CollectionErrorNavigation,\n RowErrorCount,\n} from '@chobantonov/jsonforms-react-renderer-common/collections/CollectionErrorNavigation';\nimport { ItemProvider } from '@chobantonov/jsonforms-react-renderer-common/cells/CellSummary';\nimport { resolvePagination } from '@chobantonov/jsonforms-react-renderer-common/collections/collectionPagination';\nimport { TableColumnDefinition } from '@chobantonov/jsonforms-react-renderer-common/collections/tableColumns';\nimport { useRowDetail } from '@chobantonov/jsonforms-react-renderer-common/collections/rowDetail';\nimport { useEditorAppearance } from '../util/useEditorAppearance';\nimport { useExtendedTranslator } from '../util/useExtendedTranslator';\nimport {\n composePaths,\n ControlProps,\n Resolve,\n createDefaultValue,\n JsonSchema,\n} from '@jsonforms/core';\nimport { DispatchCell, useJsonForms } from '@jsonforms/react';\nimport { resolveGridColumns } from '../util/gridColumns';\nimport { fileFilterValue } from '../util/fileFilterValue';\nimport { labelFilterValue } from '../util/labelFilterValue';\nimport {\n AllCommunityModule,\n ModuleRegistry,\n themeQuartz,\n ColDef,\n} from 'ag-grid-community';\nimport { AgGridReact } from 'ag-grid-react';\nimport {\n EditorArrayAction,\n EditorArrayFrameProps,\n EditorRendererComponents,\n} from '../components/editorRendererTypes';\n\n// A bounded cache for one set of summary bindings. Its mutation is internal to\n// this factory; the renderer only memoizes the callable it returns.\nconst createSummaryValue = (\n summaryData: unknown,\n summaryConfig: unknown,\n summaryI18n: ReturnType<typeof useJsonForms>['i18n'],\n) => {\n // The cache belongs to these bindings, not to unrelated selection renders.\n const cache = new Map<unknown, Map<unknown, string>>();\n return (label: any, item: unknown) => {\n let values = cache.get(label);\n if (!values) {\n values = new Map();\n cache.set(label, values);\n }\n if (values.has(item)) return values.get(item)!;\n const text = labelFilterValue(\n label,\n summaryData,\n item,\n summaryConfig,\n summaryI18n?.locale,\n summaryI18n?.translate,\n );\n if (values.size >= 1000) values.delete(values.keys().next().value);\n values.set(item, text);\n return text;\n };\n};\n\nconst PlainArrayFrame = ({\n label,\n actions = [],\n children,\n}: EditorArrayFrameProps) => (\n <div>\n <div\n style={{\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: 8,\n }}\n >\n <strong>{label}</strong>\n <span style={{ display: 'flex', gap: 8 }}>\n {actions.map((action) => (\n <button\n key={action.key}\n type='button'\n disabled={action.disabled}\n onClick={action.onClick}\n title={action.label}\n aria-label={action.label}\n >\n {action.icon ?? action.label}\n </button>\n ))}\n </span>\n </div>\n {children}\n </div>\n);\nModuleRegistry.registerModules([AllCommunityModule]);\n\n/**\n * Every color is a CSS variable reference with a neutral light-dark() default,\n * so a renderer set only has to set the variables on the container: light/dark\n * and design-system changes then apply as pure CSS, without rebuilding the\n * theme or recreating the grid. `browserColorScheme: 'inherit'` matters because\n * Quartz hardcodes \"light\", which would stop light-dark() following the mode.\n */\nconst gridTheme = themeQuartz.withParams({\n browserColorScheme: 'inherit',\n backgroundColor:\n 'var(--jsonforms-ag-grid-background, light-dark(#ffffff, #141414))',\n foregroundColor:\n 'var(--jsonforms-ag-grid-foreground, light-dark(#141414, #ffffffd9))',\n borderColor: 'var(--jsonforms-ag-grid-border, light-dark(#d9d9d9, #424242))',\n accentColor: 'var(--jsonforms-ag-grid-accent, light-dark(#1677ff, #1668dc))',\n headerBackgroundColor:\n 'var(--jsonforms-ag-grid-header-background, light-dark(#fafafa, #1f1f1f))',\n headerTextColor:\n 'var(--jsonforms-ag-grid-header-foreground, var(--jsonforms-ag-grid-foreground, light-dark(#141414, #ffffffd9)))',\n oddRowBackgroundColor: 'transparent',\n rowHoverColor:\n 'var(--jsonforms-ag-grid-row-hover, color-mix(in srgb, currentColor 6%, transparent))',\n selectedRowBackgroundColor:\n 'var(--jsonforms-ag-grid-selected-row-background, color-mix(in srgb, currentColor 10%, transparent))',\n fontFamily: 'var(--jsonforms-ag-grid-font-family, inherit)',\n rangeSelectionBorderStyle: 'none',\n});\n\nexport const createAgGridControl = ({\n Button,\n RowDetailButton = Button,\n RowErrorIndicator,\n EditIcon,\n ShowDetailsIcon,\n HideDetailsIcon,\n RowDetailFrame,\n AddIcon,\n RemoveIcon,\n useRemoveConfirmation,\n ArrayFrame,\n CellFrame,\n useEditorTheme,\n}: EditorRendererComponents) => {\n // Resolved once per renderer set so the hook calls below stay unconditional.\n const useHostTheme = useEditorTheme ?? (() => undefined);\n const useConfirm =\n useRemoveConfirmation ??\n (() =>\n undefined as\n | ReturnType<\n NonNullable<EditorRendererComponents['useRemoveConfirmation']>\n >\n | undefined);\n const DetailShell =\n RowDetailFrame ??\n (({ children }: React.PropsWithChildren<any>) => <>{children}</>);\n const ArrayShell = ArrayFrame ?? PlainArrayFrame;\n // Fragment would reject the identity props, so the fallback drops them.\n const CellShell =\n CellFrame ?? (({ children }: React.PropsWithChildren) => <>{children}</>);\n const AgGridControl = (props: ControlProps) => {\n const collectionErrors = usePathErrorIndicator(\n props.path,\n props.uischema.options,\n );\n const anchor = useRef<HTMLDivElement>(null);\n const gridApi = useRef<any>();\n const formContext = useJsonForms();\n const hostTheme = useHostTheme();\n const confirmation = useConfirm();\n const t = useExtendedTranslator();\n const summaryDefault = useI18nDefault();\n const { isDark } = useEditorAppearance(\n anchor,\n props.uischema.options?.theme,\n hostTheme?.isDark,\n );\n // Only variables the host actually provides are emitted; the rest fall back\n // to the light-dark() defaults baked into the theme above.\n const gridVars = useMemo(() => {\n const entries: [string, string | undefined][] = [\n ['--jsonforms-ag-grid-background', hostTheme?.background],\n ['--jsonforms-ag-grid-foreground', hostTheme?.foreground],\n ['--jsonforms-ag-grid-border', hostTheme?.border],\n ['--jsonforms-ag-grid-accent', hostTheme?.accent],\n ['--jsonforms-ag-grid-header-background', hostTheme?.headerBackground],\n ['--jsonforms-ag-grid-header-foreground', hostTheme?.headerForeground],\n ['--jsonforms-ag-grid-row-hover', hostTheme?.rowHover],\n [\n '--jsonforms-ag-grid-selected-row-background',\n hostTheme?.selectedRowBackground,\n ],\n ['--jsonforms-ag-grid-font-family', hostTheme?.fontFamily],\n ];\n return Object.fromEntries(\n entries.filter(([, value]) => Boolean(value)),\n ) as React.CSSProperties;\n }, [hostTheme]);\n const [selected, setSelected] = useState<number[]>([]);\n // Drag-to-reorder writes back by row position, so it is only meaningful\n // while what the grid shows is what the data holds. A sort or a filter\n // breaks that correspondence, so dragging is suppressed until both clear.\n const [sorted, setSorted] = useState(false);\n const [filtered, setFiltered] = useState(false);\n const [addedHidden, setAddedHidden] = useState(false);\n const rows: any[] = Array.isArray(props.data) ? props.data : [];\n const items = (\n Array.isArray(props.schema.items)\n ? props.schema.items[0]\n : props.schema.items\n ) as JsonSchema | undefined;\n const object = items?.type === 'object' || Boolean(items?.properties);\n const options = useMemo(\n () => ({ ...props.config, ...props.uischema.options }),\n [props.config, props.uischema.options],\n );\n const editable =\n props.enabled && !props.readonly && !(props.schema as any).readOnly;\n const detail = useRowDetail({\n ...props,\n schema: items ?? {},\n enabled: editable,\n });\n // Keep the action renderer stable as selection and form data change.\n const detailRef = useRef(detail);\n useLayoutEffect(() => {\n detailRef.current = detail;\n }, [detail]);\n useEffect(() => {\n const host = anchor.current;\n if (!host || !RowDetailFrame || detail.options?.presentation !== 'panel')\n return;\n const markCurrent = () => {\n host.querySelectorAll<HTMLElement>('.ag-row[row-id]').forEach((row) => {\n if (\n detail.panelOpen &&\n row.getAttribute('row-id') === String(detail.selection?.index)\n ) {\n row.setAttribute('aria-current', 'true');\n } else {\n row.removeAttribute('aria-current');\n }\n });\n };\n markCurrent();\n const observer = new MutationObserver(markCurrent);\n observer.observe(host, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['row-id'],\n });\n return () => observer.disconnect();\n }, [\n detail.panelOpen,\n detail.selection?.index,\n detail.options?.presentation,\n props.visible,\n ]);\n const detailColumn = useMemo<ColDef>(\n () => ({\n colId: '$detail',\n pinned: 'right',\n lockPinned: true,\n maxWidth: EditIcon ? 104 : 180,\n headerName: '',\n sortable: false,\n filter: false,\n resizable: false,\n suppressMovable: true,\n flex: 0,\n width: EditIcon ? 104 : 180,\n minWidth: EditIcon ? 104 : 180,\n cellRenderer: (event: { data?: { index: number } }) => (\n <span\n style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}\n >\n <RowDetailButton\n aria-label={detailRef.current.t('collection.editDetails')}\n title={detailRef.current.t('collection.editDetails')}\n icon={EditIcon ? <EditIcon /> : undefined}\n onClick={(click) => {\n click.stopPropagation();\n if (event.data) {\n detailRef.current.setPanelOpen(true);\n detailRef.current.open(event.data.index);\n }\n }}\n >\n {EditIcon\n ? undefined\n : detailRef.current.t('collection.editDetails')}\n </RowDetailButton>\n {event.data && (\n <RowErrorCount\n path={props.path}\n index={event.data.index}\n renderIndicator={\n RowErrorIndicator\n ? (message) => <RowErrorIndicator message={message} />\n : undefined\n }\n />\n )}\n </span>\n ),\n }),\n [props.path],\n );\n const showSortButtons = Boolean(options.showSortButtons);\n // `cells: { <field>: { summary, detail } }` from the uischema: how a\n // composite column summarises itself and what its detail dialog shows.\n const cellOptions = options.cells as Record<\n string,\n Record<string, unknown>\n >;\n const summaryData = formContext.core?.data;\n const summaryI18n = formContext.i18n;\n const summaryConfig = props.config;\n const summaryValue = useMemo(\n () => createSummaryValue(summaryData, summaryConfig, summaryI18n),\n [summaryData, summaryConfig, summaryI18n],\n );\n const controlSummary = (summary: any, value: unknown, schema: JsonSchema) =>\n compositeSummary(\n value,\n summary,\n schema.title,\n formContext.i18n?.translate ?? ((_key, fallback) => fallback ?? ''),\n summaryDefault,\n schema,\n );\n const controlSummaryRef = useRef(controlSummary);\n const summaryValueRef = useRef(summaryValue);\n useLayoutEffect(() => {\n controlSummaryRef.current = controlSummary;\n summaryValueRef.current = summaryValue;\n });\n const columns: ColDef[] = useMemo(\n () =>\n Object.entries(\n object\n ? {\n ...items?.properties,\n ...Object.fromEntries(\n (props.uischema.options?.columnDefs ?? [])\n .filter((c: TableColumnDefinition) => c.scope === '#')\n .map((c: TableColumnDefinition) => [c.field, items]),\n ),\n }\n : { value: items ?? {} },\n ).map(([field, schema]) => ({\n colId: field,\n headerName: schema.title ?? field,\n /*\n Cells render the renderer set's own controls rather than plain text,\n so a column gets the same editor the form would use - but only for a\n control the host registered as a **cell**. A control that exists only\n in the renderer registry is unreachable here and the column falls back\n to `TextCell`, silently. For the antd family that is what\n `antdExtendedCells` is for; a host passing bare `antdCells` sees\n colour and duration columns as text.\n\n CellShell strips the label and inline message a cell has no room for.\n */\n editable: false,\n // AG Grid uses this value for sorting and its default text filters;\n // the cell editor still binds to the original row/property below.\n valueGetter: ({ data }) => {\n const summary = cellOptions?.[field]?.summary as\n | { type?: string }\n | undefined;\n const row = data?.value;\n if (summary?.type === 'Label')\n return summaryValueRef.current(summary, row);\n const value = object ? row?.[field] : row;\n if (summary?.type === 'Control')\n return controlSummaryRef.current(summary, value, schema);\n return fileFilterValue(value, schema, props.rootSchema) ?? value;\n },\n cellRenderer: (event: { data: { index: number } }) => {\n const rowBound = props.uischema.options?.columnDefs?.some(\n (c: TableColumnDefinition) =>\n c.field === field && c.scope === '#',\n );\n const cellSchema =\n object && !rowBound\n ? (Resolve.schema(\n items as JsonSchema,\n `#/properties/${field}`,\n props.rootSchema,\n ) as JsonSchema)\n : (items as JsonSchema);\n const cellUiSchema = {\n type: 'Control' as const,\n scope: object ? `#/properties/${field}` : '#',\n label: false,\n // `cells: { <field>: { summary, detail } }` tells a composite\n // column how to summarise itself and what its dialog shows.\n options: {\n ...cellOptions?.[field],\n ...(rowBound ? { summaryOnly: true } : {}),\n },\n };\n const cellPath =\n object && !rowBound\n ? composePaths(\n composePaths(props.path, String(event.data.index)),\n field,\n )\n : composePaths(props.path, String(event.data.index));\n return (\n <ItemProvider\n path={composePaths(props.path, String(event.data.index))}\n >\n <CellShell\n schema={cellSchema}\n uischema={cellUiSchema}\n path={cellPath}\n >\n {/*\n DispatchCell, not JsonFormsDispatch: the composite (object/array)\n cell lives in the cells registry. Dispatching a renderer instead\n picks the object renderer and inlines the whole detail form in the\n cell rather than a one-line summary.\n */}\n <DispatchCell\n schema={cellSchema}\n uischema={cellUiSchema}\n path={cellPath}\n enabled={editable && !(schema as any).readOnly}\n renderers={props.renderers}\n cells={props.cells}\n />\n </CellShell>\n </ItemProvider>\n );\n },\n })),\n [\n object,\n items,\n props.rootSchema,\n props.path,\n props.renderers,\n props.cells,\n editable,\n cellOptions,\n props.uischema.options?.columnDefs,\n ],\n );\n // Let the uischema refine the generated columns: entries are matched by\n // field, and their order wins, so widths/filters can be tuned without the\n // renderer having to know about the schema.\n const agGridOptions = (options.agGridOptions ?? {}) as Record<string, any>;\n const pagination = resolvePagination(\n props.uischema.options?.pagination,\n props.config,\n 'array',\n );\n const portable = props.uischema.options?.columnDefs as\n | TableColumnDefinition[]\n | undefined;\n const resolvedColumns = resolveGridColumns(\n columns,\n portable,\n agGridOptions.columnDefs,\n items,\n cellOptions,\n options.hideRequiredAsterisk,\n );\n // `showSortButtons` is the same option the table renderer uses for its\n // per-row up/down buttons; in a grid the equivalent affordance is a drag\n // handle column. A column the uischema already marks `rowDrag` wins.\n const hasDragColumn = resolvedColumns.some(\n (column) => 'rowDrag' in column && column.rowDrag,\n );\n const columnDefs =\n editable && showSortButtons && !hasDragColumn\n ? [\n {\n colId: '$drag',\n headerName: '',\n rowDrag: true,\n sortable: false,\n filter: false,\n resizable: false,\n suppressMovable: true,\n flex: undefined,\n width: 38,\n maxWidth: 38,\n minWidth: 38,\n valueGetter: () => '',\n },\n ...resolvedColumns,\n ]\n : resolvedColumns;\n const {\n columnDefs: _ignored,\n onSortChanged: userSortChanged,\n onFilterChanged: userFilterChanged,\n onRowDragEnd: userRowDragEnd,\n onRowClicked: userRowClicked,\n onRowDataUpdated: userRowDataUpdated,\n suppressRowDrag: userSuppressRowDrag,\n ...gridOptions\n } = agGridOptions;\n const pendingAddedRow = useRef<number>();\n const addDisabled =\n !editable ||\n (options.restrict !== false &&\n props.schema.maxItems !== undefined &&\n rows.length >= props.schema.maxItems);\n const removeDisabled =\n !editable ||\n !selected.length ||\n (options.restrict !== false &&\n props.schema.minItems !== undefined &&\n rows.length - selected.length < props.schema.minItems);\n // The grid selects rows, so removal belongs in the header. Array\n // renderers without selection keep their per-row delete instead.\n let actions: EditorArrayAction[] = [\n {\n key: 'remove',\n label: t('array.removeSelected'),\n danger: true,\n disabled: removeDisabled,\n icon: RemoveIcon ? <RemoveIcon /> : undefined,\n onClick: () => {\n const remove = () => {\n props.handleChange(\n props.path,\n rows.filter((_row, index) => !selected.includes(index)),\n );\n setSelected([]);\n };\n if (!confirmation) {\n remove();\n return;\n }\n /*\n One prompt covers the whole batch, and the host decides whether\n there is one at all. Every selected row is offered as discarded, so\n a `complex` policy can ask \"does any of this matter\".\n */\n confirmation.request({\n discarded: selected.map((index) => rows[index]),\n options: props.uischema?.options as\n | Record<string, unknown>\n | undefined,\n config: props.config,\n perform: remove,\n });\n },\n },\n {\n key: 'add',\n label: t('array.addRow'),\n disabled: addDisabled,\n icon: AddIcon ? <AddIcon /> : undefined,\n onClick: () => {\n pendingAddedRow.current = rows.length;\n props.handleChange(props.path, [\n ...rows,\n createDefaultValue(items ?? {}, props.rootSchema),\n ]);\n },\n },\n ];\n if (RowDetailFrame && detail.options?.presentation === 'panel') {\n actions = [\n {\n key: 'details',\n icon:\n detail.panelOpen && HideDetailsIcon ? (\n <HideDetailsIcon />\n ) : ShowDetailsIcon ? (\n <ShowDetailsIcon />\n ) : undefined,\n label: detail.t(\n detail.panelOpen\n ? 'collection.hideDetails'\n : 'collection.showDetails',\n ),\n onClick: () => detail.setPanelOpen((open) => !open),\n },\n ...actions,\n ];\n }\n if (!props.visible) return null;\n return (\n <ArrayShell\n options={props.uischema.options}\n config={props.config}\n label={props.label}\n description={props.description}\n errors={collectionErrors}\n actions={actions}\n >\n {confirmation?.dialog}\n {addedHidden && (\n <div role='status'>\n {detail.t('collection.addedHidden')}\n <button\n type='button'\n onClick={() => {\n gridApi.current?.setFilterModel(null);\n setAddedHidden(false);\n }}\n >\n {detail.t('collection.clearFilters')}\n </button>\n </div>\n )}\n <DetailShell state={detail}>\n <div\n ref={anchor}\n data-ag-theme-mode={isDark ? 'dark' : 'light'}\n style={{\n ...gridVars,\n colorScheme: isDark ? 'dark' : 'light',\n height:\n RowDetailFrame &&\n detail.options?.presentation === 'panel' &&\n detail.panelOpen\n ? '100%'\n : (options.height ?? 400),\n minWidth: 0,\n }}\n >\n <style>{`.ag-row[aria-current=\"true\"] { background-color: var(--ag-selected-row-background-color); }`}</style>\n <AgGridReact\n theme={gridTheme}\n themeStyleContainer={() => anchor.current ?? undefined}\n rowData={rows.map((value, index) => ({ value, index }))}\n columnDefs={\n RowDetailFrame && detail.options\n ? [...columnDefs, detailColumn]\n : columnDefs\n }\n pagination={pagination.enabled}\n paginationPageSize={pagination.size}\n paginationPageSizeSelector={pagination.choices}\n {...gridOptions}\n onRowDataUpdated={(event) => {\n const index = pendingAddedRow.current;\n if (index !== undefined) {\n const node = event.api.getRowNode(String(index));\n if (node) {\n pendingAddedRow.current = undefined;\n // Use the displayed position so sorting is respected. A row\n // excluded by an active filter has no page to reveal.\n setAddedHidden(node.rowIndex == null);\n if (node.rowIndex != null) {\n event.api.paginationGoToPage(\n Math.floor(\n node.rowIndex / event.api.paginationGetPageSize(),\n ),\n );\n event.api.ensureIndexVisible(node.rowIndex);\n }\n }\n }\n userRowDataUpdated?.(event);\n }}\n defaultColDef={{\n flex: 1,\n minWidth: 120,\n sortable: true,\n filter: true,\n resizable: true,\n ...agGridOptions.defaultColDef,\n }}\n // Cells host real form controls that draw their own focus ring, so\n // the grid's cell-focus border would double up on it.\n suppressCellFocus\n rowSelection={{ mode: 'multiRow' }}\n readOnlyEdit\n getRowId={(event) => String(event.data.index)}\n suppressRowDrag={\n Boolean(userSuppressRowDrag) || !editable || sorted || filtered\n }\n onSortChanged={(event) => {\n setSorted(\n event.api\n .getColumnState()\n .some((column) => Boolean(column.sort)),\n );\n userSortChanged?.(event);\n }}\n onFilterChanged={(event) => {\n setFiltered(Object.keys(event.api.getFilterModel()).length > 0);\n userFilterChanged?.(event);\n }}\n onRowClicked={(event) => {\n if (\n RowDetailFrame &&\n detail.options?.presentation === 'panel' &&\n event.data &&\n !(\n event.event?.target instanceof Element &&\n event.event.target.closest(\n '.ag-selection-checkbox, .ag-row-drag',\n )\n )\n ) {\n detail.open(event.data.index);\n }\n userRowClicked?.(event);\n }}\n onRowDragEnd={(event) => {\n const from = event.node.data?.index ?? -1;\n const to = event.overNode?.data?.index ?? -1;\n if (\n from >= 0 &&\n to >= 0 &&\n from !== to &&\n !sorted &&\n !filtered\n ) {\n const next = rows.slice();\n next.splice(to, 0, next.splice(from, 1)[0]);\n props.handleChange(props.path, next);\n event.api.clearFocusedCell();\n }\n userRowDragEnd?.(event);\n }}\n onGridReady={(event) => {\n gridApi.current = event.api;\n agGridOptions.onGridReady?.(event);\n }}\n onSelectionChanged={(event) =>\n setSelected(event.api.getSelectedRows().map((row) => row.index))\n }\n onCellEditRequest={(event) => {\n if (!editable || event.data.index >= rows.length) return;\n const next = rows.slice();\n next[event.data.index] = object\n ? {\n ...next[event.data.index],\n [event.column.getColId()]: event.newValue,\n }\n : event.newValue;\n props.handleChange(props.path, next);\n }}\n />\n </div>\n <CollectionErrorNavigation\n options={props.uischema.options}\n renderAction={(label, onClick, icon) => (\n <Button\n icon={icon}\n title={label}\n aria-label={label}\n onClick={onClick}\n />\n )}\n path={props.path}\n reveal={(index) => {\n const api = gridApi.current;\n const node = api?.getRowNode(String(index));\n if (node?.rowIndex != null) {\n api.paginationGoToPage(\n Math.floor(node.rowIndex / api.paginationGetPageSize()),\n );\n api.ensureIndexVisible(node.rowIndex);\n }\n if (detail.options) {\n detail.setPanelOpen(true);\n detail.open(index);\n }\n }}\n />\n </DetailShell>\n </ArrayShell>\n );\n };\n return AgGridControl;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,SAASS,EAAc,GAA2C;CAChE,OAAO,cAAcC,KAAU,MAAM,QAAQA,EAAO,QAAQ;AAC9D;AAEA,SAAgBC,GACd,GACA,GACA,GACA,GACA,GACA,GACA;CACA,IAAMC,IAAiBC,EACrB,OAAO,YAAYC,EAAQ,KAAK,MAAW,CAACJ,EAAO,OAAQ,EAAI,CAAC,CAAC,GACjEK,GACAD,EAAQ,KAAK,MAAWJ,EAAO,KAAM,CACvC,GACMM,KAAe,MAA+B;EAClD,IAAMC,IAAYH,EAAQ,MACvB,MAAW;;GAAO,OAAAJ,EAAA,YAAA,IAAWS,EAAW,UAAA,OAASA,EAAW,QAApBD;EAAoB,CAC/D;EACA,OAAAjB,EAAAA,EAAAA,EAAA,CAAA,GACKgB,CAAA,GACCE,EAAW,UAAU,KAAA,KAAaA,EAAW,SAAS,KAAA,IACtD,EAAE,MAAM,EAAE,IACV,CAAC,CAAA,GACFA,CACL;CACF,GAGMC,KAAiB,MACrBC,EAAY,KAAK,MACfZ,EAAcU,CAAU,IAAAlB,EAAAA,EAAA,CAAA,GACfkB,CAAA,GAAA,CAAA,GAAA,EAAY,UAAUC,EAAcD,EAAW,QAAQ,EAAA,CAAE,IAC9DH,EAAYG,CAAU,CAC5B,GACIG,IACJC,MAAsB,KAAA,IAElBX,EAAe,KAAK,MAAU;EAC5B,IAAMO,IAAAJ,KAAA,OAAA,KAAA,IAAaA,EAAU,MAAM,MAAWL,EAAO,UAAUc,CAAK;EACpE,OAAOR,EAAAf,EAAAA,EAAA,EACL,SAAA,GAAAkB,KAAA,QACIA,EAAY,aACZ,EAAE,YAAYA,EAAW,WAAW,IACpC,CAAC,CAAA,GACFM,EAAiBN,CAAU,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ementRender-Dbp2e-Cc.js"),t=require("./jsonforms-react-extended.cjs.js"),n=require("./ajvI18n-2UTyJv5g.js");let r=require("@chobantonov/jsonforms-react-renderer-common/locale/translate"),i=require("react");i=n.u(i);let a=require("react/jsx-runtime"),o=require("valtio"),s=require("sucrase");s=n.u(s);function c(e){return e&&typeof e==`object`&&`__val__`in e?e.__val__:e}function l(e){return c((0,o.useSnapshot)(e))}var u=e=>function(t,n,...r){return d(e(),t,n,...r)};function d(r,a,o,...s){o=t.sanitizeUrlProps(a,o,r);function c(t,n){if(Array.isArray(t))return t.map((e,t)=>c(e,t));if(i.default.isValidElement(t))return t.key==null&&n!=null?i.default.cloneElement(t,{key:n}):t;if(t&&typeof t==`object`&&typeof t[e.t]==`function`){let e=l(t,t.props||{},...t.children||[]);if(!i.default.isValidElement(e))throw Error(`[ElementRender] must return a valid React element, got ${typeof e}`);return e.key==null&&n!=null?i.default.cloneElement(e,{key:n}):e}return t}function l(t,r={},...a){if(t&&typeof t==`object`&&typeof t[e.t]==`function`){let o=t[e.t](n.s(n.s({},r),{},{children:a}));if(!i.default.isValidElement(o))throw Error(`[ElementRender] must return a valid React element`);return o}return i.default.createElement(t,r,...a)}let u=s.map(c);return l(a,o,...u)}function f({error:e,template:t,availableVariables:n=[],compilation:i=!1}){let o=(0,r.useI18n)();return(0,a.jsxs)(`div`,{role:`alert`,style:{color:`red`,border:`1px solid currentColor`,padding:15,margin:10,overflowWrap:`anywhere`},children:[(0,a.jsx)(`h3`,{children:o(i?`template.compileTitle`:`template.runtimeTitle`)}),(0,a.jsxs)(`p`,{children:[(0,a.jsx)(`strong`,{children:o(`template.errorLabel`)}),` `,e instanceof Error?e.message:String(e)]}),e instanceof Error&&e.stack&&(0,a.jsxs)(`details`,{children:[(0,a.jsx)(`summary`,{children:o(`template.errorDetails`)}),(0,a.jsx)(`pre`,{children:e.stack})]}),(0,a.jsxs)(`details`,{children:[(0,a.jsx)(`summary`,{children:o(`template.source`)}),(0,a.jsx)(`pre`,{children:t})]}),(0,a.jsx)(`p`,{children:o(`template.availableVariables`,{names:n.join(`, `)||o(`template.noVariables`)})})]})}var p=class extends i.default.Component{constructor(...e){super(...e),n.c(this,`state`,{})}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,a.jsx)(f,n.s(n.s({},this.props),{},{error:this.state.error})):this.props.children}};function m({jsxTemplate:e,props:n,urlPolicy:r}){let o=r==null?t.defaultUrlPolicy:r,c=(0,i.useMemo)(()=>u(()=>o),[o]),d=(0,i.useMemo)(()=>{try{let{code:t}=s.transform(e,{transforms:[`jsx`],jsxPragma:`createElement`}),n=Function(`React`,`createElement`,`useTrackedSnapshot`,`"use strict"; ${t}; return Template;`),r=i.default.memo(function({runtimePragma:e,bindings:t}){return(0,i.useMemo)(()=>n(i.default,e,l),[e])(t)});return r.displayName=`SafeTemplate`,r}catch(t){console.error(`JSX compile error:`,t);let n=i.default.memo(({bindings:n})=>(0,a.jsx)(f,{error:t,template:e,availableVariables:Object.keys(n),compilation:!0}));return n.displayName=`TemplateCompileError`,n}},[e]);return(0,a.jsx)(p,{template:e,availableVariables:Object.keys(n),children:(0,a.jsx)(d,{runtimePragma:c,bindings:n})})}exports.default=m,exports.useTrackedSnapshot=l;
2
+ //# sourceMappingURL=DynamicJSXRenderer-Cyw40Kz0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DynamicJSXRenderer-Cyw40Kz0.js","names":["useSnapshot","sanitizeUrlProps","React","ElementRender","useI18n","defaultUrlPolicy","useMemo","Sucrase","require_elementRender","require_jsonforms_react_extended","require_ajvI18n","_chobantonov_jsonforms_react_renderer_common_locale_translate","react","react_jsx_runtime","valtio","sucrase","unwrapSafeProxy","proxyObj","useTrackedSnapshot","proxy","makeCreateElement","children","createElementWithPolicy","getPolicy","type","props","policy","processChild","child","c","i","fallbackKey","result","processReactType","typeChildren","reactType","elementResult","typeProps","processedChildren","TemplateDiagnostic","t","compilation","error","template","availableVariables","TemplateErrorBoundary","_args","DynamicJSXRenderer","urlPolicy","pragma","Component","jsxTemplate","fn","code","SafeTemplate","runtimePragma","bindings","err","CompileError"],"sources":["../src/components/DynamicJSXRenderer.tsx"],"sourcesContent":["import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport * as Sucrase from 'sucrase';\nimport React, { useMemo } from 'react';\n\nimport { useSnapshot } from 'valtio';\nimport { ElementRender } from './elementRender';\nimport { sanitizeUrlProps } from '../util/templateUrls';\nimport { UrlPolicy, defaultUrlPolicy } from '../util/urlPolicy';\n\n/**\n * Unwrap the proxy container for templates\n */\nfunction unwrapSafeProxy(proxyObj: any) {\n // If it's a special proxy wrapper, return the inner value\n if (proxyObj && typeof proxyObj === 'object' && '__val__' in proxyObj) {\n return proxyObj.__val__;\n }\n return proxyObj;\n}\n\n/**\n * Custom hook that only re-renders when accessed properties change.\n * Supports special proxies: objects, arrays, or { _value: primitive }.\n */\nexport function useTrackedSnapshot(proxy: any) {\n return unwrapSafeProxy(useSnapshot(proxy));\n}\n\n/**\n * Builds the JSX pragma, bound to a URL policy.\n *\n * A factory rather than a module-level \"current policy\" cell, because two\n * templates with different `config` can be on screen at once and a shared cell\n * would hand one of them the other's policy. Reading through `getPolicy` also\n * means the pragma itself stays identity-stable, so the compiled component is\n * not rebuilt - and the controls it slots are not remounted - when config\n * changes.\n */\nconst makeCreateElement = (getPolicy: () => UrlPolicy) =>\n function createElement(type: any, props: any, ...children: any[]) {\n return createElementWithPolicy(getPolicy(), type, props, ...children);\n };\n\n/**\n * Custom createElement: automatically renders objects with [ElementRender],\n * and applies the URL policy to whatever the template produced.\n */\nfunction createElementWithPolicy(\n policy: UrlPolicy,\n type: any,\n props: any,\n ...children: any[]\n) {\n /*\n Section 12's policy, applied here rather than in the engine: every element\n a template produces passes through this pragma, so an `href`, `src` or\n `srcSet` carrying `javascript:` is dropped before the element exists.\n Doing it per engine would mean doing it three times, and forgetting it\n once.\n */\n props = sanitizeUrlProps(type, props, policy) as any;\n // Recursively process children\n function processChild(child: any, fallbackKey?: string | number): any {\n if (Array.isArray(child)) {\n return child.map((c, i) => processChild(c, i));\n }\n\n if (React.isValidElement(child)) {\n // Assign key if missing\n if (child.key == null && fallbackKey != null) {\n return React.cloneElement(child, { key: fallbackKey });\n }\n return child;\n }\n\n // If child has [ElementRender], process it\n if (\n child &&\n typeof child === 'object' &&\n typeof child[ElementRender] === 'function'\n ) {\n const result = processReactType(\n child,\n child.props || {},\n ...(child.children || []),\n );\n if (!React.isValidElement(result)) {\n throw new Error(\n `[ElementRender] must return a valid React element, got ${typeof result}`,\n );\n }\n if (result.key == null && fallbackKey != null) {\n return React.cloneElement(result, { key: fallbackKey });\n }\n return result;\n }\n\n return child;\n }\n\n // Recursively process the type\n function processReactType(\n reactType: any,\n typeProps: any = {},\n ...typeChildren: any[]\n ): any {\n // If the object has ElementRender, call it\n if (\n reactType &&\n typeof reactType === 'object' &&\n typeof reactType[ElementRender] === 'function'\n ) {\n const elementResult = reactType[ElementRender]({\n ...typeProps,\n children: typeChildren,\n });\n if (!React.isValidElement(elementResult)) {\n throw new Error(`[ElementRender] must return a valid React element`);\n }\n return elementResult;\n }\n\n // Standard React element\n return React.createElement(reactType, typeProps, ...typeChildren);\n }\n\n // Process children\n const processedChildren = children.map(processChild);\n\n // Process main type\n return processReactType(type, props, ...processedChildren);\n}\n\ninterface TemplateDiagnosticProps {\n error: unknown;\n template: string;\n availableVariables?: string[];\n compilation?: boolean;\n}\n\nfunction TemplateDiagnostic({\n error,\n template,\n availableVariables = [],\n compilation = false,\n}: TemplateDiagnosticProps) {\n const t = useI18n();\n return (\n <div\n role='alert'\n style={{\n color: 'red',\n border: '1px solid currentColor',\n padding: 15,\n margin: 10,\n overflowWrap: 'anywhere',\n }}\n >\n <h3>\n {t(compilation ? 'template.compileTitle' : 'template.runtimeTitle')}\n </h3>\n <p>\n <strong>{t('template.errorLabel')}</strong>{' '}\n {error instanceof Error ? error.message : String(error)}\n </p>\n {error instanceof Error && error.stack && (\n <details>\n <summary>{t('template.errorDetails')}</summary>\n <pre>{error.stack}</pre>\n </details>\n )}\n <details>\n <summary>{t('template.source')}</summary>\n <pre>{template}</pre>\n </details>\n <p>\n {t('template.availableVariables', {\n names: availableVariables.join(', ') || t('template.noVariables'),\n })}\n </p>\n </div>\n );\n}\n\nclass TemplateErrorBoundary extends React.Component<\n React.PropsWithChildren<{ template: string; availableVariables: string[] }>,\n { error?: Error }\n> {\n state: { error?: Error } = {};\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n render() {\n return this.state.error ? (\n <TemplateDiagnostic {...this.props} error={this.state.error} />\n ) : (\n this.props.children\n );\n }\n}\n\ninterface CompiledTemplateProps {\n runtimePragma: ReturnType<typeof makeCreateElement>;\n bindings: Record<string, unknown>;\n}\n\n// Define the type for the props received by the dynamic component\nexport default function DynamicJSXRenderer({\n jsxTemplate,\n props,\n urlPolicy,\n}: any) {\n // Policy changes update the compiled template's runtime bindings without\n // replacing its component type or discarding a child's draft.\n const policy = urlPolicy ?? defaultUrlPolicy;\n const pragma = useMemo(() => makeCreateElement(() => policy), [policy]);\n // Compile once when jsxTemplate changes\n const Component = useMemo<React.ComponentType<CompiledTemplateProps>>(() => {\n try {\n // Compile JSX with the custom element pragma.\n const { code } = Sucrase.transform(jsxTemplate, {\n transforms: ['jsx'],\n jsxPragma: 'createElement',\n });\n\n // Create a new function that takes React and props as arguments\n // It must return the component \"Template\"\n // We expect the template string to define a function named Template\n // e.g. function Template(props) { return <div>Hello {props.name}</div>; }\n const fn = new Function(\n 'React',\n 'createElement',\n 'useTrackedSnapshot',\n `\"use strict\"; ${code}; return Template;`,\n );\n // The compiled component remains stable across locale and data changes.\n const SafeTemplate = React.memo(function SafeTemplate({\n runtimePragma,\n bindings,\n }: CompiledTemplateProps) {\n const RenderTemplate = useMemo(\n () => fn(React, runtimePragma, useTrackedSnapshot),\n [runtimePragma],\n );\n return RenderTemplate(bindings);\n });\n SafeTemplate.displayName = 'SafeTemplate';\n return SafeTemplate;\n } catch (err) {\n console.error('JSX compile error:', err);\n // Fallback component if compile fails\n const CompileError = React.memo<CompiledTemplateProps>(({ bindings }) => (\n <TemplateDiagnostic\n error={err}\n template={jsxTemplate}\n availableVariables={Object.keys(bindings)}\n compilation\n />\n ));\n CompileError.displayName = 'TemplateCompileError';\n return CompileError;\n }\n }, [jsxTemplate]);\n\n return (\n <TemplateErrorBoundary\n template={jsxTemplate}\n availableVariables={Object.keys(props)}\n >\n {/* eslint-disable-next-line react/static-components -- Runtime templates must be compiled; the component type is memoized until its source changes. */}\n <Component runtimePragma={pragma} bindings={props} />\n </TemplateErrorBoundary>\n );\n}\n"],"mappings":"A,iUAYA,SAASgB,EAAgB,EAAe,CAKtC,OAHIC,GAAY,OAAOA,GAAa,UAAY,YAAaA,EACpDA,EAAS,QAEXA,CACT,CAMA,SAAgBC,EAAmB,EAAY,CAC7C,OAAOF,GAAA,EAAgBhB,EAAAA,YAAAA,CAAYmB,CAAK,CAAC,CAC3C,CAYA,IAAMC,EAAqB,GACzB,SAAuB,EAAW,EAAY,GAAGC,EAAiB,CAChE,OAAOC,EAAwBC,EAAU,EAAGC,EAAMC,EAAO,GAAGJ,CAAQ,CACtE,EAMF,SAASC,EACP,EACA,EACA,EACA,GAAGD,EACH,CAQA,EAAQpB,EAAAA,iBAAiBuB,EAAMC,EAAOC,CAAM,EAE5C,SAASC,EAAa,EAAY,EAAoC,CACpE,GAAI,MAAM,QAAQC,CAAK,EACrB,OAAOA,EAAM,KAAK,EAAG,IAAMD,EAAaE,EAAGC,CAAC,CAAC,EAG/C,GAAI5B,EAAAA,QAAM,eAAe0B,CAAK,EAK5B,OAHIA,EAAM,KAAO,MAAQG,GAAe,KAC/B7B,EAAAA,QAAM,aAAa0B,EAAO,CAAE,IAAKG,CAAY,CAAC,EAEhDH,EAIT,GACEA,GACA,OAAOA,GAAU,UACjB,OAAOA,EAAMzB,EAAAA,IAAmB,WAChC,CACA,IAAM6B,EAASC,EACbL,EACAA,EAAM,OAAS,CAAC,EAChB,GAA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,CAACA,CAAM,CAAC,EAEhEwB,GAAA,EAAY5C,EAAAA,QAAAA,KAA0D,CAC1E,GAAI,CAEF,GAAM,CAAE,QAASC,EAAQ,UAAU4C,EAAa,CAC9C,WAAY,CAAC,KAAK,EAClB,UAAW,eACb,CAAC,EAMKC,EAAS,SACb,QACA,gBACA,qBACA,iBAAiBC,EAAK,mBACxB,EAEMC,EAAepD,EAAAA,QAAM,KAAK,SAAsB,CACpD,gBACA,YACwB,CAKxB,OAAA,EAJuBI,EAAAA,QAAAA,KACf8C,EAAGlD,EAAAA,QAAOqD,EAAerC,CAAkB,EACjD,CAACqC,CAAa,CAET,CAAA,CAAeC,CAAQ,CAChC,CAAC,EAED,MADA,GAAa,YAAc,eACpBF,CACT,OAASG,EAAK,CACZ,QAAQ,MAAM,qBAAsBA,CAAG,EAEvC,IAAMC,EAAexD,EAAAA,QAAM,MAA6B,CAAE,eACxD,EAAAW,EAAA,IAAA,CAAC0B,EAAD,CACE,MAAOkB,EACP,SAAUN,EACV,mBAAoB,OAAO,KAAKK,CAAQ,EACxC,YAAA,EACD,CAAA,CACF,EAED,MADA,GAAa,YAAc,uBACpBE,CACT,CACF,EAAG,CAACP,CAAW,CAAC,EAEhB,OACE,EAAAtC,EAAA,IAAA,CAACgC,EAAD,CACE,SAAUM,EACV,mBAAoB,OAAO,KAAK1B,CAAK,EAGrC,UAAA,EAAAZ,EAAA,IAAA,CAACqC,EAAD,CAAW,cAAeD,EAAQ,SAAUxB,CAAQ,CAAA,CAC/B,CAAA,CAE3B,C"}
@@ -0,0 +1,109 @@
1
+ import { t as e } from "./elementRender-y8MK9CCE.mjs";
2
+ import { defaultUrlPolicy as t, sanitizeUrlProps as n } from "./jsonforms-react-extended.esm.js";
3
+ import { c as r, s as i } from "./ajvI18n-DO8FFvx1.mjs";
4
+ import { useI18n as a } from "@chobantonov/jsonforms-react-renderer-common/locale/translate";
5
+ import o, { useMemo as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ import { useSnapshot as u } from "valtio";
8
+ import * as d from "sucrase";
9
+ // src/components/DynamicJSXRenderer.tsx
10
+ function f(e) {
11
+ return e && typeof e == "object" && "__val__" in e ? e.__val__ : e;
12
+ }
13
+ function p(e) {
14
+ return f(u(e));
15
+ }
16
+ var m = (e) => function(t, n, ...r) {
17
+ return h(e(), t, n, ...r);
18
+ };
19
+ function h(t, r, a, ...s) {
20
+ a = n(r, a, t);
21
+ function c(t, n) {
22
+ if (Array.isArray(t)) return t.map((e, t) => c(e, t));
23
+ if (o.isValidElement(t)) return t.key == null && n != null ? o.cloneElement(t, { key: n }) : t;
24
+ if (t && typeof t == "object" && typeof t[e] == "function") {
25
+ let e = l(t, t.props || {}, ...t.children || []);
26
+ if (!o.isValidElement(e)) throw Error(`[ElementRender] must return a valid React element, got ${typeof e}`);
27
+ return e.key == null && n != null ? o.cloneElement(e, { key: n }) : e;
28
+ }
29
+ return t;
30
+ }
31
+ function l(t, n = {}, ...r) {
32
+ if (t && typeof t == "object" && typeof t[e] == "function") {
33
+ let a = t[e](i(i({}, n), {}, { children: r }));
34
+ if (!o.isValidElement(a)) throw Error("[ElementRender] must return a valid React element");
35
+ return a;
36
+ }
37
+ return o.createElement(t, n, ...r);
38
+ }
39
+ let u = s.map(c);
40
+ return l(r, a, ...u);
41
+ }
42
+ function g({ error: e, template: t, availableVariables: n = [], compilation: r = !1 }) {
43
+ let i = a();
44
+ return /* @__PURE__ */ l("div", {
45
+ role: "alert",
46
+ style: {
47
+ color: "red",
48
+ border: "1px solid currentColor",
49
+ padding: 15,
50
+ margin: 10,
51
+ overflowWrap: "anywhere"
52
+ },
53
+ children: [
54
+ /* @__PURE__ */ c("h3", { children: i(r ? "template.compileTitle" : "template.runtimeTitle") }),
55
+ /* @__PURE__ */ l("p", { children: [
56
+ /* @__PURE__ */ c("strong", { children: i("template.errorLabel") }),
57
+ " ",
58
+ e instanceof Error ? e.message : String(e)
59
+ ] }),
60
+ e instanceof Error && e.stack && /* @__PURE__ */ l("details", { children: [/* @__PURE__ */ c("summary", { children: i("template.errorDetails") }), /* @__PURE__ */ c("pre", { children: e.stack })] }),
61
+ /* @__PURE__ */ l("details", { children: [/* @__PURE__ */ c("summary", { children: i("template.source") }), /* @__PURE__ */ c("pre", { children: t })] }),
62
+ /* @__PURE__ */ c("p", { children: i("template.availableVariables", { names: n.join(", ") || i("template.noVariables") }) })
63
+ ]
64
+ });
65
+ }
66
+ var _ = class extends o.Component {
67
+ constructor(...e) {
68
+ super(...e), r(this, "state", {});
69
+ }
70
+ static getDerivedStateFromError(e) {
71
+ return { error: e };
72
+ }
73
+ render() {
74
+ return this.state.error ? /* @__PURE__ */ c(g, i(i({}, this.props), {}, { error: this.state.error })) : this.props.children;
75
+ }
76
+ };
77
+ function v({ jsxTemplate: e, props: n, urlPolicy: r }) {
78
+ let i = r == null ? t : r, a = s(() => m(() => i), [i]), l = s(() => {
79
+ try {
80
+ let { code: t } = d.transform(e, {
81
+ transforms: ["jsx"],
82
+ jsxPragma: "createElement"
83
+ }), n = Function("React", "createElement", "useTrackedSnapshot", `"use strict"; ${t}; return Template;`), r = o.memo(function({ runtimePragma: e, bindings: t }) {
84
+ return s(() => n(o, e, p), [e])(t);
85
+ });
86
+ return r.displayName = "SafeTemplate", r;
87
+ } catch (t) {
88
+ console.error("JSX compile error:", t);
89
+ let n = o.memo(({ bindings: n }) => /* @__PURE__ */ c(g, {
90
+ error: t,
91
+ template: e,
92
+ availableVariables: Object.keys(n),
93
+ compilation: !0
94
+ }));
95
+ return n.displayName = "TemplateCompileError", n;
96
+ }
97
+ }, [e]);
98
+ return /* @__PURE__ */ c(_, {
99
+ template: e,
100
+ availableVariables: Object.keys(n),
101
+ children: /* @__PURE__ */ c(l, {
102
+ runtimePragma: a,
103
+ bindings: n
104
+ })
105
+ });
106
+ }
107
+ export { v as default, p as useTrackedSnapshot };
108
+
109
+ //# sourceMappingURL=DynamicJSXRenderer-DyB3ZpZV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DynamicJSXRenderer-DyB3ZpZV.mjs","names":["ElementRender","_defineProperty","_objectSpread2","React","Sucrase","unwrapSafeProxy","proxyObj","useTrackedSnapshot","useSnapshot","proxy","makeCreateElement","children","createElementWithPolicy","getPolicy","type","props","sanitizeUrlProps","policy","processChild","child","c","i","fallbackKey","result","processReactType","typeChildren","reactType","elementResult","typeProps","processedChildren","TemplateDiagnostic","t","useI18n","compilation","error","template","availableVariables","TemplateErrorBoundary","_args","DynamicJSXRenderer","urlPolicy","defaultUrlPolicy","pragma","useMemo","Component","jsxTemplate","fn","code","SafeTemplate","runtimePragma","bindings","err","CompileError"],"sources":["../src/components/DynamicJSXRenderer.tsx"],"sourcesContent":["import { useI18n } from '@chobantonov/jsonforms-react-renderer-common/locale/translate';\nimport * as Sucrase from 'sucrase';\nimport React, { useMemo } from 'react';\n\nimport { useSnapshot } from 'valtio';\nimport { ElementRender } from './elementRender';\nimport { sanitizeUrlProps } from '../util/templateUrls';\nimport { UrlPolicy, defaultUrlPolicy } from '../util/urlPolicy';\n\n/**\n * Unwrap the proxy container for templates\n */\nfunction unwrapSafeProxy(proxyObj: any) {\n // If it's a special proxy wrapper, return the inner value\n if (proxyObj && typeof proxyObj === 'object' && '__val__' in proxyObj) {\n return proxyObj.__val__;\n }\n return proxyObj;\n}\n\n/**\n * Custom hook that only re-renders when accessed properties change.\n * Supports special proxies: objects, arrays, or { _value: primitive }.\n */\nexport function useTrackedSnapshot(proxy: any) {\n return unwrapSafeProxy(useSnapshot(proxy));\n}\n\n/**\n * Builds the JSX pragma, bound to a URL policy.\n *\n * A factory rather than a module-level \"current policy\" cell, because two\n * templates with different `config` can be on screen at once and a shared cell\n * would hand one of them the other's policy. Reading through `getPolicy` also\n * means the pragma itself stays identity-stable, so the compiled component is\n * not rebuilt - and the controls it slots are not remounted - when config\n * changes.\n */\nconst makeCreateElement = (getPolicy: () => UrlPolicy) =>\n function createElement(type: any, props: any, ...children: any[]) {\n return createElementWithPolicy(getPolicy(), type, props, ...children);\n };\n\n/**\n * Custom createElement: automatically renders objects with [ElementRender],\n * and applies the URL policy to whatever the template produced.\n */\nfunction createElementWithPolicy(\n policy: UrlPolicy,\n type: any,\n props: any,\n ...children: any[]\n) {\n /*\n Section 12's policy, applied here rather than in the engine: every element\n a template produces passes through this pragma, so an `href`, `src` or\n `srcSet` carrying `javascript:` is dropped before the element exists.\n Doing it per engine would mean doing it three times, and forgetting it\n once.\n */\n props = sanitizeUrlProps(type, props, policy) as any;\n // Recursively process children\n function processChild(child: any, fallbackKey?: string | number): any {\n if (Array.isArray(child)) {\n return child.map((c, i) => processChild(c, i));\n }\n\n if (React.isValidElement(child)) {\n // Assign key if missing\n if (child.key == null && fallbackKey != null) {\n return React.cloneElement(child, { key: fallbackKey });\n }\n return child;\n }\n\n // If child has [ElementRender], process it\n if (\n child &&\n typeof child === 'object' &&\n typeof child[ElementRender] === 'function'\n ) {\n const result = processReactType(\n child,\n child.props || {},\n ...(child.children || []),\n );\n if (!React.isValidElement(result)) {\n throw new Error(\n `[ElementRender] must return a valid React element, got ${typeof result}`,\n );\n }\n if (result.key == null && fallbackKey != null) {\n return React.cloneElement(result, { key: fallbackKey });\n }\n return result;\n }\n\n return child;\n }\n\n // Recursively process the type\n function processReactType(\n reactType: any,\n typeProps: any = {},\n ...typeChildren: any[]\n ): any {\n // If the object has ElementRender, call it\n if (\n reactType &&\n typeof reactType === 'object' &&\n typeof reactType[ElementRender] === 'function'\n ) {\n const elementResult = reactType[ElementRender]({\n ...typeProps,\n children: typeChildren,\n });\n if (!React.isValidElement(elementResult)) {\n throw new Error(`[ElementRender] must return a valid React element`);\n }\n return elementResult;\n }\n\n // Standard React element\n return React.createElement(reactType, typeProps, ...typeChildren);\n }\n\n // Process children\n const processedChildren = children.map(processChild);\n\n // Process main type\n return processReactType(type, props, ...processedChildren);\n}\n\ninterface TemplateDiagnosticProps {\n error: unknown;\n template: string;\n availableVariables?: string[];\n compilation?: boolean;\n}\n\nfunction TemplateDiagnostic({\n error,\n template,\n availableVariables = [],\n compilation = false,\n}: TemplateDiagnosticProps) {\n const t = useI18n();\n return (\n <div\n role='alert'\n style={{\n color: 'red',\n border: '1px solid currentColor',\n padding: 15,\n margin: 10,\n overflowWrap: 'anywhere',\n }}\n >\n <h3>\n {t(compilation ? 'template.compileTitle' : 'template.runtimeTitle')}\n </h3>\n <p>\n <strong>{t('template.errorLabel')}</strong>{' '}\n {error instanceof Error ? error.message : String(error)}\n </p>\n {error instanceof Error && error.stack && (\n <details>\n <summary>{t('template.errorDetails')}</summary>\n <pre>{error.stack}</pre>\n </details>\n )}\n <details>\n <summary>{t('template.source')}</summary>\n <pre>{template}</pre>\n </details>\n <p>\n {t('template.availableVariables', {\n names: availableVariables.join(', ') || t('template.noVariables'),\n })}\n </p>\n </div>\n );\n}\n\nclass TemplateErrorBoundary extends React.Component<\n React.PropsWithChildren<{ template: string; availableVariables: string[] }>,\n { error?: Error }\n> {\n state: { error?: Error } = {};\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n render() {\n return this.state.error ? (\n <TemplateDiagnostic {...this.props} error={this.state.error} />\n ) : (\n this.props.children\n );\n }\n}\n\ninterface CompiledTemplateProps {\n runtimePragma: ReturnType<typeof makeCreateElement>;\n bindings: Record<string, unknown>;\n}\n\n// Define the type for the props received by the dynamic component\nexport default function DynamicJSXRenderer({\n jsxTemplate,\n props,\n urlPolicy,\n}: any) {\n // Policy changes update the compiled template's runtime bindings without\n // replacing its component type or discarding a child's draft.\n const policy = urlPolicy ?? defaultUrlPolicy;\n const pragma = useMemo(() => makeCreateElement(() => policy), [policy]);\n // Compile once when jsxTemplate changes\n const Component = useMemo<React.ComponentType<CompiledTemplateProps>>(() => {\n try {\n // Compile JSX with the custom element pragma.\n const { code } = Sucrase.transform(jsxTemplate, {\n transforms: ['jsx'],\n jsxPragma: 'createElement',\n });\n\n // Create a new function that takes React and props as arguments\n // It must return the component \"Template\"\n // We expect the template string to define a function named Template\n // e.g. function Template(props) { return <div>Hello {props.name}</div>; }\n const fn = new Function(\n 'React',\n 'createElement',\n 'useTrackedSnapshot',\n `\"use strict\"; ${code}; return Template;`,\n );\n // The compiled component remains stable across locale and data changes.\n const SafeTemplate = React.memo(function SafeTemplate({\n runtimePragma,\n bindings,\n }: CompiledTemplateProps) {\n const RenderTemplate = useMemo(\n () => fn(React, runtimePragma, useTrackedSnapshot),\n [runtimePragma],\n );\n return RenderTemplate(bindings);\n });\n SafeTemplate.displayName = 'SafeTemplate';\n return SafeTemplate;\n } catch (err) {\n console.error('JSX compile error:', err);\n // Fallback component if compile fails\n const CompileError = React.memo<CompiledTemplateProps>(({ bindings }) => (\n <TemplateDiagnostic\n error={err}\n template={jsxTemplate}\n availableVariables={Object.keys(bindings)}\n compilation\n />\n ));\n CompileError.displayName = 'TemplateCompileError';\n return CompileError;\n }\n }, [jsxTemplate]);\n\n return (\n <TemplateErrorBoundary\n template={jsxTemplate}\n availableVariables={Object.keys(props)}\n >\n {/* eslint-disable-next-line react/static-components -- Runtime templates must be compiled; the component type is memoized until its source changes. */}\n <Component runtimePragma={pragma} bindings={props} />\n </TemplateErrorBoundary>\n );\n}\n"],"mappings":";;;;;;;;;AAYA,SAASK,EAAgB,GAAe;CAKtC,OAHIC,KAAY,OAAOA,KAAa,YAAY,aAAaA,IACpDA,EAAS,UAEXA;AACT;AAMA,SAAgBC,EAAmB,GAAY;CAC7C,OAAOF,EAAgBG,EAAYC,CAAK,CAAC;AAC3C;AAYA,IAAMC,KAAqB,MACzB,SAAuB,GAAW,GAAY,GAAGC,GAAiB;CAChE,OAAOC,EAAwBC,EAAU,GAAGC,GAAMC,GAAO,GAAGJ,CAAQ;AACtE;AAMF,SAASC,EACP,GACA,GACA,GACA,GAAGD,GACH;CAQA,IAAQK,EAAiBF,GAAMC,GAAOE,CAAM;CAE5C,SAASC,EAAa,GAAY,GAAoC;EACpE,IAAI,MAAM,QAAQC,CAAK,GACrB,OAAOA,EAAM,KAAK,GAAG,MAAMD,EAAaE,GAAG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UAAUyC,GAAa;IAC9C,YAAY,CAAC,KAAK;IAClB,WAAW;GACb,CAAC,GAMKC,IAAS,SACb,SACA,iBACA,sBACA,iBAAiBC,EAAK,mBACxB,GAEMC,IAAe7C,EAAM,KAAK,SAAsB,EACpD,kBACA,eACwB;IAKxB,OAJuBwC,QACfG,EAAG3C,GAAO8C,GAAe1C,CAAkB,GACjD,CAAC0C,CAAa,CAET,CAAA,CAAeC,CAAQ;GAChC,CAAC;GAED,OADA,EAAa,cAAc,gBACpBF;EACT,SAASG,GAAK;GACZ,QAAQ,MAAM,sBAAsBA,CAAG;GAEvC,IAAMC,IAAejD,EAAM,MAA6B,EAAE,kBACxD,kBAAC2B,GAAD;IACE,OAAOqB;IACP,UAAUN;IACV,oBAAoB,OAAO,KAAKK,CAAQ;IACxC,aAAA;GACD,CAAA,CACF;GAED,OADA,EAAa,cAAc,wBACpBE;EACT;CACF,GAAG,CAACP,CAAW,CAAC;CAEhB,OACE,kBAACR,GAAD;EACE,UAAUQ;EACV,oBAAoB,OAAO,KAAK9B,CAAK;EAGrC,UAAA,kBAAC6B,GAAD;GAAW,eAAeF;GAAQ,UAAU3B;EAAQ,CAAA;CAC/B,CAAA;AAE3B"}
@@ -0,0 +1,12 @@
1
+ import { n as e } from "./markdown-C_y73Q0w.mjs";
2
+ import "react";
3
+ import { Fragment as t, jsx as n } from "react/jsx-runtime";
4
+ // src/renderers/MarkupLabelRenderer.impl.tsx
5
+ var r = ({ text: r, profile: i, urlPolicy: a, onRefusedUrl: o }) => /* @__PURE__ */ n(t, { children: e(r, {
6
+ profile: i,
7
+ urlPolicy: a,
8
+ onRefusedUrl: o
9
+ }) });
10
+ export { r as MarkdownText };
11
+
12
+ //# sourceMappingURL=MarkupLabelRenderer.impl-CWfdcUuH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkupLabelRenderer.impl-CWfdcUuH.mjs","names":["_Fragment","renderMarkdown","MarkdownText","Fragment","text"],"sources":["../src/renderers/MarkupLabelRenderer.impl.tsx"],"sourcesContent":["import React from 'react';\nimport { MarkdownProfile, renderMarkdown } from '../util/markdown';\nimport { UrlPolicy } from '../util/urlPolicy';\n\nexport interface MarkdownTextProps {\n text: string;\n profile: MarkdownProfile;\n urlPolicy: UrlPolicy;\n onRefusedUrl?: (href: string) => void;\n}\n\n/**\n * The half of the markup label that needs the parser.\n *\n * Split into its own module so `import('./MarkupLabelRenderer.impl')` gives\n * the bundler a seam: a form with no Markdown label never downloads\n * markdown-it.\n */\nexport const MarkdownText = ({\n text,\n profile,\n urlPolicy,\n onRefusedUrl,\n}: MarkdownTextProps) => (\n <>{renderMarkdown(text, { profile, urlPolicy, onRefusedUrl })}</>\n);\n"],"mappings":";;;;AAkBA,IAAaE,KAAgB,EAC3B,SACA,YACA,cACA,sBAEA,kBAAAF,GAAA,EAAA,UAAGC,EAAeG,GAAM;CAAE;CAAS;CAAW;AAAa,CAAC,EAAI,CAAA"}
@@ -0,0 +1,2 @@
1
+ const e=require("./ajvI18n-2UTyJv5g.js"),t=require("./markdown-CuqtpGVd.js");let n=require("react");n=e.u(n);let r=require("react/jsx-runtime");var i=({text:e,profile:n,urlPolicy:i,onRefusedUrl:a})=>(0,r.jsx)(r.Fragment,{children:t.n(e,{profile:n,urlPolicy:i,onRefusedUrl:a})});exports.MarkdownText=i;
2
+ //# sourceMappingURL=MarkupLabelRenderer.impl-DnuzIPQg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkupLabelRenderer.impl-DnuzIPQg.js","names":["_Fragment","renderMarkdown","require_ajvI18n","require_markdown","react","react_jsx_runtime","MarkdownText","text"],"sources":["../src/renderers/MarkupLabelRenderer.impl.tsx"],"sourcesContent":["import React from 'react';\nimport { MarkdownProfile, renderMarkdown } from '../util/markdown';\nimport { UrlPolicy } from '../util/urlPolicy';\n\nexport interface MarkdownTextProps {\n text: string;\n profile: MarkdownProfile;\n urlPolicy: UrlPolicy;\n onRefusedUrl?: (href: string) => void;\n}\n\n/**\n * The half of the markup label that needs the parser.\n *\n * Split into its own module so `import('./MarkupLabelRenderer.impl')` gives\n * the bundler a seam: a form with no Markdown label never downloads\n * markdown-it.\n */\nexport const MarkdownText = ({\n text,\n profile,\n urlPolicy,\n onRefusedUrl,\n}: MarkdownTextProps) => (\n <>{renderMarkdown(text, { profile, urlPolicy, onRefusedUrl })}</>\n);\n"],"mappings":"A,gJAkBA,IAAaM,GAAgB,CAC3B,OACA,UACA,YACA,mBAEA,EAAAD,EAAA,IAAA,CAAAL,EAAAA,SAAA,CAAA,SAAGC,EAAAA,EAAeM,EAAM,CAAE,UAAS,YAAW,cAAa,CAAC,CAAI,CAAA,E"}
@@ -0,0 +1,3 @@
1
+ const e=require("./jsonforms-react-extended.cjs.js"),t=require("./ajvI18n-2UTyJv5g.js");let n=require("@jsonforms/react"),r=require("react");r=t.u(r);let i=require("react/jsx-runtime"),a=require("@monaco-editor/react");a=t.u(a);var o=e=>{(0,r.useEffect)(()=>{var t;let n=(t=e.current)==null?void 0:t.getRootNode();if(!(n instanceof ShadowRoot))return;let r=new Map,i=()=>{for(let i of Array.from(document.head.querySelectorAll(`style, link[rel="stylesheet"]`))){var e,t;let a=(e=(t=i.getAttribute(`href`))==null?i.textContent:t)==null?``:e;if(!/monaco|\/vs\//i.test(a))continue;let o=r.get(i);if(o&&o.textContent===i.textContent&&o.getAttribute(`href`)===i.getAttribute(`href`))continue;let s=i.cloneNode(!0);o?o.replaceWith(s):n.appendChild(s),r.set(i,s)}for(let[e,t]of r)e.isConnected||(t.remove(),r.delete(e))},a=new MutationObserver(i);return a.observe(document.head,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),i(),()=>{a.disconnect(),r.forEach(e=>e.remove())}},[e])},s=({children:e,maximized:t})=>(0,i.jsx)(`div`,{style:{position:`relative`,height:t?`100%`:void 0},children:e}),c=({Frame:c,Button:l,MaximizeIcon:u,MinimizeIcon:d,Surface:f,useEditorTheme:p})=>{let ee=p==null?(()=>void 0):p,te=f==null?s:f;return s=>{var f,p,m,h,g,_,v,y;let b=(0,r.useRef)(null),x=(0,r.useRef)(null),[S,C]=(0,r.useState)(!1),[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(!1),O=(0,n.useJsonForms)(),k=t.s(t.s({},s.config),s.uischema.options),A=ee(),j=e.useExtendedTranslator(),{isDark:M,customTheme:N}=e.useEditorAppearance(b,(f=k.theme)==null?k.mode:f,A==null?void 0:A.isDark),ne=N==null?M?`vs-dark`:`vs`:N;o(b);let P=e.resolveEditorLanguage(k,(p=O.core)==null?void 0:p.data),F=P===`json`&&k.convertJson===!0,I=e.encodeEditorValue(s.data,F),[L,R]=(0,r.useState)(I),z=(0,r.useRef)(),B=(0,r.useRef)(I),[V,H]=(0,r.useState)(!1),[U,W]=(0,r.useState)(0),G=(0,r.useId)(),[K,re]=(0,r.useState)(null),q=`inmemory://jsonforms/mixed-${encodeURIComponent(G)}.json`,J=k.validateJsonSchema===!0;(0,r.useEffect)(()=>{var e,n;if(!K||!J)return;let r=K.languages.json.jsonDefaults,i=`${q}.root-schema.json`,a=`${q}.schema.json`,o=e=>Array.isArray(e)?e.map(o):!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,e===`$ref`&&typeof t==`string`&&t.startsWith(`#`)?i+t:o(t)])),c=[{uri:i,schema:t.s(t.s({},(e=O.core)==null?void 0:e.schema),{},{$id:i})},{uri:a,fileMatch:[q],schema:o(s.schema)}],l=e=>e.uri===i||e.uri===a;return r.setDiagnosticsOptions(t.s(t.s({},r.diagnosticsOptions),{},{validate:!0,schemas:[...((n=r.diagnosticsOptions.schemas)==null?[]:n).filter(e=>!l(e)),...c]})),()=>{var e;return r.setDiagnosticsOptions(t.s(t.s({},r.diagnosticsOptions),{},{schemas:((e=r.diagnosticsOptions.schemas)==null?[]:e).filter(e=>!l(e))}))}},[K,J,q,s.schema,(m=O.core)==null?void 0:m.schema]);let ie=e.resolvePropagateErrors(s.uischema.options,s.config)&&(J?V:U>0)?[e.editorSummaryError({owner:G,path:s.path,language:P,errorCount:J?1:U,message:J?j(`editor.invalidJson`):U===1?j(`editor.languageError`):j(`editor.languageErrors`).replace(`{count}`,String(U))})]:[];e.useOwnedAdditionalErrors(G,ie,{clearOnChange:!1});let Y=A==null?void 0:A.background,X=Y?{"--vscode-editor-background":Y,"--vscode-editorGutter-background":Y,"--vscode-minimap-background":Y,"--vscode-editorStickyScroll-background":Y}:void 0;if((0,r.useEffect)(()=>{J?B.current!==I&&(B.current=I,z.current!==I&&(R(I),H(!1))):E||(z.current!==I&&R(I),H(!1))},[I,P,F,E,J]),(0,r.useEffect)(()=>{let e=x.current;if(!e)return;let t=requestAnimationFrame(()=>{e.layout({width:0,height:0}),requestAnimationFrame(()=>e.layout())});return()=>cancelAnimationFrame(t)},[S]),!s.visible)return null;let Z=(h=k.monaco)==null?{}:h,ae=Z.autoGrow?Math.max((g=Z.minRows)==null?3:g,Math.min((_=Z.maxRows)==null?30:_,L.split(`
2
+ `).length)):(v=Z.rows)==null?10:v,Q=!s.enabled||s.readonly,$=j(S?`editor.restore`:`editor.maximize`);return(0,i.jsx)(c,t.s(t.s({},s),{},{errors:V?j(`editor.invalidJson`):s.errors,children:(0,i.jsx)(`div`,{ref:b,onKeyDown:e=>{e.key===`Escape`&&C(!1)},onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),onFocus:()=>D(!0),onBlur:()=>D(!1),style:S?t.s(t.s({},X),{},{position:`fixed`,inset:0,zIndex:1400,background:`rgba(0, 0, 0, 0.45)`,padding:24}):t.s(t.s({},X),{},{minWidth:0}),children:(0,i.jsxs)(te,{hovered:w,focused:E,disabled:Q,invalid:!!(V||s.errors),maximized:S,children:[(0,i.jsx)(a.default,{path:J?q:void 0,value:L,language:P,width:k.width,height:S?`100%`:(y=k.height)==null?ae*20+20:y,theme:ne,options:t.s(t.s({automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8,bottom:8}},Z.options),{},{readOnly:Q,ariaLabel:s.label||j(`editor.ariaLabel`)}),onMount:(e,t)=>{var n,r;re(t),x.current=e,k.focus&&e.focus();for(let t of(n=Z.initActions)==null?[]:n)(r=e.getAction(t))==null||r.run()},onValidate:t=>W(e.countBlockingMarkers(t)),onChange:t=>{if(Q)return;let n=t==null?``:t;R(n);let r=e.decodeEditorValue(n,F);H(!r.valid),r.valid&&(z.current=e.encodeEditorValue(r.value,F),s.handleChange(s.path,r.value))}}),(w||E||S)&&(0,i.jsx)(`div`,{style:{position:`absolute`,top:4,right:4,zIndex:1,lineHeight:0,background:Y,borderRadius:4},children:(0,i.jsxs)(l,{onClick:()=>C(e=>!e),title:$,"aria-label":$,children:[S?d&&(0,i.jsx)(d,{}):u&&(0,i.jsx)(u,{}),!u&&!d&&$]})})]})})}))}};exports.createMonacoControl=c;
3
+ //# sourceMappingURL=MonacoControlRenderer.impl-BwgLGNMK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonacoControlRenderer.impl-BwgLGNMK.js","names":["useRef","useState","useJsonForms","useExtendedTranslator","useEditorAppearance","resolveEditorLanguage","encodeEditorValue","useId","resolvePropagateErrors","editorSummaryError","Editor","countBlockingMarkers","decodeEditorValue","require_jsonforms_react_extended","require_ajvI18n","_jsonforms_react","react","react_jsx_runtime","_monaco_editor_react","useMonacoShadowStyles","_ref$current","root","ref","copies","sync","source","_ref","_source$getAttribute","content","previous","copy","observer","PlainSurface","maximized","createMonacoControl","useHostTheme","useEditorTheme","EditorSurface","Surface","_options$theme","_context$core","_context$core3","_options$monaco","_monaco$minRows","_monaco$maxRows","_monaco$rows","_options$height","anchor","editorRef","setMaximized","hovered","setHovered","focused","setFocused","context","options","props","hostTheme","t","theme","customTheme","isDark","language","convert","encoded","text","setText","lastCommitted","lastExternal","invalid","setInvalid","errorCount","setErrorCount","owner","monacoApi","setMonacoApi","modelUri","schemaValidation","_context$core2","_defaults$diagnostics","defaults","rootUri","sectionUri","rebase","value","key","child","registrations","owned","entry","_defaults$diagnostics2","summary","background","surfaceVars","editor","frame","monaco","rows","disabled","label","Frame","event","_monaco$initActions","_editor$getAction","api","action","markers","next","decoded","Button","v","MinimizeIcon","MaximizeIcon"],"sources":["../src/util/useMonacoShadowStyles.ts","../src/renderers/MonacoControlRenderer.impl.tsx"],"sourcesContent":["import { RefObject, useEffect } from 'react';\n\n// Monaco's loader inserts global styles; mirror only Monaco styles for shadow hosts.\nexport const useMonacoShadowStyles = (ref: RefObject<HTMLElement>) => {\n useEffect(() => {\n const root = ref.current?.getRootNode();\n if (!(root instanceof ShadowRoot)) return;\n const copies = new Map<Element, Element>();\n const sync = () => {\n for (const source of Array.from(\n document.head.querySelectorAll('style, link[rel=\"stylesheet\"]'),\n )) {\n const content = source.getAttribute('href') ?? source.textContent ?? '';\n if (!/monaco|\\/vs\\//i.test(content)) continue;\n const previous = copies.get(source);\n if (\n previous &&\n previous.textContent === source.textContent &&\n previous.getAttribute('href') === source.getAttribute('href')\n )\n continue;\n const copy = source.cloneNode(true) as Element;\n if (previous) previous.replaceWith(copy);\n else root.appendChild(copy);\n copies.set(source, copy);\n }\n for (const [source, copy] of copies) {\n if (!source.isConnected) {\n copy.remove();\n copies.delete(source);\n }\n }\n };\n const observer = new MutationObserver(sync);\n observer.observe(document.head, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n });\n sync();\n return () => {\n observer.disconnect();\n copies.forEach((copy) => copy.remove());\n };\n }, [ref]);\n};\n","import { useEditorAppearance } from '../util/useEditorAppearance';\nimport { useExtendedTranslator } from '../util/useExtendedTranslator';\nimport { useMonacoShadowStyles } from '../util/useMonacoShadowStyles';\nimport React, { useEffect, useId, useState, useRef } from 'react';\nimport { ControlProps } from '@jsonforms/core';\nimport { useJsonForms } from '@jsonforms/react';\nimport Editor from '@monaco-editor/react';\nimport {\n EditorRendererComponents,\n EditorSurfaceProps,\n} from '../components/editorRendererTypes';\nimport {\n decodeEditorValue,\n encodeEditorValue,\n resolveEditorLanguage,\n} from '../util/editorControls';\nimport { useOwnedAdditionalErrors } from '../util/additionalErrors';\nimport {\n EditorMarker,\n countBlockingMarkers,\n editorSummaryError,\n resolvePropagateErrors,\n} from '../util/editorDiagnostics';\n\nconst PlainSurface = ({ children, maximized }: EditorSurfaceProps) => (\n <div style={{ position: 'relative', height: maximized ? '100%' : undefined }}>\n {children}\n </div>\n);\n\nexport const createMonacoControl = ({\n Frame,\n Button,\n MaximizeIcon,\n MinimizeIcon,\n Surface,\n useEditorTheme,\n}: EditorRendererComponents) => {\n // Resolved once per renderer set so the hook call below stays unconditional.\n const useHostTheme = useEditorTheme ?? (() => undefined);\n const EditorSurface = Surface ?? PlainSurface;\n const MonacoControl = (props: ControlProps) => {\n const anchor = useRef<HTMLDivElement>(null);\n const editorRef = useRef<any>(null);\n const [maximized, setMaximized] = useState(false);\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const context = useJsonForms();\n const options = { ...props.config, ...props.uischema.options };\n const hostTheme = useHostTheme();\n const t = useExtendedTranslator();\n const { isDark, customTheme } = useEditorAppearance(\n anchor,\n options.theme ?? options.mode,\n hostTheme?.isDark,\n );\n // Monaco's own vocabulary lives here, not in the shared appearance hook.\n const theme = customTheme ?? (isDark ? 'vs-dark' : 'vs');\n useMonacoShadowStyles(anchor);\n const language = resolveEditorLanguage(options, context.core?.data);\n const convert = language === 'json' && options.convertJson === true;\n const encoded = encodeEditorValue(props.data, convert);\n const [text, setText] = useState(encoded);\n const lastCommitted = useRef<string>();\n const lastExternal = useRef(encoded);\n const [invalid, setInvalid] = useState(false);\n\n /*\n Monaco's own diagnostics, as a count.\n\n Only error-level markers: warnings, hints and informational messages\n \"stay inside Monaco; they do not contribute to the summary count or\n block form validity through this bridge.\"\n\n `onValidate` fires only for a language with a validating service - JSON,\n TypeScript, CSS and so on. For anything else the count stays zero, which\n is the honest answer: \"syntax highlighting alone does not establish that\n language validation is available.\"\n */\n const [errorCount, setErrorCount] = useState(0);\n\n /*\n One error per editor **instance**, so two editors bound to the same path\n - or an editor sitting beside a host-published error - never overwrite\n each other. `useId` is unique per mounted component and stable across\n that component's renders, which is exactly the lifetime an owner needs.\n */\n const owner = useId();\n const [monacoApi, setMonacoApi] = useState<any>(null);\n const modelUri = `inmemory://jsonforms/mixed-${encodeURIComponent(\n owner,\n )}.json`;\n const schemaValidation = options.validateJsonSchema === true;\n useEffect(() => {\n if (!monacoApi || !schemaValidation) return;\n const defaults = monacoApi.languages.json.jsonDefaults;\n const rootUri = `${modelUri}.root-schema.json`;\n const sectionUri = `${modelUri}.schema.json`;\n // Local references in the section still refer to the document schema.\n const rebase = (value: any): any => {\n if (Array.isArray(value)) return value.map(rebase);\n if (!value || typeof value !== 'object') return value;\n return Object.fromEntries(\n Object.entries(value).map(([key, child]) => [\n key,\n key === '$ref' && typeof child === 'string' && child.startsWith('#')\n ? rootUri + child\n : rebase(child),\n ]),\n );\n };\n const registrations = [\n { uri: rootUri, schema: { ...context.core?.schema, $id: rootUri } },\n {\n uri: sectionUri,\n fileMatch: [modelUri],\n schema: rebase(props.schema),\n },\n ];\n const owned = (entry: { uri: string }) =>\n entry.uri === rootUri || entry.uri === sectionUri;\n defaults.setDiagnosticsOptions({\n ...defaults.diagnosticsOptions,\n validate: true,\n schemas: [\n ...(defaults.diagnosticsOptions.schemas ?? []).filter(\n (entry) => !owned(entry),\n ),\n ...registrations,\n ],\n });\n return () =>\n defaults.setDiagnosticsOptions({\n ...defaults.diagnosticsOptions,\n schemas: (defaults.diagnosticsOptions.schemas ?? []).filter(\n (entry) => !owned(entry),\n ),\n });\n }, [\n monacoApi,\n schemaValidation,\n modelUri,\n props.schema,\n context.core?.schema,\n ]);\n const propagate = resolvePropagateErrors(\n props.uischema.options,\n props.config,\n );\n const summary =\n propagate && (schemaValidation ? invalid : errorCount > 0)\n ? [\n editorSummaryError({\n owner,\n path: props.path,\n language,\n errorCount: schemaValidation ? 1 : errorCount,\n message: schemaValidation\n ? t('editor.invalidJson')\n : errorCount === 1\n ? t('editor.languageError')\n : t('editor.languageErrors').replace(\n '{count}',\n String(errorCount),\n ),\n }),\n ]\n : [];\n /*\n Publishing an empty list is what clears it, so switching the option off,\n fixing the code, or unmounting all retract the summary through the same\n path rather than three special cases.\n */\n useOwnedAdditionalErrors(owner, summary, {\n /*\n This editor manages its own lifecycle: it republishes or retracts as\n the language service reports. The store's default - clear when the\n field's value changes - would wipe the summary on the first keystroke\n and let it reappear on the next validation pass, which reads as a\n flicker rather than as feedback.\n */\n clearOnChange: false,\n });\n\n // Match the editor canvas to the surface. Monaco >= 0.34 exposes its theme\n // colors as --vscode-* custom properties, so recoloring one instance is a\n // matter of setting them on an ancestor (custom properties inherit).\n // Deliberately NOT monaco.editor.defineTheme/setTheme: Monaco's theme\n // registry is global, so doing that would repaint every other Monaco editor\n // on the page, including ones the host application owns.\n const background = hostTheme?.background;\n const surfaceVars = background\n ? ({\n '--vscode-editor-background': background,\n '--vscode-editorGutter-background': background,\n '--vscode-minimap-background': background,\n '--vscode-editorStickyScroll-background': background,\n } as React.CSSProperties)\n : undefined;\n\n useEffect(() => {\n // Schema-validated drafts survive blur and echoes of committed data;\n // a changed external value replaces the draft even while focused.\n if (schemaValidation) {\n if (lastExternal.current !== encoded) {\n lastExternal.current = encoded;\n if (lastCommitted.current !== encoded) {\n setText(encoded);\n setInvalid(false);\n }\n }\n return;\n }\n // Other editors defer external updates until blur to avoid moving the\n // caret while typing. The schema-validation branch has already returned.\n if (focused) return;\n /* eslint-disable react/set-state-in-effect -- Synchronize the external editor only after blur; replacing this with unconditional derivation would discard invalid drafts. */\n if (lastCommitted.current !== encoded) setText(encoded);\n setInvalid(false);\n /* eslint-enable react/set-state-in-effect */\n }, [encoded, language, convert, focused, schemaValidation]);\n\n useEffect(() => {\n // Toggling maximize swaps the container between fixed and inline layout.\n // automaticLayout does not reliably catch that, leaving the editor stuck\n // at the maximized width after restoring, so re-measure once settled.\n const editor = editorRef.current;\n if (!editor) return;\n const frame = requestAnimationFrame(() => {\n editor.layout({ width: 0, height: 0 });\n requestAnimationFrame(() => editor.layout());\n });\n return () => cancelAnimationFrame(frame);\n }, [maximized]);\n\n if (!props.visible) return null;\n const monaco = options.monaco ?? {};\n const rows = monaco.autoGrow\n ? Math.max(\n monaco.minRows ?? 3,\n Math.min(monaco.maxRows ?? 30, text.split('\\n').length),\n )\n : (monaco.rows ?? 10);\n const disabled = !props.enabled || props.readonly;\n const label = maximized ? t('editor.restore') : t('editor.maximize');\n return (\n <Frame\n {...props}\n errors={invalid ? t('editor.invalidJson') : props.errors}\n >\n <div\n ref={anchor}\n onKeyDown={(event) => {\n if (event.key === 'Escape') setMaximized(false);\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n style={\n maximized\n ? {\n ...surfaceVars,\n position: 'fixed',\n inset: 0,\n zIndex: 1400,\n background: 'rgba(0, 0, 0, 0.45)',\n padding: 24,\n }\n : { ...surfaceVars, minWidth: 0 }\n }\n >\n <EditorSurface\n hovered={hovered}\n focused={focused}\n disabled={disabled}\n invalid={Boolean(invalid || props.errors)}\n maximized={maximized}\n >\n <Editor\n path={schemaValidation ? modelUri : undefined}\n value={text}\n language={language}\n width={options.width}\n height={maximized ? '100%' : (options.height ?? rows * 20 + 20)}\n theme={theme}\n options={{\n automaticLayout: true,\n minimap: { enabled: false },\n scrollBeyondLastLine: false,\n padding: { top: 8, bottom: 8 },\n ...monaco.options,\n readOnly: disabled,\n ariaLabel: props.label || t('editor.ariaLabel'),\n }}\n onMount={(editor, api) => {\n setMonacoApi(api);\n editorRef.current = editor;\n if (options.focus) editor.focus();\n for (const action of monaco.initActions ?? [])\n editor.getAction(action)?.run();\n }}\n onValidate={(markers) =>\n setErrorCount(countBlockingMarkers(markers as EditorMarker[]))\n }\n onChange={(value) => {\n if (disabled) return;\n const next = value ?? '';\n setText(next);\n const decoded = decodeEditorValue(next, convert);\n setInvalid(!decoded.valid);\n if (decoded.valid) {\n lastCommitted.current = encodeEditorValue(\n decoded.value,\n convert,\n );\n props.handleChange(props.path, decoded.value);\n }\n }}\n />\n {(hovered || focused || maximized) && (\n <div\n style={{\n position: 'absolute',\n top: 4,\n right: 4,\n zIndex: 1,\n lineHeight: 0,\n background,\n borderRadius: 4,\n }}\n >\n <Button\n onClick={() => setMaximized((v) => !v)}\n title={label}\n aria-label={label}\n >\n {maximized\n ? MinimizeIcon && <MinimizeIcon />\n : MaximizeIcon && <MaximizeIcon />}\n {!MaximizeIcon && !MinimizeIcon && label}\n </Button>\n </div>\n )}\n </EditorSurface>\n </div>\n </Frame>\n );\n };\n return MonacoControl;\n};\n"],"mappings":"A,oOAGA,IAAamB,EAAyB,GAAgC,EACpE,EAAAH,EAAA,UAAA,KAAgB,C,MACd,IAAMK,GAAA,EAAOC,EAAI,UAAA,KAAA,IAAA,GAAAF,EAAS,YAAY,EACtC,GAAI,EAAEC,aAAgB,YAAa,OACnC,IAAME,EAAS,IAAI,IACbC,MAAa,CACjB,IAAK,IAAMC,KAAU,MAAM,KACzB,SAAS,KAAK,iBAAiB,+BAA+B,CAChE,EAAG,C,QACD,IAAMG,GAAA,GAAA,EAAUH,EAAO,aAAa,MAAM,IAAA,KAAKA,EAAO,YAAZE,IAAY,KAAe,GAAfD,EACtD,GAAI,CAAC,iBAAiB,KAAKE,CAAO,EAAG,SACrC,IAAMC,EAAWN,EAAO,IAAIE,CAAM,EAClC,GACEI,GACAA,EAAS,cAAgBJ,EAAO,aAChCI,EAAS,aAAa,MAAM,IAAMJ,EAAO,aAAa,MAAM,EAE5D,SACF,IAAMK,EAAOL,EAAO,UAAU,EAAI,EAC9BI,EAAUA,EAAS,YAAYC,CAAI,EAClCT,EAAK,YAAYS,CAAI,EAC1BP,EAAO,IAAIE,EAAQK,CAAI,CACzB,CACA,IAAK,GAAM,CAACL,EAAQK,KAASP,EACtBE,EAAO,cACVK,EAAK,OAAO,EACZP,EAAO,OAAOE,CAAM,EAG1B,EACMM,EAAW,IAAI,iBAAiBP,CAAI,EAQ1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AC1B,EAAAR,EAAO,UAAUW,CAAM,IAAA,MAAAF,EAAG,IAAI,CAClC,EACA,WAAa,GACX/B,EAAc7D,EAAAA,qBAAqB+F,CAAyB,CAAC,EAE/D,SAAW,GAAU,CACnB,GAAIR,EAAU,OACd,IAAMS,EAAOvB,GAAA,KAAS,GAATA,EACblB,EAAQyC,CAAI,EACZ,IAAMC,EAAUhG,EAAAA,kBAAkB+F,EAAM5C,CAAO,EAC/CO,EAAW,CAACsC,EAAQ,KAAK,EACrBA,EAAQ,QACV,EAAc,QAAUtG,EAAAA,kBACtBsG,EAAQ,MACR7C,CACF,EACAP,EAAM,aAAaA,EAAM,KAAMoD,EAAQ,KAAK,EAEhD,CACD,CAAA,GACC1D,GAAWE,GAAWnB,KACtB,EAAAhB,EAAA,IAAA,CAAC,MAAD,CACE,MAAO,CACL,SAAU,WACV,IAAK,EACL,MAAO,EACP,OAAQ,EACR,WAAY,EACZ,aACA,aAAc,CAChB,EAEA,UAAA,EAAAA,EAAA,KAAA,CAAC4F,EAAD,CACE,YAAe5D,EAAc,GAAM,CAAC6D,CAAC,EACrC,MAAOX,EACP,aAAYA,EAHd,SAAA,CAKGlE,EACG8E,IAAgB,EAAA9F,EAAA,IAAA,CAAC8F,EAAD,CAAe,CAAA,EAC/BC,IAAgB,EAAA/F,EAAA,IAAA,CAAC+F,EAAD,CAAe,CAAA,EAClC,CAACA,GAAgB,CAACD,GAAgBZ,CAC7B,C,EACL,CAAA,CAEM,C,EACZ,CAAA,CACA,CAAA,CAAA,CAEX,CAEF,E"}
@@ -0,0 +1,186 @@
1
+ import { countBlockingMarkers as e, decodeEditorValue as t, editorSummaryError as n, encodeEditorValue as r, resolveEditorLanguage as i, resolvePropagateErrors as a, useEditorAppearance as o, useExtendedTranslator as s, useOwnedAdditionalErrors as ee } from "./jsonforms-react-extended.esm.js";
2
+ import { s as c } from "./ajvI18n-DO8FFvx1.mjs";
3
+ import { useJsonForms as te } from "@jsonforms/react";
4
+ import { useEffect as l, useId as ne, useRef as u, useState as d } from "react";
5
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
+ import re from "@monaco-editor/react";
7
+ // src/util/useMonacoShadowStyles.ts
8
+ var ie = (e) => {
9
+ l(() => {
10
+ var t;
11
+ let n = (t = e.current) == null ? void 0 : t.getRootNode();
12
+ if (!(n instanceof ShadowRoot)) return;
13
+ let r = /* @__PURE__ */ new Map(), i = () => {
14
+ for (let i of Array.from(document.head.querySelectorAll("style, link[rel=\"stylesheet\"]"))) {
15
+ var e, t;
16
+ let a = (e = (t = i.getAttribute("href")) == null ? i.textContent : t) == null ? "" : e;
17
+ if (!/monaco|\/vs\//i.test(a)) continue;
18
+ let o = r.get(i);
19
+ if (o && o.textContent === i.textContent && o.getAttribute("href") === i.getAttribute("href")) continue;
20
+ let s = i.cloneNode(!0);
21
+ o ? o.replaceWith(s) : n.appendChild(s), r.set(i, s);
22
+ }
23
+ for (let [e, t] of r) e.isConnected || (t.remove(), r.delete(e));
24
+ }, a = new MutationObserver(i);
25
+ return a.observe(document.head, {
26
+ childList: !0,
27
+ subtree: !0,
28
+ characterData: !0,
29
+ attributes: !0
30
+ }), i(), () => {
31
+ a.disconnect(), r.forEach((e) => e.remove());
32
+ };
33
+ }, [e]);
34
+ }, m = ({ children: e, maximized: t }) => /* @__PURE__ */ f("div", {
35
+ style: {
36
+ position: "relative",
37
+ height: t ? "100%" : void 0
38
+ },
39
+ children: e
40
+ }), h = ({ Frame: h, Button: ae, MaximizeIcon: g, MinimizeIcon: _, Surface: v, useEditorTheme: y }) => {
41
+ let oe = y == null ? (() => void 0) : y, se = v == null ? m : v;
42
+ return (m) => {
43
+ var v, y, ce, le, ue, b, x, S;
44
+ let C = u(null), w = u(null), [T, E] = d(!1), [D, O] = d(!1), [k, A] = d(!1), j = te(), M = c(c({}, m.config), m.uischema.options), N = oe(), P = s(), { isDark: de, customTheme: F } = o(C, (v = M.theme) == null ? M.mode : v, N == null ? void 0 : N.isDark), fe = F == null ? de ? "vs-dark" : "vs" : F;
45
+ ie(C);
46
+ let I = i(M, (y = j.core) == null ? void 0 : y.data), L = I === "json" && M.convertJson === !0, R = r(m.data, L), [z, B] = d(R), V = u(), H = u(R), [U, W] = d(!1), [G, pe] = d(0), K = ne(), [q, me] = d(null), J = `inmemory://jsonforms/mixed-${encodeURIComponent(K)}.json`, Y = M.validateJsonSchema === !0;
47
+ l(() => {
48
+ var e, t;
49
+ if (!q || !Y) return;
50
+ let n = q.languages.json.jsonDefaults, r = `${J}.root-schema.json`, i = `${J}.schema.json`, a = (e) => Array.isArray(e) ? e.map(a) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, e === "$ref" && typeof t == "string" && t.startsWith("#") ? r + t : a(t)])), o = [{
51
+ uri: r,
52
+ schema: c(c({}, (e = j.core) == null ? void 0 : e.schema), {}, { $id: r })
53
+ }, {
54
+ uri: i,
55
+ fileMatch: [J],
56
+ schema: a(m.schema)
57
+ }], s = (e) => e.uri === r || e.uri === i;
58
+ return n.setDiagnosticsOptions(c(c({}, n.diagnosticsOptions), {}, {
59
+ validate: !0,
60
+ schemas: [...((t = n.diagnosticsOptions.schemas) == null ? [] : t).filter((e) => !s(e)), ...o]
61
+ })), () => {
62
+ var e;
63
+ return n.setDiagnosticsOptions(c(c({}, n.diagnosticsOptions), {}, { schemas: ((e = n.diagnosticsOptions.schemas) == null ? [] : e).filter((e) => !s(e)) }));
64
+ };
65
+ }, [
66
+ q,
67
+ Y,
68
+ J,
69
+ m.schema,
70
+ (ce = j.core) == null ? void 0 : ce.schema
71
+ ]);
72
+ let he = a(m.uischema.options, m.config) && (Y ? U : G > 0) ? [n({
73
+ owner: K,
74
+ path: m.path,
75
+ language: I,
76
+ errorCount: Y ? 1 : G,
77
+ message: Y ? P("editor.invalidJson") : G === 1 ? P("editor.languageError") : P("editor.languageErrors").replace("{count}", String(G))
78
+ })] : [];
79
+ ee(K, he, { clearOnChange: !1 });
80
+ let X = N == null ? void 0 : N.background, ge = X ? {
81
+ "--vscode-editor-background": X,
82
+ "--vscode-editorGutter-background": X,
83
+ "--vscode-minimap-background": X,
84
+ "--vscode-editorStickyScroll-background": X
85
+ } : void 0;
86
+ if (l(() => {
87
+ Y ? H.current !== R && (H.current = R, V.current !== R && (B(R), W(!1))) : k || (V.current !== R && B(R), W(!1));
88
+ }, [
89
+ R,
90
+ I,
91
+ L,
92
+ k,
93
+ Y
94
+ ]), l(() => {
95
+ let e = w.current;
96
+ if (!e) return;
97
+ let t = requestAnimationFrame(() => {
98
+ e.layout({
99
+ width: 0,
100
+ height: 0
101
+ }), requestAnimationFrame(() => e.layout());
102
+ });
103
+ return () => cancelAnimationFrame(t);
104
+ }, [T]), !m.visible) return null;
105
+ let Z = (le = M.monaco) == null ? {} : le, _e = Z.autoGrow ? Math.max((ue = Z.minRows) == null ? 3 : ue, Math.min((b = Z.maxRows) == null ? 30 : b, z.split("\n").length)) : (x = Z.rows) == null ? 10 : x, Q = !m.enabled || m.readonly, $ = P(T ? "editor.restore" : "editor.maximize");
106
+ return /* @__PURE__ */ f(h, c(c({}, m), {}, {
107
+ errors: U ? P("editor.invalidJson") : m.errors,
108
+ children: /* @__PURE__ */ f("div", {
109
+ ref: C,
110
+ onKeyDown: (e) => {
111
+ e.key === "Escape" && E(!1);
112
+ },
113
+ onMouseEnter: () => O(!0),
114
+ onMouseLeave: () => O(!1),
115
+ onFocus: () => A(!0),
116
+ onBlur: () => A(!1),
117
+ style: T ? c(c({}, ge), {}, {
118
+ position: "fixed",
119
+ inset: 0,
120
+ zIndex: 1400,
121
+ background: "rgba(0, 0, 0, 0.45)",
122
+ padding: 24
123
+ }) : c(c({}, ge), {}, { minWidth: 0 }),
124
+ children: /* @__PURE__ */ p(se, {
125
+ hovered: D,
126
+ focused: k,
127
+ disabled: Q,
128
+ invalid: !!(U || m.errors),
129
+ maximized: T,
130
+ children: [/* @__PURE__ */ f(re, {
131
+ path: Y ? J : void 0,
132
+ value: z,
133
+ language: I,
134
+ width: M.width,
135
+ height: T ? "100%" : (S = M.height) == null ? _e * 20 + 20 : S,
136
+ theme: fe,
137
+ options: c(c({
138
+ automaticLayout: !0,
139
+ minimap: { enabled: !1 },
140
+ scrollBeyondLastLine: !1,
141
+ padding: {
142
+ top: 8,
143
+ bottom: 8
144
+ }
145
+ }, Z.options), {}, {
146
+ readOnly: Q,
147
+ ariaLabel: m.label || P("editor.ariaLabel")
148
+ }),
149
+ onMount: (e, t) => {
150
+ var n, r;
151
+ me(t), w.current = e, M.focus && e.focus();
152
+ for (let t of (n = Z.initActions) == null ? [] : n) (r = e.getAction(t)) == null || r.run();
153
+ },
154
+ onValidate: (t) => pe(e(t)),
155
+ onChange: (e) => {
156
+ if (Q) return;
157
+ let n = e == null ? "" : e;
158
+ B(n);
159
+ let i = t(n, L);
160
+ W(!i.valid), i.valid && (V.current = r(i.value, L), m.handleChange(m.path, i.value));
161
+ }
162
+ }), (D || k || T) && /* @__PURE__ */ f("div", {
163
+ style: {
164
+ position: "absolute",
165
+ top: 4,
166
+ right: 4,
167
+ zIndex: 1,
168
+ lineHeight: 0,
169
+ background: X,
170
+ borderRadius: 4
171
+ },
172
+ children: /* @__PURE__ */ p(ae, {
173
+ onClick: () => E((e) => !e),
174
+ title: $,
175
+ "aria-label": $,
176
+ children: [T ? _ && /* @__PURE__ */ f(_, {}) : g && /* @__PURE__ */ f(g, {}), !g && !_ && $]
177
+ })
178
+ })]
179
+ })
180
+ })
181
+ }));
182
+ };
183
+ };
184
+ export { h as createMonacoControl };
185
+
186
+ //# sourceMappingURL=MonacoControlRenderer.impl-CyjMHbOd.mjs.map