@flanksource/clicky-ui 0.3.77 → 0.3.79
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/NOTICE.md +16 -0
- package/dist/ai.cjs +2 -2
- package/dist/ai.js +2 -2
- package/dist/comments/CommentThreadList.cjs +13 -14
- package/dist/comments/CommentThreadList.cjs.map +1 -1
- package/dist/comments/CommentThreadList.d.ts.map +1 -1
- package/dist/comments/CommentThreadList.js +13 -14
- package/dist/comments/CommentThreadList.js.map +1 -1
- package/dist/components/EndpointSelector.cjs +7 -1
- package/dist/components/EndpointSelector.cjs.map +1 -1
- package/dist/components/EndpointSelector.d.ts.map +1 -1
- package/dist/components/EndpointSelector.js +7 -1
- package/dist/components/EndpointSelector.js.map +1 -1
- package/dist/components/FilterBar.cjs +36 -12
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.d.ts +14 -2
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +36 -12
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/FormLookupProvider.cjs +12 -4
- package/dist/components/FormLookupProvider.cjs.map +1 -1
- package/dist/components/FormLookupProvider.d.ts.map +1 -1
- package/dist/components/FormLookupProvider.js +13 -5
- package/dist/components/FormLookupProvider.js.map +1 -1
- package/dist/components/JSONPathPlayground.cjs +124 -233
- package/dist/components/JSONPathPlayground.cjs.map +1 -1
- package/dist/components/JSONPathPlayground.d.ts +15 -13
- package/dist/components/JSONPathPlayground.d.ts.map +1 -1
- package/dist/components/JSONPathPlayground.js +125 -234
- package/dist/components/JSONPathPlayground.js.map +1 -1
- package/dist/components/JsonSchemaForm.cjs +6 -0
- package/dist/components/JsonSchemaForm.cjs.map +1 -1
- package/dist/components/JsonSchemaForm.js +6 -0
- package/dist/components/JsonSchemaForm.js.map +1 -1
- package/dist/components/SegmentedControl.cjs +1 -1
- package/dist/components/SegmentedControl.cjs.map +1 -1
- package/dist/components/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl.js +1 -1
- package/dist/components/SegmentedControl.js.map +1 -1
- package/dist/components/TimeRange.cjs +133 -60
- package/dist/components/TimeRange.cjs.map +1 -1
- package/dist/components/TimeRange.d.ts +8 -1
- package/dist/components/TimeRange.d.ts.map +1 -1
- package/dist/components/TimeRange.js +133 -60
- package/dist/components/TimeRange.js.map +1 -1
- package/dist/components/json-schema-form-accordion-array.cjs +8 -6
- 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 +9 -7
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-array-rows.cjs +45 -0
- package/dist/components/json-schema-form-array-rows.cjs.map +1 -0
- package/dist/components/json-schema-form-array-rows.d.ts +10 -0
- package/dist/components/json-schema-form-array-rows.d.ts.map +1 -0
- package/dist/components/json-schema-form-array-rows.js +45 -0
- package/dist/components/json-schema-form-array-rows.js.map +1 -0
- package/dist/components/json-schema-form-item-summary.cjs +3 -5
- package/dist/components/json-schema-form-item-summary.cjs.map +1 -1
- package/dist/components/json-schema-form-item-summary.d.ts +1 -1
- package/dist/components/json-schema-form-item-summary.d.ts.map +1 -1
- package/dist/components/json-schema-form-item-summary.js +3 -5
- package/dist/components/json-schema-form-item-summary.js.map +1 -1
- package/dist/components/json-schema-form-render.cjs +11 -2
- 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 +12 -3
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +10 -0
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.d.ts +1 -0
- package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
- package/dist/components/json-schema-form-resolve.js +10 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-runtime-types.d.ts +4 -0
- package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -1
- package/dist/components/json-schema-form-table-array.cjs +25 -16
- package/dist/components/json-schema-form-table-array.cjs.map +1 -1
- package/dist/components/json-schema-form-table-array.d.ts +1 -1
- package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-table-array.js +26 -17
- package/dist/components/json-schema-form-table-array.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +0 -2
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/jsonPathPlaygroundEvaluator.cjs +53 -0
- package/dist/components/jsonPathPlaygroundEvaluator.cjs.map +1 -0
- package/dist/components/jsonPathPlaygroundEvaluator.d.ts +23 -0
- package/dist/components/jsonPathPlaygroundEvaluator.d.ts.map +1 -0
- package/dist/components/jsonPathPlaygroundEvaluator.js +53 -0
- package/dist/components/jsonPathPlaygroundEvaluator.js.map +1 -0
- package/dist/components/jsonPathTree.cjs +1 -0
- package/dist/components/jsonPathTree.cjs.map +1 -1
- package/dist/components/jsonPathTree.d.ts +6 -0
- package/dist/components/jsonPathTree.d.ts.map +1 -1
- package/dist/components/jsonPathTree.js +1 -0
- package/dist/components/jsonPathTree.js.map +1 -1
- package/dist/data/Clicky.cjs +37 -18
- package/dist/data/Clicky.cjs.map +1 -1
- package/dist/data/Clicky.d.ts +5 -0
- package/dist/data/Clicky.d.ts.map +1 -1
- package/dist/data/Clicky.js +37 -18
- package/dist/data/Clicky.js.map +1 -1
- package/dist/data/DataTable.cjs +49 -12
- package/dist/data/DataTable.cjs.map +1 -1
- package/dist/data/DataTable.d.ts +17 -2
- package/dist/data/DataTable.d.ts.map +1 -1
- package/dist/data/DataTable.js +49 -12
- package/dist/data/DataTable.js.map +1 -1
- package/dist/data/TaskPoolUsage.cjs +2 -1
- package/dist/data/TaskPoolUsage.cjs.map +1 -1
- package/dist/data/TaskPoolUsage.d.ts.map +1 -1
- package/dist/data/TaskPoolUsage.js +2 -1
- package/dist/data/TaskPoolUsage.js.map +1 -1
- package/dist/data/TimeseriesPanel.axes.cjs +18 -3
- package/dist/data/TimeseriesPanel.axes.cjs.map +1 -1
- package/dist/data/TimeseriesPanel.axes.d.ts +10 -1
- package/dist/data/TimeseriesPanel.axes.d.ts.map +1 -1
- package/dist/data/TimeseriesPanel.axes.js +17 -4
- package/dist/data/TimeseriesPanel.axes.js.map +1 -1
- package/dist/data/TimeseriesPanel.cjs +57 -23
- package/dist/data/TimeseriesPanel.cjs.map +1 -1
- package/dist/data/TimeseriesPanel.d.ts.map +1 -1
- package/dist/data/TimeseriesPanel.js +59 -25
- package/dist/data/TimeseriesPanel.js.map +1 -1
- package/dist/data/TimeseriesPanel.model.cjs +10 -7
- package/dist/data/TimeseriesPanel.model.cjs.map +1 -1
- package/dist/data/TimeseriesPanel.model.d.ts +7 -4
- package/dist/data/TimeseriesPanel.model.d.ts.map +1 -1
- package/dist/data/TimeseriesPanel.model.js +11 -8
- package/dist/data/TimeseriesPanel.model.js.map +1 -1
- package/dist/data/TimeseriesPanel.readout.cjs +11 -0
- package/dist/data/TimeseriesPanel.readout.cjs.map +1 -0
- package/dist/data/TimeseriesPanel.readout.d.ts +4 -0
- package/dist/data/TimeseriesPanel.readout.d.ts.map +1 -0
- package/dist/data/TimeseriesPanel.readout.js +10 -0
- package/dist/data/TimeseriesPanel.readout.js.map +1 -0
- package/dist/data/TimeseriesPanel.segments.cjs +67 -0
- package/dist/data/TimeseriesPanel.segments.cjs.map +1 -0
- package/dist/data/TimeseriesPanel.segments.d.ts +27 -0
- package/dist/data/TimeseriesPanel.segments.d.ts.map +1 -0
- package/dist/data/TimeseriesPanel.segments.js +67 -0
- package/dist/data/TimeseriesPanel.segments.js.map +1 -0
- package/dist/data/TreeDataTable.cjs +12 -3
- package/dist/data/TreeDataTable.cjs.map +1 -1
- package/dist/data/TreeDataTable.d.ts +15 -3
- package/dist/data/TreeDataTable.d.ts.map +1 -1
- package/dist/data/TreeDataTable.js +12 -3
- package/dist/data/TreeDataTable.js.map +1 -1
- package/dist/data/TreeNode.cjs +18 -3
- package/dist/data/TreeNode.cjs.map +1 -1
- package/dist/data/TreeNode.d.ts +7 -1
- package/dist/data/TreeNode.d.ts.map +1 -1
- package/dist/data/TreeNode.js +18 -3
- package/dist/data/TreeNode.js.map +1 -1
- package/dist/data/ai/SessionChatComposer.cjs +2 -0
- package/dist/data/ai/SessionChatComposer.cjs.map +1 -1
- package/dist/data/ai/SessionChatComposer.d.ts.map +1 -1
- package/dist/data/ai/SessionChatComposer.js +2 -0
- package/dist/data/ai/SessionChatComposer.js.map +1 -1
- package/dist/data/ai/SessionInspector.panels.cjs +47 -1
- package/dist/data/ai/SessionInspector.panels.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.panels.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.panels.js +48 -2
- package/dist/data/ai/SessionInspector.panels.js.map +1 -1
- package/dist/data/ai/SessionViewer.unified.d.ts +48 -0
- package/dist/data/ai/SessionViewer.unified.d.ts.map +1 -1
- package/dist/data/ai/index.d.ts +2 -2
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs +97 -100
- package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs.map +1 -1
- package/dist/data/ai/runtime-profiles/PresetWorkspace.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/PresetWorkspace.js +97 -100
- package/dist/data/ai/runtime-profiles/PresetWorkspace.js.map +1 -1
- package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs +40 -38
- package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs.map +1 -1
- package/dist/data/ai/runtime-profiles/ProfileWorkspace.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/ProfileWorkspace.js +41 -39
- package/dist/data/ai/runtime-profiles/ProfileWorkspace.js.map +1 -1
- package/dist/data/ai/runtime-profiles/ResolutionPreview.cjs +53 -0
- package/dist/data/ai/runtime-profiles/ResolutionPreview.cjs.map +1 -0
- package/dist/data/ai/runtime-profiles/ResolutionPreview.d.ts +7 -0
- package/dist/data/ai/runtime-profiles/ResolutionPreview.d.ts.map +1 -0
- package/dist/data/ai/runtime-profiles/ResolutionPreview.js +53 -0
- package/dist/data/ai/runtime-profiles/ResolutionPreview.js.map +1 -0
- package/dist/data/ai/runtime-profiles/index.d.ts +1 -1
- package/dist/data/ai/runtime-profiles/index.d.ts.map +1 -1
- package/dist/data/ai/sessionSubmitVariant.cjs +30 -0
- package/dist/data/ai/sessionSubmitVariant.cjs.map +1 -0
- package/dist/data/ai/sessionSubmitVariant.d.ts +7 -0
- package/dist/data/ai/sessionSubmitVariant.d.ts.map +1 -0
- package/dist/data/ai/sessionSubmitVariant.js +30 -0
- package/dist/data/ai/sessionSubmitVariant.js.map +1 -0
- package/dist/data/cells/Timestamp.cjs +15 -4
- package/dist/data/cells/Timestamp.cjs.map +1 -1
- package/dist/data/cells/Timestamp.d.ts.map +1 -1
- package/dist/data/cells/Timestamp.js +15 -4
- package/dist/data/cells/Timestamp.js.map +1 -1
- package/dist/data/cells/timestamp-format.cjs +28 -8
- package/dist/data/cells/timestamp-format.cjs.map +1 -1
- package/dist/data/cells/timestamp-format.d.ts +3 -1
- package/dist/data/cells/timestamp-format.d.ts.map +1 -1
- package/dist/data/cells/timestamp-format.js +28 -8
- package/dist/data/cells/timestamp-format.js.map +1 -1
- package/dist/data/charts/TrendChart.cjs +65 -31
- package/dist/data/charts/TrendChart.cjs.map +1 -1
- package/dist/data/charts/TrendChart.d.ts +12 -3
- package/dist/data/charts/TrendChart.d.ts.map +1 -1
- package/dist/data/charts/TrendChart.js +67 -33
- package/dist/data/charts/TrendChart.js.map +1 -1
- package/dist/data/charts/index.d.ts +1 -1
- package/dist/data/charts/index.d.ts.map +1 -1
- package/dist/data/chat/PromptInput.cjs +11 -2
- package/dist/data/chat/PromptInput.cjs.map +1 -1
- package/dist/data/chat/PromptInput.d.ts +15 -1
- package/dist/data/chat/PromptInput.d.ts.map +1 -1
- package/dist/data/chat/PromptInput.js +11 -2
- package/dist/data/chat/PromptInput.js.map +1 -1
- package/dist/data/chat/index.d.ts +1 -1
- package/dist/data/chat/index.d.ts.map +1 -1
- package/dist/data/data-table-filter-values.cjs.map +1 -1
- package/dist/data/data-table-filter-values.d.ts +1 -1
- package/dist/data/data-table-filter-values.d.ts.map +1 -1
- package/dist/data/data-table-filter-values.js.map +1 -1
- package/dist/data/data-table-server-filters.cjs +2 -6
- package/dist/data/data-table-server-filters.cjs.map +1 -1
- package/dist/data/data-table-server-filters.d.ts +1 -1
- package/dist/data/data-table-server-filters.d.ts.map +1 -1
- package/dist/data/data-table-server-filters.js +1 -5
- package/dist/data/data-table-server-filters.js.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.cjs +2 -1
- package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts +2 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.js +2 -1
- package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
- package/dist/data/gauge-stats.cjs +7 -3
- package/dist/data/gauge-stats.cjs.map +1 -1
- package/dist/data/gauge-stats.d.ts.map +1 -1
- package/dist/data/gauge-stats.js +7 -3
- package/dist/data/gauge-stats.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +41 -17
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.fieldNames.cjs +23 -0
- package/dist/data/query-browser/QueryBrowser.fieldNames.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowser.fieldNames.d.ts +11 -0
- package/dist/data/query-browser/QueryBrowser.fieldNames.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowser.fieldNames.js +23 -0
- package/dist/data/query-browser/QueryBrowser.fieldNames.js.map +1 -0
- package/dist/data/query-browser/QueryBrowser.js +41 -17
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +18 -0
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/runtime/RuntimeBarLayout.cjs +3 -2
- package/dist/data/runtime/RuntimeBarLayout.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBarLayout.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBarLayout.js +3 -2
- package/dist/data/runtime/RuntimeBarLayout.js.map +1 -1
- package/dist/data/test-runner/TestRunner.cjs +3 -1
- package/dist/data/test-runner/TestRunner.cjs.map +1 -1
- package/dist/data/test-runner/TestRunner.d.ts +8 -1
- package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
- package/dist/data/test-runner/TestRunner.js +3 -1
- package/dist/data/test-runner/TestRunner.js.map +1 -1
- package/dist/data/test-runner/TestTree.cjs +1 -0
- package/dist/data/test-runner/TestTree.cjs.map +1 -1
- package/dist/data/test-runner/TestTree.d.ts.map +1 -1
- package/dist/data/test-runner/TestTree.js +1 -0
- package/dist/data/test-runner/TestTree.js.map +1 -1
- package/dist/data/test-runner/context.cjs.map +1 -1
- package/dist/data/test-runner/context.d.ts +2 -0
- package/dist/data/test-runner/context.d.ts.map +1 -1
- package/dist/data/test-runner/context.js.map +1 -1
- package/dist/data/timeseries-query.cjs +2 -2
- package/dist/data/timeseries-query.cjs.map +1 -1
- package/dist/data/timeseries-query.d.ts +1 -1
- package/dist/data/timeseries-query.d.ts.map +1 -1
- package/dist/data/timeseries-query.js +2 -2
- package/dist/data/timeseries-query.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +33 -0
- package/dist/data.d.ts +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +18 -2
- package/dist/expressions/playground/EmbeddedPlayground.cjs +40 -0
- package/dist/expressions/playground/EmbeddedPlayground.cjs.map +1 -0
- package/dist/expressions/playground/EmbeddedPlayground.d.ts +30 -0
- package/dist/expressions/playground/EmbeddedPlayground.d.ts.map +1 -0
- package/dist/expressions/playground/EmbeddedPlayground.js +40 -0
- package/dist/expressions/playground/EmbeddedPlayground.js.map +1 -0
- package/dist/expressions/playground/ExpressionPlayground.cjs +6 -6
- package/dist/expressions/playground/ExpressionPlayground.cjs.map +1 -1
- package/dist/expressions/playground/ExpressionPlayground.d.ts +10 -3
- package/dist/expressions/playground/ExpressionPlayground.d.ts.map +1 -1
- package/dist/expressions/playground/ExpressionPlayground.js +6 -6
- package/dist/expressions/playground/ExpressionPlayground.js.map +1 -1
- package/dist/expressions/playground/LazyEmbeddedPlayground.cjs +22 -0
- package/dist/expressions/playground/LazyEmbeddedPlayground.cjs.map +1 -0
- package/dist/expressions/playground/LazyEmbeddedPlayground.d.ts +4 -0
- package/dist/expressions/playground/LazyEmbeddedPlayground.d.ts.map +1 -0
- package/dist/expressions/playground/LazyEmbeddedPlayground.js +22 -0
- package/dist/expressions/playground/LazyEmbeddedPlayground.js.map +1 -0
- package/dist/expressions/playground/api.cjs.map +1 -1
- package/dist/expressions/playground/api.d.ts +10 -0
- package/dist/expressions/playground/api.d.ts.map +1 -1
- package/dist/expressions/playground/api.js.map +1 -1
- package/dist/expressions/playground/hostEvaluation.cjs +67 -0
- package/dist/expressions/playground/hostEvaluation.cjs.map +1 -0
- package/dist/expressions/playground/hostEvaluation.d.ts +39 -0
- package/dist/expressions/playground/hostEvaluation.d.ts.map +1 -0
- package/dist/expressions/playground/hostEvaluation.js +63 -0
- package/dist/expressions/playground/hostEvaluation.js.map +1 -0
- package/dist/expressions/playground/panels/GraphPanel.cjs +8 -3
- package/dist/expressions/playground/panels/GraphPanel.cjs.map +1 -1
- package/dist/expressions/playground/panels/GraphPanel.d.ts +2 -1
- package/dist/expressions/playground/panels/GraphPanel.d.ts.map +1 -1
- package/dist/expressions/playground/panels/GraphPanel.js +8 -3
- package/dist/expressions/playground/panels/GraphPanel.js.map +1 -1
- package/dist/expressions/playground/panels/graphNodes.cjs +6 -2
- package/dist/expressions/playground/panels/graphNodes.cjs.map +1 -1
- package/dist/expressions/playground/panels/graphNodes.d.ts +6 -2
- package/dist/expressions/playground/panels/graphNodes.d.ts.map +1 -1
- package/dist/expressions/playground/panels/graphNodes.js +6 -2
- package/dist/expressions/playground/panels/graphNodes.js.map +1 -1
- package/dist/expressions/playground.d.ts +1 -1
- package/dist/expressions/playground.d.ts.map +1 -1
- package/dist/hooks/use-element-height.cjs +26 -0
- package/dist/hooks/use-element-height.cjs.map +1 -0
- package/dist/hooks/use-element-height.d.ts +10 -0
- package/dist/hooks/use-element-height.d.ts.map +1 -0
- package/dist/hooks/use-element-height.js +26 -0
- package/dist/hooks/use-element-height.js.map +1 -0
- package/dist/icons/components/UiGlobeShare.cjs +33 -0
- package/dist/icons/components/UiGlobeShare.cjs.map +1 -0
- package/dist/icons/components/UiGlobeShare.d.ts +9 -0
- package/dist/icons/components/UiGlobeShare.d.ts.map +1 -0
- package/dist/icons/components/UiGlobeShare.js +31 -0
- package/dist/icons/components/UiGlobeShare.js.map +1 -0
- package/dist/icons/components/UiKubernetesLink.cjs +38 -0
- package/dist/icons/components/UiKubernetesLink.cjs.map +1 -0
- package/dist/icons/components/UiKubernetesLink.d.ts +9 -0
- package/dist/icons/components/UiKubernetesLink.d.ts.map +1 -0
- package/dist/icons/components/UiKubernetesLink.js +36 -0
- package/dist/icons/components/UiKubernetesLink.js.map +1 -0
- package/dist/icons/components/UiLogoAws.cjs +29 -0
- package/dist/icons/components/UiLogoAws.cjs.map +1 -0
- package/dist/icons/components/UiLogoAws.d.ts +9 -0
- package/dist/icons/components/UiLogoAws.d.ts.map +1 -0
- package/dist/icons/components/UiLogoAws.js +27 -0
- package/dist/icons/components/UiLogoAws.js.map +1 -0
- package/dist/icons/components/UiLogoAzure.cjs +29 -0
- package/dist/icons/components/UiLogoAzure.cjs.map +1 -0
- package/dist/icons/components/UiLogoAzure.d.ts +9 -0
- package/dist/icons/components/UiLogoAzure.d.ts.map +1 -0
- package/dist/icons/components/UiLogoAzure.js +27 -0
- package/dist/icons/components/UiLogoAzure.js.map +1 -0
- package/dist/icons/components/UiLogoAzureDevops.cjs +29 -0
- package/dist/icons/components/UiLogoAzureDevops.cjs.map +1 -0
- package/dist/icons/components/UiLogoAzureDevops.d.ts +9 -0
- package/dist/icons/components/UiLogoAzureDevops.d.ts.map +1 -0
- package/dist/icons/components/UiLogoAzureDevops.js +27 -0
- package/dist/icons/components/UiLogoAzureDevops.js.map +1 -0
- package/dist/icons/components/UiLogoGit.cjs +29 -0
- package/dist/icons/components/UiLogoGit.cjs.map +1 -0
- package/dist/icons/components/UiLogoGit.d.ts +9 -0
- package/dist/icons/components/UiLogoGit.d.ts.map +1 -0
- package/dist/icons/components/UiLogoGit.js +27 -0
- package/dist/icons/components/UiLogoGit.js.map +1 -0
- package/dist/icons/components/UiLogoGithub.cjs +29 -0
- package/dist/icons/components/UiLogoGithub.cjs.map +1 -0
- package/dist/icons/components/UiLogoGithub.d.ts +9 -0
- package/dist/icons/components/UiLogoGithub.d.ts.map +1 -0
- package/dist/icons/components/UiLogoGithub.js +27 -0
- package/dist/icons/components/UiLogoGithub.js.map +1 -0
- package/dist/icons/components/UiLogoJava.cjs +29 -0
- package/dist/icons/components/UiLogoJava.cjs.map +1 -0
- package/dist/icons/components/UiLogoJava.d.ts +9 -0
- package/dist/icons/components/UiLogoJava.d.ts.map +1 -0
- package/dist/icons/components/UiLogoJava.js +27 -0
- package/dist/icons/components/UiLogoJava.js.map +1 -0
- package/dist/icons/components/UiLogoKubernetes.cjs +29 -0
- package/dist/icons/components/UiLogoKubernetes.cjs.map +1 -0
- package/dist/icons/components/UiLogoKubernetes.d.ts +9 -0
- package/dist/icons/components/UiLogoKubernetes.d.ts.map +1 -0
- package/dist/icons/components/UiLogoKubernetes.js +27 -0
- package/dist/icons/components/UiLogoKubernetes.js.map +1 -0
- package/dist/icons/components/UiLogoMssql.cjs +29 -0
- package/dist/icons/components/UiLogoMssql.cjs.map +1 -0
- package/dist/icons/components/UiLogoMssql.d.ts +9 -0
- package/dist/icons/components/UiLogoMssql.d.ts.map +1 -0
- package/dist/icons/components/UiLogoMssql.js +27 -0
- package/dist/icons/components/UiLogoMssql.js.map +1 -0
- package/dist/icons/components/UiLogoOpenjdk.cjs +29 -0
- package/dist/icons/components/UiLogoOpenjdk.cjs.map +1 -0
- package/dist/icons/components/UiLogoOpenjdk.d.ts +9 -0
- package/dist/icons/components/UiLogoOpenjdk.d.ts.map +1 -0
- package/dist/icons/components/UiLogoOpenjdk.js +27 -0
- package/dist/icons/components/UiLogoOpenjdk.js.map +1 -0
- package/dist/icons/components/UiLogoOpensearch.cjs +29 -0
- package/dist/icons/components/UiLogoOpensearch.cjs.map +1 -0
- package/dist/icons/components/UiLogoOpensearch.d.ts +9 -0
- package/dist/icons/components/UiLogoOpensearch.d.ts.map +1 -0
- package/dist/icons/components/UiLogoOpensearch.js +27 -0
- package/dist/icons/components/UiLogoOpensearch.js.map +1 -0
- package/dist/icons/components/UiLogoOpentelemetry.cjs +29 -0
- package/dist/icons/components/UiLogoOpentelemetry.cjs.map +1 -0
- package/dist/icons/components/UiLogoOpentelemetry.d.ts +9 -0
- package/dist/icons/components/UiLogoOpentelemetry.d.ts.map +1 -0
- package/dist/icons/components/UiLogoOpentelemetry.js +27 -0
- package/dist/icons/components/UiLogoOpentelemetry.js.map +1 -0
- package/dist/icons/components/UiLogoPostgres.cjs +29 -0
- package/dist/icons/components/UiLogoPostgres.cjs.map +1 -0
- package/dist/icons/components/UiLogoPostgres.d.ts +9 -0
- package/dist/icons/components/UiLogoPostgres.d.ts.map +1 -0
- package/dist/icons/components/UiLogoPostgres.js +27 -0
- package/dist/icons/components/UiLogoPostgres.js.map +1 -0
- package/dist/icons/components/UiLogoSqlite.cjs +29 -0
- package/dist/icons/components/UiLogoSqlite.cjs.map +1 -0
- package/dist/icons/components/UiLogoSqlite.d.ts +9 -0
- package/dist/icons/components/UiLogoSqlite.d.ts.map +1 -0
- package/dist/icons/components/UiLogoSqlite.js +27 -0
- package/dist/icons/components/UiLogoSqlite.js.map +1 -0
- package/dist/icons/components/UiWebLink.cjs +40 -0
- package/dist/icons/components/UiWebLink.cjs.map +1 -0
- package/dist/icons/components/UiWebLink.d.ts +9 -0
- package/dist/icons/components/UiWebLink.d.ts.map +1 -0
- package/dist/icons/components/UiWebLink.js +38 -0
- package/dist/icons/components/UiWebLink.js.map +1 -0
- package/dist/icons/index.d.ts +16 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/registry.cjs +32 -0
- package/dist/icons/registry.cjs.map +1 -1
- package/dist/icons/registry.d.ts.map +1 -1
- package/dist/icons/registry.js +32 -0
- package/dist/icons/registry.js.map +1 -1
- package/dist/icons.cjs +32 -0
- package/dist/icons.js +17 -1
- package/dist/index.cjs +38 -5
- package/dist/index.js +23 -7
- package/dist/jvm/classes/PatchedClassList.cjs +11 -2
- package/dist/jvm/classes/PatchedClassList.cjs.map +1 -1
- package/dist/jvm/classes/PatchedClassList.d.ts.map +1 -1
- package/dist/jvm/classes/PatchedClassList.js +11 -2
- package/dist/jvm/classes/PatchedClassList.js.map +1 -1
- package/dist/jvm/fixtures/fake-client.d.ts.map +1 -1
- package/dist/jvm/model/patches.cjs +4 -2
- package/dist/jvm/model/patches.cjs.map +1 -1
- package/dist/jvm/model/patches.d.ts +3 -1
- package/dist/jvm/model/patches.d.ts.map +1 -1
- package/dist/jvm/model/patches.js +4 -2
- package/dist/jvm/model/patches.js.map +1 -1
- package/dist/jvm/protocol/client.d.ts +7 -2
- package/dist/jvm/protocol/client.d.ts.map +1 -1
- package/dist/jvm/protocol/operation-client.cjs +30 -11
- package/dist/jvm/protocol/operation-client.cjs.map +1 -1
- package/dist/jvm/protocol/operation-client.d.ts.map +1 -1
- package/dist/jvm/protocol/operation-client.js +30 -11
- package/dist/jvm/protocol/operation-client.js.map +1 -1
- package/dist/jvm/protocol/query-keys.cjs +1 -1
- package/dist/jvm/protocol/query-keys.cjs.map +1 -1
- package/dist/jvm/protocol/query-keys.d.ts +1 -1
- package/dist/jvm/protocol/query-keys.d.ts.map +1 -1
- package/dist/jvm/protocol/query-keys.js +1 -1
- package/dist/jvm/protocol/query-keys.js.map +1 -1
- package/dist/jvm/protocol/status.cjs +38 -0
- package/dist/jvm/protocol/status.cjs.map +1 -0
- package/dist/jvm/protocol/status.d.ts +13 -0
- package/dist/jvm/protocol/status.d.ts.map +1 -0
- package/dist/jvm/protocol/status.js +38 -0
- package/dist/jvm/protocol/status.js.map +1 -0
- package/dist/jvm/protocol/types.d.ts +16 -4
- package/dist/jvm/protocol/types.d.ts.map +1 -1
- package/dist/jvm/runtime/GcSummary.cjs +7 -1
- package/dist/jvm/runtime/GcSummary.cjs.map +1 -1
- package/dist/jvm/runtime/GcSummary.d.ts.map +1 -1
- package/dist/jvm/runtime/GcSummary.js +7 -1
- package/dist/jvm/runtime/GcSummary.js.map +1 -1
- package/dist/jvm/surfaces/ClassesSurface.cjs +11 -10
- package/dist/jvm/surfaces/ClassesSurface.cjs.map +1 -1
- package/dist/jvm/surfaces/ClassesSurface.d.ts.map +1 -1
- package/dist/jvm/surfaces/ClassesSurface.js +12 -11
- package/dist/jvm/surfaces/ClassesSurface.js.map +1 -1
- package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.cjs +11 -3
- package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.cjs.map +1 -1
- package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.d.ts +2 -0
- package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.d.ts.map +1 -1
- package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.js +11 -3
- package/dist/jvm/surfaces/JvmDiagnosticsWorkspace.js.map +1 -1
- package/dist/jvm/surfaces/PatchesSurface.cjs +3 -8
- package/dist/jvm/surfaces/PatchesSurface.cjs.map +1 -1
- package/dist/jvm/surfaces/PatchesSurface.d.ts +2 -1
- package/dist/jvm/surfaces/PatchesSurface.d.ts.map +1 -1
- package/dist/jvm/surfaces/PatchesSurface.js +4 -9
- package/dist/jvm/surfaces/PatchesSurface.js.map +1 -1
- package/dist/jvm/surfaces/ThreadsSurface.cjs +7 -4
- package/dist/jvm/surfaces/ThreadsSurface.cjs.map +1 -1
- package/dist/jvm/surfaces/ThreadsSurface.d.ts +4 -1
- package/dist/jvm/surfaces/ThreadsSurface.d.ts.map +1 -1
- package/dist/jvm/surfaces/ThreadsSurface.js +7 -4
- package/dist/jvm/surfaces/ThreadsSurface.js.map +1 -1
- package/dist/jvm/surfaces/jvm-context.cjs +23 -4
- package/dist/jvm/surfaces/jvm-context.cjs.map +1 -1
- package/dist/jvm/surfaces/jvm-context.d.ts +7 -0
- package/dist/jvm/surfaces/jvm-context.d.ts.map +1 -1
- package/dist/jvm/surfaces/jvm-context.js +23 -5
- package/dist/jvm/surfaces/jvm-context.js.map +1 -1
- package/dist/jvm/surfaces/use-patch-actions.cjs +2 -2
- package/dist/jvm/surfaces/use-patch-actions.cjs.map +1 -1
- package/dist/jvm/surfaces/use-patch-actions.js +2 -2
- package/dist/jvm/surfaces/use-patch-actions.js.map +1 -1
- package/dist/jvm/threads/FoldedStackTrace.cjs +3 -2
- package/dist/jvm/threads/FoldedStackTrace.cjs.map +1 -1
- package/dist/jvm/threads/FoldedStackTrace.d.ts +4 -1
- package/dist/jvm/threads/FoldedStackTrace.d.ts.map +1 -1
- package/dist/jvm/threads/FoldedStackTrace.js +3 -2
- package/dist/jvm/threads/FoldedStackTrace.js.map +1 -1
- package/dist/jvm/threads/ThreadDetail.cjs +6 -2
- package/dist/jvm/threads/ThreadDetail.cjs.map +1 -1
- package/dist/jvm/threads/ThreadDetail.d.ts +4 -1
- package/dist/jvm/threads/ThreadDetail.d.ts.map +1 -1
- package/dist/jvm/threads/ThreadDetail.js +6 -2
- package/dist/jvm/threads/ThreadDetail.js.map +1 -1
- package/dist/jvm.cjs +3 -0
- package/dist/jvm.d.ts +2 -1
- package/dist/jvm.d.ts.map +1 -1
- package/dist/jvm.js +3 -2
- package/dist/layout/AppShell.cjs.map +1 -1
- package/dist/layout/AppShell.d.ts +16 -0
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/AppShell.js.map +1 -1
- package/dist/layout/AppShell.nav.cjs +21 -2
- package/dist/layout/AppShell.nav.cjs.map +1 -1
- package/dist/layout/AppShell.nav.js +21 -2
- package/dist/layout/AppShell.nav.js.map +1 -1
- package/dist/layout/Workspace.cjs +66 -21
- package/dist/layout/Workspace.cjs.map +1 -1
- package/dist/layout/Workspace.d.ts +6 -1
- package/dist/layout/Workspace.d.ts.map +1 -1
- package/dist/layout/Workspace.js +66 -21
- package/dist/layout/Workspace.js.map +1 -1
- package/dist/layout/Workspace.model.cjs +20 -0
- package/dist/layout/Workspace.model.cjs.map +1 -1
- package/dist/layout/Workspace.model.d.ts +17 -0
- package/dist/layout/Workspace.model.d.ts.map +1 -1
- package/dist/layout/Workspace.model.js +20 -1
- package/dist/layout/Workspace.model.js.map +1 -1
- package/dist/layout/Workspace.regions.cjs +10 -6
- package/dist/layout/Workspace.regions.cjs.map +1 -1
- package/dist/layout/Workspace.regions.d.ts +4 -1
- package/dist/layout/Workspace.regions.d.ts.map +1 -1
- package/dist/layout/Workspace.regions.js +10 -6
- package/dist/layout/Workspace.regions.js.map +1 -1
- package/dist/lib/duration.cjs +20 -0
- package/dist/lib/duration.cjs.map +1 -1
- package/dist/lib/duration.d.ts +8 -0
- package/dist/lib/duration.d.ts.map +1 -1
- package/dist/lib/duration.js +19 -1
- package/dist/lib/duration.js.map +1 -1
- package/dist/monaco/MonacoEditor.cjs +34 -30
- package/dist/monaco/MonacoEditor.cjs.map +1 -1
- package/dist/monaco/MonacoEditor.d.ts.map +1 -1
- package/dist/monaco/MonacoEditor.js +34 -30
- package/dist/monaco/MonacoEditor.js.map +1 -1
- package/dist/overlay/ConfirmDialog.cjs +5 -2
- package/dist/overlay/ConfirmDialog.cjs.map +1 -1
- package/dist/overlay/ConfirmDialog.d.ts +14 -2
- package/dist/overlay/ConfirmDialog.d.ts.map +1 -1
- package/dist/overlay/ConfirmDialog.js +5 -2
- package/dist/overlay/ConfirmDialog.js.map +1 -1
- package/dist/profiles/cel/celEditor.cjs +94 -285
- package/dist/profiles/cel/celEditor.cjs.map +1 -1
- package/dist/profiles/cel/celEditor.d.ts +10 -15
- package/dist/profiles/cel/celEditor.d.ts.map +1 -1
- package/dist/profiles/cel/celEditor.js +97 -287
- package/dist/profiles/cel/celEditor.js.map +1 -1
- package/dist/profiles/cel/celExpression.cjs +1 -61
- package/dist/profiles/cel/celExpression.cjs.map +1 -1
- package/dist/profiles/cel/celExpression.d.ts +2 -38
- package/dist/profiles/cel/celExpression.d.ts.map +1 -1
- package/dist/profiles/cel/celExpression.js +2 -58
- package/dist/profiles/cel/celExpression.js.map +1 -1
- package/dist/profiles/cel/celPlayground.cjs +122 -0
- package/dist/profiles/cel/celPlayground.cjs.map +1 -0
- package/dist/profiles/cel/celPlayground.d.ts +43 -0
- package/dist/profiles/cel/celPlayground.d.ts.map +1 -0
- package/dist/profiles/cel/celPlayground.js +118 -0
- package/dist/profiles/cel/celPlayground.js.map +1 -0
- package/dist/profiles/connections/connectionBrowserModel.cjs +2 -2
- package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.d.ts +5 -1
- package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.js +2 -2
- package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.cjs +2 -1
- package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -1
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.js +2 -1
- package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
- package/dist/profiles/editor/UnwrapPreviewList.cjs +90 -0
- package/dist/profiles/editor/UnwrapPreviewList.cjs.map +1 -0
- package/dist/profiles/editor/UnwrapPreviewList.d.ts +7 -0
- package/dist/profiles/editor/UnwrapPreviewList.d.ts.map +1 -0
- package/dist/profiles/editor/UnwrapPreviewList.js +90 -0
- package/dist/profiles/editor/UnwrapPreviewList.js.map +1 -0
- package/dist/profiles/editor/profileCanonicalQuery.cjs +6 -58
- package/dist/profiles/editor/profileCanonicalQuery.cjs.map +1 -1
- package/dist/profiles/editor/profileCanonicalQuery.d.ts +1 -1
- package/dist/profiles/editor/profileCanonicalQuery.d.ts.map +1 -1
- package/dist/profiles/editor/profileCanonicalQuery.js +4 -56
- package/dist/profiles/editor/profileCanonicalQuery.js.map +1 -1
- package/dist/profiles/editor/profileCanonicalTranslate.cjs +48 -0
- package/dist/profiles/editor/profileCanonicalTranslate.cjs.map +1 -0
- package/dist/profiles/editor/profileCanonicalTranslate.d.ts +24 -0
- package/dist/profiles/editor/profileCanonicalTranslate.d.ts.map +1 -0
- package/dist/profiles/editor/profileCanonicalTranslate.js +47 -0
- package/dist/profiles/editor/profileCanonicalTranslate.js.map +1 -0
- package/dist/profiles/editor/profileEditor.cjs +126 -38
- package/dist/profiles/editor/profileEditor.cjs.map +1 -1
- package/dist/profiles/editor/profileEditor.d.ts +5 -1
- package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditor.js +127 -39
- package/dist/profiles/editor/profileEditor.js.map +1 -1
- package/dist/profiles/editor/profileEditorModel.cjs +65 -19
- package/dist/profiles/editor/profileEditorModel.cjs.map +1 -1
- package/dist/profiles/editor/profileEditorModel.d.ts +24 -8
- package/dist/profiles/editor/profileEditorModel.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditorModel.js +64 -18
- package/dist/profiles/editor/profileEditorModel.js.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.cjs +129 -29
- package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.d.ts +18 -5
- package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.js +129 -29
- package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
- package/dist/profiles/editor/profileEditorSections.cjs +137 -88
- package/dist/profiles/editor/profileEditorSections.cjs.map +1 -1
- package/dist/profiles/editor/profileEditorSections.d.ts +18 -2
- package/dist/profiles/editor/profileEditorSections.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditorSections.js +138 -90
- package/dist/profiles/editor/profileEditorSections.js.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.cjs +22 -6
- package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.d.ts +17 -1
- package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.js +23 -7
- package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
- package/dist/profiles/editor/profileSaveAsDialog.cjs +93 -0
- package/dist/profiles/editor/profileSaveAsDialog.cjs.map +1 -0
- package/dist/profiles/editor/profileSaveAsDialog.d.ts +17 -0
- package/dist/profiles/editor/profileSaveAsDialog.d.ts.map +1 -0
- package/dist/profiles/editor/profileSaveAsDialog.js +93 -0
- package/dist/profiles/editor/profileSaveAsDialog.js.map +1 -0
- package/dist/profiles/editor/profileSourceExtensions.cjs +71 -0
- package/dist/profiles/editor/profileSourceExtensions.cjs.map +1 -0
- package/dist/profiles/editor/profileSourceExtensions.d.ts +26 -0
- package/dist/profiles/editor/profileSourceExtensions.d.ts.map +1 -0
- package/dist/profiles/editor/profileSourceExtensions.js +70 -0
- package/dist/profiles/editor/profileSourceExtensions.js.map +1 -0
- package/dist/profiles/editor/samplePaths.cjs +54 -0
- package/dist/profiles/editor/samplePaths.cjs.map +1 -0
- package/dist/profiles/editor/samplePaths.d.ts +27 -0
- package/dist/profiles/editor/samplePaths.d.ts.map +1 -0
- package/dist/profiles/editor/samplePaths.js +53 -0
- package/dist/profiles/editor/samplePaths.js.map +1 -0
- package/dist/profiles/editor/testSchema.d.ts.map +1 -1
- package/dist/profiles/editor/useUnwrapPreviews.cjs +60 -0
- package/dist/profiles/editor/useUnwrapPreviews.cjs.map +1 -0
- package/dist/profiles/editor/useUnwrapPreviews.d.ts +38 -0
- package/dist/profiles/editor/useUnwrapPreviews.d.ts.map +1 -0
- package/dist/profiles/editor/useUnwrapPreviews.js +60 -0
- package/dist/profiles/editor/useUnwrapPreviews.js.map +1 -0
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs +10 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.js +11 -2
- package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilderForm.cjs +38 -0
- package/dist/profiles/elasticsearch/esQueryBuilderForm.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilderForm.d.ts +17 -0
- package/dist/profiles/elasticsearch/esQueryBuilderForm.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilderForm.js +37 -1
- package/dist/profiles/elasticsearch/esQueryBuilderForm.js.map +1 -1
- package/dist/profiles/elasticsearch/esQueryConditionRow.cjs +4 -3
- package/dist/profiles/elasticsearch/esQueryConditionRow.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryConditionRow.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryConditionRow.js +4 -3
- package/dist/profiles/elasticsearch/esQueryConditionRow.js.map +1 -1
- package/dist/profiles/elasticsearch/esQueryOperators.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryOperators.d.ts +8 -0
- package/dist/profiles/elasticsearch/esQueryOperators.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryOperators.js.map +1 -1
- package/dist/profiles/fields/profileFieldControls.cjs +3 -2
- package/dist/profiles/fields/profileFieldControls.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldControls.d.ts +3 -1
- package/dist/profiles/fields/profileFieldControls.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldControls.js +3 -2
- package/dist/profiles/fields/profileFieldControls.js.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.cjs +98 -185
- package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.d.ts +11 -3
- package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.js +99 -186
- package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.cjs +115 -81
- package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.js +116 -82
- package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.cjs +2 -0
- package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.js +2 -0
- package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
- package/dist/profiles/fields/profileFieldList.cjs +23 -1
- package/dist/profiles/fields/profileFieldList.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldList.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldList.js +23 -1
- package/dist/profiles/fields/profileFieldList.js.map +1 -1
- package/dist/profiles/fields/profileFieldPreview.cjs +111 -0
- package/dist/profiles/fields/profileFieldPreview.cjs.map +1 -0
- package/dist/profiles/fields/profileFieldPreview.d.ts +25 -0
- package/dist/profiles/fields/profileFieldPreview.d.ts.map +1 -0
- package/dist/profiles/fields/profileFieldPreview.js +110 -0
- package/dist/profiles/fields/profileFieldPreview.js.map +1 -0
- package/dist/profiles/fields/profileFieldSample.cjs +182 -0
- package/dist/profiles/fields/profileFieldSample.cjs.map +1 -0
- package/dist/profiles/fields/profileFieldSample.d.ts +35 -0
- package/dist/profiles/fields/profileFieldSample.d.ts.map +1 -0
- package/dist/profiles/fields/profileFieldSample.js +180 -0
- package/dist/profiles/fields/profileFieldSample.js.map +1 -0
- package/dist/profiles/fields/profileFieldTypeField.cjs +104 -0
- package/dist/profiles/fields/profileFieldTypeField.cjs.map +1 -0
- package/dist/profiles/fields/profileFieldTypeField.d.ts +17 -0
- package/dist/profiles/fields/profileFieldTypeField.d.ts.map +1 -0
- package/dist/profiles/fields/profileFieldTypeField.js +104 -0
- package/dist/profiles/fields/profileFieldTypeField.js.map +1 -0
- package/dist/profiles/fields/profileFieldTypes.cjs +1 -0
- package/dist/profiles/fields/profileFieldTypes.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldTypes.d.ts +1 -1
- package/dist/profiles/fields/profileFieldTypes.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldTypes.js +1 -0
- package/dist/profiles/fields/profileFieldTypes.js.map +1 -1
- package/dist/profiles/fields/profileFieldValueEditor.cjs +298 -0
- package/dist/profiles/fields/profileFieldValueEditor.cjs.map +1 -0
- package/dist/profiles/fields/profileFieldValueEditor.d.ts +18 -0
- package/dist/profiles/fields/profileFieldValueEditor.d.ts.map +1 -0
- package/dist/profiles/fields/profileFieldValueEditor.js +298 -0
- package/dist/profiles/fields/profileFieldValueEditor.js.map +1 -0
- package/dist/profiles/fields/profileFieldValueMode.cjs +61 -0
- package/dist/profiles/fields/profileFieldValueMode.cjs.map +1 -0
- package/dist/profiles/fields/profileFieldValueMode.d.ts +34 -0
- package/dist/profiles/fields/profileFieldValueMode.d.ts.map +1 -0
- package/dist/profiles/fields/profileFieldValueMode.js +59 -0
- package/dist/profiles/fields/profileFieldValueMode.js.map +1 -0
- package/dist/profiles/processor/processorConfig.cjs +79 -79
- package/dist/profiles/processor/processorConfig.cjs.map +1 -1
- package/dist/profiles/processor/processorConfig.d.ts +30 -3
- package/dist/profiles/processor/processorConfig.d.ts.map +1 -1
- package/dist/profiles/processor/processorConfig.js +78 -78
- package/dist/profiles/processor/processorConfig.js.map +1 -1
- package/dist/profiles/processor/processorPipeline.cjs +24 -8
- package/dist/profiles/processor/processorPipeline.cjs.map +1 -1
- package/dist/profiles/processor/processorPipeline.d.ts +3 -3
- package/dist/profiles/processor/processorPipeline.d.ts.map +1 -1
- package/dist/profiles/processor/processorPipeline.js +25 -9
- package/dist/profiles/processor/processorPipeline.js.map +1 -1
- package/dist/profiles/processor/processorPipelineEditor.cjs +38 -94
- package/dist/profiles/processor/processorPipelineEditor.cjs.map +1 -1
- package/dist/profiles/processor/processorPipelineEditor.d.ts +3 -3
- package/dist/profiles/processor/processorPipelineEditor.d.ts.map +1 -1
- package/dist/profiles/processor/processorPipelineEditor.js +39 -95
- package/dist/profiles/processor/processorPipelineEditor.js.map +1 -1
- package/dist/profiles/processor/processorPipelineExtension.cjs +3 -2
- package/dist/profiles/processor/processorPipelineExtension.cjs.map +1 -1
- package/dist/profiles/processor/processorPipelineExtension.d.ts.map +1 -1
- package/dist/profiles/processor/processorPipelineExtension.js +3 -2
- package/dist/profiles/processor/processorPipelineExtension.js.map +1 -1
- package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -1
- package/dist/profiles/query/profileSampleFilterLookup.d.ts +6 -3
- package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -1
- package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.cjs +10 -1
- package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.d.ts +6 -0
- package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.js +10 -1
- package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.cjs +10 -22
- package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts +8 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.js +11 -23
- package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
- package/dist/profiles/wizard/useProfileInspection.cjs +39 -0
- package/dist/profiles/wizard/useProfileInspection.cjs.map +1 -0
- package/dist/profiles/wizard/useProfileInspection.d.ts +21 -0
- package/dist/profiles/wizard/useProfileInspection.d.ts.map +1 -0
- package/dist/profiles/wizard/useProfileInspection.js +39 -0
- package/dist/profiles/wizard/useProfileInspection.js.map +1 -0
- package/dist/profiles.cjs +9 -11
- package/dist/profiles.js +8 -8
- package/dist/rpc/EntityExplorerApp.cjs +7 -3
- package/dist/rpc/EntityExplorerApp.cjs.map +1 -1
- package/dist/rpc/EntityExplorerApp.d.ts +16 -1
- package/dist/rpc/EntityExplorerApp.d.ts.map +1 -1
- package/dist/rpc/EntityExplorerApp.js +7 -3
- package/dist/rpc/EntityExplorerApp.js.map +1 -1
- package/dist/rpc/InlineError.cjs +30 -10
- package/dist/rpc/InlineError.cjs.map +1 -1
- package/dist/rpc/InlineError.d.ts +10 -1
- package/dist/rpc/InlineError.d.ts.map +1 -1
- package/dist/rpc/InlineError.js +30 -10
- package/dist/rpc/InlineError.js.map +1 -1
- package/dist/rpc/SchemaActionForm.cjs +9 -6
- package/dist/rpc/SchemaActionForm.cjs.map +1 -1
- package/dist/rpc/SchemaActionForm.d.ts.map +1 -1
- package/dist/rpc/SchemaActionForm.js +9 -6
- package/dist/rpc/SchemaActionForm.js.map +1 -1
- package/dist/rpc/SessionHeader.cjs +117 -111
- package/dist/rpc/SessionHeader.cjs.map +1 -1
- package/dist/rpc/SessionHeader.d.ts +3 -1
- package/dist/rpc/SessionHeader.d.ts.map +1 -1
- package/dist/rpc/SessionHeader.js +117 -111
- package/dist/rpc/SessionHeader.js.map +1 -1
- package/dist/rpc/formMetadata.cjs +2 -6
- package/dist/rpc/formMetadata.cjs.map +1 -1
- package/dist/rpc/formMetadata.d.ts.map +1 -1
- package/dist/rpc/formMetadata.js +1 -5
- package/dist/rpc/formMetadata.js.map +1 -1
- package/dist/rpc/surfaceNav.cjs +5 -0
- package/dist/rpc/surfaceNav.cjs.map +1 -1
- package/dist/rpc/surfaceNav.d.ts.map +1 -1
- package/dist/rpc/surfaceNav.js +5 -0
- package/dist/rpc/surfaceNav.js.map +1 -1
- package/dist/runtime/barrels.json +8944 -8877
- package/dist/runtime/importmap.json +2168 -2129
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs +0 -91
- package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs.map +0 -1
- package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts +0 -7
- package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts.map +0 -1
- package/dist/data/ai/runtime-profiles/ResolutionInspector.js +0 -91
- package/dist/data/ai/runtime-profiles/ResolutionInspector.js.map +0 -1
- package/dist/profiles/cel/celEditorResults.cjs +0 -158
- package/dist/profiles/cel/celEditorResults.cjs.map +0 -1
- package/dist/profiles/cel/celEditorResults.d.ts +0 -37
- package/dist/profiles/cel/celEditorResults.d.ts.map +0 -1
- package/dist/profiles/cel/celEditorResults.js +0 -156
- package/dist/profiles/cel/celEditorResults.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionPlayground.js","names":["packagedSpec","spec"],"sources":["../../../src/expressions/playground/ExpressionPlayground.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Combobox } from \"../../components/Combobox\";\nimport { Tabs } from \"../../layout/Tabs\";\nimport { MonacoEditor } from \"../../monaco/MonacoEditor\";\nimport type { Monaco } from \"@monaco-editor/react\";\nimport * as monacoEditor from \"monaco-editor\";\n\nimport {\n mergeSpec,\n registerGomplateLanguages,\n spec as packagedSpec,\n} from \"../lang/index.ts\";\nimport type { GomplateSpec, RegisteredLanguages } from \"../lang/index.ts\";\nimport { DEFAULT_API_BASE, fetchExamples, fetchSpec } from \"./api.ts\";\nimport type { EvalRequest, EvalResponse, Example, PlaygroundSample, ResultExpectation } from \"./api.ts\";\nimport { LANGUAGES, languageById } from \"./languages.ts\";\nimport type { PlaygroundLanguage } from \"./languages.ts\";\nimport { GraphPanel } from \"./panels/GraphPanel.tsx\";\nimport { ResultView, type ResultViewId } from \"./panels/ResultView.tsx\";\nimport { SpecPanel } from \"./panels/SpecPanel.tsx\";\nimport { TokensPanel } from \"./panels/TokensPanel.tsx\";\nimport { RunControls } from \"./RunControls.tsx\";\nimport { registerRunAction } from \"./runAction.ts\";\nimport { useEditorTheme } from \"./useEditorTheme.ts\";\nimport { useEvaluator, type Evaluator } from \"./useEvaluator.ts\";\nimport { useParsedInput } from \"./useParsedInput.ts\";\nimport { useSampleRuns } from \"./useSampleRuns.ts\";\nimport { VerticalSplit } from \"./VerticalSplit.tsx\";\nimport { rowsToPaneHeight } from \"./verticalSplitModel\";\n\n/** What the author is editing. Hosts persist this wherever suits them. */\nexport interface PlaygroundState {\n language: string;\n source: string;\n input: string;\n}\n\nexport interface ExpressionPlaygroundProps {\n /**\n * Where the host mounted the playground API. Defaults to `/api`; a host\n * serving it behind a prefix passes that instead.\n */\n apiBase?: string;\n /** Languages offered. Defaults to everything gomplate evaluates. */\n languages?: PlaygroundLanguage[];\n /**\n * Samples to offer. Fetched from the server when omitted, so a host that\n * configured `Options.Examples` needs no prop at all.\n */\n examples?: Example[];\n /** Host catalogue. When supplied, the playground does not fetch /spec. */\n spec?: GomplateSpec;\n /** Host evaluator for runtimes beyond the packaged playground API. */\n evaluate?: (request: EvalRequest, signal: AbortSignal) => Promise<EvalResponse>;\n /**\n * Runs before every run with the evaluations it is about to make -- one for\n * the current input, one per sample for \"All samples\". Return false to cancel.\n */\n beforeRun?: (requests: EvalRequest[]) => boolean | Promise<boolean>;\n /**\n * Inputs the expression should hold for. With two or more, the Result tab\n * offers \"All samples\", which evaluates the expression against each in turn.\n */\n samples?: PlaygroundSample[];\n /** What the result is going into: allowed values, rules and a validator. */\n expectation?: ResultExpectation;\n /** Explicit mode disables evaluation on mount and edits. */\n executionMode?: \"automatic\" | \"explicit\";\n /** Host syntax for paths inserted from the object graph. */\n formatPath?: (segments: Array<string | number>) => string | null;\n /** Controlled state. Pair with `onChange`. */\n value?: PlaygroundState;\n onChange?: (state: PlaygroundState) => void;\n /** Starting state when uncontrolled. */\n defaultValue?: PlaygroundState;\n className?: string;\n}\n\nconst SOURCE_MODEL_PATH = \"inmemory://expressions/source\";\nconst INPUT_MODEL_PATH = \"inmemory://expressions/input.yaml\";\n\nconst EMPTY_STATE: PlaygroundState = { language: \"cel\", source: \"\", input: \"\" };\n\n/**\n * An editor for one expression, the document it runs against, and its result.\n *\n * Deliberately shell-less: it renders the editors and the output panels and\n * nothing around them, so a host frames it with its own navigation. gomplate's\n * playground wraps it in an AppShell with a language rail; an app embedding it\n * in a drawer wraps it in nothing at all.\n *\n * Highlighting, completion and hover come from the catalogue the *server*\n * reports, so a host's own functions are first-class here without this\n * component knowing anything about them.\n */\nexport function ExpressionPlayground({\n apiBase = DEFAULT_API_BASE,\n languages: offered = LANGUAGES,\n examples,\n spec,\n evaluate,\n beforeRun,\n samples = [],\n expectation,\n executionMode,\n formatPath,\n value,\n onChange,\n defaultValue,\n className,\n}: ExpressionPlaygroundProps) {\n const [uncontrolled, setUncontrolled] = useState<PlaygroundState>(\n () => defaultValue ?? { ...EMPTY_STATE, language: offered[0]?.id ?? \"cel\" },\n );\n const state = value ?? uncontrolled;\n\n const update = useCallback(\n (patch: Partial<PlaygroundState>) => {\n const next = { ...state, ...patch };\n if (!value) setUncontrolled(next);\n onChange?.(next);\n },\n [state, value, onChange],\n );\n\n const language = useMemo(\n () => languageById(state.language, offered),\n [state.language, offered],\n );\n const [outputTab, setOutputTab] = useState(\"result\");\n\n const evaluator = useEvaluator(apiBase, {\n language: language.evalLanguage,\n source: state.source,\n input: state.input,\n }, {\n ...(executionMode ? { mode: executionMode } : {}),\n ...(evaluate ? { evaluate } : {}),\n ...(beforeRun ? { beforeRun } : {}),\n });\n\n const [resultView, setResultView] = useState<ResultViewId>(\"input\");\n const sampleRuns = useSampleRuns(apiBase, {\n language: language.evalLanguage,\n source: state.source,\n samples,\n }, {\n ...(evaluate ? { evaluate } : {}),\n ...(beforeRun ? { beforeRun } : {}),\n });\n // Run, its shortcut and the Monaco action all drive whichever result view is\n // showing, so \"run\" never means evaluating something the author cannot see.\n const showingSamples = samples.length > 1 && outputTab === \"result\" && resultView === \"samples\";\n const runner: Evaluator = showingSamples\n ? { ...evaluator, explicit: true, autoRun: false, run: sampleRuns.run, pending: sampleRuns.pending, stale: sampleRuns.stale }\n : evaluator;\n\n // Completion reads the document through a ref: languages are registered once,\n // before the first editor mounts, while the input keeps being edited after.\n const parsedInput = useParsedInput(state.input);\n const environmentRef = useRef<unknown>(undefined);\n environmentRef.current = parsedInput.value;\n\n const [served, setServed] = useState<GomplateSpec>();\n const servedRef = useRef<GomplateSpec>(undefined);\n servedRef.current = served;\n const activeSpec = useMemo(() => mergeSpec(packagedSpec, spec ?? served), [spec, served]);\n\n const [fetched, setFetched] = useState<Example[]>();\n const available = examples ?? fetched ?? [];\n const forLanguage = available.filter(\n (example) => example.language === language.evalLanguage,\n );\n\n // Registration must happen before the first model is created, or Monaco\n // resolves the language id to plaintext and never revisits it. Which of the\n // two lands first is a race -- Monaco loads slowly, the fetch returns fast --\n // so both paths apply the catalogue.\n const registered = useRef<RegisteredLanguages | null>(null);\n const registerLanguages = useCallback((monaco: Monaco) => {\n const current = spec ?? servedRef.current;\n registered.current = registerGomplateLanguages(monaco, {\n environment: () => environmentRef.current,\n ...(current ? { spec: current } : {}),\n });\n }, [spec]);\n\n useEffect(() => {\n if (spec) return;\n const controller = new AbortController();\n void fetchSpec(apiBase, controller.signal).then((next) => {\n if (!controller.signal.aborted) setServed(next);\n });\n return () => controller.abort();\n }, [apiBase, spec]);\n\n useEffect(() => {\n if (spec ?? served) registered.current?.setSpec(spec ?? served);\n }, [spec, served]);\n\n useEffect(() => {\n if (examples) return;\n const controller = new AbortController();\n void fetchExamples(apiBase, controller.signal).then((next) => {\n if (!controller.signal.aborted && next) setFetched(next);\n });\n return () => controller.abort();\n }, [apiBase, examples]);\n\n useMarkers(evaluator.response);\n const applyTheme = useEditorTheme();\n\n useEffect(() => {\n if (outputTab === \"spec\" && !language.catalogue) setOutputTab(\"result\");\n }, [language.catalogue, outputTab]);\n\n // The Monaco action is registered once per editor, so it has to reach the\n // current `run` through a ref rather than capturing it.\n const runRef = useRef(runner.run);\n runRef.current = runner.run;\n const sourceEditor = useRef<Parameters<typeof registerRunAction>[0] | null>(\n null,\n );\n const onEditorMount = useCallback(\n (editor: Parameters<typeof registerRunAction>[0], monaco: Monaco) => {\n applyTheme();\n registerRunAction(editor, monaco, () => runRef.current());\n if (editor.getModel()?.uri.toString() === SOURCE_MODEL_PATH)\n sourceEditor.current = editor;\n },\n [applyTheme],\n );\n\n /** Writes a path from the object graph where the author last left the caret. */\n const insertExpression = useCallback((expression: string) => {\n const editor = sourceEditor.current;\n const selection = editor?.getSelection();\n if (!editor || !selection) return;\n editor.executeEdits(\"object-graph\", [\n { range: selection, text: expression, forceMoveMarkers: true },\n ]);\n editor.focus();\n }, []);\n\n const catalogue = language.catalogue\n ? activeSpec[language.catalogue].functions\n : [];\n\n return (\n <div className={`flex h-full min-h-0 ${className ?? \"\"}`}>\n <div className=\"flex min-h-0 w-1/2 flex-col border-r border-border\">\n <VerticalSplit\n storageKey=\"expressions:editor-split\"\n defaultTopHeight={rowsToPaneHeight(language.editorRows)}\n top={\n <EditorPane\n label=\"Expression\"\n actions={<RunControls evaluator={runner} label={showingSamples ? \"Run all\" : \"Run\"} />}\n hint={\n forLanguage.length > 0 ? (\n <Combobox\n options={forLanguage.map((example) => ({\n value: example.name,\n label: example.name,\n }))}\n value=\"\"\n allowCustomValue={false}\n placeholder=\"Load an example…\"\n ariaLabel=\"Load an example\"\n className=\"w-56\"\n onChange={(name) => {\n const example = forLanguage.find(\n (candidate) => candidate.name === name,\n );\n if (example)\n update({\n source: example.source,\n input: example.input,\n });\n }}\n />\n ) : undefined\n }\n >\n <MonacoEditor\n value={state.source}\n onChange={(source) => update({ source: source ?? \"\" })}\n language={language.editorLanguage}\n path={SOURCE_MODEL_PATH}\n height=\"100%\"\n beforeMount={registerLanguages}\n onMount={onEditorMount}\n />\n </EditorPane>\n }\n bottom={\n <EditorPane\n label=\"Input\"\n hint={\n <span\n className={`truncate text-[11px] ${\n parsedInput.error\n ? \"text-destructive\"\n : \"text-muted-foreground/70\"\n }`}\n title={parsedInput.error ?? undefined}\n >\n {parsedInput.error ?? \"YAML or JSON\"}\n </span>\n }\n >\n <MonacoEditor\n value={state.input}\n onChange={(input) => update({ input: input ?? \"\" })}\n language=\"yaml\"\n path={INPUT_MODEL_PATH}\n height=\"100%\"\n onMount={onEditorMount}\n />\n </EditorPane>\n }\n />\n </div>\n\n <div className=\"flex min-h-0 w-1/2 flex-col\">\n <div className=\"border-b border-border px-4\">\n <Tabs\n tabs={[\n { id: \"result\", label: \"Result\" },\n { id: \"graph\", label: \"Object graph\" },\n { id: \"tokens\", label: \"Tokens\" },\n ...(language.catalogue\n ? [{ id: \"spec\", label: \"Functions\", count: catalogue.length }]\n : []),\n ]}\n value={outputTab}\n onChange={setOutputTab}\n />\n </div>\n\n <div className=\"min-h-0 flex-1\">\n {outputTab === \"result\" ? (\n <ResultView\n view={resultView}\n onViewChange={setResultView}\n evaluator={evaluator}\n sampleRuns={sampleRuns}\n samples={samples}\n expectation={expectation}\n onUseInput={(input) => update({ input })}\n />\n ) : null}\n {outputTab === \"graph\" ? (\n <GraphPanel\n document={parsedInput.value}\n languageId={language.editorLanguage}\n onInsert={insertExpression}\n {...(formatPath ? { formatPath } : {})}\n />\n ) : null}\n {outputTab === \"tokens\" ? (\n <TokensPanel\n source={state.source}\n languageId={language.editorLanguage}\n />\n ) : null}\n {outputTab === \"spec\" && language.catalogue ? (\n <SpecPanel flavour={language.catalogue} spec={activeSpec} />\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n\nfunction EditorPane({\n label,\n hint,\n actions,\n children,\n}: {\n label: string;\n hint?: React.ReactNode;\n actions?: React.ReactNode;\n children: React.ReactNode;\n}) {\n return (\n <section className=\"flex h-full min-h-0 flex-col bg-background\">\n <header className=\"flex h-[33px] shrink-0 items-center justify-between gap-2 px-4 py-2\">\n <div className=\"flex items-baseline gap-2\">\n <h2 className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </h2>\n {hint}\n </div>\n {actions}\n </header>\n <div className=\"min-h-0 flex-1 [&_[data-slot=monaco-editor]]:h-full [&_[data-slot=monaco-editor]]:rounded-none [&_[data-slot=monaco-editor]]:border-0 [&_[data-slot=monaco-editor]]:border-t\">\n {children}\n </div>\n </section>\n );\n}\n\n/**\n * Mirrors a compile error onto the editor as a marker, so the position the\n * server reported is visible where the mistake is rather than only in the\n * result panel.\n */\nfunction useMarkers(response: EvalResponse | null) {\n useEffect(() => {\n const model = monacoEditor.editor\n .getModels()\n .find((candidate) => candidate.uri.toString() === SOURCE_MODEL_PATH);\n if (!model) return;\n\n const error = response?.error;\n if (!error?.line) {\n monacoEditor.editor.setModelMarkers(model, \"expressions\", []);\n return;\n }\n\n const column = error.column ?? 1;\n monacoEditor.editor.setModelMarkers(model, \"expressions\", [\n {\n severity: monacoEditor.MarkerSeverity.Error,\n message: error.message,\n startLineNumber: error.line,\n startColumn: column,\n endLineNumber: error.line,\n endColumn: column + 1,\n },\n ]);\n }, [response]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8EA,IAAM,oBAAoB;AAC1B,IAAM,mBAAm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ACtB,CACF,CAAC;CACH,GAAG,CAAC,QAAQ,CAAC;AACf"}
|
|
1
|
+
{"version":3,"file":"ExpressionPlayground.js","names":["packagedSpec","spec"],"sources":["../../../src/expressions/playground/ExpressionPlayground.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Combobox } from \"../../components/Combobox\";\nimport { Tabs } from \"../../layout/Tabs\";\nimport { MonacoEditor } from \"../../monaco/MonacoEditor\";\nimport type { Monaco } from \"@monaco-editor/react\";\nimport * as monacoEditor from \"monaco-editor\";\n\nimport {\n mergeSpec,\n registerGomplateLanguages,\n spec as packagedSpec,\n} from \"../lang/index.ts\";\nimport type { GomplateSpec, RegisteredLanguages } from \"../lang/index.ts\";\nimport { DEFAULT_API_BASE, fetchExamples, fetchSpec } from \"./api.ts\";\nimport type { EvalRequest, EvalResponse, Example, FormatPath, PlaygroundSample, ResultExpectation } from \"./api.ts\";\nimport { LANGUAGES, languageById } from \"./languages.ts\";\nimport type { PlaygroundLanguage } from \"./languages.ts\";\nimport { GraphPanel } from \"./panels/GraphPanel.tsx\";\nimport { ResultView, type ResultViewId } from \"./panels/ResultView.tsx\";\nimport { SpecPanel } from \"./panels/SpecPanel.tsx\";\nimport { TokensPanel } from \"./panels/TokensPanel.tsx\";\nimport { RunControls } from \"./RunControls.tsx\";\nimport { registerRunAction } from \"./runAction.ts\";\nimport { useEditorTheme } from \"./useEditorTheme.ts\";\nimport { useEvaluator, type Evaluator } from \"./useEvaluator.ts\";\nimport { useParsedInput } from \"./useParsedInput.ts\";\nimport { useSampleRuns } from \"./useSampleRuns.ts\";\nimport { VerticalSplit } from \"./VerticalSplit.tsx\";\nimport { rowsToPaneHeight } from \"./verticalSplitModel\";\n\n/** What the author is editing. Hosts persist this wherever suits them. */\nexport interface PlaygroundState {\n language: string;\n source: string;\n input: string;\n}\n\nexport interface ExpressionPlaygroundProps {\n /**\n * Where the host mounted the playground API. Defaults to `/api`; a host\n * serving it behind a prefix passes that instead.\n */\n apiBase?: string;\n /** Languages offered. Defaults to everything gomplate evaluates. */\n languages?: PlaygroundLanguage[];\n /**\n * Samples to offer. Fetched from the server when omitted, so a host that\n * configured `Options.Examples` needs no prop at all.\n */\n examples?: Example[];\n /** Host catalogue. When supplied, the playground does not fetch /spec. */\n spec?: GomplateSpec;\n /** Host evaluator for runtimes beyond the packaged playground API. */\n evaluate?: (request: EvalRequest, signal: AbortSignal) => Promise<EvalResponse>;\n /**\n * Runs before every run with the evaluations it is about to make -- one for\n * the current input, one per sample for \"All samples\". Return false to cancel.\n */\n beforeRun?: (requests: EvalRequest[]) => boolean | Promise<boolean>;\n /**\n * Inputs the expression should hold for. With two or more, the Result tab\n * offers \"All samples\", which evaluates the expression against each in turn.\n */\n samples?: PlaygroundSample[];\n /** What the result is going into: allowed values, rules and a validator. */\n expectation?: ResultExpectation;\n /** Explicit mode disables evaluation on mount and edits. */\n executionMode?: \"automatic\" | \"explicit\";\n /** Host syntax for paths inserted from the object graph. */\n formatPath?: FormatPath;\n /**\n * Where a path picked in the object graph lands. `caret` (the default) writes\n * it at the cursor, which completes an expression half-written around it;\n * `replace` overwrites the whole expression, for a language whose expression\n * is a path — a JSONPath picked over `$.old` should be `$.new`, not both.\n */\n pathInsertion?: \"caret\" | \"replace\";\n /** Controlled state. Pair with `onChange`. */\n value?: PlaygroundState;\n onChange?: (state: PlaygroundState) => void;\n /** Starting state when uncontrolled. */\n defaultValue?: PlaygroundState;\n className?: string;\n}\n\nconst SOURCE_MODEL_PATH = \"inmemory://expressions/source\";\nconst INPUT_MODEL_PATH = \"inmemory://expressions/input.yaml\";\n\nconst EMPTY_STATE: PlaygroundState = { language: \"cel\", source: \"\", input: \"\" };\n\n/**\n * An editor for one expression, the document it runs against, and its result.\n *\n * Deliberately shell-less: it renders the editors and the output panels and\n * nothing around them, so a host frames it with its own navigation. gomplate's\n * playground wraps it in an AppShell with a language rail; an app embedding it\n * in a drawer wraps it in nothing at all.\n *\n * Highlighting, completion and hover come from the catalogue the *server*\n * reports, so a host's own functions are first-class here without this\n * component knowing anything about them.\n */\nexport function ExpressionPlayground({\n apiBase = DEFAULT_API_BASE,\n languages: offered = LANGUAGES,\n examples,\n spec,\n evaluate,\n beforeRun,\n samples = [],\n expectation,\n executionMode,\n formatPath,\n pathInsertion = \"caret\",\n value,\n onChange,\n defaultValue,\n className,\n}: ExpressionPlaygroundProps) {\n const [uncontrolled, setUncontrolled] = useState<PlaygroundState>(\n () => defaultValue ?? { ...EMPTY_STATE, language: offered[0]?.id ?? \"cel\" },\n );\n const state = value ?? uncontrolled;\n\n const update = useCallback(\n (patch: Partial<PlaygroundState>) => {\n const next = { ...state, ...patch };\n if (!value) setUncontrolled(next);\n onChange?.(next);\n },\n [state, value, onChange],\n );\n\n const language = useMemo(\n () => languageById(state.language, offered),\n [state.language, offered],\n );\n const [outputTab, setOutputTab] = useState(\"result\");\n\n const evaluator = useEvaluator(apiBase, {\n language: language.evalLanguage,\n source: state.source,\n input: state.input,\n }, {\n ...(executionMode ? { mode: executionMode } : {}),\n ...(evaluate ? { evaluate } : {}),\n ...(beforeRun ? { beforeRun } : {}),\n });\n\n const [resultView, setResultView] = useState<ResultViewId>(\"input\");\n const sampleRuns = useSampleRuns(apiBase, {\n language: language.evalLanguage,\n source: state.source,\n samples,\n }, {\n ...(evaluate ? { evaluate } : {}),\n ...(beforeRun ? { beforeRun } : {}),\n });\n // Run, its shortcut and the Monaco action all drive whichever result view is\n // showing, so \"run\" never means evaluating something the author cannot see.\n const showingSamples = samples.length > 1 && outputTab === \"result\" && resultView === \"samples\";\n const runner: Evaluator = showingSamples\n ? { ...evaluator, explicit: true, autoRun: false, run: sampleRuns.run, pending: sampleRuns.pending, stale: sampleRuns.stale }\n : evaluator;\n\n // Completion reads the document through a ref: languages are registered once,\n // before the first editor mounts, while the input keeps being edited after.\n const parsedInput = useParsedInput(state.input);\n const environmentRef = useRef<unknown>(undefined);\n environmentRef.current = parsedInput.value;\n\n const [served, setServed] = useState<GomplateSpec>();\n const servedRef = useRef<GomplateSpec>(undefined);\n servedRef.current = served;\n const activeSpec = useMemo(() => mergeSpec(packagedSpec, spec ?? served), [spec, served]);\n\n const [fetched, setFetched] = useState<Example[]>();\n const available = examples ?? fetched ?? [];\n const forLanguage = available.filter(\n (example) => example.language === language.evalLanguage,\n );\n\n // Registration must happen before the first model is created, or Monaco\n // resolves the language id to plaintext and never revisits it. Which of the\n // two lands first is a race -- Monaco loads slowly, the fetch returns fast --\n // so both paths apply the catalogue.\n const registered = useRef<RegisteredLanguages | null>(null);\n const registerLanguages = useCallback((monaco: Monaco) => {\n const current = spec ?? servedRef.current;\n registered.current = registerGomplateLanguages(monaco, {\n environment: () => environmentRef.current,\n ...(current ? { spec: current } : {}),\n });\n }, [spec]);\n\n useEffect(() => {\n if (spec) return;\n const controller = new AbortController();\n void fetchSpec(apiBase, controller.signal).then((next) => {\n if (!controller.signal.aborted) setServed(next);\n });\n return () => controller.abort();\n }, [apiBase, spec]);\n\n useEffect(() => {\n if (spec ?? served) registered.current?.setSpec(spec ?? served);\n }, [spec, served]);\n\n useEffect(() => {\n if (examples) return;\n const controller = new AbortController();\n void fetchExamples(apiBase, controller.signal).then((next) => {\n if (!controller.signal.aborted && next) setFetched(next);\n });\n return () => controller.abort();\n }, [apiBase, examples]);\n\n useMarkers(evaluator.response);\n const applyTheme = useEditorTheme();\n\n useEffect(() => {\n if (outputTab === \"spec\" && !language.catalogue) setOutputTab(\"result\");\n }, [language.catalogue, outputTab]);\n\n // The Monaco action is registered once per editor, so it has to reach the\n // current `run` through a ref rather than capturing it.\n const runRef = useRef(runner.run);\n runRef.current = runner.run;\n const sourceEditor = useRef<Parameters<typeof registerRunAction>[0] | null>(\n null,\n );\n const onEditorMount = useCallback(\n (editor: Parameters<typeof registerRunAction>[0], monaco: Monaco) => {\n applyTheme();\n registerRunAction(editor, monaco, () => runRef.current());\n if (editor.getModel()?.uri.toString() === SOURCE_MODEL_PATH)\n sourceEditor.current = editor;\n },\n [applyTheme],\n );\n\n /** Writes a path from the object graph where the author last left the caret, or over the whole expression. */\n const insertExpression = useCallback((expression: string) => {\n const editor = sourceEditor.current;\n const range =\n pathInsertion === \"replace\" ? editor?.getModel()?.getFullModelRange() : editor?.getSelection();\n if (!editor || !range) return;\n editor.executeEdits(\"object-graph\", [\n { range, text: expression, forceMoveMarkers: true },\n ]);\n editor.focus();\n }, [pathInsertion]);\n\n const catalogue = language.catalogue\n ? activeSpec[language.catalogue].functions\n : [];\n\n return (\n <div className={`flex h-full min-h-0 ${className ?? \"\"}`}>\n <div className=\"flex min-h-0 w-1/2 flex-col border-r border-border\">\n <VerticalSplit\n storageKey=\"expressions:editor-split\"\n defaultTopHeight={rowsToPaneHeight(language.editorRows)}\n top={\n <EditorPane\n label=\"Expression\"\n actions={<RunControls evaluator={runner} label={showingSamples ? \"Run all\" : \"Run\"} />}\n hint={\n forLanguage.length > 0 ? (\n <Combobox\n options={forLanguage.map((example) => ({\n value: example.name,\n label: example.name,\n }))}\n value=\"\"\n allowCustomValue={false}\n placeholder=\"Load an example…\"\n ariaLabel=\"Load an example\"\n className=\"w-56\"\n onChange={(name) => {\n const example = forLanguage.find(\n (candidate) => candidate.name === name,\n );\n if (example)\n update({\n source: example.source,\n input: example.input,\n });\n }}\n />\n ) : undefined\n }\n >\n <MonacoEditor\n value={state.source}\n onChange={(source) => update({ source: source ?? \"\" })}\n language={language.editorLanguage}\n path={SOURCE_MODEL_PATH}\n height=\"100%\"\n beforeMount={registerLanguages}\n onMount={onEditorMount}\n />\n </EditorPane>\n }\n bottom={\n <EditorPane\n label=\"Input\"\n hint={\n <span\n className={`truncate text-[11px] ${\n parsedInput.error\n ? \"text-destructive\"\n : \"text-muted-foreground/70\"\n }`}\n title={parsedInput.error ?? undefined}\n >\n {parsedInput.error ?? \"YAML or JSON\"}\n </span>\n }\n >\n <MonacoEditor\n value={state.input}\n onChange={(input) => update({ input: input ?? \"\" })}\n language=\"yaml\"\n path={INPUT_MODEL_PATH}\n height=\"100%\"\n onMount={onEditorMount}\n />\n </EditorPane>\n }\n />\n </div>\n\n <div className=\"flex min-h-0 w-1/2 flex-col\">\n <div className=\"border-b border-border px-4\">\n <Tabs\n tabs={[\n { id: \"result\", label: \"Result\" },\n { id: \"graph\", label: \"Object graph\" },\n { id: \"tokens\", label: \"Tokens\" },\n ...(language.catalogue\n ? [{ id: \"spec\", label: \"Functions\", count: catalogue.length }]\n : []),\n ]}\n value={outputTab}\n onChange={setOutputTab}\n />\n </div>\n\n <div className=\"min-h-0 flex-1\">\n {outputTab === \"result\" ? (\n <ResultView\n view={resultView}\n onViewChange={setResultView}\n evaluator={evaluator}\n sampleRuns={sampleRuns}\n samples={samples}\n expectation={expectation}\n onUseInput={(input) => update({ input })}\n />\n ) : null}\n {outputTab === \"graph\" ? (\n <GraphPanel\n document={parsedInput.value}\n languageId={language.editorLanguage}\n onInsert={insertExpression}\n {...(formatPath ? { formatPath } : {})}\n />\n ) : null}\n {outputTab === \"tokens\" ? (\n <TokensPanel\n source={state.source}\n languageId={language.editorLanguage}\n />\n ) : null}\n {outputTab === \"spec\" && language.catalogue ? (\n <SpecPanel flavour={language.catalogue} spec={activeSpec} />\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n\nfunction EditorPane({\n label,\n hint,\n actions,\n children,\n}: {\n label: string;\n hint?: React.ReactNode;\n actions?: React.ReactNode;\n children: React.ReactNode;\n}) {\n return (\n <section className=\"flex h-full min-h-0 flex-col bg-background\">\n <header className=\"flex h-[33px] shrink-0 items-center justify-between gap-2 px-4 py-2\">\n <div className=\"flex items-baseline gap-2\">\n <h2 className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </h2>\n {hint}\n </div>\n {actions}\n </header>\n <div className=\"min-h-0 flex-1 [&_[data-slot=monaco-editor]]:h-full [&_[data-slot=monaco-editor]]:rounded-none [&_[data-slot=monaco-editor]]:border-0 [&_[data-slot=monaco-editor]]:border-t\">\n {children}\n </div>\n </section>\n );\n}\n\n/**\n * Mirrors a compile error onto the editor as a marker, so the position the\n * server reported is visible where the mistake is rather than only in the\n * result panel.\n */\nfunction useMarkers(response: EvalResponse | null) {\n useEffect(() => {\n const model = monacoEditor.editor\n .getModels()\n .find((candidate) => candidate.uri.toString() === SOURCE_MODEL_PATH);\n if (!model) return;\n\n const error = response?.error;\n if (!error?.line) {\n monacoEditor.editor.setModelMarkers(model, \"expressions\", []);\n return;\n }\n\n const column = error.column ?? 1;\n monacoEditor.editor.setModelMarkers(model, \"expressions\", [\n {\n severity: monacoEditor.MarkerSeverity.Error,\n message: error.message,\n startLineNumber: error.line,\n startColumn: column,\n endLineNumber: error.line,\n endColumn: column + 1,\n },\n ]);\n }, [response]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAM,oBAAoB;AAC1B,IAAM,mBAAmB;AAEzB,IAAM,cAA+B;CAAE,UAAU;CAAO,QAAQ;CAAI,OAAO;AAAG;;;;;;;;;;;;;AAc9E,SAAgB,qBAAqB,EACnC,UAAU,kBACV,WAAW,UAAU,WACrB,UACA,MAAA,QACA,UACA,WACA,UAAU,CAAC,GACX,aACA,eACA,YACA,gBAAgB,SAChB,OACA,UACA,cACA,aAC4B;CAC5B,MAAM,CAAC,cAAc,mBAAmB,eAChC,gBAAgB;EAAE,GAAG;EAAa,UAAU,QAAQ,EAAE,EAAE,MAAM;CAAM,CAC5E;CACA,MAAM,QAAQ,SAAS;CAEvB,MAAM,SAAS,aACZ,UAAoC;EACnC,MAAM,OAAO;GAAE,GAAG;GAAO,GAAG;EAAM;EAClC,IAAI,CAAC,OAAO,gBAAgB,IAAI;EAChC,WAAW,IAAI;CACjB,GACA;EAAC;EAAO;EAAO;CAAQ,CACzB;CAEA,MAAM,WAAW,cACT,aAAa,MAAM,UAAU,OAAO,GAC1C,CAAC,MAAM,UAAU,OAAO,CAC1B;CACA,MAAM,CAAC,WAAW,gBAAgB,SAAS,QAAQ;CAEnD,MAAM,YAAY,aAAa,SAAS;EACtC,UAAU,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;IACC,CAAA,GACH,IACE;GACJ,CAAA,GAAA,OACK;EACR,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAU;GACZ;EACE,CAAA,CACE;;AAEb;;;;;;AAOA,SAAS,WAAW,UAA+B;CACjD,gBAAgB;EACd,MAAM,QAAQ,aAAa,OACxB,UAAU,CAAC,CACX,MAAM,cAAc,UAAU,IAAI,SAAS,MAAM,iBAAiB;EACrE,IAAI,CAAC,OAAO;EAEZ,MAAM,QAAQ,UAAU;EACxB,IAAI,CAAC,OAAO,MAAM;GAChB,aAAa,OAAO,gBAAgB,OAAO,eAAe,CAAC,CAAC;GAC5D;EACF;EAEA,MAAM,SAAS,MAAM,UAAU;EAC/B,aAAa,OAAO,gBAAgB,OAAO,eAAe,CACxD;GACE,UAAU,aAAa,eAAe;GACtC,SAAS,MAAM;GACf,iBAAiB,MAAM;GACvB,aAAa;GACb,eAAe,MAAM;GACrB,WAAW,SAAS;EACtB,CACF,CAAC;CACH,GAAG,CAAC,QAAQ,CAAC;AACf"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const require_Icon = require("../../data/Icon.cjs");
|
|
2
|
+
const require_UiLoader = require("../../icons/components/UiLoader.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
// src/expressions/playground/LazyEmbeddedPlayground.tsx
|
|
6
|
+
var Loaded = (0, react.lazy)(() => Promise.resolve().then(() => require("./EmbeddedPlayground.cjs")).then((module) => ({ default: module.EmbeddedPlayground })));
|
|
7
|
+
/** `EmbeddedPlayground`, loaded when first opened. */
|
|
8
|
+
function LazyEmbeddedPlayground(props) {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
10
|
+
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11
|
+
className: "flex h-full items-center justify-center p-8 text-sm text-muted-foreground",
|
|
12
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
13
|
+
icon: require_UiLoader.UiLoader,
|
|
14
|
+
className: "mr-2 animate-spin"
|
|
15
|
+
}), "Loading editor"]
|
|
16
|
+
}),
|
|
17
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Loaded, { ...props })
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.LazyEmbeddedPlayground = LazyEmbeddedPlayground;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=LazyEmbeddedPlayground.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyEmbeddedPlayground.cjs","names":["lazy","Suspense","Icon","UiLoader"],"sources":["../../../src/expressions/playground/LazyEmbeddedPlayground.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport { Icon } from \"../../data/Icon\";\nimport { UiLoader } from \"../../icons\";\nimport type { EmbeddedPlaygroundProps } from \"./EmbeddedPlayground.tsx\";\n\n// The only path from the profile editor and the JSONPath field to Monaco:\n// `import()` keeps the editor, its language registrations and the packaged\n// catalogue out of the static graph of every page that merely has a Test button.\nconst Loaded = lazy(() =>\n import(\"./EmbeddedPlayground.tsx\").then((module) => ({ default: module.EmbeddedPlayground })),\n);\n\n/** `EmbeddedPlayground`, loaded when first opened. */\nexport function LazyEmbeddedPlayground(props: EmbeddedPlaygroundProps) {\n return (\n <Suspense\n fallback={\n <div className=\"flex h-full items-center justify-center p-8 text-sm text-muted-foreground\">\n <Icon icon={UiLoader} className=\"mr-2 animate-spin\" />\n Loading editor\n </div>\n }\n >\n <Loaded {...props} />\n </Suspense>\n );\n}\n"],"mappings":";;;;;AAQA,IAAM,UAAA,GAASA,MAAAA,KAAAA,OAAAA,QAAAA,QAAAA,CAAAA,CAAAA,WAAAA,QACb,0BAAA,CAAA,CAAA,CAAmC,MAAM,YAAY,EAAE,SAAS,OAAO,mBAAmB,EAAE,CAC9F;;AAGA,SAAgB,uBAAuB,OAAgC;CACrE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,MAAAA,UAAD;EACE,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,aAAAA,MAAD;IAAM,MAAMC,iBAAAA;IAAU,WAAU;GAAqB,CAAA,GAAC,gBAEnD;;EAGP,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAQ,GAAI,MAAQ,CAAA;CACZ,CAAA;AAEd"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EmbeddedPlaygroundProps } from './EmbeddedPlayground.js';
|
|
2
|
+
/** `EmbeddedPlayground`, loaded when first opened. */
|
|
3
|
+
export declare function LazyEmbeddedPlayground(props: EmbeddedPlaygroundProps): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=LazyEmbeddedPlayground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyEmbeddedPlayground.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/LazyEmbeddedPlayground.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AASxE,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,uBAAuB,+BAapE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Icon } from "../../data/Icon.js";
|
|
2
|
+
import { UiLoader } from "../../icons/components/UiLoader.js";
|
|
3
|
+
import { Suspense, lazy } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/expressions/playground/LazyEmbeddedPlayground.tsx
|
|
6
|
+
var Loaded = lazy(() => import("./EmbeddedPlayground.js").then((module) => ({ default: module.EmbeddedPlayground })));
|
|
7
|
+
/** `EmbeddedPlayground`, loaded when first opened. */
|
|
8
|
+
function LazyEmbeddedPlayground(props) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Suspense, {
|
|
10
|
+
fallback: /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "flex h-full items-center justify-center p-8 text-sm text-muted-foreground",
|
|
12
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
13
|
+
icon: UiLoader,
|
|
14
|
+
className: "mr-2 animate-spin"
|
|
15
|
+
}), "Loading editor"]
|
|
16
|
+
}),
|
|
17
|
+
children: /* @__PURE__ */ jsx(Loaded, { ...props })
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export { LazyEmbeddedPlayground };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=LazyEmbeddedPlayground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyEmbeddedPlayground.js","names":[],"sources":["../../../src/expressions/playground/LazyEmbeddedPlayground.tsx"],"sourcesContent":["import { lazy, Suspense } from \"react\";\nimport { Icon } from \"../../data/Icon\";\nimport { UiLoader } from \"../../icons\";\nimport type { EmbeddedPlaygroundProps } from \"./EmbeddedPlayground.tsx\";\n\n// The only path from the profile editor and the JSONPath field to Monaco:\n// `import()` keeps the editor, its language registrations and the packaged\n// catalogue out of the static graph of every page that merely has a Test button.\nconst Loaded = lazy(() =>\n import(\"./EmbeddedPlayground.tsx\").then((module) => ({ default: module.EmbeddedPlayground })),\n);\n\n/** `EmbeddedPlayground`, loaded when first opened. */\nexport function LazyEmbeddedPlayground(props: EmbeddedPlaygroundProps) {\n return (\n <Suspense\n fallback={\n <div className=\"flex h-full items-center justify-center p-8 text-sm text-muted-foreground\">\n <Icon icon={UiLoader} className=\"mr-2 animate-spin\" />\n Loading editor\n </div>\n }\n >\n <Loaded {...props} />\n </Suspense>\n );\n}\n"],"mappings":";;;;;AAQA,IAAM,SAAS,WACb,OAAO,0BAA2B,CAAC,MAAM,YAAY,EAAE,SAAS,OAAO,mBAAmB,EAAE,CAC9F;;AAGA,SAAgB,uBAAuB,OAAgC;CACrE,OACE,oBAAC,UAAD;EACE,UACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,MAAD;IAAM,MAAM;IAAU,WAAU;GAAqB,CAAA,GAAC,gBAEnD;;EAGP,UAAA,oBAAC,QAAD,EAAQ,GAAI,MAAQ,CAAA;CACZ,CAAA;AAEd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","names":[],"sources":["../../../src/expressions/playground/api.ts"],"sourcesContent":["import type { GomplateSpec } from \"../lang/index.ts\";\nimport type { EvalLanguage } from \"./languages.ts\";\n\nexport interface EvalRequest {\n language: EvalLanguage;\n source: string;\n input?: string;\n leftDelim?: string;\n rightDelim?: string;\n}\n\nexport interface EvalError {\n message: string;\n line?: number;\n column?: number;\n}\n\nexport interface EvalResponse {\n result: string;\n value?: unknown;\n type?: string;\n error?: EvalError;\n durationMs: number;\n}\n\n/**\n * One input the expression should hold for. With more than one, the Result\n * tab can evaluate the current expression against every sample at once.\n */\nexport interface PlaygroundSample {\n id: string;\n label: string;\n input: string;\n}\n\n/**\n * What the result is going into. The playground shows it beside the result and\n * judges each result by `validate`; it knows nothing about schemas itself.\n */\nexport interface ResultExpectation {\n /** Allowed values. The one equal to the result is highlighted. */\n options?: Array<{ value: string; label?: string }>;\n /** Other constraints, one phrase each (\"Integer\", \"Min: 0\", \"Required\"). */\n rules?: string[];\n /** Problems with a successful result; empty when it is acceptable. */\n validate?: (response: EvalResponse) => string[];\n}\n\n/** One sample an author can load, as `GET /api/examples` returns it. */\nexport interface Example {\n name: string;\n language: EvalLanguage;\n source: string;\n input: string;\n}\n\n/**\n * Where the host mounted the playground API.\n *\n * A host serves it under its own prefix -- mission-control behind an\n * authenticated route group -- so nothing here may assume `/api`.\n */\nexport const DEFAULT_API_BASE = \"/api\";\n\n/**\n * Evaluates against the host's Go server.\n *\n * A transport failure is surfaced as an error result rather than thrown: the\n * usual cause is the server not running yet, and the playground should say so\n * rather than blank out.\n */\nexport async function evaluate(\n apiBase: string,\n request: EvalRequest,\n signal?: AbortSignal,\n): Promise<EvalResponse> {\n let response: Response;\n try {\n response = await fetch(`${apiBase}/eval`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(request),\n ...(signal ? { signal } : {}),\n });\n } catch (cause) {\n if (signal?.aborted) throw cause;\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `could not reach the evaluation server: ${String(cause)}` },\n };\n }\n\n if (!response.ok && response.status !== 400) {\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `evaluation server returned ${response.status} ${response.statusText}` },\n };\n }\n return (await response.json()) as EvalResponse;\n}\n\n/**\n * The catalogue the running server can actually evaluate.\n *\n * Wider than the one this package ships whenever the host registers functions\n * of its own. Undefined on any failure, which leaves the packaged catalogue in\n * place -- right when the server is simply not up yet.\n */\nexport async function fetchSpec(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<GomplateSpec | undefined> {\n return fetchJSON<GomplateSpec>(`${apiBase}/spec`, signal);\n}\n\nexport async function fetchExamples(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<Example[] | undefined> {\n return fetchJSON<Example[]>(`${apiBase}/examples`, signal);\n}\n\nasync function fetchJSON<T>(url: string, signal?: AbortSignal): Promise<T | undefined> {\n try {\n const response = await fetch(url, signal ? { signal } : {});\n if (!response.ok) return undefined;\n return (await response.json()) as T;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"api.cjs","names":[],"sources":["../../../src/expressions/playground/api.ts"],"sourcesContent":["import type { JSONPathNode } from \"../../components/jsonPathTree\";\nimport type { GomplateSpec } from \"../lang/index.ts\";\nimport type { EvalLanguage } from \"./languages.ts\";\n\nexport interface EvalRequest {\n language: EvalLanguage;\n source: string;\n input?: string;\n leftDelim?: string;\n rightDelim?: string;\n}\n\nexport interface EvalError {\n message: string;\n line?: number;\n column?: number;\n}\n\nexport interface EvalResponse {\n result: string;\n value?: unknown;\n type?: string;\n error?: EvalError;\n durationMs: number;\n}\n\n/**\n * One input the expression should hold for. With more than one, the Result\n * tab can evaluate the current expression against every sample at once.\n */\nexport interface PlaygroundSample {\n id: string;\n label: string;\n input: string;\n}\n\n/**\n * A host's syntax for a path picked in the object graph.\n *\n * `segments` is the node's literal path; `node` is the tree node itself, for a\n * host whose syntax depends on more than the segments — inside a JSON-encoded\n * column the path restarts at its own root, and `node.origin` says where. Null\n * means the node has no expression in the host's syntax.\n */\nexport type FormatPath = (segments: Array<string | number>, node: JSONPathNode) => string | null;\n\n/**\n * What the result is going into. The playground shows it beside the result and\n * judges each result by `validate`; it knows nothing about schemas itself.\n */\nexport interface ResultExpectation {\n /** Allowed values. The one equal to the result is highlighted. */\n options?: Array<{ value: string; label?: string }>;\n /** Other constraints, one phrase each (\"Integer\", \"Min: 0\", \"Required\"). */\n rules?: string[];\n /** Problems with a successful result; empty when it is acceptable. */\n validate?: (response: EvalResponse) => string[];\n}\n\n/** One sample an author can load, as `GET /api/examples` returns it. */\nexport interface Example {\n name: string;\n language: EvalLanguage;\n source: string;\n input: string;\n}\n\n/**\n * Where the host mounted the playground API.\n *\n * A host serves it under its own prefix -- mission-control behind an\n * authenticated route group -- so nothing here may assume `/api`.\n */\nexport const DEFAULT_API_BASE = \"/api\";\n\n/**\n * Evaluates against the host's Go server.\n *\n * A transport failure is surfaced as an error result rather than thrown: the\n * usual cause is the server not running yet, and the playground should say so\n * rather than blank out.\n */\nexport async function evaluate(\n apiBase: string,\n request: EvalRequest,\n signal?: AbortSignal,\n): Promise<EvalResponse> {\n let response: Response;\n try {\n response = await fetch(`${apiBase}/eval`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(request),\n ...(signal ? { signal } : {}),\n });\n } catch (cause) {\n if (signal?.aborted) throw cause;\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `could not reach the evaluation server: ${String(cause)}` },\n };\n }\n\n if (!response.ok && response.status !== 400) {\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `evaluation server returned ${response.status} ${response.statusText}` },\n };\n }\n return (await response.json()) as EvalResponse;\n}\n\n/**\n * The catalogue the running server can actually evaluate.\n *\n * Wider than the one this package ships whenever the host registers functions\n * of its own. Undefined on any failure, which leaves the packaged catalogue in\n * place -- right when the server is simply not up yet.\n */\nexport async function fetchSpec(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<GomplateSpec | undefined> {\n return fetchJSON<GomplateSpec>(`${apiBase}/spec`, signal);\n}\n\nexport async function fetchExamples(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<Example[] | undefined> {\n return fetchJSON<Example[]>(`${apiBase}/examples`, signal);\n}\n\nasync function fetchJSON<T>(url: string, signal?: AbortSignal): Promise<T | undefined> {\n try {\n const response = await fetch(url, signal ? { signal } : {});\n if (!response.ok) return undefined;\n return (await response.json()) as T;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;AAyEA,IAAa,mBAAmB;;;;;;;;AAShC,eAAsB,SACpB,SACA,SACA,QACuB;CACvB,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,MAAM,GAAG,QAAQ,QAAQ;GACxC,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU,OAAO;GAC5B,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC7B,CAAC;CACH,SAAS,OAAO;EACd,IAAI,QAAQ,SAAS,MAAM;EAC3B,OAAO;GACL,QAAQ;GACR,YAAY;GACZ,OAAO,EAAE,SAAS,0CAA0C,OAAO,KAAK,IAAI;EAC9E;CACF;CAEA,IAAI,CAAC,SAAS,MAAM,SAAS,WAAW,KACtC,OAAO;EACL,QAAQ;EACR,YAAY;EACZ,OAAO,EAAE,SAAS,8BAA8B,SAAS,OAAO,GAAG,SAAS,aAAa;CAC3F;CAEF,OAAQ,MAAM,SAAS,KAAK;AAC9B;;;;;;;;AASA,eAAsB,UACpB,SACA,QACmC;CACnC,OAAO,UAAwB,GAAG,QAAQ,QAAQ,MAAM;AAC1D;AAEA,eAAsB,cACpB,SACA,QACgC;CAChC,OAAO,UAAqB,GAAG,QAAQ,YAAY,MAAM;AAC3D;AAEA,eAAe,UAAa,KAAa,QAA8C;CACrF,IAAI;EACF,MAAM,WAAW,MAAM,MAAM,KAAK,SAAS,EAAE,OAAO,IAAI,CAAC,CAAC;EAC1D,IAAI,CAAC,SAAS,IAAI,OAAO,KAAA;EACzB,OAAQ,MAAM,SAAS,KAAK;CAC9B,QAAQ;EACN;CACF;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSONPathNode } from '../../components/jsonPathTree.js';
|
|
1
2
|
import { GomplateSpec } from '../lang/index.js';
|
|
2
3
|
import { EvalLanguage } from './languages.js';
|
|
3
4
|
export interface EvalRequest {
|
|
@@ -28,6 +29,15 @@ export interface PlaygroundSample {
|
|
|
28
29
|
label: string;
|
|
29
30
|
input: string;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* A host's syntax for a path picked in the object graph.
|
|
34
|
+
*
|
|
35
|
+
* `segments` is the node's literal path; `node` is the tree node itself, for a
|
|
36
|
+
* host whose syntax depends on more than the segments — inside a JSON-encoded
|
|
37
|
+
* column the path restarts at its own root, and `node.origin` says where. Null
|
|
38
|
+
* means the node has no expression in the host's syntax.
|
|
39
|
+
*/
|
|
40
|
+
export type FormatPath = (segments: Array<string | number>, node: JSONPathNode) => string | null;
|
|
31
41
|
/**
|
|
32
42
|
* What the result is going into. The playground shows it beside the result and
|
|
33
43
|
* judges each result by `validate`; it knows nothing about schemas itself.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC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src/expressions/playground/api.ts"],"sourcesContent":["import type { GomplateSpec } from \"../lang/index.ts\";\nimport type { EvalLanguage } from \"./languages.ts\";\n\nexport interface EvalRequest {\n language: EvalLanguage;\n source: string;\n input?: string;\n leftDelim?: string;\n rightDelim?: string;\n}\n\nexport interface EvalError {\n message: string;\n line?: number;\n column?: number;\n}\n\nexport interface EvalResponse {\n result: string;\n value?: unknown;\n type?: string;\n error?: EvalError;\n durationMs: number;\n}\n\n/**\n * One input the expression should hold for. With more than one, the Result\n * tab can evaluate the current expression against every sample at once.\n */\nexport interface PlaygroundSample {\n id: string;\n label: string;\n input: string;\n}\n\n/**\n * What the result is going into. The playground shows it beside the result and\n * judges each result by `validate`; it knows nothing about schemas itself.\n */\nexport interface ResultExpectation {\n /** Allowed values. The one equal to the result is highlighted. */\n options?: Array<{ value: string; label?: string }>;\n /** Other constraints, one phrase each (\"Integer\", \"Min: 0\", \"Required\"). */\n rules?: string[];\n /** Problems with a successful result; empty when it is acceptable. */\n validate?: (response: EvalResponse) => string[];\n}\n\n/** One sample an author can load, as `GET /api/examples` returns it. */\nexport interface Example {\n name: string;\n language: EvalLanguage;\n source: string;\n input: string;\n}\n\n/**\n * Where the host mounted the playground API.\n *\n * A host serves it under its own prefix -- mission-control behind an\n * authenticated route group -- so nothing here may assume `/api`.\n */\nexport const DEFAULT_API_BASE = \"/api\";\n\n/**\n * Evaluates against the host's Go server.\n *\n * A transport failure is surfaced as an error result rather than thrown: the\n * usual cause is the server not running yet, and the playground should say so\n * rather than blank out.\n */\nexport async function evaluate(\n apiBase: string,\n request: EvalRequest,\n signal?: AbortSignal,\n): Promise<EvalResponse> {\n let response: Response;\n try {\n response = await fetch(`${apiBase}/eval`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(request),\n ...(signal ? { signal } : {}),\n });\n } catch (cause) {\n if (signal?.aborted) throw cause;\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `could not reach the evaluation server: ${String(cause)}` },\n };\n }\n\n if (!response.ok && response.status !== 400) {\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `evaluation server returned ${response.status} ${response.statusText}` },\n };\n }\n return (await response.json()) as EvalResponse;\n}\n\n/**\n * The catalogue the running server can actually evaluate.\n *\n * Wider than the one this package ships whenever the host registers functions\n * of its own. Undefined on any failure, which leaves the packaged catalogue in\n * place -- right when the server is simply not up yet.\n */\nexport async function fetchSpec(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<GomplateSpec | undefined> {\n return fetchJSON<GomplateSpec>(`${apiBase}/spec`, signal);\n}\n\nexport async function fetchExamples(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<Example[] | undefined> {\n return fetchJSON<Example[]>(`${apiBase}/examples`, signal);\n}\n\nasync function fetchJSON<T>(url: string, signal?: AbortSignal): Promise<T | undefined> {\n try {\n const response = await fetch(url, signal ? { signal } : {});\n if (!response.ok) return undefined;\n return (await response.json()) as T;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../../src/expressions/playground/api.ts"],"sourcesContent":["import type { JSONPathNode } from \"../../components/jsonPathTree\";\nimport type { GomplateSpec } from \"../lang/index.ts\";\nimport type { EvalLanguage } from \"./languages.ts\";\n\nexport interface EvalRequest {\n language: EvalLanguage;\n source: string;\n input?: string;\n leftDelim?: string;\n rightDelim?: string;\n}\n\nexport interface EvalError {\n message: string;\n line?: number;\n column?: number;\n}\n\nexport interface EvalResponse {\n result: string;\n value?: unknown;\n type?: string;\n error?: EvalError;\n durationMs: number;\n}\n\n/**\n * One input the expression should hold for. With more than one, the Result\n * tab can evaluate the current expression against every sample at once.\n */\nexport interface PlaygroundSample {\n id: string;\n label: string;\n input: string;\n}\n\n/**\n * A host's syntax for a path picked in the object graph.\n *\n * `segments` is the node's literal path; `node` is the tree node itself, for a\n * host whose syntax depends on more than the segments — inside a JSON-encoded\n * column the path restarts at its own root, and `node.origin` says where. Null\n * means the node has no expression in the host's syntax.\n */\nexport type FormatPath = (segments: Array<string | number>, node: JSONPathNode) => string | null;\n\n/**\n * What the result is going into. The playground shows it beside the result and\n * judges each result by `validate`; it knows nothing about schemas itself.\n */\nexport interface ResultExpectation {\n /** Allowed values. The one equal to the result is highlighted. */\n options?: Array<{ value: string; label?: string }>;\n /** Other constraints, one phrase each (\"Integer\", \"Min: 0\", \"Required\"). */\n rules?: string[];\n /** Problems with a successful result; empty when it is acceptable. */\n validate?: (response: EvalResponse) => string[];\n}\n\n/** One sample an author can load, as `GET /api/examples` returns it. */\nexport interface Example {\n name: string;\n language: EvalLanguage;\n source: string;\n input: string;\n}\n\n/**\n * Where the host mounted the playground API.\n *\n * A host serves it under its own prefix -- mission-control behind an\n * authenticated route group -- so nothing here may assume `/api`.\n */\nexport const DEFAULT_API_BASE = \"/api\";\n\n/**\n * Evaluates against the host's Go server.\n *\n * A transport failure is surfaced as an error result rather than thrown: the\n * usual cause is the server not running yet, and the playground should say so\n * rather than blank out.\n */\nexport async function evaluate(\n apiBase: string,\n request: EvalRequest,\n signal?: AbortSignal,\n): Promise<EvalResponse> {\n let response: Response;\n try {\n response = await fetch(`${apiBase}/eval`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(request),\n ...(signal ? { signal } : {}),\n });\n } catch (cause) {\n if (signal?.aborted) throw cause;\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `could not reach the evaluation server: ${String(cause)}` },\n };\n }\n\n if (!response.ok && response.status !== 400) {\n return {\n result: \"\",\n durationMs: 0,\n error: { message: `evaluation server returned ${response.status} ${response.statusText}` },\n };\n }\n return (await response.json()) as EvalResponse;\n}\n\n/**\n * The catalogue the running server can actually evaluate.\n *\n * Wider than the one this package ships whenever the host registers functions\n * of its own. Undefined on any failure, which leaves the packaged catalogue in\n * place -- right when the server is simply not up yet.\n */\nexport async function fetchSpec(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<GomplateSpec | undefined> {\n return fetchJSON<GomplateSpec>(`${apiBase}/spec`, signal);\n}\n\nexport async function fetchExamples(\n apiBase: string,\n signal?: AbortSignal,\n): Promise<Example[] | undefined> {\n return fetchJSON<Example[]>(`${apiBase}/examples`, signal);\n}\n\nasync function fetchJSON<T>(url: string, signal?: AbortSignal): Promise<T | undefined> {\n try {\n const response = await fetch(url, signal ? { signal } : {});\n if (!response.ok) return undefined;\n return (await response.json()) as T;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;AAyEA,IAAa,mBAAmB;;;;;;;;AAShC,eAAsB,SACpB,SACA,SACA,QACuB;CACvB,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,MAAM,GAAG,QAAQ,QAAQ;GACxC,QAAQ;GACR,SAAS,EAAE,gBAAgB,mBAAmB;GAC9C,MAAM,KAAK,UAAU,OAAO;GAC5B,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC7B,CAAC;CACH,SAAS,OAAO;EACd,IAAI,QAAQ,SAAS,MAAM;EAC3B,OAAO;GACL,QAAQ;GACR,YAAY;GACZ,OAAO,EAAE,SAAS,0CAA0C,OAAO,KAAK,IAAI;EAC9E;CACF;CAEA,IAAI,CAAC,SAAS,MAAM,SAAS,WAAW,KACtC,OAAO;EACL,QAAQ;EACR,YAAY;EACZ,OAAO,EAAE,SAAS,8BAA8B,SAAS,OAAO,GAAG,SAAS,aAAa;CAC3F;CAEF,OAAQ,MAAM,SAAS,KAAK;AAC9B;;;;;;;;AASA,eAAsB,UACpB,SACA,QACmC;CACnC,OAAO,UAAwB,GAAG,QAAQ,QAAQ,MAAM;AAC1D;AAEA,eAAsB,cACpB,SACA,QACgC;CAChC,OAAO,UAAqB,GAAG,QAAQ,YAAY,MAAM;AAC3D;AAEA,eAAe,UAAa,KAAa,QAA8C;CACrF,IAAI;EACF,MAAM,WAAW,MAAM,MAAM,KAAK,SAAS,EAAE,OAAO,IAAI,CAAC,CAAC;EAC1D,IAAI,CAAC,SAAS,IAAI,OAAO,KAAA;EACzB,OAAQ,MAAM,SAAS,KAAK;CAC9B,QAAQ;EACN;CACF;AACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
let yaml = require("yaml");
|
|
2
|
+
// src/expressions/playground/hostEvaluation.ts
|
|
3
|
+
/**
|
|
4
|
+
* Pieces a host needs to run the playground on its own evaluator.
|
|
5
|
+
*
|
|
6
|
+
* The playground evaluates text against text: a source and an input document,
|
|
7
|
+
* answering with a rendered string. A host that evaluates somewhere else — a
|
|
8
|
+
* profile service, an RPC — has rows (objects) and answers with values, so
|
|
9
|
+
* these convert between the two without each host re-deriving the rules.
|
|
10
|
+
*/
|
|
11
|
+
/** An error answer: nothing was evaluated, and the author is told why. */
|
|
12
|
+
function evalFailure(message) {
|
|
13
|
+
return {
|
|
14
|
+
result: "",
|
|
15
|
+
durationMs: 0,
|
|
16
|
+
error: { message }
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The input pane's text as a document. JSON is valid YAML, so one parser reads
|
|
21
|
+
* both — the same way the Go evaluator's `parseInput` does.
|
|
22
|
+
*
|
|
23
|
+
* An empty input is an error rather than null: evaluating against nothing and
|
|
24
|
+
* reporting a clean result is how a wrong expression looks right.
|
|
25
|
+
*/
|
|
26
|
+
function parseInputDocument(input) {
|
|
27
|
+
if (input.trim() === "") return { error: "The input is empty. Add a YAML or JSON document for the expression to run against." };
|
|
28
|
+
try {
|
|
29
|
+
return { value: (0, yaml.parse)(input) };
|
|
30
|
+
} catch (cause) {
|
|
31
|
+
return { error: `The input is not valid YAML or JSON: ${cause.message}` };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A value as the playground's `result` string.
|
|
36
|
+
*
|
|
37
|
+
* Null is the empty string, not "null": the samples view calls a blank result
|
|
38
|
+
* "empty", which is exactly what an expression that read nothing should be.
|
|
39
|
+
*/
|
|
40
|
+
function resultText(value) {
|
|
41
|
+
if (value === null || value === void 0) return "";
|
|
42
|
+
if (typeof value === "string") return value;
|
|
43
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
44
|
+
return String(value);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sampled rows as the playground's samples: the row as pretty JSON, named by
|
|
48
|
+
* the host or by position.
|
|
49
|
+
*/
|
|
50
|
+
function rowSamples(rows, label) {
|
|
51
|
+
return rows.map((row, index) => ({
|
|
52
|
+
id: String(index),
|
|
53
|
+
label: label?.(row, index) ?? `row ${index + 1}`,
|
|
54
|
+
input: JSON.stringify(row, null, 2)
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
/** Where the input pane opens: the first sampled row, or an empty document. */
|
|
58
|
+
function initialInput(samples) {
|
|
59
|
+
return samples[0]?.input ?? "{}";
|
|
60
|
+
}
|
|
61
|
+
exports.evalFailure = evalFailure;
|
|
62
|
+
exports.initialInput = initialInput;
|
|
63
|
+
exports.parseInputDocument = parseInputDocument;
|
|
64
|
+
exports.resultText = resultText;
|
|
65
|
+
exports.rowSamples = rowSamples;
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=hostEvaluation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostEvaluation.cjs","names":["parse"],"sources":["../../../src/expressions/playground/hostEvaluation.ts"],"sourcesContent":["import { parse } from \"yaml\";\nimport type { EvalResponse, PlaygroundSample } from \"./api.ts\";\n\n/**\n * Pieces a host needs to run the playground on its own evaluator.\n *\n * The playground evaluates text against text: a source and an input document,\n * answering with a rendered string. A host that evaluates somewhere else — a\n * profile service, an RPC — has rows (objects) and answers with values, so\n * these convert between the two without each host re-deriving the rules.\n */\n\n/** An error answer: nothing was evaluated, and the author is told why. */\nexport function evalFailure(message: string): EvalResponse {\n return { result: \"\", durationMs: 0, error: { message } };\n}\n\nexport type ParsedDocument = { value: unknown } | { error: string };\n\n/**\n * The input pane's text as a document. JSON is valid YAML, so one parser reads\n * both — the same way the Go evaluator's `parseInput` does.\n *\n * An empty input is an error rather than null: evaluating against nothing and\n * reporting a clean result is how a wrong expression looks right.\n */\nexport function parseInputDocument(input: string): ParsedDocument {\n if (input.trim() === \"\") {\n return { error: \"The input is empty. Add a YAML or JSON document for the expression to run against.\" };\n }\n try {\n return { value: parse(input) as unknown };\n } catch (cause) {\n return { error: `The input is not valid YAML or JSON: ${(cause as Error).message}` };\n }\n}\n\n/**\n * A value as the playground's `result` string.\n *\n * Null is the empty string, not \"null\": the samples view calls a blank result\n * \"empty\", which is exactly what an expression that read nothing should be.\n */\nexport function resultText(value: unknown): string {\n if (value === null || value === undefined) return \"\";\n if (typeof value === \"string\") return value;\n if (typeof value === \"object\") return JSON.stringify(value);\n return String(value);\n}\n\n/**\n * Sampled rows as the playground's samples: the row as pretty JSON, named by\n * the host or by position.\n */\nexport function rowSamples<Row = unknown>(\n rows: readonly Row[],\n label?: (row: Row, index: number) => string,\n): PlaygroundSample[] {\n return rows.map((row, index) => ({\n id: String(index),\n label: label?.(row, index) ?? `row ${index + 1}`,\n input: JSON.stringify(row, null, 2),\n }));\n}\n\n/** Where the input pane opens: the first sampled row, or an empty document. */\nexport function initialInput(samples: readonly PlaygroundSample[]): string {\n return samples[0]?.input ?? \"{}\";\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,YAAY,SAA+B;CACzD,OAAO;EAAE,QAAQ;EAAI,YAAY;EAAG,OAAO,EAAE,QAAQ;CAAE;AACzD;;;;;;;;AAWA,SAAgB,mBAAmB,OAA+B;CAChE,IAAI,MAAM,KAAK,MAAM,IACnB,OAAO,EAAE,OAAO,qFAAqF;CAEvG,IAAI;EACF,OAAO,EAAE,QAAA,GAAOA,KAAAA,MAAAA,CAAM,KAAK,EAAa;CAC1C,SAAS,OAAO;EACd,OAAO,EAAE,OAAO,wCAAyC,MAAgB,UAAU;CACrF;AACF;;;;;;;AAQA,SAAgB,WAAW,OAAwB;CACjD,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO,KAAK,UAAU,KAAK;CAC1D,OAAO,OAAO,KAAK;AACrB;;;;;AAMA,SAAgB,WACd,MACA,OACoB;CACpB,OAAO,KAAK,KAAK,KAAK,WAAW;EAC/B,IAAI,OAAO,KAAK;EAChB,OAAO,QAAQ,KAAK,KAAK,KAAK,OAAO,QAAQ;EAC7C,OAAO,KAAK,UAAU,KAAK,MAAM,CAAC;CACpC,EAAE;AACJ;;AAGA,SAAgB,aAAa,SAA8C;CACzE,OAAO,QAAQ,EAAE,EAAE,SAAS;AAC9B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EvalResponse, PlaygroundSample } from './api.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pieces a host needs to run the playground on its own evaluator.
|
|
4
|
+
*
|
|
5
|
+
* The playground evaluates text against text: a source and an input document,
|
|
6
|
+
* answering with a rendered string. A host that evaluates somewhere else — a
|
|
7
|
+
* profile service, an RPC — has rows (objects) and answers with values, so
|
|
8
|
+
* these convert between the two without each host re-deriving the rules.
|
|
9
|
+
*/
|
|
10
|
+
/** An error answer: nothing was evaluated, and the author is told why. */
|
|
11
|
+
export declare function evalFailure(message: string): EvalResponse;
|
|
12
|
+
export type ParsedDocument = {
|
|
13
|
+
value: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
error: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The input pane's text as a document. JSON is valid YAML, so one parser reads
|
|
19
|
+
* both — the same way the Go evaluator's `parseInput` does.
|
|
20
|
+
*
|
|
21
|
+
* An empty input is an error rather than null: evaluating against nothing and
|
|
22
|
+
* reporting a clean result is how a wrong expression looks right.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseInputDocument(input: string): ParsedDocument;
|
|
25
|
+
/**
|
|
26
|
+
* A value as the playground's `result` string.
|
|
27
|
+
*
|
|
28
|
+
* Null is the empty string, not "null": the samples view calls a blank result
|
|
29
|
+
* "empty", which is exactly what an expression that read nothing should be.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resultText(value: unknown): string;
|
|
32
|
+
/**
|
|
33
|
+
* Sampled rows as the playground's samples: the row as pretty JSON, named by
|
|
34
|
+
* the host or by position.
|
|
35
|
+
*/
|
|
36
|
+
export declare function rowSamples<Row = unknown>(rows: readonly Row[], label?: (row: Row, index: number) => string): PlaygroundSample[];
|
|
37
|
+
/** Where the input pane opens: the first sampled row, or an empty document. */
|
|
38
|
+
export declare function initialInput(samples: readonly PlaygroundSample[]): string;
|
|
39
|
+
//# sourceMappingURL=hostEvaluation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostEvaluation.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/hostEvaluation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE/D;;;;;;;GAOG;AAEH,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAEzD;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAShE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKjD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,GAAG,OAAO,EACtC,IAAI,EAAE,SAAS,GAAG,EAAE,EACpB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAC1C,gBAAgB,EAAE,CAMpB;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { parse } from "yaml";
|
|
2
|
+
// src/expressions/playground/hostEvaluation.ts
|
|
3
|
+
/**
|
|
4
|
+
* Pieces a host needs to run the playground on its own evaluator.
|
|
5
|
+
*
|
|
6
|
+
* The playground evaluates text against text: a source and an input document,
|
|
7
|
+
* answering with a rendered string. A host that evaluates somewhere else — a
|
|
8
|
+
* profile service, an RPC — has rows (objects) and answers with values, so
|
|
9
|
+
* these convert between the two without each host re-deriving the rules.
|
|
10
|
+
*/
|
|
11
|
+
/** An error answer: nothing was evaluated, and the author is told why. */
|
|
12
|
+
function evalFailure(message) {
|
|
13
|
+
return {
|
|
14
|
+
result: "",
|
|
15
|
+
durationMs: 0,
|
|
16
|
+
error: { message }
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The input pane's text as a document. JSON is valid YAML, so one parser reads
|
|
21
|
+
* both — the same way the Go evaluator's `parseInput` does.
|
|
22
|
+
*
|
|
23
|
+
* An empty input is an error rather than null: evaluating against nothing and
|
|
24
|
+
* reporting a clean result is how a wrong expression looks right.
|
|
25
|
+
*/
|
|
26
|
+
function parseInputDocument(input) {
|
|
27
|
+
if (input.trim() === "") return { error: "The input is empty. Add a YAML or JSON document for the expression to run against." };
|
|
28
|
+
try {
|
|
29
|
+
return { value: parse(input) };
|
|
30
|
+
} catch (cause) {
|
|
31
|
+
return { error: `The input is not valid YAML or JSON: ${cause.message}` };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A value as the playground's `result` string.
|
|
36
|
+
*
|
|
37
|
+
* Null is the empty string, not "null": the samples view calls a blank result
|
|
38
|
+
* "empty", which is exactly what an expression that read nothing should be.
|
|
39
|
+
*/
|
|
40
|
+
function resultText(value) {
|
|
41
|
+
if (value === null || value === void 0) return "";
|
|
42
|
+
if (typeof value === "string") return value;
|
|
43
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
44
|
+
return String(value);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sampled rows as the playground's samples: the row as pretty JSON, named by
|
|
48
|
+
* the host or by position.
|
|
49
|
+
*/
|
|
50
|
+
function rowSamples(rows, label) {
|
|
51
|
+
return rows.map((row, index) => ({
|
|
52
|
+
id: String(index),
|
|
53
|
+
label: label?.(row, index) ?? `row ${index + 1}`,
|
|
54
|
+
input: JSON.stringify(row, null, 2)
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
/** Where the input pane opens: the first sampled row, or an empty document. */
|
|
58
|
+
function initialInput(samples) {
|
|
59
|
+
return samples[0]?.input ?? "{}";
|
|
60
|
+
}
|
|
61
|
+
export { evalFailure, initialInput, parseInputDocument, resultText, rowSamples };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=hostEvaluation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostEvaluation.js","names":[],"sources":["../../../src/expressions/playground/hostEvaluation.ts"],"sourcesContent":["import { parse } from \"yaml\";\nimport type { EvalResponse, PlaygroundSample } from \"./api.ts\";\n\n/**\n * Pieces a host needs to run the playground on its own evaluator.\n *\n * The playground evaluates text against text: a source and an input document,\n * answering with a rendered string. A host that evaluates somewhere else — a\n * profile service, an RPC — has rows (objects) and answers with values, so\n * these convert between the two without each host re-deriving the rules.\n */\n\n/** An error answer: nothing was evaluated, and the author is told why. */\nexport function evalFailure(message: string): EvalResponse {\n return { result: \"\", durationMs: 0, error: { message } };\n}\n\nexport type ParsedDocument = { value: unknown } | { error: string };\n\n/**\n * The input pane's text as a document. JSON is valid YAML, so one parser reads\n * both — the same way the Go evaluator's `parseInput` does.\n *\n * An empty input is an error rather than null: evaluating against nothing and\n * reporting a clean result is how a wrong expression looks right.\n */\nexport function parseInputDocument(input: string): ParsedDocument {\n if (input.trim() === \"\") {\n return { error: \"The input is empty. Add a YAML or JSON document for the expression to run against.\" };\n }\n try {\n return { value: parse(input) as unknown };\n } catch (cause) {\n return { error: `The input is not valid YAML or JSON: ${(cause as Error).message}` };\n }\n}\n\n/**\n * A value as the playground's `result` string.\n *\n * Null is the empty string, not \"null\": the samples view calls a blank result\n * \"empty\", which is exactly what an expression that read nothing should be.\n */\nexport function resultText(value: unknown): string {\n if (value === null || value === undefined) return \"\";\n if (typeof value === \"string\") return value;\n if (typeof value === \"object\") return JSON.stringify(value);\n return String(value);\n}\n\n/**\n * Sampled rows as the playground's samples: the row as pretty JSON, named by\n * the host or by position.\n */\nexport function rowSamples<Row = unknown>(\n rows: readonly Row[],\n label?: (row: Row, index: number) => string,\n): PlaygroundSample[] {\n return rows.map((row, index) => ({\n id: String(index),\n label: label?.(row, index) ?? `row ${index + 1}`,\n input: JSON.stringify(row, null, 2),\n }));\n}\n\n/** Where the input pane opens: the first sampled row, or an empty document. */\nexport function initialInput(samples: readonly PlaygroundSample[]): string {\n return samples[0]?.input ?? \"{}\";\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,YAAY,SAA+B;CACzD,OAAO;EAAE,QAAQ;EAAI,YAAY;EAAG,OAAO,EAAE,QAAQ;CAAE;AACzD;;;;;;;;AAWA,SAAgB,mBAAmB,OAA+B;CAChE,IAAI,MAAM,KAAK,MAAM,IACnB,OAAO,EAAE,OAAO,qFAAqF;CAEvG,IAAI;EACF,OAAO,EAAE,OAAO,MAAM,KAAK,EAAa;CAC1C,SAAS,OAAO;EACd,OAAO,EAAE,OAAO,wCAAyC,MAAgB,UAAU;CACrF;AACF;;;;;;;AAQA,SAAgB,WAAW,OAAwB;CACjD,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO,KAAK,UAAU,KAAK;CAC1D,OAAO,OAAO,KAAK;AACrB;;;;;AAMA,SAAgB,WACd,MACA,OACoB;CACpB,OAAO,KAAK,KAAK,KAAK,WAAW;EAC/B,IAAI,OAAO,KAAK;EAChB,OAAO,QAAQ,KAAK,KAAK,KAAK,OAAO,QAAQ;EAC7C,OAAO,KAAK,UAAU,KAAK,MAAM,CAAC;CACpC,EAAE;AACJ;;AAGA,SAAgB,aAAa,SAA8C;CACzE,OAAO,QAAQ,EAAE,EAAE,SAAS;AAC9B"}
|
|
@@ -17,7 +17,7 @@ function GraphPanel({ document, languageId, onInsert, formatPath }) {
|
|
|
17
17
|
const [selectedId, setSelectedId] = (0, react.useState)();
|
|
18
18
|
const [note, setNote] = (0, react.useState)();
|
|
19
19
|
const tree = (0, react.useMemo)(() => document === void 0 || document === null ? null : require_jsonPathTree.createLazyJSONPathTree(document, { keyPrefix: "input" }), [document]);
|
|
20
|
-
const roots = (0, react.useMemo)(() => tree ? tree.roots.map(require_graphNodes.toGraphNode) : [], [tree]);
|
|
20
|
+
const roots = (0, react.useMemo)(() => tree ? tree.roots.map((root) => require_graphNodes.toGraphNode(root, tree)) : [], [tree]);
|
|
21
21
|
if (!tree) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22
22
|
className: "flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground",
|
|
23
23
|
children: "Nothing to show yet — write a YAML or JSON document in the input pane and its shape appears here."
|
|
@@ -29,7 +29,12 @@ function GraphPanel({ document, languageId, onInsert, formatPath }) {
|
|
|
29
29
|
setNote("That row has no addressable path.");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const treeNode = node.metadata?.node;
|
|
33
|
+
if (formatPath && !treeNode) {
|
|
34
|
+
setNote("That row has no addressable path.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const expression = formatPath && treeNode ? formatPath(segments, treeNode) : require_environment.pathExpression(languageId, segments);
|
|
33
38
|
if (expression === null) {
|
|
34
39
|
setNote("A go template reaches a list element or a non-identifier key through `index`, which is a call rather than a path — so there is nothing to insert.");
|
|
35
40
|
return;
|
|
@@ -54,7 +59,7 @@ function GraphPanel({ document, languageId, onInsert, formatPath }) {
|
|
|
54
59
|
loadChildren: async (node) => {
|
|
55
60
|
const source = node.metadata?.node;
|
|
56
61
|
if (!source) return [];
|
|
57
|
-
return (await tree.loadChildren(source)).map(require_graphNodes.toGraphNode);
|
|
62
|
+
return (await tree.loadChildren(source)).map((child) => require_graphNodes.toGraphNode(child, tree));
|
|
58
63
|
},
|
|
59
64
|
empty: "The document is empty."
|
|
60
65
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphPanel.cjs","names":["useState","useMemo","createLazyJSONPathTree","toGraphNode","literalSegments","pathExpression","ObjectGraph"],"sources":["../../../../src/expressions/playground/panels/GraphPanel.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n createLazyJSONPathTree,\n literalSegments,\n type JSONPathNode,\n type LazyJSONPathTree,\n} from \"../../../components/jsonPathTree\";\nimport { ObjectGraph } from \"../../../data/ObjectGraph\";\nimport { pathExpression } from \"../../lang/index.ts\";\nimport { toGraphNode } from \"./graphNodes.ts\";\nimport type { GraphNode } from \"./graphNodes.ts\";\n\ninterface GraphPanelProps {\n /** The parsed input document, or undefined when there is nothing to show. */\n document: unknown;\n /** Monaco language id, which decides the syntax a click inserts. */\n languageId: string;\n /** Writes an expression at the source editor's cursor. */\n onInsert: (expression: string) => void;\n formatPath?:
|
|
1
|
+
{"version":3,"file":"GraphPanel.cjs","names":["useState","useMemo","createLazyJSONPathTree","toGraphNode","literalSegments","pathExpression","ObjectGraph"],"sources":["../../../../src/expressions/playground/panels/GraphPanel.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n createLazyJSONPathTree,\n literalSegments,\n type JSONPathNode,\n type LazyJSONPathTree,\n} from \"../../../components/jsonPathTree\";\nimport { ObjectGraph } from \"../../../data/ObjectGraph\";\nimport { pathExpression } from \"../../lang/index.ts\";\nimport type { FormatPath } from \"../api.ts\";\nimport { toGraphNode } from \"./graphNodes.ts\";\nimport type { GraphNode } from \"./graphNodes.ts\";\n\ninterface GraphPanelProps {\n /** The parsed input document, or undefined when there is nothing to show. */\n document: unknown;\n /** Monaco language id, which decides the syntax a click inserts. */\n languageId: string;\n /** Writes an expression at the source editor's cursor. */\n onInsert: (expression: string) => void;\n formatPath?: FormatPath;\n}\n\n/**\n * The shape of the document being evaluated against.\n *\n * The input pane shows the document as text; this shows it as paths. Clicking a\n * row writes that path into the expression, in the syntax of the language being\n * written, which is the step that otherwise means reading YAML and retyping it\n * by hand.\n */\nexport function GraphPanel({\n document,\n languageId,\n onInsert,\n formatPath,\n}: GraphPanelProps) {\n const [selectedId, setSelectedId] = useState<string>();\n const [note, setNote] = useState<string>();\n\n const tree = useMemo<LazyJSONPathTree | null>(\n () =>\n document === undefined || document === null\n ? null\n : createLazyJSONPathTree(document, { keyPrefix: \"input\" }),\n [document],\n );\n\n const roots = useMemo(\n () => (tree ? tree.roots.map((root) => toGraphNode(root, tree)) : []),\n [tree],\n );\n\n if (!tree) {\n return (\n <div className=\"flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground\">\n Nothing to show yet — write a YAML or JSON document in the input pane\n and its shape appears here.\n </div>\n );\n }\n\n const select = (node: GraphNode) => {\n setSelectedId(node.id);\n const segments = node.path ? literalSegments(node.path) : undefined;\n if (!segments) {\n setNote(\"That row has no addressable path.\");\n return;\n }\n const treeNode = node.metadata?.node;\n if (formatPath && !treeNode) {\n setNote(\"That row has no addressable path.\");\n return;\n }\n const expression =\n formatPath && treeNode ? formatPath(segments, treeNode) : pathExpression(languageId, segments);\n if (expression === null) {\n setNote(\n \"A go template reaches a list element or a non-identifier key through `index`, \" +\n \"which is a call rather than a path — so there is nothing to insert.\",\n );\n return;\n }\n if (expression === \"\") {\n setNote(\n \"The whole document has no name in this language — pick a key under it.\",\n );\n return;\n }\n setNote(undefined);\n onInsert(expression);\n };\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n <div className=\"min-h-0 flex-1 overflow-auto p-2\">\n <ObjectGraph\n roots={roots}\n showControls\n defaultOpenDepth={2}\n {...(selectedId ? { selectedId } : {})}\n onNodeSelect={select}\n loadChildren={async (node) => {\n const source = node.metadata?.node as JSONPathNode | undefined;\n if (!source) return [];\n return (await tree.loadChildren(source)).map((child) => toGraphNode(child, tree));\n }}\n empty=\"The document is empty.\"\n />\n </div>\n <footer className=\"shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground\">\n {note ?? \"Click a key to insert its path at the cursor.\"}\n </footer>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,SAAgB,WAAW,EACzB,UACA,YACA,UACA,cACkB;CAClB,MAAM,CAAC,YAAY,kBAAA,GAAiBA,MAAAA,SAAAA,CAAiB;CACrD,MAAM,CAAC,MAAM,YAAA,GAAWA,MAAAA,SAAAA,CAAiB;CAEzC,MAAM,QAAA,GAAOC,MAAAA,QAAAA,OAET,aAAa,KAAA,KAAa,aAAa,OACnC,OACAC,qBAAAA,uBAAuB,UAAU,EAAE,WAAW,QAAQ,CAAC,GAC7D,CAAC,QAAQ,CACX;CAEA,MAAM,SAAA,GAAQD,MAAAA,QAAAA,OACL,OAAO,KAAK,MAAM,KAAK,SAASE,mBAAAA,YAAY,MAAM,IAAI,CAAC,IAAI,CAAC,GACnE,CAAC,IAAI,CACP;CAEA,IAAI,CAAC,MACH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EAAwF,UAAA;CAGlG,CAAA;CAIT,MAAM,UAAU,SAAoB;EAClC,cAAc,KAAK,EAAE;EACrB,MAAM,WAAW,KAAK,OAAOC,qBAAAA,gBAAgB,KAAK,IAAI,IAAI,KAAA;EAC1D,IAAI,CAAC,UAAU;GACb,QAAQ,mCAAmC;GAC3C;EACF;EACA,MAAM,WAAW,KAAK,UAAU;EAChC,IAAI,cAAc,CAAC,UAAU;GAC3B,QAAQ,mCAAmC;GAC3C;EACF;EACA,MAAM,aACJ,cAAc,WAAW,WAAW,UAAU,QAAQ,IAAIC,oBAAAA,eAAe,YAAY,QAAQ;EAC/F,IAAI,eAAe,MAAM;GACvB,QACE,mJAEF;GACA;EACF;EACA,IAAI,eAAe,IAAI;GACrB,QACE,wEACF;GACA;EACF;EACA,QAAQ,KAAA,CAAS;EACjB,SAAS,UAAU;CACrB;CAEA,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,aAAD;IACS;IACP,cAAA;IACA,kBAAkB;IAClB,GAAK,aAAa,EAAE,WAAW,IAAI,CAAC;IACpC,cAAc;IACd,cAAc,OAAO,SAAS;KAC5B,MAAM,SAAS,KAAK,UAAU;KAC9B,IAAI,CAAC,QAAQ,OAAO,CAAC;KACrB,QAAQ,MAAM,KAAK,aAAa,MAAM,EAAA,CAAG,KAAK,UAAUH,mBAAAA,YAAY,OAAO,IAAI,CAAC;IAClF;IACA,OAAM;GACP,CAAA;EACE,CAAA,GACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;GAAQ,WAAU;GACf,UAAA,QAAQ;EACH,CAAA,CACL;;AAET"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormatPath } from '../api.js';
|
|
1
2
|
interface GraphPanelProps {
|
|
2
3
|
/** The parsed input document, or undefined when there is nothing to show. */
|
|
3
4
|
document: unknown;
|
|
@@ -5,7 +6,7 @@ interface GraphPanelProps {
|
|
|
5
6
|
languageId: string;
|
|
6
7
|
/** Writes an expression at the source editor's cursor. */
|
|
7
8
|
onInsert: (expression: string) => void;
|
|
8
|
-
formatPath?:
|
|
9
|
+
formatPath?: FormatPath;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* The shape of the document being evaluated against.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphPanel.d.ts","sourceRoot":"","sources":["../../../../src/expressions/playground/panels/GraphPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GraphPanel.d.ts","sourceRoot":"","sources":["../../../../src/expressions/playground/panels/GraphPanel.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAI5C,UAAU,eAAe;IACvB,6EAA6E;IAC7E,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,GACX,EAAE,eAAe,+BA+EjB"}
|
|
@@ -17,7 +17,7 @@ function GraphPanel({ document, languageId, onInsert, formatPath }) {
|
|
|
17
17
|
const [selectedId, setSelectedId] = useState();
|
|
18
18
|
const [note, setNote] = useState();
|
|
19
19
|
const tree = useMemo(() => document === void 0 || document === null ? null : createLazyJSONPathTree(document, { keyPrefix: "input" }), [document]);
|
|
20
|
-
const roots = useMemo(() => tree ? tree.roots.map(toGraphNode) : [], [tree]);
|
|
20
|
+
const roots = useMemo(() => tree ? tree.roots.map((root) => toGraphNode(root, tree)) : [], [tree]);
|
|
21
21
|
if (!tree) return /* @__PURE__ */ jsx("div", {
|
|
22
22
|
className: "flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground",
|
|
23
23
|
children: "Nothing to show yet — write a YAML or JSON document in the input pane and its shape appears here."
|
|
@@ -29,7 +29,12 @@ function GraphPanel({ document, languageId, onInsert, formatPath }) {
|
|
|
29
29
|
setNote("That row has no addressable path.");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const treeNode = node.metadata?.node;
|
|
33
|
+
if (formatPath && !treeNode) {
|
|
34
|
+
setNote("That row has no addressable path.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const expression = formatPath && treeNode ? formatPath(segments, treeNode) : pathExpression(languageId, segments);
|
|
33
38
|
if (expression === null) {
|
|
34
39
|
setNote("A go template reaches a list element or a non-identifier key through `index`, which is a call rather than a path — so there is nothing to insert.");
|
|
35
40
|
return;
|
|
@@ -54,7 +59,7 @@ function GraphPanel({ document, languageId, onInsert, formatPath }) {
|
|
|
54
59
|
loadChildren: async (node) => {
|
|
55
60
|
const source = node.metadata?.node;
|
|
56
61
|
if (!source) return [];
|
|
57
|
-
return (await tree.loadChildren(source)).map(toGraphNode);
|
|
62
|
+
return (await tree.loadChildren(source)).map((child) => toGraphNode(child, tree));
|
|
58
63
|
},
|
|
59
64
|
empty: "The document is empty."
|
|
60
65
|
})
|