@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
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Compiler
|
|
3
|
+
} from "../chunk-2REUEDUA.mjs";
|
|
4
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/index.ts
|
|
7
|
+
import { lazy } from "react";
|
|
8
|
+
|
|
9
|
+
// src/components/NotebookStack/NotebookMenu.tsx
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { DropdownMenu, useTranslation } from "@dxos/react-ui";
|
|
12
|
+
import { meta } from "#meta";
|
|
13
|
+
var NotebookMenu = ({ cell, onCellInsert, onCellDelete }) => {
|
|
14
|
+
const { t } = useTranslation(meta.id);
|
|
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, {
|
|
16
|
+
onClick: () => onCellInsert?.("script", cell?.id)
|
|
17
|
+
}, t("notebook-cell-insert-script.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
18
|
+
onClick: () => onCellInsert?.("prompt", cell?.id)
|
|
19
|
+
}, t("notebook-cell-insert-prompt.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
20
|
+
onClick: () => onCellInsert?.("query", cell?.id)
|
|
21
|
+
}, t("notebook-cell-insert-query.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
22
|
+
onClick: () => onCellInsert?.("markdown", cell?.id)
|
|
23
|
+
}, t("notebook-cell-insert-markdown.label")), cell && onCellDelete && /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
24
|
+
onClick: () => onCellDelete?.(cell.id)
|
|
25
|
+
}, t("notebook-cell-delete.label"))), /* @__PURE__ */ React.createElement(DropdownMenu.Arrow, null)));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/components/NotebookStack/NotebookStack.tsx
|
|
29
|
+
import React4 from "react";
|
|
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";
|
|
32
|
+
import { Stack, StackItem } from "@dxos/react-ui-stack";
|
|
33
|
+
import { meta as meta3 } from "#meta";
|
|
34
|
+
|
|
35
|
+
// src/components/NotebookStack/NotebookCell.tsx
|
|
36
|
+
import React3, { useCallback, useMemo } from "react";
|
|
37
|
+
import { Surface } from "@dxos/app-framework/ui";
|
|
38
|
+
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
39
|
+
import { Obj } from "@dxos/echo";
|
|
40
|
+
import { createDocAccessor } from "@dxos/echo-db";
|
|
41
|
+
import { invariant } from "@dxos/invariant";
|
|
42
|
+
import { TemplateEditor } from "@dxos/plugin-assistant/components";
|
|
43
|
+
import { useThemeContext as useThemeContext2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
44
|
+
import { QueryEditor } from "@dxos/react-ui-components";
|
|
45
|
+
import { Editor } from "@dxos/react-ui-editor";
|
|
46
|
+
import { createBasicExtensions as createBasicExtensions2, createDataExtensions, createMarkdownExtensions, createThemeExtensions as createThemeExtensions2, decorateMarkdown } from "@dxos/ui-editor";
|
|
47
|
+
import { mx } from "@dxos/ui-theme";
|
|
48
|
+
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
49
|
+
import { meta as meta2 } from "#meta";
|
|
50
|
+
|
|
51
|
+
// src/components/TypescriptEditor/TypescriptEditor.tsx
|
|
52
|
+
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
53
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
54
|
+
import { HighlightStyle } from "@codemirror/language";
|
|
55
|
+
import { lintKeymap } from "@codemirror/lint";
|
|
56
|
+
import { Prec } from "@codemirror/state";
|
|
57
|
+
import { keymap } from "@codemirror/view";
|
|
58
|
+
import { tags } from "@lezer/highlight";
|
|
59
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
60
|
+
import { continueKeymap } from "@valtown/codemirror-continue";
|
|
61
|
+
import { tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from "@valtown/codemirror-ts";
|
|
62
|
+
import React2 from "react";
|
|
63
|
+
import { useThemeContext } from "@dxos/react-ui";
|
|
64
|
+
import { composable, composableProps } from "@dxos/react-ui";
|
|
65
|
+
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
66
|
+
import { Domino } from "@dxos/ui";
|
|
67
|
+
import { InputModeExtensions, createBasicExtensions, createThemeExtensions, defaultStyles } from "@dxos/ui-editor";
|
|
68
|
+
import { isNonNullable } from "@dxos/util";
|
|
69
|
+
var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode = "vscode", env, options, initialValue, extensions, scrollTo, selection, ...props }, forwardedRef) => {
|
|
70
|
+
const { themeMode } = useThemeContext();
|
|
71
|
+
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
72
|
+
id,
|
|
73
|
+
initialValue,
|
|
74
|
+
selection,
|
|
75
|
+
scrollTo,
|
|
76
|
+
extensions: [
|
|
77
|
+
extensions,
|
|
78
|
+
createBasicExtensions({
|
|
79
|
+
highlightActiveLine: true,
|
|
80
|
+
indentWithTab: true,
|
|
81
|
+
lineNumbers: true,
|
|
82
|
+
lineWrapping: false,
|
|
83
|
+
scrollPastEnd: role !== "section",
|
|
84
|
+
search: true,
|
|
85
|
+
...options
|
|
86
|
+
}),
|
|
87
|
+
createThemeExtensions({
|
|
88
|
+
monospace: true,
|
|
89
|
+
themeMode,
|
|
90
|
+
syntaxHighlighting: true
|
|
91
|
+
}),
|
|
92
|
+
InputModeExtensions[inputMode],
|
|
93
|
+
javascript({
|
|
94
|
+
typescript: true
|
|
95
|
+
}),
|
|
96
|
+
autocompletion({
|
|
97
|
+
override: env ? [
|
|
98
|
+
tsAutocomplete()
|
|
99
|
+
] : void 0
|
|
100
|
+
}),
|
|
101
|
+
// Continues block comments when pressing Enter.
|
|
102
|
+
Prec.high(keymap.of(continueKeymap)),
|
|
103
|
+
keymap.of(completionKeymap),
|
|
104
|
+
keymap.of(lintKeymap),
|
|
105
|
+
// https://github.com/val-town/codemirror-ts
|
|
106
|
+
env && [
|
|
107
|
+
// TODO(burdon): Fix type.
|
|
108
|
+
tsFacet.of({
|
|
109
|
+
env,
|
|
110
|
+
path: `./src/${id}.ts`
|
|
111
|
+
}),
|
|
112
|
+
tsSync(),
|
|
113
|
+
tsLinter(),
|
|
114
|
+
tsHover({
|
|
115
|
+
renderTooltip: createTooltipRenderer(themeMode)
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
].filter(isNonNullable)
|
|
119
|
+
}), [
|
|
120
|
+
themeMode,
|
|
121
|
+
id,
|
|
122
|
+
extensions,
|
|
123
|
+
inputMode,
|
|
124
|
+
selection,
|
|
125
|
+
scrollTo,
|
|
126
|
+
env
|
|
127
|
+
]);
|
|
128
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
129
|
+
...composableProps(props, {
|
|
130
|
+
classNames,
|
|
131
|
+
...focusAttributes
|
|
132
|
+
}),
|
|
133
|
+
ref: composeRefs(parentRef, forwardedRef)
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
var createTooltipRenderer = (themeMode) => {
|
|
137
|
+
const theme = HighlightStyle.define(themeMode === "dark" ? defaultStyles.dark : defaultStyles.light);
|
|
138
|
+
const classFromKind = (_kind) => {
|
|
139
|
+
const kind = _kind.endsWith("Name") ? "name" : _kind;
|
|
140
|
+
const validTag = kind in tags;
|
|
141
|
+
if (!validTag) {
|
|
142
|
+
return "";
|
|
143
|
+
}
|
|
144
|
+
const tag = tags[kind];
|
|
145
|
+
if (typeof tag === "function") {
|
|
146
|
+
return "";
|
|
147
|
+
}
|
|
148
|
+
return theme.style([
|
|
149
|
+
tag
|
|
150
|
+
]) ?? "";
|
|
151
|
+
};
|
|
152
|
+
return (info) => {
|
|
153
|
+
const children = info.quickInfo?.displayParts?.map(({ kind, text }) => Domino.of("span").classNames(classFromKind(kind)).text(text)) ?? [];
|
|
154
|
+
return {
|
|
155
|
+
dom: Domino.of("div").classNames("xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator").append(...children).root
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/components/NotebookStack/NotebookCell.tsx
|
|
161
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/NotebookStack/NotebookCell.tsx";
|
|
162
|
+
var editorStyles = "p-2 ps-3";
|
|
163
|
+
var valueStyles = "p-1 ps-3";
|
|
164
|
+
var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
165
|
+
const { t } = useTranslation2(meta2.id);
|
|
166
|
+
const extensions = useMemo(() => {
|
|
167
|
+
return cell.source?.target ? [
|
|
168
|
+
createDataExtensions({
|
|
169
|
+
id: cell.id,
|
|
170
|
+
text: createDocAccessor(cell.source.target, [
|
|
171
|
+
"content"
|
|
172
|
+
])
|
|
173
|
+
})
|
|
174
|
+
].filter(isNonNullable2) : [];
|
|
175
|
+
}, [
|
|
176
|
+
cell.source?.target
|
|
177
|
+
]);
|
|
178
|
+
const explorerGraph = cell.graph?.target;
|
|
179
|
+
const handleQueryChange = useCallback((value) => {
|
|
180
|
+
invariant(cell.source?.target, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 38, S: void 0, A: ["cell.source?.target", ""] });
|
|
181
|
+
Obj.update(cell.source.target, (obj) => {
|
|
182
|
+
obj.content = value;
|
|
183
|
+
});
|
|
184
|
+
}, [
|
|
185
|
+
cell
|
|
186
|
+
]);
|
|
187
|
+
switch (cell.type) {
|
|
188
|
+
case "markdown":
|
|
189
|
+
if (!cell.source?.target) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ React3.createElement(NotebookTextEditor, {
|
|
193
|
+
id: cell.id,
|
|
194
|
+
classNames: editorStyles,
|
|
195
|
+
initialValue: cell.source.target.content,
|
|
196
|
+
extensions
|
|
197
|
+
});
|
|
198
|
+
case "script":
|
|
199
|
+
if (!cell.source?.target) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(TypescriptEditor, {
|
|
203
|
+
id: cell.id,
|
|
204
|
+
role: "section",
|
|
205
|
+
classNames: editorStyles,
|
|
206
|
+
initialValue: cell.source.target.content,
|
|
207
|
+
extensions,
|
|
208
|
+
env,
|
|
209
|
+
options: {
|
|
210
|
+
placeholder: t("notebook-cell.placeholder"),
|
|
211
|
+
highlightActiveLine: false,
|
|
212
|
+
lineNumbers: false
|
|
213
|
+
}
|
|
214
|
+
}), /* @__PURE__ */ React3.createElement(NotebookCellValue, {
|
|
215
|
+
cell,
|
|
216
|
+
graph
|
|
217
|
+
}));
|
|
218
|
+
case "query":
|
|
219
|
+
if (!cell.source?.target) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
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, {
|
|
225
|
+
id: cell.id,
|
|
226
|
+
classNames: [
|
|
227
|
+
editorStyles,
|
|
228
|
+
"border-b border-subdued-separator"
|
|
229
|
+
],
|
|
230
|
+
db,
|
|
231
|
+
value: cell.source.target.content,
|
|
232
|
+
onChange: handleQueryChange
|
|
233
|
+
}), explorerGraph && !dragging && /* @__PURE__ */ React3.createElement(Surface.Surface, {
|
|
234
|
+
type: AppSurface.Section,
|
|
235
|
+
limit: 1,
|
|
236
|
+
data: {
|
|
237
|
+
subject: explorerGraph,
|
|
238
|
+
attendableId: cell.id
|
|
239
|
+
}
|
|
240
|
+
}));
|
|
241
|
+
// TODO(burdon): Use streaming response from Chat.
|
|
242
|
+
case "prompt":
|
|
243
|
+
if (!cell.prompt?.target) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(TemplateEditor, {
|
|
247
|
+
id: cell.id,
|
|
248
|
+
source: cell.prompt.target.instructions,
|
|
249
|
+
lineNumbers: false,
|
|
250
|
+
classNames: editorStyles
|
|
251
|
+
}), /* @__PURE__ */ React3.createElement(NotebookPromptResult, {
|
|
252
|
+
cell,
|
|
253
|
+
promptResults
|
|
254
|
+
}));
|
|
255
|
+
default:
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var NotebookCellValue = ({ cell, graph }) => {
|
|
260
|
+
const name = graph?.getExpressions()[cell.id]?.name;
|
|
261
|
+
const value = graph?.getValue(cell.id);
|
|
262
|
+
if (value == null) {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
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", {
|
|
268
|
+
className: "text-success-text"
|
|
269
|
+
}, name), /* @__PURE__ */ React3.createElement("span", {
|
|
270
|
+
className: "text-description"
|
|
271
|
+
}, "\xA0=\xA0")), /* @__PURE__ */ React3.createElement("span", null, value));
|
|
272
|
+
};
|
|
273
|
+
var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
274
|
+
if (!cell.prompt) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
const value = promptResults?.[cell.prompt.uri];
|
|
278
|
+
if (value == null) {
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
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, {
|
|
284
|
+
readOnly: true,
|
|
285
|
+
value
|
|
286
|
+
}));
|
|
287
|
+
};
|
|
288
|
+
var NotebookTextEditor = ({ extensions: extensionsProp, readOnly, ...props }) => {
|
|
289
|
+
const { t } = useTranslation2(meta2.id);
|
|
290
|
+
const { themeMode } = useThemeContext2();
|
|
291
|
+
const extensions = useMemo(() => {
|
|
292
|
+
return [
|
|
293
|
+
createBasicExtensions2({
|
|
294
|
+
placeholder: t("notebook-markdown.placeholder"),
|
|
295
|
+
readOnly
|
|
296
|
+
}),
|
|
297
|
+
createThemeExtensions2({
|
|
298
|
+
themeMode,
|
|
299
|
+
syntaxHighlighting: true
|
|
300
|
+
}),
|
|
301
|
+
createMarkdownExtensions(),
|
|
302
|
+
decorateMarkdown(),
|
|
303
|
+
extensionsProp
|
|
304
|
+
].filter(isNonNullable2);
|
|
305
|
+
}, [
|
|
306
|
+
extensionsProp
|
|
307
|
+
]);
|
|
308
|
+
return /* @__PURE__ */ React3.createElement(Editor.Root, null, /* @__PURE__ */ React3.createElement(Editor.View, {
|
|
309
|
+
...props,
|
|
310
|
+
extensions,
|
|
311
|
+
selectionEnd: true
|
|
312
|
+
}));
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// src/components/NotebookStack/NotebookStack.tsx
|
|
316
|
+
var minSectionHeight = "min-h-[16rem]";
|
|
317
|
+
var NotebookStack = composable2(({ notebook, onRearrange, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {
|
|
318
|
+
const sectionProps = {
|
|
319
|
+
db,
|
|
320
|
+
graph,
|
|
321
|
+
promptResults,
|
|
322
|
+
onCellInsert,
|
|
323
|
+
onCellDelete,
|
|
324
|
+
env
|
|
325
|
+
};
|
|
326
|
+
return /* @__PURE__ */ React4.createElement(Stack, {
|
|
327
|
+
...composableProps2(props),
|
|
328
|
+
orientation: "vertical",
|
|
329
|
+
size: "contain",
|
|
330
|
+
rail: true,
|
|
331
|
+
onRearrange,
|
|
332
|
+
ref: forwardedRef
|
|
333
|
+
}, notebook?.cells.map((cell, i) => /* @__PURE__ */ React4.createElement(NotebookSection, {
|
|
334
|
+
key: i,
|
|
335
|
+
cell,
|
|
336
|
+
...sectionProps
|
|
337
|
+
})));
|
|
338
|
+
});
|
|
339
|
+
var NotebookSection = ({ cell, db, env, promptResults, onCellInsert, onCellDelete, ...props }) => {
|
|
340
|
+
const { t } = useTranslation3(meta3.id);
|
|
341
|
+
const resizable = cell.type === "query";
|
|
342
|
+
return /* @__PURE__ */ React4.createElement(StackItem.Root, {
|
|
343
|
+
role: "section",
|
|
344
|
+
item: cell,
|
|
345
|
+
draggable: true,
|
|
346
|
+
classNames: resizable && minSectionHeight
|
|
347
|
+
}, /* @__PURE__ */ React4.createElement(StackItem.Heading, {
|
|
348
|
+
classNames: "h-full p-1 justify-between dx-attention-surface"
|
|
349
|
+
}, /* @__PURE__ */ React4.createElement(StackItem.DragHandle, {
|
|
350
|
+
asChild: true
|
|
351
|
+
}, /* @__PURE__ */ React4.createElement(IconButton, {
|
|
352
|
+
variant: "ghost",
|
|
353
|
+
icon: "ph--dots-six-vertical--regular",
|
|
354
|
+
iconOnly: true,
|
|
355
|
+
label: "Drag handle"
|
|
356
|
+
})), /* @__PURE__ */ React4.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React4.createElement(DropdownMenu2.Trigger, {
|
|
357
|
+
asChild: true
|
|
358
|
+
}, /* @__PURE__ */ React4.createElement(IconButton, {
|
|
359
|
+
variant: "ghost",
|
|
360
|
+
icon: "ph--dots-three--regular",
|
|
361
|
+
iconOnly: true,
|
|
362
|
+
label: t("notebook-cell-insert.label")
|
|
363
|
+
})), /* @__PURE__ */ React4.createElement(NotebookMenu, {
|
|
364
|
+
cell,
|
|
365
|
+
onCellInsert,
|
|
366
|
+
onCellDelete
|
|
367
|
+
})), resizable && /* @__PURE__ */ React4.createElement(StackItem.ResizeHandle, null)), /* @__PURE__ */ React4.createElement(StackItem.DragPreview, null, ({ item: cell2 }) => /* @__PURE__ */ React4.createElement(StackItem.Content, {
|
|
368
|
+
classNames: "overflow-visible bg-group-surface border border-subdued-separator"
|
|
369
|
+
}, /* @__PURE__ */ React4.createElement(NotebookCell, {
|
|
370
|
+
db,
|
|
371
|
+
cell: cell2,
|
|
372
|
+
env,
|
|
373
|
+
dragging: true
|
|
374
|
+
}))), /* @__PURE__ */ React4.createElement(StackItem.Content, {
|
|
375
|
+
classNames: "overflow-visible"
|
|
376
|
+
}, /* @__PURE__ */ React4.createElement(NotebookCell, {
|
|
377
|
+
db,
|
|
378
|
+
cell,
|
|
379
|
+
env,
|
|
380
|
+
promptResults,
|
|
381
|
+
...props
|
|
382
|
+
})));
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/components/QueryEditor/QueryEditor.tsx
|
|
386
|
+
import React5, { useState } from "react";
|
|
387
|
+
import { ModuleResolutionKind, ScriptTarget } from "typescript";
|
|
388
|
+
import queryApi from "@dxos/echo-query/api.d.ts?raw";
|
|
389
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
390
|
+
var GLOBALS = `
|
|
391
|
+
namespace QueryAPI {
|
|
392
|
+
${queryApi}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
declare global {
|
|
396
|
+
const Query: typeof QueryAPI.Query;
|
|
397
|
+
const Filter: typeof QueryAPI.Filter;
|
|
398
|
+
const Order: typeof QueryAPI.Order;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export {};
|
|
402
|
+
`;
|
|
403
|
+
var QueryEditor2 = (props) => {
|
|
404
|
+
const [compiler, setCompiler] = useState();
|
|
405
|
+
useAsyncEffect(async () => {
|
|
406
|
+
const compiler2 = new Compiler({
|
|
407
|
+
lib: [
|
|
408
|
+
"ES5"
|
|
409
|
+
],
|
|
410
|
+
target: ScriptTarget.ES2022,
|
|
411
|
+
// Avoid `@typescript/vfs`'s deprecated `node10` default (rejected by TS 6).
|
|
412
|
+
moduleResolution: ModuleResolutionKind.Bundler
|
|
413
|
+
});
|
|
414
|
+
await compiler2.initialize(GLOBALS);
|
|
415
|
+
setCompiler(compiler2);
|
|
416
|
+
}, []);
|
|
417
|
+
if (!compiler) {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
return /* @__PURE__ */ React5.createElement(TypescriptEditor, {
|
|
421
|
+
...props,
|
|
422
|
+
env: compiler.environment
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
// src/components/ScriptToolbar/ScriptToolbar.tsx
|
|
427
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
428
|
+
import React6, { useMemo as useMemo2 } from "react";
|
|
429
|
+
import { ElevationProvider, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
430
|
+
import { composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
|
|
431
|
+
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
432
|
+
import { createDeploy, createFormat, createTemplateSelect, useDeployDeps } from "#hooks";
|
|
433
|
+
import { meta as meta4 } from "#meta";
|
|
434
|
+
var ScriptToolbar = composable3(({ script, attendableId, role, state, ...props }, forwardedRef) => {
|
|
435
|
+
const { t } = useTranslation4(meta4.id);
|
|
436
|
+
const options = useDeployDeps({
|
|
437
|
+
script
|
|
438
|
+
});
|
|
439
|
+
const menuCreator = useMemo2(() => createToolbarActions({
|
|
440
|
+
state,
|
|
441
|
+
script,
|
|
442
|
+
t,
|
|
443
|
+
...options
|
|
444
|
+
}), [
|
|
445
|
+
state,
|
|
446
|
+
script,
|
|
447
|
+
options,
|
|
448
|
+
t
|
|
449
|
+
]);
|
|
450
|
+
const menuActions = useMenuActions(menuCreator);
|
|
451
|
+
return /* @__PURE__ */ React6.createElement(ElevationProvider, {
|
|
452
|
+
elevation: role === "section" ? "positioned" : "base"
|
|
453
|
+
}, /* @__PURE__ */ React6.createElement(Menu.Root, {
|
|
454
|
+
...menuActions,
|
|
455
|
+
attendableId
|
|
456
|
+
}, /* @__PURE__ */ React6.createElement(Menu.Toolbar, {
|
|
457
|
+
...composableProps3(props),
|
|
458
|
+
ref: forwardedRef
|
|
459
|
+
})));
|
|
460
|
+
});
|
|
461
|
+
var createToolbarActions = ({ state, script, ...options }) => Atom.make((get) => {
|
|
462
|
+
get(state.atom);
|
|
463
|
+
const templateSelect = createTemplateSelect(script);
|
|
464
|
+
const format = createFormat(script);
|
|
465
|
+
const gap = createGapSeparator();
|
|
466
|
+
const deploy = createDeploy({
|
|
467
|
+
state,
|
|
468
|
+
script,
|
|
469
|
+
...options
|
|
470
|
+
});
|
|
471
|
+
return {
|
|
472
|
+
nodes: [
|
|
473
|
+
...templateSelect.nodes,
|
|
474
|
+
...format.nodes,
|
|
475
|
+
...gap.nodes,
|
|
476
|
+
...deploy.nodes
|
|
477
|
+
],
|
|
478
|
+
edges: [
|
|
479
|
+
...templateSelect.edges,
|
|
480
|
+
...format.edges,
|
|
481
|
+
...gap.edges,
|
|
482
|
+
...deploy.edges
|
|
483
|
+
]
|
|
484
|
+
};
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// src/components/TestPanel/TestPanel.tsx
|
|
488
|
+
import React7, { forwardRef, useRef, useState as useState2 } from "react";
|
|
489
|
+
import { log } from "@dxos/log";
|
|
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";
|
|
492
|
+
import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
493
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
494
|
+
import { meta as meta5 } from "#meta";
|
|
495
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
496
|
+
var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
497
|
+
const { t } = useTranslation5(meta5.id);
|
|
498
|
+
const inputRef = useRef(null);
|
|
499
|
+
const [input, setInput] = useState2("");
|
|
500
|
+
const [state, setState] = useState2(null);
|
|
501
|
+
const [history, setHistory] = useState2([]);
|
|
502
|
+
const scrollerRef = useRef(null);
|
|
503
|
+
const handleScroll = () => {
|
|
504
|
+
if (scrollerRef.current) {
|
|
505
|
+
scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
const handleClear = () => {
|
|
509
|
+
setInput("");
|
|
510
|
+
setHistory([]);
|
|
511
|
+
inputRef.current?.focus();
|
|
512
|
+
};
|
|
513
|
+
const handleResponse = ({ text, data, error } = {}) => {
|
|
514
|
+
setHistory((history2) => [
|
|
515
|
+
...history2,
|
|
516
|
+
{
|
|
517
|
+
type: "response",
|
|
518
|
+
text,
|
|
519
|
+
data,
|
|
520
|
+
error
|
|
521
|
+
}
|
|
522
|
+
]);
|
|
523
|
+
setState(null);
|
|
524
|
+
handleScroll();
|
|
525
|
+
};
|
|
526
|
+
const handleRequest = async (input2) => {
|
|
527
|
+
if (!onInvoke) {
|
|
528
|
+
handleResponse({
|
|
529
|
+
error: new Error("Function not deployed")
|
|
530
|
+
});
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
let data = input2;
|
|
534
|
+
let displayText = input2;
|
|
535
|
+
if (input2.charAt(0) === "{") {
|
|
536
|
+
try {
|
|
537
|
+
const validJsonString = input2.replace(/'/g, '"').replace(/([{,]\s*)([a-zA-Z0-9_]+)(\s*:)/g, '$1"$2"$3');
|
|
538
|
+
data = JSON.parse(validJsonString);
|
|
539
|
+
displayText = JSON.stringify(data, null, 2);
|
|
540
|
+
} catch (err) {
|
|
541
|
+
handleResponse({
|
|
542
|
+
error: new Error("Invalid JSON input")
|
|
543
|
+
});
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
try {
|
|
548
|
+
setState("pending");
|
|
549
|
+
setInput("");
|
|
550
|
+
setHistory((history2) => [
|
|
551
|
+
...history2,
|
|
552
|
+
{
|
|
553
|
+
type: "request",
|
|
554
|
+
text: displayText
|
|
555
|
+
}
|
|
556
|
+
]);
|
|
557
|
+
setTimeout(handleScroll);
|
|
558
|
+
const result = await onInvoke(data);
|
|
559
|
+
if (typeof result === "string") {
|
|
560
|
+
handleResponse({
|
|
561
|
+
text: result
|
|
562
|
+
});
|
|
563
|
+
} else {
|
|
564
|
+
handleResponse({
|
|
565
|
+
data: result
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
} catch (err) {
|
|
569
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
570
|
+
handleResponse({
|
|
571
|
+
error
|
|
572
|
+
});
|
|
573
|
+
log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 90, S: void 0 });
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
577
|
+
...composableProps4(props, {
|
|
578
|
+
classNames: [
|
|
579
|
+
"flex flex-col h-full overflow-hidden",
|
|
580
|
+
classNames
|
|
581
|
+
]
|
|
582
|
+
}),
|
|
583
|
+
ref: forwardedRef
|
|
584
|
+
}, /* @__PURE__ */ React7.createElement(MessageThread, {
|
|
585
|
+
ref: scrollerRef,
|
|
586
|
+
state,
|
|
587
|
+
history
|
|
588
|
+
}), /* @__PURE__ */ React7.createElement(Toolbar.Root, null, /* @__PURE__ */ React7.createElement(Input.Root, null, /* @__PURE__ */ React7.createElement(Input.TextInput, {
|
|
589
|
+
ref: inputRef,
|
|
590
|
+
autoFocus: true,
|
|
591
|
+
placeholder: t("function-request.placeholder"),
|
|
592
|
+
value: input,
|
|
593
|
+
onChange: (ev) => setInput(ev.target.value),
|
|
594
|
+
onKeyDown: (ev) => ev.key === "Enter" && handleRequest(input)
|
|
595
|
+
})), /* @__PURE__ */ React7.createElement(Toolbar.IconButton, {
|
|
596
|
+
icon: "ph--play--regular",
|
|
597
|
+
label: "Execute",
|
|
598
|
+
iconOnly: true,
|
|
599
|
+
onClick: () => handleRequest(input)
|
|
600
|
+
}), /* @__PURE__ */ React7.createElement(Toolbar.IconButton, {
|
|
601
|
+
icon: "ph--trash--regular",
|
|
602
|
+
label: "Clear",
|
|
603
|
+
iconOnly: true,
|
|
604
|
+
onClick: handleClear
|
|
605
|
+
})));
|
|
606
|
+
});
|
|
607
|
+
var MessageThread = /* @__PURE__ */ forwardRef(({ state, history }, forwardedRef) => {
|
|
608
|
+
return /* @__PURE__ */ React7.createElement(ScrollArea.Root, {
|
|
609
|
+
orientation: "vertical",
|
|
610
|
+
classNames: "h-full",
|
|
611
|
+
ref: forwardedRef
|
|
612
|
+
}, /* @__PURE__ */ React7.createElement(ScrollArea.Viewport, {
|
|
613
|
+
classNames: "gap-6 p-2"
|
|
614
|
+
}, history.map((message, i) => /* @__PURE__ */ React7.createElement("div", {
|
|
615
|
+
key: i,
|
|
616
|
+
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
617
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
618
|
+
className: "p-1"
|
|
619
|
+
}, message.type === "response" && /* @__PURE__ */ React7.createElement(RobotAvatar, null)), /* @__PURE__ */ React7.createElement("div", {
|
|
620
|
+
className: "overflow-auto"
|
|
621
|
+
}, /* @__PURE__ */ React7.createElement(MessageItem, {
|
|
622
|
+
message
|
|
623
|
+
})))), state === "pending" && /* @__PURE__ */ React7.createElement("div", {
|
|
624
|
+
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
625
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
626
|
+
className: "p-1"
|
|
627
|
+
}, /* @__PURE__ */ React7.createElement(Icon, {
|
|
628
|
+
icon: "ph--spinner--regular",
|
|
629
|
+
size: 6,
|
|
630
|
+
classNames: "animate-spin"
|
|
631
|
+
})))));
|
|
632
|
+
});
|
|
633
|
+
var MessageItem = ({ classNames, message }) => {
|
|
634
|
+
const { type, text, data, error } = message;
|
|
635
|
+
const wrapper = "p-1 px-2 rounded-md bg-hover-surface overflow-auto";
|
|
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, {
|
|
643
|
+
data,
|
|
644
|
+
classNames: mx2(wrapper, "text-xs")
|
|
645
|
+
}));
|
|
646
|
+
};
|
|
647
|
+
var RobotAvatar = () => /* @__PURE__ */ React7.createElement(Avatar.Root, null, /* @__PURE__ */ React7.createElement(Avatar.Content, {
|
|
648
|
+
size: 6,
|
|
649
|
+
variant: "circle",
|
|
650
|
+
icon: "ph--drone--regular"
|
|
651
|
+
}));
|
|
652
|
+
|
|
653
|
+
// src/components/index.ts
|
|
654
|
+
var ScriptPluginSettings = lazy(() => import("../ScriptPluginSettings-T4JMUSHN.mjs"));
|
|
655
|
+
export {
|
|
656
|
+
NotebookMenu,
|
|
657
|
+
NotebookStack,
|
|
658
|
+
QueryEditor2 as QueryEditor,
|
|
659
|
+
ScriptPluginSettings,
|
|
660
|
+
ScriptToolbar,
|
|
661
|
+
TestPanel,
|
|
662
|
+
TypescriptEditor
|
|
663
|
+
};
|
|
664
|
+
//# sourceMappingURL=index.mjs.map
|