@dxos/plugin-script 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/{browser/DeploymentDialog-IIOXAS47.mjs → neutral/DeploymentDialog-M3AFYQHC.mjs} +24 -48
- package/dist/lib/neutral/DeploymentDialog-M3AFYQHC.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-VVZOKGRC.mjs → neutral/NotebookArticle-NV4AHOOS.mjs} +58 -145
- package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +7 -0
- package/dist/lib/{browser/ScriptContainer-A5SSIUH6.mjs → neutral/ScriptArticle-UBT27SB6.mjs} +14 -28
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +51 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs +297 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs +44 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs +52 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs.map +7 -0
- package/dist/lib/{browser/blueprint-definition-YMZEJBAZ.mjs → neutral/blueprint-definition-T33SBPP2.mjs} +4 -6
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +3 -1
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +17 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-JGN7TDJH.mjs → neutral/chunk-2REUEDUA.mjs} +10 -23
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDHDBPVM.mjs +52 -0
- package/dist/lib/neutral/chunk-BDHDBPVM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-C4O7EV6M.mjs +123 -0
- 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-LHEJXJEL.mjs +8 -0
- package/dist/lib/neutral/chunk-LHEJXJEL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NQOIENTU.mjs +8 -0
- package/dist/lib/neutral/chunk-NQOIENTU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TRKXIP2Q.mjs +345 -0
- 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/{browser/chunk-G3XIOLLI.mjs → neutral/chunk-VXDJH6OL.mjs} +24 -48
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/{browser/compiler-53G6ZHQM.mjs → neutral/compiler-ODK4UA2N.mjs} +24 -22
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +664 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +17 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-WQJXMOUE.mjs +46 -0
- package/dist/lib/neutral/create-WQJXMOUE.mjs.map +7 -0
- package/dist/lib/neutral/create-object-FZM5ASWM.mjs +45 -0
- package/dist/lib/neutral/create-object-FZM5ASWM.mjs.map +7 -0
- package/dist/lib/neutral/create-script-66DO3UJO.mjs +45 -0
- package/dist/lib/neutral/create-script-66DO3UJO.mjs.map +7 -0
- package/dist/lib/neutral/delete-HCQIQFVP.mjs +21 -0
- package/dist/lib/neutral/delete-HCQIQFVP.mjs.map +7 -0
- package/dist/lib/neutral/deploy-7JVMMHSH.mjs +63 -0
- package/dist/lib/neutral/deploy-7JVMMHSH.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MUEVLYXJ.mjs → neutral/hooks/index.mjs} +52 -80
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-6MW73SDV.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-6MW73SDV.mjs.map +7 -0
- package/dist/lib/neutral/install-function-FJIE2JAI.mjs +49 -0
- package/dist/lib/neutral/install-function-FJIE2JAI.mjs.map +7 -0
- package/dist/lib/neutral/invoke-3HVWY2KF.mjs +32 -0
- package/dist/lib/neutral/invoke-3HVWY2KF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/operation-handler-X44IGZXS.mjs +18 -0
- package/dist/lib/neutral/operation-handler-X44IGZXS.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs +121 -0
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs.map +7 -0
- package/dist/lib/neutral/read-RQESBAQI.mjs +26 -0
- package/dist/lib/neutral/read-RQESBAQI.mjs.map +7 -0
- package/dist/lib/{browser/settings-76UM7442.mjs → neutral/settings-VJBW4OMK.mjs} +6 -12
- package/dist/lib/neutral/settings-VJBW4OMK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +105 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +17 -0
- package/dist/lib/neutral/update-JZUNJYZM.mjs +63 -0
- package/dist/lib/neutral/update-JZUNJYZM.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +1 -0
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
- package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
- 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 +11 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts +135 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +17 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +21 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +28 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts +21 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/read.d.ts +21 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +26 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +16 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +19 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +18 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -5
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +4 -2
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -228
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +241 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +7 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -228
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +4 -2
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +5 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -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/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +219 -228
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -2
- package/dist/types/src/containers/DeploymentDialog/index.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/NotebookArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +242 -0
- 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 +7 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +4 -5
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -2
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts +1 -2
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -4
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +16 -5
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +1 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -4
- package/dist/types/src/index.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/notebook/compute-graph.d.ts +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
- package/dist/types/src/operations/create-script.d.ts +5 -0
- package/dist/types/src/operations/create-script.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/anthropic.d.ts +4 -5
- package/dist/types/src/templates/anthropic.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +8 -10
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +9 -10
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +3 -2
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +3 -2
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +26 -31
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +2 -1
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-notebook.d.ts +3 -0
- package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
- package/dist/types/src/testing/test-script.d.ts +7 -0
- package/dist/types/src/testing/test-script.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +222 -92
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +53 -60
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +6 -0
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/ScriptEvents.d.ts +3 -0
- package/dist/types/src/types/ScriptEvents.d.ts.map +1 -0
- package/dist/types/src/types/ScriptOperation.d.ts +29 -0
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -4
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +2 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +2 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +167 -118
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +17 -43
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +332 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +71 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +56 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +34 -0
- package/src/blueprints/functions/query-deployed-functions.ts +35 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/script-blueprint.ts +32 -8
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
- package/src/capabilities/create-object.ts +49 -0
- package/src/capabilities/index.ts +14 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +130 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/compiler/compiler.ts +12 -1
- package/src/components/NotebookStack/NotebookCell.tsx +25 -14
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +8 -9
- package/src/components/NotebookStack/NotebookStack.tsx +24 -13
- package/src/components/QueryEditor/QueryEditor.stories.tsx +5 -11
- package/src/components/QueryEditor/QueryEditor.tsx +3 -1
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
- package/src/components/ScriptPluginSettings/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +7 -7
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +24 -26
- package/src/components/TestPanel/TestPanel.tsx +91 -176
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +4 -4
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +25 -18
- package/src/components/index.ts +4 -1
- package/src/constants.ts +4 -2
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +7 -5
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +26 -26
- package/src/containers/DeploymentDialog/index.ts +1 -3
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +85 -0
- package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +43 -56
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
- package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +15 -14
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +102 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +76 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -21
- package/src/containers/ScriptProperties/index.ts +1 -3
- package/src/containers/TestContainer/TestContainer.tsx +24 -8
- package/src/containers/TestContainer/index.ts +1 -3
- package/src/containers/index.ts +2 -4
- package/src/e2e/ai.test.ts +7 -6
- package/src/e2e/deploy.test.ts +6 -4
- package/src/hooks/deploy.ts +10 -8
- package/src/hooks/format.ts +5 -5
- package/src/hooks/template.ts +7 -6
- package/src/hooks/useCompiler.ts +3 -2
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
- package/src/index.ts +2 -5
- package/src/meta.ts +13 -7
- package/src/notebook/compute-graph.test.ts +7 -7
- package/src/notebook/compute-graph.ts +1 -1
- package/src/notebook/vfs-parser.ts +10 -3
- package/src/operations/create-script.ts +46 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +20 -12
- package/src/templates/chess-bot.ts +42 -37
- package/src/templates/commentary.ts +185 -165
- package/src/templates/data-generator.ts +2 -2
- package/src/templates/discord.ts +8 -8
- package/src/templates/forex-effect.ts +31 -19
- package/src/templates/forex.ts +25 -15
- package/src/templates/gmail.ts +9 -9
- package/src/templates/index.ts +16 -23
- package/src/templates/ping.ts +17 -8
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +3 -4
- package/src/testing/{data.ts → test-notebook.ts} +12 -13
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +89 -89
- package/src/types/Notebook.ts +8 -10
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/types/ScriptOperation.ts +42 -0
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -4
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +14 -12
- package/src/util/functions.ts +12 -11
- package/src/vite-env.d.ts +5 -0
- package/dist/lib/browser/DeploymentDialog-IIOXAS47.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-VVZOKGRC.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs.map +0 -7
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs +0 -294
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs.map +0 -7
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs +0 -55
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs.map +0 -7
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs +0 -28
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs.map +0 -7
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs +0 -39
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +0 -69
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6IXFDTAI.mjs +0 -113
- package/dist/lib/browser/chunk-6IXFDTAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATTZUDT7.mjs +0 -67
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +0 -7
- package/dist/lib/browser/chunk-J7PGML5B.mjs +0 -105
- package/dist/lib/browser/chunk-J7PGML5B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-PLDBKKYO.mjs +0 -789
- package/dist/lib/browser/chunk-PLDBKKYO.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q66L5EUR.mjs +0 -20
- package/dist/lib/browser/chunk-Q66L5EUR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TW27W3EL.mjs +0 -29
- package/dist/lib/browser/chunk-TW27W3EL.mjs.map +0 -7
- package/dist/lib/browser/chunk-WYR4QHPE.mjs +0 -31
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs +0 -11
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs.map +0 -7
- package/dist/lib/browser/compiler-53G6ZHQM.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -250
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs +0 -79
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-26P6HAFD.mjs +0 -141
- package/dist/lib/browser/react-surface-26P6HAFD.mjs.map +0 -7
- package/dist/lib/browser/settings-76UM7442.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs +0 -139
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs +0 -851
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs +0 -94
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs +0 -295
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs +0 -56
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs +0 -29
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs.map +0 -7
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs +0 -40
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +0 -70
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs +0 -176
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs +0 -33
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs +0 -790
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs +0 -107
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs +0 -31
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs +0 -22
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs +0 -12
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs +0 -114
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs +0 -398
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs +0 -100
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -251
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-THCIK266.mjs +0 -142
- package/dist/lib/node-esm/react-surface-THCIK266.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs +0 -37
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -19
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +0 -12
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/compiler.d.ts +0 -6
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/index.d.ts +0 -3
- package/dist/types/src/capabilities/compiler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -7
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +0 -12
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/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 -3
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +0 -10
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +0 -7
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +0 -8
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptPluginSettings/index.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/dist/types/src/testing/data.d.ts +0 -3
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/types/actions.d.ts +0 -40
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -12
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -56
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/artifact-definition/artifact-definition.ts +0 -227
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/compiler/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -75
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -121
- package/src/capabilities/settings/index.ts +0 -7
- package/src/components/FrameContainer/FrameContainer.tsx +0 -85
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/components/FrameContainer/index.ts +0 -5
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +0 -87
- package/src/containers/NotebookContainer/index.ts +0 -7
- package/src/containers/ScriptContainer/index.ts +0 -7
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -291
- package/src/containers/ScriptObjectSettings/index.ts +0 -7
- package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +0 -66
- package/src/containers/ScriptPluginSettings/index.ts +0 -7
- package/src/templates/chat.ts +0 -96
- package/src/types/actions.ts +0 -45
- package/src/types/capabilities.ts +0 -17
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/templates → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/templates/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -1,790 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
Compiler
|
|
4
|
-
} from "./chunk-JGN7TDJH.mjs";
|
|
5
|
-
import {
|
|
6
|
-
createDeploy,
|
|
7
|
-
createFormat,
|
|
8
|
-
createTemplateSelect,
|
|
9
|
-
useDeployDeps
|
|
10
|
-
} from "./chunk-ZDJ2FI7E.mjs";
|
|
11
|
-
import {
|
|
12
|
-
meta
|
|
13
|
-
} from "./chunk-5HSJPAK7.mjs";
|
|
14
|
-
|
|
15
|
-
// src/components/FrameContainer/FrameContainer.tsx
|
|
16
|
-
import React, { useEffect, useRef } from "react";
|
|
17
|
-
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
18
|
-
import { invariant } from "@dxos/invariant";
|
|
19
|
-
import { log } from "@dxos/log";
|
|
20
|
-
import { useClient } from "@dxos/react-client";
|
|
21
|
-
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
22
|
-
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
23
|
-
import { mx } from "@dxos/ui-theme";
|
|
24
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/FrameContainer/FrameContainer.tsx";
|
|
25
|
-
var FrameContainer = ({ containerUrl, result, debug = true }) => {
|
|
26
|
-
const client = useClient();
|
|
27
|
-
const iframeRef = useRef(null);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (iframeRef.current) {
|
|
30
|
-
const rpc = createProtoRpcPeer({
|
|
31
|
-
exposed: clientServiceBundle,
|
|
32
|
-
handlers: client._services.services,
|
|
33
|
-
port: createIFramePort({
|
|
34
|
-
channel: "frame",
|
|
35
|
-
iframe: iframeRef.current,
|
|
36
|
-
origin: "*"
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
rpc.open().catch((e) => log.catch(e, void 0, {
|
|
40
|
-
F: __dxlog_file,
|
|
41
|
-
L: 41,
|
|
42
|
-
S: void 0,
|
|
43
|
-
C: (f, a) => f(...a)
|
|
44
|
-
}));
|
|
45
|
-
return () => {
|
|
46
|
-
rpc.close().catch((e) => log.catch(e, void 0, {
|
|
47
|
-
F: __dxlog_file,
|
|
48
|
-
L: 43,
|
|
49
|
-
S: void 0,
|
|
50
|
-
C: (f, a) => f(...a)
|
|
51
|
-
}));
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}, [
|
|
55
|
-
iframeRef
|
|
56
|
-
]);
|
|
57
|
-
invariant(result.sourceHash, "Source hash is required.", {
|
|
58
|
-
F: __dxlog_file,
|
|
59
|
-
L: 49,
|
|
60
|
-
S: void 0,
|
|
61
|
-
A: [
|
|
62
|
-
"result.sourceHash",
|
|
63
|
-
"'Source hash is required.'"
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
const sourceHash = Buffer.from(result.sourceHash).toString("hex");
|
|
67
|
-
const src = "bundle" in result ? `${containerUrl}?ts=${sourceHash}#code=${encodeURIComponent(new TextDecoder().decode(Object.values(result.bundle)[0]))}` : void 0;
|
|
68
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("iframe", {
|
|
69
|
-
ref: iframeRef,
|
|
70
|
-
sandbox: "allow-scripts",
|
|
71
|
-
src,
|
|
72
|
-
style: {
|
|
73
|
-
width: "100%",
|
|
74
|
-
height: "100%"
|
|
75
|
-
}
|
|
76
|
-
}), debug && /* @__PURE__ */ React.createElement("div", {
|
|
77
|
-
className: "relative"
|
|
78
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
79
|
-
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")
|
|
80
|
-
}, /* @__PURE__ */ React.createElement("pre", {
|
|
81
|
-
className: "text-xs whitespace-break-spaces break-all p-2"
|
|
82
|
-
}, JSON.stringify({
|
|
83
|
-
timestamp: result.timestamp,
|
|
84
|
-
sourceHash,
|
|
85
|
-
error: "error" in result ? result.error : void 0,
|
|
86
|
-
src
|
|
87
|
-
}, void 0, 2)))));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// src/components/NotebookStack/NotebookMenu.tsx
|
|
91
|
-
import React2 from "react";
|
|
92
|
-
import { DropdownMenu, useTranslation } from "@dxos/react-ui";
|
|
93
|
-
var NotebookMenu = ({ cell, onCellInsert, onCellDelete }) => {
|
|
94
|
-
const { t } = useTranslation(meta.id);
|
|
95
|
-
return /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
96
|
-
onClick: () => onCellInsert?.("script", cell?.id)
|
|
97
|
-
}, t("notebook cell insert script label")), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
98
|
-
onClick: () => onCellInsert?.("prompt", cell?.id)
|
|
99
|
-
}, t("notebook cell insert prompt label")), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
100
|
-
onClick: () => onCellInsert?.("query", cell?.id)
|
|
101
|
-
}, t("notebook cell insert query label")), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
102
|
-
onClick: () => onCellInsert?.("markdown", cell?.id)
|
|
103
|
-
}, t("notebook cell insert markdown label")), cell && onCellDelete && /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
104
|
-
onClick: () => onCellDelete?.(cell.id)
|
|
105
|
-
}, t("notebook cell delete label"))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)));
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// src/components/TypescriptEditor/TypescriptEditor.tsx
|
|
109
|
-
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
110
|
-
import { javascript } from "@codemirror/lang-javascript";
|
|
111
|
-
import { HighlightStyle } from "@codemirror/language";
|
|
112
|
-
import { lintKeymap } from "@codemirror/lint";
|
|
113
|
-
import { Prec } from "@codemirror/state";
|
|
114
|
-
import { keymap } from "@codemirror/view";
|
|
115
|
-
import { tags } from "@lezer/highlight";
|
|
116
|
-
import { continueKeymap } from "@valtown/codemirror-continue";
|
|
117
|
-
import { tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from "@valtown/codemirror-ts";
|
|
118
|
-
import React3, { memo } from "react";
|
|
119
|
-
import { useThemeContext } from "@dxos/react-ui";
|
|
120
|
-
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
121
|
-
import { Domino } from "@dxos/ui";
|
|
122
|
-
import { InputModeExtensions, createBasicExtensions, createThemeExtensions, defaultStyles } from "@dxos/ui-editor";
|
|
123
|
-
import { mx as mx2 } from "@dxos/ui-theme";
|
|
124
|
-
import { isNonNullable } from "@dxos/util";
|
|
125
|
-
var TypescriptEditor = /* @__PURE__ */ memo(({ classNames, id, role = "article", inputMode = "vscode", env, options, initialValue, extensions, scrollTo, selection }) => {
|
|
126
|
-
const { themeMode } = useThemeContext();
|
|
127
|
-
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
128
|
-
id,
|
|
129
|
-
initialValue,
|
|
130
|
-
selection,
|
|
131
|
-
scrollTo,
|
|
132
|
-
extensions: [
|
|
133
|
-
extensions,
|
|
134
|
-
createBasicExtensions({
|
|
135
|
-
highlightActiveLine: true,
|
|
136
|
-
indentWithTab: true,
|
|
137
|
-
lineNumbers: true,
|
|
138
|
-
lineWrapping: false,
|
|
139
|
-
scrollPastEnd: role !== "section",
|
|
140
|
-
search: true,
|
|
141
|
-
...options
|
|
142
|
-
}),
|
|
143
|
-
createThemeExtensions({
|
|
144
|
-
monospace: true,
|
|
145
|
-
themeMode,
|
|
146
|
-
syntaxHighlighting: true
|
|
147
|
-
}),
|
|
148
|
-
InputModeExtensions[inputMode],
|
|
149
|
-
javascript({
|
|
150
|
-
typescript: true
|
|
151
|
-
}),
|
|
152
|
-
autocompletion({
|
|
153
|
-
override: env ? [
|
|
154
|
-
tsAutocomplete()
|
|
155
|
-
] : void 0
|
|
156
|
-
}),
|
|
157
|
-
// Continues block comments when pressing Enter.
|
|
158
|
-
Prec.high(keymap.of(continueKeymap)),
|
|
159
|
-
keymap.of(completionKeymap),
|
|
160
|
-
keymap.of(lintKeymap),
|
|
161
|
-
// https://github.com/val-town/codemirror-ts
|
|
162
|
-
env && [
|
|
163
|
-
// TODO(burdon): Fix type.
|
|
164
|
-
tsFacet.of({
|
|
165
|
-
env,
|
|
166
|
-
path: `./src/${id}.ts`
|
|
167
|
-
}),
|
|
168
|
-
tsSync(),
|
|
169
|
-
tsLinter(),
|
|
170
|
-
tsHover({
|
|
171
|
-
renderTooltip: createTooltipRenderer(themeMode)
|
|
172
|
-
})
|
|
173
|
-
]
|
|
174
|
-
].filter(isNonNullable)
|
|
175
|
-
}), [
|
|
176
|
-
themeMode,
|
|
177
|
-
id,
|
|
178
|
-
extensions,
|
|
179
|
-
inputMode,
|
|
180
|
-
selection,
|
|
181
|
-
scrollTo,
|
|
182
|
-
env
|
|
183
|
-
]);
|
|
184
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
185
|
-
ref: parentRef,
|
|
186
|
-
className: mx2(classNames),
|
|
187
|
-
...focusAttributes
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
var createTooltipRenderer = (themeMode) => {
|
|
191
|
-
const theme = HighlightStyle.define(themeMode === "dark" ? defaultStyles.dark : defaultStyles.light);
|
|
192
|
-
const classFromKind = (_kind) => {
|
|
193
|
-
const kind = _kind.endsWith("Name") ? "name" : _kind;
|
|
194
|
-
const validTag = kind in tags;
|
|
195
|
-
if (!validTag) {
|
|
196
|
-
return "";
|
|
197
|
-
}
|
|
198
|
-
const tag = tags[kind];
|
|
199
|
-
if (typeof tag === "function") {
|
|
200
|
-
return "";
|
|
201
|
-
}
|
|
202
|
-
return theme.style([
|
|
203
|
-
tag
|
|
204
|
-
]) ?? "";
|
|
205
|
-
};
|
|
206
|
-
return (info) => {
|
|
207
|
-
const children = info.quickInfo?.displayParts?.map(({ kind, text }) => Domino.of("span").classNames(classFromKind(kind)).text(text)) ?? [];
|
|
208
|
-
return {
|
|
209
|
-
dom: Domino.of("div").classNames("xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator").children(...children).root
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// src/components/NotebookStack/NotebookStack.tsx
|
|
215
|
-
import React5 from "react";
|
|
216
|
-
import { DropdownMenu as DropdownMenu2, IconButton, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
217
|
-
import { Stack, StackItem } from "@dxos/react-ui-stack";
|
|
218
|
-
|
|
219
|
-
// src/components/NotebookStack/NotebookCell.tsx
|
|
220
|
-
import React4, { useCallback, useMemo } from "react";
|
|
221
|
-
import { Surface } from "@dxos/app-framework/ui";
|
|
222
|
-
import { Obj } from "@dxos/echo";
|
|
223
|
-
import { createDocAccessor } from "@dxos/echo-db";
|
|
224
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
225
|
-
import { TemplateEditor } from "@dxos/plugin-assistant";
|
|
226
|
-
import { useThemeContext as useThemeContext2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
227
|
-
import { QueryEditor } from "@dxos/react-ui-components";
|
|
228
|
-
import { EditorContent } from "@dxos/react-ui-editor";
|
|
229
|
-
import { createBasicExtensions as createBasicExtensions2, createDataExtensions, createMarkdownExtensions, createThemeExtensions as createThemeExtensions2, decorateMarkdown } from "@dxos/ui-editor";
|
|
230
|
-
import { mx as mx3 } from "@dxos/ui-theme";
|
|
231
|
-
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
232
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/NotebookStack/NotebookCell.tsx";
|
|
233
|
-
var editorStyles = "p-2 ps-3";
|
|
234
|
-
var valueStyles = "p-1 ps-3";
|
|
235
|
-
var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
236
|
-
const { t } = useTranslation2(meta.id);
|
|
237
|
-
const extensions = useMemo(() => {
|
|
238
|
-
return cell.source?.target ? [
|
|
239
|
-
createDataExtensions({
|
|
240
|
-
id: cell.id,
|
|
241
|
-
text: createDocAccessor(cell.source.target, [
|
|
242
|
-
"content"
|
|
243
|
-
])
|
|
244
|
-
})
|
|
245
|
-
].filter(isNonNullable2) : [];
|
|
246
|
-
}, [
|
|
247
|
-
cell.source?.target
|
|
248
|
-
]);
|
|
249
|
-
const explorerGraph = cell.graph?.target;
|
|
250
|
-
const handleQueryChange = useCallback((value) => {
|
|
251
|
-
invariant2(cell.source?.target, void 0, {
|
|
252
|
-
F: __dxlog_file2,
|
|
253
|
-
L: 63,
|
|
254
|
-
S: void 0,
|
|
255
|
-
A: [
|
|
256
|
-
"cell.source?.target",
|
|
257
|
-
""
|
|
258
|
-
]
|
|
259
|
-
});
|
|
260
|
-
Obj.change(cell.source.target, (s) => {
|
|
261
|
-
s.content = value;
|
|
262
|
-
});
|
|
263
|
-
}, [
|
|
264
|
-
cell
|
|
265
|
-
]);
|
|
266
|
-
switch (cell.type) {
|
|
267
|
-
case "markdown":
|
|
268
|
-
if (!cell.source?.target) {
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
return /* @__PURE__ */ React4.createElement(NotebookTextEditor, {
|
|
272
|
-
id: cell.id,
|
|
273
|
-
classNames: editorStyles,
|
|
274
|
-
initialValue: cell.source.target.content,
|
|
275
|
-
extensions
|
|
276
|
-
});
|
|
277
|
-
case "script":
|
|
278
|
-
if (!cell.source?.target) {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(TypescriptEditor, {
|
|
282
|
-
id: cell.id,
|
|
283
|
-
role: "section",
|
|
284
|
-
classNames: editorStyles,
|
|
285
|
-
initialValue: cell.source.target.content,
|
|
286
|
-
extensions,
|
|
287
|
-
env,
|
|
288
|
-
options: {
|
|
289
|
-
placeholder: t("notebook cell placeholder"),
|
|
290
|
-
highlightActiveLine: false,
|
|
291
|
-
lineNumbers: false
|
|
292
|
-
}
|
|
293
|
-
}), /* @__PURE__ */ React4.createElement(NotebookCellValue, {
|
|
294
|
-
cell,
|
|
295
|
-
graph
|
|
296
|
-
}));
|
|
297
|
-
case "query":
|
|
298
|
-
if (!cell.source?.target) {
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
return /* @__PURE__ */ React4.createElement("div", {
|
|
302
|
-
className: mx3("h-full overflow-hidden grid", explorerGraph && !dragging && "grid-rows-[min-content_1fr]")
|
|
303
|
-
}, /* @__PURE__ */ React4.createElement(QueryEditor, {
|
|
304
|
-
id: cell.id,
|
|
305
|
-
classNames: [
|
|
306
|
-
editorStyles,
|
|
307
|
-
"border-b border-subdued-separator"
|
|
308
|
-
],
|
|
309
|
-
db,
|
|
310
|
-
value: cell.source.target.content,
|
|
311
|
-
onChange: handleQueryChange
|
|
312
|
-
}), explorerGraph && !dragging && /* @__PURE__ */ React4.createElement(Surface.Surface, {
|
|
313
|
-
role: "section",
|
|
314
|
-
limit: 1,
|
|
315
|
-
data: {
|
|
316
|
-
subject: explorerGraph
|
|
317
|
-
}
|
|
318
|
-
}));
|
|
319
|
-
// TODO(burdon): Use streaming response from Chat.
|
|
320
|
-
case "prompt":
|
|
321
|
-
if (!cell.prompt?.target) {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(TemplateEditor, {
|
|
325
|
-
id: cell.id,
|
|
326
|
-
template: cell.prompt.target.instructions,
|
|
327
|
-
lineNumbers: false,
|
|
328
|
-
classNames: editorStyles
|
|
329
|
-
}), /* @__PURE__ */ React4.createElement(NotebookPromptResult, {
|
|
330
|
-
cell,
|
|
331
|
-
promptResults
|
|
332
|
-
}));
|
|
333
|
-
default:
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
var NotebookCellValue = ({ cell, graph }) => {
|
|
338
|
-
const name = graph?.getExpressions()[cell.id]?.name;
|
|
339
|
-
const value = graph?.getValue(cell.id);
|
|
340
|
-
if (value == null) {
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
return /* @__PURE__ */ React4.createElement("div", {
|
|
344
|
-
className: mx3("flex w-full bg-group-surface border-y border-subdued-separator text-description font-mono", valueStyles)
|
|
345
|
-
}, name && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("span", {
|
|
346
|
-
className: "text-success-text"
|
|
347
|
-
}, name), /* @__PURE__ */ React4.createElement("span", {
|
|
348
|
-
className: "text-description"
|
|
349
|
-
}, "\xA0=\xA0")), /* @__PURE__ */ React4.createElement("span", null, value));
|
|
350
|
-
};
|
|
351
|
-
var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
352
|
-
if (!cell.prompt) {
|
|
353
|
-
return null;
|
|
354
|
-
}
|
|
355
|
-
const value = promptResults?.[cell.prompt.dxn.toString()];
|
|
356
|
-
if (value == null) {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
return /* @__PURE__ */ React4.createElement("div", {
|
|
360
|
-
className: mx3("flex w-full bg-group-surface text-description border-y border-subdued-separator", valueStyles)
|
|
361
|
-
}, /* @__PURE__ */ React4.createElement(NotebookTextEditor, {
|
|
362
|
-
readOnly: true,
|
|
363
|
-
value
|
|
364
|
-
}));
|
|
365
|
-
};
|
|
366
|
-
var NotebookTextEditor = ({ extensions: extensionsProp, readOnly, ...props }) => {
|
|
367
|
-
const { t } = useTranslation2(meta.id);
|
|
368
|
-
const { themeMode } = useThemeContext2();
|
|
369
|
-
const extensions = useMemo(() => {
|
|
370
|
-
return [
|
|
371
|
-
createBasicExtensions2({
|
|
372
|
-
placeholder: t("notebook markdown placeholder"),
|
|
373
|
-
readOnly
|
|
374
|
-
}),
|
|
375
|
-
createThemeExtensions2({
|
|
376
|
-
themeMode,
|
|
377
|
-
syntaxHighlighting: true
|
|
378
|
-
}),
|
|
379
|
-
createMarkdownExtensions(),
|
|
380
|
-
decorateMarkdown(),
|
|
381
|
-
extensionsProp
|
|
382
|
-
].filter(isNonNullable2);
|
|
383
|
-
}, [
|
|
384
|
-
extensionsProp
|
|
385
|
-
]);
|
|
386
|
-
return /* @__PURE__ */ React4.createElement(EditorContent, {
|
|
387
|
-
...props,
|
|
388
|
-
extensions,
|
|
389
|
-
selectionEnd: true
|
|
390
|
-
});
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
// src/components/NotebookStack/NotebookStack.tsx
|
|
394
|
-
var minSectionHeight = "min-h-[16rem]";
|
|
395
|
-
var NotebookStack = ({ classNames, notebook, onRearrange, ...props }) => {
|
|
396
|
-
return /* @__PURE__ */ React5.createElement(Stack, {
|
|
397
|
-
classNames,
|
|
398
|
-
orientation: "vertical",
|
|
399
|
-
size: "contain",
|
|
400
|
-
rail: true,
|
|
401
|
-
onRearrange
|
|
402
|
-
}, notebook?.cells.map((cell, i) => /* @__PURE__ */ React5.createElement(NotebookSection, {
|
|
403
|
-
key: i,
|
|
404
|
-
cell,
|
|
405
|
-
...props
|
|
406
|
-
})));
|
|
407
|
-
};
|
|
408
|
-
var NotebookSection = ({ cell, db, env, promptResults, onCellInsert, onCellDelete, ...props }) => {
|
|
409
|
-
const { t } = useTranslation3(meta.id);
|
|
410
|
-
const resizable = cell.type === "query";
|
|
411
|
-
return /* @__PURE__ */ React5.createElement(StackItem.Root, {
|
|
412
|
-
role: "section",
|
|
413
|
-
item: cell,
|
|
414
|
-
draggable: true,
|
|
415
|
-
classNames: resizable && minSectionHeight
|
|
416
|
-
}, /* @__PURE__ */ React5.createElement(StackItem.Heading, {
|
|
417
|
-
classNames: "h-full p-1 justify-between dx-attention-surface"
|
|
418
|
-
}, /* @__PURE__ */ React5.createElement(StackItem.DragHandle, {
|
|
419
|
-
asChild: true
|
|
420
|
-
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
421
|
-
variant: "ghost",
|
|
422
|
-
icon: "ph--dots-six-vertical--regular",
|
|
423
|
-
iconOnly: true,
|
|
424
|
-
label: "Drag handle"
|
|
425
|
-
})), /* @__PURE__ */ React5.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React5.createElement(DropdownMenu2.Trigger, {
|
|
426
|
-
asChild: true
|
|
427
|
-
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
428
|
-
variant: "ghost",
|
|
429
|
-
icon: "ph--dots-three--regular",
|
|
430
|
-
iconOnly: true,
|
|
431
|
-
label: t("notebook cell insert label")
|
|
432
|
-
})), /* @__PURE__ */ React5.createElement(NotebookMenu, {
|
|
433
|
-
cell,
|
|
434
|
-
onCellInsert,
|
|
435
|
-
onCellDelete
|
|
436
|
-
})), resizable && /* @__PURE__ */ React5.createElement(StackItem.ResizeHandle, null)), /* @__PURE__ */ React5.createElement(StackItem.DragPreview, null, ({ item: cell2 }) => /* @__PURE__ */ React5.createElement(StackItem.Content, {
|
|
437
|
-
classNames: "overflow-visible bg-group-surface border border-subdued-separator"
|
|
438
|
-
}, /* @__PURE__ */ React5.createElement(NotebookCell, {
|
|
439
|
-
db,
|
|
440
|
-
cell: cell2,
|
|
441
|
-
env,
|
|
442
|
-
dragging: true
|
|
443
|
-
}))), /* @__PURE__ */ React5.createElement(StackItem.Content, {
|
|
444
|
-
classNames: "overflow-visible"
|
|
445
|
-
}, /* @__PURE__ */ React5.createElement(NotebookCell, {
|
|
446
|
-
db,
|
|
447
|
-
cell,
|
|
448
|
-
env,
|
|
449
|
-
promptResults,
|
|
450
|
-
...props
|
|
451
|
-
})));
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
// src/components/QueryEditor/QueryEditor.tsx
|
|
455
|
-
import React6, { useState } from "react";
|
|
456
|
-
import { ScriptTarget } from "typescript";
|
|
457
|
-
import queryApi from "@dxos/echo-query/api.d.ts?raw";
|
|
458
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
459
|
-
var GLOBALS = `
|
|
460
|
-
namespace QueryAPI {
|
|
461
|
-
${queryApi}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
declare global {
|
|
465
|
-
const Query: typeof QueryAPI.Query;
|
|
466
|
-
const Filter: typeof QueryAPI.Filter;
|
|
467
|
-
const Order: typeof QueryAPI.Order;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
export {};
|
|
471
|
-
`;
|
|
472
|
-
var QueryEditor2 = (props) => {
|
|
473
|
-
const [compiler, setCompiler] = useState();
|
|
474
|
-
useAsyncEffect(async () => {
|
|
475
|
-
const compiler2 = new Compiler({
|
|
476
|
-
lib: [
|
|
477
|
-
"ES5"
|
|
478
|
-
],
|
|
479
|
-
target: ScriptTarget.ES2022
|
|
480
|
-
});
|
|
481
|
-
await compiler2.initialize(GLOBALS);
|
|
482
|
-
setCompiler(compiler2);
|
|
483
|
-
}, []);
|
|
484
|
-
if (!compiler) {
|
|
485
|
-
return null;
|
|
486
|
-
}
|
|
487
|
-
return /* @__PURE__ */ React6.createElement(TypescriptEditor, {
|
|
488
|
-
...props,
|
|
489
|
-
env: compiler.environment
|
|
490
|
-
});
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
// src/components/ScriptToolbar/ScriptToolbar.tsx
|
|
494
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
495
|
-
import React7, { useMemo as useMemo2 } from "react";
|
|
496
|
-
import { Obj as Obj2 } from "@dxos/echo";
|
|
497
|
-
import { ElevationProvider, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
498
|
-
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
499
|
-
var ScriptToolbar = ({ script, role, state, ...props }) => {
|
|
500
|
-
const { t } = useTranslation4(meta.id);
|
|
501
|
-
const options = useDeployDeps({
|
|
502
|
-
script
|
|
503
|
-
});
|
|
504
|
-
const menu = useMemo2(() => createToolbarActions({
|
|
505
|
-
state,
|
|
506
|
-
script,
|
|
507
|
-
t,
|
|
508
|
-
...options
|
|
509
|
-
}), [
|
|
510
|
-
state,
|
|
511
|
-
script,
|
|
512
|
-
options,
|
|
513
|
-
t
|
|
514
|
-
]);
|
|
515
|
-
const actions = useMenuActions(menu);
|
|
516
|
-
return /* @__PURE__ */ React7.createElement(ElevationProvider, {
|
|
517
|
-
elevation: role === "section" ? "positioned" : "base"
|
|
518
|
-
}, /* @__PURE__ */ React7.createElement(Menu.Root, {
|
|
519
|
-
...props,
|
|
520
|
-
...actions,
|
|
521
|
-
attendableId: Obj2.getDXN(script).toString()
|
|
522
|
-
}, /* @__PURE__ */ React7.createElement(Menu.Toolbar, null)));
|
|
523
|
-
};
|
|
524
|
-
var createToolbarActions = ({ state, script, ...options }) => Atom.make((get) => {
|
|
525
|
-
get(state.atom);
|
|
526
|
-
const templateSelect = createTemplateSelect(script);
|
|
527
|
-
const format = createFormat(script);
|
|
528
|
-
const gap = createGapSeparator();
|
|
529
|
-
const deploy = createDeploy({
|
|
530
|
-
state,
|
|
531
|
-
script,
|
|
532
|
-
...options
|
|
533
|
-
});
|
|
534
|
-
return {
|
|
535
|
-
nodes: [
|
|
536
|
-
...templateSelect.nodes,
|
|
537
|
-
...format.nodes,
|
|
538
|
-
...gap.nodes,
|
|
539
|
-
...deploy.nodes
|
|
540
|
-
],
|
|
541
|
-
edges: [
|
|
542
|
-
...templateSelect.edges,
|
|
543
|
-
...format.edges,
|
|
544
|
-
...gap.edges,
|
|
545
|
-
...deploy.edges
|
|
546
|
-
]
|
|
547
|
-
};
|
|
548
|
-
});
|
|
549
|
-
|
|
550
|
-
// src/components/TestPanel/TestPanel.tsx
|
|
551
|
-
import React8, { forwardRef, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
552
|
-
import { log as log2 } from "@dxos/log";
|
|
553
|
-
import { Avatar, Icon, Input, ScrollArea, Toolbar, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
554
|
-
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
555
|
-
import { mx as mx4 } from "@dxos/ui-theme";
|
|
556
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
557
|
-
var TestPanel = ({ classNames, functionUrl }) => {
|
|
558
|
-
const { t } = useTranslation5(meta.id);
|
|
559
|
-
const inputRef = useRef2(null);
|
|
560
|
-
const [input, setInput] = useState2("");
|
|
561
|
-
const [result, setResult] = useState2("");
|
|
562
|
-
const [state, setState] = useState2(null);
|
|
563
|
-
const [history, setHistory] = useState2([]);
|
|
564
|
-
const scrollerRef = useRef2(null);
|
|
565
|
-
const handleScroll = () => {
|
|
566
|
-
if (scrollerRef.current) {
|
|
567
|
-
scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
const controller = useRef2(null);
|
|
571
|
-
useEffect2(() => {
|
|
572
|
-
return () => {
|
|
573
|
-
handleStop();
|
|
574
|
-
};
|
|
575
|
-
}, []);
|
|
576
|
-
const handleStop = () => {
|
|
577
|
-
controller.current?.abort("stop");
|
|
578
|
-
controller.current = null;
|
|
579
|
-
};
|
|
580
|
-
const handleClear = () => {
|
|
581
|
-
handleStop();
|
|
582
|
-
setInput("");
|
|
583
|
-
setResult("");
|
|
584
|
-
setHistory([]);
|
|
585
|
-
inputRef.current?.focus();
|
|
586
|
-
};
|
|
587
|
-
const handleResponse = ({ text, data, error } = {}) => {
|
|
588
|
-
controller.current = null;
|
|
589
|
-
setHistory((history2) => [
|
|
590
|
-
...history2,
|
|
591
|
-
{
|
|
592
|
-
type: "response",
|
|
593
|
-
text,
|
|
594
|
-
data,
|
|
595
|
-
error
|
|
596
|
-
}
|
|
597
|
-
]);
|
|
598
|
-
setResult("");
|
|
599
|
-
setState(null);
|
|
600
|
-
handleScroll();
|
|
601
|
-
};
|
|
602
|
-
const handleRequest = async (input2) => {
|
|
603
|
-
try {
|
|
604
|
-
setState("pending");
|
|
605
|
-
let data = null;
|
|
606
|
-
if (input2.charAt(0) === "{") {
|
|
607
|
-
try {
|
|
608
|
-
const validJsonString = input2.replace(/'/g, '"').replace(/([{,]\s*)([a-zA-Z0-9_]+)(\s*:)/g, '$1"$2"$3');
|
|
609
|
-
data = JSON.parse(validJsonString);
|
|
610
|
-
input2 = JSON.stringify(data, null, 2);
|
|
611
|
-
} catch (err) {
|
|
612
|
-
inputRef.current?.focus();
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
setInput("");
|
|
617
|
-
setResult("");
|
|
618
|
-
setHistory((history2) => [
|
|
619
|
-
...history2,
|
|
620
|
-
{
|
|
621
|
-
type: "request",
|
|
622
|
-
text: input2
|
|
623
|
-
}
|
|
624
|
-
]);
|
|
625
|
-
setTimeout(() => {
|
|
626
|
-
handleScroll();
|
|
627
|
-
});
|
|
628
|
-
controller.current = new AbortController();
|
|
629
|
-
const response = await fetch(functionUrl, {
|
|
630
|
-
signal: controller.current.signal,
|
|
631
|
-
method: "POST",
|
|
632
|
-
body: input2,
|
|
633
|
-
headers: {
|
|
634
|
-
"Content-Type": data ? "application/json" : "text/plain"
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
if (!response.ok) {
|
|
638
|
-
const text2 = await response.text();
|
|
639
|
-
handleResponse({
|
|
640
|
-
error: new Error(text2 || response.statusText || String(response.status))
|
|
641
|
-
});
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
const contentType = response.headers.get("content-type");
|
|
645
|
-
if (contentType === "application/json") {
|
|
646
|
-
const data2 = await response.json();
|
|
647
|
-
handleResponse({
|
|
648
|
-
data: data2
|
|
649
|
-
});
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
setState("responding");
|
|
653
|
-
let text = "";
|
|
654
|
-
const reader = response.body.getReader();
|
|
655
|
-
const pump = async ({ done, value }) => {
|
|
656
|
-
text = text + new TextDecoder().decode(value);
|
|
657
|
-
if (!controller.current || done) {
|
|
658
|
-
handleResponse({
|
|
659
|
-
text
|
|
660
|
-
});
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
setResult(text);
|
|
664
|
-
setTimeout(() => {
|
|
665
|
-
handleScroll();
|
|
666
|
-
});
|
|
667
|
-
return reader.read().then(pump);
|
|
668
|
-
};
|
|
669
|
-
void reader.read().then(pump).catch((err) => {
|
|
670
|
-
if (err.name !== "AbortError") {
|
|
671
|
-
log2.catch(err, void 0, {
|
|
672
|
-
F: __dxlog_file3,
|
|
673
|
-
L: 162,
|
|
674
|
-
S: void 0,
|
|
675
|
-
C: (f, a) => f(...a)
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
} catch (err) {
|
|
680
|
-
if (err !== "stop") {
|
|
681
|
-
const error = err instanceof Error ? err : new Error(err);
|
|
682
|
-
handleResponse({
|
|
683
|
-
error
|
|
684
|
-
});
|
|
685
|
-
log2.catch(err, void 0, {
|
|
686
|
-
F: __dxlog_file3,
|
|
687
|
-
L: 169,
|
|
688
|
-
S: void 0,
|
|
689
|
-
C: (f, a) => f(...a)
|
|
690
|
-
});
|
|
691
|
-
} else {
|
|
692
|
-
handleResponse();
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
return /* @__PURE__ */ React8.createElement("div", {
|
|
697
|
-
className: mx4("flex flex-col h-full overflow-hidden", classNames)
|
|
698
|
-
}, /* @__PURE__ */ React8.createElement(MessageThread, {
|
|
699
|
-
ref: scrollerRef,
|
|
700
|
-
state,
|
|
701
|
-
result,
|
|
702
|
-
history
|
|
703
|
-
}), /* @__PURE__ */ React8.createElement(Toolbar.Root, null, /* @__PURE__ */ React8.createElement(Input.Root, null, /* @__PURE__ */ React8.createElement(Input.TextInput, {
|
|
704
|
-
ref: inputRef,
|
|
705
|
-
autoFocus: true,
|
|
706
|
-
placeholder: t("function request placeholder"),
|
|
707
|
-
value: input,
|
|
708
|
-
onChange: (ev) => setInput(ev.target.value),
|
|
709
|
-
onKeyDown: (ev) => ev.key === "Enter" && handleRequest(input)
|
|
710
|
-
})), /* @__PURE__ */ React8.createElement(Toolbar.IconButton, {
|
|
711
|
-
icon: "ph--play--regular",
|
|
712
|
-
size: 4,
|
|
713
|
-
label: "Execute",
|
|
714
|
-
iconOnly: true,
|
|
715
|
-
onClick: () => handleRequest(input)
|
|
716
|
-
}), /* @__PURE__ */ React8.createElement(Toolbar.IconButton, {
|
|
717
|
-
icon: state ? "ph--stop--regular" : "ph--trash--regular",
|
|
718
|
-
size: 4,
|
|
719
|
-
label: state ? "Stop" : "Clear",
|
|
720
|
-
iconOnly: true,
|
|
721
|
-
onClick: () => state ? handleStop() : handleClear()
|
|
722
|
-
})));
|
|
723
|
-
};
|
|
724
|
-
var MessageThread = /* @__PURE__ */ forwardRef(({ state, history, result }, forwardedRef) => {
|
|
725
|
-
return /* @__PURE__ */ React8.createElement(ScrollArea.Root, {
|
|
726
|
-
orientation: "vertical",
|
|
727
|
-
classNames: "h-full",
|
|
728
|
-
ref: forwardedRef
|
|
729
|
-
}, /* @__PURE__ */ React8.createElement(ScrollArea.Viewport, {
|
|
730
|
-
classNames: "gap-6 p-2"
|
|
731
|
-
}, history.map((message, i) => /* @__PURE__ */ React8.createElement("div", {
|
|
732
|
-
key: i,
|
|
733
|
-
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
734
|
-
}, /* @__PURE__ */ React8.createElement("div", {
|
|
735
|
-
className: "p-1"
|
|
736
|
-
}, message.type === "response" && /* @__PURE__ */ React8.createElement(RobotAvatar, null)), /* @__PURE__ */ React8.createElement("div", {
|
|
737
|
-
className: "overflow-auto"
|
|
738
|
-
}, /* @__PURE__ */ React8.createElement(MessageItem, {
|
|
739
|
-
message
|
|
740
|
-
})))), result?.length > 0 && /* @__PURE__ */ React8.createElement("div", {
|
|
741
|
-
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
742
|
-
}, /* @__PURE__ */ React8.createElement("div", {
|
|
743
|
-
className: "p-1"
|
|
744
|
-
}, state === "pending" && /* @__PURE__ */ React8.createElement(Icon, {
|
|
745
|
-
icon: "ph--spinner--regular",
|
|
746
|
-
size: 6,
|
|
747
|
-
classNames: "animate-spin"
|
|
748
|
-
}) || /* @__PURE__ */ React8.createElement(Icon, {
|
|
749
|
-
icon: "ph--robot--regular",
|
|
750
|
-
size: 6,
|
|
751
|
-
classNames: "animate-[pulse_1s_ease-in-out_infinite]"
|
|
752
|
-
})), /* @__PURE__ */ React8.createElement("div", {
|
|
753
|
-
className: "overflow-auto"
|
|
754
|
-
}, /* @__PURE__ */ React8.createElement(MessageItem, {
|
|
755
|
-
message: {
|
|
756
|
-
type: "response",
|
|
757
|
-
text: result
|
|
758
|
-
}
|
|
759
|
-
})))));
|
|
760
|
-
});
|
|
761
|
-
var MessageItem = ({ classNames, message }) => {
|
|
762
|
-
const { type, text, data, error } = message;
|
|
763
|
-
const wrapper = "p-1 px-2 rounded-md bg-hover-surface overflow-auto";
|
|
764
|
-
return /* @__PURE__ */ React8.createElement("div", {
|
|
765
|
-
className: mx4("flex", type === "request" ? "ml-[1rem] justify-end" : "mr-[1rem]", classNames)
|
|
766
|
-
}, error && /* @__PURE__ */ React8.createElement("div", {
|
|
767
|
-
className: mx4(wrapper, "whitespace-pre text-error-text")
|
|
768
|
-
}, String(error)), text !== void 0 && /* @__PURE__ */ React8.createElement("div", {
|
|
769
|
-
className: mx4(wrapper, type === "request" && "bg-primary-500 dark:bg-primary-600")
|
|
770
|
-
}, text || "\xD8"), data && /* @__PURE__ */ React8.createElement(SyntaxHighlighter, {
|
|
771
|
-
language: "json",
|
|
772
|
-
className: mx4(wrapper, "text-xs")
|
|
773
|
-
}, JSON.stringify(data, null, 2)));
|
|
774
|
-
};
|
|
775
|
-
var RobotAvatar = () => /* @__PURE__ */ React8.createElement(Avatar.Root, null, /* @__PURE__ */ React8.createElement(Avatar.Content, {
|
|
776
|
-
size: 6,
|
|
777
|
-
variant: "circle",
|
|
778
|
-
icon: "ph--robot--regular"
|
|
779
|
-
}));
|
|
780
|
-
|
|
781
|
-
export {
|
|
782
|
-
FrameContainer,
|
|
783
|
-
NotebookMenu,
|
|
784
|
-
TypescriptEditor,
|
|
785
|
-
NotebookStack,
|
|
786
|
-
QueryEditor2 as QueryEditor,
|
|
787
|
-
ScriptToolbar,
|
|
788
|
-
TestPanel
|
|
789
|
-
};
|
|
790
|
-
//# sourceMappingURL=chunk-H46R2RS5.mjs.map
|