@flanksource/clicky-ui 0.3.34 → 0.3.35
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/README.md +4 -0
- package/dist/ai.cjs +3 -0
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.js +3 -0
- package/dist/ai.js.map +1 -1
- package/dist/comments/CommentCard.d.ts +1 -1
- package/dist/comments/CommentProvider.d.ts +1 -1
- package/dist/comments/CommentThread.d.ts +1 -1
- package/dist/comments/CommentThreadList.d.ts +1 -1
- package/dist/comments/MentionTextarea.d.ts +1 -1
- package/dist/comments/comment-context.d.ts +4 -4
- package/dist/comments/comment-fixtures.d.ts +1 -1
- package/dist/comments/comment-types.d.ts +1 -1
- package/dist/components/AccordionList.d.ts +1 -1
- package/dist/components/ComboboxControl.d.ts +1 -1
- package/dist/components/ComboboxMenu.d.ts +2 -2
- package/dist/components/ComboboxTags.cjs +41 -11
- package/dist/components/ComboboxTags.cjs.map +1 -1
- package/dist/components/ComboboxTags.d.ts +6 -0
- package/dist/components/ComboboxTags.d.ts.map +1 -1
- package/dist/components/ComboboxTags.js +41 -11
- package/dist/components/ComboboxTags.js.map +1 -1
- package/dist/components/DateField.d.ts +3 -3
- package/dist/components/DatePicker.d.ts +3 -3
- package/dist/components/DateTimePicker.d.ts +3 -3
- package/dist/components/ErrorWrapper.d.ts +2 -2
- package/dist/components/Field.d.ts +1 -1
- package/dist/components/FilterBar.d.ts +1 -1
- package/dist/components/FormLookupProvider.d.ts +1 -1
- package/dist/components/FormatOptionsDropdown.d.ts +1 -1
- package/dist/components/IconButton.d.ts +3 -3
- package/dist/components/InputField.d.ts +2 -2
- package/dist/components/ItemActions.d.ts +1 -1
- package/dist/components/JsonSchemaForm.cjs +17 -36
- package/dist/components/JsonSchemaForm.cjs.map +1 -1
- package/dist/components/JsonSchemaForm.d.ts +1 -1
- package/dist/components/JsonSchemaForm.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm.js +17 -36
- package/dist/components/JsonSchemaForm.js.map +1 -1
- package/dist/components/ListMenu.d.ts +1 -1
- package/dist/components/MultiSelect.d.ts +1 -1
- package/dist/components/SearchInput.d.ts +1 -1
- package/dist/components/SegmentedControl.d.ts +1 -1
- package/dist/components/SplitButton.d.ts +1 -1
- package/dist/components/Switch.d.ts +1 -1
- package/dist/components/TreePickerField.cjs +11 -2
- package/dist/components/TreePickerField.cjs.map +1 -1
- package/dist/components/TreePickerField.d.ts +13 -4
- package/dist/components/TreePickerField.d.ts.map +1 -1
- package/dist/components/TreePickerField.js +11 -2
- package/dist/components/TreePickerField.js.map +1 -1
- package/dist/components/UnitStepControls.d.ts +1 -1
- package/dist/components/button.d.ts +3 -3
- package/dist/components/combobox-types.d.ts +1 -1
- package/dist/components/density-switcher.d.ts +1 -1
- package/dist/components/filter-bar-context.d.ts +1 -1
- package/dist/components/filter-bar-field-utils.d.ts +2 -2
- package/dist/components/form-lookup-context.d.ts +1 -1
- package/dist/components/icon-menu-picker.d.ts +1 -1
- package/dist/components/json-schema-form-accordion-array.cjs +44 -21
- 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 +47 -24
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-array.cjs +53 -30
- package/dist/components/json-schema-form-array.cjs.map +1 -1
- package/dist/components/json-schema-form-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-array.js +54 -31
- package/dist/components/json-schema-form-array.js.map +1 -1
- package/dist/components/json-schema-form-cards-array.cjs +32 -22
- package/dist/components/json-schema-form-cards-array.cjs.map +1 -1
- package/dist/components/json-schema-form-cards-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-cards-array.js +33 -23
- package/dist/components/json-schema-form-cards-array.js.map +1 -1
- package/dist/components/json-schema-form-collection-layouts.fixtures.d.ts +44 -0
- package/dist/components/json-schema-form-collection-layouts.fixtures.d.ts.map +1 -0
- package/dist/components/json-schema-form-discriminator.d.ts +1 -1
- package/dist/components/json-schema-form-errors.cjs +5 -1
- package/dist/components/json-schema-form-errors.cjs.map +1 -1
- package/dist/components/json-schema-form-errors.d.ts +2 -1
- package/dist/components/json-schema-form-errors.d.ts.map +1 -1
- package/dist/components/json-schema-form-errors.js +6 -2
- package/dist/components/json-schema-form-errors.js.map +1 -1
- package/dist/components/json-schema-form-extensions.d.ts +1 -1
- package/dist/components/json-schema-form-filter-input.cjs +50 -0
- package/dist/components/json-schema-form-filter-input.cjs.map +1 -0
- package/dist/components/json-schema-form-filter-input.d.ts +5 -0
- package/dist/components/json-schema-form-filter-input.d.ts.map +1 -0
- package/dist/components/json-schema-form-filter-input.js +50 -0
- package/dist/components/json-schema-form-filter-input.js.map +1 -0
- package/dist/components/json-schema-form-filter.cjs +49 -0
- package/dist/components/json-schema-form-filter.cjs.map +1 -0
- package/dist/components/json-schema-form-filter.d.ts +8 -0
- package/dist/components/json-schema-form-filter.d.ts.map +1 -0
- package/dist/components/json-schema-form-filter.js +49 -0
- package/dist/components/json-schema-form-filter.js.map +1 -0
- package/dist/components/json-schema-form-layout.cjs +84 -17
- package/dist/components/json-schema-form-layout.cjs.map +1 -1
- package/dist/components/json-schema-form-layout.d.ts +1 -1
- package/dist/components/json-schema-form-layout.d.ts.map +1 -1
- package/dist/components/json-schema-form-layout.js +84 -17
- package/dist/components/json-schema-form-layout.js.map +1 -1
- package/dist/components/json-schema-form-list-array.cjs +16 -5
- package/dist/components/json-schema-form-list-array.cjs.map +1 -1
- package/dist/components/json-schema-form-list-array.d.ts +2 -1
- package/dist/components/json-schema-form-list-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-list-array.js +16 -5
- package/dist/components/json-schema-form-list-array.js.map +1 -1
- package/dist/components/json-schema-form-object.cjs +239 -85
- package/dist/components/json-schema-form-object.cjs.map +1 -1
- package/dist/components/json-schema-form-object.d.ts +2 -2
- package/dist/components/json-schema-form-object.d.ts.map +1 -1
- package/dist/components/json-schema-form-object.js +241 -87
- package/dist/components/json-schema-form-object.js.map +1 -1
- package/dist/components/json-schema-form-preferences.cjs +1 -1
- package/dist/components/json-schema-form-preferences.cjs.map +1 -1
- package/dist/components/json-schema-form-preferences.d.ts +1 -1
- package/dist/components/json-schema-form-preferences.d.ts.map +1 -1
- package/dist/components/json-schema-form-preferences.js +1 -1
- package/dist/components/json-schema-form-preferences.js.map +1 -1
- package/dist/components/json-schema-form-properties-errors.fixtures.d.ts +14 -0
- package/dist/components/json-schema-form-properties-errors.fixtures.d.ts.map +1 -0
- package/dist/components/json-schema-form-properties-size.cjs +19 -0
- package/dist/components/json-schema-form-properties-size.cjs.map +1 -0
- package/dist/components/json-schema-form-properties-size.d.ts +4 -0
- package/dist/components/json-schema-form-properties-size.d.ts.map +1 -0
- package/dist/components/json-schema-form-properties-size.js +19 -0
- package/dist/components/json-schema-form-properties-size.js.map +1 -0
- package/dist/components/json-schema-form-properties.cjs +305 -0
- package/dist/components/json-schema-form-properties.cjs.map +1 -0
- package/dist/components/json-schema-form-properties.d.ts +20 -0
- package/dist/components/json-schema-form-properties.d.ts.map +1 -0
- package/dist/components/json-schema-form-properties.fixtures.d.ts +157 -0
- package/dist/components/json-schema-form-properties.fixtures.d.ts.map +1 -0
- package/dist/components/json-schema-form-properties.js +305 -0
- package/dist/components/json-schema-form-properties.js.map +1 -0
- package/dist/components/json-schema-form-property-actions-context.cjs +6 -0
- package/dist/components/json-schema-form-property-actions-context.cjs.map +1 -0
- package/dist/components/json-schema-form-property-actions-context.d.ts +2 -0
- package/dist/components/json-schema-form-property-actions-context.d.ts.map +1 -0
- package/dist/components/json-schema-form-property-actions-context.js +6 -0
- package/dist/components/json-schema-form-property-actions-context.js.map +1 -0
- package/dist/components/json-schema-form-property-collection.cjs +31 -0
- package/dist/components/json-schema-form-property-collection.cjs.map +1 -0
- package/dist/components/json-schema-form-property-collection.d.ts +6 -0
- package/dist/components/json-schema-form-property-collection.d.ts.map +1 -0
- package/dist/components/json-schema-form-property-collection.js +31 -0
- package/dist/components/json-schema-form-property-collection.js.map +1 -0
- package/dist/components/json-schema-form-property-draft.cjs +45 -0
- package/dist/components/json-schema-form-property-draft.cjs.map +1 -0
- package/dist/components/json-schema-form-property-draft.d.ts +8 -0
- package/dist/components/json-schema-form-property-draft.d.ts.map +1 -0
- package/dist/components/json-schema-form-property-draft.js +45 -0
- package/dist/components/json-schema-form-property-draft.js.map +1 -0
- package/dist/components/json-schema-form-property-preview.cjs +68 -0
- package/dist/components/json-schema-form-property-preview.cjs.map +1 -0
- package/dist/components/json-schema-form-property-preview.d.ts +7 -0
- package/dist/components/json-schema-form-property-preview.d.ts.map +1 -0
- package/dist/components/json-schema-form-property-preview.js +68 -0
- package/dist/components/json-schema-form-property-preview.js.map +1 -0
- package/dist/components/json-schema-form-property-selection.cjs +89 -0
- package/dist/components/json-schema-form-property-selection.cjs.map +1 -0
- package/dist/components/json-schema-form-property-selection.d.ts +6 -0
- package/dist/components/json-schema-form-property-selection.d.ts.map +1 -0
- package/dist/components/json-schema-form-property-selection.js +89 -0
- package/dist/components/json-schema-form-property-selection.js.map +1 -0
- package/dist/components/json-schema-form-render.cjs +41 -4
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +42 -5
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +2 -0
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
- package/dist/components/json-schema-form-resolve.js +2 -0
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-runtime-types.d.ts +222 -0
- package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -0
- package/dist/components/json-schema-form-table-array.cjs +82 -51
- package/dist/components/json-schema-form-table-array.cjs.map +1 -1
- package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-table-array.js +84 -53
- package/dist/components/json-schema-form-table-array.js.map +1 -1
- package/dist/components/json-schema-form-template-menu.d.ts +1 -1
- package/dist/components/json-schema-form-template.d.ts +1 -1
- package/dist/components/json-schema-form-types.d.ts +7 -179
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/json-schema-form-utils.cjs +10 -9
- package/dist/components/json-schema-form-utils.cjs.map +1 -1
- package/dist/components/json-schema-form-utils.d.ts +11 -1
- package/dist/components/json-schema-form-utils.d.ts.map +1 -1
- package/dist/components/json-schema-form-utils.js +10 -9
- package/dist/components/json-schema-form-utils.js.map +1 -1
- package/dist/components/loading.d.ts +4 -4
- package/dist/components/mdx-editor-callout.d.ts +1 -1
- package/dist/components/mdx-editor-options.d.ts +1 -1
- package/dist/components/select.d.ts +3 -3
- package/dist/components/theme-switcher.d.ts +1 -1
- package/dist/components/use-list-menu-selection.d.ts +1 -1
- package/dist/components/useComboboxLayout.d.ts +1 -1
- package/dist/components/workload-picker-utils.d.ts +1 -1
- package/dist/data/Avatar.d.ts +1 -1
- package/dist/data/AvatarBadge.d.ts +1 -1
- package/dist/data/Badge.d.ts +1 -1
- package/dist/data/Callout.d.ts +1 -1
- package/dist/data/DataTable.cjs +575 -435
- package/dist/data/DataTable.cjs.map +1 -1
- package/dist/data/DataTable.d.ts +21 -13
- package/dist/data/DataTable.d.ts.map +1 -1
- package/dist/data/DataTable.grouping.d.ts +1 -1
- package/dist/data/DataTable.js +575 -435
- package/dist/data/DataTable.js.map +1 -1
- package/dist/data/ExecutionTree.d.ts +1 -1
- package/dist/data/FilterPill.d.ts +1 -1
- package/dist/data/FixtureEditor/RawFenceEditor.d.ts +1 -1
- package/dist/data/FixtureEditor/types.d.ts +1 -1
- package/dist/data/Gauge.d.ts +1 -1
- package/dist/data/GaugeHoverCard.d.ts +1 -1
- package/dist/data/Icon.d.ts +1 -1
- package/dist/data/KeyValueList.d.ts +1 -1
- package/dist/data/MarkdownEditor.d.ts +1 -1
- package/dist/data/MatrixTable.d.ts +1 -1
- package/dist/data/ObjectGraph.d.ts +1 -1
- package/dist/data/ProgressBars.d.ts +1 -1
- package/dist/data/Properties.cjs +86 -35
- package/dist/data/Properties.cjs.map +1 -1
- package/dist/data/Properties.d.ts +2 -2
- package/dist/data/Properties.d.ts.map +1 -1
- package/dist/data/Properties.js +87 -36
- package/dist/data/Properties.js.map +1 -1
- package/dist/data/RadialGauge.d.ts +1 -1
- package/dist/data/SchemaViewer.d.ts +1 -1
- package/dist/data/SortableHeader.d.ts +1 -1
- package/dist/data/StatStrip.d.ts +1 -1
- package/dist/data/StatusBreakdown.d.ts +1 -1
- package/dist/data/TabButton.d.ts +1 -1
- package/dist/data/TaskManager.cjs +9 -17
- package/dist/data/TaskManager.cjs.map +1 -1
- package/dist/data/TaskManager.d.ts.map +1 -1
- package/dist/data/TaskManager.js +9 -17
- package/dist/data/TaskManager.js.map +1 -1
- package/dist/data/TaskManagerButton.cjs +17 -34
- package/dist/data/TaskManagerButton.cjs.map +1 -1
- package/dist/data/TaskManagerButton.d.ts.map +1 -1
- package/dist/data/TaskManagerButton.js +18 -35
- package/dist/data/TaskManagerButton.js.map +1 -1
- package/dist/data/TaskProcessDetails.cjs +5 -26
- package/dist/data/TaskProcessDetails.cjs.map +1 -1
- package/dist/data/TaskProcessDetails.d.ts +2 -1
- package/dist/data/TaskProcessDetails.d.ts.map +1 -1
- package/dist/data/TaskProcessDetails.js +5 -26
- package/dist/data/TaskProcessDetails.js.map +1 -1
- package/dist/data/TaskProgress.cjs +24 -15
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.d.ts +2 -1
- package/dist/data/TaskProgress.d.ts.map +1 -1
- package/dist/data/TaskProgress.js +24 -15
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/TaskResourceReadings.cjs +42 -0
- package/dist/data/TaskResourceReadings.cjs.map +1 -0
- package/dist/data/TaskResourceReadings.d.ts +6 -0
- package/dist/data/TaskResourceReadings.d.ts.map +1 -0
- package/dist/data/TaskResourceReadings.js +42 -0
- package/dist/data/TaskResourceReadings.js.map +1 -0
- package/dist/data/TaskSnapshot.cjs.map +1 -1
- package/dist/data/TaskSnapshot.d.ts +14 -1
- package/dist/data/TaskSnapshot.d.ts.map +1 -1
- package/dist/data/TaskSnapshot.js.map +1 -1
- package/dist/data/Timeline.d.ts +1 -1
- package/dist/data/Tree.d.ts +1 -1
- package/dist/data/TreeGroupHeader.d.ts +1 -1
- package/dist/data/TreeNode.d.ts +1 -1
- package/dist/data/Version.d.ts +3 -3
- package/dist/data/ai/ChatWindow.cjs +22 -12
- package/dist/data/ai/ChatWindow.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.js +22 -12
- package/dist/data/ai/ChatWindow.js.map +1 -1
- package/dist/data/ai/ChatWindow.test-utils.d.ts +4 -2
- package/dist/data/ai/ChatWindow.test-utils.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.types.d.ts +1 -1
- package/dist/data/ai/ChatWindowManager.cjs +2 -0
- package/dist/data/ai/ChatWindowManager.cjs.map +1 -1
- package/dist/data/ai/ChatWindowManager.d.ts +1 -1
- package/dist/data/ai/ChatWindowManager.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowManager.js +2 -0
- package/dist/data/ai/ChatWindowManager.js.map +1 -1
- package/dist/data/ai/PolicyTree.d.ts +1 -1
- package/dist/data/ai/PromptCatalog/PromptPageHeader.d.ts +1 -1
- package/dist/data/ai/PromptCatalog/types.d.ts +1 -1
- package/dist/data/ai/PromptRunEditor/index.cjs +4 -0
- package/dist/data/ai/PromptRunEditor/index.cjs.map +1 -1
- package/dist/data/ai/PromptRunEditor/index.d.ts +5 -2
- package/dist/data/ai/PromptRunEditor/index.d.ts.map +1 -1
- package/dist/data/ai/PromptRunEditor/index.js +4 -0
- package/dist/data/ai/PromptRunEditor/index.js.map +1 -1
- package/dist/data/ai/SessionChatComposer.d.ts +1 -1
- package/dist/data/ai/SessionInspector.approvals.cjs +147 -0
- package/dist/data/ai/SessionInspector.approvals.cjs.map +1 -0
- package/dist/data/ai/SessionInspector.approvals.d.ts +21 -0
- package/dist/data/ai/SessionInspector.approvals.d.ts.map +1 -0
- package/dist/data/ai/SessionInspector.approvals.js +147 -0
- package/dist/data/ai/SessionInspector.approvals.js.map +1 -0
- package/dist/data/ai/SessionInspector.cjs +21 -8
- package/dist/data/ai/SessionInspector.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.d.ts +6 -2
- package/dist/data/ai/SessionInspector.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.hierarchy.d.ts +1 -1
- package/dist/data/ai/SessionInspector.js +21 -8
- package/dist/data/ai/SessionInspector.js.map +1 -1
- package/dist/data/ai/SessionInspector.panel-parts.cjs +47 -0
- package/dist/data/ai/SessionInspector.panel-parts.cjs.map +1 -0
- package/dist/data/ai/SessionInspector.panel-parts.d.ts +20 -0
- package/dist/data/ai/SessionInspector.panel-parts.d.ts.map +1 -0
- package/dist/data/ai/SessionInspector.panel-parts.js +47 -0
- package/dist/data/ai/SessionInspector.panel-parts.js.map +1 -0
- package/dist/data/ai/SessionInspector.panels.cjs +40 -99
- package/dist/data/ai/SessionInspector.panels.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.panels.d.ts +3 -1
- package/dist/data/ai/SessionInspector.panels.d.ts.map +1 -1
- package/dist/data/ai/SessionInspector.panels.js +12 -71
- package/dist/data/ai/SessionInspector.panels.js.map +1 -1
- package/dist/data/ai/SessionViewer.d.ts +1 -1
- package/dist/data/ai/SessionViewer.rows.d.ts +1 -1
- package/dist/data/ai/SessionViewer.tool-details.d.ts +1 -1
- package/dist/data/ai/SessionViewer.unified.d.ts +23 -0
- package/dist/data/ai/SessionViewer.unified.d.ts.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/Footer.d.ts +1 -1
- package/dist/data/ai/SpecRuntimeEditor/Rail.d.ts +1 -1
- package/dist/data/ai/SpecRuntimeEditor/SectionCard.d.ts +1 -1
- package/dist/data/ai/SpecRuntimeEditor/VerifySection.cjs +3 -1
- package/dist/data/ai/SpecRuntimeEditor/VerifySection.cjs.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/VerifySection.d.ts +3 -1
- package/dist/data/ai/SpecRuntimeEditor/VerifySection.d.ts.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/VerifySection.js +3 -1
- package/dist/data/ai/SpecRuntimeEditor/VerifySection.js.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/fields.d.ts +1 -1
- package/dist/data/ai/SpecRuntimeEditor/index.cjs +3 -1
- package/dist/data/ai/SpecRuntimeEditor/index.cjs.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/index.d.ts +5 -2
- package/dist/data/ai/SpecRuntimeEditor/index.d.ts.map +1 -1
- package/dist/data/ai/SpecRuntimeEditor/index.js +3 -1
- package/dist/data/ai/SpecRuntimeEditor/index.js.map +1 -1
- package/dist/data/ai/chat-window-context.cjs +1 -0
- package/dist/data/ai/chat-window-context.cjs.map +1 -1
- package/dist/data/ai/chat-window-context.d.ts +13 -5
- package/dist/data/ai/chat-window-context.d.ts.map +1 -1
- package/dist/data/ai/chat-window-context.js +1 -0
- package/dist/data/ai/chat-window-context.js.map +1 -1
- package/dist/data/ai/index.d.ts +2 -1
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/ai/use-session-scroll.d.ts +1 -1
- package/dist/data/cache-browser/adapter.d.ts +1 -1
- package/dist/data/cells/CellFilterActions.d.ts +1 -1
- package/dist/data/cells/EntityCell.d.ts +1 -1
- package/dist/data/cells/tag-utils.d.ts +1 -1
- package/dist/data/chat/Chat.cjs +42 -46
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts +16 -5
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.js +43 -47
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/chat/ModelSelector.d.ts +1 -1
- package/dist/data/chat/PromptInput.cjs +13 -0
- package/dist/data/chat/PromptInput.cjs.map +1 -1
- package/dist/data/chat/PromptInput.d.ts +8 -2
- package/dist/data/chat/PromptInput.d.ts.map +1 -1
- package/dist/data/chat/PromptInput.js +14 -1
- package/dist/data/chat/PromptInput.js.map +1 -1
- package/dist/data/chat/tool-render/ToolArgs.d.ts +1 -1
- package/dist/data/chat/tool-render/ToolParams.d.ts +1 -1
- package/dist/data/chat/tool-render/ToolValue.d.ts +1 -1
- package/dist/data/chat/tool-render/adapter.d.ts +1 -1
- package/dist/data/chat/tool-render/context.d.ts +1 -1
- package/dist/data/chat/tool-render/defaults.d.ts +1 -1
- package/dist/data/chat/tool-render/known-tool-views.d.ts +1 -1
- package/dist/data/chat/tool-render/summary.d.ts +1 -1
- package/dist/data/chat/types.d.ts +1 -1
- package/dist/data/clicky-export/useClickyExport.d.ts +1 -1
- package/dist/data/data-table-server-filters.d.ts +1 -1
- package/dist/data/diagnostics/DiagnosticsDetailPanel.d.ts +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts +1 -1
- package/dist/data/diagnostics/StackFrameRow.d.ts +1 -1
- package/dist/data/git/GitChangeList.d.ts +1 -1
- package/dist/data/icon-fallback.d.ts +1 -1
- package/dist/data/properties-context.cjs +6 -0
- package/dist/data/properties-context.cjs.map +1 -0
- package/dist/data/properties-context.d.ts +7 -0
- package/dist/data/properties-context.d.ts.map +1 -0
- package/dist/data/properties-context.js +6 -0
- package/dist/data/properties-context.js.map +1 -0
- package/dist/data/query-browser/QueryBrowser.types.d.ts +1 -1
- package/dist/data/runtime/RuntimeBar.cjs +7 -3
- package/dist/data/runtime/RuntimeBar.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBar.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBar.js +7 -3
- package/dist/data/runtime/RuntimeBar.js.map +1 -1
- package/dist/data/task-copy.cjs +1 -1
- package/dist/data/task-copy.cjs.map +1 -1
- package/dist/data/task-copy.js +1 -1
- package/dist/data/task-copy.js.map +1 -1
- package/dist/data/task-resource-summary.cjs +30 -0
- package/dist/data/task-resource-summary.cjs.map +1 -0
- package/dist/data/task-resource-summary.d.ts +15 -0
- package/dist/data/task-resource-summary.d.ts.map +1 -0
- package/dist/data/task-resource-summary.js +30 -0
- package/dist/data/task-resource-summary.js.map +1 -0
- package/dist/data/task-status.cjs +8 -2
- package/dist/data/task-status.cjs.map +1 -1
- package/dist/data/task-status.d.ts +3 -0
- package/dist/data/task-status.d.ts.map +1 -1
- package/dist/data/task-status.js +8 -2
- package/dist/data/task-status.js.map +1 -1
- package/dist/data/task-work-progress.cjs +24 -0
- package/dist/data/task-work-progress.cjs.map +1 -0
- package/dist/data/task-work-progress.d.ts +21 -0
- package/dist/data/task-work-progress.d.ts.map +1 -0
- package/dist/data/task-work-progress.js +24 -0
- package/dist/data/task-work-progress.js.map +1 -0
- package/dist/data/test-runner/TestRunner.d.ts +1 -1
- package/dist/data/test-runner/adapter.d.ts +1 -1
- package/dist/data/test-runner/context.d.ts +1 -1
- package/dist/data/use-data-table-virtual.cjs +73 -0
- package/dist/data/use-data-table-virtual.cjs.map +1 -0
- package/dist/data/use-data-table-virtual.d.ts +40 -0
- package/dist/data/use-data-table-virtual.d.ts.map +1 -0
- package/dist/data/use-data-table-virtual.js +73 -0
- package/dist/data/use-data-table-virtual.js.map +1 -0
- package/dist/data/verification/VerificationResults.d.ts +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/expressions/lang/attributes.cjs +56 -0
- package/dist/expressions/lang/attributes.cjs.map +1 -0
- package/dist/expressions/lang/attributes.d.ts +22 -0
- package/dist/expressions/lang/attributes.d.ts.map +1 -0
- package/dist/expressions/lang/attributes.js +56 -0
- package/dist/expressions/lang/attributes.js.map +1 -0
- package/dist/expressions/lang/completion.cjs +164 -0
- package/dist/expressions/lang/completion.cjs.map +1 -0
- package/dist/expressions/lang/completion.d.ts +29 -0
- package/dist/expressions/lang/completion.d.ts.map +1 -0
- package/dist/expressions/lang/completion.js +164 -0
- package/dist/expressions/lang/completion.js.map +1 -0
- package/dist/expressions/lang/environment.cjs +115 -0
- package/dist/expressions/lang/environment.cjs.map +1 -0
- package/dist/expressions/lang/environment.d.ts +54 -0
- package/dist/expressions/lang/environment.d.ts.map +1 -0
- package/dist/expressions/lang/environment.js +115 -0
- package/dist/expressions/lang/environment.js.map +1 -0
- package/dist/expressions/lang/generated/conformance.json.d.ts +4962 -0
- package/dist/expressions/lang/generated/index.cjs +18 -0
- package/dist/expressions/lang/generated/index.cjs.map +1 -0
- package/dist/expressions/lang/generated/index.d.ts +9 -0
- package/dist/expressions/lang/generated/index.d.ts.map +1 -0
- package/dist/expressions/lang/generated/index.js +18 -0
- package/dist/expressions/lang/generated/index.js.map +1 -0
- package/dist/expressions/lang/generated/languages.json.cjs +18 -0
- package/dist/expressions/lang/generated/languages.json.cjs.map +1 -0
- package/dist/expressions/lang/generated/languages.json.d.ts +2305 -0
- package/dist/expressions/lang/generated/languages.json.js +18 -0
- package/dist/expressions/lang/generated/languages.json.js.map +1 -0
- package/dist/expressions/lang/generated/spec.json.cjs +12 -0
- package/dist/expressions/lang/generated/spec.json.cjs.map +1 -0
- package/dist/expressions/lang/generated/spec.json.d.ts +6260 -0
- package/dist/expressions/lang/generated/spec.json.js +12 -0
- package/dist/expressions/lang/generated/spec.json.js.map +1 -0
- package/dist/expressions/lang/hover.cjs +106 -0
- package/dist/expressions/lang/hover.cjs.map +1 -0
- package/dist/expressions/lang/hover.d.ts +54 -0
- package/dist/expressions/lang/hover.d.ts.map +1 -0
- package/dist/expressions/lang/hover.js +106 -0
- package/dist/expressions/lang/hover.js.map +1 -0
- package/dist/expressions/lang/index.cjs +87 -0
- package/dist/expressions/lang/index.cjs.map +1 -0
- package/dist/expressions/lang/index.d.ts +65 -0
- package/dist/expressions/lang/index.d.ts.map +1 -0
- package/dist/expressions/lang/index.js +90 -0
- package/dist/expressions/lang/index.js.map +1 -0
- package/dist/expressions/lang/merge.cjs +52 -0
- package/dist/expressions/lang/merge.cjs.map +1 -0
- package/dist/expressions/lang/merge.d.ts +12 -0
- package/dist/expressions/lang/merge.d.ts.map +1 -0
- package/dist/expressions/lang/merge.js +52 -0
- package/dist/expressions/lang/merge.js.map +1 -0
- package/dist/expressions/lang/prefix.cjs +91 -0
- package/dist/expressions/lang/prefix.cjs.map +1 -0
- package/dist/expressions/lang/prefix.d.ts +36 -0
- package/dist/expressions/lang/prefix.d.ts.map +1 -0
- package/dist/expressions/lang/prefix.js +91 -0
- package/dist/expressions/lang/prefix.js.map +1 -0
- package/dist/expressions/lang/spec.d.ts +13 -0
- package/dist/expressions/lang/spec.d.ts.map +1 -0
- package/dist/expressions/lang/theme.cjs +97 -0
- package/dist/expressions/lang/theme.cjs.map +1 -0
- package/dist/expressions/lang/theme.d.ts +6 -0
- package/dist/expressions/lang/theme.d.ts.map +1 -0
- package/dist/expressions/lang/theme.js +97 -0
- package/dist/expressions/lang/theme.js.map +1 -0
- package/dist/expressions/lang/types.d.ts +81 -0
- package/dist/expressions/lang/types.d.ts.map +1 -0
- package/dist/expressions/playground/ExpressionPlayground.cjs +308 -0
- package/dist/expressions/playground/ExpressionPlayground.cjs.map +1 -0
- package/dist/expressions/playground/ExpressionPlayground.d.ts +42 -0
- package/dist/expressions/playground/ExpressionPlayground.d.ts.map +1 -0
- package/dist/expressions/playground/ExpressionPlayground.js +291 -0
- package/dist/expressions/playground/ExpressionPlayground.js.map +1 -0
- package/dist/expressions/playground/RunControls.cjs +51 -0
- package/dist/expressions/playground/RunControls.cjs.map +1 -0
- package/dist/expressions/playground/RunControls.d.ts +7 -0
- package/dist/expressions/playground/RunControls.d.ts.map +1 -0
- package/dist/expressions/playground/RunControls.js +51 -0
- package/dist/expressions/playground/RunControls.js.map +1 -0
- package/dist/expressions/playground/VerticalSplit.cjs +109 -0
- package/dist/expressions/playground/VerticalSplit.cjs.map +1 -0
- package/dist/expressions/playground/VerticalSplit.d.ts +23 -0
- package/dist/expressions/playground/VerticalSplit.d.ts.map +1 -0
- package/dist/expressions/playground/VerticalSplit.js +109 -0
- package/dist/expressions/playground/VerticalSplit.js.map +1 -0
- package/dist/expressions/playground/api.cjs +49 -0
- package/dist/expressions/playground/api.cjs.map +1 -0
- package/dist/expressions/playground/api.d.ts +53 -0
- package/dist/expressions/playground/api.d.ts.map +1 -0
- package/dist/expressions/playground/api.js +49 -0
- package/dist/expressions/playground/api.js.map +1 -0
- package/dist/expressions/playground/languages.cjs +88 -0
- package/dist/expressions/playground/languages.cjs.map +1 -0
- package/dist/expressions/playground/languages.d.ts +43 -0
- package/dist/expressions/playground/languages.d.ts.map +1 -0
- package/dist/expressions/playground/languages.js +88 -0
- package/dist/expressions/playground/languages.js.map +1 -0
- package/dist/expressions/playground/panels/GraphPanel.cjs +72 -0
- package/dist/expressions/playground/panels/GraphPanel.cjs.map +1 -0
- package/dist/expressions/playground/panels/GraphPanel.d.ts +19 -0
- package/dist/expressions/playground/panels/GraphPanel.d.ts.map +1 -0
- package/dist/expressions/playground/panels/GraphPanel.js +72 -0
- package/dist/expressions/playground/panels/GraphPanel.js.map +1 -0
- package/dist/expressions/playground/panels/ResultPanel.cjs +82 -0
- package/dist/expressions/playground/panels/ResultPanel.cjs.map +1 -0
- package/dist/expressions/playground/panels/ResultPanel.d.ts +11 -0
- package/dist/expressions/playground/panels/ResultPanel.d.ts.map +1 -0
- package/dist/expressions/playground/panels/ResultPanel.js +82 -0
- package/dist/expressions/playground/panels/ResultPanel.js.map +1 -0
- package/dist/expressions/playground/panels/SpecPanel.cjs +76 -0
- package/dist/expressions/playground/panels/SpecPanel.cjs.map +1 -0
- package/dist/expressions/playground/panels/SpecPanel.d.ts +18 -0
- package/dist/expressions/playground/panels/SpecPanel.d.ts.map +1 -0
- package/dist/expressions/playground/panels/SpecPanel.js +76 -0
- package/dist/expressions/playground/panels/SpecPanel.js.map +1 -0
- package/dist/expressions/playground/panels/TokensPanel.cjs +89 -0
- package/dist/expressions/playground/panels/TokensPanel.cjs.map +1 -0
- package/dist/expressions/playground/panels/TokensPanel.d.ts +15 -0
- package/dist/expressions/playground/panels/TokensPanel.d.ts.map +1 -0
- package/dist/expressions/playground/panels/TokensPanel.js +72 -0
- package/dist/expressions/playground/panels/TokensPanel.js.map +1 -0
- package/dist/expressions/playground/panels/graphNodes.cjs +35 -0
- package/dist/expressions/playground/panels/graphNodes.cjs.map +1 -0
- package/dist/expressions/playground/panels/graphNodes.d.ts +19 -0
- package/dist/expressions/playground/panels/graphNodes.d.ts.map +1 -0
- package/dist/expressions/playground/panels/graphNodes.js +35 -0
- package/dist/expressions/playground/panels/graphNodes.js.map +1 -0
- package/dist/expressions/playground/runAction.cjs +12 -0
- package/dist/expressions/playground/runAction.cjs.map +1 -0
- package/dist/expressions/playground/runAction.d.ts +15 -0
- package/dist/expressions/playground/runAction.d.ts.map +1 -0
- package/dist/expressions/playground/runAction.js +12 -0
- package/dist/expressions/playground/runAction.js.map +1 -0
- package/dist/expressions/playground/runShortcut.cjs +9 -0
- package/dist/expressions/playground/runShortcut.cjs.map +1 -0
- package/dist/expressions/playground/runShortcut.d.ts +2 -0
- package/dist/expressions/playground/runShortcut.d.ts.map +1 -0
- package/dist/expressions/playground/runShortcut.js +9 -0
- package/dist/expressions/playground/runShortcut.js.map +1 -0
- package/dist/expressions/playground/useEditorTheme.cjs +40 -0
- package/dist/expressions/playground/useEditorTheme.cjs.map +1 -0
- package/dist/expressions/playground/useEditorTheme.d.ts +16 -0
- package/dist/expressions/playground/useEditorTheme.d.ts.map +1 -0
- package/dist/expressions/playground/useEditorTheme.js +23 -0
- package/dist/expressions/playground/useEditorTheme.js.map +1 -0
- package/dist/expressions/playground/useEvaluator.cjs +72 -0
- package/dist/expressions/playground/useEvaluator.cjs.map +1 -0
- package/dist/expressions/playground/useEvaluator.d.ts +25 -0
- package/dist/expressions/playground/useEvaluator.d.ts.map +1 -0
- package/dist/expressions/playground/useEvaluator.js +72 -0
- package/dist/expressions/playground/useEvaluator.js.map +1 -0
- package/dist/expressions/playground/useParsedInput.cjs +22 -0
- package/dist/expressions/playground/useParsedInput.cjs.map +1 -0
- package/dist/expressions/playground/useParsedInput.d.ts +20 -0
- package/dist/expressions/playground/useParsedInput.d.ts.map +1 -0
- package/dist/expressions/playground/useParsedInput.js +22 -0
- package/dist/expressions/playground/useParsedInput.js.map +1 -0
- package/dist/expressions/playground/verticalSplitModel.cjs +11 -0
- package/dist/expressions/playground/verticalSplitModel.cjs.map +1 -0
- package/dist/expressions/playground/verticalSplitModel.d.ts +3 -0
- package/dist/expressions/playground/verticalSplitModel.d.ts.map +1 -0
- package/dist/expressions/playground/verticalSplitModel.js +11 -0
- package/dist/expressions/playground/verticalSplitModel.js.map +1 -0
- package/dist/expressions/playground.cjs +18 -0
- package/dist/expressions/playground.cjs.map +1 -0
- package/dist/expressions/playground.d.ts +18 -0
- package/dist/expressions/playground.d.ts.map +1 -0
- package/dist/expressions/playground.js +18 -0
- package/dist/expressions/playground.js.map +1 -0
- package/dist/expressions.cjs +28 -0
- package/dist/expressions.cjs.map +1 -0
- package/dist/expressions.d.ts +10 -0
- package/dist/expressions.d.ts.map +1 -0
- package/dist/expressions.js +28 -0
- package/dist/expressions.js.map +1 -0
- package/dist/hooks/density-provider.d.ts +1 -1
- package/dist/hooks/theme-provider.d.ts +1 -1
- package/dist/hooks/use-density.d.ts +1 -1
- package/dist/hooks/use-resource-clock.cjs +14 -0
- package/dist/hooks/use-resource-clock.cjs.map +1 -0
- package/dist/hooks/use-resource-clock.d.ts +2 -0
- package/dist/hooks/use-resource-clock.d.ts.map +1 -0
- package/dist/hooks/use-resource-clock.js +14 -0
- package/dist/hooks/use-resource-clock.js.map +1 -0
- package/dist/hooks/use-task-run.cjs +12 -3
- package/dist/hooks/use-task-run.cjs.map +1 -1
- package/dist/hooks/use-task-run.d.ts.map +1 -1
- package/dist/hooks/use-task-run.js +12 -3
- package/dist/hooks/use-task-run.js.map +1 -1
- package/dist/hooks/use-theme.d.ts +1 -1
- package/dist/icons/registry.d.ts +1 -1
- package/dist/icons/types.d.ts +1 -1
- package/dist/layout/AppShell.d.ts +1 -1
- package/dist/layout/AppShell.nav.drag.d.ts +1 -1
- package/dist/layout/AppSidebar.d.ts +1 -1
- package/dist/layout/Panel.d.ts +1 -1
- package/dist/layout/PanelFrame.d.ts +1 -1
- package/dist/layout/Section.d.ts +1 -1
- package/dist/layout/SplitPane.d.ts +1 -1
- package/dist/layout/Tabs.d.ts +1 -1
- package/dist/layout/Workspace.d.ts +1 -1
- package/dist/layout/Workspace.model.d.ts +1 -1
- package/dist/lib/combobox-values.d.ts +1 -1
- package/dist/monaco/MonacoEditor.cjs +3 -3
- package/dist/monaco/MonacoEditor.cjs.map +1 -1
- package/dist/monaco/MonacoEditor.js +2 -2
- package/dist/monaco/MonacoEditor.js.map +1 -1
- package/dist/monaco/types.d.ts +1 -1
- package/dist/monaco/use-monaco-worker.d.ts +1 -1
- package/dist/overlay/CellActions.d.ts +1 -1
- package/dist/overlay/CommandPalette.d.ts +2 -2
- package/dist/overlay/CommandPalette.model.d.ts +1 -1
- package/dist/overlay/CommandPaletteList.d.ts +1 -1
- package/dist/overlay/DropdownMenu.d.ts +1 -1
- package/dist/overlay/HoverCard.d.ts +1 -1
- package/dist/overlay/Modal.d.ts +2 -2
- package/dist/overlay/Toast.d.ts +1 -1
- package/dist/overlay/TourCard.d.ts +1 -1
- package/dist/overlay/TourProvider.d.ts +1 -1
- package/dist/overlay/dropdownMenuContext.d.ts +1 -1
- package/dist/overlay/toast-context.d.ts +2 -2
- package/dist/overlay/tour-context.d.ts +1 -1
- package/dist/overlay/tour-types.d.ts +1 -1
- package/dist/profiles/connections/connectionBrowserModel.d.ts +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts +1 -1
- package/dist/profiles/editor/profileBuilder.d.ts +1 -1
- package/dist/profiles/elasticsearch/esParamOperandExtension.d.ts +1 -1
- package/dist/profiles/fields/profileFieldControls.d.ts +1 -1
- package/dist/profiles/fields/profileFieldIcons.d.ts +1 -1
- package/dist/profiles/fields/profileFieldState.d.ts +1 -1
- package/dist/profiles/query/jsonPathSample.d.ts +1 -1
- package/dist/profiles/query/jsonPathSampleRow.d.ts +1 -1
- package/dist/profiles/query/prometheusResults.d.ts +2 -2
- package/dist/rpc/EndpointList.d.ts +1 -1
- package/dist/rpc/EntityExplorerApp.d.ts +1 -1
- package/dist/rpc/OperationCatalog.d.ts +1 -1
- package/dist/rpc/OperationEntityContextPicker.d.ts +1 -1
- package/dist/rpc/OperationEntityPage.d.ts +1 -1
- package/dist/rpc/OperationResultView.d.ts +1 -1
- package/dist/rpc/RouterProvider.d.ts +1 -1
- package/dist/rpc/SchemaActionForm.d.ts +1 -1
- package/dist/rpc/formMetadata.d.ts +1 -1
- package/dist/rpc/router.d.ts +1 -1
- package/dist/rpc/rpc-story.fixtures.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +21 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface TokensPanelProps {
|
|
2
|
+
source: string;
|
|
3
|
+
languageId: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Shows the token stream Monarch produces.
|
|
7
|
+
*
|
|
8
|
+
* This is the panel that makes a highlighting bug legible: colours tell you
|
|
9
|
+
* something is off, the token stream tells you which rule matched. It is also
|
|
10
|
+
* the fastest way to check a newly registered function is classified as
|
|
11
|
+
* `function` rather than falling through to `identifier`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function TokensPanel({ source, languageId }: TokensPanelProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=TokensPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokensPanel.d.ts","sourceRoot":"","sources":["../../../../src/expressions/playground/panels/TokensPanel.tsx"],"names":[],"mappings":"AAIA,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,gBAAgB,+BAqDnE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { DataTable } from "../../../data/DataTable.js";
|
|
4
|
+
import * as monacoEditor from "monaco-editor";
|
|
5
|
+
function TokensPanel({ source, languageId }) {
|
|
6
|
+
const rows = useMemo(
|
|
7
|
+
() => tokenize(source, languageId),
|
|
8
|
+
[source, languageId]
|
|
9
|
+
);
|
|
10
|
+
const columns = [
|
|
11
|
+
{
|
|
12
|
+
key: "line",
|
|
13
|
+
label: "Line",
|
|
14
|
+
align: "right",
|
|
15
|
+
shrink: true,
|
|
16
|
+
sortable: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: "text",
|
|
20
|
+
label: "Text",
|
|
21
|
+
grow: true,
|
|
22
|
+
cellClassName: "font-mono whitespace-pre"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: "token",
|
|
26
|
+
label: "Token",
|
|
27
|
+
sortable: true,
|
|
28
|
+
filterable: true,
|
|
29
|
+
cellClassName: "font-mono",
|
|
30
|
+
// An `identifier` is the fallback every unmatched word lands on, so it is
|
|
31
|
+
// the one class worth de-emphasising: what stands out is what matched.
|
|
32
|
+
render: (value) => /* @__PURE__ */ jsx(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
className: String(value).startsWith("identifier") ? "text-muted-foreground" : "",
|
|
36
|
+
children: String(value)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
DataTable,
|
|
43
|
+
{
|
|
44
|
+
data: rows,
|
|
45
|
+
columns,
|
|
46
|
+
autoFilter: true,
|
|
47
|
+
showGlobalFilter: true,
|
|
48
|
+
globalFilterPlaceholder: "Filter tokens…",
|
|
49
|
+
emptyMessage: "Nothing to tokenize.",
|
|
50
|
+
className: "h-full"
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function tokenize(source, languageId) {
|
|
55
|
+
if (!source.trim()) return [];
|
|
56
|
+
const lines = monacoEditor.editor.tokenize(source, languageId);
|
|
57
|
+
const rows = [];
|
|
58
|
+
source.split(/\r\n|\r|\n/).forEach((line, index) => {
|
|
59
|
+
const tokens = lines[index] ?? [];
|
|
60
|
+
tokens.forEach((token, i) => {
|
|
61
|
+
const end = i + 1 < tokens.length ? tokens[i + 1].offset : line.length;
|
|
62
|
+
const text = line.slice(token.offset, end);
|
|
63
|
+
if (text.trim() === "") return;
|
|
64
|
+
rows.push({ line: index + 1, text, token: token.type });
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return rows;
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
TokensPanel
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=TokensPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokensPanel.js","sources":["../../../../src/expressions/playground/panels/TokensPanel.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { DataTable, type DataTableColumn } from \"../../../data/DataTable\";\nimport * as monaco from \"monaco-editor\";\n\ninterface TokensPanelProps {\n source: string;\n languageId: string;\n}\n\ninterface TokenRow extends Record<string, unknown> {\n line: number;\n text: string;\n token: string;\n}\n\n/**\n * Shows the token stream Monarch produces.\n *\n * This is the panel that makes a highlighting bug legible: colours tell you\n * something is off, the token stream tells you which rule matched. It is also\n * the fastest way to check a newly registered function is classified as\n * `function` rather than falling through to `identifier`.\n */\nexport function TokensPanel({ source, languageId }: TokensPanelProps) {\n const rows = useMemo(\n () => tokenize(source, languageId),\n [source, languageId],\n );\n\n const columns: DataTableColumn<TokenRow>[] = [\n {\n key: \"line\",\n label: \"Line\",\n align: \"right\",\n shrink: true,\n sortable: true,\n },\n {\n key: \"text\",\n label: \"Text\",\n grow: true,\n cellClassName: \"font-mono whitespace-pre\",\n },\n {\n key: \"token\",\n label: \"Token\",\n sortable: true,\n filterable: true,\n cellClassName: \"font-mono\",\n // An `identifier` is the fallback every unmatched word lands on, so it is\n // the one class worth de-emphasising: what stands out is what matched.\n render: (value) => (\n <span\n className={\n String(value).startsWith(\"identifier\")\n ? \"text-muted-foreground\"\n : \"\"\n }\n >\n {String(value)}\n </span>\n ),\n },\n ];\n\n return (\n <DataTable\n data={rows}\n columns={columns}\n autoFilter\n showGlobalFilter\n globalFilterPlaceholder=\"Filter tokens…\"\n emptyMessage=\"Nothing to tokenize.\"\n className=\"h-full\"\n />\n );\n}\n\nfunction tokenize(source: string, languageId: string): TokenRow[] {\n if (!source.trim()) return [];\n\n const lines = monaco.editor.tokenize(source, languageId);\n const rows: TokenRow[] = [];\n\n source.split(/\\r\\n|\\r|\\n/).forEach((line, index) => {\n const tokens = lines[index] ?? [];\n tokens.forEach((token, i) => {\n // Monaco reports a start offset only; each token runs to the next start.\n const end = i + 1 < tokens.length ? tokens[i + 1]!.offset : line.length;\n const text = line.slice(token.offset, end);\n if (text.trim() === \"\") return;\n rows.push({ line: index + 1, text, token: token.type });\n });\n });\n return rows;\n}\n"],"names":["monaco"],"mappings":";;;;AAuBO,SAAS,YAAY,EAAE,QAAQ,cAAgC;AACpE,QAAM,OAAO;AAAA,IACX,MAAM,SAAS,QAAQ,UAAU;AAAA,IACjC,CAAC,QAAQ,UAAU;AAAA,EAAA;AAGrB,QAAM,UAAuC;AAAA,IAC3C;AAAA,MACE,KAAK;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,IAAA;AAAA,IAEZ;AAAA,MACE,KAAK;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,eAAe;AAAA,IAAA;AAAA,IAEjB;AAAA,MACE,KAAK;AAAA,MACL,OAAO;AAAA,MACP,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,eAAe;AAAA;AAAA;AAAA,MAGf,QAAQ,CAAC,UACP;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WACE,OAAO,KAAK,EAAE,WAAW,YAAY,IACjC,0BACA;AAAA,UAGL,iBAAO,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACf;AAAA,EAEJ;AAGF,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA,YAAU;AAAA,MACV,kBAAgB;AAAA,MAChB,yBAAwB;AAAA,MACxB,cAAa;AAAA,MACb,WAAU;AAAA,IAAA;AAAA,EAAA;AAGhB;AAEA,SAAS,SAAS,QAAgB,YAAgC;AAChE,MAAI,CAAC,OAAO,KAAA,UAAe,CAAA;AAE3B,QAAM,QAAQA,aAAO,OAAO,SAAS,QAAQ,UAAU;AACvD,QAAM,OAAmB,CAAA;AAEzB,SAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,UAAU;AAClD,UAAM,SAAS,MAAM,KAAK,KAAK,CAAA;AAC/B,WAAO,QAAQ,CAAC,OAAO,MAAM;AAE3B,YAAM,MAAM,IAAI,IAAI,OAAO,SAAS,OAAO,IAAI,CAAC,EAAG,SAAS,KAAK;AACjE,YAAM,OAAO,KAAK,MAAM,MAAM,QAAQ,GAAG;AACzC,UAAI,KAAK,KAAA,MAAW,GAAI;AACxB,WAAK,KAAK,EAAE,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,MAAM;AAAA,IACxD,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsonPathTree = require("../../../components/jsonPathTree.cjs");
|
|
4
|
+
const environment = require("../../lang/environment.cjs");
|
|
5
|
+
function toGraphNode(node) {
|
|
6
|
+
const container = node.kind === "object" || node.kind === "array";
|
|
7
|
+
const scalar = node.kind === "scalar";
|
|
8
|
+
return {
|
|
9
|
+
id: node.key,
|
|
10
|
+
label: labelOf(node),
|
|
11
|
+
path: node.path,
|
|
12
|
+
kind: node.kind,
|
|
13
|
+
...scalar || container ? { type: environment.kindOf(node.value) } : {},
|
|
14
|
+
...scalar ? { value: scalarValue(node.value) } : {},
|
|
15
|
+
...scalar ? {} : { raw: node.summary },
|
|
16
|
+
expandable: container && node.childCount > 0,
|
|
17
|
+
metadata: { node }
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function labelOf(node) {
|
|
21
|
+
if (node.kind === "more") return "…";
|
|
22
|
+
const segments = jsonPathTree.literalSegments(node.path);
|
|
23
|
+
const last = segments == null ? void 0 : segments[segments.length - 1];
|
|
24
|
+
return last === void 0 ? node.path : String(last);
|
|
25
|
+
}
|
|
26
|
+
function scalarValue(value) {
|
|
27
|
+
if (value === null || value === void 0) return null;
|
|
28
|
+
const type = typeof value;
|
|
29
|
+
if (type === "string" || type === "number" || type === "boolean") {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
return String(value);
|
|
33
|
+
}
|
|
34
|
+
exports.toGraphNode = toGraphNode;
|
|
35
|
+
//# sourceMappingURL=graphNodes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphNodes.cjs","sources":["../../../../src/expressions/playground/panels/graphNodes.ts"],"sourcesContent":["import {\n literalSegments,\n type JSONPathNode,\n} from \"../../../components/jsonPathTree\";\nimport type { ObjectGraphNode } from \"../../../data/ObjectGraph\";\nimport { kindOf } from \"../../lang/index.ts\";\n\n/** An `ObjectGraphNode` that keeps the tree node it came from, for lazy loading. */\nexport interface GraphNode extends ObjectGraphNode {\n metadata?: { node: JSONPathNode };\n}\n\n/**\n * Maps one lazy-tree node to a graph row.\n *\n * Two of the tree's fields do not mean what their names suggest here. `key` is a\n * namespaced identity, not a display name, so the label comes off the end of the\n * path instead. And `kind` is structural — object, array, scalar — so a scalar's\n * own type is read from the value: `string` against `number` is the distinction\n * that decides whether an expression needs quotes.\n */\nexport function toGraphNode(node: JSONPathNode): GraphNode {\n const container = node.kind === \"object\" || node.kind === \"array\";\n const scalar = node.kind === \"scalar\";\n // Keys are omitted rather than set to undefined: `exactOptionalPropertyTypes`\n // treats the two as different, and ObjectGraph's optional fields mean absent.\n return {\n id: node.key,\n label: labelOf(node),\n path: node.path,\n kind: node.kind,\n ...(scalar || container ? { type: kindOf(node.value) } : {}),\n ...(scalar ? { value: scalarValue(node.value) } : {}),\n ...(scalar ? {} : { raw: node.summary }),\n expandable: container && node.childCount > 0,\n metadata: { node },\n };\n}\n\n/** The last segment of the node's path — the root has none, and is `$`. */\nfunction labelOf(node: JSONPathNode): string {\n if (node.kind === \"more\") return \"…\";\n const segments = literalSegments(node.path);\n const last = segments?.[segments.length - 1];\n return last === undefined ? node.path : String(last);\n}\n\nfunction scalarValue(value: unknown): string | number | boolean | null {\n if (value === null || value === undefined) return null;\n const type = typeof value;\n if (type === \"string\" || type === \"number\" || type === \"boolean\") {\n return value as string | number | boolean;\n }\n return String(value);\n}\n"],"names":["kindOf","literalSegments"],"mappings":";;;;AAqBO,SAAS,YAAY,MAA+B;AACzD,QAAM,YAAY,KAAK,SAAS,YAAY,KAAK,SAAS;AAC1D,QAAM,SAAS,KAAK,SAAS;AAG7B,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,OAAO,QAAQ,IAAI;AAAA,IACnB,MAAM,KAAK;AAAA,IACX,MAAM,KAAK;AAAA,IACX,GAAI,UAAU,YAAY,EAAE,MAAMA,YAAAA,OAAO,KAAK,KAAK,EAAA,IAAM,CAAA;AAAA,IACzD,GAAI,SAAS,EAAE,OAAO,YAAY,KAAK,KAAK,EAAA,IAAM,CAAA;AAAA,IAClD,GAAI,SAAS,CAAA,IAAK,EAAE,KAAK,KAAK,QAAA;AAAA,IAC9B,YAAY,aAAa,KAAK,aAAa;AAAA,IAC3C,UAAU,EAAE,KAAA;AAAA,EAAK;AAErB;AAGA,SAAS,QAAQ,MAA4B;AAC3C,MAAI,KAAK,SAAS,OAAQ,QAAO;AACjC,QAAM,WAAWC,aAAAA,gBAAgB,KAAK,IAAI;AAC1C,QAAM,OAAO,qCAAW,SAAS,SAAS;AAC1C,SAAO,SAAS,SAAY,KAAK,OAAO,OAAO,IAAI;AACrD;AAEA,SAAS,YAAY,OAAkD;AACrE,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,OAAO,OAAO;AACpB,MAAI,SAAS,YAAY,SAAS,YAAY,SAAS,WAAW;AAChE,WAAO;AAAA,EACT;AACA,SAAO,OAAO,KAAK;AACrB;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JSONPathNode } from '../../../components/jsonPathTree';
|
|
2
|
+
import { ObjectGraphNode } from '../../../data/ObjectGraph';
|
|
3
|
+
/** An `ObjectGraphNode` that keeps the tree node it came from, for lazy loading. */
|
|
4
|
+
export interface GraphNode extends ObjectGraphNode {
|
|
5
|
+
metadata?: {
|
|
6
|
+
node: JSONPathNode;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps one lazy-tree node to a graph row.
|
|
11
|
+
*
|
|
12
|
+
* Two of the tree's fields do not mean what their names suggest here. `key` is a
|
|
13
|
+
* namespaced identity, not a display name, so the label comes off the end of the
|
|
14
|
+
* path instead. And `kind` is structural — object, array, scalar — so a scalar's
|
|
15
|
+
* own type is read from the value: `string` against `number` is the distinction
|
|
16
|
+
* that decides whether an expression needs quotes.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toGraphNode(node: JSONPathNode): GraphNode;
|
|
19
|
+
//# sourceMappingURL=graphNodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphNodes.d.ts","sourceRoot":"","sources":["../../../../src/expressions/playground/panels/graphNodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,oFAAoF;AACpF,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,YAAY,CAAA;KAAE,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAgBzD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { literalSegments } from "../../../components/jsonPathTree.js";
|
|
2
|
+
import { kindOf } from "../../lang/environment.js";
|
|
3
|
+
function toGraphNode(node) {
|
|
4
|
+
const container = node.kind === "object" || node.kind === "array";
|
|
5
|
+
const scalar = node.kind === "scalar";
|
|
6
|
+
return {
|
|
7
|
+
id: node.key,
|
|
8
|
+
label: labelOf(node),
|
|
9
|
+
path: node.path,
|
|
10
|
+
kind: node.kind,
|
|
11
|
+
...scalar || container ? { type: kindOf(node.value) } : {},
|
|
12
|
+
...scalar ? { value: scalarValue(node.value) } : {},
|
|
13
|
+
...scalar ? {} : { raw: node.summary },
|
|
14
|
+
expandable: container && node.childCount > 0,
|
|
15
|
+
metadata: { node }
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function labelOf(node) {
|
|
19
|
+
if (node.kind === "more") return "…";
|
|
20
|
+
const segments = literalSegments(node.path);
|
|
21
|
+
const last = segments == null ? void 0 : segments[segments.length - 1];
|
|
22
|
+
return last === void 0 ? node.path : String(last);
|
|
23
|
+
}
|
|
24
|
+
function scalarValue(value) {
|
|
25
|
+
if (value === null || value === void 0) return null;
|
|
26
|
+
const type = typeof value;
|
|
27
|
+
if (type === "string" || type === "number" || type === "boolean") {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
toGraphNode
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=graphNodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphNodes.js","sources":["../../../../src/expressions/playground/panels/graphNodes.ts"],"sourcesContent":["import {\n literalSegments,\n type JSONPathNode,\n} from \"../../../components/jsonPathTree\";\nimport type { ObjectGraphNode } from \"../../../data/ObjectGraph\";\nimport { kindOf } from \"../../lang/index.ts\";\n\n/** An `ObjectGraphNode` that keeps the tree node it came from, for lazy loading. */\nexport interface GraphNode extends ObjectGraphNode {\n metadata?: { node: JSONPathNode };\n}\n\n/**\n * Maps one lazy-tree node to a graph row.\n *\n * Two of the tree's fields do not mean what their names suggest here. `key` is a\n * namespaced identity, not a display name, so the label comes off the end of the\n * path instead. And `kind` is structural — object, array, scalar — so a scalar's\n * own type is read from the value: `string` against `number` is the distinction\n * that decides whether an expression needs quotes.\n */\nexport function toGraphNode(node: JSONPathNode): GraphNode {\n const container = node.kind === \"object\" || node.kind === \"array\";\n const scalar = node.kind === \"scalar\";\n // Keys are omitted rather than set to undefined: `exactOptionalPropertyTypes`\n // treats the two as different, and ObjectGraph's optional fields mean absent.\n return {\n id: node.key,\n label: labelOf(node),\n path: node.path,\n kind: node.kind,\n ...(scalar || container ? { type: kindOf(node.value) } : {}),\n ...(scalar ? { value: scalarValue(node.value) } : {}),\n ...(scalar ? {} : { raw: node.summary }),\n expandable: container && node.childCount > 0,\n metadata: { node },\n };\n}\n\n/** The last segment of the node's path — the root has none, and is `$`. */\nfunction labelOf(node: JSONPathNode): string {\n if (node.kind === \"more\") return \"…\";\n const segments = literalSegments(node.path);\n const last = segments?.[segments.length - 1];\n return last === undefined ? node.path : String(last);\n}\n\nfunction scalarValue(value: unknown): string | number | boolean | null {\n if (value === null || value === undefined) return null;\n const type = typeof value;\n if (type === \"string\" || type === \"number\" || type === \"boolean\") {\n return value as string | number | boolean;\n }\n return String(value);\n}\n"],"names":[],"mappings":";;AAqBO,SAAS,YAAY,MAA+B;AACzD,QAAM,YAAY,KAAK,SAAS,YAAY,KAAK,SAAS;AAC1D,QAAM,SAAS,KAAK,SAAS;AAG7B,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,OAAO,QAAQ,IAAI;AAAA,IACnB,MAAM,KAAK;AAAA,IACX,MAAM,KAAK;AAAA,IACX,GAAI,UAAU,YAAY,EAAE,MAAM,OAAO,KAAK,KAAK,EAAA,IAAM,CAAA;AAAA,IACzD,GAAI,SAAS,EAAE,OAAO,YAAY,KAAK,KAAK,EAAA,IAAM,CAAA;AAAA,IAClD,GAAI,SAAS,CAAA,IAAK,EAAE,KAAK,KAAK,QAAA;AAAA,IAC9B,YAAY,aAAa,KAAK,aAAa;AAAA,IAC3C,UAAU,EAAE,KAAA;AAAA,EAAK;AAErB;AAGA,SAAS,QAAQ,MAA4B;AAC3C,MAAI,KAAK,SAAS,OAAQ,QAAO;AACjC,QAAM,WAAW,gBAAgB,KAAK,IAAI;AAC1C,QAAM,OAAO,qCAAW,SAAS,SAAS;AAC1C,SAAO,SAAS,SAAY,KAAK,OAAO,OAAO,IAAI;AACrD;AAEA,SAAS,YAAY,OAAkD;AACrE,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,OAAO,OAAO;AACpB,MAAI,SAAS,YAAY,SAAS,YAAY,SAAS,WAAW;AAChE,WAAO;AAAA,EACT;AACA,SAAO,OAAO,KAAK;AACrB;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function registerRunAction(editor, monaco, run) {
|
|
4
|
+
return editor.addAction({
|
|
5
|
+
id: "gomplate.run",
|
|
6
|
+
label: "Run expression",
|
|
7
|
+
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],
|
|
8
|
+
run
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
exports.registerRunAction = registerRunAction;
|
|
12
|
+
//# sourceMappingURL=runAction.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAction.cjs","sources":["../../../src/expressions/playground/runAction.ts"],"sourcesContent":["import type * as monacoEditor from \"monaco-editor\";\nimport type { Monaco } from \"@monaco-editor/react\";\n\n/**\n * Registers Cmd/Ctrl+Enter inside a Monaco editor.\n *\n * A window-level listener is not enough: Monaco captures keystrokes while it\n * has focus, which is exactly where the reader is when they want to run. The\n * action also puts \"Run expression\" in the editor's command palette, so the\n * accelerator is discoverable rather than folklore.\n *\n * `run` is read through a ref by the caller, because the action is registered\n * once per editor and must not capture the first render's closure.\n */\nexport function registerRunAction(\n editor: monacoEditor.editor.IStandaloneCodeEditor,\n monaco: Monaco,\n run: () => void,\n): monacoEditor.IDisposable {\n return editor.addAction({\n id: \"gomplate.run\",\n label: \"Run expression\",\n keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],\n run,\n });\n}\n"],"names":[],"mappings":";;AAcO,SAAS,kBACd,QACA,QACA,KAC0B;AAC1B,SAAO,OAAO,UAAU;AAAA,IACtB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa,CAAC,OAAO,OAAO,UAAU,OAAO,QAAQ,KAAK;AAAA,IAC1D;AAAA,EAAA,CACD;AACH;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Monaco } from '@monaco-editor/react';
|
|
2
|
+
import type * as monacoEditor from "monaco-editor";
|
|
3
|
+
/**
|
|
4
|
+
* Registers Cmd/Ctrl+Enter inside a Monaco editor.
|
|
5
|
+
*
|
|
6
|
+
* A window-level listener is not enough: Monaco captures keystrokes while it
|
|
7
|
+
* has focus, which is exactly where the reader is when they want to run. The
|
|
8
|
+
* action also puts "Run expression" in the editor's command palette, so the
|
|
9
|
+
* accelerator is discoverable rather than folklore.
|
|
10
|
+
*
|
|
11
|
+
* `run` is read through a ref by the caller, because the action is registered
|
|
12
|
+
* once per editor and must not capture the first render's closure.
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerRunAction(editor: monacoEditor.editor.IStandaloneCodeEditor, monaco: Monaco, run: () => void): monacoEditor.IDisposable;
|
|
15
|
+
//# sourceMappingURL=runAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAction.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/runAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,YAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,qBAAqB,EACjD,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,IAAI,GACd,YAAY,CAAC,WAAW,CAO1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function registerRunAction(editor, monaco, run) {
|
|
2
|
+
return editor.addAction({
|
|
3
|
+
id: "gomplate.run",
|
|
4
|
+
label: "Run expression",
|
|
5
|
+
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],
|
|
6
|
+
run
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
registerRunAction
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=runAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAction.js","sources":["../../../src/expressions/playground/runAction.ts"],"sourcesContent":["import type * as monacoEditor from \"monaco-editor\";\nimport type { Monaco } from \"@monaco-editor/react\";\n\n/**\n * Registers Cmd/Ctrl+Enter inside a Monaco editor.\n *\n * A window-level listener is not enough: Monaco captures keystrokes while it\n * has focus, which is exactly where the reader is when they want to run. The\n * action also puts \"Run expression\" in the editor's command palette, so the\n * accelerator is discoverable rather than folklore.\n *\n * `run` is read through a ref by the caller, because the action is registered\n * once per editor and must not capture the first render's closure.\n */\nexport function registerRunAction(\n editor: monacoEditor.editor.IStandaloneCodeEditor,\n monaco: Monaco,\n run: () => void,\n): monacoEditor.IDisposable {\n return editor.addAction({\n id: \"gomplate.run\",\n label: \"Run expression\",\n keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter],\n run,\n });\n}\n"],"names":[],"mappings":"AAcO,SAAS,kBACd,QACA,QACA,KAC0B;AAC1B,SAAO,OAAO,UAAU;AAAA,IACtB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa,CAAC,OAAO,OAAO,UAAU,OAAO,QAAQ,KAAK;AAAA,IAC1D;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const RUN_SHORTCUT_LABEL = isApple() ? "⌘⏎" : "Ctrl+↵";
|
|
4
|
+
function isApple() {
|
|
5
|
+
if (typeof navigator === "undefined") return false;
|
|
6
|
+
return /mac|iphone|ipad/i.test(navigator.userAgent);
|
|
7
|
+
}
|
|
8
|
+
exports.RUN_SHORTCUT_LABEL = RUN_SHORTCUT_LABEL;
|
|
9
|
+
//# sourceMappingURL=runShortcut.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runShortcut.cjs","sources":["../../../src/expressions/playground/runShortcut.ts"],"sourcesContent":["export const RUN_SHORTCUT_LABEL = isApple() ? \"⌘⏎\" : \"Ctrl+↵\";\n\nfunction isApple(): boolean {\n if (typeof navigator === \"undefined\") return false;\n return /mac|iphone|ipad/i.test(navigator.userAgent);\n}\n"],"names":[],"mappings":";;AAAO,MAAM,qBAAqB,QAAA,IAAY,OAAO;AAErD,SAAS,UAAmB;AAC1B,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,SAAO,mBAAmB,KAAK,UAAU,SAAS;AACpD;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runShortcut.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/runShortcut.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,QAA8B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const RUN_SHORTCUT_LABEL = isApple() ? "⌘⏎" : "Ctrl+↵";
|
|
2
|
+
function isApple() {
|
|
3
|
+
if (typeof navigator === "undefined") return false;
|
|
4
|
+
return /mac|iphone|ipad/i.test(navigator.userAgent);
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
RUN_SHORTCUT_LABEL
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=runShortcut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runShortcut.js","sources":["../../../src/expressions/playground/runShortcut.ts"],"sourcesContent":["export const RUN_SHORTCUT_LABEL = isApple() ? \"⌘⏎\" : \"Ctrl+↵\";\n\nfunction isApple(): boolean {\n if (typeof navigator === \"undefined\") return false;\n return /mac|iphone|ipad/i.test(navigator.userAgent);\n}\n"],"names":[],"mappings":"AAAO,MAAM,qBAAqB,QAAA,IAAY,OAAO;AAErD,SAAS,UAAmB;AAC1B,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,SAAO,mBAAmB,KAAK,UAAU,SAAS;AACpD;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const monacoEditor = require("monaco-editor");
|
|
5
|
+
const theme = require("../lang/theme.cjs");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const monacoEditor__namespace = /* @__PURE__ */ _interopNamespaceDefault(monacoEditor);
|
|
23
|
+
function useEditorTheme() {
|
|
24
|
+
const applyTheme = react.useCallback(() => {
|
|
25
|
+
const dark = document.documentElement.getAttribute("data-theme") === "dark";
|
|
26
|
+
monacoEditor__namespace.editor.setTheme(dark ? theme.GOMPLATE_DARK_THEME : theme.GOMPLATE_LIGHT_THEME);
|
|
27
|
+
}, []);
|
|
28
|
+
react.useEffect(() => {
|
|
29
|
+
applyTheme();
|
|
30
|
+
const observer = new MutationObserver(applyTheme);
|
|
31
|
+
observer.observe(document.documentElement, {
|
|
32
|
+
attributes: true,
|
|
33
|
+
attributeFilter: ["data-theme"]
|
|
34
|
+
});
|
|
35
|
+
return () => observer.disconnect();
|
|
36
|
+
}, [applyTheme]);
|
|
37
|
+
return applyTheme;
|
|
38
|
+
}
|
|
39
|
+
exports.useEditorTheme = useEditorTheme;
|
|
40
|
+
//# sourceMappingURL=useEditorTheme.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorTheme.cjs","sources":["../../../src/expressions/playground/useEditorTheme.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport * as monaco from \"monaco-editor\";\nimport { GOMPLATE_DARK_THEME, GOMPLATE_LIGHT_THEME } from \"../lang/index.ts\";\n\n/**\n * Applies the gomplate colour themes and keeps them in step with clicky-ui's\n * theme switcher.\n *\n * `monaco.editor.setTheme` is global rather than per-editor, and\n * `@monaco-editor/react` calls it whenever an editor mounts, using the `theme`\n * prop clicky-ui hardcodes to `light`/`vs-dark`. So setting the theme once is\n * not enough: every editor that mounts afterwards resets it. Re-asserting from\n * each editor's `onMount` runs after that call and is deterministic, where a\n * plain effect would race the editor's lazy mount.\n *\n * clicky-ui's `MonacoEditor` gaining a `theme` prop makes this unnecessary;\n * until then this keeps the playground correct against the published package.\n */\nexport function useEditorTheme() {\n const applyTheme = useCallback(() => {\n const dark = document.documentElement.getAttribute(\"data-theme\") === \"dark\";\n monaco.editor.setTheme(dark ? GOMPLATE_DARK_THEME : GOMPLATE_LIGHT_THEME);\n }, []);\n\n useEffect(() => {\n applyTheme();\n\n // clicky-ui's ThemeProvider writes `data-theme` on <html> and emits no\n // event, so observe the attribute.\n const observer = new MutationObserver(applyTheme);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n return () => observer.disconnect();\n }, [applyTheme]);\n\n return applyTheme;\n}\n"],"names":["useCallback","monaco","GOMPLATE_DARK_THEME","GOMPLATE_LIGHT_THEME","useEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBO,SAAS,iBAAiB;AAC/B,QAAM,aAAaA,MAAAA,YAAY,MAAM;AACnC,UAAM,OAAO,SAAS,gBAAgB,aAAa,YAAY,MAAM;AACrEC,4BAAO,OAAO,SAAS,OAAOC,MAAAA,sBAAsBC,MAAAA,oBAAoB;AAAA,EAC1E,GAAG,CAAA,CAAE;AAELC,QAAAA,UAAU,MAAM;AACd,eAAA;AAIA,UAAM,WAAW,IAAI,iBAAiB,UAAU;AAChD,aAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,YAAY;AAAA,IAAA,CAC/B;AACD,WAAO,MAAM,SAAS,WAAA;AAAA,EACxB,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AACT;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies the gomplate colour themes and keeps them in step with clicky-ui's
|
|
3
|
+
* theme switcher.
|
|
4
|
+
*
|
|
5
|
+
* `monaco.editor.setTheme` is global rather than per-editor, and
|
|
6
|
+
* `@monaco-editor/react` calls it whenever an editor mounts, using the `theme`
|
|
7
|
+
* prop clicky-ui hardcodes to `light`/`vs-dark`. So setting the theme once is
|
|
8
|
+
* not enough: every editor that mounts afterwards resets it. Re-asserting from
|
|
9
|
+
* each editor's `onMount` runs after that call and is deterministic, where a
|
|
10
|
+
* plain effect would race the editor's lazy mount.
|
|
11
|
+
*
|
|
12
|
+
* clicky-ui's `MonacoEditor` gaining a `theme` prop makes this unnecessary;
|
|
13
|
+
* until then this keeps the playground correct against the published package.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useEditorTheme(): () => void;
|
|
16
|
+
//# sourceMappingURL=useEditorTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorTheme.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/useEditorTheme.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,eAoB7B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback, useEffect } from "react";
|
|
2
|
+
import * as monacoEditor from "monaco-editor";
|
|
3
|
+
import { GOMPLATE_DARK_THEME, GOMPLATE_LIGHT_THEME } from "../lang/theme.js";
|
|
4
|
+
function useEditorTheme() {
|
|
5
|
+
const applyTheme = useCallback(() => {
|
|
6
|
+
const dark = document.documentElement.getAttribute("data-theme") === "dark";
|
|
7
|
+
monacoEditor.editor.setTheme(dark ? GOMPLATE_DARK_THEME : GOMPLATE_LIGHT_THEME);
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
applyTheme();
|
|
11
|
+
const observer = new MutationObserver(applyTheme);
|
|
12
|
+
observer.observe(document.documentElement, {
|
|
13
|
+
attributes: true,
|
|
14
|
+
attributeFilter: ["data-theme"]
|
|
15
|
+
});
|
|
16
|
+
return () => observer.disconnect();
|
|
17
|
+
}, [applyTheme]);
|
|
18
|
+
return applyTheme;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
useEditorTheme
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useEditorTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorTheme.js","sources":["../../../src/expressions/playground/useEditorTheme.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport * as monaco from \"monaco-editor\";\nimport { GOMPLATE_DARK_THEME, GOMPLATE_LIGHT_THEME } from \"../lang/index.ts\";\n\n/**\n * Applies the gomplate colour themes and keeps them in step with clicky-ui's\n * theme switcher.\n *\n * `monaco.editor.setTheme` is global rather than per-editor, and\n * `@monaco-editor/react` calls it whenever an editor mounts, using the `theme`\n * prop clicky-ui hardcodes to `light`/`vs-dark`. So setting the theme once is\n * not enough: every editor that mounts afterwards resets it. Re-asserting from\n * each editor's `onMount` runs after that call and is deterministic, where a\n * plain effect would race the editor's lazy mount.\n *\n * clicky-ui's `MonacoEditor` gaining a `theme` prop makes this unnecessary;\n * until then this keeps the playground correct against the published package.\n */\nexport function useEditorTheme() {\n const applyTheme = useCallback(() => {\n const dark = document.documentElement.getAttribute(\"data-theme\") === \"dark\";\n monaco.editor.setTheme(dark ? GOMPLATE_DARK_THEME : GOMPLATE_LIGHT_THEME);\n }, []);\n\n useEffect(() => {\n applyTheme();\n\n // clicky-ui's ThemeProvider writes `data-theme` on <html> and emits no\n // event, so observe the attribute.\n const observer = new MutationObserver(applyTheme);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n return () => observer.disconnect();\n }, [applyTheme]);\n\n return applyTheme;\n}\n"],"names":["monaco"],"mappings":";;;AAkBO,SAAS,iBAAiB;AAC/B,QAAM,aAAa,YAAY,MAAM;AACnC,UAAM,OAAO,SAAS,gBAAgB,aAAa,YAAY,MAAM;AACrEA,iBAAO,OAAO,SAAS,OAAO,sBAAsB,oBAAoB;AAAA,EAC1E,GAAG,CAAA,CAAE;AAEL,YAAU,MAAM;AACd,eAAA;AAIA,UAAM,WAAW,IAAI,iBAAiB,UAAU;AAChD,aAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,YAAY;AAAA,IAAA,CAC/B;AACD,WAAO,MAAM,SAAS,WAAA;AAAA,EACxB,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AACT;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const api = require("./api.cjs");
|
|
5
|
+
const AUTO_RUN_STORAGE_KEY = "expressions:auto-run";
|
|
6
|
+
const DEBOUNCE_MS = 250;
|
|
7
|
+
function useEvaluator(apiBase, payload) {
|
|
8
|
+
const [response, setResponse] = react.useState(null);
|
|
9
|
+
const [pending, setPending] = react.useState(false);
|
|
10
|
+
const [autoRun, setAutoRunState] = react.useState(readAutoRun);
|
|
11
|
+
const [evaluated, setEvaluated] = react.useState(null);
|
|
12
|
+
const abortRef = react.useRef(void 0);
|
|
13
|
+
const payloadRef = react.useRef(payload);
|
|
14
|
+
payloadRef.current = payload;
|
|
15
|
+
const evaluateNow = react.useCallback(() => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const current = payloadRef.current;
|
|
18
|
+
if (!current.source.trim()) {
|
|
19
|
+
(_a = abortRef.current) == null ? void 0 : _a.abort();
|
|
20
|
+
setResponse(null);
|
|
21
|
+
setEvaluated(current);
|
|
22
|
+
setPending(false);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
(_b = abortRef.current) == null ? void 0 : _b.abort();
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
abortRef.current = controller;
|
|
28
|
+
setPending(true);
|
|
29
|
+
api.evaluate(apiBase, current, controller.signal).then((next) => {
|
|
30
|
+
setResponse(next);
|
|
31
|
+
setEvaluated(current);
|
|
32
|
+
setPending(false);
|
|
33
|
+
}).catch(() => {
|
|
34
|
+
});
|
|
35
|
+
}, [apiBase]);
|
|
36
|
+
react.useEffect(() => {
|
|
37
|
+
if (!autoRun) return;
|
|
38
|
+
const timer = setTimeout(evaluateNow, DEBOUNCE_MS);
|
|
39
|
+
return () => clearTimeout(timer);
|
|
40
|
+
}, [payload.language, payload.source, payload.input, autoRun, evaluateNow]);
|
|
41
|
+
react.useEffect(() => {
|
|
42
|
+
setResponse(null);
|
|
43
|
+
setEvaluated(null);
|
|
44
|
+
}, [payload.language]);
|
|
45
|
+
const setAutoRun = react.useCallback(
|
|
46
|
+
(next) => {
|
|
47
|
+
setAutoRunState(next);
|
|
48
|
+
window.localStorage.setItem(AUTO_RUN_STORAGE_KEY, String(next));
|
|
49
|
+
if (next) evaluateNow();
|
|
50
|
+
},
|
|
51
|
+
[evaluateNow]
|
|
52
|
+
);
|
|
53
|
+
return {
|
|
54
|
+
response,
|
|
55
|
+
pending,
|
|
56
|
+
stale: isStale(evaluated, payload),
|
|
57
|
+
autoRun,
|
|
58
|
+
setAutoRun,
|
|
59
|
+
run: evaluateNow
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function isStale(evaluated, current) {
|
|
63
|
+
if (!current.source.trim()) return false;
|
|
64
|
+
if (!evaluated) return true;
|
|
65
|
+
return evaluated.source !== current.source || evaluated.input !== current.input || evaluated.language !== current.language;
|
|
66
|
+
}
|
|
67
|
+
function readAutoRun() {
|
|
68
|
+
if (typeof window === "undefined") return true;
|
|
69
|
+
return window.localStorage.getItem(AUTO_RUN_STORAGE_KEY) !== "false";
|
|
70
|
+
}
|
|
71
|
+
exports.useEvaluator = useEvaluator;
|
|
72
|
+
//# sourceMappingURL=useEvaluator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvaluator.cjs","sources":["../../../src/expressions/playground/useEvaluator.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { evaluate, type EvalRequest, type EvalResponse } from \"./api.ts\";\n\nconst AUTO_RUN_STORAGE_KEY = \"expressions:auto-run\";\n\n/** How long typing settles before an automatic run fires. */\nconst DEBOUNCE_MS = 250;\n\nexport interface Evaluator {\n response: EvalResponse | null;\n /** A request is in flight or a debounce is pending. */\n pending: boolean;\n /** The source or input has changed since the shown result was produced. */\n stale: boolean;\n autoRun: boolean;\n setAutoRun: (next: boolean) => void;\n /** Evaluates now, skipping the debounce. */\n run: () => void;\n}\n\ntype Payload = Pick<EvalRequest, \"language\" | \"source\" | \"input\">;\n\n/**\n * Runs an expression against the Go evaluator.\n *\n * Automatic evaluation is convenient for a one-line expression and a nuisance\n * for anything longer: a debounce fires mid-keystroke and reports errors for\n * half-written input. So it is a toggle, and an explicit run is always\n * available -- which is also the only way to re-run an expression whose value\n * changes on its own (`time.Now()`, `uuid.V4()`, `random.*`).\n */\nexport function useEvaluator(apiBase: string, payload: Payload): Evaluator {\n const [response, setResponse] = useState<EvalResponse | null>(null);\n const [pending, setPending] = useState(false);\n const [autoRun, setAutoRunState] = useState(readAutoRun);\n const [evaluated, setEvaluated] = useState<Payload | null>(null);\n\n const abortRef = useRef<AbortController | undefined>(undefined);\n // The current payload, so `run` stays referentially stable: it is wired into\n // a Monaco action registered once at mount, which would otherwise capture the\n // payload from the first render forever.\n const payloadRef = useRef(payload);\n payloadRef.current = payload;\n\n const evaluateNow = useCallback(() => {\n const current = payloadRef.current;\n if (!current.source.trim()) {\n abortRef.current?.abort();\n setResponse(null);\n setEvaluated(current);\n setPending(false);\n return;\n }\n\n abortRef.current?.abort();\n const controller = new AbortController();\n abortRef.current = controller;\n\n setPending(true);\n evaluate(apiBase, current, controller.signal)\n .then((next) => {\n setResponse(next);\n setEvaluated(current);\n setPending(false);\n })\n .catch(() => {\n // Superseded by a newer run; that one owns the state.\n });\n }, [apiBase]);\n\n useEffect(() => {\n if (!autoRun) return;\n const timer = setTimeout(evaluateNow, DEBOUNCE_MS);\n return () => clearTimeout(timer);\n }, [payload.language, payload.source, payload.input, autoRun, evaluateNow]);\n\n // Switching language changes what the source even means, so show nothing\n // rather than the previous language's result.\n useEffect(() => {\n setResponse(null);\n setEvaluated(null);\n }, [payload.language]);\n\n const setAutoRun = useCallback(\n (next: boolean) => {\n setAutoRunState(next);\n window.localStorage.setItem(AUTO_RUN_STORAGE_KEY, String(next));\n if (next) evaluateNow();\n },\n [evaluateNow],\n );\n\n return {\n response,\n pending,\n stale: isStale(evaluated, payload),\n autoRun,\n setAutoRun,\n run: evaluateNow,\n };\n}\n\nfunction isStale(evaluated: Payload | null, current: Payload): boolean {\n if (!current.source.trim()) return false;\n if (!evaluated) return true;\n return (\n evaluated.source !== current.source ||\n evaluated.input !== current.input ||\n evaluated.language !== current.language\n );\n}\n\nfunction readAutoRun(): boolean {\n if (typeof window === \"undefined\") return true;\n // Default on: the playground should evaluate as soon as it opens.\n return window.localStorage.getItem(AUTO_RUN_STORAGE_KEY) !== \"false\";\n}\n"],"names":["useState","useRef","useCallback","evaluate","useEffect"],"mappings":";;;;AAGA,MAAM,uBAAuB;AAG7B,MAAM,cAAc;AAyBb,SAAS,aAAa,SAAiB,SAA6B;AACzE,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAA8B,IAAI;AAClE,QAAM,CAAC,SAAS,UAAU,IAAIA,MAAAA,SAAS,KAAK;AAC5C,QAAM,CAAC,SAAS,eAAe,IAAIA,MAAAA,SAAS,WAAW;AACvD,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA,SAAyB,IAAI;AAE/D,QAAM,WAAWC,MAAAA,OAAoC,MAAS;AAI9D,QAAM,aAAaA,MAAAA,OAAO,OAAO;AACjC,aAAW,UAAU;AAErB,QAAM,cAAcC,MAAAA,YAAY,MAAM;;AACpC,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC,QAAQ,OAAO,QAAQ;AAC1B,qBAAS,YAAT,mBAAkB;AAClB,kBAAY,IAAI;AAChB,mBAAa,OAAO;AACpB,iBAAW,KAAK;AAChB;AAAA,IACF;AAEA,mBAAS,YAAT,mBAAkB;AAClB,UAAM,aAAa,IAAI,gBAAA;AACvB,aAAS,UAAU;AAEnB,eAAW,IAAI;AACfC,QAAAA,SAAS,SAAS,SAAS,WAAW,MAAM,EACzC,KAAK,CAAC,SAAS;AACd,kBAAY,IAAI;AAChB,mBAAa,OAAO;AACpB,iBAAW,KAAK;AAAA,IAClB,CAAC,EACA,MAAM,MAAM;AAAA,IAEb,CAAC;AAAA,EACL,GAAG,CAAC,OAAO,CAAC;AAEZC,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,QAAS;AACd,UAAM,QAAQ,WAAW,aAAa,WAAW;AACjD,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,QAAQ,UAAU,QAAQ,QAAQ,QAAQ,OAAO,SAAS,WAAW,CAAC;AAI1EA,QAAAA,UAAU,MAAM;AACd,gBAAY,IAAI;AAChB,iBAAa,IAAI;AAAA,EACnB,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,QAAM,aAAaF,MAAAA;AAAAA,IACjB,CAAC,SAAkB;AACjB,sBAAgB,IAAI;AACpB,aAAO,aAAa,QAAQ,sBAAsB,OAAO,IAAI,CAAC;AAC9D,UAAI,KAAM,aAAA;AAAA,IACZ;AAAA,IACA,CAAC,WAAW;AAAA,EAAA;AAGd,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO,QAAQ,WAAW,OAAO;AAAA,IACjC;AAAA,IACA;AAAA,IACA,KAAK;AAAA,EAAA;AAET;AAEA,SAAS,QAAQ,WAA2B,SAA2B;AACrE,MAAI,CAAC,QAAQ,OAAO,KAAA,EAAQ,QAAO;AACnC,MAAI,CAAC,UAAW,QAAO;AACvB,SACE,UAAU,WAAW,QAAQ,UAC7B,UAAU,UAAU,QAAQ,SAC5B,UAAU,aAAa,QAAQ;AAEnC;AAEA,SAAS,cAAuB;AAC9B,MAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,SAAO,OAAO,aAAa,QAAQ,oBAAoB,MAAM;AAC/D;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EvalRequest, EvalResponse } from './api.ts';
|
|
2
|
+
export interface Evaluator {
|
|
3
|
+
response: EvalResponse | null;
|
|
4
|
+
/** A request is in flight or a debounce is pending. */
|
|
5
|
+
pending: boolean;
|
|
6
|
+
/** The source or input has changed since the shown result was produced. */
|
|
7
|
+
stale: boolean;
|
|
8
|
+
autoRun: boolean;
|
|
9
|
+
setAutoRun: (next: boolean) => void;
|
|
10
|
+
/** Evaluates now, skipping the debounce. */
|
|
11
|
+
run: () => void;
|
|
12
|
+
}
|
|
13
|
+
type Payload = Pick<EvalRequest, "language" | "source" | "input">;
|
|
14
|
+
/**
|
|
15
|
+
* Runs an expression against the Go evaluator.
|
|
16
|
+
*
|
|
17
|
+
* Automatic evaluation is convenient for a one-line expression and a nuisance
|
|
18
|
+
* for anything longer: a debounce fires mid-keystroke and reports errors for
|
|
19
|
+
* half-written input. So it is a toggle, and an explicit run is always
|
|
20
|
+
* available -- which is also the only way to re-run an expression whose value
|
|
21
|
+
* changes on its own (`time.Now()`, `uuid.V4()`, `random.*`).
|
|
22
|
+
*/
|
|
23
|
+
export declare function useEvaluator(apiBase: string, payload: Payload): Evaluator;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=useEvaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvaluator.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/useEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAOzE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,4CAA4C;IAC5C,GAAG,EAAE,MAAM,IAAI,CAAC;CACjB;AAED,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAC;AAElE;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,CAqEzE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
2
|
+
import { evaluate } from "./api.js";
|
|
3
|
+
const AUTO_RUN_STORAGE_KEY = "expressions:auto-run";
|
|
4
|
+
const DEBOUNCE_MS = 250;
|
|
5
|
+
function useEvaluator(apiBase, payload) {
|
|
6
|
+
const [response, setResponse] = useState(null);
|
|
7
|
+
const [pending, setPending] = useState(false);
|
|
8
|
+
const [autoRun, setAutoRunState] = useState(readAutoRun);
|
|
9
|
+
const [evaluated, setEvaluated] = useState(null);
|
|
10
|
+
const abortRef = useRef(void 0);
|
|
11
|
+
const payloadRef = useRef(payload);
|
|
12
|
+
payloadRef.current = payload;
|
|
13
|
+
const evaluateNow = useCallback(() => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const current = payloadRef.current;
|
|
16
|
+
if (!current.source.trim()) {
|
|
17
|
+
(_a = abortRef.current) == null ? void 0 : _a.abort();
|
|
18
|
+
setResponse(null);
|
|
19
|
+
setEvaluated(current);
|
|
20
|
+
setPending(false);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
(_b = abortRef.current) == null ? void 0 : _b.abort();
|
|
24
|
+
const controller = new AbortController();
|
|
25
|
+
abortRef.current = controller;
|
|
26
|
+
setPending(true);
|
|
27
|
+
evaluate(apiBase, current, controller.signal).then((next) => {
|
|
28
|
+
setResponse(next);
|
|
29
|
+
setEvaluated(current);
|
|
30
|
+
setPending(false);
|
|
31
|
+
}).catch(() => {
|
|
32
|
+
});
|
|
33
|
+
}, [apiBase]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!autoRun) return;
|
|
36
|
+
const timer = setTimeout(evaluateNow, DEBOUNCE_MS);
|
|
37
|
+
return () => clearTimeout(timer);
|
|
38
|
+
}, [payload.language, payload.source, payload.input, autoRun, evaluateNow]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setResponse(null);
|
|
41
|
+
setEvaluated(null);
|
|
42
|
+
}, [payload.language]);
|
|
43
|
+
const setAutoRun = useCallback(
|
|
44
|
+
(next) => {
|
|
45
|
+
setAutoRunState(next);
|
|
46
|
+
window.localStorage.setItem(AUTO_RUN_STORAGE_KEY, String(next));
|
|
47
|
+
if (next) evaluateNow();
|
|
48
|
+
},
|
|
49
|
+
[evaluateNow]
|
|
50
|
+
);
|
|
51
|
+
return {
|
|
52
|
+
response,
|
|
53
|
+
pending,
|
|
54
|
+
stale: isStale(evaluated, payload),
|
|
55
|
+
autoRun,
|
|
56
|
+
setAutoRun,
|
|
57
|
+
run: evaluateNow
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function isStale(evaluated, current) {
|
|
61
|
+
if (!current.source.trim()) return false;
|
|
62
|
+
if (!evaluated) return true;
|
|
63
|
+
return evaluated.source !== current.source || evaluated.input !== current.input || evaluated.language !== current.language;
|
|
64
|
+
}
|
|
65
|
+
function readAutoRun() {
|
|
66
|
+
if (typeof window === "undefined") return true;
|
|
67
|
+
return window.localStorage.getItem(AUTO_RUN_STORAGE_KEY) !== "false";
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
useEvaluator
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=useEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvaluator.js","sources":["../../../src/expressions/playground/useEvaluator.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { evaluate, type EvalRequest, type EvalResponse } from \"./api.ts\";\n\nconst AUTO_RUN_STORAGE_KEY = \"expressions:auto-run\";\n\n/** How long typing settles before an automatic run fires. */\nconst DEBOUNCE_MS = 250;\n\nexport interface Evaluator {\n response: EvalResponse | null;\n /** A request is in flight or a debounce is pending. */\n pending: boolean;\n /** The source or input has changed since the shown result was produced. */\n stale: boolean;\n autoRun: boolean;\n setAutoRun: (next: boolean) => void;\n /** Evaluates now, skipping the debounce. */\n run: () => void;\n}\n\ntype Payload = Pick<EvalRequest, \"language\" | \"source\" | \"input\">;\n\n/**\n * Runs an expression against the Go evaluator.\n *\n * Automatic evaluation is convenient for a one-line expression and a nuisance\n * for anything longer: a debounce fires mid-keystroke and reports errors for\n * half-written input. So it is a toggle, and an explicit run is always\n * available -- which is also the only way to re-run an expression whose value\n * changes on its own (`time.Now()`, `uuid.V4()`, `random.*`).\n */\nexport function useEvaluator(apiBase: string, payload: Payload): Evaluator {\n const [response, setResponse] = useState<EvalResponse | null>(null);\n const [pending, setPending] = useState(false);\n const [autoRun, setAutoRunState] = useState(readAutoRun);\n const [evaluated, setEvaluated] = useState<Payload | null>(null);\n\n const abortRef = useRef<AbortController | undefined>(undefined);\n // The current payload, so `run` stays referentially stable: it is wired into\n // a Monaco action registered once at mount, which would otherwise capture the\n // payload from the first render forever.\n const payloadRef = useRef(payload);\n payloadRef.current = payload;\n\n const evaluateNow = useCallback(() => {\n const current = payloadRef.current;\n if (!current.source.trim()) {\n abortRef.current?.abort();\n setResponse(null);\n setEvaluated(current);\n setPending(false);\n return;\n }\n\n abortRef.current?.abort();\n const controller = new AbortController();\n abortRef.current = controller;\n\n setPending(true);\n evaluate(apiBase, current, controller.signal)\n .then((next) => {\n setResponse(next);\n setEvaluated(current);\n setPending(false);\n })\n .catch(() => {\n // Superseded by a newer run; that one owns the state.\n });\n }, [apiBase]);\n\n useEffect(() => {\n if (!autoRun) return;\n const timer = setTimeout(evaluateNow, DEBOUNCE_MS);\n return () => clearTimeout(timer);\n }, [payload.language, payload.source, payload.input, autoRun, evaluateNow]);\n\n // Switching language changes what the source even means, so show nothing\n // rather than the previous language's result.\n useEffect(() => {\n setResponse(null);\n setEvaluated(null);\n }, [payload.language]);\n\n const setAutoRun = useCallback(\n (next: boolean) => {\n setAutoRunState(next);\n window.localStorage.setItem(AUTO_RUN_STORAGE_KEY, String(next));\n if (next) evaluateNow();\n },\n [evaluateNow],\n );\n\n return {\n response,\n pending,\n stale: isStale(evaluated, payload),\n autoRun,\n setAutoRun,\n run: evaluateNow,\n };\n}\n\nfunction isStale(evaluated: Payload | null, current: Payload): boolean {\n if (!current.source.trim()) return false;\n if (!evaluated) return true;\n return (\n evaluated.source !== current.source ||\n evaluated.input !== current.input ||\n evaluated.language !== current.language\n );\n}\n\nfunction readAutoRun(): boolean {\n if (typeof window === \"undefined\") return true;\n // Default on: the playground should evaluate as soon as it opens.\n return window.localStorage.getItem(AUTO_RUN_STORAGE_KEY) !== \"false\";\n}\n"],"names":[],"mappings":";;AAGA,MAAM,uBAAuB;AAG7B,MAAM,cAAc;AAyBb,SAAS,aAAa,SAAiB,SAA6B;AACzE,QAAM,CAAC,UAAU,WAAW,IAAI,SAA8B,IAAI;AAClE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,SAAS,eAAe,IAAI,SAAS,WAAW;AACvD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAyB,IAAI;AAE/D,QAAM,WAAW,OAAoC,MAAS;AAI9D,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AAErB,QAAM,cAAc,YAAY,MAAM;;AACpC,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC,QAAQ,OAAO,QAAQ;AAC1B,qBAAS,YAAT,mBAAkB;AAClB,kBAAY,IAAI;AAChB,mBAAa,OAAO;AACpB,iBAAW,KAAK;AAChB;AAAA,IACF;AAEA,mBAAS,YAAT,mBAAkB;AAClB,UAAM,aAAa,IAAI,gBAAA;AACvB,aAAS,UAAU;AAEnB,eAAW,IAAI;AACf,aAAS,SAAS,SAAS,WAAW,MAAM,EACzC,KAAK,CAAC,SAAS;AACd,kBAAY,IAAI;AAChB,mBAAa,OAAO;AACpB,iBAAW,KAAK;AAAA,IAClB,CAAC,EACA,MAAM,MAAM;AAAA,IAEb,CAAC;AAAA,EACL,GAAG,CAAC,OAAO,CAAC;AAEZ,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AACd,UAAM,QAAQ,WAAW,aAAa,WAAW;AACjD,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,QAAQ,UAAU,QAAQ,QAAQ,QAAQ,OAAO,SAAS,WAAW,CAAC;AAI1E,YAAU,MAAM;AACd,gBAAY,IAAI;AAChB,iBAAa,IAAI;AAAA,EACnB,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,QAAM,aAAa;AAAA,IACjB,CAAC,SAAkB;AACjB,sBAAgB,IAAI;AACpB,aAAO,aAAa,QAAQ,sBAAsB,OAAO,IAAI,CAAC;AAC9D,UAAI,KAAM,aAAA;AAAA,IACZ;AAAA,IACA,CAAC,WAAW;AAAA,EAAA;AAGd,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO,QAAQ,WAAW,OAAO;AAAA,IACjC;AAAA,IACA;AAAA,IACA,KAAK;AAAA,EAAA;AAET;AAEA,SAAS,QAAQ,WAA2B,SAA2B;AACrE,MAAI,CAAC,QAAQ,OAAO,KAAA,EAAQ,QAAO;AACnC,MAAI,CAAC,UAAW,QAAO;AACvB,SACE,UAAU,WAAW,QAAQ,UAC7B,UAAU,UAAU,QAAQ,SAC5B,UAAU,aAAa,QAAQ;AAEnC;AAEA,SAAS,cAAuB;AAC9B,MAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,SAAO,OAAO,aAAa,QAAQ,oBAAoB,MAAM;AAC/D;"}
|