@flanksource/clicky-ui 0.3.18 → 0.3.20
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.
- package/dist/components/ComboboxMenu.cjs +5 -1
- package/dist/components/ComboboxMenu.cjs.map +1 -1
- package/dist/components/ComboboxMenu.d.ts.map +1 -1
- package/dist/components/ComboboxMenu.js +5 -1
- package/dist/components/ComboboxMenu.js.map +1 -1
- package/dist/components/EndpointSelector.model.cjs +96 -0
- package/dist/components/EndpointSelector.model.cjs.map +1 -0
- package/dist/components/EndpointSelector.model.d.ts +2 -0
- package/dist/components/EndpointSelector.model.d.ts.map +1 -1
- package/dist/components/EndpointSelector.model.js +96 -0
- package/dist/components/EndpointSelector.model.js.map +1 -0
- package/dist/components/ErrorWrapper.cjs +1 -1
- package/dist/components/ErrorWrapper.cjs.map +1 -1
- package/dist/components/ErrorWrapper.js +1 -1
- package/dist/components/ErrorWrapper.js.map +1 -1
- package/dist/components/FilterBar.cjs +52 -2
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.d.ts +20 -2
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +52 -2
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/JSONPathField.cjs +87 -66
- package/dist/components/JSONPathField.cjs.map +1 -1
- package/dist/components/JSONPathField.d.ts +26 -9
- package/dist/components/JSONPathField.d.ts.map +1 -1
- package/dist/components/JSONPathField.js +88 -67
- package/dist/components/JSONPathField.js.map +1 -1
- package/dist/components/JSONPathPlayground.cjs +225 -0
- package/dist/components/JSONPathPlayground.cjs.map +1 -0
- package/dist/components/JSONPathPlayground.d.ts +59 -0
- package/dist/components/JSONPathPlayground.d.ts.map +1 -0
- package/dist/components/JSONPathPlayground.js +225 -0
- package/dist/components/JSONPathPlayground.js.map +1 -0
- package/dist/components/OnePasswordSelector.cjs +178 -0
- package/dist/components/OnePasswordSelector.cjs.map +1 -0
- package/dist/components/OnePasswordSelector.d.ts +8 -0
- package/dist/components/OnePasswordSelector.d.ts.map +1 -0
- package/dist/components/OnePasswordSelector.js +178 -0
- package/dist/components/OnePasswordSelector.js.map +1 -0
- package/dist/components/OnePasswordSelector.model.cjs +31 -0
- package/dist/components/OnePasswordSelector.model.cjs.map +1 -0
- package/dist/components/OnePasswordSelector.model.d.ts +27 -0
- package/dist/components/OnePasswordSelector.model.d.ts.map +1 -0
- package/dist/components/OnePasswordSelector.model.js +31 -0
- package/dist/components/OnePasswordSelector.model.js.map +1 -0
- package/dist/components/SecretFormField.cjs +142 -0
- package/dist/components/SecretFormField.cjs.map +1 -0
- package/dist/components/SecretFormField.d.ts +9 -0
- package/dist/components/SecretFormField.d.ts.map +1 -0
- package/dist/components/SecretFormField.js +142 -0
- package/dist/components/SecretFormField.js.map +1 -0
- package/dist/components/SecretKeySelector.cjs +20 -14
- package/dist/components/SecretKeySelector.cjs.map +1 -1
- package/dist/components/SecretKeySelector.d.ts +4 -1
- package/dist/components/SecretKeySelector.d.ts.map +1 -1
- package/dist/components/SecretKeySelector.js +20 -14
- package/dist/components/SecretKeySelector.js.map +1 -1
- package/dist/components/TreePickerField.cjs +55 -29
- package/dist/components/TreePickerField.cjs.map +1 -1
- package/dist/components/TreePickerField.d.ts +10 -1
- package/dist/components/TreePickerField.d.ts.map +1 -1
- package/dist/components/TreePickerField.js +56 -30
- package/dist/components/TreePickerField.js.map +1 -1
- package/dist/components/UnitStepControls.cjs +55 -0
- package/dist/components/UnitStepControls.cjs.map +1 -0
- package/dist/components/UnitStepControls.d.ts +10 -0
- package/dist/components/UnitStepControls.d.ts.map +1 -0
- package/dist/components/UnitStepControls.js +55 -0
- package/dist/components/UnitStepControls.js.map +1 -0
- package/dist/components/combobox-types.d.ts +9 -0
- package/dist/components/combobox-types.d.ts.map +1 -1
- package/dist/components/filter-bar-utils.cjs +7 -0
- package/dist/components/filter-bar-utils.cjs.map +1 -1
- package/dist/components/filter-bar-utils.d.ts.map +1 -1
- package/dist/components/filter-bar-utils.js +7 -0
- package/dist/components/filter-bar-utils.js.map +1 -1
- package/dist/components/jotai-bindings-core.cjs.map +1 -1
- package/dist/components/jotai-bindings-core.d.ts +4 -1
- package/dist/components/jotai-bindings-core.d.ts.map +1 -1
- package/dist/components/jotai-bindings-core.js.map +1 -1
- package/dist/components/json-schema-form-accordion-array.cjs +5 -73
- package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
- package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-accordion-array.js +3 -71
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-array.cjs +6 -1
- package/dist/components/json-schema-form-array.cjs.map +1 -1
- package/dist/components/json-schema-form-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-array.js +6 -1
- package/dist/components/json-schema-form-array.js.map +1 -1
- package/dist/components/json-schema-form-cards-array.cjs +96 -0
- package/dist/components/json-schema-form-cards-array.cjs.map +1 -0
- package/dist/components/json-schema-form-cards-array.d.ts +7 -0
- package/dist/components/json-schema-form-cards-array.d.ts.map +1 -0
- package/dist/components/json-schema-form-cards-array.js +96 -0
- package/dist/components/json-schema-form-cards-array.js.map +1 -0
- package/dist/components/json-schema-form-item-row.cjs +81 -0
- package/dist/components/json-schema-form-item-row.cjs.map +1 -0
- package/dist/components/json-schema-form-item-row.d.ts +19 -0
- package/dist/components/json-schema-form-item-row.d.ts.map +1 -0
- package/dist/components/json-schema-form-item-row.js +81 -0
- package/dist/components/json-schema-form-item-row.js.map +1 -0
- package/dist/components/json-schema-form-render.cjs +4 -3
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +4 -3
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +1 -1
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.js +1 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-tone.cjs +12 -0
- package/dist/components/json-schema-form-tone.cjs.map +1 -1
- package/dist/components/json-schema-form-tone.js +12 -0
- package/dist/components/json-schema-form-tone.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +10 -1
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/jsonPathTree.cjs +189 -0
- package/dist/components/jsonPathTree.cjs.map +1 -0
- package/dist/components/jsonPathTree.d.ts +92 -0
- package/dist/components/jsonPathTree.d.ts.map +1 -0
- package/dist/components/jsonPathTree.js +189 -0
- package/dist/components/jsonPathTree.js.map +1 -0
- package/dist/components/secret-form-extension.cjs +30 -0
- package/dist/components/secret-form-extension.cjs.map +1 -0
- package/dist/components/secret-form-extension.d.ts +23 -0
- package/dist/components/secret-form-extension.d.ts.map +1 -0
- package/dist/components/secret-form-extension.js +30 -0
- package/dist/components/secret-form-extension.js.map +1 -0
- package/dist/components/unit-form-extension.cjs +126 -0
- package/dist/components/unit-form-extension.cjs.map +1 -0
- package/dist/components/unit-form-extension.d.ts +8 -0
- package/dist/components/unit-form-extension.d.ts.map +1 -0
- package/dist/components/unit-form-extension.js +126 -0
- package/dist/components/unit-form-extension.js.map +1 -0
- package/dist/components.cjs +20 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +7 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +20 -0
- package/dist/components.js.map +1 -1
- package/dist/data/TaskExecDetails.cjs +40 -0
- package/dist/data/TaskExecDetails.cjs.map +1 -0
- package/dist/data/TaskExecDetails.d.ts +5 -0
- package/dist/data/TaskExecDetails.d.ts.map +1 -0
- package/dist/data/TaskExecDetails.js +40 -0
- package/dist/data/TaskExecDetails.js.map +1 -0
- package/dist/data/TaskProgress.cjs +9 -3
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.d.ts.map +1 -1
- package/dist/data/TaskProgress.js +9 -3
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/TaskSnapshot.cjs.map +1 -1
- package/dist/data/TaskSnapshot.d.ts +12 -1
- package/dist/data/TaskSnapshot.d.ts.map +1 -1
- package/dist/data/TaskSnapshot.js.map +1 -1
- package/dist/data/TreeNode.cjs +3 -0
- package/dist/data/TreeNode.cjs.map +1 -1
- package/dist/data/TreeNode.d.ts.map +1 -1
- package/dist/data/TreeNode.js +3 -0
- package/dist/data/TreeNode.js.map +1 -1
- package/dist/data/data-table-filter-values.cjs +20 -0
- package/dist/data/data-table-filter-values.cjs.map +1 -1
- package/dist/data/data-table-filter-values.d.ts +16 -0
- package/dist/data/data-table-filter-values.d.ts.map +1 -1
- package/dist/data/data-table-filter-values.js +20 -0
- package/dist/data/data-table-filter-values.js.map +1 -1
- package/dist/data/data-table-server-filters.cjs +23 -29
- package/dist/data/data-table-server-filters.cjs.map +1 -1
- package/dist/data/data-table-server-filters.d.ts.map +1 -1
- package/dist/data/data-table-server-filters.js +21 -27
- package/dist/data/data-table-server-filters.js.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.cjs +61 -8
- package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.js +61 -8
- package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.cjs +10 -4
- package/dist/data/diagnostics/error-diagnostics.cjs.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.d.ts.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.js +10 -4
- package/dist/data/diagnostics/error-diagnostics.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +139 -161
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts +1 -71
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.editor.cjs +88 -0
- package/dist/data/query-browser/QueryBrowser.editor.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowser.editor.d.ts +12 -0
- package/dist/data/query-browser/QueryBrowser.editor.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowser.editor.js +88 -0
- package/dist/data/query-browser/QueryBrowser.editor.js.map +1 -0
- package/dist/data/query-browser/QueryBrowser.js +140 -162
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs +12 -0
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowser.types.d.ts +94 -0
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowser.types.js +12 -0
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.cjs +56 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.d.ts +5 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.js +56 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.js.map +1 -0
- package/dist/data/query-browser/QueryBrowserResults.cjs +80 -0
- package/dist/data/query-browser/QueryBrowserResults.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowserResults.d.ts +16 -0
- package/dist/data/query-browser/QueryBrowserResults.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowserResults.js +80 -0
- package/dist/data/query-browser/QueryBrowserResults.js.map +1 -0
- package/dist/data/query-browser/index.d.ts +2 -1
- package/dist/data/query-browser/index.d.ts.map +1 -1
- package/dist/data/task-exec-details.cjs +9 -0
- package/dist/data/task-exec-details.cjs.map +1 -0
- package/dist/data/task-exec-details.d.ts +3 -0
- package/dist/data/task-exec-details.d.ts.map +1 -0
- package/dist/data/task-exec-details.js +9 -0
- package/dist/data/task-exec-details.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +2 -0
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +2 -0
- package/dist/data.js.map +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/string.cjs +8 -0
- package/dist/lib/string.cjs.map +1 -1
- package/dist/lib/string.d.ts +1 -0
- package/dist/lib/string.d.ts.map +1 -1
- package/dist/lib/string.js +8 -0
- package/dist/lib/string.js.map +1 -1
- package/dist/profiles/catalogTree.cjs +133 -0
- package/dist/profiles/catalogTree.cjs.map +1 -0
- package/dist/profiles/catalogTree.d.ts +11 -0
- package/dist/profiles/catalogTree.d.ts.map +1 -0
- package/dist/profiles/catalogTree.js +133 -0
- package/dist/profiles/catalogTree.js.map +1 -0
- package/dist/profiles/connectionBrowserModel.cjs +185 -0
- package/dist/profiles/connectionBrowserModel.cjs.map +1 -0
- package/dist/profiles/connectionBrowserModel.d.ts +169 -0
- package/dist/profiles/connectionBrowserModel.d.ts.map +1 -0
- package/dist/profiles/connectionBrowserModel.js +185 -0
- package/dist/profiles/connectionBrowserModel.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.cjs +185 -0
- package/dist/profiles/connectionQueryWorkspace.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts +63 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.js +185 -0
- package/dist/profiles/connectionQueryWorkspace.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts +38 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js.map +1 -0
- package/dist/profiles/esFieldValues.cjs +64 -0
- package/dist/profiles/esFieldValues.cjs.map +1 -0
- package/dist/profiles/esFieldValues.d.ts +48 -0
- package/dist/profiles/esFieldValues.d.ts.map +1 -0
- package/dist/profiles/esFieldValues.js +64 -0
- package/dist/profiles/esFieldValues.js.map +1 -0
- package/dist/profiles/esParamMappingModel.cjs +301 -0
- package/dist/profiles/esParamMappingModel.cjs.map +1 -0
- package/dist/profiles/esParamMappingModel.d.ts +37 -0
- package/dist/profiles/esParamMappingModel.d.ts.map +1 -0
- package/dist/profiles/esParamMappingModel.js +301 -0
- package/dist/profiles/esParamMappingModel.js.map +1 -0
- package/dist/profiles/esParamMappingPill.cjs +24 -0
- package/dist/profiles/esParamMappingPill.cjs.map +1 -0
- package/dist/profiles/esParamMappingPill.d.ts +13 -0
- package/dist/profiles/esParamMappingPill.d.ts.map +1 -0
- package/dist/profiles/esParamMappingPill.js +24 -0
- package/dist/profiles/esParamMappingPill.js.map +1 -0
- package/dist/profiles/esParamOperandExtension.cjs +75 -0
- package/dist/profiles/esParamOperandExtension.cjs.map +1 -0
- package/dist/profiles/esParamOperandExtension.d.ts +11 -0
- package/dist/profiles/esParamOperandExtension.d.ts.map +1 -0
- package/dist/profiles/esParamOperandExtension.js +75 -0
- package/dist/profiles/esParamOperandExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilder.cjs +205 -0
- package/dist/profiles/esQueryBuilder.cjs.map +1 -0
- package/dist/profiles/esQueryBuilder.d.ts +35 -0
- package/dist/profiles/esQueryBuilder.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilder.js +205 -0
- package/dist/profiles/esQueryBuilder.js.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.cjs +23 -0
- package/dist/profiles/esQueryBuilderExtension.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts +5 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.js +23 -0
- package/dist/profiles/esQueryBuilderExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilderForm.cjs +26 -0
- package/dist/profiles/esQueryBuilderForm.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderForm.d.ts +18 -0
- package/dist/profiles/esQueryBuilderForm.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderForm.js +26 -0
- package/dist/profiles/esQueryBuilderForm.js.map +1 -0
- package/dist/profiles/esQueryBuilderModel.cjs +131 -0
- package/dist/profiles/esQueryBuilderModel.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderModel.d.ts +108 -0
- package/dist/profiles/esQueryBuilderModel.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderModel.js +131 -0
- package/dist/profiles/esQueryBuilderModel.js.map +1 -0
- package/dist/profiles/esQueryClauseGroup.cjs +144 -0
- package/dist/profiles/esQueryClauseGroup.cjs.map +1 -0
- package/dist/profiles/esQueryClauseGroup.d.ts +10 -0
- package/dist/profiles/esQueryClauseGroup.d.ts.map +1 -0
- package/dist/profiles/esQueryClauseGroup.js +144 -0
- package/dist/profiles/esQueryClauseGroup.js.map +1 -0
- package/dist/profiles/esQueryCompile.cjs +47 -0
- package/dist/profiles/esQueryCompile.cjs.map +1 -0
- package/dist/profiles/esQueryCompile.d.ts +39 -0
- package/dist/profiles/esQueryCompile.d.ts.map +1 -0
- package/dist/profiles/esQueryCompile.js +47 -0
- package/dist/profiles/esQueryCompile.js.map +1 -0
- package/dist/profiles/esQueryConditionRow.cjs +168 -0
- package/dist/profiles/esQueryConditionRow.cjs.map +1 -0
- package/dist/profiles/esQueryConditionRow.d.ts +37 -0
- package/dist/profiles/esQueryConditionRow.d.ts.map +1 -0
- package/dist/profiles/esQueryConditionRow.js +168 -0
- package/dist/profiles/esQueryConditionRow.js.map +1 -0
- package/dist/profiles/esQueryGroupModel.cjs +12 -0
- package/dist/profiles/esQueryGroupModel.cjs.map +1 -0
- package/dist/profiles/esQueryGroupModel.d.ts +9 -0
- package/dist/profiles/esQueryGroupModel.d.ts.map +1 -0
- package/dist/profiles/esQueryGroupModel.js +12 -0
- package/dist/profiles/esQueryGroupModel.js.map +1 -0
- package/dist/profiles/esQueryOccur.cjs +16 -0
- package/dist/profiles/esQueryOccur.cjs.map +1 -0
- package/dist/profiles/esQueryOccur.d.ts +11 -0
- package/dist/profiles/esQueryOccur.d.ts.map +1 -0
- package/dist/profiles/esQueryOccur.js +16 -0
- package/dist/profiles/esQueryOccur.js.map +1 -0
- package/dist/profiles/esQueryOperandEditors.cjs +279 -0
- package/dist/profiles/esQueryOperandEditors.cjs.map +1 -0
- package/dist/profiles/esQueryOperandEditors.d.ts +24 -0
- package/dist/profiles/esQueryOperandEditors.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandEditors.js +279 -0
- package/dist/profiles/esQueryOperandEditors.js.map +1 -0
- package/dist/profiles/esQueryOperandModel.cjs +28 -0
- package/dist/profiles/esQueryOperandModel.cjs.map +1 -0
- package/dist/profiles/esQueryOperandModel.d.ts +17 -0
- package/dist/profiles/esQueryOperandModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandModel.js +28 -0
- package/dist/profiles/esQueryOperandModel.js.map +1 -0
- package/dist/profiles/esQueryOperators.cjs +165 -0
- package/dist/profiles/esQueryOperators.cjs.map +1 -0
- package/dist/profiles/esQueryOperators.d.ts +83 -0
- package/dist/profiles/esQueryOperators.d.ts.map +1 -0
- package/dist/profiles/esQueryOperators.js +165 -0
- package/dist/profiles/esQueryOperators.js.map +1 -0
- package/dist/profiles/esQueryOutputEditor.cjs +138 -0
- package/dist/profiles/esQueryOutputEditor.cjs.map +1 -0
- package/dist/profiles/esQueryOutputEditor.d.ts +7 -0
- package/dist/profiles/esQueryOutputEditor.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputEditor.js +138 -0
- package/dist/profiles/esQueryOutputEditor.js.map +1 -0
- package/dist/profiles/esQueryOutputModel.cjs +16 -0
- package/dist/profiles/esQueryOutputModel.cjs.map +1 -0
- package/dist/profiles/esQueryOutputModel.d.ts +14 -0
- package/dist/profiles/esQueryOutputModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputModel.js +16 -0
- package/dist/profiles/esQueryOutputModel.js.map +1 -0
- package/dist/profiles/esQueryPreview.cjs +30 -0
- package/dist/profiles/esQueryPreview.cjs.map +1 -0
- package/dist/profiles/esQueryPreview.d.ts +6 -0
- package/dist/profiles/esQueryPreview.d.ts.map +1 -0
- package/dist/profiles/esQueryPreview.js +30 -0
- package/dist/profiles/esQueryPreview.js.map +1 -0
- package/dist/profiles/esQuerySortEditor.cjs +143 -0
- package/dist/profiles/esQuerySortEditor.cjs.map +1 -0
- package/dist/profiles/esQuerySortEditor.d.ts +9 -0
- package/dist/profiles/esQuerySortEditor.d.ts.map +1 -0
- package/dist/profiles/esQuerySortEditor.js +143 -0
- package/dist/profiles/esQuerySortEditor.js.map +1 -0
- package/dist/profiles/esQuerySortModel.cjs +13 -0
- package/dist/profiles/esQuerySortModel.cjs.map +1 -0
- package/dist/profiles/esQuerySortModel.d.ts +4 -0
- package/dist/profiles/esQuerySortModel.d.ts.map +1 -0
- package/dist/profiles/esQuerySortModel.js +13 -0
- package/dist/profiles/esQuerySortModel.js.map +1 -0
- package/dist/profiles/esValueCombobox.cjs +86 -0
- package/dist/profiles/esValueCombobox.cjs.map +1 -0
- package/dist/profiles/esValueCombobox.d.ts +15 -0
- package/dist/profiles/esValueCombobox.d.ts.map +1 -0
- package/dist/profiles/esValueCombobox.js +86 -0
- package/dist/profiles/esValueCombobox.js.map +1 -0
- package/dist/profiles/jsonPathSample.cjs +75 -0
- package/dist/profiles/jsonPathSample.cjs.map +1 -0
- package/dist/profiles/jsonPathSample.d.ts +27 -0
- package/dist/profiles/jsonPathSample.d.ts.map +1 -0
- package/dist/profiles/jsonPathSample.js +75 -0
- package/dist/profiles/jsonPathSample.js.map +1 -0
- package/dist/profiles/jsonPathSampleRow.cjs +14 -0
- package/dist/profiles/jsonPathSampleRow.cjs.map +1 -0
- package/dist/profiles/jsonPathSampleRow.d.ts +6 -0
- package/dist/profiles/jsonPathSampleRow.d.ts.map +1 -0
- package/dist/profiles/jsonPathSampleRow.js +14 -0
- package/dist/profiles/jsonPathSampleRow.js.map +1 -0
- package/dist/profiles/profileApi.cjs +37 -0
- package/dist/profiles/profileApi.cjs.map +1 -0
- package/dist/profiles/profileApi.d.ts +32 -0
- package/dist/profiles/profileApi.d.ts.map +1 -0
- package/dist/profiles/profileApi.js +37 -0
- package/dist/profiles/profileApi.js.map +1 -0
- package/dist/profiles/profileBuilder.cjs +65 -0
- package/dist/profiles/profileBuilder.cjs.map +1 -0
- package/dist/profiles/profileBuilder.d.ts +11 -0
- package/dist/profiles/profileBuilder.d.ts.map +1 -0
- package/dist/profiles/profileBuilder.js +65 -0
- package/dist/profiles/profileBuilder.js.map +1 -0
- package/dist/profiles/profileBuilderExtension.cjs +25 -0
- package/dist/profiles/profileBuilderExtension.cjs.map +1 -0
- package/dist/profiles/profileBuilderExtension.d.ts +5 -0
- package/dist/profiles/profileBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/profileBuilderExtension.js +25 -0
- package/dist/profiles/profileBuilderExtension.js.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.cjs +368 -0
- package/dist/profiles/profileBuilderWorkspace.cjs.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts +21 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.js +368 -0
- package/dist/profiles/profileBuilderWorkspace.js.map +1 -0
- package/dist/profiles/profileColumnModel.cjs +23 -0
- package/dist/profiles/profileColumnModel.cjs.map +1 -0
- package/dist/profiles/profileColumnModel.d.ts +8 -0
- package/dist/profiles/profileColumnModel.d.ts.map +1 -0
- package/dist/profiles/profileColumnModel.js +23 -0
- package/dist/profiles/profileColumnModel.js.map +1 -0
- package/dist/profiles/profileColumnPicker.cjs +68 -0
- package/dist/profiles/profileColumnPicker.cjs.map +1 -0
- package/dist/profiles/profileColumnPicker.d.ts +11 -0
- package/dist/profiles/profileColumnPicker.d.ts.map +1 -0
- package/dist/profiles/profileColumnPicker.js +68 -0
- package/dist/profiles/profileColumnPicker.js.map +1 -0
- package/dist/profiles/profileEditor.cjs +386 -0
- package/dist/profiles/profileEditor.cjs.map +1 -0
- package/dist/profiles/profileEditor.d.ts +19 -0
- package/dist/profiles/profileEditor.d.ts.map +1 -0
- package/dist/profiles/profileEditor.js +386 -0
- package/dist/profiles/profileEditor.js.map +1 -0
- package/dist/profiles/profileEditorModel.cjs +181 -0
- package/dist/profiles/profileEditorModel.cjs.map +1 -0
- package/dist/profiles/profileEditorModel.d.ts +74 -0
- package/dist/profiles/profileEditorModel.d.ts.map +1 -0
- package/dist/profiles/profileEditorModel.js +181 -0
- package/dist/profiles/profileEditorModel.js.map +1 -0
- package/dist/profiles/profileEditorPreview.cjs +38 -0
- package/dist/profiles/profileEditorPreview.cjs.map +1 -0
- package/dist/profiles/profileEditorPreview.d.ts +12 -0
- package/dist/profiles/profileEditorPreview.d.ts.map +1 -0
- package/dist/profiles/profileEditorPreview.js +38 -0
- package/dist/profiles/profileEditorPreview.js.map +1 -0
- package/dist/profiles/profileEditorRail.cjs +46 -0
- package/dist/profiles/profileEditorRail.cjs.map +1 -0
- package/dist/profiles/profileEditorRail.d.ts +8 -0
- package/dist/profiles/profileEditorRail.d.ts.map +1 -0
- package/dist/profiles/profileEditorRail.js +46 -0
- package/dist/profiles/profileEditorRail.js.map +1 -0
- package/dist/profiles/profileEditorRaw.cjs +118 -0
- package/dist/profiles/profileEditorRaw.cjs.map +1 -0
- package/dist/profiles/profileEditorRaw.d.ts +7 -0
- package/dist/profiles/profileEditorRaw.d.ts.map +1 -0
- package/dist/profiles/profileEditorRaw.js +118 -0
- package/dist/profiles/profileEditorRaw.js.map +1 -0
- package/dist/profiles/profileEditorRoutes.cjs +7 -0
- package/dist/profiles/profileEditorRoutes.cjs.map +1 -0
- package/dist/profiles/profileEditorRoutes.d.ts +2 -0
- package/dist/profiles/profileEditorRoutes.d.ts.map +1 -0
- package/dist/profiles/profileEditorRoutes.js +7 -0
- package/dist/profiles/profileEditorRoutes.js.map +1 -0
- package/dist/profiles/profileEditorSections.cjs +213 -0
- package/dist/profiles/profileEditorSections.cjs.map +1 -0
- package/dist/profiles/profileEditorSections.d.ts +23 -0
- package/dist/profiles/profileEditorSections.d.ts.map +1 -0
- package/dist/profiles/profileEditorSections.js +213 -0
- package/dist/profiles/profileEditorSections.js.map +1 -0
- package/dist/profiles/profileFieldEditor.cjs +200 -0
- package/dist/profiles/profileFieldEditor.cjs.map +1 -0
- package/dist/profiles/profileFieldEditor.d.ts +34 -0
- package/dist/profiles/profileFieldEditor.d.ts.map +1 -0
- package/dist/profiles/profileFieldEditor.js +200 -0
- package/dist/profiles/profileFieldEditor.js.map +1 -0
- package/dist/profiles/profileFieldGrid.cjs +250 -0
- package/dist/profiles/profileFieldGrid.cjs.map +1 -0
- package/dist/profiles/profileFieldGrid.d.ts +20 -0
- package/dist/profiles/profileFieldGrid.d.ts.map +1 -0
- package/dist/profiles/profileFieldGrid.js +250 -0
- package/dist/profiles/profileFieldGrid.js.map +1 -0
- package/dist/profiles/profileFieldManager.cjs +103 -0
- package/dist/profiles/profileFieldManager.cjs.map +1 -0
- package/dist/profiles/profileFieldManager.d.ts +9 -0
- package/dist/profiles/profileFieldManager.d.ts.map +1 -0
- package/dist/profiles/profileFieldManager.js +103 -0
- package/dist/profiles/profileFieldManager.js.map +1 -0
- package/dist/profiles/profileFieldState.cjs +136 -0
- package/dist/profiles/profileFieldState.cjs.map +1 -0
- package/dist/profiles/profileFieldState.d.ts +41 -0
- package/dist/profiles/profileFieldState.d.ts.map +1 -0
- package/dist/profiles/profileFieldState.js +136 -0
- package/dist/profiles/profileFieldState.js.map +1 -0
- package/dist/profiles/profileFieldTypes.cjs +17 -0
- package/dist/profiles/profileFieldTypes.cjs.map +1 -0
- package/dist/profiles/profileFieldTypes.d.ts +8 -0
- package/dist/profiles/profileFieldTypes.d.ts.map +1 -0
- package/dist/profiles/profileFieldTypes.js +17 -0
- package/dist/profiles/profileFieldTypes.js.map +1 -0
- package/dist/profiles/profileParamModel.cjs +78 -0
- package/dist/profiles/profileParamModel.cjs.map +1 -0
- package/dist/profiles/profileParamModel.d.ts +3 -0
- package/dist/profiles/profileParamModel.d.ts.map +1 -0
- package/dist/profiles/profileParamModel.js +78 -0
- package/dist/profiles/profileParamModel.js.map +1 -0
- package/dist/profiles/profileSamplePayload.cjs +15 -0
- package/dist/profiles/profileSamplePayload.cjs.map +1 -0
- package/dist/profiles/profileSamplePayload.d.ts +13 -0
- package/dist/profiles/profileSamplePayload.d.ts.map +1 -0
- package/dist/profiles/profileSamplePayload.js +15 -0
- package/dist/profiles/profileSamplePayload.js.map +1 -0
- package/dist/profiles/profileWizard.cjs +257 -0
- package/dist/profiles/profileWizard.cjs.map +1 -0
- package/dist/profiles/profileWizard.d.ts +12 -0
- package/dist/profiles/profileWizard.d.ts.map +1 -0
- package/dist/profiles/profileWizard.js +257 -0
- package/dist/profiles/profileWizard.js.map +1 -0
- package/dist/profiles/profileWizardHelp.cjs +10 -0
- package/dist/profiles/profileWizardHelp.cjs.map +1 -0
- package/dist/profiles/profileWizardHelp.d.ts +13 -0
- package/dist/profiles/profileWizardHelp.d.ts.map +1 -0
- package/dist/profiles/profileWizardHelp.js +10 -0
- package/dist/profiles/profileWizardHelp.js.map +1 -0
- package/dist/profiles/profileWizardModel.cjs +198 -0
- package/dist/profiles/profileWizardModel.cjs.map +1 -0
- package/dist/profiles/profileWizardModel.d.ts +255 -0
- package/dist/profiles/profileWizardModel.d.ts.map +1 -0
- package/dist/profiles/profileWizardModel.js +198 -0
- package/dist/profiles/profileWizardModel.js.map +1 -0
- package/dist/profiles/profileWizardQueryStep.cjs +215 -0
- package/dist/profiles/profileWizardQueryStep.cjs.map +1 -0
- package/dist/profiles/profileWizardQueryStep.d.ts +18 -0
- package/dist/profiles/profileWizardQueryStep.d.ts.map +1 -0
- package/dist/profiles/profileWizardQueryStep.js +215 -0
- package/dist/profiles/profileWizardQueryStep.js.map +1 -0
- package/dist/profiles/profileWizardSteps.cjs +214 -0
- package/dist/profiles/profileWizardSteps.cjs.map +1 -0
- package/dist/profiles/profileWizardSteps.d.ts +35 -0
- package/dist/profiles/profileWizardSteps.d.ts.map +1 -0
- package/dist/profiles/profileWizardSteps.js +214 -0
- package/dist/profiles/profileWizardSteps.js.map +1 -0
- package/dist/profiles/profileYaml.cjs +19 -0
- package/dist/profiles/profileYaml.cjs.map +1 -0
- package/dist/profiles/profileYaml.d.ts +4 -0
- package/dist/profiles/profileYaml.d.ts.map +1 -0
- package/dist/profiles/profileYaml.js +19 -0
- package/dist/profiles/profileYaml.js.map +1 -0
- package/dist/profiles/prometheusResults.cjs +60 -0
- package/dist/profiles/prometheusResults.cjs.map +1 -0
- package/dist/profiles/prometheusResults.d.ts +7 -0
- package/dist/profiles/prometheusResults.d.ts.map +1 -0
- package/dist/profiles/prometheusResults.js +60 -0
- package/dist/profiles/prometheusResults.js.map +1 -0
- package/dist/profiles/queryRowLimits.cjs +82 -0
- package/dist/profiles/queryRowLimits.cjs.map +1 -0
- package/dist/profiles/queryRowLimits.d.ts +9 -0
- package/dist/profiles/queryRowLimits.d.ts.map +1 -0
- package/dist/profiles/queryRowLimits.js +82 -0
- package/dist/profiles/queryRowLimits.js.map +1 -0
- package/dist/profiles/queryRowLimitsModel.cjs +10 -0
- package/dist/profiles/queryRowLimitsModel.cjs.map +1 -0
- package/dist/profiles/queryRowLimitsModel.d.ts +9 -0
- package/dist/profiles/queryRowLimitsModel.d.ts.map +1 -0
- package/dist/profiles/queryRowLimitsModel.js +10 -0
- package/dist/profiles/queryRowLimitsModel.js.map +1 -0
- package/dist/profiles/queryTargetPicker.cjs +42 -0
- package/dist/profiles/queryTargetPicker.cjs.map +1 -0
- package/dist/profiles/queryTargetPicker.d.ts +8 -0
- package/dist/profiles/queryTargetPicker.d.ts.map +1 -0
- package/dist/profiles/queryTargetPicker.js +42 -0
- package/dist/profiles/queryTargetPicker.js.map +1 -0
- package/dist/profiles/testSchema.d.ts +3 -0
- package/dist/profiles/testSchema.d.ts.map +1 -0
- package/dist/profiles.cjs +223 -0
- package/dist/profiles.cjs.map +1 -0
- package/dist/profiles.d.ts +68 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +223 -0
- package/dist/profiles.js.map +1 -0
- package/dist/rpc/FilterForm.cjs +20 -0
- package/dist/rpc/FilterForm.cjs.map +1 -1
- package/dist/rpc/FilterForm.js +20 -0
- package/dist/rpc/FilterForm.js.map +1 -1
- package/dist/rpc/formMetadata.cjs +34 -0
- package/dist/rpc/formMetadata.cjs.map +1 -1
- package/dist/rpc/formMetadata.d.ts.map +1 -1
- package/dist/rpc/formMetadata.js +35 -1
- package/dist/rpc/formMetadata.js.map +1 -1
- package/dist/rpc/types.cjs.map +1 -1
- package/dist/rpc/types.d.ts +9 -1
- package/dist/rpc/types.d.ts.map +1 -1
- package/dist/rpc/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-render.js","sources":["../../src/components/json-schema-form-render.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { LabelIcon } from \"../data/Icon\";\nimport {\n BooleanControl,\n DateControl,\n DisplayControl,\n EnumControl,\n LinkControl,\n LookupControl,\n MarkdownControl,\n NumberControl,\n ReadOnlyValue,\n StringControl,\n TextareaControl,\n} from \"./json-schema-form-fields\";\nimport {\n FieldLabel,\n FieldWrapper,\n HelpHint,\n ObjectSection,\n} from \"./json-schema-form-layout\";\nimport { ArrayControl } from \"./json-schema-form-array\";\nimport { ObjectControl, StringMapControl } from \"./json-schema-form-object\";\nimport { FieldErrorMessages, FieldErrorText } from \"./json-schema-form-error-display\";\nimport { appendInstancePath, errorsAtInstancePath } from \"./json-schema-form-errors\";\nimport type { JsonSchemaFormError } from \"./json-schema-form-error-types\";\nimport { applyPostExtensions } from \"./json-schema-form-extensions\";\nimport { effectiveProperties, resolveControl, schemaRendersAsObject } from \"./json-schema-form-resolve\";\nimport type {\n FieldArgs,\n FieldControl,\n HelpDisplay,\n JsonSchemaObject,\n JsonSchemaProperty,\n RenderApi,\n RenderContext,\n} from \"./json-schema-form-types\";\nimport {\n fieldErrorId,\n fieldInputId,\n matchesFieldFilter,\n normalizeColSpan,\n normalizeColumns,\n orderByClickyOrder,\n orderByPriority,\n orderByXOrder,\n orderRequiredFirst,\n softError,\n} from \"./json-schema-form-utils\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\n\n// This module is the top of the json-schema-form graph: it imports the control\n// components and dispatches into them, while container controls recurse back in\n// only through ctx.render (see RenderApi). Nothing here is a React component,\n// so the component modules stay Fast-Refresh-eligible and cycle-free.\n\n// renderValueControl produces just the value node for a field, dispatching on\n// its resolved kind. The RenderContext carries readOnly + the pre/post stacks so\n// container controls (array/object/map) can recurse with full context.\nexport function renderValueControl(field: FieldControl, ctx: RenderContext): ReactNode {\n // ctx.instancePath is the field's own path here: buildField descends into the\n // child context before rendering the value.\n const fieldId = fieldInputId(ctx.instancePath, ctx.idPrefix);\n // A field the schema marks `readOnly` is never editable: it shows its current\n // value as plain text, not a disabled input. (The form-level ctx.readOnly,\n // below, instead disables the real controls so the structure stays visible.)\n // Containers (array/object/map) still render structurally so nested read-only\n // values surface, and textarea/display/link own their non-editable rendering\n // (multi-line text / static element / hyperlink), so all of these are excluded\n // from the plain ReadOnlyValue fallback.\n if (field.readOnly && !ownsReadOnlyRendering(field.kind)) {\n return <ReadOnlyValue field={field} fieldId={fieldId} size={ctx.size} />;\n }\n const readOnly = ctx.readOnly || field.readOnly === true;\n const size = ctx.size;\n switch (field.kind) {\n case \"enum\":\n return <EnumControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"lookup\":\n return (\n <LookupControl\n field={field}\n fieldId={fieldId}\n readOnly={readOnly}\n size={size}\n {...(ctx.rootValue ? { rootValue: ctx.rootValue } : {})}\n />\n );\n case \"boolean\":\n return <BooleanControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"number\":\n return <NumberControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"date\":\n return <DateControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"textarea\":\n return <TextareaControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"markdown\":\n return <MarkdownControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"display\":\n return <DisplayControl field={field} size={size} />;\n case \"link\":\n return <LinkControl field={field} fieldId={fieldId} size={size} />;\n case \"array\":\n return <ArrayControl field={field} fieldId={fieldId} ctx={ctx} />;\n case \"object\":\n return <ObjectControl field={field} ctx={ctx} />;\n case \"string-map\":\n return <StringMapControl field={field} ctx={ctx} />;\n default:\n return <StringControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n }\n}\n\n// ownsReadOnlyRendering reports whether a control renders its own non-editable\n// form, so the renderer must not pre-empt it with the plain ReadOnlyValue text:\n// containers recurse structurally, and textarea/display/link have bespoke\n// read-only output.\nfunction ownsReadOnlyRendering(kind: FieldControl[\"kind\"]): boolean {\n return (\n kind === \"array\" ||\n kind === \"object\" ||\n kind === \"string-map\" ||\n kind === \"textarea\" ||\n kind === \"markdown\" ||\n kind === \"display\" ||\n kind === \"link\"\n );\n}\n\n// buildField resolves a control, applies the pre-extensions (any returning\n// null drops the field), renders the value node, then applies the\n// post-extensions to the {label, value} node pair.\nfunction buildField(\n args: FieldArgs,\n ctx: RenderContext,\n): {\n field: FieldControl;\n fieldId: string;\n label: ReactNode;\n value: ReactNode;\n messages: JsonSchemaFormError[];\n help: HelpDisplay;\n} | null {\n const base = resolveControl(args);\n let field: FieldControl | null = base;\n for (const ext of ctx.pre) {\n if (!field) break;\n field = ext(field, {\n key: args.key,\n prop: args.prop,\n value: args.value,\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n });\n }\n if (!field) return null;\n // Drop read-only fields entirely when the form opts out of displaying them.\n // Checked after pre-extensions so an extension that sets/clears readOnly wins.\n if (ctx.hideReadOnlyFields && field.readOnly) return null;\n\n const instancePath = args.instancePath ?? appendInstancePath(ctx.instancePath, args.key);\n const fieldId = fieldInputId(instancePath, ctx.idPrefix);\n // Resolve this field's errors before rendering its control, so the control can\n // carry aria-invalid / aria-describedby rather than leaving the error text\n // visually adjacent but programmatically unassociated. Host-supplied errors\n // and the locally-derived soft hint (e.g. \"Required\" on an empty required\n // field) are one validation state: either one marks the field invalid and is\n // rendered into the aria-describedby target, so a locally-invalid field is\n // never invalid only to sighted users. softError reads value/required/kind —\n // never `invalid` — so deriving it from `field` here is not circular.\n const errors = errorsAtInstancePath(ctx.errors, instancePath);\n const soft = errors.length === 0 ? softError(field) : undefined;\n const messages: JsonSchemaFormError[] =\n errors.length > 0 ? errors : soft ? [{ instancePath, message: soft }] : [];\n if (messages.length > 0) field = { ...field, invalid: true };\n // A field's own x-help-display wins over the form-level setting; both default\n // to the permanent paragraph every form renders today.\n const help = field.helpDisplay ?? ctx.layout.help ?? \"inline\";\n let label: ReactNode = (\n <FieldLabel field={field} fieldId={fieldId} size={ctx.size} helpDisplay={help} />\n );\n // A field's `x-layout: inline|stack` overrides the form-level layout for its\n // own value subtree (the field's own row keeps the parent layout). \"table\" is\n // handled structurally inside the array/string-map controls, not here.\n const overrideMode =\n field.layout === \"inline\" ? \"inline\" : field.layout === \"stack\" ? \"stacked\" : undefined;\n const valueCtx: RenderContext = {\n ...ctx,\n instancePath,\n ...(overrideMode ? { layout: { ...ctx.layout, mode: overrideMode } } : {}),\n };\n let value: ReactNode = renderValueControl(field, valueCtx);\n const postCtx = {\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n };\n ({ label, value } = applyPostExtensions(\n field,\n { label, value },\n ctx.post,\n postCtx,\n ));\n return { field, fieldId, label, value, messages, help };\n}\n\n// renderFieldNodes runs the full pipeline and returns the raw {label, value}\n// nodes (no FieldWrapper). Used where the caller arranges layout itself — map\n// rows (value only) and scalar array items.\nexport function renderFieldNodes(\n args: FieldArgs,\n ctx: RenderContext,\n): { label: ReactNode; value: ReactNode } | null {\n const built = buildField(args, ctx);\n if (!built) return null;\n return {\n label: built.label,\n value:\n built.messages.length > 0 ? (\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n {built.value}\n <FieldErrorText id={fieldErrorId(built.fieldId)} errors={built.messages} />\n </div>\n ) : (\n built.value\n ),\n };\n}\n\n// renderFieldRow runs the pipeline and wraps it in a FieldWrapper with the soft\n// validation hint. `labelOverride` lets a container relabel a field that has no\n// natural key (e.g. array items → \"Item 1\").\nexport function renderFieldRow(\n args: FieldArgs,\n ctx: RenderContext,\n opts?: { labelOverride?: string },\n): ReactNode | null {\n const built = buildField(args, ctx);\n if (!built) return null;\n const { field } = built;\n // Object fields — and table-laid-out arrays/string-maps — render as a flat\n // section: a header followed by their body at full width, rather than an\n // inline label + narrow value column. This keeps deep schemas (e.g. policy →\n // shape, asfile → params) readable as a single column of labelled sections,\n // and gives a `x-layout: \"table\"` array the full width its columns need\n // instead of cramming it into the inline value column.\n // An accordion joins this list: crammed into the 600px inline value column it\n // is unusable, and it needs the ObjectSection header to carry the array's own\n // title, required marker and help.\n if (\n field.kind === \"object\" ||\n field.layout === \"table\" ||\n field.arrayDisplay === \"accordion\"\n ) {\n return (\n <ObjectSection\n label={opts?.labelOverride ?? field.label}\n required={field.required}\n size={ctx.size}\n helpDisplay={built.help}\n {...(field.badge ? { badge: field.badge } : {})}\n {...(field.helper ? { helper: field.helper } : {})}\n {...(field.labelIcon != null ? { labelIcon: field.labelIcon } : {})}\n >\n <FieldErrorText\n id={fieldErrorId(built.fieldId)}\n errors={built.messages}\n className=\"min-w-0 break-words\"\n />\n {built.value}\n </ObjectSection>\n );\n }\n // A display field (heading/divider/info/spacer) is the label — it carries no\n // value column, so it spans the full grid width with no inline label cell.\n if (field.kind === \"display\") {\n return <div className=\"col-span-full\">{built.value}</div>;\n }\n const label = opts?.labelOverride ? (\n <span className={cn(\"flex items-center gap-2 font-medium\", labelSizeClass[ctx.size])}>\n <LabelIcon icon={field.labelIcon} className=\"text-[15px] text-muted-foreground\" />\n <span>{opts.labelOverride}</span>\n {field.required && <span className=\"text-destructive\">*</span>}\n {field.badge && (\n <span className=\"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {field.badge}\n </span>\n )}\n {/* Without this the `?` silently disappears for relabelled rows (array\n items), taking the description with it — FieldWrapper has already\n dropped the paragraph by then. */}\n {built.help === \"hover\" && field.helper && (\n <HelpHint label={opts.labelOverride} helper={field.helper} />\n )}\n </span>\n ) : (\n built.label\n );\n // One rendering path for both sources, so the soft hint lands in the same\n // fieldErrorId element the control's aria-describedby already points at.\n const err =\n built.messages.length > 0 ? (\n <FieldErrorMessages id={fieldErrorId(built.fieldId)} errors={built.messages} />\n ) : undefined;\n return (\n <FieldWrapper\n layout={ctx.layout}\n size={ctx.size}\n label={label}\n value={built.value}\n {...(field.colSpan === \"full\" ? { maxWidth: \"none\" } : {})}\n {...(field.helper && built.help !== \"hover\" ? { helper: field.helper } : {})}\n {...(err ? { error: err } : {})}\n />\n );\n}\n\n// renderObjectFields maps an object subschema's effective properties to field\n// rows. It is the recursive heart, shared by the top-level form and the nested\n// ObjectControl. Edits spread immutably onto the object.\nexport function renderObjectFields(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n onChange: (next: Record<string, unknown>) => void,\n ctx: RenderContext,\n opts?: { hiddenKeys?: string[] },\n): ReactNode[] {\n const { properties, required } = effectiveProperties(schema, value);\n const hidden = new Set(opts?.hiddenKeys ?? []);\n // Per-property `x-clicky-order` wins (composes across merged branches); the\n // object-level `x-order` array is the fallback; document order otherwise.\n const ordered = orderByClickyOrder(orderByXOrder(Object.entries(properties), schema[\"x-order\"]));\n const sorted =\n ctx.sortMode === \"required-first\"\n ? orderRequiredFirst(ordered, required)\n : ctx.sortMode === \"priority\"\n ? orderByPriority(ordered, required, value)\n : ordered;\n // The field filter narrows only the outermost object level (depth 0); nested\n // object subtrees render in full so a matched parent keeps all its children.\n const entries =\n ctx.depth === 0 && ctx.fieldFilter\n ? sorted.filter(([key, prop]) => matchesFieldFilter(key, prop, ctx.fieldFilter!))\n : sorted;\n // Object-level `x-columns` lays the fields out in a multi-column stacked grid;\n // each field spans `x-col-span` columns (object sections/table arrays span the\n // full row). Only takes effect in stacked mode — inline owns its 2-track grid.\n const columns = ctx.layout.mode === \"inline\" ? 1 : normalizeColumns(schema[\"x-columns\"]);\n return entries.flatMap(([key, prop]) => {\n if (hidden.has(key)) return [];\n const row = renderFieldRow(\n {\n key,\n prop,\n required: required.includes(key),\n value: value[key],\n onChange: (next) => onChange({ ...value, [key]: next }),\n instancePath: appendInstancePath(ctx.instancePath, key),\n },\n ctx,\n );\n if (!row) return [];\n if (columns === \"auto\" || columns > 1) {\n const span = rendersFullWidth(prop)\n ? \"full\"\n : normalizeColSpan(prop[\"x-col-span\"], columns);\n return [\n <div\n key={key}\n // Under \"auto\" the track count only exists at layout time, so a\n // full-width field must say `1 / -1` rather than span a number.\n style={{\n gridColumn: span === \"full\" ? \"1 / -1\" : `span ${span} / span ${span}`,\n }}\n >\n {row}\n </div>,\n ];\n }\n // `contents` keeps the keyed wrapper out of the box tree so the row's own\n // node (a subgrid FieldWrapper or a full-width ObjectSection) is a direct\n // child of the FieldsGrid and snaps to its label/value tracks.\n return [<div key={key} className=\"contents\">{row}</div>];\n });\n}\n\n// rendersFullWidth reports whether a property renders as a full-width block\n// (a structured object → ObjectSection, or an `x-layout: \"table\"` array/map) so\n// a multi-column grid gives it the whole row instead of a single column.\nfunction rendersFullWidth(prop: JsonSchemaProperty): boolean {\n const fixedProperties = effectiveProperties(prop as JsonSchemaObject, {}).properties;\n if (schemaRendersAsObject(prop) && (prop.properties !== undefined || Object.keys(fixedProperties).length > 0)) {\n return true;\n }\n return prop[\"x-layout\"] === \"table\" || prop[\"x-array-display\"] === \"accordion\";\n}\n\n// renderApi is the RenderContext injection bundle: the root form stores it on\n// the context so container controls can recurse without importing this module.\nexport const renderApi: RenderApi = {\n renderFieldNodes,\n renderFieldRow,\n renderObjectFields,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA4DO,SAAS,mBAAmB,OAAqB,KAA+B;AAGrF,QAAM,UAAU,aAAa,IAAI,cAAc,IAAI,QAAQ;AAQ3D,MAAI,MAAM,YAAY,CAAC,sBAAsB,MAAM,IAAI,GAAG;AACxD,+BAAQ,eAAA,EAAc,OAAc,SAAkB,MAAM,IAAI,MAAM;AAAA,EACxE;AACA,QAAM,WAAW,IAAI,YAAY,MAAM,aAAa;AACpD,QAAM,OAAO,IAAI;AACjB,UAAQ,MAAM,MAAA;AAAA,IACZ,KAAK;AACH,aAAO,oBAAC,aAAA,EAAY,OAAc,SAAkB,UAAoB,MAAY;AAAA,IACtF,KAAK;AACH,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACC,GAAI,IAAI,YAAY,EAAE,WAAW,IAAI,UAAA,IAAc,CAAA;AAAA,QAAC;AAAA,MAAA;AAAA,IAG3D,KAAK;AACH,aAAO,oBAAC,gBAAA,EAAe,OAAc,SAAkB,UAAoB,MAAY;AAAA,IACzF,KAAK;AACH,aAAO,oBAAC,eAAA,EAAc,OAAc,SAAkB,UAAoB,MAAY;AAAA,IACxF,KAAK;AACH,aAAO,oBAAC,aAAA,EAAY,OAAc,SAAkB,UAAoB,MAAY;AAAA,IACtF,KAAK;AACH,aAAO,oBAAC,iBAAA,EAAgB,OAAc,SAAkB,UAAoB,MAAY;AAAA,IAC1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/components/json-schema-form-render.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { LabelIcon } from \"../data/Icon\";\nimport {\n BooleanControl,\n DateControl,\n DisplayControl,\n EnumControl,\n LinkControl,\n LookupControl,\n MarkdownControl,\n NumberControl,\n ReadOnlyValue,\n StringControl,\n TextareaControl,\n} from \"./json-schema-form-fields\";\nimport {\n FieldLabel,\n FieldWrapper,\n HelpHint,\n ObjectSection,\n} from \"./json-schema-form-layout\";\nimport { ArrayControl } from \"./json-schema-form-array\";\nimport { ObjectControl, StringMapControl } from \"./json-schema-form-object\";\nimport { FieldErrorMessages, FieldErrorText } from \"./json-schema-form-error-display\";\nimport { appendInstancePath, errorsAtInstancePath } from \"./json-schema-form-errors\";\nimport type { JsonSchemaFormError } from \"./json-schema-form-error-types\";\nimport { applyPostExtensions } from \"./json-schema-form-extensions\";\nimport { effectiveProperties, resolveControl, schemaRendersAsObject } from \"./json-schema-form-resolve\";\nimport type {\n FieldArgs,\n FieldControl,\n HelpDisplay,\n JsonSchemaObject,\n JsonSchemaProperty,\n RenderApi,\n RenderContext,\n} from \"./json-schema-form-types\";\nimport {\n fieldErrorId,\n fieldInputId,\n matchesFieldFilter,\n normalizeColSpan,\n normalizeColumns,\n orderByClickyOrder,\n orderByPriority,\n orderByXOrder,\n orderRequiredFirst,\n softError,\n} from \"./json-schema-form-utils\";\nimport { labelSizeClass } from \"./json-schema-form-size\";\n\n// This module is the top of the json-schema-form graph: it imports the control\n// components and dispatches into them, while container controls recurse back in\n// only through ctx.render (see RenderApi). Nothing here is a React component,\n// so the component modules stay Fast-Refresh-eligible and cycle-free.\n\n// renderValueControl produces just the value node for a field, dispatching on\n// its resolved kind. The RenderContext carries readOnly + the pre/post stacks so\n// container controls (array/object/map) can recurse with full context.\nexport function renderValueControl(field: FieldControl, ctx: RenderContext): ReactNode {\n // ctx.instancePath is the field's own path here: buildField descends into the\n // child context before rendering the value.\n const fieldId = fieldInputId(ctx.instancePath, ctx.idPrefix);\n // A field the schema marks `readOnly` is never editable: it shows its current\n // value as plain text, not a disabled input. (The form-level ctx.readOnly,\n // below, instead disables the real controls so the structure stays visible.)\n // Containers (array/object/map) still render structurally so nested read-only\n // values surface, and textarea/display/link own their non-editable rendering\n // (multi-line text / static element / hyperlink), so all of these are excluded\n // from the plain ReadOnlyValue fallback.\n if (field.readOnly && !ownsReadOnlyRendering(field.kind)) {\n return <ReadOnlyValue field={field} fieldId={fieldId} size={ctx.size} />;\n }\n const readOnly = ctx.readOnly || field.readOnly === true;\n const size = ctx.size;\n switch (field.kind) {\n case \"enum\":\n return <EnumControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"lookup\":\n return (\n <LookupControl\n field={field}\n fieldId={fieldId}\n readOnly={readOnly}\n size={size}\n {...(ctx.rootValue ? { rootValue: ctx.rootValue } : {})}\n />\n );\n case \"boolean\":\n return <BooleanControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"number\":\n return <NumberControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"date\":\n return <DateControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"textarea\":\n return <TextareaControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"markdown\":\n return <MarkdownControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n case \"display\":\n return <DisplayControl field={field} size={size} />;\n case \"link\":\n return <LinkControl field={field} fieldId={fieldId} size={size} />;\n case \"array\":\n return <ArrayControl field={field} fieldId={fieldId} ctx={ctx} />;\n case \"object\":\n return <ObjectControl field={field} ctx={ctx} />;\n case \"string-map\":\n return <StringMapControl field={field} ctx={ctx} />;\n default:\n return <StringControl field={field} fieldId={fieldId} readOnly={readOnly} size={size} />;\n }\n}\n\n// ownsReadOnlyRendering reports whether a control renders its own non-editable\n// form, so the renderer must not pre-empt it with the plain ReadOnlyValue text:\n// containers recurse structurally, and textarea/display/link have bespoke\n// read-only output.\nfunction ownsReadOnlyRendering(kind: FieldControl[\"kind\"]): boolean {\n return (\n kind === \"array\" ||\n kind === \"object\" ||\n kind === \"string-map\" ||\n kind === \"textarea\" ||\n kind === \"markdown\" ||\n kind === \"display\" ||\n kind === \"link\"\n );\n}\n\n// buildField resolves a control, applies the pre-extensions (any returning\n// null drops the field), renders the value node, then applies the\n// post-extensions to the {label, value} node pair.\nfunction buildField(\n args: FieldArgs,\n ctx: RenderContext,\n): {\n field: FieldControl;\n fieldId: string;\n label: ReactNode;\n value: ReactNode;\n messages: JsonSchemaFormError[];\n help: HelpDisplay;\n} | null {\n const base = resolveControl(args);\n let field: FieldControl | null = base;\n for (const ext of ctx.pre) {\n if (!field) break;\n field = ext(field, {\n key: args.key,\n prop: args.prop,\n value: args.value,\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n });\n }\n if (!field) return null;\n // Drop read-only fields entirely when the form opts out of displaying them.\n // Checked after pre-extensions so an extension that sets/clears readOnly wins.\n if (ctx.hideReadOnlyFields && field.readOnly) return null;\n\n const instancePath = args.instancePath ?? appendInstancePath(ctx.instancePath, args.key);\n const fieldId = fieldInputId(instancePath, ctx.idPrefix);\n // Resolve this field's errors before rendering its control, so the control can\n // carry aria-invalid / aria-describedby rather than leaving the error text\n // visually adjacent but programmatically unassociated. Host-supplied errors\n // and the locally-derived soft hint (e.g. \"Required\" on an empty required\n // field) are one validation state: either one marks the field invalid and is\n // rendered into the aria-describedby target, so a locally-invalid field is\n // never invalid only to sighted users. softError reads value/required/kind —\n // never `invalid` — so deriving it from `field` here is not circular.\n const errors = errorsAtInstancePath(ctx.errors, instancePath);\n const soft = errors.length === 0 ? softError(field) : undefined;\n const messages: JsonSchemaFormError[] =\n errors.length > 0 ? errors : soft ? [{ instancePath, message: soft }] : [];\n if (messages.length > 0) field = { ...field, invalid: true };\n // A field's own x-help-display wins over the form-level setting; both default\n // to the permanent paragraph every form renders today.\n const help = field.helpDisplay ?? ctx.layout.help ?? \"inline\";\n let label: ReactNode = (\n <FieldLabel field={field} fieldId={fieldId} size={ctx.size} helpDisplay={help} />\n );\n // A field's `x-layout: inline|stack` overrides the form-level layout for its\n // own value subtree (the field's own row keeps the parent layout). \"table\" is\n // handled structurally inside the array/string-map controls, not here.\n const overrideMode =\n field.layout === \"inline\" ? \"inline\" : field.layout === \"stack\" ? \"stacked\" : undefined;\n const valueCtx: RenderContext = {\n ...ctx,\n instancePath,\n ...(overrideMode ? { layout: { ...ctx.layout, mode: overrideMode } } : {}),\n };\n let value: ReactNode = renderValueControl(field, valueCtx);\n const postCtx = {\n ...(ctx.rootValue ? { rootValue: ctx.rootValue } : {}),\n ...(ctx.onRootChange ? { onRootChange: ctx.onRootChange } : {}),\n instancePath,\n };\n ({ label, value } = applyPostExtensions(\n field,\n { label, value },\n ctx.post,\n postCtx,\n ));\n return { field, fieldId, label, value, messages, help };\n}\n\n// renderFieldNodes runs the full pipeline and returns the raw {label, value}\n// nodes (no FieldWrapper). Used where the caller arranges layout itself — map\n// rows (value only) and scalar array items.\nexport function renderFieldNodes(\n args: FieldArgs,\n ctx: RenderContext,\n): { label: ReactNode; value: ReactNode } | null {\n const built = buildField(args, ctx);\n if (!built) return null;\n return {\n label: built.label,\n value:\n built.messages.length > 0 ? (\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n {built.value}\n <FieldErrorText id={fieldErrorId(built.fieldId)} errors={built.messages} />\n </div>\n ) : (\n built.value\n ),\n };\n}\n\n// renderFieldRow runs the pipeline and wraps it in a FieldWrapper with the soft\n// validation hint. `labelOverride` lets a container relabel a field that has no\n// natural key (e.g. array items → \"Item 1\").\nexport function renderFieldRow(\n args: FieldArgs,\n ctx: RenderContext,\n opts?: { labelOverride?: string },\n): ReactNode | null {\n const built = buildField(args, ctx);\n if (!built) return null;\n const { field } = built;\n // Object fields — and table-laid-out arrays/string-maps — render as a flat\n // section: a header followed by their body at full width, rather than an\n // inline label + narrow value column. This keeps deep schemas (e.g. policy →\n // shape, asfile → params) readable as a single column of labelled sections,\n // and gives a `x-layout: \"table\"` array the full width its columns need\n // instead of cramming it into the inline value column.\n // An accordion joins this list: crammed into the 600px inline value column it\n // is unusable, and it needs the ObjectSection header to carry the array's own\n // title, required marker and help. Cards are the same shape of thing — a\n // full-width stack of item panels — so they join it too.\n if (\n field.kind === \"object\" ||\n field.layout === \"table\" ||\n field.arrayDisplay === \"accordion\" ||\n field.arrayDisplay === \"cards\"\n ) {\n return (\n <ObjectSection\n label={opts?.labelOverride ?? field.label}\n required={field.required}\n size={ctx.size}\n helpDisplay={built.help}\n {...(field.badge ? { badge: field.badge } : {})}\n {...(field.helper ? { helper: field.helper } : {})}\n {...(field.labelIcon != null ? { labelIcon: field.labelIcon } : {})}\n >\n <FieldErrorText\n id={fieldErrorId(built.fieldId)}\n errors={built.messages}\n className=\"min-w-0 break-words\"\n />\n {built.value}\n </ObjectSection>\n );\n }\n // A display field (heading/divider/info/spacer) is the label — it carries no\n // value column, so it spans the full grid width with no inline label cell.\n if (field.kind === \"display\") {\n return <div className=\"col-span-full\">{built.value}</div>;\n }\n const label = opts?.labelOverride ? (\n <span className={cn(\"flex items-center gap-2 font-medium\", labelSizeClass[ctx.size])}>\n <LabelIcon icon={field.labelIcon} className=\"text-[15px] text-muted-foreground\" />\n <span>{opts.labelOverride}</span>\n {field.required && <span className=\"text-destructive\">*</span>}\n {field.badge && (\n <span className=\"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground\">\n {field.badge}\n </span>\n )}\n {/* Without this the `?` silently disappears for relabelled rows (array\n items), taking the description with it — FieldWrapper has already\n dropped the paragraph by then. */}\n {built.help === \"hover\" && field.helper && (\n <HelpHint label={opts.labelOverride} helper={field.helper} />\n )}\n </span>\n ) : (\n built.label\n );\n // One rendering path for both sources, so the soft hint lands in the same\n // fieldErrorId element the control's aria-describedby already points at.\n const err =\n built.messages.length > 0 ? (\n <FieldErrorMessages id={fieldErrorId(built.fieldId)} errors={built.messages} />\n ) : undefined;\n return (\n <FieldWrapper\n layout={ctx.layout}\n size={ctx.size}\n label={label}\n value={built.value}\n {...(field.colSpan === \"full\" ? { maxWidth: \"none\" } : {})}\n {...(field.helper && built.help !== \"hover\" ? { helper: field.helper } : {})}\n {...(err ? { error: err } : {})}\n />\n );\n}\n\n// renderObjectFields maps an object subschema's effective properties to field\n// rows. It is the recursive heart, shared by the top-level form and the nested\n// ObjectControl. Edits spread immutably onto the object.\nexport function renderObjectFields(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n onChange: (next: Record<string, unknown>) => void,\n ctx: RenderContext,\n opts?: { hiddenKeys?: string[] },\n): ReactNode[] {\n const { properties, required } = effectiveProperties(schema, value);\n const hidden = new Set(opts?.hiddenKeys ?? []);\n // Per-property `x-clicky-order` wins (composes across merged branches); the\n // object-level `x-order` array is the fallback; document order otherwise.\n const ordered = orderByClickyOrder(orderByXOrder(Object.entries(properties), schema[\"x-order\"]));\n const sorted =\n ctx.sortMode === \"required-first\"\n ? orderRequiredFirst(ordered, required)\n : ctx.sortMode === \"priority\"\n ? orderByPriority(ordered, required, value)\n : ordered;\n // The field filter narrows only the outermost object level (depth 0); nested\n // object subtrees render in full so a matched parent keeps all its children.\n const entries =\n ctx.depth === 0 && ctx.fieldFilter\n ? sorted.filter(([key, prop]) => matchesFieldFilter(key, prop, ctx.fieldFilter!))\n : sorted;\n // Object-level `x-columns` lays the fields out in a multi-column stacked grid;\n // each field spans `x-col-span` columns (object sections/table arrays span the\n // full row). Only takes effect in stacked mode — inline owns its 2-track grid.\n const columns = ctx.layout.mode === \"inline\" ? 1 : normalizeColumns(schema[\"x-columns\"]);\n return entries.flatMap(([key, prop]) => {\n if (hidden.has(key)) return [];\n const row = renderFieldRow(\n {\n key,\n prop,\n required: required.includes(key),\n value: value[key],\n onChange: (next) => onChange({ ...value, [key]: next }),\n instancePath: appendInstancePath(ctx.instancePath, key),\n },\n ctx,\n );\n if (!row) return [];\n if (columns === \"auto\" || columns > 1) {\n const span = rendersFullWidth(prop)\n ? \"full\"\n : normalizeColSpan(prop[\"x-col-span\"], columns);\n return [\n <div\n key={key}\n // Under \"auto\" the track count only exists at layout time, so a\n // full-width field must say `1 / -1` rather than span a number.\n style={{\n gridColumn: span === \"full\" ? \"1 / -1\" : `span ${span} / span ${span}`,\n }}\n >\n {row}\n </div>,\n ];\n }\n // `contents` keeps the keyed wrapper out of the box tree so the row's own\n // node (a subgrid FieldWrapper or a full-width ObjectSection) is a direct\n // child of the FieldsGrid and snaps to its label/value tracks.\n return [<div key={key} className=\"contents\">{row}</div>];\n });\n}\n\n// rendersFullWidth reports whether a property renders as a full-width block\n// (a structured object → ObjectSection, or an `x-layout: \"table\"` array/map) so\n// a multi-column grid gives it the whole row instead of a single column.\nfunction rendersFullWidth(prop: JsonSchemaProperty): boolean {\n const fixedProperties = effectiveProperties(prop as JsonSchemaObject, {}).properties;\n if (schemaRendersAsObject(prop) && (prop.properties !== undefined || Object.keys(fixedProperties).length > 0)) {\n return true;\n }\n return (\n prop[\"x-layout\"] === \"table\" ||\n prop[\"x-array-display\"] === \"accordion\" ||\n prop[\"x-array-display\"] === \"cards\"\n );\n}\n\n// renderApi is the RenderContext injection bundle: the root form stores it on\n// the context so container controls can recurse without importing this module.\nexport const renderApi: RenderApi = {\n renderFieldNodes,\n renderFieldRow,\n renderObjectFields,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA4DO,SAAS,mBAAmB,OAAqB,KAA+B;AAGrF,QAAM,UAAU,aAAa,IAAI,cAAc,IAAI,QAAQ;AAQ3D,MAAI,MAAM,YAAY,CAAC,sBAAsB,MAAM,IAAI,GAAG;AACxD,+BAAQ,eAAA,EAAc,OAAc,SAAkB,MAAM,IAAI,MAAM;AAAA,EACxE;AACA,QAAM,WAAW,IAAI,YAAY,MAAM,aAAa;AACpD,QAAM,OAAO,IAAI;AACjB,UAAQ,MAAM,MAAA;AAAA,IACZ,KAAK;AACH,aAAO,oBA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IAAI,WAAW,IAAI;AAAA,YAAA;AAAA,YAGrE,UAAA;AAAA,UAAA;AAAA,UAPI;AAAA,QAAA;AAAA,MAQP;AAAA,IAEJ;AAIA,WAAO,CAAC,oBAAC,OAAA,EAAc,WAAU,YAAY,UAAA,OAA3B,GAA+B,CAAM;AAAA,EACzD,CAAC;AACH;AAKA,SAAS,iBAAiB,MAAmC;AAC3D,QAAM,kBAAkB,oBAAoB,MAA0B,CAAA,CAAE,EAAE;AAC1E,MAAI,sBAAsB,IAAI,MAAM,KAAK,eAAe,UAAa,OAAO,KAAK,eAAe,EAAE,SAAS,IAAI;AAC7G,WAAO;AAAA,EACT;AACA,SACE,KAAK,UAAU,MAAM,WACrB,KAAK,iBAAiB,MAAM,eAC5B,KAAK,iBAAiB,MAAM;AAEhC;AAIO,MAAM,YAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF;"}
|
|
@@ -62,7 +62,7 @@ function enumDisplay(prop) {
|
|
|
62
62
|
}
|
|
63
63
|
function arrayDisplay(prop) {
|
|
64
64
|
const d = prop["x-array-display"];
|
|
65
|
-
return d === "filter-pills" || d === "accordion" ? d : void 0;
|
|
65
|
+
return d === "filter-pills" || d === "accordion" || d === "cards" ? d : void 0;
|
|
66
66
|
}
|
|
67
67
|
function helpDisplay(prop) {
|
|
68
68
|
const d = prop["x-help-display"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-resolve.cjs","sources":["../../src/components/json-schema-form-resolve.ts"],"sourcesContent":["import { createElement, type ReactNode } from \"react\";\nimport type {\n ArrayDisplay,\n EnumDisplay,\n FieldControl,\n FieldOption,\n HelpDisplay,\n JsonSchemaObject,\n JsonSchemaProperty,\n LookupDescriptor,\n} from \"./json-schema-form-types\";\nimport { LabelIcon } from \"../data/Icon\";\nimport { resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { isFieldTone } from \"./json-schema-form-tone\";\nimport { isPlainObject } from \"./json-schema-form-utils\";\n\n// isOpenStringMap reports whether a property is an object whose entries are\n// described by a sub-schema in `additionalProperties` (a typed key/value map) or\n// by `patternProperties` (a per-key-pattern value map). Either makes it an\n// editable key/value control rather than a fixed-property sub-form.\nexport function isOpenStringMap(prop: JsonSchemaProperty): boolean {\n if (!schemaRendersAsObject(prop)) return false;\n if (\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ) {\n return true;\n }\n return (\n !!prop.patternProperties && Object.keys(prop.patternProperties).length > 0\n );\n}\n\n// patternSchemasOf compiles a schema's `patternProperties` into the ordered\n// {pattern, schema} list the string-map control matches keys against.\nfunction patternSchemasOf(\n prop: JsonSchemaProperty,\n): { pattern: string; schema: JsonSchemaProperty }[] | undefined {\n const pp = prop.patternProperties;\n if (!pp || Object.keys(pp).length === 0) return undefined;\n return Object.entries(pp).map(([pattern, schema]) => ({ pattern, schema }));\n}\n\nfunction schemaHasType(prop: JsonSchemaProperty, type: string): boolean {\n if (Array.isArray(prop.type)) return prop.type.includes(type as never);\n return prop.type === type;\n}\n\n// schemaRendersAsObject accepts schemas that omit `type` but use object-only\n// keywords, including composed schemas whose local refs were rehydrated into\n// unconditional allOf members. An explicit incompatible type always wins.\nexport function schemaRendersAsObject(prop: JsonSchemaProperty): boolean {\n if (schemaHasType(prop, \"object\")) return true;\n if (prop.type !== undefined) return false;\n if (\n prop.properties !== undefined ||\n prop.required !== undefined ||\n prop.additionalProperties !== undefined ||\n prop.patternProperties !== undefined ||\n prop.propertyNames !== undefined ||\n prop.unevaluatedProperties !== undefined\n ) {\n return true;\n }\n return (\n prop.allOf?.some(\n (clause) =>\n clause.if === undefined &&\n clause.then === undefined &&\n schemaRendersAsObject(clause as JsonSchemaProperty),\n ) ?? false\n );\n}\n\nfunction enumOptions(prop: JsonSchemaProperty): FieldOption[] {\n const labels = prop[\"x-enum-labels\"];\n const icons = prop[\"x-enum-icons\"];\n const descriptions = prop[\"x-enum-descriptions\"];\n const tones = prop[\"x-enum-tones\"];\n return (prop.enum ?? []).map((v) => {\n const value = String(v);\n const desc = labels?.[value];\n const icon = icons?.[value];\n const description = descriptions?.[value];\n const tone = tones?.[value];\n return {\n value,\n label:\n typeof desc === \"string\" && desc && desc !== value\n ? `${desc} (${value})`\n : value,\n ...(typeof icon === \"string\" && icon ? { icon } : {}),\n ...(typeof description === \"string\" && description\n ? { description }\n : {}),\n ...(isFieldTone(tone) ? { tone } : {}),\n };\n });\n}\n\n// enumDisplay resolves how an enum should render: an explicit `x-enum-display`\n// wins; otherwise an enum carrying `x-enum-icons` defaults to the icon grid.\n// Returns undefined to keep the combobox default.\nfunction enumDisplay(prop: JsonSchemaProperty): EnumDisplay | undefined {\n const d = prop[\"x-enum-display\"];\n if (d === \"combobox\" || d === \"radio\" || d === \"grid\" || d === \"segmented\")\n return d;\n const icons = prop[\"x-enum-icons\"];\n if (icons && Object.keys(icons).length > 0) return \"grid\";\n return undefined;\n}\n\nfunction arrayDisplay(prop: JsonSchemaProperty): ArrayDisplay | undefined {\n const d = prop[\"x-array-display\"];\n return d === \"filter-pills\" || d === \"accordion\" ? d : undefined;\n}\n\n// helpDisplay reads the per-field `x-help-display` override. Returns undefined\n// to defer to the form-level FormLayout.help.\nfunction helpDisplay(prop: JsonSchemaProperty): HelpDisplay | undefined {\n const d = prop[\"x-help-display\"];\n return d === \"inline\" || d === \"hover\" ? d : undefined;\n}\n\nexport function schemaHelper(prop: JsonSchemaProperty): string | undefined {\n const description =\n typeof prop.description === \"string\" ? prop.description.trim() : \"\";\n const help = prop[\"x-help\"];\n const helpBody =\n isPlainObject(help) && typeof help.body === \"string\"\n ? help.body.trim()\n : \"\";\n\n if (description && helpBody && helpBody !== description) {\n return `${description} ${helpBody}`;\n }\n return description || helpBody || undefined;\n}\n\n// adornmentNode builds a prefix/suffix node from the x-input-*[-icon] extensions:\n// a runtime icon name wins, else static text. Returns undefined when neither set.\nfunction adornmentNode(iconName: unknown, text: unknown): ReactNode {\n if (typeof iconName === \"string\" && iconName) {\n // Match the library's InputField field-icon convention (16px, muted/70) so a\n // schema-driven field lines up with a hand-built one.\n return createElement(LabelIcon, {\n icon: iconName,\n className: \"size-4 text-muted-foreground/70\",\n });\n }\n if (typeof text === \"string\" && text) {\n return createElement(\n \"span\",\n { className: \"text-sm text-muted-foreground\" },\n text,\n );\n }\n return undefined;\n}\n\n// enumBranch returns the first anyOf/oneOf member carrying a non-empty `enum`,\n// for a union of \"an enum value OR a free-form string\" (e.g. a value-or-token\n// field). It lets such a union render as a dropdown. Returns undefined when no\n// branch enumerates values.\nexport function enumBranch(\n prop: JsonSchemaProperty,\n): JsonSchemaProperty | undefined {\n for (const branch of [...(prop.anyOf ?? []), ...(prop.oneOf ?? [])]) {\n if (Array.isArray(branch.enum) && branch.enum.length > 0) return branch;\n }\n return undefined;\n}\n\n// lookupDescriptor reads the `x-clicky-lookup` extension into a LookupDescriptor,\n// returning undefined when the keyword is absent or lacks its required url/filter.\nfunction lookupDescriptor(\n prop: JsonSchemaProperty,\n): LookupDescriptor | undefined {\n const raw = prop[\"x-clicky-lookup\"];\n if (!raw || typeof raw !== \"object\") return undefined;\n const d = raw as Record<string, unknown>;\n if (typeof d.url !== \"string\" || typeof d.filter !== \"string\")\n return undefined;\n return raw as LookupDescriptor;\n}\n\nexport interface ResolveControlArgs {\n key: string;\n prop: JsonSchemaProperty;\n required: boolean;\n value: unknown;\n onChange: (next: unknown) => void;\n}\n\n// resolveControl infers a base, render-ready FieldControl from a property\n// schema. It keys off schema keywords only — never the field name: ascode/token\n// heuristics are layered on by consumer pre-extensions. The one exception is the\n// standard `format: date`/`date-time` keyword, which is a schema-declared signal\n// (not a name guess) and so drives a date control directly. First match wins.\nexport function resolveControl(args: ResolveControlArgs): FieldControl {\n const { key, prop, required, value, onChange } = args;\n const labelIcon = prop[\"x-icon\"];\n const xLayout = prop[\"x-layout\"];\n const explicitLayout =\n xLayout === \"inline\" || xLayout === \"stack\" || xLayout === \"table\"\n ? xLayout\n : undefined;\n // `x-label-position` is a friendlier alias over the same per-field layout knob:\n // \"top\" stacks the label above the value; \"left\" forces inline. `x-layout` wins.\n const labelPosition = prop[\"x-label-position\"];\n const layout =\n explicitLayout ??\n (labelPosition === \"top\"\n ? \"stack\"\n : labelPosition === \"left\"\n ? \"inline\"\n : undefined);\n const prefix = adornmentNode(\n prop[\"x-input-prefix-icon\"],\n prop[\"x-input-prefix\"],\n );\n const suffix = adornmentNode(\n prop[\"x-input-suffix-icon\"],\n prop[\"x-input-suffix\"],\n );\n const labelClassName =\n typeof prop[\"x-label-classes\"] === \"string\"\n ? prop[\"x-label-classes\"]\n : undefined;\n const inputClassName =\n typeof prop[\"x-input-classes\"] === \"string\"\n ? prop[\"x-input-classes\"]\n : undefined;\n const colSpan =\n prop[\"x-col-span\"] === \"full\"\n ? (\"full\" as const)\n : typeof prop[\"x-col-span\"] === \"number\" &&\n Number.isFinite(prop[\"x-col-span\"])\n ? prop[\"x-col-span\"]\n : undefined;\n const keyOptions = keyOptionsFor(prop);\n const helper = schemaHelper(prop);\n const helpMode = helpDisplay(prop);\n const base: FieldControl = {\n key,\n kind: \"string\",\n label: typeof prop.title === \"string\" && prop.title ? prop.title : key,\n required,\n schema: prop,\n value,\n onChange,\n ...(prop.readOnly === true ? { readOnly: true } : {}),\n ...(typeof prop.description === \"string\"\n ? { description: prop.description }\n : {}),\n ...(helper ? { helper } : {}),\n ...(helpMode ? { helpDisplay: helpMode } : {}),\n ...(labelIcon != null && labelIcon !== \"\"\n ? { labelIcon: labelIcon as FieldControl[\"labelIcon\"] }\n : {}),\n ...(layout ? { layout } : {}),\n ...(prefix ? { prefix } : {}),\n ...(suffix ? { suffix } : {}),\n ...(labelClassName ? { labelClassName } : {}),\n ...(inputClassName ? { inputClassName } : {}),\n ...(colSpan != null ? { colSpan } : {}),\n };\n\n // An `x-clicky-lookup` field is an async entity-reference picker: options load\n // lazily from another entity's list endpoint. Single-select also allows\n // free-form entry so a typed value outside the option set still commits.\n const lookup = lookupDescriptor(prop);\n if (lookup) {\n return {\n ...base,\n kind: \"lookup\",\n lookup,\n options: [],\n allowCustomValue: lookup.multi !== true,\n };\n }\n if (Array.isArray(prop.enum) && prop.enum.length > 0) {\n const display = enumDisplay(prop);\n return {\n ...base,\n kind: \"enum\",\n options: enumOptions(prop),\n ...(display ? { display } : {}),\n };\n }\n // A value-or-template union: the enum lives in an anyOf/oneOf branch alongside\n // free-form branches. Render it as a dropdown using that branch's enum; the\n // free-form branches are honoured via a consumer's allowCustomValue pre-ext.\n const branch = enumBranch(prop);\n if (branch) {\n return { ...base, kind: \"enum\", options: enumOptions(branch) };\n }\n // A schema-declared date/date-time string renders as a date control.\n if (prop.format === \"date\" || prop.format === \"date-time\") {\n return { ...base, kind: \"date\", dateFormat: prop.format };\n }\n // A long-form string declares `format: textarea` to render a multi-line box.\n if (prop.format === \"textarea\" && schemaHasType(prop, \"string\")) {\n return { ...base, kind: \"textarea\" };\n }\n // A markdown string declares `format: md` to render the MDXEditor-backed\n // editor. Plugin toggles live under `x-md-editor` so schema authors can keep\n // the format signal standard-sized and the editor behavior explicit.\n if (prop.format === \"md\" && schemaHasType(prop, \"string\")) {\n const markdownOptions = prop[\"x-md-editor\"];\n return {\n ...base,\n kind: \"markdown\",\n ...(isPlainObject(markdownOptions) ? { markdownOptions } : {}),\n };\n }\n if (schemaHasType(prop, \"boolean\")) {\n return { ...base, kind: \"boolean\" };\n }\n if (schemaHasType(prop, \"integer\") || schemaHasType(prop, \"number\")) {\n return {\n ...base,\n kind: \"number\",\n coerceNumber: true,\n // A percent number carries a static \"%\" unit shown inside the input.\n ...(prop.format === \"percent\" ? { unit: \"%\" } : {}),\n ...(typeof prop.minimum === \"number\" ? { minimum: prop.minimum } : {}),\n };\n }\n if (schemaHasType(prop, \"array\")) {\n const display = arrayDisplay(prop);\n const itemSchema = prop.items;\n return {\n ...base,\n kind: \"array\",\n ...(itemSchema ? { itemSchema } : {}),\n ...(display ? { arrayDisplay: display } : {}),\n ...(display === \"accordion\" ? { itemSpec: resolveItemSpec(prop, itemSchema) } : {}),\n // An accordion reuses the array's description as the zero-item copy in its\n // add row, so a paragraph of the same sentence directly above would be a\n // literal duplicate. The schema can still say otherwise.\n ...(display === \"accordion\" && !helpMode ? { helpDisplay: \"hover\" as const } : {}),\n ...(display && itemSchema && Array.isArray(itemSchema.enum)\n ? { options: enumOptions(itemSchema) }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // An open map: object whose entries are described by an additionalProperties\n // sub-schema and/or per-key patternProperties. Renders as editable key/value\n // rows (+ any known properties), with the value form resolved per key.\n if (isOpenStringMap(prop)) {\n const addl =\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ? (prop.additionalProperties as JsonSchemaProperty)\n : undefined;\n const patterns = patternSchemasOf(prop);\n // A constrained picker (propertyNames enum) or patternProperties still lets\n // the author ADD keys — the additions are limited to the allowed set, not\n // free-form — so `additionalProperties: false` doesn't disable \"Add field\"\n // in that case. It only closes a plain open map with no key constraints.\n const allowExtraKeys =\n keyOptions || patterns ? true : prop.additionalProperties !== false;\n return {\n ...base,\n kind: \"string-map\",\n ...(addl ? { valueSchema: addl } : {}),\n ...(patterns ? { valuePatternSchemas: patterns } : {}),\n ...(prop.properties ? { knownProperties: prop.properties } : {}),\n allowExtraKeys,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // A structured object: fixed `properties`, not an open map. Renders as a\n // nested sub-form (labels, required, if/then) — recursed into by the renderer.\n if (schemaRendersAsObject(prop)) {\n const valueObject = isPlainObject(value) ? value : {};\n const objectFields = effectiveProperties(\n prop as JsonSchemaObject,\n valueObject,\n );\n if (Object.keys(objectFields.properties).length > 0 || prop.properties) {\n return {\n ...base,\n kind: \"object\",\n objectProperties: objectFields.properties,\n ...(objectFields.required.length > 0\n ? { objectRequired: objectFields.required }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n }\n // A bare object with neither properties nor an additionalProperties schema:\n // treat as an open string map unless explicitly closed.\n if (schemaRendersAsObject(prop)) {\n return {\n ...base,\n kind: \"string-map\",\n allowExtraKeys: prop.additionalProperties !== false,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n return base;\n}\n\n// keyOptionsFor resolves the strict map-key picker options from a map schema's\n// `propertyNames.enum` (e.g. an AsCode-constrained key set). Returns undefined\n// when the keys are unconstrained, so the key stays free-text.\nfunction keyOptionsFor(prop: JsonSchemaProperty): FieldOption[] | undefined {\n const pn = prop.propertyNames as JsonSchemaProperty | undefined;\n if (!pn || !Array.isArray(pn.enum) || pn.enum.length === 0) return undefined;\n return enumOptions(pn);\n}\n\n// isScalarStringItems reports whether an array's item schema is a plain string\n// with no richer shape — the case the array control renders as compact tags.\n// Anything with an enum/const/properties/items/additionalProperties/allOf needs\n// a real per-item control instead.\nexport function isScalarStringItems(\n items: JsonSchemaProperty | undefined,\n): boolean {\n if (!items) return true; // untyped items default to string tags\n if (items.type !== undefined && !schemaHasType(items, \"string\")) return false;\n return (\n items.enum === undefined &&\n items.const === undefined &&\n items.properties === undefined &&\n items.items === undefined &&\n items.additionalProperties === undefined &&\n items.allOf === undefined\n );\n}\n\n// matchesIf reports whether the `if` sub-schema holds for the current value:\n// every `if.required` key is present AND every `if.properties[k].const` equals\n// value[k].\nexport function matchesIf(\n ifSchema: JsonSchemaProperty | undefined,\n value: Record<string, unknown>,\n): boolean {\n if (!ifSchema) return false;\n for (const k of ifSchema.required ?? []) {\n if (!(k in value)) return false;\n }\n for (const [k, sub] of Object.entries(ifSchema.properties ?? {})) {\n if (\"const\" in sub && value[k] !== sub.const) return false;\n }\n return true;\n}\n\nexport interface EffectiveProperties {\n properties: Record<string, JsonSchemaProperty>;\n required: string[];\n}\n\n// applySchemaDefaults fills missing values from JSON Schema `default` keywords.\n// It walks fixed object properties recursively and re-evaluates `if`/`then`\n// branches after each pass, so a defaulted discriminator can activate defaults\n// in its selected branch. Existing values, including null and empty strings, are\n// never replaced. The original value is returned when no defaults apply.\nexport function applySchemaDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): Record<string, unknown> {\n return applyObjectDefaults(schema, value, new Set());\n}\n\nfunction applyObjectDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n ancestors: Set<JsonSchemaObject>,\n): Record<string, unknown> {\n // Recursive schemas may point back to an ancestor after refs are hydrated.\n if (ancestors.has(schema)) return value;\n const nextAncestors = new Set(ancestors).add(schema);\n let next = value;\n\n // A default can select another conditional branch, so allow enough passes for\n // a chain of discriminator defaults while keeping malformed schemas bounded.\n const maxPasses = Math.min(\n 100,\n Object.keys(schema.properties ?? {}).length +\n (schema.allOf?.length ?? 0) +\n 2,\n );\n for (let pass = 0; pass < maxPasses; pass += 1) {\n const { properties } = effectiveProperties(schema, next);\n let passChanged = false;\n let passValue = next;\n\n for (const [key, propertySchema] of Object.entries(properties)) {\n const existing = passValue[key];\n let fieldValue = existing;\n let fieldChanged = false;\n\n if (existing === undefined && propertySchema.default !== undefined) {\n fieldValue = cloneSchemaDefault(propertySchema.default);\n fieldChanged = true;\n }\n\n const structuredObject = schemaRendersAsObject(propertySchema);\n if (structuredObject && !isOpenStringMap(propertySchema)) {\n const objectValue = isPlainObject(fieldValue)\n ? (fieldValue as Record<string, unknown>)\n : {};\n const defaultedObject = applyObjectDefaults(\n propertySchema as JsonSchemaObject,\n objectValue,\n nextAncestors,\n );\n if (defaultedObject !== objectValue) {\n fieldValue = defaultedObject;\n fieldChanged = true;\n }\n }\n\n if (fieldChanged) {\n if (!passChanged) passValue = { ...next };\n passValue[key] = fieldValue;\n passChanged = true;\n }\n }\n\n if (!passChanged) break;\n next = passValue;\n }\n return next;\n}\n\nfunction cloneSchemaDefault(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(cloneSchemaDefault);\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, entry]) => [\n key,\n cloneSchemaDefault(entry),\n ]),\n );\n }\n return value;\n}\n\n// effectiveProperties merges the schema's base `properties` with each `allOf`\n// member's contribution. An `if`/`then` member contributes `then.properties`\n// only when its `if` matches the current value; an unconditional member (e.g.\n// an inlined `$ref` composition, which carries its own `properties` and no\n// `if`) always contributes. Later members win on key collision; required is the\n// union. Pure and idempotent.\nexport function effectiveProperties(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): EffectiveProperties {\n const properties: Record<string, JsonSchemaProperty> = {\n ...schema.properties,\n };\n const required = new Set(schema.required ?? []);\n for (const clause of schema.allOf ?? []) {\n // Unconditional composition member: merge its own properties/required.\n if (clause.if === undefined && clause.then === undefined) {\n for (const [k, sub] of Object.entries(clause.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of clause.required ?? []) required.add(k);\n continue;\n }\n if (!matchesIf(clause.if, value)) continue;\n const then = clause.then ?? {};\n for (const [k, sub] of Object.entries(then.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of then.required ?? []) required.add(k);\n }\n return { properties, required: [...required] };\n}\n"],"names":["isFieldTone","isPlainObject","createElement","LabelIcon","resolveItemSpec"],"mappings":";;;;;;;AAoBO,SAAS,gBAAgB,MAAmC;AACjE,MAAI,CAAC,sBAAsB,IAAI,EAAG,QAAO;AACzC,MACE,OAAO,KAAK,yBAAyB,YACrC,KAAK,yBAAyB,MAC9B;AACA,WAAO;AAAA,EACT;AACA,SACE,CAAC,CAAC,KAAK,qBAAqB,OAAO,KAAK,KAAK,iBAAiB,EAAE,SAAS;AAE7E;AAIA,SAAS,iBACP,MAC+D;AAC/D,QAAM,KAAK,KAAK;AAChB,MAAI,CAAC,MAAM,OAAO,KAAK,EAAE,EAAE,WAAW,EAAG,QAAO;AAChD,SAAO,OAAO,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,SAAS,SAAS;AAC5E;AAEA,SAAS,cAAc,MAA0B,MAAuB;AACtE,MAAI,MAAM,QAAQ,KAAK,IAAI,EAAG,QAAO,KAAK,KAAK,SAAS,IAAa;AACrE,SAAO,KAAK,S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,aAAW,UAAU,OAAO,SAAS,CAAA,GAAI;AAEvC,QAAI,OAAO,OAAO,UAAa,OAAO,SAAS,QAAW;AACxD,iBAAW,CAAC,GAAG,GAAG,KAAK,OAAO,QAAQ,OAAO,cAAc,CAAA,CAAE,GAAG;AAC9D,mBAAW,CAAC,IAAI;AAAA,MAClB;AACA,iBAAW,KAAK,OAAO,YAAY,CAAA,EAAI,UAAS,IAAI,CAAC;AACrD;AAAA,IACF;AACA,QAAI,CAAC,UAAU,OAAO,IAAI,KAAK,EAAG;AAClC,UAAM,OAAO,OAAO,QAAQ,CAAA;AAC5B,eAAW,CAAC,GAAG,GAAG,KAAK,OAAO,QAAQ,KAAK,cAAc,CAAA,CAAE,GAAG;AAC5D,iBAAW,CAAC,IAAI;AAAA,IAClB;AACA,eAAW,KAAK,KAAK,YAAY,CAAA,EAAI,UAAS,IAAI,CAAC;AAAA,EACrD;AACA,SAAO,EAAE,YAAY,UAAU,CAAC,GAAG,QAAQ,EAAA;AAC7C;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-resolve.cjs","sources":["../../src/components/json-schema-form-resolve.ts"],"sourcesContent":["import { createElement, type ReactNode } from \"react\";\nimport type {\n ArrayDisplay,\n EnumDisplay,\n FieldControl,\n FieldOption,\n HelpDisplay,\n JsonSchemaObject,\n JsonSchemaProperty,\n LookupDescriptor,\n} from \"./json-schema-form-types\";\nimport { LabelIcon } from \"../data/Icon\";\nimport { resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { isFieldTone } from \"./json-schema-form-tone\";\nimport { isPlainObject } from \"./json-schema-form-utils\";\n\n// isOpenStringMap reports whether a property is an object whose entries are\n// described by a sub-schema in `additionalProperties` (a typed key/value map) or\n// by `patternProperties` (a per-key-pattern value map). Either makes it an\n// editable key/value control rather than a fixed-property sub-form.\nexport function isOpenStringMap(prop: JsonSchemaProperty): boolean {\n if (!schemaRendersAsObject(prop)) return false;\n if (\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ) {\n return true;\n }\n return (\n !!prop.patternProperties && Object.keys(prop.patternProperties).length > 0\n );\n}\n\n// patternSchemasOf compiles a schema's `patternProperties` into the ordered\n// {pattern, schema} list the string-map control matches keys against.\nfunction patternSchemasOf(\n prop: JsonSchemaProperty,\n): { pattern: string; schema: JsonSchemaProperty }[] | undefined {\n const pp = prop.patternProperties;\n if (!pp || Object.keys(pp).length === 0) return undefined;\n return Object.entries(pp).map(([pattern, schema]) => ({ pattern, schema }));\n}\n\nfunction schemaHasType(prop: JsonSchemaProperty, type: string): boolean {\n if (Array.isArray(prop.type)) return prop.type.includes(type as never);\n return prop.type === type;\n}\n\n// schemaRendersAsObject accepts schemas that omit `type` but use object-only\n// keywords, including composed schemas whose local refs were rehydrated into\n// unconditional allOf members. An explicit incompatible type always wins.\nexport function schemaRendersAsObject(prop: JsonSchemaProperty): boolean {\n if (schemaHasType(prop, \"object\")) return true;\n if (prop.type !== undefined) return false;\n if (\n prop.properties !== undefined ||\n prop.required !== undefined ||\n prop.additionalProperties !== undefined ||\n prop.patternProperties !== undefined ||\n prop.propertyNames !== undefined ||\n prop.unevaluatedProperties !== undefined\n ) {\n return true;\n }\n return (\n prop.allOf?.some(\n (clause) =>\n clause.if === undefined &&\n clause.then === undefined &&\n schemaRendersAsObject(clause as JsonSchemaProperty),\n ) ?? false\n );\n}\n\nfunction enumOptions(prop: JsonSchemaProperty): FieldOption[] {\n const labels = prop[\"x-enum-labels\"];\n const icons = prop[\"x-enum-icons\"];\n const descriptions = prop[\"x-enum-descriptions\"];\n const tones = prop[\"x-enum-tones\"];\n return (prop.enum ?? []).map((v) => {\n const value = String(v);\n const desc = labels?.[value];\n const icon = icons?.[value];\n const description = descriptions?.[value];\n const tone = tones?.[value];\n return {\n value,\n label:\n typeof desc === \"string\" && desc && desc !== value\n ? `${desc} (${value})`\n : value,\n ...(typeof icon === \"string\" && icon ? { icon } : {}),\n ...(typeof description === \"string\" && description\n ? { description }\n : {}),\n ...(isFieldTone(tone) ? { tone } : {}),\n };\n });\n}\n\n// enumDisplay resolves how an enum should render: an explicit `x-enum-display`\n// wins; otherwise an enum carrying `x-enum-icons` defaults to the icon grid.\n// Returns undefined to keep the combobox default.\nfunction enumDisplay(prop: JsonSchemaProperty): EnumDisplay | undefined {\n const d = prop[\"x-enum-display\"];\n if (d === \"combobox\" || d === \"radio\" || d === \"grid\" || d === \"segmented\")\n return d;\n const icons = prop[\"x-enum-icons\"];\n if (icons && Object.keys(icons).length > 0) return \"grid\";\n return undefined;\n}\n\nfunction arrayDisplay(prop: JsonSchemaProperty): ArrayDisplay | undefined {\n const d = prop[\"x-array-display\"];\n return d === \"filter-pills\" || d === \"accordion\" || d === \"cards\" ? d : undefined;\n}\n\n// helpDisplay reads the per-field `x-help-display` override. Returns undefined\n// to defer to the form-level FormLayout.help.\nfunction helpDisplay(prop: JsonSchemaProperty): HelpDisplay | undefined {\n const d = prop[\"x-help-display\"];\n return d === \"inline\" || d === \"hover\" ? d : undefined;\n}\n\nexport function schemaHelper(prop: JsonSchemaProperty): string | undefined {\n const description =\n typeof prop.description === \"string\" ? prop.description.trim() : \"\";\n const help = prop[\"x-help\"];\n const helpBody =\n isPlainObject(help) && typeof help.body === \"string\"\n ? help.body.trim()\n : \"\";\n\n if (description && helpBody && helpBody !== description) {\n return `${description} ${helpBody}`;\n }\n return description || helpBody || undefined;\n}\n\n// adornmentNode builds a prefix/suffix node from the x-input-*[-icon] extensions:\n// a runtime icon name wins, else static text. Returns undefined when neither set.\nfunction adornmentNode(iconName: unknown, text: unknown): ReactNode {\n if (typeof iconName === \"string\" && iconName) {\n // Match the library's InputField field-icon convention (16px, muted/70) so a\n // schema-driven field lines up with a hand-built one.\n return createElement(LabelIcon, {\n icon: iconName,\n className: \"size-4 text-muted-foreground/70\",\n });\n }\n if (typeof text === \"string\" && text) {\n return createElement(\n \"span\",\n { className: \"text-sm text-muted-foreground\" },\n text,\n );\n }\n return undefined;\n}\n\n// enumBranch returns the first anyOf/oneOf member carrying a non-empty `enum`,\n// for a union of \"an enum value OR a free-form string\" (e.g. a value-or-token\n// field). It lets such a union render as a dropdown. Returns undefined when no\n// branch enumerates values.\nexport function enumBranch(\n prop: JsonSchemaProperty,\n): JsonSchemaProperty | undefined {\n for (const branch of [...(prop.anyOf ?? []), ...(prop.oneOf ?? [])]) {\n if (Array.isArray(branch.enum) && branch.enum.length > 0) return branch;\n }\n return undefined;\n}\n\n// lookupDescriptor reads the `x-clicky-lookup` extension into a LookupDescriptor,\n// returning undefined when the keyword is absent or lacks its required url/filter.\nfunction lookupDescriptor(\n prop: JsonSchemaProperty,\n): LookupDescriptor | undefined {\n const raw = prop[\"x-clicky-lookup\"];\n if (!raw || typeof raw !== \"object\") return undefined;\n const d = raw as Record<string, unknown>;\n if (typeof d.url !== \"string\" || typeof d.filter !== \"string\")\n return undefined;\n return raw as LookupDescriptor;\n}\n\nexport interface ResolveControlArgs {\n key: string;\n prop: JsonSchemaProperty;\n required: boolean;\n value: unknown;\n onChange: (next: unknown) => void;\n}\n\n// resolveControl infers a base, render-ready FieldControl from a property\n// schema. It keys off schema keywords only — never the field name: ascode/token\n// heuristics are layered on by consumer pre-extensions. The one exception is the\n// standard `format: date`/`date-time` keyword, which is a schema-declared signal\n// (not a name guess) and so drives a date control directly. First match wins.\nexport function resolveControl(args: ResolveControlArgs): FieldControl {\n const { key, prop, required, value, onChange } = args;\n const labelIcon = prop[\"x-icon\"];\n const xLayout = prop[\"x-layout\"];\n const explicitLayout =\n xLayout === \"inline\" || xLayout === \"stack\" || xLayout === \"table\"\n ? xLayout\n : undefined;\n // `x-label-position` is a friendlier alias over the same per-field layout knob:\n // \"top\" stacks the label above the value; \"left\" forces inline. `x-layout` wins.\n const labelPosition = prop[\"x-label-position\"];\n const layout =\n explicitLayout ??\n (labelPosition === \"top\"\n ? \"stack\"\n : labelPosition === \"left\"\n ? \"inline\"\n : undefined);\n const prefix = adornmentNode(\n prop[\"x-input-prefix-icon\"],\n prop[\"x-input-prefix\"],\n );\n const suffix = adornmentNode(\n prop[\"x-input-suffix-icon\"],\n prop[\"x-input-suffix\"],\n );\n const labelClassName =\n typeof prop[\"x-label-classes\"] === \"string\"\n ? prop[\"x-label-classes\"]\n : undefined;\n const inputClassName =\n typeof prop[\"x-input-classes\"] === \"string\"\n ? prop[\"x-input-classes\"]\n : undefined;\n const colSpan =\n prop[\"x-col-span\"] === \"full\"\n ? (\"full\" as const)\n : typeof prop[\"x-col-span\"] === \"number\" &&\n Number.isFinite(prop[\"x-col-span\"])\n ? prop[\"x-col-span\"]\n : undefined;\n const keyOptions = keyOptionsFor(prop);\n const helper = schemaHelper(prop);\n const helpMode = helpDisplay(prop);\n const base: FieldControl = {\n key,\n kind: \"string\",\n label: typeof prop.title === \"string\" && prop.title ? prop.title : key,\n required,\n schema: prop,\n value,\n onChange,\n ...(prop.readOnly === true ? { readOnly: true } : {}),\n ...(typeof prop.description === \"string\"\n ? { description: prop.description }\n : {}),\n ...(helper ? { helper } : {}),\n ...(helpMode ? { helpDisplay: helpMode } : {}),\n ...(labelIcon != null && labelIcon !== \"\"\n ? { labelIcon: labelIcon as FieldControl[\"labelIcon\"] }\n : {}),\n ...(layout ? { layout } : {}),\n ...(prefix ? { prefix } : {}),\n ...(suffix ? { suffix } : {}),\n ...(labelClassName ? { labelClassName } : {}),\n ...(inputClassName ? { inputClassName } : {}),\n ...(colSpan != null ? { colSpan } : {}),\n };\n\n // An `x-clicky-lookup` field is an async entity-reference picker: options load\n // lazily from another entity's list endpoint. Single-select also allows\n // free-form entry so a typed value outside the option set still commits.\n const lookup = lookupDescriptor(prop);\n if (lookup) {\n return {\n ...base,\n kind: \"lookup\",\n lookup,\n options: [],\n allowCustomValue: lookup.multi !== true,\n };\n }\n if (Array.isArray(prop.enum) && prop.enum.length > 0) {\n const display = enumDisplay(prop);\n return {\n ...base,\n kind: \"enum\",\n options: enumOptions(prop),\n ...(display ? { display } : {}),\n };\n }\n // A value-or-template union: the enum lives in an anyOf/oneOf branch alongside\n // free-form branches. Render it as a dropdown using that branch's enum; the\n // free-form branches are honoured via a consumer's allowCustomValue pre-ext.\n const branch = enumBranch(prop);\n if (branch) {\n return { ...base, kind: \"enum\", options: enumOptions(branch) };\n }\n // A schema-declared date/date-time string renders as a date control.\n if (prop.format === \"date\" || prop.format === \"date-time\") {\n return { ...base, kind: \"date\", dateFormat: prop.format };\n }\n // A long-form string declares `format: textarea` to render a multi-line box.\n if (prop.format === \"textarea\" && schemaHasType(prop, \"string\")) {\n return { ...base, kind: \"textarea\" };\n }\n // A markdown string declares `format: md` to render the MDXEditor-backed\n // editor. Plugin toggles live under `x-md-editor` so schema authors can keep\n // the format signal standard-sized and the editor behavior explicit.\n if (prop.format === \"md\" && schemaHasType(prop, \"string\")) {\n const markdownOptions = prop[\"x-md-editor\"];\n return {\n ...base,\n kind: \"markdown\",\n ...(isPlainObject(markdownOptions) ? { markdownOptions } : {}),\n };\n }\n if (schemaHasType(prop, \"boolean\")) {\n return { ...base, kind: \"boolean\" };\n }\n if (schemaHasType(prop, \"integer\") || schemaHasType(prop, \"number\")) {\n return {\n ...base,\n kind: \"number\",\n coerceNumber: true,\n // A percent number carries a static \"%\" unit shown inside the input.\n ...(prop.format === \"percent\" ? { unit: \"%\" } : {}),\n ...(typeof prop.minimum === \"number\" ? { minimum: prop.minimum } : {}),\n };\n }\n if (schemaHasType(prop, \"array\")) {\n const display = arrayDisplay(prop);\n const itemSchema = prop.items;\n return {\n ...base,\n kind: \"array\",\n ...(itemSchema ? { itemSchema } : {}),\n ...(display ? { arrayDisplay: display } : {}),\n ...(display === \"accordion\" ? { itemSpec: resolveItemSpec(prop, itemSchema) } : {}),\n // An accordion reuses the array's description as the zero-item copy in its\n // add row, so a paragraph of the same sentence directly above would be a\n // literal duplicate. The schema can still say otherwise.\n ...(display === \"accordion\" && !helpMode ? { helpDisplay: \"hover\" as const } : {}),\n ...(display && itemSchema && Array.isArray(itemSchema.enum)\n ? { options: enumOptions(itemSchema) }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // An open map: object whose entries are described by an additionalProperties\n // sub-schema and/or per-key patternProperties. Renders as editable key/value\n // rows (+ any known properties), with the value form resolved per key.\n if (isOpenStringMap(prop)) {\n const addl =\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ? (prop.additionalProperties as JsonSchemaProperty)\n : undefined;\n const patterns = patternSchemasOf(prop);\n // A constrained picker (propertyNames enum) or patternProperties still lets\n // the author ADD keys — the additions are limited to the allowed set, not\n // free-form — so `additionalProperties: false` doesn't disable \"Add field\"\n // in that case. It only closes a plain open map with no key constraints.\n const allowExtraKeys =\n keyOptions || patterns ? true : prop.additionalProperties !== false;\n return {\n ...base,\n kind: \"string-map\",\n ...(addl ? { valueSchema: addl } : {}),\n ...(patterns ? { valuePatternSchemas: patterns } : {}),\n ...(prop.properties ? { knownProperties: prop.properties } : {}),\n allowExtraKeys,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // A structured object: fixed `properties`, not an open map. Renders as a\n // nested sub-form (labels, required, if/then) — recursed into by the renderer.\n if (schemaRendersAsObject(prop)) {\n const valueObject = isPlainObject(value) ? value : {};\n const objectFields = effectiveProperties(\n prop as JsonSchemaObject,\n valueObject,\n );\n if (Object.keys(objectFields.properties).length > 0 || prop.properties) {\n return {\n ...base,\n kind: \"object\",\n objectProperties: objectFields.properties,\n ...(objectFields.required.length > 0\n ? { objectRequired: objectFields.required }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n }\n // A bare object with neither properties nor an additionalProperties schema:\n // treat as an open string map unless explicitly closed.\n if (schemaRendersAsObject(prop)) {\n return {\n ...base,\n kind: \"string-map\",\n allowExtraKeys: prop.additionalProperties !== false,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n return base;\n}\n\n// keyOptionsFor resolves the strict map-key picker options from a map schema's\n// `propertyNames.enum` (e.g. an AsCode-constrained key set). Returns undefined\n// when the keys are unconstrained, so the key stays free-text.\nfunction keyOptionsFor(prop: JsonSchemaProperty): FieldOption[] | undefined {\n const pn = prop.propertyNames as JsonSchemaProperty | undefined;\n if (!pn || !Array.isArray(pn.enum) || pn.enum.length === 0) return undefined;\n return enumOptions(pn);\n}\n\n// isScalarStringItems reports whether an array's item schema is a plain string\n// with no richer shape — the case the array control renders as compact tags.\n// Anything with an enum/const/properties/items/additionalProperties/allOf needs\n// a real per-item control instead.\nexport function isScalarStringItems(\n items: JsonSchemaProperty | undefined,\n): boolean {\n if (!items) return true; // untyped items default to string tags\n if (items.type !== undefined && !schemaHasType(items, \"string\")) return false;\n return (\n items.enum === undefined &&\n items.const === undefined &&\n items.properties === undefined &&\n items.items === undefined &&\n items.additionalProperties === undefined &&\n items.allOf === undefined\n );\n}\n\n// matchesIf reports whether the `if` sub-schema holds for the current value:\n// every `if.required` key is present AND every `if.properties[k].const` equals\n// value[k].\nexport function matchesIf(\n ifSchema: JsonSchemaProperty | undefined,\n value: Record<string, unknown>,\n): boolean {\n if (!ifSchema) return false;\n for (const k of ifSchema.required ?? []) {\n if (!(k in value)) return false;\n }\n for (const [k, sub] of Object.entries(ifSchema.properties ?? {})) {\n if (\"const\" in sub && value[k] !== sub.const) return false;\n }\n return true;\n}\n\nexport interface EffectiveProperties {\n properties: Record<string, JsonSchemaProperty>;\n required: string[];\n}\n\n// applySchemaDefaults fills missing values from JSON Schema `default` keywords.\n// It walks fixed object properties recursively and re-evaluates `if`/`then`\n// branches after each pass, so a defaulted discriminator can activate defaults\n// in its selected branch. Existing values, including null and empty strings, are\n// never replaced. The original value is returned when no defaults apply.\nexport function applySchemaDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): Record<string, unknown> {\n return applyObjectDefaults(schema, value, new Set());\n}\n\nfunction applyObjectDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n ancestors: Set<JsonSchemaObject>,\n): Record<string, unknown> {\n // Recursive schemas may point back to an ancestor after refs are hydrated.\n if (ancestors.has(schema)) return value;\n const nextAncestors = new Set(ancestors).add(schema);\n let next = value;\n\n // A default can select another conditional branch, so allow enough passes for\n // a chain of discriminator defaults while keeping malformed schemas bounded.\n const maxPasses = Math.min(\n 100,\n Object.keys(schema.properties ?? {}).length +\n (schema.allOf?.length ?? 0) +\n 2,\n );\n for (let pass = 0; pass < maxPasses; pass += 1) {\n const { properties } = effectiveProperties(schema, next);\n let passChanged = false;\n let passValue = next;\n\n for (const [key, propertySchema] of Object.entries(properties)) {\n const existing = passValue[key];\n let fieldValue = existing;\n let fieldChanged = false;\n\n if (existing === undefined && propertySchema.default !== undefined) {\n fieldValue = cloneSchemaDefault(propertySchema.default);\n fieldChanged = true;\n }\n\n const structuredObject = schemaRendersAsObject(propertySchema);\n if (structuredObject && !isOpenStringMap(propertySchema)) {\n const objectValue = isPlainObject(fieldValue)\n ? (fieldValue as Record<string, unknown>)\n : {};\n const defaultedObject = applyObjectDefaults(\n propertySchema as JsonSchemaObject,\n objectValue,\n nextAncestors,\n );\n if (defaultedObject !== objectValue) {\n fieldValue = defaultedObject;\n fieldChanged = true;\n }\n }\n\n if (fieldChanged) {\n if (!passChanged) passValue = { ...next };\n passValue[key] = fieldValue;\n passChanged = true;\n }\n }\n\n if (!passChanged) break;\n next = passValue;\n }\n return next;\n}\n\nfunction cloneSchemaDefault(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(cloneSchemaDefault);\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, entry]) => [\n key,\n cloneSchemaDefault(entry),\n ]),\n );\n }\n return value;\n}\n\n// effectiveProperties merges the schema's base `properties` with each `allOf`\n// member's contribution. An `if`/`then` member contributes `then.properties`\n// only when its `if` matches the current value; an unconditional member (e.g.\n// an inlined `$ref` composition, which carries its own `properties` and no\n// `if`) always contributes. Later members win on key collision; required is the\n// union. Pure and idempotent.\nexport function effectiveProperties(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): EffectiveProperties {\n const properties: Record<string, JsonSchemaProperty> = {\n ...schema.properties,\n };\n const required = new Set(schema.required ?? []);\n for (const clause of schema.allOf ?? []) {\n // Unconditional composition member: merge its own properties/required.\n if (clause.if === undefined && clause.then === undefined) {\n for (const [k, sub] of Object.entries(clause.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of clause.required ?? []) required.add(k);\n continue;\n }\n if (!matchesIf(clause.if, value)) continue;\n const then = clause.then ?? {};\n for (const [k, sub] of Object.entries(then.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of then.required ?? []) required.add(k);\n }\n return { properties, required: [...required] };\n}\n"],"names":["isFieldTone","isPlainObject","createElement","LabelIcon","resolveItemSpec"],"mappings":";;;;;;;AAoBO,SAAS,gBAAgB,MAAmC;AACjE,MAAI,CAAC,sBAAsB,IAAI,EAAG,QAAO;AACzC,MACE,OAAO,KAAK,yBAAyB,YACrC,KAAK,yBAAyB,MAC9B;AACA,WAAO;AAAA,EACT;AACA,SACE,CAAC,CAAC,KAAK,qBAAqB,OAAO,KAAK,KAAK,iBAAiB,EAAE,SAAS;AAE7E;AAIA,SAAS,iBACP,MAC+D;AAC/D,QAAM,KAAK,KAAK;AAChB,MAAI,CAAC,MAAM,OAAO,KAAK,EAAE,EAAE,WAAW,EAAG,QAAO;AAChD,SAAO,OAAO,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,SAAS,SAAS;AAC5E;AAEA,SAAS,cAAc,MAA0B,MAAuB;AACtE,MAAI,MAAM,QAAQ,KAAK,IAAI,EAAG,QAAO,KAAK,KAAK,SAAS,IAAa;AACrE,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,sBAAsB,MAAmC;;AACvE,MAAI,cAAc,MAAM,QAAQ,EAAG,QAAO;AAC1C,MAAI,KAAK,SAAS,OAAW,QAAO;AACpC,MACE,KAAK,eAAe,UACpB,KAAK,aAAa,UAClB,KAAK,yBAAyB,UAC9B,KAAK,sBAAsB,UAC3B,KAAK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ClB;AACA,iBAAW,KAAK,OAAO,YAAY,CAAA,EAAI,UAAS,IAAI,CAAC;AACrD;AAAA,IACF;AACA,QAAI,CAAC,UAAU,OAAO,IAAI,KAAK,EAAG;AAClC,UAAM,OAAO,OAAO,QAAQ,CAAA;AAC5B,eAAW,CAAC,GAAG,GAAG,KAAK,OAAO,QAAQ,KAAK,cAAc,CAAA,CAAE,GAAG;AAC5D,iBAAW,CAAC,IAAI;AAAA,IAClB;AACA,eAAW,KAAK,KAAK,YAAY,CAAA,EAAI,UAAS,IAAI,CAAC;AAAA,EACrD;AACA,SAAO,EAAE,YAAY,UAAU,CAAC,GAAG,QAAQ,EAAA;AAC7C;;;;;;;;;;"}
|
|
@@ -60,7 +60,7 @@ function enumDisplay(prop) {
|
|
|
60
60
|
}
|
|
61
61
|
function arrayDisplay(prop) {
|
|
62
62
|
const d = prop["x-array-display"];
|
|
63
|
-
return d === "filter-pills" || d === "accordion" ? d : void 0;
|
|
63
|
+
return d === "filter-pills" || d === "accordion" || d === "cards" ? d : void 0;
|
|
64
64
|
}
|
|
65
65
|
function helpDisplay(prop) {
|
|
66
66
|
const d = prop["x-help-display"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-resolve.js","sources":["../../src/components/json-schema-form-resolve.ts"],"sourcesContent":["import { createElement, type ReactNode } from \"react\";\nimport type {\n ArrayDisplay,\n EnumDisplay,\n FieldControl,\n FieldOption,\n HelpDisplay,\n JsonSchemaObject,\n JsonSchemaProperty,\n LookupDescriptor,\n} from \"./json-schema-form-types\";\nimport { LabelIcon } from \"../data/Icon\";\nimport { resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { isFieldTone } from \"./json-schema-form-tone\";\nimport { isPlainObject } from \"./json-schema-form-utils\";\n\n// isOpenStringMap reports whether a property is an object whose entries are\n// described by a sub-schema in `additionalProperties` (a typed key/value map) or\n// by `patternProperties` (a per-key-pattern value map). Either makes it an\n// editable key/value control rather than a fixed-property sub-form.\nexport function isOpenStringMap(prop: JsonSchemaProperty): boolean {\n if (!schemaRendersAsObject(prop)) return false;\n if (\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ) {\n return true;\n }\n return (\n !!prop.patternProperties && Object.keys(prop.patternProperties).length > 0\n );\n}\n\n// patternSchemasOf compiles a schema's `patternProperties` into the ordered\n// {pattern, schema} list the string-map control matches keys against.\nfunction patternSchemasOf(\n prop: JsonSchemaProperty,\n): { pattern: string; schema: JsonSchemaProperty }[] | undefined {\n const pp = prop.patternProperties;\n if (!pp || Object.keys(pp).length === 0) return undefined;\n return Object.entries(pp).map(([pattern, schema]) => ({ pattern, schema }));\n}\n\nfunction schemaHasType(prop: JsonSchemaProperty, type: string): boolean {\n if (Array.isArray(prop.type)) return prop.type.includes(type as never);\n return prop.type === type;\n}\n\n// schemaRendersAsObject accepts schemas that omit `type` but use object-only\n// keywords, including composed schemas whose local refs were rehydrated into\n// unconditional allOf members. An explicit incompatible type always wins.\nexport function schemaRendersAsObject(prop: JsonSchemaProperty): boolean {\n if (schemaHasType(prop, \"object\")) return true;\n if (prop.type !== undefined) return false;\n if (\n prop.properties !== undefined ||\n prop.required !== undefined ||\n prop.additionalProperties !== undefined ||\n prop.patternProperties !== undefined ||\n prop.propertyNames !== undefined ||\n prop.unevaluatedProperties !== undefined\n ) {\n return true;\n }\n return (\n prop.allOf?.some(\n (clause) =>\n clause.if === undefined &&\n clause.then === undefined &&\n schemaRendersAsObject(clause as JsonSchemaProperty),\n ) ?? false\n );\n}\n\nfunction enumOptions(prop: JsonSchemaProperty): FieldOption[] {\n const labels = prop[\"x-enum-labels\"];\n const icons = prop[\"x-enum-icons\"];\n const descriptions = prop[\"x-enum-descriptions\"];\n const tones = prop[\"x-enum-tones\"];\n return (prop.enum ?? []).map((v) => {\n const value = String(v);\n const desc = labels?.[value];\n const icon = icons?.[value];\n const description = descriptions?.[value];\n const tone = tones?.[value];\n return {\n value,\n label:\n typeof desc === \"string\" && desc && desc !== value\n ? `${desc} (${value})`\n : value,\n ...(typeof icon === \"string\" && icon ? { icon } : {}),\n ...(typeof description === \"string\" && description\n ? { description }\n : {}),\n ...(isFieldTone(tone) ? { tone } : {}),\n };\n });\n}\n\n// enumDisplay resolves how an enum should render: an explicit `x-enum-display`\n// wins; otherwise an enum carrying `x-enum-icons` defaults to the icon grid.\n// Returns undefined to keep the combobox default.\nfunction enumDisplay(prop: JsonSchemaProperty): EnumDisplay | undefined {\n const d = prop[\"x-enum-display\"];\n if (d === \"combobox\" || d === \"radio\" || d === \"grid\" || d === \"segmented\")\n return d;\n const icons = prop[\"x-enum-icons\"];\n if (icons && Object.keys(icons).length > 0) return \"grid\";\n return undefined;\n}\n\nfunction arrayDisplay(prop: JsonSchemaProperty): ArrayDisplay | undefined {\n const d = prop[\"x-array-display\"];\n return d === \"filter-pills\" || d === \"accordion\" ? d : undefined;\n}\n\n// helpDisplay reads the per-field `x-help-display` override. Returns undefined\n// to defer to the form-level FormLayout.help.\nfunction helpDisplay(prop: JsonSchemaProperty): HelpDisplay | undefined {\n const d = prop[\"x-help-display\"];\n return d === \"inline\" || d === \"hover\" ? d : undefined;\n}\n\nexport function schemaHelper(prop: JsonSchemaProperty): string | undefined {\n const description =\n typeof prop.description === \"string\" ? prop.description.trim() : \"\";\n const help = prop[\"x-help\"];\n const helpBody =\n isPlainObject(help) && typeof help.body === \"string\"\n ? help.body.trim()\n : \"\";\n\n if (description && helpBody && helpBody !== description) {\n return `${description} ${helpBody}`;\n }\n return description || helpBody || undefined;\n}\n\n// adornmentNode builds a prefix/suffix node from the x-input-*[-icon] extensions:\n// a runtime icon name wins, else static text. Returns undefined when neither set.\nfunction adornmentNode(iconName: unknown, text: unknown): ReactNode {\n if (typeof iconName === \"string\" && iconName) {\n // Match the library's InputField field-icon convention (16px, muted/70) so a\n // schema-driven field lines up with a hand-built one.\n return createElement(LabelIcon, {\n icon: iconName,\n className: \"size-4 text-muted-foreground/70\",\n });\n }\n if (typeof text === \"string\" && text) {\n return createElement(\n \"span\",\n { className: \"text-sm text-muted-foreground\" },\n text,\n );\n }\n return undefined;\n}\n\n// enumBranch returns the first anyOf/oneOf member carrying a non-empty `enum`,\n// for a union of \"an enum value OR a free-form string\" (e.g. a value-or-token\n// field). It lets such a union render as a dropdown. Returns undefined when no\n// branch enumerates values.\nexport function enumBranch(\n prop: JsonSchemaProperty,\n): JsonSchemaProperty | undefined {\n for (const branch of [...(prop.anyOf ?? []), ...(prop.oneOf ?? [])]) {\n if (Array.isArray(branch.enum) && branch.enum.length > 0) return branch;\n }\n return undefined;\n}\n\n// lookupDescriptor reads the `x-clicky-lookup` extension into a LookupDescriptor,\n// returning undefined when the keyword is absent or lacks its required url/filter.\nfunction lookupDescriptor(\n prop: JsonSchemaProperty,\n): LookupDescriptor | undefined {\n const raw = prop[\"x-clicky-lookup\"];\n if (!raw || typeof raw !== \"object\") return undefined;\n const d = raw as Record<string, unknown>;\n if (typeof d.url !== \"string\" || typeof d.filter !== \"string\")\n return undefined;\n return raw as LookupDescriptor;\n}\n\nexport interface ResolveControlArgs {\n key: string;\n prop: JsonSchemaProperty;\n required: boolean;\n value: unknown;\n onChange: (next: unknown) => void;\n}\n\n// resolveControl infers a base, render-ready FieldControl from a property\n// schema. It keys off schema keywords only — never the field name: ascode/token\n// heuristics are layered on by consumer pre-extensions. The one exception is the\n// standard `format: date`/`date-time` keyword, which is a schema-declared signal\n// (not a name guess) and so drives a date control directly. First match wins.\nexport function resolveControl(args: ResolveControlArgs): FieldControl {\n const { key, prop, required, value, onChange } = args;\n const labelIcon = prop[\"x-icon\"];\n const xLayout = prop[\"x-layout\"];\n const explicitLayout =\n xLayout === \"inline\" || xLayout === \"stack\" || xLayout === \"table\"\n ? xLayout\n : undefined;\n // `x-label-position` is a friendlier alias over the same per-field layout knob:\n // \"top\" stacks the label above the value; \"left\" forces inline. `x-layout` wins.\n const labelPosition = prop[\"x-label-position\"];\n const layout =\n explicitLayout ??\n (labelPosition === \"top\"\n ? \"stack\"\n : labelPosition === \"left\"\n ? \"inline\"\n : undefined);\n const prefix = adornmentNode(\n prop[\"x-input-prefix-icon\"],\n prop[\"x-input-prefix\"],\n );\n const suffix = adornmentNode(\n prop[\"x-input-suffix-icon\"],\n prop[\"x-input-suffix\"],\n );\n const labelClassName =\n typeof prop[\"x-label-classes\"] === \"string\"\n ? prop[\"x-label-classes\"]\n : undefined;\n const inputClassName =\n typeof prop[\"x-input-classes\"] === \"string\"\n ? prop[\"x-input-classes\"]\n : undefined;\n const colSpan =\n prop[\"x-col-span\"] === \"full\"\n ? (\"full\" as const)\n : typeof prop[\"x-col-span\"] === \"number\" &&\n Number.isFinite(prop[\"x-col-span\"])\n ? prop[\"x-col-span\"]\n : undefined;\n const keyOptions = keyOptionsFor(prop);\n const helper = schemaHelper(prop);\n const helpMode = helpDisplay(prop);\n const base: FieldControl = {\n key,\n kind: \"string\",\n label: typeof prop.title === \"string\" && prop.title ? prop.title : key,\n required,\n schema: prop,\n value,\n onChange,\n ...(prop.readOnly === true ? { readOnly: true } : {}),\n ...(typeof prop.description === \"string\"\n ? { description: prop.description }\n : {}),\n ...(helper ? { helper } : {}),\n ...(helpMode ? { helpDisplay: helpMode } : {}),\n ...(labelIcon != null && labelIcon !== \"\"\n ? { labelIcon: labelIcon as FieldControl[\"labelIcon\"] }\n : {}),\n ...(layout ? { layout } : {}),\n ...(prefix ? { prefix } : {}),\n ...(suffix ? { suffix } : {}),\n ...(labelClassName ? { labelClassName } : {}),\n ...(inputClassName ? { inputClassName } : {}),\n ...(colSpan != null ? { colSpan } : {}),\n };\n\n // An `x-clicky-lookup` field is an async entity-reference picker: options load\n // lazily from another entity's list endpoint. Single-select also allows\n // free-form entry so a typed value outside the option set still commits.\n const lookup = lookupDescriptor(prop);\n if (lookup) {\n return {\n ...base,\n kind: \"lookup\",\n lookup,\n options: [],\n allowCustomValue: lookup.multi !== true,\n };\n }\n if (Array.isArray(prop.enum) && prop.enum.length > 0) {\n const display = enumDisplay(prop);\n return {\n ...base,\n kind: \"enum\",\n options: enumOptions(prop),\n ...(display ? { display } : {}),\n };\n }\n // A value-or-template union: the enum lives in an anyOf/oneOf branch alongside\n // free-form branches. Render it as a dropdown using that branch's enum; the\n // free-form branches are honoured via a consumer's allowCustomValue pre-ext.\n const branch = enumBranch(prop);\n if (branch) {\n return { ...base, kind: \"enum\", options: enumOptions(branch) };\n }\n // A schema-declared date/date-time string renders as a date control.\n if (prop.format === \"date\" || prop.format === \"date-time\") {\n return { ...base, kind: \"date\", dateFormat: prop.format };\n }\n // A long-form string declares `format: textarea` to render a multi-line box.\n if (prop.format === \"textarea\" && schemaHasType(prop, \"string\")) {\n return { ...base, kind: \"textarea\" };\n }\n // A markdown string declares `format: md` to render the MDXEditor-backed\n // editor. Plugin toggles live under `x-md-editor` so schema authors can keep\n // the format signal standard-sized and the editor behavior explicit.\n if (prop.format === \"md\" && schemaHasType(prop, \"string\")) {\n const markdownOptions = prop[\"x-md-editor\"];\n return {\n ...base,\n kind: \"markdown\",\n ...(isPlainObject(markdownOptions) ? { markdownOptions } : {}),\n };\n }\n if (schemaHasType(prop, \"boolean\")) {\n return { ...base, kind: \"boolean\" };\n }\n if (schemaHasType(prop, \"integer\") || schemaHasType(prop, \"number\")) {\n return {\n ...base,\n kind: \"number\",\n coerceNumber: true,\n // A percent number carries a static \"%\" unit shown inside the input.\n ...(prop.format === \"percent\" ? { unit: \"%\" } : {}),\n ...(typeof prop.minimum === \"number\" ? { minimum: prop.minimum } : {}),\n };\n }\n if (schemaHasType(prop, \"array\")) {\n const display = arrayDisplay(prop);\n const itemSchema = prop.items;\n return {\n ...base,\n kind: \"array\",\n ...(itemSchema ? { itemSchema } : {}),\n ...(display ? { arrayDisplay: display } : {}),\n ...(display === \"accordion\" ? { itemSpec: resolveItemSpec(prop, itemSchema) } : {}),\n // An accordion reuses the array's description as the zero-item copy in its\n // add row, so a paragraph of the same sentence directly above would be a\n // literal duplicate. The schema can still say otherwise.\n ...(display === \"accordion\" && !helpMode ? { helpDisplay: \"hover\" as const } : {}),\n ...(display && itemSchema && Array.isArray(itemSchema.enum)\n ? { options: enumOptions(itemSchema) }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // An open map: object whose entries are described by an additionalProperties\n // sub-schema and/or per-key patternProperties. Renders as editable key/value\n // rows (+ any known properties), with the value form resolved per key.\n if (isOpenStringMap(prop)) {\n const addl =\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ? (prop.additionalProperties as JsonSchemaProperty)\n : undefined;\n const patterns = patternSchemasOf(prop);\n // A constrained picker (propertyNames enum) or patternProperties still lets\n // the author ADD keys — the additions are limited to the allowed set, not\n // free-form — so `additionalProperties: false` doesn't disable \"Add field\"\n // in that case. It only closes a plain open map with no key constraints.\n const allowExtraKeys =\n keyOptions || patterns ? true : prop.additionalProperties !== false;\n return {\n ...base,\n kind: \"string-map\",\n ...(addl ? { valueSchema: addl } : {}),\n ...(patterns ? { valuePatternSchemas: patterns } : {}),\n ...(prop.properties ? { knownProperties: prop.properties } : {}),\n allowExtraKeys,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // A structured object: fixed `properties`, not an open map. Renders as a\n // nested sub-form (labels, required, if/then) — recursed into by the renderer.\n if (schemaRendersAsObject(prop)) {\n const valueObject = isPlainObject(value) ? value : {};\n const objectFields = effectiveProperties(\n prop as JsonSchemaObject,\n valueObject,\n );\n if (Object.keys(objectFields.properties).length > 0 || prop.properties) {\n return {\n ...base,\n kind: \"object\",\n objectProperties: objectFields.properties,\n ...(objectFields.required.length > 0\n ? { objectRequired: objectFields.required }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n }\n // A bare object with neither properties nor an additionalProperties schema:\n // treat as an open string map unless explicitly closed.\n if (schemaRendersAsObject(prop)) {\n return {\n ...base,\n kind: \"string-map\",\n allowExtraKeys: prop.additionalProperties !== false,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n return base;\n}\n\n// keyOptionsFor resolves the strict map-key picker options from a map schema's\n// `propertyNames.enum` (e.g. an AsCode-constrained key set). Returns undefined\n// when the keys are unconstrained, so the key stays free-text.\nfunction keyOptionsFor(prop: JsonSchemaProperty): FieldOption[] | undefined {\n const pn = prop.propertyNames as JsonSchemaProperty | undefined;\n if (!pn || !Array.isArray(pn.enum) || pn.enum.length === 0) return undefined;\n return enumOptions(pn);\n}\n\n// isScalarStringItems reports whether an array's item schema is a plain string\n// with no richer shape — the case the array control renders as compact tags.\n// Anything with an enum/const/properties/items/additionalProperties/allOf needs\n// a real per-item control instead.\nexport function isScalarStringItems(\n items: JsonSchemaProperty | undefined,\n): boolean {\n if (!items) return true; // untyped items default to string tags\n if (items.type !== undefined && !schemaHasType(items, \"string\")) return false;\n return (\n items.enum === undefined &&\n items.const === undefined &&\n items.properties === undefined &&\n items.items === undefined &&\n items.additionalProperties === undefined &&\n items.allOf === undefined\n );\n}\n\n// matchesIf reports whether the `if` sub-schema holds for the current value:\n// every `if.required` key is present AND every `if.properties[k].const` equals\n// value[k].\nexport function matchesIf(\n ifSchema: JsonSchemaProperty | undefined,\n value: Record<string, unknown>,\n): boolean {\n if (!ifSchema) return false;\n for (const k of ifSchema.required ?? []) {\n if (!(k in value)) return false;\n }\n for (const [k, sub] of Object.entries(ifSchema.properties ?? {})) {\n if (\"const\" in sub && value[k] !== sub.const) return false;\n }\n return true;\n}\n\nexport interface EffectiveProperties {\n properties: Record<string, JsonSchemaProperty>;\n required: string[];\n}\n\n// applySchemaDefaults fills missing values from JSON Schema `default` keywords.\n// It walks fixed object properties recursively and re-evaluates `if`/`then`\n// branches after each pass, so a defaulted discriminator can activate defaults\n// in its selected branch. Existing values, including null and empty strings, are\n// never replaced. The original value is returned when no defaults apply.\nexport function applySchemaDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): Record<string, unknown> {\n return applyObjectDefaults(schema, value, new Set());\n}\n\nfunction applyObjectDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n ancestors: Set<JsonSchemaObject>,\n): Record<string, unknown> {\n // Recursive schemas may point back to an ancestor after refs are hydrated.\n if (ancestors.has(schema)) return value;\n const nextAncestors = new Set(ancestors).add(schema);\n let next = value;\n\n // A default can select another conditional branch, so allow enough passes for\n // a chain of discriminator defaults while keeping malformed schemas bounded.\n const maxPasses = Math.min(\n 100,\n Object.keys(schema.properties ?? {}).length +\n (schema.allOf?.length ?? 0) +\n 2,\n );\n for (let pass = 0; pass < maxPasses; pass += 1) {\n const { properties } = effectiveProperties(schema, next);\n let passChanged = false;\n let passValue = next;\n\n for (const [key, propertySchema] of Object.entries(properties)) {\n const existing = passValue[key];\n let fieldValue = existing;\n let fieldChanged = false;\n\n if (existing === undefined && propertySchema.default !== undefined) {\n fieldValue = cloneSchemaDefault(propertySchema.default);\n fieldChanged = true;\n }\n\n const structuredObject = schemaRendersAsObject(propertySchema);\n if (structuredObject && !isOpenStringMap(propertySchema)) {\n const objectValue = isPlainObject(fieldValue)\n ? (fieldValue as Record<string, unknown>)\n : {};\n const defaultedObject = applyObjectDefaults(\n propertySchema as JsonSchemaObject,\n objectValue,\n nextAncestors,\n );\n if (defaultedObject !== objectValue) {\n fieldValue = defaultedObject;\n fieldChanged = true;\n }\n }\n\n if (fieldChanged) {\n if (!passChanged) passValue = { ...next };\n passValue[key] = fieldValue;\n passChanged = true;\n }\n }\n\n if (!passChanged) break;\n next = passValue;\n }\n return next;\n}\n\nfunction cloneSchemaDefault(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(cloneSchemaDefault);\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, entry]) => [\n key,\n cloneSchemaDefault(entry),\n ]),\n );\n }\n return value;\n}\n\n// effectiveProperties merges the schema's base `properties` with each `allOf`\n// member's contribution. An `if`/`then` member contributes `then.properties`\n// only when its `if` matches the current value; an unconditional member (e.g.\n// an inlined `$ref` composition, which carries its own `properties` and no\n// `if`) always contributes. Later members win on key collision; required is the\n// union. Pure and idempotent.\nexport function effectiveProperties(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): EffectiveProperties {\n const properties: Record<string, JsonSchemaProperty> = {\n ...schema.properties,\n };\n const required = new Set(schema.required ?? []);\n for (const clause of schema.allOf ?? []) {\n // Unconditional composition member: merge its own properties/required.\n if (clause.if === undefined && clause.then === undefined) {\n for (const [k, sub] of Object.entries(clause.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of clause.required ?? []) required.add(k);\n continue;\n }\n if (!matchesIf(clause.if, value)) continue;\n const then = clause.then ?? {};\n for (const [k, sub] of Object.entries(then.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of then.required ?? []) required.add(k);\n }\n return { properties, required: [...required] };\n}\n"],"names":[],"mappings":";;;;;AAoBO,SAAS,gBAAgB,MAAmC;AACjE,MAAI,CAAC,sBAAsB,IAAI,EAAG,QAAO;AACzC,MACE,OAAO,KAAK,yBAAyB,YACrC,KAAK,yBAAyB,MAC9B;AACA,WAAO;AAAA,EACT;AACA,SACE,CAAC,CAAC,KAAK,qBAAqB,OAAO,KAAK,KAAK,iBAAiB,EAAE,SAAS;AAE7E;AAIA,SAAS,iBACP,MAC+D;AAC/D,QAAM,KAAK,KAAK;AAChB,MAAI,CAAC,MAAM,OAAO,KAAK,EAAE,EAAE,WAAW,EAAG,QAAO;AAChD,SAAO,OAAO,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,SAAS,SAAS;AAC5E;AAEA,SAAS,cAAc,MAA0B,MAAuB;AACtE,MAAI,MAAM,QAAQ,KAAK,IAAI,EAAG,QAAO,KAAK,KAAK,SAAS,IAAa;AACrE,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,sBAAsB,MAAmC;;AACvE,MAAI,cAAc,MAAM,QAAQ,EAAG,QAAO;AAC1C,MAAI,KAAK,SAAS,OAAW,QAAO;AACpC,MACE,KAAK,eAAe,UACpB,KAAK,aAAa,UAClB,KA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,UAAS,IAAI,CAAC;AACrD;AAAA,IACF;AACA,QAAI,CAAC,UAAU,OAAO,IAAI,KAAK,EAAG;AAClC,UAAM,OAAO,OAAO,QAAQ,CAAA;AAC5B,eAAW,CAAC,GAAG,GAAG,KAAK,OAAO,QAAQ,KAAK,cAAc,CAAA,CAAE,GAAG;AAC5D,iBAAW,CAAC,IAAI;AAAA,IAClB;AACA,eAAW,KAAK,KAAK,YAAY,CAAA,EAAI,UAAS,IAAI,CAAC;AAAA,EACrD;AACA,SAAO,EAAE,YAAY,UAAU,CAAC,GAAG,QAAQ,EAAA;AAC7C;"}
|
|
1
|
+
{"version":3,"file":"json-schema-form-resolve.js","sources":["../../src/components/json-schema-form-resolve.ts"],"sourcesContent":["import { createElement, type ReactNode } from \"react\";\nimport type {\n ArrayDisplay,\n EnumDisplay,\n FieldControl,\n FieldOption,\n HelpDisplay,\n JsonSchemaObject,\n JsonSchemaProperty,\n LookupDescriptor,\n} from \"./json-schema-form-types\";\nimport { LabelIcon } from \"../data/Icon\";\nimport { resolveItemSpec } from \"./json-schema-form-item-summary\";\nimport { isFieldTone } from \"./json-schema-form-tone\";\nimport { isPlainObject } from \"./json-schema-form-utils\";\n\n// isOpenStringMap reports whether a property is an object whose entries are\n// described by a sub-schema in `additionalProperties` (a typed key/value map) or\n// by `patternProperties` (a per-key-pattern value map). Either makes it an\n// editable key/value control rather than a fixed-property sub-form.\nexport function isOpenStringMap(prop: JsonSchemaProperty): boolean {\n if (!schemaRendersAsObject(prop)) return false;\n if (\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ) {\n return true;\n }\n return (\n !!prop.patternProperties && Object.keys(prop.patternProperties).length > 0\n );\n}\n\n// patternSchemasOf compiles a schema's `patternProperties` into the ordered\n// {pattern, schema} list the string-map control matches keys against.\nfunction patternSchemasOf(\n prop: JsonSchemaProperty,\n): { pattern: string; schema: JsonSchemaProperty }[] | undefined {\n const pp = prop.patternProperties;\n if (!pp || Object.keys(pp).length === 0) return undefined;\n return Object.entries(pp).map(([pattern, schema]) => ({ pattern, schema }));\n}\n\nfunction schemaHasType(prop: JsonSchemaProperty, type: string): boolean {\n if (Array.isArray(prop.type)) return prop.type.includes(type as never);\n return prop.type === type;\n}\n\n// schemaRendersAsObject accepts schemas that omit `type` but use object-only\n// keywords, including composed schemas whose local refs were rehydrated into\n// unconditional allOf members. An explicit incompatible type always wins.\nexport function schemaRendersAsObject(prop: JsonSchemaProperty): boolean {\n if (schemaHasType(prop, \"object\")) return true;\n if (prop.type !== undefined) return false;\n if (\n prop.properties !== undefined ||\n prop.required !== undefined ||\n prop.additionalProperties !== undefined ||\n prop.patternProperties !== undefined ||\n prop.propertyNames !== undefined ||\n prop.unevaluatedProperties !== undefined\n ) {\n return true;\n }\n return (\n prop.allOf?.some(\n (clause) =>\n clause.if === undefined &&\n clause.then === undefined &&\n schemaRendersAsObject(clause as JsonSchemaProperty),\n ) ?? false\n );\n}\n\nfunction enumOptions(prop: JsonSchemaProperty): FieldOption[] {\n const labels = prop[\"x-enum-labels\"];\n const icons = prop[\"x-enum-icons\"];\n const descriptions = prop[\"x-enum-descriptions\"];\n const tones = prop[\"x-enum-tones\"];\n return (prop.enum ?? []).map((v) => {\n const value = String(v);\n const desc = labels?.[value];\n const icon = icons?.[value];\n const description = descriptions?.[value];\n const tone = tones?.[value];\n return {\n value,\n label:\n typeof desc === \"string\" && desc && desc !== value\n ? `${desc} (${value})`\n : value,\n ...(typeof icon === \"string\" && icon ? { icon } : {}),\n ...(typeof description === \"string\" && description\n ? { description }\n : {}),\n ...(isFieldTone(tone) ? { tone } : {}),\n };\n });\n}\n\n// enumDisplay resolves how an enum should render: an explicit `x-enum-display`\n// wins; otherwise an enum carrying `x-enum-icons` defaults to the icon grid.\n// Returns undefined to keep the combobox default.\nfunction enumDisplay(prop: JsonSchemaProperty): EnumDisplay | undefined {\n const d = prop[\"x-enum-display\"];\n if (d === \"combobox\" || d === \"radio\" || d === \"grid\" || d === \"segmented\")\n return d;\n const icons = prop[\"x-enum-icons\"];\n if (icons && Object.keys(icons).length > 0) return \"grid\";\n return undefined;\n}\n\nfunction arrayDisplay(prop: JsonSchemaProperty): ArrayDisplay | undefined {\n const d = prop[\"x-array-display\"];\n return d === \"filter-pills\" || d === \"accordion\" || d === \"cards\" ? d : undefined;\n}\n\n// helpDisplay reads the per-field `x-help-display` override. Returns undefined\n// to defer to the form-level FormLayout.help.\nfunction helpDisplay(prop: JsonSchemaProperty): HelpDisplay | undefined {\n const d = prop[\"x-help-display\"];\n return d === \"inline\" || d === \"hover\" ? d : undefined;\n}\n\nexport function schemaHelper(prop: JsonSchemaProperty): string | undefined {\n const description =\n typeof prop.description === \"string\" ? prop.description.trim() : \"\";\n const help = prop[\"x-help\"];\n const helpBody =\n isPlainObject(help) && typeof help.body === \"string\"\n ? help.body.trim()\n : \"\";\n\n if (description && helpBody && helpBody !== description) {\n return `${description} ${helpBody}`;\n }\n return description || helpBody || undefined;\n}\n\n// adornmentNode builds a prefix/suffix node from the x-input-*[-icon] extensions:\n// a runtime icon name wins, else static text. Returns undefined when neither set.\nfunction adornmentNode(iconName: unknown, text: unknown): ReactNode {\n if (typeof iconName === \"string\" && iconName) {\n // Match the library's InputField field-icon convention (16px, muted/70) so a\n // schema-driven field lines up with a hand-built one.\n return createElement(LabelIcon, {\n icon: iconName,\n className: \"size-4 text-muted-foreground/70\",\n });\n }\n if (typeof text === \"string\" && text) {\n return createElement(\n \"span\",\n { className: \"text-sm text-muted-foreground\" },\n text,\n );\n }\n return undefined;\n}\n\n// enumBranch returns the first anyOf/oneOf member carrying a non-empty `enum`,\n// for a union of \"an enum value OR a free-form string\" (e.g. a value-or-token\n// field). It lets such a union render as a dropdown. Returns undefined when no\n// branch enumerates values.\nexport function enumBranch(\n prop: JsonSchemaProperty,\n): JsonSchemaProperty | undefined {\n for (const branch of [...(prop.anyOf ?? []), ...(prop.oneOf ?? [])]) {\n if (Array.isArray(branch.enum) && branch.enum.length > 0) return branch;\n }\n return undefined;\n}\n\n// lookupDescriptor reads the `x-clicky-lookup` extension into a LookupDescriptor,\n// returning undefined when the keyword is absent or lacks its required url/filter.\nfunction lookupDescriptor(\n prop: JsonSchemaProperty,\n): LookupDescriptor | undefined {\n const raw = prop[\"x-clicky-lookup\"];\n if (!raw || typeof raw !== \"object\") return undefined;\n const d = raw as Record<string, unknown>;\n if (typeof d.url !== \"string\" || typeof d.filter !== \"string\")\n return undefined;\n return raw as LookupDescriptor;\n}\n\nexport interface ResolveControlArgs {\n key: string;\n prop: JsonSchemaProperty;\n required: boolean;\n value: unknown;\n onChange: (next: unknown) => void;\n}\n\n// resolveControl infers a base, render-ready FieldControl from a property\n// schema. It keys off schema keywords only — never the field name: ascode/token\n// heuristics are layered on by consumer pre-extensions. The one exception is the\n// standard `format: date`/`date-time` keyword, which is a schema-declared signal\n// (not a name guess) and so drives a date control directly. First match wins.\nexport function resolveControl(args: ResolveControlArgs): FieldControl {\n const { key, prop, required, value, onChange } = args;\n const labelIcon = prop[\"x-icon\"];\n const xLayout = prop[\"x-layout\"];\n const explicitLayout =\n xLayout === \"inline\" || xLayout === \"stack\" || xLayout === \"table\"\n ? xLayout\n : undefined;\n // `x-label-position` is a friendlier alias over the same per-field layout knob:\n // \"top\" stacks the label above the value; \"left\" forces inline. `x-layout` wins.\n const labelPosition = prop[\"x-label-position\"];\n const layout =\n explicitLayout ??\n (labelPosition === \"top\"\n ? \"stack\"\n : labelPosition === \"left\"\n ? \"inline\"\n : undefined);\n const prefix = adornmentNode(\n prop[\"x-input-prefix-icon\"],\n prop[\"x-input-prefix\"],\n );\n const suffix = adornmentNode(\n prop[\"x-input-suffix-icon\"],\n prop[\"x-input-suffix\"],\n );\n const labelClassName =\n typeof prop[\"x-label-classes\"] === \"string\"\n ? prop[\"x-label-classes\"]\n : undefined;\n const inputClassName =\n typeof prop[\"x-input-classes\"] === \"string\"\n ? prop[\"x-input-classes\"]\n : undefined;\n const colSpan =\n prop[\"x-col-span\"] === \"full\"\n ? (\"full\" as const)\n : typeof prop[\"x-col-span\"] === \"number\" &&\n Number.isFinite(prop[\"x-col-span\"])\n ? prop[\"x-col-span\"]\n : undefined;\n const keyOptions = keyOptionsFor(prop);\n const helper = schemaHelper(prop);\n const helpMode = helpDisplay(prop);\n const base: FieldControl = {\n key,\n kind: \"string\",\n label: typeof prop.title === \"string\" && prop.title ? prop.title : key,\n required,\n schema: prop,\n value,\n onChange,\n ...(prop.readOnly === true ? { readOnly: true } : {}),\n ...(typeof prop.description === \"string\"\n ? { description: prop.description }\n : {}),\n ...(helper ? { helper } : {}),\n ...(helpMode ? { helpDisplay: helpMode } : {}),\n ...(labelIcon != null && labelIcon !== \"\"\n ? { labelIcon: labelIcon as FieldControl[\"labelIcon\"] }\n : {}),\n ...(layout ? { layout } : {}),\n ...(prefix ? { prefix } : {}),\n ...(suffix ? { suffix } : {}),\n ...(labelClassName ? { labelClassName } : {}),\n ...(inputClassName ? { inputClassName } : {}),\n ...(colSpan != null ? { colSpan } : {}),\n };\n\n // An `x-clicky-lookup` field is an async entity-reference picker: options load\n // lazily from another entity's list endpoint. Single-select also allows\n // free-form entry so a typed value outside the option set still commits.\n const lookup = lookupDescriptor(prop);\n if (lookup) {\n return {\n ...base,\n kind: \"lookup\",\n lookup,\n options: [],\n allowCustomValue: lookup.multi !== true,\n };\n }\n if (Array.isArray(prop.enum) && prop.enum.length > 0) {\n const display = enumDisplay(prop);\n return {\n ...base,\n kind: \"enum\",\n options: enumOptions(prop),\n ...(display ? { display } : {}),\n };\n }\n // A value-or-template union: the enum lives in an anyOf/oneOf branch alongside\n // free-form branches. Render it as a dropdown using that branch's enum; the\n // free-form branches are honoured via a consumer's allowCustomValue pre-ext.\n const branch = enumBranch(prop);\n if (branch) {\n return { ...base, kind: \"enum\", options: enumOptions(branch) };\n }\n // A schema-declared date/date-time string renders as a date control.\n if (prop.format === \"date\" || prop.format === \"date-time\") {\n return { ...base, kind: \"date\", dateFormat: prop.format };\n }\n // A long-form string declares `format: textarea` to render a multi-line box.\n if (prop.format === \"textarea\" && schemaHasType(prop, \"string\")) {\n return { ...base, kind: \"textarea\" };\n }\n // A markdown string declares `format: md` to render the MDXEditor-backed\n // editor. Plugin toggles live under `x-md-editor` so schema authors can keep\n // the format signal standard-sized and the editor behavior explicit.\n if (prop.format === \"md\" && schemaHasType(prop, \"string\")) {\n const markdownOptions = prop[\"x-md-editor\"];\n return {\n ...base,\n kind: \"markdown\",\n ...(isPlainObject(markdownOptions) ? { markdownOptions } : {}),\n };\n }\n if (schemaHasType(prop, \"boolean\")) {\n return { ...base, kind: \"boolean\" };\n }\n if (schemaHasType(prop, \"integer\") || schemaHasType(prop, \"number\")) {\n return {\n ...base,\n kind: \"number\",\n coerceNumber: true,\n // A percent number carries a static \"%\" unit shown inside the input.\n ...(prop.format === \"percent\" ? { unit: \"%\" } : {}),\n ...(typeof prop.minimum === \"number\" ? { minimum: prop.minimum } : {}),\n };\n }\n if (schemaHasType(prop, \"array\")) {\n const display = arrayDisplay(prop);\n const itemSchema = prop.items;\n return {\n ...base,\n kind: \"array\",\n ...(itemSchema ? { itemSchema } : {}),\n ...(display ? { arrayDisplay: display } : {}),\n ...(display === \"accordion\" ? { itemSpec: resolveItemSpec(prop, itemSchema) } : {}),\n // An accordion reuses the array's description as the zero-item copy in its\n // add row, so a paragraph of the same sentence directly above would be a\n // literal duplicate. The schema can still say otherwise.\n ...(display === \"accordion\" && !helpMode ? { helpDisplay: \"hover\" as const } : {}),\n ...(display && itemSchema && Array.isArray(itemSchema.enum)\n ? { options: enumOptions(itemSchema) }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // An open map: object whose entries are described by an additionalProperties\n // sub-schema and/or per-key patternProperties. Renders as editable key/value\n // rows (+ any known properties), with the value form resolved per key.\n if (isOpenStringMap(prop)) {\n const addl =\n typeof prop.additionalProperties === \"object\" &&\n prop.additionalProperties !== null\n ? (prop.additionalProperties as JsonSchemaProperty)\n : undefined;\n const patterns = patternSchemasOf(prop);\n // A constrained picker (propertyNames enum) or patternProperties still lets\n // the author ADD keys — the additions are limited to the allowed set, not\n // free-form — so `additionalProperties: false` doesn't disable \"Add field\"\n // in that case. It only closes a plain open map with no key constraints.\n const allowExtraKeys =\n keyOptions || patterns ? true : prop.additionalProperties !== false;\n return {\n ...base,\n kind: \"string-map\",\n ...(addl ? { valueSchema: addl } : {}),\n ...(patterns ? { valuePatternSchemas: patterns } : {}),\n ...(prop.properties ? { knownProperties: prop.properties } : {}),\n allowExtraKeys,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n // A structured object: fixed `properties`, not an open map. Renders as a\n // nested sub-form (labels, required, if/then) — recursed into by the renderer.\n if (schemaRendersAsObject(prop)) {\n const valueObject = isPlainObject(value) ? value : {};\n const objectFields = effectiveProperties(\n prop as JsonSchemaObject,\n valueObject,\n );\n if (Object.keys(objectFields.properties).length > 0 || prop.properties) {\n return {\n ...base,\n kind: \"object\",\n objectProperties: objectFields.properties,\n ...(objectFields.required.length > 0\n ? { objectRequired: objectFields.required }\n : {}),\n ...(layout ? { layout } : {}),\n };\n }\n }\n // A bare object with neither properties nor an additionalProperties schema:\n // treat as an open string map unless explicitly closed.\n if (schemaRendersAsObject(prop)) {\n return {\n ...base,\n kind: \"string-map\",\n allowExtraKeys: prop.additionalProperties !== false,\n ...(keyOptions ? { keyOptions } : {}),\n ...(layout ? { layout } : {}),\n };\n }\n return base;\n}\n\n// keyOptionsFor resolves the strict map-key picker options from a map schema's\n// `propertyNames.enum` (e.g. an AsCode-constrained key set). Returns undefined\n// when the keys are unconstrained, so the key stays free-text.\nfunction keyOptionsFor(prop: JsonSchemaProperty): FieldOption[] | undefined {\n const pn = prop.propertyNames as JsonSchemaProperty | undefined;\n if (!pn || !Array.isArray(pn.enum) || pn.enum.length === 0) return undefined;\n return enumOptions(pn);\n}\n\n// isScalarStringItems reports whether an array's item schema is a plain string\n// with no richer shape — the case the array control renders as compact tags.\n// Anything with an enum/const/properties/items/additionalProperties/allOf needs\n// a real per-item control instead.\nexport function isScalarStringItems(\n items: JsonSchemaProperty | undefined,\n): boolean {\n if (!items) return true; // untyped items default to string tags\n if (items.type !== undefined && !schemaHasType(items, \"string\")) return false;\n return (\n items.enum === undefined &&\n items.const === undefined &&\n items.properties === undefined &&\n items.items === undefined &&\n items.additionalProperties === undefined &&\n items.allOf === undefined\n );\n}\n\n// matchesIf reports whether the `if` sub-schema holds for the current value:\n// every `if.required` key is present AND every `if.properties[k].const` equals\n// value[k].\nexport function matchesIf(\n ifSchema: JsonSchemaProperty | undefined,\n value: Record<string, unknown>,\n): boolean {\n if (!ifSchema) return false;\n for (const k of ifSchema.required ?? []) {\n if (!(k in value)) return false;\n }\n for (const [k, sub] of Object.entries(ifSchema.properties ?? {})) {\n if (\"const\" in sub && value[k] !== sub.const) return false;\n }\n return true;\n}\n\nexport interface EffectiveProperties {\n properties: Record<string, JsonSchemaProperty>;\n required: string[];\n}\n\n// applySchemaDefaults fills missing values from JSON Schema `default` keywords.\n// It walks fixed object properties recursively and re-evaluates `if`/`then`\n// branches after each pass, so a defaulted discriminator can activate defaults\n// in its selected branch. Existing values, including null and empty strings, are\n// never replaced. The original value is returned when no defaults apply.\nexport function applySchemaDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): Record<string, unknown> {\n return applyObjectDefaults(schema, value, new Set());\n}\n\nfunction applyObjectDefaults(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n ancestors: Set<JsonSchemaObject>,\n): Record<string, unknown> {\n // Recursive schemas may point back to an ancestor after refs are hydrated.\n if (ancestors.has(schema)) return value;\n const nextAncestors = new Set(ancestors).add(schema);\n let next = value;\n\n // A default can select another conditional branch, so allow enough passes for\n // a chain of discriminator defaults while keeping malformed schemas bounded.\n const maxPasses = Math.min(\n 100,\n Object.keys(schema.properties ?? {}).length +\n (schema.allOf?.length ?? 0) +\n 2,\n );\n for (let pass = 0; pass < maxPasses; pass += 1) {\n const { properties } = effectiveProperties(schema, next);\n let passChanged = false;\n let passValue = next;\n\n for (const [key, propertySchema] of Object.entries(properties)) {\n const existing = passValue[key];\n let fieldValue = existing;\n let fieldChanged = false;\n\n if (existing === undefined && propertySchema.default !== undefined) {\n fieldValue = cloneSchemaDefault(propertySchema.default);\n fieldChanged = true;\n }\n\n const structuredObject = schemaRendersAsObject(propertySchema);\n if (structuredObject && !isOpenStringMap(propertySchema)) {\n const objectValue = isPlainObject(fieldValue)\n ? (fieldValue as Record<string, unknown>)\n : {};\n const defaultedObject = applyObjectDefaults(\n propertySchema as JsonSchemaObject,\n objectValue,\n nextAncestors,\n );\n if (defaultedObject !== objectValue) {\n fieldValue = defaultedObject;\n fieldChanged = true;\n }\n }\n\n if (fieldChanged) {\n if (!passChanged) passValue = { ...next };\n passValue[key] = fieldValue;\n passChanged = true;\n }\n }\n\n if (!passChanged) break;\n next = passValue;\n }\n return next;\n}\n\nfunction cloneSchemaDefault(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(cloneSchemaDefault);\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, entry]) => [\n key,\n cloneSchemaDefault(entry),\n ]),\n );\n }\n return value;\n}\n\n// effectiveProperties merges the schema's base `properties` with each `allOf`\n// member's contribution. An `if`/`then` member contributes `then.properties`\n// only when its `if` matches the current value; an unconditional member (e.g.\n// an inlined `$ref` composition, which carries its own `properties` and no\n// `if`) always contributes. Later members win on key collision; required is the\n// union. Pure and idempotent.\nexport function effectiveProperties(\n schema: JsonSchemaObject,\n value: Record<string, unknown>,\n): EffectiveProperties {\n const properties: Record<string, JsonSchemaProperty> = {\n ...schema.properties,\n };\n const required = new Set(schema.required ?? []);\n for (const clause of schema.allOf ?? []) {\n // Unconditional composition member: merge its own properties/required.\n if (clause.if === undefined && clause.then === undefined) {\n for (const [k, sub] of Object.entries(clause.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of clause.required ?? []) required.add(k);\n continue;\n }\n if (!matchesIf(clause.if, value)) continue;\n const then = clause.then ?? {};\n for (const [k, sub] of Object.entries(then.properties ?? {})) {\n properties[k] = sub;\n }\n for (const k of then.required ?? []) required.add(k);\n }\n return { properties, required: [...required] };\n}\n"],"names":[],"mappings":";;;;;AAoBO,SAAS,gBAAgB,MAAmC;AACjE,MAAI,CAAC,sBAAsB,IAAI,EAAG,QAAO;AACzC,MACE,OAAO,KAAK,yBAAyB,YACrC,KAAK,yBAAyB,MAC9B;AACA,WAAO;AAAA,EACT;AACA,SACE,CAAC,CAAC,KAAK,qBAAqB,OAAO,KAAK,KAAK,iBAAiB,EAAE,SAAS;AAE7E;AAIA,SAAS,iBACP,MAC+D;AAC/D,QAAM,KAAK,KAAK;AAChB,MAAI,CAAC,MAAM,OAAO,KAAK,EAAE,EAAE,WAAW,EAAG,QAAO;AAChD,SAAO,OAAO,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,SAAS,SAAS;AAC5E;AAEA,SAAS,cAAc,MAA0B,MAAuB;AACtE,MAAI,MAAM,QAAQ,KAAK,IAAI,EAAG,QAAO,KAAK,KAAK,SAAS,IAAa;AACrE,SAAO,KAAK,SAAS;AACvB;AAKO,SAAS,sBAAsB,MAAmC;;AACvE,MAAI,cAAc,MAAM,QAAQ,EAAG,QAAO;AAC1C,MAAI,KAAK,SAAS,OAAW,QAAO;AACpC,MACE,KAAK,eAAe,UACpB,KAAK,aAAa,UAClB,KAAK,yBAAyB,UAC9B,KAAK,sBAAsB,UAC3B,KAAK,kBAAkB,UACvB,KAAK,0BAA0B,QAC/B;AACA,WAAO;AAAA,EACT;AACA,WACE,UAAK,UAAL,mBAAY;AAAA,IACV,CAAC,WACC,OAAO,OAAO,UACd,OAAO,SAAS,UAChB,sBAAsB,MAA4B;AAAA,QACjD;AAET;AAEA,SAAS,YAAY,MAAyC;AAC5D,QAAM,SAAS,KAAK,eAAe;AACnC,QAAM,QAAQ,KAAK,cAAc;AACjC,QAAM,eAAe,KAAK,qBAAqB;AAC/C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AU,CAAC,GAAG,QAAQ,EAAA;AAC7C;"}
|
|
@@ -22,12 +22,24 @@ const TONE_GLYPH_CLASS = {
|
|
|
22
22
|
emerald: "bg-emerald-100 text-emerald-700 ring-emerald-300/60 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25",
|
|
23
23
|
rose: "bg-rose-100 text-rose-700 ring-rose-300/60 dark:bg-rose-400/10 dark:text-rose-300 dark:ring-rose-400/25"
|
|
24
24
|
};
|
|
25
|
+
const TONE_EDGE_CLASS = {
|
|
26
|
+
neutral: "border-l-border dark:border-l-border",
|
|
27
|
+
slate: "border-l-slate-400 dark:border-l-slate-500",
|
|
28
|
+
violet: "border-l-violet-400 dark:border-l-violet-500",
|
|
29
|
+
amber: "border-l-amber-400 dark:border-l-amber-500",
|
|
30
|
+
sky: "border-l-sky-400 dark:border-l-sky-500",
|
|
31
|
+
teal: "border-l-teal-400 dark:border-l-teal-500",
|
|
32
|
+
indigo: "border-l-indigo-400 dark:border-l-indigo-500",
|
|
33
|
+
emerald: "border-l-emerald-400 dark:border-l-emerald-500",
|
|
34
|
+
rose: "border-l-rose-400 dark:border-l-rose-500"
|
|
35
|
+
};
|
|
25
36
|
function isFieldTone(value) {
|
|
26
37
|
return typeof value === "string" && TONES.includes(value);
|
|
27
38
|
}
|
|
28
39
|
function normalizeTone(value) {
|
|
29
40
|
return isFieldTone(value) ? value : "neutral";
|
|
30
41
|
}
|
|
42
|
+
exports.TONE_EDGE_CLASS = TONE_EDGE_CLASS;
|
|
31
43
|
exports.TONE_GLYPH_CLASS = TONE_GLYPH_CLASS;
|
|
32
44
|
exports.isFieldTone = isFieldTone;
|
|
33
45
|
exports.normalizeTone = normalizeTone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-tone.cjs","sources":["../../src/components/json-schema-form-tone.ts"],"sourcesContent":["// FieldTone is the closed colour vocabulary a schema may name via `x-enum-tones`\n// to give an enum value its own hue (e.g. a parameter's type). It extends the\n// `IconTone` union in ../data/Icon with the two extra hues a six-value enum needs,\n// so the two vocabularies read as one system.\n//\n// The class strings below are written out IN FULL and never composed. Tailwind\n// scans source text, so `bg-${tone}-100` would emit nothing — and a tone name\n// arriving from a consumer's JSON schema is data the scanner never sees at all.\n// Every entry carries a `dark:` variant; the clicky-ui preset binds `dark:` to\n// [data-theme=\"dark\"], so tones track the theme switcher rather than the OS.\nexport type FieldTone =\n | \"neutral\"\n | \"slate\"\n | \"violet\"\n | \"amber\"\n | \"sky\"\n | \"teal\"\n | \"indigo\"\n | \"emerald\"\n | \"rose\";\n\nconst TONES: readonly FieldTone[] = [\n \"neutral\",\n \"slate\",\n \"violet\",\n \"amber\",\n \"sky\",\n \"teal\",\n \"indigo\",\n \"emerald\",\n \"rose\",\n];\n\n// Soft filled tile + inset ring — the accordion's leading glyph and enum chip.\nexport const TONE_GLYPH_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted text-muted-foreground ring-border\",\n slate:\n \"bg-slate-100 text-slate-700 ring-slate-300/60 dark:bg-slate-400/10 dark:text-slate-300 dark:ring-slate-400/25\",\n violet:\n \"bg-violet-100 text-violet-700 ring-violet-300/60 dark:bg-violet-400/10 dark:text-violet-300 dark:ring-violet-400/25\",\n amber:\n \"bg-amber-100 text-amber-800 ring-amber-300/60 dark:bg-amber-400/10 dark:text-amber-300 dark:ring-amber-400/25\",\n sky: \"bg-sky-100 text-sky-700 ring-sky-300/60 dark:bg-sky-400/10 dark:text-sky-300 dark:ring-sky-400/25\",\n teal: \"bg-teal-100 text-teal-700 ring-teal-300/60 dark:bg-teal-400/10 dark:text-teal-300 dark:ring-teal-400/25\",\n indigo:\n \"bg-indigo-100 text-indigo-700 ring-indigo-300/60 dark:bg-indigo-400/10 dark:text-indigo-300 dark:ring-indigo-400/25\",\n emerald:\n \"bg-emerald-100 text-emerald-700 ring-emerald-300/60 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25\",\n rose: \"bg-rose-100 text-rose-700 ring-rose-300/60 dark:bg-rose-400/10 dark:text-rose-300 dark:ring-rose-400/25\",\n};\n\n// Left border accent — a stack of items is scannable by hue before you read it.\nexport const TONE_EDGE_CLASS: Record<FieldTone, string> = {\n neutral: \"border-l-border dark:border-l-border\",\n slate: \"border-l-slate-400 dark:border-l-slate-500\",\n violet: \"border-l-violet-400 dark:border-l-violet-500\",\n amber: \"border-l-amber-400 dark:border-l-amber-500\",\n sky: \"border-l-sky-400 dark:border-l-sky-500\",\n teal: \"border-l-teal-400 dark:border-l-teal-500\",\n indigo: \"border-l-indigo-400 dark:border-l-indigo-500\",\n emerald: \"border-l-emerald-400 dark:border-l-emerald-500\",\n rose: \"border-l-rose-400 dark:border-l-rose-500\",\n};\n\n// Solid dot — the compact legend/rail marker.\nexport const TONE_DOT_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted-foreground dark:bg-muted-foreground\",\n slate: \"bg-slate-400 dark:bg-slate-500\",\n violet: \"bg-violet-400 dark:bg-violet-500\",\n amber: \"bg-amber-400 dark:bg-amber-500\",\n sky: \"bg-sky-400 dark:bg-sky-500\",\n teal: \"bg-teal-400 dark:bg-teal-500\",\n indigo: \"bg-indigo-400 dark:bg-indigo-500\",\n emerald: \"bg-emerald-400 dark:bg-emerald-500\",\n rose: \"bg-rose-400 dark:bg-rose-500\",\n};\n\nexport function isFieldTone(value: unknown): value is FieldTone {\n return typeof value === \"string\" && (TONES as readonly string[]).includes(value);\n}\n\n// normalizeTone coerces an unvalidated schema value to a known tone. A tone is\n// pure decoration, so an unrecognised one falls back to neutral rather than\n// failing the render.\nexport function normalizeTone(value: unknown): FieldTone {\n return isFieldTone(value) ? value : \"neutral\";\n}\n\nexport function fieldToneNames(): readonly FieldTone[] {\n return TONES;\n}\n"],"names":[],"mappings":";;AAqBA,MAAM,QAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,mBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,OACE;AAAA,EACF,QACE;AAAA,EACF,OACE;AAAA,EACF,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QACE;AAAA,EACF,SACE;AAAA,EACF,MAAM;AACR;
|
|
1
|
+
{"version":3,"file":"json-schema-form-tone.cjs","sources":["../../src/components/json-schema-form-tone.ts"],"sourcesContent":["// FieldTone is the closed colour vocabulary a schema may name via `x-enum-tones`\n// to give an enum value its own hue (e.g. a parameter's type). It extends the\n// `IconTone` union in ../data/Icon with the two extra hues a six-value enum needs,\n// so the two vocabularies read as one system.\n//\n// The class strings below are written out IN FULL and never composed. Tailwind\n// scans source text, so `bg-${tone}-100` would emit nothing — and a tone name\n// arriving from a consumer's JSON schema is data the scanner never sees at all.\n// Every entry carries a `dark:` variant; the clicky-ui preset binds `dark:` to\n// [data-theme=\"dark\"], so tones track the theme switcher rather than the OS.\nexport type FieldTone =\n | \"neutral\"\n | \"slate\"\n | \"violet\"\n | \"amber\"\n | \"sky\"\n | \"teal\"\n | \"indigo\"\n | \"emerald\"\n | \"rose\";\n\nconst TONES: readonly FieldTone[] = [\n \"neutral\",\n \"slate\",\n \"violet\",\n \"amber\",\n \"sky\",\n \"teal\",\n \"indigo\",\n \"emerald\",\n \"rose\",\n];\n\n// Soft filled tile + inset ring — the accordion's leading glyph and enum chip.\nexport const TONE_GLYPH_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted text-muted-foreground ring-border\",\n slate:\n \"bg-slate-100 text-slate-700 ring-slate-300/60 dark:bg-slate-400/10 dark:text-slate-300 dark:ring-slate-400/25\",\n violet:\n \"bg-violet-100 text-violet-700 ring-violet-300/60 dark:bg-violet-400/10 dark:text-violet-300 dark:ring-violet-400/25\",\n amber:\n \"bg-amber-100 text-amber-800 ring-amber-300/60 dark:bg-amber-400/10 dark:text-amber-300 dark:ring-amber-400/25\",\n sky: \"bg-sky-100 text-sky-700 ring-sky-300/60 dark:bg-sky-400/10 dark:text-sky-300 dark:ring-sky-400/25\",\n teal: \"bg-teal-100 text-teal-700 ring-teal-300/60 dark:bg-teal-400/10 dark:text-teal-300 dark:ring-teal-400/25\",\n indigo:\n \"bg-indigo-100 text-indigo-700 ring-indigo-300/60 dark:bg-indigo-400/10 dark:text-indigo-300 dark:ring-indigo-400/25\",\n emerald:\n \"bg-emerald-100 text-emerald-700 ring-emerald-300/60 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25\",\n rose: \"bg-rose-100 text-rose-700 ring-rose-300/60 dark:bg-rose-400/10 dark:text-rose-300 dark:ring-rose-400/25\",\n};\n\n// Left border accent — a stack of items is scannable by hue before you read it.\nexport const TONE_EDGE_CLASS: Record<FieldTone, string> = {\n neutral: \"border-l-border dark:border-l-border\",\n slate: \"border-l-slate-400 dark:border-l-slate-500\",\n violet: \"border-l-violet-400 dark:border-l-violet-500\",\n amber: \"border-l-amber-400 dark:border-l-amber-500\",\n sky: \"border-l-sky-400 dark:border-l-sky-500\",\n teal: \"border-l-teal-400 dark:border-l-teal-500\",\n indigo: \"border-l-indigo-400 dark:border-l-indigo-500\",\n emerald: \"border-l-emerald-400 dark:border-l-emerald-500\",\n rose: \"border-l-rose-400 dark:border-l-rose-500\",\n};\n\n// Solid dot — the compact legend/rail marker.\nexport const TONE_DOT_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted-foreground dark:bg-muted-foreground\",\n slate: \"bg-slate-400 dark:bg-slate-500\",\n violet: \"bg-violet-400 dark:bg-violet-500\",\n amber: \"bg-amber-400 dark:bg-amber-500\",\n sky: \"bg-sky-400 dark:bg-sky-500\",\n teal: \"bg-teal-400 dark:bg-teal-500\",\n indigo: \"bg-indigo-400 dark:bg-indigo-500\",\n emerald: \"bg-emerald-400 dark:bg-emerald-500\",\n rose: \"bg-rose-400 dark:bg-rose-500\",\n};\n\nexport function isFieldTone(value: unknown): value is FieldTone {\n return typeof value === \"string\" && (TONES as readonly string[]).includes(value);\n}\n\n// normalizeTone coerces an unvalidated schema value to a known tone. A tone is\n// pure decoration, so an unrecognised one falls back to neutral rather than\n// failing the render.\nexport function normalizeTone(value: unknown): FieldTone {\n return isFieldTone(value) ? value : \"neutral\";\n}\n\nexport function fieldToneNames(): readonly FieldTone[] {\n return TONES;\n}\n"],"names":[],"mappings":";;AAqBA,MAAM,QAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,mBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,OACE;AAAA,EACF,QACE;AAAA,EACF,OACE;AAAA,EACF,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QACE;AAAA,EACF,SACE;AAAA,EACF,MAAM;AACR;AAGO,MAAM,kBAA6C;AAAA,EACxD,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AACR;AAeO,SAAS,YAAY,OAAoC;AAC9D,SAAO,OAAO,UAAU,YAAa,MAA4B,SAAS,KAAK;AACjF;AAKO,SAAS,cAAc,OAA2B;AACvD,SAAO,YAAY,KAAK,IAAI,QAAQ;AACtC;;;;;"}
|
|
@@ -20,6 +20,17 @@ const TONE_GLYPH_CLASS = {
|
|
|
20
20
|
emerald: "bg-emerald-100 text-emerald-700 ring-emerald-300/60 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25",
|
|
21
21
|
rose: "bg-rose-100 text-rose-700 ring-rose-300/60 dark:bg-rose-400/10 dark:text-rose-300 dark:ring-rose-400/25"
|
|
22
22
|
};
|
|
23
|
+
const TONE_EDGE_CLASS = {
|
|
24
|
+
neutral: "border-l-border dark:border-l-border",
|
|
25
|
+
slate: "border-l-slate-400 dark:border-l-slate-500",
|
|
26
|
+
violet: "border-l-violet-400 dark:border-l-violet-500",
|
|
27
|
+
amber: "border-l-amber-400 dark:border-l-amber-500",
|
|
28
|
+
sky: "border-l-sky-400 dark:border-l-sky-500",
|
|
29
|
+
teal: "border-l-teal-400 dark:border-l-teal-500",
|
|
30
|
+
indigo: "border-l-indigo-400 dark:border-l-indigo-500",
|
|
31
|
+
emerald: "border-l-emerald-400 dark:border-l-emerald-500",
|
|
32
|
+
rose: "border-l-rose-400 dark:border-l-rose-500"
|
|
33
|
+
};
|
|
23
34
|
function isFieldTone(value) {
|
|
24
35
|
return typeof value === "string" && TONES.includes(value);
|
|
25
36
|
}
|
|
@@ -27,6 +38,7 @@ function normalizeTone(value) {
|
|
|
27
38
|
return isFieldTone(value) ? value : "neutral";
|
|
28
39
|
}
|
|
29
40
|
export {
|
|
41
|
+
TONE_EDGE_CLASS,
|
|
30
42
|
TONE_GLYPH_CLASS,
|
|
31
43
|
isFieldTone,
|
|
32
44
|
normalizeTone
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-form-tone.js","sources":["../../src/components/json-schema-form-tone.ts"],"sourcesContent":["// FieldTone is the closed colour vocabulary a schema may name via `x-enum-tones`\n// to give an enum value its own hue (e.g. a parameter's type). It extends the\n// `IconTone` union in ../data/Icon with the two extra hues a six-value enum needs,\n// so the two vocabularies read as one system.\n//\n// The class strings below are written out IN FULL and never composed. Tailwind\n// scans source text, so `bg-${tone}-100` would emit nothing — and a tone name\n// arriving from a consumer's JSON schema is data the scanner never sees at all.\n// Every entry carries a `dark:` variant; the clicky-ui preset binds `dark:` to\n// [data-theme=\"dark\"], so tones track the theme switcher rather than the OS.\nexport type FieldTone =\n | \"neutral\"\n | \"slate\"\n | \"violet\"\n | \"amber\"\n | \"sky\"\n | \"teal\"\n | \"indigo\"\n | \"emerald\"\n | \"rose\";\n\nconst TONES: readonly FieldTone[] = [\n \"neutral\",\n \"slate\",\n \"violet\",\n \"amber\",\n \"sky\",\n \"teal\",\n \"indigo\",\n \"emerald\",\n \"rose\",\n];\n\n// Soft filled tile + inset ring — the accordion's leading glyph and enum chip.\nexport const TONE_GLYPH_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted text-muted-foreground ring-border\",\n slate:\n \"bg-slate-100 text-slate-700 ring-slate-300/60 dark:bg-slate-400/10 dark:text-slate-300 dark:ring-slate-400/25\",\n violet:\n \"bg-violet-100 text-violet-700 ring-violet-300/60 dark:bg-violet-400/10 dark:text-violet-300 dark:ring-violet-400/25\",\n amber:\n \"bg-amber-100 text-amber-800 ring-amber-300/60 dark:bg-amber-400/10 dark:text-amber-300 dark:ring-amber-400/25\",\n sky: \"bg-sky-100 text-sky-700 ring-sky-300/60 dark:bg-sky-400/10 dark:text-sky-300 dark:ring-sky-400/25\",\n teal: \"bg-teal-100 text-teal-700 ring-teal-300/60 dark:bg-teal-400/10 dark:text-teal-300 dark:ring-teal-400/25\",\n indigo:\n \"bg-indigo-100 text-indigo-700 ring-indigo-300/60 dark:bg-indigo-400/10 dark:text-indigo-300 dark:ring-indigo-400/25\",\n emerald:\n \"bg-emerald-100 text-emerald-700 ring-emerald-300/60 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25\",\n rose: \"bg-rose-100 text-rose-700 ring-rose-300/60 dark:bg-rose-400/10 dark:text-rose-300 dark:ring-rose-400/25\",\n};\n\n// Left border accent — a stack of items is scannable by hue before you read it.\nexport const TONE_EDGE_CLASS: Record<FieldTone, string> = {\n neutral: \"border-l-border dark:border-l-border\",\n slate: \"border-l-slate-400 dark:border-l-slate-500\",\n violet: \"border-l-violet-400 dark:border-l-violet-500\",\n amber: \"border-l-amber-400 dark:border-l-amber-500\",\n sky: \"border-l-sky-400 dark:border-l-sky-500\",\n teal: \"border-l-teal-400 dark:border-l-teal-500\",\n indigo: \"border-l-indigo-400 dark:border-l-indigo-500\",\n emerald: \"border-l-emerald-400 dark:border-l-emerald-500\",\n rose: \"border-l-rose-400 dark:border-l-rose-500\",\n};\n\n// Solid dot — the compact legend/rail marker.\nexport const TONE_DOT_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted-foreground dark:bg-muted-foreground\",\n slate: \"bg-slate-400 dark:bg-slate-500\",\n violet: \"bg-violet-400 dark:bg-violet-500\",\n amber: \"bg-amber-400 dark:bg-amber-500\",\n sky: \"bg-sky-400 dark:bg-sky-500\",\n teal: \"bg-teal-400 dark:bg-teal-500\",\n indigo: \"bg-indigo-400 dark:bg-indigo-500\",\n emerald: \"bg-emerald-400 dark:bg-emerald-500\",\n rose: \"bg-rose-400 dark:bg-rose-500\",\n};\n\nexport function isFieldTone(value: unknown): value is FieldTone {\n return typeof value === \"string\" && (TONES as readonly string[]).includes(value);\n}\n\n// normalizeTone coerces an unvalidated schema value to a known tone. A tone is\n// pure decoration, so an unrecognised one falls back to neutral rather than\n// failing the render.\nexport function normalizeTone(value: unknown): FieldTone {\n return isFieldTone(value) ? value : \"neutral\";\n}\n\nexport function fieldToneNames(): readonly FieldTone[] {\n return TONES;\n}\n"],"names":[],"mappings":"AAqBA,MAAM,QAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,mBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,OACE;AAAA,EACF,QACE;AAAA,EACF,OACE;AAAA,EACF,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QACE;AAAA,EACF,SACE;AAAA,EACF,MAAM;AACR;
|
|
1
|
+
{"version":3,"file":"json-schema-form-tone.js","sources":["../../src/components/json-schema-form-tone.ts"],"sourcesContent":["// FieldTone is the closed colour vocabulary a schema may name via `x-enum-tones`\n// to give an enum value its own hue (e.g. a parameter's type). It extends the\n// `IconTone` union in ../data/Icon with the two extra hues a six-value enum needs,\n// so the two vocabularies read as one system.\n//\n// The class strings below are written out IN FULL and never composed. Tailwind\n// scans source text, so `bg-${tone}-100` would emit nothing — and a tone name\n// arriving from a consumer's JSON schema is data the scanner never sees at all.\n// Every entry carries a `dark:` variant; the clicky-ui preset binds `dark:` to\n// [data-theme=\"dark\"], so tones track the theme switcher rather than the OS.\nexport type FieldTone =\n | \"neutral\"\n | \"slate\"\n | \"violet\"\n | \"amber\"\n | \"sky\"\n | \"teal\"\n | \"indigo\"\n | \"emerald\"\n | \"rose\";\n\nconst TONES: readonly FieldTone[] = [\n \"neutral\",\n \"slate\",\n \"violet\",\n \"amber\",\n \"sky\",\n \"teal\",\n \"indigo\",\n \"emerald\",\n \"rose\",\n];\n\n// Soft filled tile + inset ring — the accordion's leading glyph and enum chip.\nexport const TONE_GLYPH_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted text-muted-foreground ring-border\",\n slate:\n \"bg-slate-100 text-slate-700 ring-slate-300/60 dark:bg-slate-400/10 dark:text-slate-300 dark:ring-slate-400/25\",\n violet:\n \"bg-violet-100 text-violet-700 ring-violet-300/60 dark:bg-violet-400/10 dark:text-violet-300 dark:ring-violet-400/25\",\n amber:\n \"bg-amber-100 text-amber-800 ring-amber-300/60 dark:bg-amber-400/10 dark:text-amber-300 dark:ring-amber-400/25\",\n sky: \"bg-sky-100 text-sky-700 ring-sky-300/60 dark:bg-sky-400/10 dark:text-sky-300 dark:ring-sky-400/25\",\n teal: \"bg-teal-100 text-teal-700 ring-teal-300/60 dark:bg-teal-400/10 dark:text-teal-300 dark:ring-teal-400/25\",\n indigo:\n \"bg-indigo-100 text-indigo-700 ring-indigo-300/60 dark:bg-indigo-400/10 dark:text-indigo-300 dark:ring-indigo-400/25\",\n emerald:\n \"bg-emerald-100 text-emerald-700 ring-emerald-300/60 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25\",\n rose: \"bg-rose-100 text-rose-700 ring-rose-300/60 dark:bg-rose-400/10 dark:text-rose-300 dark:ring-rose-400/25\",\n};\n\n// Left border accent — a stack of items is scannable by hue before you read it.\nexport const TONE_EDGE_CLASS: Record<FieldTone, string> = {\n neutral: \"border-l-border dark:border-l-border\",\n slate: \"border-l-slate-400 dark:border-l-slate-500\",\n violet: \"border-l-violet-400 dark:border-l-violet-500\",\n amber: \"border-l-amber-400 dark:border-l-amber-500\",\n sky: \"border-l-sky-400 dark:border-l-sky-500\",\n teal: \"border-l-teal-400 dark:border-l-teal-500\",\n indigo: \"border-l-indigo-400 dark:border-l-indigo-500\",\n emerald: \"border-l-emerald-400 dark:border-l-emerald-500\",\n rose: \"border-l-rose-400 dark:border-l-rose-500\",\n};\n\n// Solid dot — the compact legend/rail marker.\nexport const TONE_DOT_CLASS: Record<FieldTone, string> = {\n neutral: \"bg-muted-foreground dark:bg-muted-foreground\",\n slate: \"bg-slate-400 dark:bg-slate-500\",\n violet: \"bg-violet-400 dark:bg-violet-500\",\n amber: \"bg-amber-400 dark:bg-amber-500\",\n sky: \"bg-sky-400 dark:bg-sky-500\",\n teal: \"bg-teal-400 dark:bg-teal-500\",\n indigo: \"bg-indigo-400 dark:bg-indigo-500\",\n emerald: \"bg-emerald-400 dark:bg-emerald-500\",\n rose: \"bg-rose-400 dark:bg-rose-500\",\n};\n\nexport function isFieldTone(value: unknown): value is FieldTone {\n return typeof value === \"string\" && (TONES as readonly string[]).includes(value);\n}\n\n// normalizeTone coerces an unvalidated schema value to a known tone. A tone is\n// pure decoration, so an unrecognised one falls back to neutral rather than\n// failing the render.\nexport function normalizeTone(value: unknown): FieldTone {\n return isFieldTone(value) ? value : \"neutral\";\n}\n\nexport function fieldToneNames(): readonly FieldTone[] {\n return TONES;\n}\n"],"names":[],"mappings":"AAqBA,MAAM,QAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,mBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,OACE;AAAA,EACF,QACE;AAAA,EACF,OACE;AAAA,EACF,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QACE;AAAA,EACF,SACE;AAAA,EACF,MAAM;AACR;AAGO,MAAM,kBAA6C;AAAA,EACxD,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AACR;AAeO,SAAS,YAAY,OAAoC;AAC9D,SAAO,OAAO,UAAU,YAAa,MAA4B,SAAS,KAAK;AACjF;AAKO,SAAS,cAAc,OAA2B;AACvD,SAAO,YAAY,KAAK,IAAI,QAAQ;AACtC;"}
|
|
@@ -78,7 +78,7 @@ export type DisplayVariant = "heading" | "text" | "divider" | "spacer";
|
|
|
78
78
|
export type EnumDisplay = "combobox" | "radio" | "grid" | "segmented";
|
|
79
79
|
export type GridColumns = number | "auto";
|
|
80
80
|
export type HelpDisplay = "inline" | "hover";
|
|
81
|
-
export type ArrayDisplay = "filter-pills" | "accordion";
|
|
81
|
+
export type ArrayDisplay = "filter-pills" | "accordion" | "cards";
|
|
82
82
|
export interface ArrayItemSpec {
|
|
83
83
|
/** Property keys tried in order; the first with a non-empty value is the row title. */
|
|
84
84
|
title?: string[];
|
|
@@ -213,6 +213,15 @@ export type PreExtension = (field: FieldControl, ctx: PreExtensionContext) => Fi
|
|
|
213
213
|
export interface PostExtensionContext {
|
|
214
214
|
rootValue?: Record<string, unknown>;
|
|
215
215
|
onRootChange?: (next: Record<string, unknown>) => void;
|
|
216
|
+
/**
|
|
217
|
+
* RFC 6901 pointer to the field being rendered, e.g. `/columns/3/jsonpath`.
|
|
218
|
+
*
|
|
219
|
+
* With `rootValue` and `onRootChange` it is what lets an extension write a
|
|
220
|
+
* *sibling* of its own field — a control whose value only means something
|
|
221
|
+
* paired with another one has to be able to set both, rather than rendering
|
|
222
|
+
* an instruction telling the author to go and finish the job by hand.
|
|
223
|
+
*/
|
|
224
|
+
instancePath?: string;
|
|
216
225
|
}
|
|
217
226
|
export type PostExtension = (field: FieldControl, nodes: {
|
|
218
227
|
label: ReactNode;
|