@dxos/plugin-script 0.8.4-main.3fbcb4aa9b → 0.8.4-main.43cb759274
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/LICENSE +102 -5
- package/PLUGIN.mdl +515 -0
- package/dist/lib/neutral/{DeploymentDialog-6DBF3V6C.mjs → DeploymentDialog-M3AFYQHC.mjs} +4 -2
- package/dist/lib/neutral/{DeploymentDialog-6DBF3V6C.mjs.map → DeploymentDialog-M3AFYQHC.mjs.map} +3 -3
- package/dist/lib/neutral/{NotebookContainer-FIAQI3A2.mjs → NotebookArticle-NV4AHOOS.mjs} +15 -12
- package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +7 -0
- package/dist/lib/neutral/{ScriptContainer-2OPBAXFB.mjs → ScriptArticle-UBT27SB6.mjs} +4 -4
- package/dist/lib/neutral/{ScriptContainer-2OPBAXFB.mjs.map → ScriptArticle-UBT27SB6.mjs.map} +4 -4
- package/dist/lib/neutral/ScriptPlugin.mjs +12 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +4 -4
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/{ScriptProperties-F6NE6M4H.mjs → ScriptProperties-RLXNAN3N.mjs} +9 -8
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/neutral/{TestContainer-JNFPLAJX.mjs → TestContainer-AFVTBYSJ.mjs} +5 -5
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +3 -3
- package/dist/lib/neutral/capabilities/index.mjs +4 -4
- package/dist/lib/neutral/capabilities/node.mjs +3 -3
- package/dist/lib/neutral/{chunk-D7DFASAE.mjs → chunk-2REUEDUA.mjs} +8 -4
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-BDRB6ZX2.mjs → chunk-BDHDBPVM.mjs} +2 -2
- package/dist/lib/neutral/{chunk-PDB6UOSB.mjs → chunk-C4O7EV6M.mjs} +11 -13
- package/dist/lib/neutral/chunk-C4O7EV6M.mjs.map +7 -0
- package/dist/lib/neutral/chunk-H2BRWQMY.mjs +96 -0
- package/dist/lib/neutral/chunk-H2BRWQMY.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-B4FVQEHV.mjs → chunk-LHEJXJEL.mjs} +2 -2
- package/dist/lib/neutral/{chunk-B4FVQEHV.mjs.map → chunk-LHEJXJEL.mjs.map} +2 -2
- package/dist/lib/neutral/chunk-NQOIENTU.mjs +8 -0
- package/dist/lib/neutral/{chunk-MI6X5CTJ.mjs → chunk-TRKXIP2Q.mjs} +30 -21
- package/dist/lib/neutral/chunk-TRKXIP2Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs +38 -0
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-4RJALG6K.mjs → chunk-VXDJH6OL.mjs} +9 -10
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/neutral/{compiler-SMVIP5UN.mjs → compiler-ODK4UA2N.mjs} +2 -2
- package/dist/lib/neutral/components/index.mjs +93 -148
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +7 -7
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/{create-OZRIZ7RN.mjs → create-WQJXMOUE.mjs} +7 -5
- package/dist/lib/neutral/create-WQJXMOUE.mjs.map +7 -0
- package/dist/lib/neutral/{create-object-F2NWICFV.mjs → create-object-FZM5ASWM.mjs} +4 -3
- package/dist/lib/neutral/create-object-FZM5ASWM.mjs.map +7 -0
- package/dist/lib/neutral/{create-script-VBA3SLSU.mjs → create-script-66DO3UJO.mjs} +3 -3
- package/dist/lib/neutral/{delete-PAUWA2QM.mjs → delete-HCQIQFVP.mjs} +2 -2
- package/dist/lib/neutral/{deploy-CXVW54JJ.mjs → deploy-7JVMMHSH.mjs} +6 -5
- package/dist/lib/neutral/{deploy-CXVW54JJ.mjs.map → deploy-7JVMMHSH.mjs.map} +3 -3
- package/dist/lib/neutral/hooks/index.mjs +2 -2
- package/dist/lib/neutral/index.mjs +7 -7
- package/dist/lib/neutral/{inspect-invocations-LEOEP5I2.mjs → inspect-invocations-6MW73SDV.mjs} +3 -3
- package/dist/lib/neutral/{inspect-invocations-LEOEP5I2.mjs.map → inspect-invocations-6MW73SDV.mjs.map} +3 -3
- package/dist/lib/neutral/{install-function-5N24Q45W.mjs → install-function-FJIE2JAI.mjs} +7 -9
- package/dist/lib/neutral/install-function-FJIE2JAI.mjs.map +7 -0
- package/dist/lib/neutral/{invoke-5QVEZ3X5.mjs → invoke-3HVWY2KF.mjs} +7 -8
- package/dist/lib/neutral/invoke-3HVWY2KF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{operation-handler-OTCWYDFI.mjs → operation-handler-X44IGZXS.mjs} +3 -3
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{query-deployed-functions-FVD7NYPA.mjs → query-deployed-functions-F4FHJNWO.mjs} +14 -10
- package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs.map +7 -0
- package/dist/lib/neutral/{react-surface-JH2AOK7V.mjs → react-surface-ACNZ35FV.mjs} +17 -13
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs.map +7 -0
- package/dist/lib/neutral/{read-FFOSK6A3.mjs → read-RQESBAQI.mjs} +2 -2
- package/dist/lib/neutral/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +3 -2
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +2 -2
- package/dist/lib/neutral/{update-PJS5GG3Y.mjs → update-JZUNJYZM.mjs} +3 -3
- package/dist/lib/neutral/{update-PJS5GG3Y.mjs.map → update-JZUNJYZM.mjs.map} +3 -3
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.workerd.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/definitions.d.ts +24 -30
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/delete.d.ts +4 -5
- package/dist/types/src/blueprints/functions/deploy.d.ts +4 -5
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +4 -5
- package/dist/types/src/blueprints/functions/invoke.d.ts +5 -6
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/read.d.ts +4 -5
- package/dist/types/src/blueprints/functions/update.d.ts +4 -5
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -1
- package/dist/types/src/constants.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
- package/dist/types/src/containers/{ScriptContainer → NotebookArticle}/index.d.ts.map +1 -1
- package/dist/types/src/containers/{ScriptContainer/ScriptContainer.d.ts → ScriptArticle/ScriptArticle.d.ts} +2 -2
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/{ScriptContainer/ScriptContainer.stories.d.ts → ScriptArticle/ScriptArticle.stories.d.ts} +1 -1
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +5 -6
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +4 -2
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +6 -4
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +0 -5
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-script.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +28 -47
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptOperation.d.ts +6 -6
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +90 -90
- package/src/ScriptPlugin.tsx +6 -0
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +3 -3
- package/src/blueprints/functions/definitions.ts +20 -11
- package/src/blueprints/functions/deploy.ts +3 -2
- package/src/blueprints/functions/inspect-invocations.ts +1 -1
- package/src/blueprints/functions/install-function.ts +5 -5
- package/src/blueprints/functions/invoke.ts +4 -5
- package/src/blueprints/functions/query-deployed-functions.ts +11 -7
- package/src/blueprints/functions/update.ts +1 -1
- package/src/capabilities/create-object.ts +3 -2
- package/src/capabilities/react-surface.tsx +6 -6
- package/src/compiler/compiler.ts +4 -0
- package/src/components/NotebookStack/NotebookCell.tsx +2 -2
- package/src/components/NotebookStack/NotebookStack.stories.tsx +2 -2
- package/src/components/NotebookStack/NotebookStack.tsx +1 -1
- package/src/components/QueryEditor/QueryEditor.tsx +3 -1
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +3 -3
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +1 -1
- package/src/components/TestPanel/TestPanel.tsx +2 -1
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/constants.ts +3 -1
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +3 -3
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +1 -1
- package/src/containers/{NotebookContainer/NotebookContainer.stories.tsx → NotebookArticle/NotebookArticle.stories.tsx} +10 -10
- package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +10 -9
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/{ScriptContainer/ScriptContainer.stories.tsx → ScriptArticle/ScriptArticle.stories.tsx} +6 -5
- package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +1 -1
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +8 -7
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +3 -2
- package/src/containers/TestContainer/TestContainer.tsx +4 -4
- package/src/containers/index.ts +2 -2
- package/src/meta.ts +13 -7
- package/src/operations/index.ts +1 -4
- package/src/templates/anthropic.ts +2 -1
- package/src/templates/chess-bot.ts +2 -2
- package/src/templates/commentary.ts +19 -17
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/discord.ts +5 -5
- package/src/templates/forex-effect.ts +2 -1
- package/src/templates/forex.ts +2 -1
- package/src/templates/gmail.ts +5 -5
- package/src/templates/index.ts +0 -7
- package/src/templates/ping.ts +2 -1
- package/src/testing/test-notebook.ts +2 -2
- package/src/testing/test-script.ts +1 -2
- package/src/translations.ts +3 -2
- package/src/types/Notebook.ts +5 -11
- package/src/types/ScriptOperation.ts +4 -4
- package/src/util/deploy.ts +1 -1
- package/src/util/functions.ts +4 -4
- package/src/vite-env.d.ts +5 -0
- package/dist/lib/neutral/NotebookContainer-FIAQI3A2.mjs.map +0 -7
- package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs.map +0 -7
- package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs.map +0 -7
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs +0 -34
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs.map +0 -7
- package/dist/lib/neutral/chunk-2DMPFVUM.mjs +0 -8
- package/dist/lib/neutral/chunk-4RJALG6K.mjs.map +0 -7
- package/dist/lib/neutral/chunk-BUKQITZT.mjs +0 -105
- package/dist/lib/neutral/chunk-BUKQITZT.mjs.map +0 -7
- package/dist/lib/neutral/chunk-D7DFASAE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-P2F3STZN.mjs +0 -8
- package/dist/lib/neutral/chunk-P2F3STZN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-PDB6UOSB.mjs.map +0 -7
- package/dist/lib/neutral/chunk-UYR3YH4Q.mjs +0 -31
- package/dist/lib/neutral/chunk-UYR3YH4Q.mjs.map +0 -7
- package/dist/lib/neutral/create-OZRIZ7RN.mjs.map +0 -7
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +0 -7
- package/dist/lib/neutral/install-function-5N24Q45W.mjs.map +0 -7
- package/dist/lib/neutral/invoke-5QVEZ3X5.mjs.map +0 -7
- package/dist/lib/neutral/query-deployed-functions-FVD7NYPA.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-JH2AOK7V.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -12
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/components/FramePanel/FramePanel.d.ts +0 -12
- package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +0 -1
- package/dist/types/src/components/FramePanel/index.d.ts +0 -2
- package/dist/types/src/components/FramePanel/index.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/index.d.ts +0 -2
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -2
- package/dist/types/src/operations/access-token-created.d.ts +0 -5
- package/dist/types/src/operations/access-token-created.d.ts.map +0 -1
- package/dist/types/src/templates/chat.d.ts +0 -6
- package/dist/types/src/templates/chat.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -226
- package/src/components/FramePanel/FramePanel.tsx +0 -85
- package/src/components/FramePanel/index.ts +0 -5
- package/src/containers/NotebookContainer/index.ts +0 -5
- package/src/containers/ScriptContainer/index.ts +0 -5
- package/src/operations/access-token-created.ts +0 -37
- package/src/templates/chat.ts +0 -96
- /package/dist/lib/neutral/{chunk-BDRB6ZX2.mjs.map → chunk-BDHDBPVM.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-2DMPFVUM.mjs.map → chunk-NQOIENTU.mjs.map} +0 -0
- /package/dist/lib/neutral/{compiler-SMVIP5UN.mjs.map → compiler-ODK4UA2N.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-script-VBA3SLSU.mjs.map → create-script-66DO3UJO.mjs.map} +0 -0
- /package/dist/lib/neutral/{delete-PAUWA2QM.mjs.map → delete-HCQIQFVP.mjs.map} +0 -0
- /package/dist/lib/neutral/{operation-handler-OTCWYDFI.mjs.map → operation-handler-X44IGZXS.mjs.map} +0 -0
- /package/dist/lib/neutral/{read-FFOSK6A3.mjs.map → read-RQESBAQI.mjs.map} +0 -0
|
@@ -1,107 +1,50 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Compiler
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2REUEDUA.mjs";
|
|
4
4
|
import "../chunk-J5LGTIGS.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/index.ts
|
|
7
7
|
import { lazy } from "react";
|
|
8
8
|
|
|
9
|
-
// src/components/FramePanel/FramePanel.tsx
|
|
10
|
-
import React, { useEffect, useRef } from "react";
|
|
11
|
-
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
12
|
-
import { invariant } from "@dxos/invariant";
|
|
13
|
-
import { log } from "@dxos/log";
|
|
14
|
-
import { useClient } from "@dxos/react-client";
|
|
15
|
-
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
16
|
-
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
17
|
-
import { mx } from "@dxos/ui-theme";
|
|
18
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/FramePanel/FramePanel.tsx";
|
|
19
|
-
var FramePanel = ({ containerUrl, result, debug = true }) => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const iframeRef = useRef(null);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (iframeRef.current) {
|
|
24
|
-
const rpc = createProtoRpcPeer({
|
|
25
|
-
exposed: clientServiceBundle,
|
|
26
|
-
handlers: client._services.services,
|
|
27
|
-
port: createIFramePort({
|
|
28
|
-
channel: "frame",
|
|
29
|
-
iframe: iframeRef.current,
|
|
30
|
-
origin: "*"
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
rpc.open().catch((e) => log.catch(e, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 29, S: void 0 }));
|
|
34
|
-
return () => {
|
|
35
|
-
rpc.close().catch((e) => log.catch(e, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 31, S: void 0 }));
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}, [
|
|
39
|
-
iframeRef
|
|
40
|
-
]);
|
|
41
|
-
invariant(result.sourceHash, "Source hash is required.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 38, S: void 0, A: ["result.sourceHash", "'Source hash is required.'"] });
|
|
42
|
-
const sourceHash = Buffer.from(result.sourceHash).toString("hex");
|
|
43
|
-
const src = "bundle" in result ? `${containerUrl}?ts=${sourceHash}#code=${encodeURIComponent(new TextDecoder().decode(Object.values(result.bundle)[0]))}` : void 0;
|
|
44
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("iframe", {
|
|
45
|
-
ref: iframeRef,
|
|
46
|
-
sandbox: "allow-scripts",
|
|
47
|
-
src,
|
|
48
|
-
style: {
|
|
49
|
-
width: "100%",
|
|
50
|
-
height: "100%"
|
|
51
|
-
}
|
|
52
|
-
}), debug && /* @__PURE__ */ React.createElement("div", {
|
|
53
|
-
className: "relative"
|
|
54
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
55
|
-
className: mx("flex absolute right-2 bottom-2 w-[30rem] h-[200px] bg-base-surface ring rounded-sm", "z-20 overflow-x-hidden overflow-y-auto")
|
|
56
|
-
}, /* @__PURE__ */ React.createElement("pre", {
|
|
57
|
-
className: "text-xs whitespace-break-spaces break-all p-2"
|
|
58
|
-
}, JSON.stringify({
|
|
59
|
-
timestamp: result.timestamp,
|
|
60
|
-
sourceHash,
|
|
61
|
-
error: "error" in result ? result.error : void 0,
|
|
62
|
-
src
|
|
63
|
-
}, void 0, 2)))));
|
|
64
|
-
};
|
|
65
|
-
|
|
66
9
|
// src/components/NotebookStack/NotebookMenu.tsx
|
|
67
|
-
import
|
|
10
|
+
import React from "react";
|
|
68
11
|
import { DropdownMenu, useTranslation } from "@dxos/react-ui";
|
|
69
12
|
import { meta } from "#meta";
|
|
70
13
|
var NotebookMenu = ({ cell, onCellInsert, onCellDelete }) => {
|
|
71
14
|
const { t } = useTranslation(meta.id);
|
|
72
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
73
16
|
onClick: () => onCellInsert?.("script", cell?.id)
|
|
74
|
-
}, t("notebook-cell-insert-script.label")), /* @__PURE__ */
|
|
17
|
+
}, t("notebook-cell-insert-script.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
75
18
|
onClick: () => onCellInsert?.("prompt", cell?.id)
|
|
76
|
-
}, t("notebook-cell-insert-prompt.label")), /* @__PURE__ */
|
|
19
|
+
}, t("notebook-cell-insert-prompt.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
77
20
|
onClick: () => onCellInsert?.("query", cell?.id)
|
|
78
|
-
}, t("notebook-cell-insert-query.label")), /* @__PURE__ */
|
|
21
|
+
}, t("notebook-cell-insert-query.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
79
22
|
onClick: () => onCellInsert?.("markdown", cell?.id)
|
|
80
|
-
}, t("notebook-cell-insert-markdown.label")), cell && onCellDelete && /* @__PURE__ */
|
|
23
|
+
}, t("notebook-cell-insert-markdown.label")), cell && onCellDelete && /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
81
24
|
onClick: () => onCellDelete?.(cell.id)
|
|
82
|
-
}, t("notebook-cell-delete.label"))), /* @__PURE__ */
|
|
25
|
+
}, t("notebook-cell-delete.label"))), /* @__PURE__ */ React.createElement(DropdownMenu.Arrow, null)));
|
|
83
26
|
};
|
|
84
27
|
|
|
85
28
|
// src/components/NotebookStack/NotebookStack.tsx
|
|
86
|
-
import
|
|
29
|
+
import React4 from "react";
|
|
87
30
|
import { DropdownMenu as DropdownMenu2, IconButton, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
31
|
+
import { composable as composable2, composableProps as composableProps2 } from "@dxos/react-ui";
|
|
88
32
|
import { Stack, StackItem } from "@dxos/react-ui-stack";
|
|
89
|
-
import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui-theme";
|
|
90
33
|
import { meta as meta3 } from "#meta";
|
|
91
34
|
|
|
92
35
|
// src/components/NotebookStack/NotebookCell.tsx
|
|
93
|
-
import
|
|
36
|
+
import React3, { useCallback, useMemo } from "react";
|
|
94
37
|
import { Surface } from "@dxos/app-framework/ui";
|
|
95
38
|
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
96
39
|
import { Obj } from "@dxos/echo";
|
|
97
40
|
import { createDocAccessor } from "@dxos/echo-db";
|
|
98
|
-
import { invariant
|
|
41
|
+
import { invariant } from "@dxos/invariant";
|
|
99
42
|
import { TemplateEditor } from "@dxos/plugin-assistant/components";
|
|
100
43
|
import { useThemeContext as useThemeContext2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
101
44
|
import { QueryEditor } from "@dxos/react-ui-components";
|
|
102
45
|
import { Editor } from "@dxos/react-ui-editor";
|
|
103
46
|
import { createBasicExtensions as createBasicExtensions2, createDataExtensions, createMarkdownExtensions, createThemeExtensions as createThemeExtensions2, decorateMarkdown } from "@dxos/ui-editor";
|
|
104
|
-
import { mx
|
|
47
|
+
import { mx } from "@dxos/ui-theme";
|
|
105
48
|
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
106
49
|
import { meta as meta2 } from "#meta";
|
|
107
50
|
|
|
@@ -116,12 +59,12 @@ import { tags } from "@lezer/highlight";
|
|
|
116
59
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
117
60
|
import { continueKeymap } from "@valtown/codemirror-continue";
|
|
118
61
|
import { tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from "@valtown/codemirror-ts";
|
|
119
|
-
import
|
|
62
|
+
import React2 from "react";
|
|
120
63
|
import { useThemeContext } from "@dxos/react-ui";
|
|
64
|
+
import { composable, composableProps } from "@dxos/react-ui";
|
|
121
65
|
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
122
66
|
import { Domino } from "@dxos/ui";
|
|
123
67
|
import { InputModeExtensions, createBasicExtensions, createThemeExtensions, defaultStyles } from "@dxos/ui-editor";
|
|
124
|
-
import { composable, composableProps } from "@dxos/ui-theme";
|
|
125
68
|
import { isNonNullable } from "@dxos/util";
|
|
126
69
|
var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode = "vscode", env, options, initialValue, extensions, scrollTo, selection, ...props }, forwardedRef) => {
|
|
127
70
|
const { themeMode } = useThemeContext();
|
|
@@ -182,7 +125,7 @@ var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode
|
|
|
182
125
|
scrollTo,
|
|
183
126
|
env
|
|
184
127
|
]);
|
|
185
|
-
return /* @__PURE__ */
|
|
128
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
186
129
|
...composableProps(props, {
|
|
187
130
|
classNames,
|
|
188
131
|
...focusAttributes
|
|
@@ -215,7 +158,7 @@ var createTooltipRenderer = (themeMode) => {
|
|
|
215
158
|
};
|
|
216
159
|
|
|
217
160
|
// src/components/NotebookStack/NotebookCell.tsx
|
|
218
|
-
var
|
|
161
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/NotebookStack/NotebookCell.tsx";
|
|
219
162
|
var editorStyles = "p-2 ps-3";
|
|
220
163
|
var valueStyles = "p-1 ps-3";
|
|
221
164
|
var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
@@ -234,7 +177,7 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
234
177
|
]);
|
|
235
178
|
const explorerGraph = cell.graph?.target;
|
|
236
179
|
const handleQueryChange = useCallback((value) => {
|
|
237
|
-
|
|
180
|
+
invariant(cell.source?.target, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 38, S: void 0, A: ["cell.source?.target", ""] });
|
|
238
181
|
Obj.update(cell.source.target, (obj) => {
|
|
239
182
|
obj.content = value;
|
|
240
183
|
});
|
|
@@ -246,7 +189,7 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
246
189
|
if (!cell.source?.target) {
|
|
247
190
|
return null;
|
|
248
191
|
}
|
|
249
|
-
return /* @__PURE__ */
|
|
192
|
+
return /* @__PURE__ */ React3.createElement(NotebookTextEditor, {
|
|
250
193
|
id: cell.id,
|
|
251
194
|
classNames: editorStyles,
|
|
252
195
|
initialValue: cell.source.target.content,
|
|
@@ -256,7 +199,7 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
256
199
|
if (!cell.source?.target) {
|
|
257
200
|
return null;
|
|
258
201
|
}
|
|
259
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(TypescriptEditor, {
|
|
260
203
|
id: cell.id,
|
|
261
204
|
role: "section",
|
|
262
205
|
classNames: editorStyles,
|
|
@@ -268,7 +211,7 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
268
211
|
highlightActiveLine: false,
|
|
269
212
|
lineNumbers: false
|
|
270
213
|
}
|
|
271
|
-
}), /* @__PURE__ */
|
|
214
|
+
}), /* @__PURE__ */ React3.createElement(NotebookCellValue, {
|
|
272
215
|
cell,
|
|
273
216
|
graph
|
|
274
217
|
}));
|
|
@@ -276,9 +219,9 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
276
219
|
if (!cell.source?.target) {
|
|
277
220
|
return null;
|
|
278
221
|
}
|
|
279
|
-
return /* @__PURE__ */
|
|
280
|
-
className:
|
|
281
|
-
}, /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
223
|
+
className: mx("h-full overflow-hidden grid", explorerGraph && !dragging && "grid-rows-[min-content_1fr]")
|
|
224
|
+
}, /* @__PURE__ */ React3.createElement(QueryEditor, {
|
|
282
225
|
id: cell.id,
|
|
283
226
|
classNames: [
|
|
284
227
|
editorStyles,
|
|
@@ -287,7 +230,7 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
287
230
|
db,
|
|
288
231
|
value: cell.source.target.content,
|
|
289
232
|
onChange: handleQueryChange
|
|
290
|
-
}), explorerGraph && !dragging && /* @__PURE__ */
|
|
233
|
+
}), explorerGraph && !dragging && /* @__PURE__ */ React3.createElement(Surface.Surface, {
|
|
291
234
|
type: AppSurface.Section,
|
|
292
235
|
limit: 1,
|
|
293
236
|
data: {
|
|
@@ -300,12 +243,12 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
300
243
|
if (!cell.prompt?.target) {
|
|
301
244
|
return null;
|
|
302
245
|
}
|
|
303
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(TemplateEditor, {
|
|
304
247
|
id: cell.id,
|
|
305
|
-
|
|
248
|
+
source: cell.prompt.target.instructions,
|
|
306
249
|
lineNumbers: false,
|
|
307
250
|
classNames: editorStyles
|
|
308
|
-
}), /* @__PURE__ */
|
|
251
|
+
}), /* @__PURE__ */ React3.createElement(NotebookPromptResult, {
|
|
309
252
|
cell,
|
|
310
253
|
promptResults
|
|
311
254
|
}));
|
|
@@ -319,25 +262,25 @@ var NotebookCellValue = ({ cell, graph }) => {
|
|
|
319
262
|
if (value == null) {
|
|
320
263
|
return null;
|
|
321
264
|
}
|
|
322
|
-
return /* @__PURE__ */
|
|
323
|
-
className:
|
|
324
|
-
}, name && /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
266
|
+
className: mx("flex w-full bg-group-surface border-y border-subdued-separator text-description font-mono", valueStyles)
|
|
267
|
+
}, name && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("span", {
|
|
325
268
|
className: "text-success-text"
|
|
326
|
-
}, name), /* @__PURE__ */
|
|
269
|
+
}, name), /* @__PURE__ */ React3.createElement("span", {
|
|
327
270
|
className: "text-description"
|
|
328
|
-
}, "\xA0=\xA0")), /* @__PURE__ */
|
|
271
|
+
}, "\xA0=\xA0")), /* @__PURE__ */ React3.createElement("span", null, value));
|
|
329
272
|
};
|
|
330
273
|
var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
331
274
|
if (!cell.prompt) {
|
|
332
275
|
return null;
|
|
333
276
|
}
|
|
334
|
-
const value = promptResults?.[cell.prompt.
|
|
277
|
+
const value = promptResults?.[cell.prompt.uri];
|
|
335
278
|
if (value == null) {
|
|
336
279
|
return null;
|
|
337
280
|
}
|
|
338
|
-
return /* @__PURE__ */
|
|
339
|
-
className:
|
|
340
|
-
}, /* @__PURE__ */
|
|
281
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
282
|
+
className: mx("flex w-full bg-group-surface text-description border-y border-subdued-separator", valueStyles)
|
|
283
|
+
}, /* @__PURE__ */ React3.createElement(NotebookTextEditor, {
|
|
341
284
|
readOnly: true,
|
|
342
285
|
value
|
|
343
286
|
}));
|
|
@@ -362,7 +305,7 @@ var NotebookTextEditor = ({ extensions: extensionsProp, readOnly, ...props }) =>
|
|
|
362
305
|
}, [
|
|
363
306
|
extensionsProp
|
|
364
307
|
]);
|
|
365
|
-
return /* @__PURE__ */
|
|
308
|
+
return /* @__PURE__ */ React3.createElement(Editor.Root, null, /* @__PURE__ */ React3.createElement(Editor.View, {
|
|
366
309
|
...props,
|
|
367
310
|
extensions,
|
|
368
311
|
selectionEnd: true
|
|
@@ -380,14 +323,14 @@ var NotebookStack = composable2(({ notebook, onRearrange, db, graph, promptResul
|
|
|
380
323
|
onCellDelete,
|
|
381
324
|
env
|
|
382
325
|
};
|
|
383
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ React4.createElement(Stack, {
|
|
384
327
|
...composableProps2(props),
|
|
385
328
|
orientation: "vertical",
|
|
386
329
|
size: "contain",
|
|
387
330
|
rail: true,
|
|
388
331
|
onRearrange,
|
|
389
332
|
ref: forwardedRef
|
|
390
|
-
}, notebook?.cells.map((cell, i) => /* @__PURE__ */
|
|
333
|
+
}, notebook?.cells.map((cell, i) => /* @__PURE__ */ React4.createElement(NotebookSection, {
|
|
391
334
|
key: i,
|
|
392
335
|
cell,
|
|
393
336
|
...sectionProps
|
|
@@ -396,41 +339,41 @@ var NotebookStack = composable2(({ notebook, onRearrange, db, graph, promptResul
|
|
|
396
339
|
var NotebookSection = ({ cell, db, env, promptResults, onCellInsert, onCellDelete, ...props }) => {
|
|
397
340
|
const { t } = useTranslation3(meta3.id);
|
|
398
341
|
const resizable = cell.type === "query";
|
|
399
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ React4.createElement(StackItem.Root, {
|
|
400
343
|
role: "section",
|
|
401
344
|
item: cell,
|
|
402
345
|
draggable: true,
|
|
403
346
|
classNames: resizable && minSectionHeight
|
|
404
|
-
}, /* @__PURE__ */
|
|
347
|
+
}, /* @__PURE__ */ React4.createElement(StackItem.Heading, {
|
|
405
348
|
classNames: "h-full p-1 justify-between dx-attention-surface"
|
|
406
|
-
}, /* @__PURE__ */
|
|
349
|
+
}, /* @__PURE__ */ React4.createElement(StackItem.DragHandle, {
|
|
407
350
|
asChild: true
|
|
408
|
-
}, /* @__PURE__ */
|
|
351
|
+
}, /* @__PURE__ */ React4.createElement(IconButton, {
|
|
409
352
|
variant: "ghost",
|
|
410
353
|
icon: "ph--dots-six-vertical--regular",
|
|
411
354
|
iconOnly: true,
|
|
412
355
|
label: "Drag handle"
|
|
413
|
-
})), /* @__PURE__ */
|
|
356
|
+
})), /* @__PURE__ */ React4.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React4.createElement(DropdownMenu2.Trigger, {
|
|
414
357
|
asChild: true
|
|
415
|
-
}, /* @__PURE__ */
|
|
358
|
+
}, /* @__PURE__ */ React4.createElement(IconButton, {
|
|
416
359
|
variant: "ghost",
|
|
417
360
|
icon: "ph--dots-three--regular",
|
|
418
361
|
iconOnly: true,
|
|
419
362
|
label: t("notebook-cell-insert.label")
|
|
420
|
-
})), /* @__PURE__ */
|
|
363
|
+
})), /* @__PURE__ */ React4.createElement(NotebookMenu, {
|
|
421
364
|
cell,
|
|
422
365
|
onCellInsert,
|
|
423
366
|
onCellDelete
|
|
424
|
-
})), resizable && /* @__PURE__ */
|
|
367
|
+
})), resizable && /* @__PURE__ */ React4.createElement(StackItem.ResizeHandle, null)), /* @__PURE__ */ React4.createElement(StackItem.DragPreview, null, ({ item: cell2 }) => /* @__PURE__ */ React4.createElement(StackItem.Content, {
|
|
425
368
|
classNames: "overflow-visible bg-group-surface border border-subdued-separator"
|
|
426
|
-
}, /* @__PURE__ */
|
|
369
|
+
}, /* @__PURE__ */ React4.createElement(NotebookCell, {
|
|
427
370
|
db,
|
|
428
371
|
cell: cell2,
|
|
429
372
|
env,
|
|
430
373
|
dragging: true
|
|
431
|
-
}))), /* @__PURE__ */
|
|
374
|
+
}))), /* @__PURE__ */ React4.createElement(StackItem.Content, {
|
|
432
375
|
classNames: "overflow-visible"
|
|
433
|
-
}, /* @__PURE__ */
|
|
376
|
+
}, /* @__PURE__ */ React4.createElement(NotebookCell, {
|
|
434
377
|
db,
|
|
435
378
|
cell,
|
|
436
379
|
env,
|
|
@@ -440,8 +383,8 @@ var NotebookSection = ({ cell, db, env, promptResults, onCellInsert, onCellDelet
|
|
|
440
383
|
};
|
|
441
384
|
|
|
442
385
|
// src/components/QueryEditor/QueryEditor.tsx
|
|
443
|
-
import
|
|
444
|
-
import { ScriptTarget } from "typescript";
|
|
386
|
+
import React5, { useState } from "react";
|
|
387
|
+
import { ModuleResolutionKind, ScriptTarget } from "typescript";
|
|
445
388
|
import queryApi from "@dxos/echo-query/api.d.ts?raw";
|
|
446
389
|
import { useAsyncEffect } from "@dxos/react-ui";
|
|
447
390
|
var GLOBALS = `
|
|
@@ -464,7 +407,9 @@ var QueryEditor2 = (props) => {
|
|
|
464
407
|
lib: [
|
|
465
408
|
"ES5"
|
|
466
409
|
],
|
|
467
|
-
target: ScriptTarget.ES2022
|
|
410
|
+
target: ScriptTarget.ES2022,
|
|
411
|
+
// Avoid `@typescript/vfs`'s deprecated `node10` default (rejected by TS 6).
|
|
412
|
+
moduleResolution: ModuleResolutionKind.Bundler
|
|
468
413
|
});
|
|
469
414
|
await compiler2.initialize(GLOBALS);
|
|
470
415
|
setCompiler(compiler2);
|
|
@@ -472,7 +417,7 @@ var QueryEditor2 = (props) => {
|
|
|
472
417
|
if (!compiler) {
|
|
473
418
|
return null;
|
|
474
419
|
}
|
|
475
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ React5.createElement(TypescriptEditor, {
|
|
476
421
|
...props,
|
|
477
422
|
env: compiler.environment
|
|
478
423
|
});
|
|
@@ -480,10 +425,10 @@ var QueryEditor2 = (props) => {
|
|
|
480
425
|
|
|
481
426
|
// src/components/ScriptToolbar/ScriptToolbar.tsx
|
|
482
427
|
import { Atom } from "@effect-atom/atom-react";
|
|
483
|
-
import
|
|
428
|
+
import React6, { useMemo as useMemo2 } from "react";
|
|
484
429
|
import { ElevationProvider, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
430
|
+
import { composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
|
|
485
431
|
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
486
|
-
import { composable as composable3, composableProps as composableProps3 } from "@dxos/ui-theme";
|
|
487
432
|
import { createDeploy, createFormat, createTemplateSelect, useDeployDeps } from "#hooks";
|
|
488
433
|
import { meta as meta4 } from "#meta";
|
|
489
434
|
var ScriptToolbar = composable3(({ script, attendableId, role, state, ...props }, forwardedRef) => {
|
|
@@ -503,12 +448,12 @@ var ScriptToolbar = composable3(({ script, attendableId, role, state, ...props }
|
|
|
503
448
|
t
|
|
504
449
|
]);
|
|
505
450
|
const menuActions = useMenuActions(menuCreator);
|
|
506
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ React6.createElement(ElevationProvider, {
|
|
507
452
|
elevation: role === "section" ? "positioned" : "base"
|
|
508
|
-
}, /* @__PURE__ */
|
|
453
|
+
}, /* @__PURE__ */ React6.createElement(Menu.Root, {
|
|
509
454
|
...menuActions,
|
|
510
455
|
attendableId
|
|
511
|
-
}, /* @__PURE__ */
|
|
456
|
+
}, /* @__PURE__ */ React6.createElement(Menu.Toolbar, {
|
|
512
457
|
...composableProps3(props),
|
|
513
458
|
ref: forwardedRef
|
|
514
459
|
})));
|
|
@@ -540,20 +485,21 @@ var createToolbarActions = ({ state, script, ...options }) => Atom.make((get) =>
|
|
|
540
485
|
});
|
|
541
486
|
|
|
542
487
|
// src/components/TestPanel/TestPanel.tsx
|
|
543
|
-
import
|
|
544
|
-
import { log
|
|
488
|
+
import React7, { forwardRef, useRef, useState as useState2 } from "react";
|
|
489
|
+
import { log } from "@dxos/log";
|
|
545
490
|
import { Avatar, Icon, Input, ScrollArea, Toolbar, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
491
|
+
import { composable as composable4, composableProps as composableProps4 } from "@dxos/react-ui";
|
|
546
492
|
import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
547
|
-
import {
|
|
493
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
548
494
|
import { meta as meta5 } from "#meta";
|
|
549
|
-
var
|
|
495
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
550
496
|
var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
551
497
|
const { t } = useTranslation5(meta5.id);
|
|
552
|
-
const inputRef =
|
|
498
|
+
const inputRef = useRef(null);
|
|
553
499
|
const [input, setInput] = useState2("");
|
|
554
500
|
const [state, setState] = useState2(null);
|
|
555
501
|
const [history, setHistory] = useState2([]);
|
|
556
|
-
const scrollerRef =
|
|
502
|
+
const scrollerRef = useRef(null);
|
|
557
503
|
const handleScroll = () => {
|
|
558
504
|
if (scrollerRef.current) {
|
|
559
505
|
scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
|
|
@@ -624,10 +570,10 @@ var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) =
|
|
|
624
570
|
handleResponse({
|
|
625
571
|
error
|
|
626
572
|
});
|
|
627
|
-
|
|
573
|
+
log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 90, S: void 0 });
|
|
628
574
|
}
|
|
629
575
|
};
|
|
630
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
631
577
|
...composableProps4(props, {
|
|
632
578
|
classNames: [
|
|
633
579
|
"flex flex-col h-full overflow-hidden",
|
|
@@ -635,23 +581,23 @@ var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) =
|
|
|
635
581
|
]
|
|
636
582
|
}),
|
|
637
583
|
ref: forwardedRef
|
|
638
|
-
}, /* @__PURE__ */
|
|
584
|
+
}, /* @__PURE__ */ React7.createElement(MessageThread, {
|
|
639
585
|
ref: scrollerRef,
|
|
640
586
|
state,
|
|
641
587
|
history
|
|
642
|
-
}), /* @__PURE__ */
|
|
588
|
+
}), /* @__PURE__ */ React7.createElement(Toolbar.Root, null, /* @__PURE__ */ React7.createElement(Input.Root, null, /* @__PURE__ */ React7.createElement(Input.TextInput, {
|
|
643
589
|
ref: inputRef,
|
|
644
590
|
autoFocus: true,
|
|
645
591
|
placeholder: t("function-request.placeholder"),
|
|
646
592
|
value: input,
|
|
647
593
|
onChange: (ev) => setInput(ev.target.value),
|
|
648
594
|
onKeyDown: (ev) => ev.key === "Enter" && handleRequest(input)
|
|
649
|
-
})), /* @__PURE__ */
|
|
595
|
+
})), /* @__PURE__ */ React7.createElement(Toolbar.IconButton, {
|
|
650
596
|
icon: "ph--play--regular",
|
|
651
597
|
label: "Execute",
|
|
652
598
|
iconOnly: true,
|
|
653
599
|
onClick: () => handleRequest(input)
|
|
654
|
-
}), /* @__PURE__ */
|
|
600
|
+
}), /* @__PURE__ */ React7.createElement(Toolbar.IconButton, {
|
|
655
601
|
icon: "ph--trash--regular",
|
|
656
602
|
label: "Clear",
|
|
657
603
|
iconOnly: true,
|
|
@@ -659,26 +605,26 @@ var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) =
|
|
|
659
605
|
})));
|
|
660
606
|
});
|
|
661
607
|
var MessageThread = /* @__PURE__ */ forwardRef(({ state, history }, forwardedRef) => {
|
|
662
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ React7.createElement(ScrollArea.Root, {
|
|
663
609
|
orientation: "vertical",
|
|
664
610
|
classNames: "h-full",
|
|
665
611
|
ref: forwardedRef
|
|
666
|
-
}, /* @__PURE__ */
|
|
612
|
+
}, /* @__PURE__ */ React7.createElement(ScrollArea.Viewport, {
|
|
667
613
|
classNames: "gap-6 p-2"
|
|
668
|
-
}, history.map((message, i) => /* @__PURE__ */
|
|
614
|
+
}, history.map((message, i) => /* @__PURE__ */ React7.createElement("div", {
|
|
669
615
|
key: i,
|
|
670
616
|
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
671
|
-
}, /* @__PURE__ */
|
|
617
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
672
618
|
className: "p-1"
|
|
673
|
-
}, message.type === "response" && /* @__PURE__ */
|
|
619
|
+
}, message.type === "response" && /* @__PURE__ */ React7.createElement(RobotAvatar, null)), /* @__PURE__ */ React7.createElement("div", {
|
|
674
620
|
className: "overflow-auto"
|
|
675
|
-
}, /* @__PURE__ */
|
|
621
|
+
}, /* @__PURE__ */ React7.createElement(MessageItem, {
|
|
676
622
|
message
|
|
677
|
-
})))), state === "pending" && /* @__PURE__ */
|
|
623
|
+
})))), state === "pending" && /* @__PURE__ */ React7.createElement("div", {
|
|
678
624
|
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
679
|
-
}, /* @__PURE__ */
|
|
625
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
680
626
|
className: "p-1"
|
|
681
|
-
}, /* @__PURE__ */
|
|
627
|
+
}, /* @__PURE__ */ React7.createElement(Icon, {
|
|
682
628
|
icon: "ph--spinner--regular",
|
|
683
629
|
size: 6,
|
|
684
630
|
classNames: "animate-spin"
|
|
@@ -687,18 +633,18 @@ var MessageThread = /* @__PURE__ */ forwardRef(({ state, history }, forwardedRef
|
|
|
687
633
|
var MessageItem = ({ classNames, message }) => {
|
|
688
634
|
const { type, text, data, error } = message;
|
|
689
635
|
const wrapper = "p-1 px-2 rounded-md bg-hover-surface overflow-auto";
|
|
690
|
-
return /* @__PURE__ */
|
|
691
|
-
className:
|
|
692
|
-
}, error && /* @__PURE__ */
|
|
693
|
-
className:
|
|
694
|
-
}, String(error)), text !== void 0 && /* @__PURE__ */
|
|
695
|
-
className:
|
|
696
|
-
}, text || "\xD8"), data && /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
637
|
+
className: mx2("flex", type === "request" ? "ml-[1rem] justify-end" : "mr-[1rem]", classNames)
|
|
638
|
+
}, error && /* @__PURE__ */ React7.createElement("div", {
|
|
639
|
+
className: mx2(wrapper, "whitespace-pre text-error-text")
|
|
640
|
+
}, String(error)), text !== void 0 && /* @__PURE__ */ React7.createElement("div", {
|
|
641
|
+
className: mx2(wrapper, type === "request" && "bg-primary-500 dark:bg-primary-600")
|
|
642
|
+
}, text || "\xD8"), data && /* @__PURE__ */ React7.createElement(JsonHighlighter, {
|
|
697
643
|
data,
|
|
698
|
-
classNames:
|
|
644
|
+
classNames: mx2(wrapper, "text-xs")
|
|
699
645
|
}));
|
|
700
646
|
};
|
|
701
|
-
var RobotAvatar = () => /* @__PURE__ */
|
|
647
|
+
var RobotAvatar = () => /* @__PURE__ */ React7.createElement(Avatar.Root, null, /* @__PURE__ */ React7.createElement(Avatar.Content, {
|
|
702
648
|
size: 6,
|
|
703
649
|
variant: "circle",
|
|
704
650
|
icon: "ph--drone--regular"
|
|
@@ -707,7 +653,6 @@ var RobotAvatar = () => /* @__PURE__ */ React8.createElement(Avatar.Root, null,
|
|
|
707
653
|
// src/components/index.ts
|
|
708
654
|
var ScriptPluginSettings = lazy(() => import("../ScriptPluginSettings-T4JMUSHN.mjs"));
|
|
709
655
|
export {
|
|
710
|
-
FramePanel,
|
|
711
656
|
NotebookMenu,
|
|
712
657
|
NotebookStack,
|
|
713
658
|
QueryEditor2 as QueryEditor,
|