@dxos/plugin-script 0.8.4-main.406dc2a → 0.8.4-main.4a85c3132b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -13
- package/dist/lib/browser/DeploymentDialog-IIOXAS47.mjs +138 -0
- package/dist/lib/browser/DeploymentDialog-IIOXAS47.mjs.map +7 -0
- package/dist/lib/browser/{NotebookContainer-LVGRPFY3.mjs → NotebookContainer-VVZOKGRC.mjs} +367 -200
- package/dist/lib/browser/NotebookContainer-VVZOKGRC.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs +93 -0
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs.map +7 -0
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs +294 -0
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs.map +7 -0
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs +55 -0
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs +28 -0
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs +39 -0
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +69 -0
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-6IXFDTAI.mjs +113 -0
- package/dist/lib/browser/chunk-6IXFDTAI.mjs.map +7 -0
- package/dist/lib/browser/chunk-ATTZUDT7.mjs +67 -0
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +7 -0
- package/dist/lib/browser/chunk-G3XIOLLI.mjs +174 -0
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/{chunk-ST3ACVUC.mjs → chunk-J7PGML5B.mjs} +29 -12
- package/dist/lib/browser/chunk-J7PGML5B.mjs.map +7 -0
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs +397 -0
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-PLDBKKYO.mjs +789 -0
- package/dist/lib/browser/chunk-PLDBKKYO.mjs.map +7 -0
- package/dist/lib/browser/chunk-Q66L5EUR.mjs +20 -0
- package/dist/lib/browser/chunk-Q66L5EUR.mjs.map +7 -0
- package/dist/lib/browser/chunk-TW27W3EL.mjs +29 -0
- package/dist/lib/browser/chunk-TW27W3EL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EZVXV6DA.mjs → chunk-WYR4QHPE.mjs} +7 -2
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs +11 -0
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs.map +7 -0
- package/dist/lib/browser/compiler-53G6ZHQM.mjs +99 -0
- package/dist/lib/browser/compiler-53G6ZHQM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +111 -140
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs +79 -0
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs.map +7 -0
- package/dist/lib/browser/react-surface-26P6HAFD.mjs +141 -0
- package/dist/lib/browser/react-surface-26P6HAFD.mjs.map +7 -0
- package/dist/lib/browser/settings-76UM7442.mjs +36 -0
- package/dist/lib/browser/settings-76UM7442.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +2 -1
- package/dist/lib/browser/types/index.mjs +12 -7
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs +139 -0
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-QY5NJGJI.mjs → NotebookContainer-ZLWTNMQA.mjs} +367 -200
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs +94 -0
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs +295 -0
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs +56 -0
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs +29 -0
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs +40 -0
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +70 -0
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs +176 -0
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OG2SIKHE.mjs → chunk-5HSJPAK7.mjs} +7 -2
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs +790 -0
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs +69 -0
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2GVTWESW.mjs → chunk-QG6ANK4B.mjs} +29 -12
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs +31 -0
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs +22 -0
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs +12 -0
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs +114 -0
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs +398 -0
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs +100 -0
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +111 -140
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-THCIK266.mjs +142 -0
- package/dist/lib/node-esm/react-surface-THCIK266.mjs.map +7 -0
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs +37 -0
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +2 -1
- package/dist/lib/node-esm/types/index.mjs +12 -7
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/index.d.ts +3 -0
- package/dist/types/src/capabilities/compiler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +10 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +4 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +5 -4
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +8 -8
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +5 -4
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts +0 -1
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +2 -4
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/{components/NotebookContainer.stories.d.ts → containers/DeploymentDialog/DeploymentDialog.stories.d.ts} +7 -6
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +3 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +10 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +7 -0
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +8 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/index.d.ts +3 -0
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +9 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/e2e/ai.test.d.ts +2 -0
- package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
- package/dist/types/src/e2e/deploy.test.d.ts +2 -0
- package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
- package/dist/types/src/hooks/deploy.d.ts +17 -31
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +5 -4
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +7 -16
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +58 -0
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts +2 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/notebook/eval.d.ts +1 -1
- package/dist/types/src/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/index.d.ts +1 -1
- package/dist/types/src/notebook/index.d.ts.map +1 -1
- package/dist/types/src/templates/anthropic.d.ts +8 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +16 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +16 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- package/dist/types/src/templates/forex-effect.d.ts +4 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +4 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +12 -3
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +2 -18
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +4 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +108 -0
- package/dist/types/src/types/Notebook.d.ts.map +1 -0
- package/dist/types/src/types/actions.d.ts +30 -56
- package/dist/types/src/types/actions.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +6 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/util/deploy.d.ts +4 -4
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +3 -3
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +114 -82
- package/src/ScriptPlugin.tsx +45 -87
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +31 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +56 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +97 -95
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/compiler/compiler.ts +103 -0
- package/src/capabilities/compiler/index.ts +7 -0
- package/src/capabilities/index.ts +6 -10
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +75 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +121 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +33 -0
- package/src/compiler/compiler.ts +10 -3
- package/src/components/FrameContainer/FrameContainer.tsx +6 -5
- package/src/components/FrameContainer/frame.html +21 -21
- package/src/components/NotebookStack/NotebookCell.tsx +85 -87
- package/src/components/NotebookStack/NotebookStack.stories.tsx +32 -10
- package/src/components/NotebookStack/NotebookStack.tsx +16 -9
- package/src/components/QueryEditor/QueryEditor.stories.tsx +102 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +42 -20
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +28 -31
- package/src/components/TestPanel/TestPanel.tsx +61 -36
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +25 -18
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +70 -74
- package/src/components/index.ts +4 -9
- package/src/constants.ts +7 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +61 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +99 -0
- package/src/containers/DeploymentDialog/index.ts +7 -0
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +87 -0
- package/src/containers/NotebookContainer/NotebookContainer.tsx +268 -0
- package/src/containers/NotebookContainer/index.ts +7 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +84 -0
- package/src/containers/ScriptContainer/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx +55 -50
- package/src/containers/ScriptObjectSettings/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptPluginSettings}/ScriptPluginSettings.tsx +19 -14
- package/src/containers/ScriptPluginSettings/index.ts +7 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +33 -0
- package/src/containers/ScriptProperties/index.ts +7 -0
- package/src/containers/TestContainer/TestContainer.tsx +28 -0
- package/src/containers/TestContainer/index.ts +7 -0
- package/src/containers/index.ts +13 -0
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +43 -35
- package/src/hooks/format.ts +8 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +22 -26
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +14 -16
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -1
- package/src/meta.ts +8 -4
- package/src/notebook/{notebook.test.ts → compute-graph.test.ts} +31 -19
- package/src/notebook/{notebook.ts → compute-graph.ts} +65 -18
- package/src/notebook/eval.ts +1 -1
- package/src/notebook/index.ts +1 -1
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +231 -0
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/forex-effect.ts +22 -27
- package/src/templates/forex.ts +7 -6
- package/src/templates/gmail.ts +1 -2
- package/src/templates/index.ts +18 -5
- package/src/templates/ping.ts +14 -5
- package/src/testing/data.ts +34 -9
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +4 -3
- package/src/types/Notebook.ts +41 -0
- package/src/types/actions.ts +18 -26
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +4 -1
- package/src/types/types.ts +15 -0
- package/src/util/deploy.ts +30 -40
- package/src/util/functions.ts +32 -28
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-65TWT6S5.mjs +0 -13
- package/dist/lib/browser/NotebookContainer-LVGRPFY3.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-LRTRN7JW.mjs +0 -149
- package/dist/lib/browser/ScriptContainer-LRTRN7JW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DPYULSME.mjs +0 -65
- package/dist/lib/browser/app-graph-builder-DPYULSME.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-ET5KZ46I.mjs +0 -28
- package/dist/lib/browser/blueprint-definition-ET5KZ46I.mjs.map +0 -7
- package/dist/lib/browser/chunk-5CYLWXRH.mjs +0 -89
- package/dist/lib/browser/chunk-5CYLWXRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-75LH4EUR.mjs +0 -326
- package/dist/lib/browser/chunk-75LH4EUR.mjs.map +0 -7
- package/dist/lib/browser/chunk-E7DXDICD.mjs +0 -282
- package/dist/lib/browser/chunk-E7DXDICD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZVXV6DA.mjs.map +0 -7
- package/dist/lib/browser/chunk-I3QSGUFJ.mjs +0 -646
- package/dist/lib/browser/chunk-I3QSGUFJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO2O7W6J.mjs +0 -254
- package/dist/lib/browser/chunk-JO2O7W6J.mjs.map +0 -7
- package/dist/lib/browser/chunk-N6M34EUC.mjs +0 -112
- package/dist/lib/browser/chunk-N6M34EUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-NM4WQS4F.mjs +0 -153
- package/dist/lib/browser/chunk-NM4WQS4F.mjs.map +0 -7
- package/dist/lib/browser/chunk-OKXN2N7M.mjs +0 -15
- package/dist/lib/browser/chunk-OKXN2N7M.mjs.map +0 -7
- package/dist/lib/browser/chunk-ST3ACVUC.mjs.map +0 -7
- package/dist/lib/browser/compiler-G2N2CG63.mjs +0 -98
- package/dist/lib/browser/compiler-G2N2CG63.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JLU7DVLQ.mjs +0 -105
- package/dist/lib/browser/intent-resolver-JLU7DVLQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-76SDTUYG.mjs +0 -127
- package/dist/lib/browser/react-surface-76SDTUYG.mjs.map +0 -7
- package/dist/lib/browser/settings-ERFKVNUK.mjs +0 -25
- package/dist/lib/browser/settings-ERFKVNUK.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-I63ZC2HH.mjs +0 -14
- package/dist/lib/node-esm/NotebookContainer-QY5NJGJI.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-SVXCSLNH.mjs +0 -150
- package/dist/lib/node-esm/ScriptContainer-SVXCSLNH.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-UXJGHXSL.mjs +0 -66
- package/dist/lib/node-esm/app-graph-builder-UXJGHXSL.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-AIYFOT7Q.mjs +0 -30
- package/dist/lib/node-esm/blueprint-definition-AIYFOT7Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2GVTWESW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4X375PGY.mjs +0 -90
- package/dist/lib/node-esm/chunk-4X375PGY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-67OVZHI3.mjs +0 -327
- package/dist/lib/node-esm/chunk-67OVZHI3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C2ORIPKH.mjs +0 -154
- package/dist/lib/node-esm/chunk-C2ORIPKH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NUXZQQ6P.mjs +0 -16
- package/dist/lib/node-esm/chunk-NUXZQQ6P.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OG2SIKHE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SMFPSKQT.mjs +0 -647
- package/dist/lib/node-esm/chunk-SMFPSKQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VRSDE4CI.mjs +0 -114
- package/dist/lib/node-esm/chunk-VRSDE4CI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VZAFGLD7.mjs +0 -283
- package/dist/lib/node-esm/chunk-VZAFGLD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YW36TZ7K.mjs +0 -255
- package/dist/lib/node-esm/chunk-YW36TZ7K.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-PLDAZ5GJ.mjs +0 -99
- package/dist/lib/node-esm/compiler-PLDAZ5GJ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-SFGTIFOG.mjs +0 -106
- package/dist/lib/node-esm/intent-resolver-SFGTIFOG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SHEBNW4R.mjs +0 -128
- package/dist/lib/node-esm/react-surface-SHEBNW4R.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5TYXQ42N.mjs +0 -26
- package/dist/lib/node-esm/settings-5TYXQ42N.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler.d.ts +0 -4
- package/dist/types/src/capabilities/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -251
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.d.ts +0 -10
- package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -12
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -3
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +0 -8
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/notebook/notebook.d.ts +0 -35
- package/dist/types/src/notebook/notebook.d.ts.map +0 -1
- package/dist/types/src/notebook/notebook.test.d.ts +0 -2
- package/dist/types/src/notebook/notebook.test.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -61
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -65
- package/src/capabilities/blueprint-definition.ts +0 -30
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -34
- package/src/capabilities/intent-resolver.ts +0 -87
- package/src/capabilities/react-surface.tsx +0 -102
- package/src/capabilities/settings.ts +0 -21
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -53
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -106
- package/src/components/DeploymentDialog/index.ts +0 -9
- package/src/components/NotebookContainer.stories.tsx +0 -32
- package/src/components/NotebookContainer.tsx +0 -124
- package/src/components/ScriptContainer.tsx +0 -69
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -27
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- package/src/types/schema.ts +0 -48
- /package/dist/lib/browser/{DeploymentDialog-65TWT6S5.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-I63ZC2HH.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { ScriptTarget } from 'typescript';
|
|
7
|
+
|
|
8
|
+
import queryApi from '@dxos/echo-query/api.d.ts?raw';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { Compiler } from '../../compiler';
|
|
12
|
+
import { TypescriptEditor, type TypescriptEditorProps } from '../TypescriptEditor';
|
|
13
|
+
|
|
14
|
+
const GLOBALS = `
|
|
15
|
+
namespace QueryAPI {
|
|
16
|
+
${queryApi}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare global {
|
|
20
|
+
const Query: typeof QueryAPI.Query;
|
|
21
|
+
const Filter: typeof QueryAPI.Filter;
|
|
22
|
+
const Order: typeof QueryAPI.Order;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {};
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export type QueryEditorProps = Omit<TypescriptEditorProps, 'env'>;
|
|
29
|
+
|
|
30
|
+
export const QueryEditor = (props: QueryEditorProps) => {
|
|
31
|
+
const [compiler, setCompiler] = useState<Compiler>();
|
|
32
|
+
|
|
33
|
+
useAsyncEffect(async () => {
|
|
34
|
+
const compiler = new Compiler({
|
|
35
|
+
lib: ['ES5'],
|
|
36
|
+
target: ScriptTarget.ES2022,
|
|
37
|
+
});
|
|
38
|
+
await compiler.initialize(GLOBALS);
|
|
39
|
+
setCompiler(compiler);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
if (!compiler) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return <TypescriptEditor {...props} env={compiler.environment} />;
|
|
47
|
+
};
|
|
@@ -2,46 +2,68 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
5
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
6
8
|
|
|
7
|
-
import {
|
|
9
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
8
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
-
import {
|
|
10
|
-
import { ScriptType } from '@dxos/functions';
|
|
11
|
+
import { Script } from '@dxos/functions';
|
|
11
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
12
13
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
|
-
import { DataType } from '@dxos/schema';
|
|
14
14
|
|
|
15
|
+
import { type ScriptToolbarState, type ScriptToolbarStateStore } from '../../hooks';
|
|
15
16
|
import { translations } from '../../translations';
|
|
16
17
|
|
|
17
18
|
import { ScriptToolbar } from './ScriptToolbar';
|
|
18
19
|
|
|
20
|
+
// Create a mock store for stories.
|
|
21
|
+
const createMockStore = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {
|
|
22
|
+
const registry = Registry.make();
|
|
23
|
+
const atom = Atom.make<ScriptToolbarState>(initialState);
|
|
24
|
+
return {
|
|
25
|
+
atom,
|
|
26
|
+
get value() {
|
|
27
|
+
return registry.get(atom);
|
|
28
|
+
},
|
|
29
|
+
update: (updater) => registry.set(atom, updater(registry.get(atom))),
|
|
30
|
+
set: (key, value) => registry.set(atom, { ...registry.get(atom), [key]: value }),
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const ScriptToolbarStory = () => {
|
|
35
|
+
const state = useMemo(() => createMockStore(), []);
|
|
36
|
+
const script = useMemo(
|
|
37
|
+
() =>
|
|
38
|
+
Script.make({
|
|
39
|
+
name: 'test',
|
|
40
|
+
description: 'test',
|
|
41
|
+
source: 'test',
|
|
42
|
+
}),
|
|
43
|
+
[],
|
|
44
|
+
);
|
|
45
|
+
return <ScriptToolbar state={state} script={script} />;
|
|
46
|
+
};
|
|
47
|
+
|
|
19
48
|
const meta = {
|
|
20
|
-
title: 'plugins/plugin-script/Toolbar',
|
|
21
|
-
component:
|
|
49
|
+
title: 'plugins/plugin-script/components/Toolbar',
|
|
50
|
+
component: ScriptToolbarStory,
|
|
22
51
|
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
23
52
|
decorators: [
|
|
24
|
-
withTheme,
|
|
25
|
-
withLayout({ classNames: '
|
|
26
|
-
withPluginManager({
|
|
53
|
+
withTheme(),
|
|
54
|
+
withLayout({ classNames: 'w-prose-max-width' }),
|
|
55
|
+
withPluginManager({
|
|
56
|
+
plugins: [OperationPlugin(), RuntimePlugin(), ClientPlugin({})],
|
|
57
|
+
}),
|
|
27
58
|
],
|
|
28
59
|
parameters: {
|
|
29
60
|
layout: 'centered',
|
|
30
61
|
translations,
|
|
31
62
|
},
|
|
32
|
-
} satisfies Meta<typeof
|
|
63
|
+
} satisfies Meta<typeof ScriptToolbarStory>;
|
|
33
64
|
|
|
34
65
|
export default meta;
|
|
35
66
|
|
|
36
67
|
type Story = StoryObj<typeof meta>;
|
|
37
68
|
|
|
38
|
-
export const Default: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
state: {},
|
|
41
|
-
script: Obj.make(ScriptType, {
|
|
42
|
-
name: 'test',
|
|
43
|
-
description: 'test',
|
|
44
|
-
source: Ref.make(DataType.makeText('test')),
|
|
45
|
-
}),
|
|
46
|
-
},
|
|
47
|
-
};
|
|
69
|
+
export const Default: Story = {};
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ElevationProvider,
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type Script } from '@dxos/functions';
|
|
10
|
+
import { ElevationProvider, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import {
|
|
12
12
|
type ActionGraphProps,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
Menu,
|
|
14
|
+
type MenuRootProps,
|
|
15
15
|
createGapSeparator,
|
|
16
|
-
rxFromSignal,
|
|
17
16
|
useMenuActions,
|
|
18
17
|
} from '@dxos/react-ui-menu';
|
|
19
18
|
|
|
20
19
|
import {
|
|
21
20
|
type CreateDeployOptions,
|
|
22
|
-
type
|
|
21
|
+
type ScriptToolbarStateStore,
|
|
23
22
|
createDeploy,
|
|
24
23
|
createFormat,
|
|
25
24
|
createTemplateSelect,
|
|
@@ -27,13 +26,13 @@ import {
|
|
|
27
26
|
} from '../../hooks';
|
|
28
27
|
import { meta } from '../../meta';
|
|
29
28
|
|
|
30
|
-
export type ScriptToolbarProps =
|
|
29
|
+
export type ScriptToolbarProps = Partial<MenuRootProps> & {
|
|
31
30
|
role?: string;
|
|
32
|
-
script:
|
|
33
|
-
state:
|
|
34
|
-
}
|
|
31
|
+
script: Script.Script;
|
|
32
|
+
state: ScriptToolbarStateStore;
|
|
33
|
+
};
|
|
35
34
|
|
|
36
|
-
export const ScriptToolbar = ({ script, role, state,
|
|
35
|
+
export const ScriptToolbar = ({ script, role, state, ...props }: ScriptToolbarProps) => {
|
|
37
36
|
const { t } = useTranslation(meta.id);
|
|
38
37
|
const options = useDeployDeps({ script });
|
|
39
38
|
const menu = useMemo(() => createToolbarActions({ state, script, t, ...options }), [state, script, options, t]);
|
|
@@ -41,25 +40,23 @@ export const ScriptToolbar = ({ script, role, state, classNames }: ScriptToolbar
|
|
|
41
40
|
|
|
42
41
|
return (
|
|
43
42
|
<ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
</
|
|
43
|
+
<Menu.Root {...props} {...actions} attendableId={Obj.getDXN(script).toString()}>
|
|
44
|
+
<Menu.Toolbar />
|
|
45
|
+
</Menu.Root>
|
|
47
46
|
</ElevationProvider>
|
|
48
47
|
);
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
const createToolbarActions = ({ state, script, ...options }: CreateDeployOptions):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
);
|
|
50
|
+
const createToolbarActions = ({ state, script, ...options }: CreateDeployOptions): Atom.Atom<ActionGraphProps> =>
|
|
51
|
+
Atom.make((get) => {
|
|
52
|
+
// Subscribe to state changes.
|
|
53
|
+
get(state.atom);
|
|
54
|
+
const templateSelect = createTemplateSelect(script);
|
|
55
|
+
const format = createFormat(script);
|
|
56
|
+
const gap = createGapSeparator();
|
|
57
|
+
const deploy = createDeploy({ state, script, ...options });
|
|
58
|
+
return {
|
|
59
|
+
nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes],
|
|
60
|
+
edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import {
|
|
10
|
+
import { mx } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
12
|
import { meta } from '../../meta';
|
|
13
13
|
|
|
@@ -16,7 +16,12 @@ type State = 'pending' | 'responding';
|
|
|
16
16
|
/**
|
|
17
17
|
* Request or response.
|
|
18
18
|
*/
|
|
19
|
-
type Message = {
|
|
19
|
+
type Message = {
|
|
20
|
+
type: 'request' | 'response';
|
|
21
|
+
text?: string;
|
|
22
|
+
data?: any;
|
|
23
|
+
error?: Error;
|
|
24
|
+
};
|
|
20
25
|
|
|
21
26
|
export type TestPanelProps = ThemedClassName<{
|
|
22
27
|
functionUrl?: string;
|
|
@@ -61,7 +66,15 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
61
66
|
inputRef.current?.focus();
|
|
62
67
|
};
|
|
63
68
|
|
|
64
|
-
const handleResponse = ({
|
|
69
|
+
const handleResponse = ({
|
|
70
|
+
text,
|
|
71
|
+
data,
|
|
72
|
+
error,
|
|
73
|
+
}: {
|
|
74
|
+
text?: string;
|
|
75
|
+
data?: any;
|
|
76
|
+
error?: Error;
|
|
77
|
+
} = {}) => {
|
|
65
78
|
controller.current = null;
|
|
66
79
|
setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);
|
|
67
80
|
setResult('');
|
|
@@ -108,7 +121,9 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
108
121
|
// Check for error.
|
|
109
122
|
if (!response.ok) {
|
|
110
123
|
const text = await response.text();
|
|
111
|
-
handleResponse({
|
|
124
|
+
handleResponse({
|
|
125
|
+
error: new Error(text || response.statusText || String(response.status)),
|
|
126
|
+
});
|
|
112
127
|
return;
|
|
113
128
|
}
|
|
114
129
|
|
|
@@ -163,7 +178,7 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
163
178
|
{/* TODO(burdon): Replace with Thread. */}
|
|
164
179
|
<MessageThread ref={scrollerRef} state={state} result={result} history={history} />
|
|
165
180
|
{/* TODO(burdon): Replace with Form based on the function's input schema. */}
|
|
166
|
-
<Toolbar.Root
|
|
181
|
+
<Toolbar.Root>
|
|
167
182
|
<Input.Root>
|
|
168
183
|
<Input.TextInput
|
|
169
184
|
ref={inputRef}
|
|
@@ -174,12 +189,20 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
174
189
|
onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
|
|
175
190
|
/>
|
|
176
191
|
</Input.Root>
|
|
177
|
-
<Toolbar.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
<Toolbar.IconButton
|
|
193
|
+
icon='ph--play--regular'
|
|
194
|
+
size={4}
|
|
195
|
+
label='Execute'
|
|
196
|
+
iconOnly
|
|
197
|
+
onClick={() => handleRequest(input)}
|
|
198
|
+
/>
|
|
199
|
+
<Toolbar.IconButton
|
|
200
|
+
icon={state ? 'ph--stop--regular' : 'ph--trash--regular'}
|
|
201
|
+
size={4}
|
|
202
|
+
label={state ? 'Stop' : 'Clear'}
|
|
203
|
+
iconOnly
|
|
204
|
+
onClick={() => (state ? handleStop() : handleClear())}
|
|
205
|
+
/>
|
|
183
206
|
</Toolbar.Root>
|
|
184
207
|
</div>
|
|
185
208
|
);
|
|
@@ -196,42 +219,44 @@ type MessageThreadProps = {
|
|
|
196
219
|
const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
197
220
|
({ state, history, result }: MessageThreadProps, forwardedRef) => {
|
|
198
221
|
return (
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<div className='
|
|
203
|
-
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
))}
|
|
208
|
-
|
|
209
|
-
{result?.length > 0 && (
|
|
210
|
-
<div className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
211
|
-
<div className='p-1'>
|
|
212
|
-
{(state === 'pending' && <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />) || (
|
|
213
|
-
<Icon icon='ph--robot--regular' size={6} classNames='animate-[pulse_1s_ease-in-out_infinite]' />
|
|
214
|
-
)}
|
|
222
|
+
<ScrollArea.Root orientation='vertical' classNames='h-full' ref={forwardedRef}>
|
|
223
|
+
<ScrollArea.Viewport classNames='gap-6 p-2'>
|
|
224
|
+
{history.map((message, i) => (
|
|
225
|
+
<div key={i} className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
226
|
+
<div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>
|
|
227
|
+
<div className='overflow-auto'>
|
|
228
|
+
<MessageItem message={message} />
|
|
229
|
+
</div>
|
|
215
230
|
</div>
|
|
216
|
-
|
|
217
|
-
|
|
231
|
+
))}
|
|
232
|
+
|
|
233
|
+
{result?.length > 0 && (
|
|
234
|
+
<div className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
235
|
+
<div className='p-1'>
|
|
236
|
+
{(state === 'pending' && <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />) || (
|
|
237
|
+
<Icon icon='ph--robot--regular' size={6} classNames='animate-[pulse_1s_ease-in-out_infinite]' />
|
|
238
|
+
)}
|
|
239
|
+
</div>
|
|
240
|
+
<div className='overflow-auto'>
|
|
241
|
+
<MessageItem message={{ type: 'response', text: result }} />
|
|
242
|
+
</div>
|
|
218
243
|
</div>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
</
|
|
244
|
+
)}
|
|
245
|
+
</ScrollArea.Viewport>
|
|
246
|
+
</ScrollArea.Root>
|
|
222
247
|
);
|
|
223
248
|
},
|
|
224
249
|
);
|
|
225
250
|
|
|
226
251
|
const MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {
|
|
227
252
|
const { type, text, data, error } = message;
|
|
228
|
-
const wrapper = 'p-1 px-2 rounded-md bg-
|
|
253
|
+
const wrapper = 'p-1 px-2 rounded-md bg-hover-surface overflow-auto';
|
|
229
254
|
return (
|
|
230
255
|
<div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>
|
|
231
|
-
{error && <div className={mx(wrapper, 'whitespace-pre'
|
|
256
|
+
{error && <div className={mx(wrapper, 'whitespace-pre text-error-text')}>{String(error)}</div>}
|
|
232
257
|
|
|
233
258
|
{text !== undefined && (
|
|
234
|
-
<div className={mx(wrapper, type === 'request' && 'bg-primary-
|
|
259
|
+
<div className={mx(wrapper, type === 'request' && 'bg-primary-500 dark:bg-primary-600')}>
|
|
235
260
|
{text || '\u00D8'}
|
|
236
261
|
</div>
|
|
237
262
|
)}
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
9
|
import { createObject } from '@dxos/react-client/echo';
|
|
10
|
-
import { Toolbar } from '@dxos/react-ui';
|
|
10
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
11
11
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
|
-
import { createDataExtensions } from '@dxos/react-ui-editor';
|
|
13
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
14
12
|
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
13
|
+
import { createDataExtensions } from '@dxos/ui-editor';
|
|
15
14
|
import { trim } from '@dxos/util';
|
|
16
15
|
|
|
17
16
|
import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';
|
|
@@ -25,7 +24,7 @@ const DefaultStory = (props: TypescriptEditorProps) => {
|
|
|
25
24
|
const [result, setResult] = useState<object | undefined>({});
|
|
26
25
|
|
|
27
26
|
// TODO(burdon): Make this work.
|
|
28
|
-
// const object = useMemo(() =>
|
|
27
|
+
// const object = useMemo(() => Text.make(templates[1].source), []);
|
|
29
28
|
// const script = useMemo(
|
|
30
29
|
// () =>
|
|
31
30
|
// Obj.make(ScriptType, {
|
|
@@ -35,7 +34,12 @@ const DefaultStory = (props: TypescriptEditorProps) => {
|
|
|
35
34
|
// );
|
|
36
35
|
|
|
37
36
|
const extensions = useMemo(
|
|
38
|
-
() => [
|
|
37
|
+
() => [
|
|
38
|
+
createDataExtensions({
|
|
39
|
+
id: object.id,
|
|
40
|
+
text: createDocAccessor(object, ['content']),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
39
43
|
[],
|
|
40
44
|
);
|
|
41
45
|
|
|
@@ -61,24 +65,27 @@ const DefaultStory = (props: TypescriptEditorProps) => {
|
|
|
61
65
|
}, [object]);
|
|
62
66
|
|
|
63
67
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
<Panel.Root>
|
|
69
|
+
<Panel.Toolbar asChild>
|
|
70
|
+
<Toolbar.Root>
|
|
71
|
+
<Toolbar.Button onClick={handleRun}>Run</Toolbar.Button>
|
|
72
|
+
</Toolbar.Root>
|
|
73
|
+
</Panel.Toolbar>
|
|
74
|
+
<Panel.Content>
|
|
75
|
+
<div role='none' className='grid grid-rows-[1fr_min-content] h-full overflow-hidden text-sm'>
|
|
76
|
+
<TypescriptEditor {...props} initialValue={object.content} extensions={extensions} />
|
|
77
|
+
<Json data={result} classNames='shrink-0 p-2 border-y border-subdued-separator' />
|
|
78
|
+
</div>
|
|
79
|
+
</Panel.Content>
|
|
80
|
+
</Panel.Root>
|
|
74
81
|
);
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
const meta = {
|
|
78
|
-
title: 'plugins/plugin-script/TypescriptEditor',
|
|
85
|
+
title: 'plugins/plugin-script/components/TypescriptEditor',
|
|
79
86
|
component: TypescriptEditor,
|
|
80
87
|
render: DefaultStory,
|
|
81
|
-
decorators: [withTheme, withLayout({
|
|
88
|
+
decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'w-prose-max-width' })],
|
|
82
89
|
} satisfies Meta<typeof DefaultStory>;
|
|
83
90
|
|
|
84
91
|
export default meta;
|
|
@@ -12,20 +12,20 @@ import { tags } from '@lezer/highlight';
|
|
|
12
12
|
import { type VirtualTypeScriptEnvironment } from '@typescript/vfs';
|
|
13
13
|
import { continueKeymap } from '@valtown/codemirror-continue';
|
|
14
14
|
import { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';
|
|
15
|
-
import React from 'react';
|
|
15
|
+
import React, { memo } from 'react';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
18
|
+
import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
|
|
19
|
+
import { Domino } from '@dxos/ui';
|
|
18
20
|
import {
|
|
19
21
|
type BasicExtensionsOptions,
|
|
20
22
|
type EditorInputMode,
|
|
21
23
|
InputModeExtensions,
|
|
22
|
-
type UseTextEditorProps,
|
|
23
24
|
createBasicExtensions,
|
|
24
25
|
createThemeExtensions,
|
|
25
26
|
defaultStyles,
|
|
26
|
-
|
|
27
|
-
} from '@dxos/
|
|
28
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
27
|
+
} from '@dxos/ui-editor';
|
|
28
|
+
import { mx } from '@dxos/ui-theme';
|
|
29
29
|
import { isNonNullable } from '@dxos/util';
|
|
30
30
|
|
|
31
31
|
export type TypescriptEditorProps = ThemedClassName<
|
|
@@ -39,71 +39,68 @@ export type TypescriptEditorProps = ThemedClassName<
|
|
|
39
39
|
} & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>
|
|
40
40
|
>;
|
|
41
41
|
|
|
42
|
-
export const TypescriptEditor = (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}: TypescriptEditorProps) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
42
|
+
export const TypescriptEditor = memo(
|
|
43
|
+
({
|
|
44
|
+
classNames,
|
|
45
|
+
id,
|
|
46
|
+
role = 'article',
|
|
47
|
+
inputMode = 'vscode',
|
|
48
|
+
env,
|
|
49
|
+
options,
|
|
50
|
+
initialValue,
|
|
51
|
+
extensions,
|
|
52
|
+
scrollTo,
|
|
53
|
+
selection,
|
|
54
|
+
}: TypescriptEditorProps) => {
|
|
55
|
+
const { themeMode } = useThemeContext();
|
|
56
|
+
const { parentRef, focusAttributes } = useTextEditor(
|
|
57
|
+
() => ({
|
|
58
|
+
id,
|
|
59
|
+
initialValue,
|
|
60
|
+
selection,
|
|
61
|
+
scrollTo,
|
|
62
|
+
extensions: [
|
|
63
|
+
extensions,
|
|
64
|
+
createBasicExtensions({
|
|
65
|
+
highlightActiveLine: true,
|
|
66
|
+
indentWithTab: true,
|
|
67
|
+
lineNumbers: true,
|
|
68
|
+
lineWrapping: false,
|
|
69
|
+
scrollPastEnd: role !== 'section',
|
|
70
|
+
search: true,
|
|
71
|
+
...options,
|
|
72
|
+
}),
|
|
73
|
+
createThemeExtensions({
|
|
74
|
+
monospace: true,
|
|
75
|
+
themeMode,
|
|
76
|
+
syntaxHighlighting: true,
|
|
77
|
+
}),
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
InputModeExtensions[inputMode],
|
|
80
|
+
javascript({ typescript: true }),
|
|
81
|
+
autocompletion({ override: env ? [tsAutocomplete()] : undefined }),
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
// Continues block comments when pressing Enter.
|
|
84
|
+
Prec.high(keymap.of(continueKeymap)),
|
|
85
|
+
keymap.of(completionKeymap),
|
|
86
|
+
keymap.of(lintKeymap),
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
// https://github.com/val-town/codemirror-ts
|
|
89
|
+
env && [
|
|
90
|
+
// TODO(burdon): Fix type.
|
|
91
|
+
tsFacet.of({ env: env as any, path: `./src/${id}.ts` }),
|
|
92
|
+
tsSync(),
|
|
93
|
+
tsLinter(),
|
|
94
|
+
tsHover({ renderTooltip: createTooltipRenderer(themeMode) }),
|
|
95
|
+
],
|
|
96
|
+
].filter(isNonNullable),
|
|
97
|
+
}),
|
|
98
|
+
[themeMode, id, extensions, inputMode, selection, scrollTo, env],
|
|
99
|
+
);
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
ref={parentRef}
|
|
101
|
-
data-toolbar={toolbar ? 'enabled' : 'disabled'}
|
|
102
|
-
className={mx(classNames)}
|
|
103
|
-
{...focusAttributes}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
101
|
+
return <div ref={parentRef} className={mx(classNames)} {...focusAttributes} />;
|
|
102
|
+
},
|
|
103
|
+
);
|
|
107
104
|
|
|
108
105
|
// TODO(burdon): Factor out (react-ui-editor).
|
|
109
106
|
const createTooltipRenderer = (themeMode: ThemeMode) => {
|
|
@@ -126,15 +123,14 @@ const createTooltipRenderer = (themeMode: ThemeMode) => {
|
|
|
126
123
|
};
|
|
127
124
|
|
|
128
125
|
return (info: HoverInfo) => {
|
|
126
|
+
const children =
|
|
127
|
+
info.quickInfo?.displayParts?.map(({ kind, text }) =>
|
|
128
|
+
Domino.of('span').classNames(classFromKind(kind)).text(text),
|
|
129
|
+
) ?? [];
|
|
129
130
|
return {
|
|
130
131
|
dom: Domino.of('div')
|
|
131
|
-
.classNames('xs:max-
|
|
132
|
-
.children(
|
|
133
|
-
...(info.quickInfo?.displayParts?.map(({ kind, text }) =>
|
|
134
|
-
Domino.of('span').classNames(classFromKind(kind)).text(text),
|
|
135
|
-
) ?? []),
|
|
136
|
-
)
|
|
137
|
-
.build(),
|
|
132
|
+
.classNames('xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator')
|
|
133
|
+
.children(...children).root,
|
|
138
134
|
};
|
|
139
135
|
};
|
|
140
136
|
};
|