@dxos/plugin-script 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PLUGIN.mdl +93 -17
- package/README.md +1 -1
- package/dist/lib/Notebook.mjs +4 -5
- package/dist/lib/Notebook.mjs.map +1 -1
- package/dist/lib/ScriptCapabilities.mjs.map +1 -1
- package/dist/lib/ScriptOperation.mjs +1 -1
- package/dist/lib/ScriptOperation.mjs.map +1 -1
- package/dist/lib/ScriptOperationHandlerSet.mjs.map +1 -1
- package/dist/lib/ScriptSkill.mjs +1 -1
- package/dist/lib/ScriptSkill.mjs.map +1 -1
- package/dist/lib/capabilities.browser.mjs +51 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +17 -7
- package/dist/lib/capabilities.mjs.map +1 -1
- package/dist/lib/capabilities.node.mjs +16 -4
- package/dist/lib/capabilities.node.mjs.map +1 -1
- package/dist/lib/capabilities.tauri.mjs +51 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs +1 -1
- package/dist/lib/capabilities.workerd.mjs.map +1 -1
- package/dist/lib/chunk-DeploymentDialog.mjs +12 -9
- package/dist/lib/chunk-DeploymentDialog.mjs.map +1 -1
- package/dist/lib/chunk-NotebookArticle.mjs +37 -36
- package/dist/lib/chunk-NotebookArticle.mjs.map +1 -1
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-ScriptArticle.mjs +14 -15
- package/dist/lib/chunk-ScriptArticle.mjs.map +1 -1
- package/dist/lib/chunk-ScriptProperties.mjs +91 -94
- package/dist/lib/chunk-ScriptProperties.mjs.map +1 -1
- package/dist/lib/chunk-ScriptSettings.mjs +11 -8
- package/dist/lib/chunk-ScriptSettings.mjs.map +1 -1
- package/dist/lib/chunk-TestContainer.mjs +5 -5
- package/dist/lib/chunk-TestContainer.mjs.map +1 -1
- package/dist/lib/chunk-app-graph-builder.mjs +2 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -1
- package/dist/lib/chunk-compiler.mjs +87 -4
- package/dist/lib/chunk-compiler.mjs.map +1 -1
- package/dist/lib/chunk-create-object.mjs +1 -1
- package/dist/lib/chunk-create-script.mjs.map +1 -1
- package/dist/lib/chunk-create.mjs +4 -4
- package/dist/lib/chunk-create.mjs.map +1 -1
- package/dist/lib/chunk-definitions.mjs +246 -0
- package/dist/lib/chunk-definitions.mjs.map +1 -0
- package/dist/lib/chunk-delete.mjs +2 -2
- package/dist/lib/chunk-delete.mjs.map +1 -1
- package/dist/lib/chunk-deploy.mjs +16 -12
- package/dist/lib/chunk-deploy.mjs.map +1 -1
- package/dist/lib/chunk-errors.mjs +8 -0
- package/dist/lib/chunk-errors.mjs.map +1 -0
- package/dist/lib/chunk-functions.mjs +66 -246
- package/dist/lib/chunk-functions.mjs.map +1 -1
- package/dist/lib/chunk-inspect-invocations.mjs +3 -3
- package/dist/lib/chunk-inspect-invocations.mjs.map +1 -1
- package/dist/lib/chunk-install-function.mjs +11 -11
- package/dist/lib/chunk-install-function.mjs.map +1 -1
- package/dist/lib/chunk-invoke.mjs +6 -6
- package/dist/lib/chunk-invoke.mjs.map +1 -1
- package/dist/lib/chunk-operation-handler.mjs +16 -2
- package/dist/lib/chunk-operation-handler.mjs.map +1 -1
- package/dist/lib/chunk-query-deployed-functions.mjs +5 -6
- package/dist/lib/chunk-query-deployed-functions.mjs.map +1 -1
- package/dist/lib/chunk-react-surface.mjs +14 -10
- package/dist/lib/chunk-react-surface.mjs.map +1 -1
- package/dist/lib/chunk-read.mjs +4 -3
- package/dist/lib/chunk-read.mjs.map +1 -1
- package/dist/lib/chunk-settings.mjs +2 -2
- package/dist/lib/chunk-settings.mjs.map +1 -1
- package/dist/lib/chunk-skill-definition.mjs +1 -1
- package/dist/lib/chunk-templates.mjs +3 -3
- package/dist/lib/chunk-update.mjs +4 -3
- package/dist/lib/chunk-update.mjs.map +1 -1
- package/dist/lib/components.mjs +114 -123
- package/dist/lib/components.mjs.map +1 -1
- package/dist/lib/containers.mjs.map +1 -1
- package/dist/lib/hooks.mjs +96 -16
- package/dist/lib/hooks.mjs.map +1 -1
- package/dist/lib/index.mjs +5 -3
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/ns/ScriptFunction.mjs +12 -0
- package/dist/lib/ns/ScriptFunction.mjs.map +1 -0
- package/dist/lib/ns/Templates.mjs +11 -0
- package/dist/lib/ns/Templates.mjs.map +1 -0
- package/dist/lib/testing.mjs +1 -1
- package/dist/lib/translations.mjs +2 -1
- package/dist/lib/translations.mjs.map +1 -1
- package/dist/types/src/ScriptFunction.d.ts +2 -0
- package/dist/types/src/ScriptFunction.d.ts.map +1 -0
- package/dist/types/src/Templates.d.ts +2 -0
- package/dist/types/src/Templates.d.ts.map +1 -0
- package/dist/types/src/capabilities/ScriptSurfaces.d.ts.map +1 -1
- package/dist/types/src/capabilities/compiler.d.ts +2 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/errors.d.ts +33 -0
- package/dist/types/src/capabilities/errors.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/browser.d.ts +12 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/gen/tauri.d.ts +12 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/compiler/index.d.ts +1 -1
- package/dist/types/src/compiler/index.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +4 -4
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +10 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/index.d.ts +2 -2
- package/dist/types/src/components/NotebookStack/index.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +10 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/index.d.ts +1 -1
- package/dist/types/src/components/ScriptToolbar/index.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +2 -2
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +2 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/index.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +10 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/index.d.ts +1 -1
- package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptArticle/index.d.ts +1 -1
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +10 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -1
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts +2 -2
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts +11 -1
- package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptSettings/index.d.ts +1 -1
- package/dist/types/src/containers/ScriptSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +3 -3
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +6 -6
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +2 -2
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +3 -3
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/notebook/index.d.ts +1 -1
- package/dist/types/src/notebook/index.d.ts.map +1 -1
- package/dist/types/src/operations/ScriptOperationHandlerSet.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/skills/ScriptSkill.d.ts.map +1 -1
- package/dist/types/src/skills/functions/definitions.d.ts +8 -6
- package/dist/types/src/skills/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/skills/functions/deploy.d.ts +4 -2
- package/dist/types/src/skills/functions/deploy.d.ts.map +1 -1
- package/dist/types/src/skills/functions/errors.d.ts +33 -0
- package/dist/types/src/skills/functions/errors.d.ts.map +1 -0
- package/dist/types/src/skills/functions/index.d.ts +1 -1
- package/dist/types/src/skills/functions/index.d.ts.map +1 -1
- package/dist/types/src/skills/functions/install-function.d.ts +3 -2
- package/dist/types/src/skills/functions/install-function.d.ts.map +1 -1
- package/dist/types/src/skills/functions/invoke.d.ts +2 -2
- package/dist/types/src/skills/functions/invoke.d.ts.map +1 -1
- package/dist/types/src/skills/functions/query-deployed-functions.d.ts +2 -2
- package/dist/types/src/skills/functions/query-deployed-functions.d.ts.map +1 -1
- package/dist/types/src/skills/index.d.ts +1 -1
- package/dist/types/src/skills/index.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +3 -3
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +5 -5
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +6 -3
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +106 -96
- package/src/ScriptFunction.ts +7 -0
- package/src/Templates.ts +7 -0
- package/src/capabilities/ScriptSurfaces.tsx +19 -10
- package/src/capabilities/app-graph-builder.ts +2 -0
- package/src/capabilities/compiler.ts +6 -5
- package/src/capabilities/errors.ts +8 -0
- package/src/capabilities/gen/browser.ts +62 -0
- package/src/capabilities/gen/node.ts +10 -10
- package/src/capabilities/gen/tauri.ts +62 -0
- package/src/capabilities/gen/workerd.ts +4 -4
- package/src/capabilities/index.ts +11 -11
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.ts +4 -4
- package/src/capabilities/settings.ts +2 -2
- package/src/compiler/compiler.browser.test.ts +1 -1
- package/src/compiler/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +35 -29
- package/src/components/NotebookStack/NotebookMenu.tsx +27 -26
- package/src/components/NotebookStack/NotebookStack.stories.tsx +3 -3
- package/src/components/NotebookStack/NotebookStack.tsx +20 -17
- package/src/components/NotebookStack/index.ts +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +5 -5
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -15
- package/src/components/ScriptToolbar/index.ts +1 -1
- package/src/components/TestPanel/TestPanel.tsx +29 -23
- package/src/components/TestPanel/index.ts +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +10 -8
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +11 -7
- package/src/components/TypescriptEditor/index.ts +1 -1
- package/src/components/index.ts +4 -5
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +5 -7
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +18 -15
- package/src/containers/DeploymentDialog/index.ts +1 -1
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +6 -6
- package/src/containers/NotebookArticle/NotebookArticle.tsx +25 -21
- package/src/containers/NotebookArticle/index.ts +1 -1
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +3 -3
- package/src/containers/ScriptArticle/ScriptArticle.tsx +13 -11
- package/src/containers/ScriptArticle/index.ts +1 -1
- package/src/containers/ScriptProperties/FunctionBinding.tsx +18 -18
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +22 -22
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +3 -3
- package/src/containers/ScriptProperties/ScriptProperties.tsx +10 -10
- package/src/containers/ScriptProperties/SkillEditor.tsx +16 -14
- package/src/containers/ScriptProperties/index.ts +1 -1
- package/src/containers/ScriptSettings/ScriptSettings.stories.tsx +1 -1
- package/src/containers/ScriptSettings/ScriptSettings.tsx +16 -11
- package/src/containers/ScriptSettings/index.ts +1 -1
- package/src/containers/TestContainer/TestContainer.tsx +4 -4
- package/src/containers/TestContainer/index.ts +1 -1
- package/src/containers/index.ts +6 -6
- package/src/e2e/ai.test.ts +1 -1
- package/src/hooks/deploy.ts +12 -5
- package/src/hooks/index.ts +6 -6
- package/src/hooks/template.ts +1 -1
- package/src/hooks/useCompiler.ts +8 -7
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +10 -5
- package/src/hooks/useToolbarState.ts +4 -4
- package/src/index.ts +5 -3
- package/src/meta.ts +1 -1
- package/src/notebook/compute-graph.test.ts +2 -2
- package/src/notebook/compute-graph.ts +4 -4
- package/src/notebook/index.ts +1 -1
- package/src/notebook/vfs-parser.test.ts +1 -1
- package/src/notebook/vfs-parser.ts +1 -1
- package/src/operations/ScriptOperationHandlerSet.ts +3 -1
- package/src/operations/create-script.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/plugin.test.ts +2 -2
- package/src/skills/ScriptSkill.ts +3 -1
- package/src/skills/functions/create.ts +4 -4
- package/src/skills/functions/definitions.ts +8 -6
- package/src/skills/functions/delete.ts +1 -1
- package/src/skills/functions/deploy.ts +13 -9
- package/src/skills/functions/errors.ts +8 -0
- package/src/skills/functions/index.ts +11 -11
- package/src/skills/functions/inspect-invocations.ts +1 -1
- package/src/skills/functions/install-function.ts +11 -14
- package/src/skills/functions/invoke.ts +5 -5
- package/src/skills/functions/query-deployed-functions.ts +3 -4
- package/src/skills/functions/read.ts +3 -2
- package/src/skills/functions/update.ts +3 -2
- package/src/skills/index.ts +1 -1
- package/src/templates/anthropic.ts +2 -2
- package/src/templates/commentary.ts +1 -1
- package/src/templates/forex-effect.ts +7 -4
- package/src/testing/index.ts +2 -2
- package/src/translations.ts +4 -2
- package/src/types/Notebook.ts +6 -4
- package/src/types/ScriptCapabilities.ts +3 -3
- package/src/types/ScriptOperation.ts +1 -1
- package/src/types/index.ts +5 -5
- package/src/util/deploy.ts +10 -7
- package/src/util/functions.ts +24 -15
- package/src/util/index.ts +2 -2
- package/dist/lib/chunk-compiler2.mjs +0 -76
- package/dist/lib/chunk-compiler2.mjs.map +0 -1
- package/dist/lib/chunk-util.mjs +0 -146
- package/dist/lib/chunk-util.mjs.map +0 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +0 -5
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +0 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +0 -14
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/QueryEditor/index.d.ts +0 -2
- package/dist/types/src/components/QueryEditor/index.d.ts.map +0 -1
- package/src/components/QueryEditor/QueryEditor.stories.tsx +0 -91
- package/src/components/QueryEditor/QueryEditor.tsx +0 -50
- package/src/components/QueryEditor/index.ts +0 -5
package/dist/lib/components.mjs
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { t as Compiler } from "./chunk-compiler.mjs";
|
|
2
1
|
import { meta } from "#meta";
|
|
3
|
-
import { arrayMove, isNonNullable } from "@dxos/util";
|
|
4
2
|
import { Obj } from "@dxos/echo";
|
|
5
3
|
import { log } from "@dxos/log";
|
|
4
|
+
import { arrayMove, isNonNullable } from "@dxos/util";
|
|
6
5
|
import { forwardRef, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
7
|
-
import
|
|
6
|
+
import * as Hooks from "@dxos/react-ui/Hooks";
|
|
7
|
+
import * as Menu from "@dxos/react-ui/Menu";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Mosaic } from "@dxos/react-ui-mosaic";
|
|
10
|
+
import * as Button from "@dxos/react-ui/Button";
|
|
11
|
+
import * as ScrollArea from "@dxos/react-ui/ScrollArea";
|
|
12
|
+
import * as Util from "@dxos/react-ui/Util";
|
|
10
13
|
import { mx } from "@dxos/ui-theme";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
14
|
+
import * as Surface from "@dxos/app-framework/Surface";
|
|
15
|
+
import * as AppSurface from "@dxos/app-toolkit/AppSurface";
|
|
13
16
|
import { Doc } from "@dxos/echo-doc";
|
|
17
|
+
import { useResolveRef } from "@dxos/echo-react";
|
|
14
18
|
import { invariant } from "@dxos/invariant";
|
|
15
|
-
import
|
|
16
|
-
import { QueryEditor as QueryEditor$1 } from "@dxos/react-ui-components";
|
|
19
|
+
import * as TemplateEditor from "@dxos/plugin-routine/TemplateEditor";
|
|
17
20
|
import { Editor, useTextEditor } from "@dxos/react-ui-editor";
|
|
21
|
+
import { QueryEditor } from "@dxos/react-ui-query";
|
|
18
22
|
import { InputModeExtensions, createBasicExtensions, createDataExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown, defaultStyles } from "@dxos/ui-editor";
|
|
19
23
|
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
20
24
|
import { javascript } from "@codemirror/lang-javascript";
|
|
@@ -23,46 +27,65 @@ import { lintKeymap } from "@codemirror/lint";
|
|
|
23
27
|
import { Prec } from "@codemirror/state";
|
|
24
28
|
import { keymap } from "@codemirror/view";
|
|
25
29
|
import { tags } from "@lezer/highlight";
|
|
26
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
27
30
|
import { continueKeymap } from "@valtown/codemirror-continue";
|
|
28
31
|
import { tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from "@valtown/codemirror-ts";
|
|
32
|
+
import { composeRefs } from "@dxos/react-hooks";
|
|
29
33
|
import { Domino } from "@dxos/ui";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import * as Atom from "effect/unstable/reactivity/Atom";
|
|
33
|
-
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
34
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
35
|
+
import { ActionToolbar, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
34
36
|
import { createDeploy, createFormat, createTemplateSelect, useDeployDeps } from "#hooks";
|
|
35
37
|
import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
38
|
+
import * as Avatar from "@dxos/react-ui/Avatar";
|
|
39
|
+
import * as Field from "@dxos/react-ui/Field";
|
|
40
|
+
import * as Icon from "@dxos/react-ui/Icon";
|
|
41
|
+
import * as Input from "@dxos/react-ui/Input";
|
|
42
|
+
import * as Layout from "@dxos/react-ui/Layout";
|
|
43
|
+
import * as Toolbar from "@dxos/react-ui/Toolbar";
|
|
36
44
|
//#region src/components/NotebookStack/NotebookMenu.tsx
|
|
37
45
|
var NotebookMenu = ({ cell, onCellInsert, onCellDelete }) => {
|
|
38
|
-
const { t } = useTranslation(meta.profile.key);
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */ jsx(
|
|
46
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
47
|
+
return /* @__PURE__ */ jsxs(Menu.Content, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
41
49
|
onClick: () => onCellInsert?.("script", cell?.id),
|
|
42
|
-
|
|
50
|
+
item: {
|
|
51
|
+
value: t("notebook-cell-insert-script.label"),
|
|
52
|
+
label: t("notebook-cell-insert-script.label")
|
|
53
|
+
}
|
|
43
54
|
}),
|
|
44
|
-
/* @__PURE__ */ jsx(
|
|
55
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
45
56
|
onClick: () => onCellInsert?.("prompt", cell?.id),
|
|
46
|
-
|
|
57
|
+
item: {
|
|
58
|
+
value: t("notebook-cell-insert-prompt.label"),
|
|
59
|
+
label: t("notebook-cell-insert-prompt.label")
|
|
60
|
+
}
|
|
47
61
|
}),
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
62
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
49
63
|
onClick: () => onCellInsert?.("query", cell?.id),
|
|
50
|
-
|
|
64
|
+
item: {
|
|
65
|
+
value: t("notebook-cell-insert-query.label"),
|
|
66
|
+
label: t("notebook-cell-insert-query.label")
|
|
67
|
+
}
|
|
51
68
|
}),
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
69
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
53
70
|
onClick: () => onCellInsert?.("markdown", cell?.id),
|
|
54
|
-
|
|
71
|
+
item: {
|
|
72
|
+
value: t("notebook-cell-insert-markdown.label"),
|
|
73
|
+
label: t("notebook-cell-insert-markdown.label")
|
|
74
|
+
}
|
|
55
75
|
}),
|
|
56
|
-
cell && onCellDelete && /* @__PURE__ */ jsx(
|
|
76
|
+
cell && onCellDelete && /* @__PURE__ */ jsx(Menu.Item, {
|
|
57
77
|
onClick: () => onCellDelete?.(cell.id),
|
|
58
|
-
|
|
78
|
+
item: {
|
|
79
|
+
value: t("notebook-cell-delete.label"),
|
|
80
|
+
label: t("notebook-cell-delete.label")
|
|
81
|
+
}
|
|
59
82
|
})
|
|
60
|
-
] })
|
|
83
|
+
] });
|
|
61
84
|
};
|
|
62
85
|
//#endregion
|
|
63
86
|
//#region src/components/TypescriptEditor/TypescriptEditor.tsx
|
|
64
|
-
var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode = "vscode", env, options, initialValue, extensions, scrollTo, selection, ...props }, forwardedRef) => {
|
|
65
|
-
const
|
|
87
|
+
var TypescriptEditor = Util.composable(({ classNames, id, role = "article", inputMode = "vscode", env, options, initialValue, extensions, scrollTo, selection, ...props }, forwardedRef) => {
|
|
88
|
+
const themeMode = Hooks.useThemeMode();
|
|
66
89
|
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
67
90
|
id,
|
|
68
91
|
initialValue,
|
|
@@ -110,7 +133,7 @@ var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode
|
|
|
110
133
|
env
|
|
111
134
|
]);
|
|
112
135
|
return /* @__PURE__ */ jsx("div", {
|
|
113
|
-
...composableProps(props, {
|
|
136
|
+
...Util.composableProps(props, {
|
|
114
137
|
classNames,
|
|
115
138
|
...focusAttributes
|
|
116
139
|
}),
|
|
@@ -137,19 +160,21 @@ var __dxlog_file$1 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/componen
|
|
|
137
160
|
var editorStyles = "p-2 ps-3";
|
|
138
161
|
var valueStyles = "p-1 ps-3";
|
|
139
162
|
var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
140
|
-
const { t } = useTranslation(meta.profile.key);
|
|
163
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
164
|
+
const source = useResolveRef(cell.source);
|
|
165
|
+
const prompt = useResolveRef(cell.prompt);
|
|
166
|
+
const explorerGraph = useResolveRef(cell.graph);
|
|
141
167
|
const extensions = useMemo(() => {
|
|
142
|
-
return
|
|
168
|
+
return source ? [createDataExtensions({
|
|
143
169
|
id: cell.id,
|
|
144
|
-
text: Doc.createAccessor(
|
|
170
|
+
text: Doc.createAccessor(source, ["content"])
|
|
145
171
|
})] : [];
|
|
146
|
-
}, [
|
|
147
|
-
const explorerGraph = cell.graph?.target;
|
|
172
|
+
}, [source]);
|
|
148
173
|
const handleQueryChange = useCallback((value) => {
|
|
149
174
|
invariant(cell.source?.target, void 0, {
|
|
150
175
|
"~LogMeta": "~LogMeta",
|
|
151
176
|
F: __dxlog_file$1,
|
|
152
|
-
L:
|
|
177
|
+
L: 60,
|
|
153
178
|
S: void 0,
|
|
154
179
|
A: ["cell.source?.target", ""]
|
|
155
180
|
});
|
|
@@ -159,22 +184,22 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
159
184
|
}, [cell]);
|
|
160
185
|
switch (cell.type) {
|
|
161
186
|
case "markdown":
|
|
162
|
-
if (!
|
|
187
|
+
if (!source) return null;
|
|
163
188
|
return /* @__PURE__ */ jsx(NotebookTextEditor, {
|
|
164
189
|
id: cell.id,
|
|
165
190
|
classNames: editorStyles,
|
|
166
|
-
initialValue:
|
|
191
|
+
initialValue: source.content,
|
|
167
192
|
extensions
|
|
168
193
|
});
|
|
169
194
|
case "script":
|
|
170
|
-
if (!
|
|
195
|
+
if (!source) return null;
|
|
171
196
|
return /* @__PURE__ */ jsxs("div", {
|
|
172
|
-
className: "flex flex-col divide-y divide-
|
|
197
|
+
className: "flex flex-col divide-y divide-separator-subtle",
|
|
173
198
|
children: [/* @__PURE__ */ jsx(TypescriptEditor, {
|
|
174
199
|
id: cell.id,
|
|
175
200
|
role: "section",
|
|
176
201
|
classNames: editorStyles,
|
|
177
|
-
initialValue:
|
|
202
|
+
initialValue: source.content,
|
|
178
203
|
extensions,
|
|
179
204
|
env,
|
|
180
205
|
options: {
|
|
@@ -188,14 +213,14 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
188
213
|
})]
|
|
189
214
|
});
|
|
190
215
|
case "query":
|
|
191
|
-
if (!
|
|
216
|
+
if (!source) return null;
|
|
192
217
|
return /* @__PURE__ */ jsxs("div", {
|
|
193
218
|
className: mx("h-full overflow-hidden grid", explorerGraph && !dragging && "grid-rows-[min-content_1fr]"),
|
|
194
|
-
children: [/* @__PURE__ */ jsx(QueryEditor
|
|
219
|
+
children: [/* @__PURE__ */ jsx(QueryEditor, {
|
|
195
220
|
id: cell.id,
|
|
196
221
|
classNames: editorStyles,
|
|
197
222
|
db,
|
|
198
|
-
value:
|
|
223
|
+
value: source.content,
|
|
199
224
|
onChange: handleQueryChange
|
|
200
225
|
}), explorerGraph && !dragging && /* @__PURE__ */ jsx(Surface.Surface, {
|
|
201
226
|
type: AppSurface.Section,
|
|
@@ -207,10 +232,10 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
207
232
|
})]
|
|
208
233
|
});
|
|
209
234
|
case "prompt":
|
|
210
|
-
if (!
|
|
211
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TemplateEditor, {
|
|
235
|
+
if (!prompt) return null;
|
|
236
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TemplateEditor.TemplateEditor, {
|
|
212
237
|
id: cell.id,
|
|
213
|
-
source:
|
|
238
|
+
source: prompt.text,
|
|
214
239
|
lineNumbers: false,
|
|
215
240
|
classNames: editorStyles
|
|
216
241
|
}), /* @__PURE__ */ jsx(NotebookPromptResult, {
|
|
@@ -225,12 +250,12 @@ var NotebookCellValue = ({ cell, graph }) => {
|
|
|
225
250
|
const value = graph?.getValue(cell.id);
|
|
226
251
|
if (value == null) return null;
|
|
227
252
|
return /* @__PURE__ */ jsxs("div", {
|
|
228
|
-
className: mx("flex w-full bg-group-surface text-
|
|
253
|
+
className: mx("flex w-full bg-group-surface text-fg-muted font-mono", valueStyles),
|
|
229
254
|
children: [name && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
230
255
|
className: "text-success-text",
|
|
231
256
|
children: name
|
|
232
257
|
}), /* @__PURE__ */ jsx("span", {
|
|
233
|
-
className: "text-
|
|
258
|
+
className: "text-fg-muted",
|
|
234
259
|
children: "\xA0=\xA0"
|
|
235
260
|
})] }), /* @__PURE__ */ jsx("span", { children: value })]
|
|
236
261
|
});
|
|
@@ -240,7 +265,7 @@ var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
|
240
265
|
const value = promptResults?.[cell.prompt.uri];
|
|
241
266
|
if (value == null) return null;
|
|
242
267
|
return /* @__PURE__ */ jsx("div", {
|
|
243
|
-
className: mx("flex w-full dx-group-surface text-
|
|
268
|
+
className: mx("flex w-full dx-group-surface text-fg-muted border-y border-separator-subtle", valueStyles),
|
|
244
269
|
children: /* @__PURE__ */ jsx(NotebookTextEditor, {
|
|
245
270
|
readOnly: true,
|
|
246
271
|
value
|
|
@@ -248,8 +273,8 @@ var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
|
248
273
|
});
|
|
249
274
|
};
|
|
250
275
|
var NotebookTextEditor = ({ classNames, extensions: extensionsProp, readOnly, ...props }) => {
|
|
251
|
-
const { t } = useTranslation(meta.profile.key);
|
|
252
|
-
const
|
|
276
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
277
|
+
const themeMode = Hooks.useThemeMode();
|
|
253
278
|
const extensions = useMemo(() => {
|
|
254
279
|
return [
|
|
255
280
|
createThemeExtensions({
|
|
@@ -281,7 +306,7 @@ var NotebookTextEditor = ({ classNames, extensions: extensionsProp, readOnly, ..
|
|
|
281
306
|
//#region src/components/NotebookStack/NotebookStack.tsx
|
|
282
307
|
var minSectionHeight = "min-h-[16rem]";
|
|
283
308
|
var getCellId = (cell) => cell.id;
|
|
284
|
-
var NotebookStack = composable(({ notebook, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {
|
|
309
|
+
var NotebookStack = Util.composable(({ notebook, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {
|
|
285
310
|
const [viewport, setViewport] = useState(null);
|
|
286
311
|
const Tile = useCallback((tileProps) => /* @__PURE__ */ jsx(NotebookSection, {
|
|
287
312
|
...tileProps,
|
|
@@ -322,8 +347,7 @@ var NotebookStack = composable(({ notebook, db, graph, promptResults, onCellInse
|
|
|
322
347
|
ref: forwardedRef,
|
|
323
348
|
children: /* @__PURE__ */ jsx(ScrollArea.Root, {
|
|
324
349
|
orientation: "vertical",
|
|
325
|
-
|
|
326
|
-
...composableProps(props),
|
|
350
|
+
...Util.composableProps(props),
|
|
327
351
|
children: /* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
328
352
|
ref: setViewport,
|
|
329
353
|
children: /* @__PURE__ */ jsx(Mosaic.Stack, {
|
|
@@ -337,25 +361,25 @@ var NotebookStack = composable(({ notebook, db, graph, promptResults, onCellInse
|
|
|
337
361
|
});
|
|
338
362
|
});
|
|
339
363
|
var NotebookSection = ({ data: cell, db, env, graph, promptResults, onCellInsert, onCellDelete, ...tileProps }) => {
|
|
340
|
-
const { t } = useTranslation(meta.profile.key);
|
|
364
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
341
365
|
const resizable = cell.type === "query";
|
|
342
366
|
const [dragHandle, setDragHandle] = useState(null);
|
|
343
367
|
return /* @__PURE__ */ jsxs(Mosaic.Tile, {
|
|
344
368
|
...tileProps,
|
|
345
369
|
data: cell,
|
|
346
370
|
dragHandle,
|
|
347
|
-
classNames: mx("grid grid-cols-[min-content_1fr] overflow-visible border border-
|
|
371
|
+
classNames: mx("grid grid-cols-[min-content_1fr] overflow-visible border border-separator-subtle", resizable && minSectionHeight),
|
|
348
372
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
349
|
-
className: "flex flex-col p-1 border-e border-
|
|
350
|
-
children: [/* @__PURE__ */ jsx(
|
|
373
|
+
className: "flex flex-col p-1 border-e border-separator-subtle dx-attention-surface",
|
|
374
|
+
children: [/* @__PURE__ */ jsx(Button.Root, {
|
|
351
375
|
ref: setDragHandle,
|
|
352
376
|
variant: "ghost",
|
|
353
377
|
icon: "ph--dots-six-vertical--regular",
|
|
354
378
|
iconOnly: true,
|
|
355
379
|
label: "Drag handle"
|
|
356
|
-
}), /* @__PURE__ */ jsxs(
|
|
380
|
+
}), /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
357
381
|
asChild: true,
|
|
358
|
-
children: /* @__PURE__ */ jsx(
|
|
382
|
+
children: /* @__PURE__ */ jsx(Button.Root, {
|
|
359
383
|
variant: "ghost",
|
|
360
384
|
icon: "ph--dots-three--regular",
|
|
361
385
|
iconOnly: true,
|
|
@@ -376,41 +400,9 @@ var NotebookSection = ({ data: cell, db, env, graph, promptResults, onCellInsert
|
|
|
376
400
|
});
|
|
377
401
|
};
|
|
378
402
|
//#endregion
|
|
379
|
-
//#region src/components/QueryEditor/QueryEditor.tsx
|
|
380
|
-
var GLOBALS = `
|
|
381
|
-
namespace QueryAPI {
|
|
382
|
-
${queryApi}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
declare global {
|
|
386
|
-
const Query: typeof QueryAPI.Query;
|
|
387
|
-
const Filter: typeof QueryAPI.Filter;
|
|
388
|
-
const Order: typeof QueryAPI.Order;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export {};
|
|
392
|
-
`;
|
|
393
|
-
var QueryEditor = (props) => {
|
|
394
|
-
const [compiler, setCompiler] = useState();
|
|
395
|
-
useAsyncEffect(async () => {
|
|
396
|
-
const compiler = new Compiler({
|
|
397
|
-
lib: ["ES5"],
|
|
398
|
-
target: ScriptTarget.ES2022,
|
|
399
|
-
moduleResolution: ModuleResolutionKind.Bundler
|
|
400
|
-
});
|
|
401
|
-
await compiler.initialize(GLOBALS);
|
|
402
|
-
setCompiler(compiler);
|
|
403
|
-
}, []);
|
|
404
|
-
if (!compiler) return null;
|
|
405
|
-
return /* @__PURE__ */ jsx(TypescriptEditor, {
|
|
406
|
-
...props,
|
|
407
|
-
env: compiler.environment
|
|
408
|
-
});
|
|
409
|
-
};
|
|
410
|
-
//#endregion
|
|
411
403
|
//#region src/components/ScriptToolbar/ScriptToolbar.tsx
|
|
412
|
-
var ScriptToolbar = composable(({ script, attendableId, role, state, ...props }, forwardedRef) => {
|
|
413
|
-
const { t } = useTranslation(meta.profile.key);
|
|
404
|
+
var ScriptToolbar = Util.composable(({ script, attendableId, role, state, ...props }, forwardedRef) => {
|
|
405
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
414
406
|
const options = useDeployDeps({ script });
|
|
415
407
|
const menuCreator = useMemo(() => createToolbarActions({
|
|
416
408
|
state,
|
|
@@ -424,17 +416,11 @@ var ScriptToolbar = composable(({ script, attendableId, role, state, ...props },
|
|
|
424
416
|
t
|
|
425
417
|
]);
|
|
426
418
|
const menuActions = useMenuActions(menuCreator);
|
|
427
|
-
return /* @__PURE__ */ jsx(
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
children: /* @__PURE__ */ jsx(Menu.Toolbar, {
|
|
433
|
-
...composableProps(props),
|
|
434
|
-
ref: forwardedRef,
|
|
435
|
-
children: /* @__PURE__ */ jsx(Menu.Items, {})
|
|
436
|
-
})
|
|
437
|
-
})
|
|
419
|
+
return /* @__PURE__ */ jsx(ActionToolbar, {
|
|
420
|
+
...menuActions,
|
|
421
|
+
attendableId,
|
|
422
|
+
...Util.composableProps(props),
|
|
423
|
+
ref: forwardedRef
|
|
438
424
|
});
|
|
439
425
|
});
|
|
440
426
|
var createToolbarActions = ({ state, script, ...options }) => Atom.make((get) => {
|
|
@@ -465,8 +451,8 @@ var createToolbarActions = ({ state, script, ...options }) => Atom.make((get) =>
|
|
|
465
451
|
//#endregion
|
|
466
452
|
//#region src/components/TestPanel/TestPanel.tsx
|
|
467
453
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
468
|
-
var TestPanel = composable(({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
469
|
-
const { t } = useTranslation(meta.profile.key);
|
|
454
|
+
var TestPanel = Util.composable(({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
455
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
470
456
|
const inputRef = useRef(null);
|
|
471
457
|
const [input, setInput] = useState("");
|
|
472
458
|
const [state, setState] = useState(null);
|
|
@@ -522,20 +508,20 @@ var TestPanel = composable(({ classNames, onInvoke, ...props }, forwardedRef) =>
|
|
|
522
508
|
log.catch(err, void 0, {
|
|
523
509
|
"~LogMeta": "~LogMeta",
|
|
524
510
|
F: __dxlog_file,
|
|
525
|
-
L:
|
|
511
|
+
L: 113,
|
|
526
512
|
S: void 0
|
|
527
513
|
});
|
|
528
514
|
}
|
|
529
515
|
};
|
|
530
516
|
return /* @__PURE__ */ jsxs("div", {
|
|
531
|
-
...composableProps(props, { classNames: ["flex flex-col h-full overflow-hidden", classNames] }),
|
|
517
|
+
...Util.composableProps(props, { classNames: ["flex flex-col h-full overflow-hidden", classNames] }),
|
|
532
518
|
ref: forwardedRef,
|
|
533
519
|
children: [/* @__PURE__ */ jsx(MessageThread, {
|
|
534
520
|
ref: scrollerRef,
|
|
535
521
|
state,
|
|
536
522
|
history
|
|
537
523
|
}), /* @__PURE__ */ jsxs(Toolbar.Root, { children: [
|
|
538
|
-
/* @__PURE__ */ jsx(
|
|
524
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Input.Root, {
|
|
539
525
|
ref: inputRef,
|
|
540
526
|
autoFocus: true,
|
|
541
527
|
placeholder: t("function-request.placeholder"),
|
|
@@ -543,13 +529,13 @@ var TestPanel = composable(({ classNames, onInvoke, ...props }, forwardedRef) =>
|
|
|
543
529
|
onChange: (ev) => setInput(ev.target.value),
|
|
544
530
|
onKeyDown: (ev) => ev.key === "Enter" && handleRequest(input)
|
|
545
531
|
}) }),
|
|
546
|
-
/* @__PURE__ */ jsx(
|
|
532
|
+
/* @__PURE__ */ jsx(Button.Root, {
|
|
547
533
|
icon: "ph--play--regular",
|
|
548
534
|
label: "Execute",
|
|
549
535
|
iconOnly: true,
|
|
550
536
|
onClick: () => handleRequest(input)
|
|
551
537
|
}),
|
|
552
|
-
/* @__PURE__ */ jsx(
|
|
538
|
+
/* @__PURE__ */ jsx(Button.Root, {
|
|
553
539
|
icon: "ph--trash--regular",
|
|
554
540
|
label: "Clear",
|
|
555
541
|
iconOnly: true,
|
|
@@ -558,6 +544,11 @@ var TestPanel = composable(({ classNames, onInvoke, ...props }, forwardedRef) =>
|
|
|
558
544
|
] })]
|
|
559
545
|
});
|
|
560
546
|
});
|
|
547
|
+
var MESSAGE_COLS = [
|
|
548
|
+
"var(--dx-rail-item)",
|
|
549
|
+
"fill",
|
|
550
|
+
"var(--dx-rail-item)"
|
|
551
|
+
];
|
|
561
552
|
var MessageThread = forwardRef(({ state, history }, forwardedRef) => {
|
|
562
553
|
return /* @__PURE__ */ jsx(ScrollArea.Root, {
|
|
563
554
|
orientation: "vertical",
|
|
@@ -565,8 +556,8 @@ var MessageThread = forwardRef(({ state, history }, forwardedRef) => {
|
|
|
565
556
|
ref: forwardedRef,
|
|
566
557
|
children: /* @__PURE__ */ jsxs(ScrollArea.Viewport, {
|
|
567
558
|
classNames: "gap-6 p-2",
|
|
568
|
-
children: [history.map((message, i) => /* @__PURE__ */ jsxs(
|
|
569
|
-
|
|
559
|
+
children: [history.map((message, i) => /* @__PURE__ */ jsxs(Layout.Grid, {
|
|
560
|
+
cols: MESSAGE_COLS,
|
|
570
561
|
children: [/* @__PURE__ */ jsx("div", {
|
|
571
562
|
className: "p-1",
|
|
572
563
|
children: message.type === "response" && /* @__PURE__ */ jsx(RobotAvatar, {})
|
|
@@ -574,14 +565,14 @@ var MessageThread = forwardRef(({ state, history }, forwardedRef) => {
|
|
|
574
565
|
className: "overflow-auto",
|
|
575
566
|
children: /* @__PURE__ */ jsx(MessageItem, { message })
|
|
576
567
|
})]
|
|
577
|
-
}, i)), state === "pending" && /* @__PURE__ */ jsx(
|
|
578
|
-
|
|
568
|
+
}, i)), state === "pending" && /* @__PURE__ */ jsx(Layout.Grid, {
|
|
569
|
+
cols: MESSAGE_COLS,
|
|
579
570
|
children: /* @__PURE__ */ jsx("div", {
|
|
580
571
|
className: "p-1",
|
|
581
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
572
|
+
children: /* @__PURE__ */ jsx(Icon.Icon, {
|
|
582
573
|
icon: "ph--spinner--regular",
|
|
583
|
-
size:
|
|
584
|
-
|
|
574
|
+
size: "xl",
|
|
575
|
+
spin: true
|
|
585
576
|
})
|
|
586
577
|
})
|
|
587
578
|
})]
|
|
@@ -590,7 +581,7 @@ var MessageThread = forwardRef(({ state, history }, forwardedRef) => {
|
|
|
590
581
|
});
|
|
591
582
|
var MessageItem = ({ classNames, message }) => {
|
|
592
583
|
const { type, text, data, error } = message;
|
|
593
|
-
const wrapper = "p-1 px-2 rounded-md bg-hover-surface
|
|
584
|
+
const wrapper = "p-1 px-2 rounded-md bg-hover-surface";
|
|
594
585
|
return /* @__PURE__ */ jsxs("div", {
|
|
595
586
|
className: mx("flex", type === "request" ? "ml-[1rem] justify-end" : "mr-[1rem]", classNames),
|
|
596
587
|
children: [
|
|
@@ -609,12 +600,12 @@ var MessageItem = ({ classNames, message }) => {
|
|
|
609
600
|
]
|
|
610
601
|
});
|
|
611
602
|
};
|
|
612
|
-
var RobotAvatar = () => /* @__PURE__ */ jsx(Avatar.Root, {
|
|
613
|
-
size:
|
|
603
|
+
var RobotAvatar = () => /* @__PURE__ */ jsx(Avatar.Root, {
|
|
604
|
+
size: "sm",
|
|
614
605
|
variant: "circle",
|
|
615
606
|
icon: "ph--drone--regular"
|
|
616
|
-
})
|
|
607
|
+
});
|
|
617
608
|
//#endregion
|
|
618
|
-
export { NotebookMenu, NotebookStack,
|
|
609
|
+
export { NotebookMenu, NotebookStack, ScriptToolbar, TestPanel, TypescriptEditor };
|
|
619
610
|
|
|
620
611
|
//# sourceMappingURL=components.mjs.map
|