@dxos/plugin-script 0.7.4 → 0.7.5-labs.401163d
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/dist/lib/browser/{AutomationPanel-PMTZROAZ.mjs → AutomationPanel-J3SZ5L3Y.mjs} +4 -11
- package/dist/lib/browser/AutomationPanel-J3SZ5L3Y.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-JHAVO2KA.mjs +713 -0
- package/dist/lib/browser/ScriptContainer-JHAVO2KA.mjs.map +7 -0
- package/dist/lib/browser/artifact-YCIVHFSS.mjs +243 -0
- package/dist/lib/browser/artifact-YCIVHFSS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-K7KY6YMG.mjs → chunk-45LXDWNF.mjs} +2 -2
- package/dist/lib/browser/chunk-6MOQ4BP3.mjs +15 -0
- package/dist/lib/browser/chunk-6MOQ4BP3.mjs.map +7 -0
- package/dist/lib/browser/chunk-FVVCAWNP.mjs +21 -0
- package/dist/lib/browser/chunk-FVVCAWNP.mjs.map +7 -0
- package/dist/lib/browser/chunk-N46LE7FS.mjs +40 -0
- package/dist/lib/browser/chunk-N46LE7FS.mjs.map +7 -0
- package/dist/lib/browser/chunk-UDLKK74O.mjs +69 -0
- package/dist/lib/browser/chunk-UDLKK74O.mjs.map +7 -0
- package/dist/lib/browser/chunk-WAXHENSY.mjs +236 -0
- package/dist/lib/browser/chunk-WAXHENSY.mjs.map +7 -0
- package/dist/lib/browser/compiler-YY2XSKHQ.mjs +82 -0
- package/dist/lib/browser/compiler-YY2XSKHQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +111 -359
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-RV3YXIVN.mjs +45 -0
- package/dist/lib/browser/intent-resolver-RV3YXIVN.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-ETY4XKFG.mjs +65 -0
- package/dist/lib/browser/react-surface-ETY4XKFG.mjs.map +7 -0
- package/dist/lib/browser/settings-SZCDKHWO.mjs +24 -0
- package/dist/lib/browser/settings-SZCDKHWO.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +10 -0
- package/dist/lib/node/{AutomationPanel-AAGQREH7.cjs → AutomationPanel-4M55FURO.cjs} +16 -17
- package/dist/lib/node/AutomationPanel-4M55FURO.cjs.map +7 -0
- package/dist/lib/node/ScriptContainer-EBIT6CT4.cjs +719 -0
- package/dist/lib/node/ScriptContainer-EBIT6CT4.cjs.map +7 -0
- package/dist/lib/node/artifact-IPGGY2Z2.cjs +262 -0
- package/dist/lib/node/artifact-IPGGY2Z2.cjs.map +7 -0
- package/dist/lib/node/chunk-3VDHZ54A.cjs +264 -0
- package/dist/lib/node/chunk-3VDHZ54A.cjs.map +7 -0
- package/dist/lib/node/{chunk-6LYX73ZT.cjs → chunk-5UH3F7TA.cjs} +11 -8
- package/dist/lib/node/chunk-5UH3F7TA.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-ALY3N6PW.cjs} +12 -8
- package/dist/lib/node/chunk-ALY3N6PW.cjs.map +7 -0
- package/dist/lib/node/chunk-DJGLGRQV.cjs +60 -0
- package/dist/lib/node/chunk-DJGLGRQV.cjs.map +7 -0
- package/dist/lib/node/{chunk-4INUJLXL.cjs → chunk-IID7WUQS.cjs} +6 -6
- package/dist/lib/node/chunk-JKPNBFU2.cjs +77 -0
- package/dist/lib/node/chunk-JKPNBFU2.cjs.map +7 -0
- package/dist/lib/node/compiler-UIBLKJKG.cjs +104 -0
- package/dist/lib/node/compiler-UIBLKJKG.cjs.map +7 -0
- package/dist/lib/node/index.cjs +108 -347
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-WFLQNAID.cjs +59 -0
- package/dist/lib/node/intent-resolver-WFLQNAID.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-OIQJFA7P.cjs +84 -0
- package/dist/lib/node/react-surface-OIQJFA7P.cjs.map +7 -0
- package/dist/lib/node/settings-SZFSMSKM.cjs +38 -0
- package/dist/lib/node/settings-SZFSMSKM.cjs.map +7 -0
- package/dist/lib/node/{types/index.cjs → types.cjs} +6 -8
- package/dist/lib/node/types.cjs.map +7 -0
- package/dist/lib/node-esm/{AutomationPanel-ETQEDY5I.mjs → AutomationPanel-W6SKG35R.mjs} +4 -11
- package/dist/lib/node-esm/AutomationPanel-W6SKG35R.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-QVFTCAML.mjs +714 -0
- package/dist/lib/node-esm/ScriptContainer-QVFTCAML.mjs.map +7 -0
- package/dist/lib/node-esm/artifact-7H4HGX5W.mjs +245 -0
- package/dist/lib/node-esm/artifact-7H4HGX5W.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5CEKSMA5.mjs +71 -0
- package/dist/lib/node-esm/chunk-5CEKSMA5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OFYGBUNI.mjs → chunk-CGF7EOGD.mjs} +2 -2
- package/dist/lib/node-esm/chunk-CP5LXTK5.mjs +16 -0
- package/dist/lib/node-esm/chunk-CP5LXTK5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SLTZMY34.mjs → chunk-P2V2Y5LV.mjs} +7 -4
- package/dist/lib/node-esm/chunk-P2V2Y5LV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UNQFIERE.mjs +41 -0
- package/dist/lib/node-esm/chunk-UNQFIERE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WCAUDRF4.mjs +237 -0
- package/dist/lib/node-esm/chunk-WCAUDRF4.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-XTXFGZJM.mjs +83 -0
- package/dist/lib/node-esm/compiler-XTXFGZJM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +111 -359
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-CYT6IYYH.mjs +46 -0
- package/dist/lib/node-esm/intent-resolver-CYT6IYYH.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-N67GNKC2.mjs +66 -0
- package/dist/lib/node-esm/react-surface-N67GNKC2.mjs.map +7 -0
- package/dist/lib/node-esm/settings-GR4O2WHZ.mjs +25 -0
- package/dist/lib/node-esm/settings-GR4O2WHZ.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +11 -0
- package/dist/types/src/ScriptPlugin.d.ts +1 -3
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact.d.ts +11 -0
- package/dist/types/src/capabilities/artifact.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +4 -0
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +2 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +2 -2
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptContainer.d.ts +10 -2
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +11 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -0
- package/dist/types/src/components/{Toolbar/Toolbar.stories.d.ts → ScriptToolbar/ScriptToolbar.stories.d.ts} +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/index.d.ts +2 -0
- package/dist/types/src/components/ScriptToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +4 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +48 -0
- package/dist/types/src/hooks/deploy.d.ts.map +1 -0
- package/dist/types/src/hooks/format.d.ts +25 -0
- package/dist/types/src/hooks/format.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/template.d.ts +31 -0
- package/dist/types/src/hooks/template.d.ts.map +1 -0
- package/dist/types/src/hooks/useToolbarAction.d.ts +14 -0
- package/dist/types/src/hooks/useToolbarAction.d.ts.map +1 -0
- package/dist/types/src/hooks/useToolbarState.d.ts +10 -0
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -0
- package/dist/types/src/hooks/view.d.ts +33 -0
- package/dist/types/src/hooks/view.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -5
- 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/templates/discord.d.ts +3 -0
- package/dist/types/src/templates/discord.d.ts.map +1 -0
- package/dist/types/src/templates/echo.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts +2 -1
- package/dist/types/src/templates/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +6 -0
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -0
- package/dist/types/src/templates/forex.d.ts +1 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/{templates.d.ts → templates/index.d.ts} +1 -1
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +54 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +30 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +45 -55
- package/src/ScriptPlugin.tsx +62 -145
- package/src/capabilities/artifact.ts +219 -0
- package/src/capabilities/capabilities.ts +12 -0
- package/src/capabilities/compiler.ts +33 -0
- package/src/capabilities/index.ts +13 -0
- package/src/capabilities/intent-resolver.ts +46 -0
- package/src/capabilities/react-surface.tsx +54 -0
- package/src/capabilities/settings.ts +14 -0
- package/src/compiler/compiler.browser.test.ts +1 -1
- package/src/components/AutomationPanel/AutomationPanel.tsx +2 -4
- package/src/components/FrameContainer/FrameContainer.tsx +5 -4
- package/src/components/ScriptContainer.tsx +69 -9
- package/src/components/ScriptSettings/ScriptSettings.tsx +28 -4
- package/src/components/ScriptSettingsPanel.tsx +140 -53
- package/src/components/{Toolbar/Toolbar.stories.tsx → ScriptToolbar/ScriptToolbar.stories.tsx} +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +53 -0
- package/src/{bundler → components/ScriptToolbar}/index.ts +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +2 -0
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +75 -10
- package/src/hooks/deploy.ts +169 -0
- package/src/hooks/format.ts +47 -0
- package/src/hooks/index.ts +11 -0
- package/src/hooks/template.ts +64 -0
- package/src/hooks/useToolbarAction.ts +54 -0
- package/src/hooks/useToolbarState.ts +16 -0
- package/src/hooks/view.ts +52 -0
- package/src/index.ts +2 -7
- package/src/meta.ts +4 -2
- package/src/templates/discord.ts +88 -0
- package/src/templates/echo.ts +5 -1
- package/src/templates/email.ts +26 -23
- package/src/templates/forex-effect.ts +44 -0
- package/src/templates/forex.ts +21 -13
- package/src/{templates.ts → templates/index.ts} +20 -5
- package/src/translations.ts +20 -1
- package/src/types.ts +39 -0
- package/dist/lib/browser/AutomationPanel-PMTZROAZ.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-RYZFYCNK.mjs +0 -425
- package/dist/lib/browser/ScriptContainer-RYZFYCNK.mjs.map +0 -7
- package/dist/lib/browser/chunk-4UTRJLQ3.mjs +0 -286
- package/dist/lib/browser/chunk-4UTRJLQ3.mjs.map +0 -7
- package/dist/lib/browser/chunk-C7VBULMK.mjs +0 -18
- package/dist/lib/browser/chunk-C7VBULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-QFZUFT5G.mjs +0 -48
- package/dist/lib/browser/chunk-QFZUFT5G.mjs.map +0 -7
- package/dist/lib/browser/chunk-U3OP64V4.mjs +0 -123
- package/dist/lib/browser/chunk-U3OP64V4.mjs.map +0 -7
- package/dist/lib/browser/edge/index.mjs +0 -19
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/types/index.mjs +0 -12
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-AAGQREH7.cjs.map +0 -7
- package/dist/lib/node/ScriptContainer-FZ44UIRC.cjs +0 -427
- package/dist/lib/node/ScriptContainer-FZ44UIRC.cjs.map +0 -7
- package/dist/lib/node/chunk-6LYX73ZT.cjs.map +0 -7
- package/dist/lib/node/chunk-CS25QNKZ.cjs +0 -151
- package/dist/lib/node/chunk-CS25QNKZ.cjs.map +0 -7
- package/dist/lib/node/chunk-DQYAU2CJ.cjs +0 -67
- package/dist/lib/node/chunk-DQYAU2CJ.cjs.map +0 -7
- package/dist/lib/node/chunk-WPP65EYS.cjs +0 -298
- package/dist/lib/node/chunk-WPP65EYS.cjs.map +0 -7
- package/dist/lib/node/edge/index.cjs +0 -41
- package/dist/lib/node/edge/index.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-ETQEDY5I.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-3PKDW34A.mjs +0 -426
- package/dist/lib/node-esm/ScriptContainer-3PKDW34A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-36DLLQ6E.mjs +0 -125
- package/dist/lib/node-esm/chunk-36DLLQ6E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4SRPREUK.mjs +0 -288
- package/dist/lib/node-esm/chunk-4SRPREUK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMVPKT6A.mjs +0 -49
- package/dist/lib/node-esm/chunk-GMVPKT6A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SLTZMY34.mjs.map +0 -7
- package/dist/lib/node-esm/edge/index.mjs +0 -20
- package/dist/lib/node-esm/edge/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -13
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/bundler/bundler.d.ts +0 -39
- package/dist/types/src/bundler/bundler.d.ts.map +0 -1
- package/dist/types/src/bundler/bundler.test.d.ts +0 -2
- package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
- package/dist/types/src/bundler/index.d.ts +0 -2
- package/dist/types/src/bundler/index.d.ts.map +0 -1
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts +0 -12
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +0 -1
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +0 -6
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptBlock/index.d.ts +0 -2
- package/dist/types/src/components/ScriptBlock/index.d.ts.map +0 -1
- package/dist/types/src/components/ScriptEditor.d.ts +0 -9
- package/dist/types/src/components/ScriptEditor.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -23
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/edge/functions.d.ts +0 -25
- package/dist/types/src/edge/functions.d.ts.map +0 -1
- package/dist/types/src/edge/index.d.ts +0 -2
- package/dist/types/src/edge/index.d.ts.map +0 -1
- package/dist/types/src/templates.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -3
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -71
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -8
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/bundler/bundler.test.ts +0 -54
- package/src/bundler/bundler.ts +0 -250
- package/src/components/ScriptBlock/ScriptBlock.stories.tsx +0 -52
- package/src/components/ScriptBlock/ScriptBlock.tsx +0 -102
- package/src/components/ScriptBlock/index.ts +0 -5
- package/src/components/ScriptEditor.tsx +0 -191
- package/src/components/Toolbar/Toolbar.tsx +0 -177
- package/src/components/Toolbar/index.ts +0 -5
- package/src/edge/functions.ts +0 -116
- package/src/edge/index.ts +0 -7
- package/src/types/index.ts +0 -6
- package/src/types/schema.ts +0 -44
- package/src/types/types.ts +0 -29
- /package/dist/lib/browser/{chunk-K7KY6YMG.mjs.map → chunk-45LXDWNF.mjs.map} +0 -0
- /package/dist/lib/browser/{edge/index.mjs.map → types.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-4INUJLXL.cjs.map → chunk-IID7WUQS.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-OFYGBUNI.mjs.map → chunk-CGF7EOGD.mjs.map} +0 -0
- /package/dist/lib/{browser/meta.mjs.map → node-esm/types.mjs.map} +0 -0
|
@@ -1,207 +1,37 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
AutomationPanel,
|
|
4
|
+
ScriptContainer,
|
|
5
|
+
ScriptSettings,
|
|
6
|
+
ScriptSettingsPanel
|
|
7
|
+
} from "./chunk-WCAUDRF4.mjs";
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./chunk-36DLLQ6E.mjs";
|
|
9
|
+
ScriptCapabilities
|
|
10
|
+
} from "./chunk-CP5LXTK5.mjs";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ScriptType
|
|
15
|
-
} from "./chunk-GMVPKT6A.mjs";
|
|
12
|
+
ScriptAction
|
|
13
|
+
} from "./chunk-UNQFIERE.mjs";
|
|
16
14
|
import {
|
|
17
15
|
SCRIPT_PLUGIN,
|
|
18
|
-
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
meta
|
|
17
|
+
} from "./chunk-P2V2Y5LV.mjs";
|
|
20
18
|
|
|
21
|
-
// packages/plugins/experimental/plugin-script/src/
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import { TextType } from "@dxos/plugin-markdown/types";
|
|
29
|
-
import { SpaceAction } from "@dxos/plugin-space";
|
|
30
|
-
import { loadObjectReferences } from "@dxos/react-client/echo";
|
|
19
|
+
// packages/plugins/experimental/plugin-script/src/capabilities/index.ts
|
|
20
|
+
import { lazy } from "@dxos/app-framework";
|
|
21
|
+
var Compiler = lazy(() => import("./compiler-XTXFGZJM.mjs"));
|
|
22
|
+
var IntentResolver = lazy(() => import("./intent-resolver-CYT6IYYH.mjs"));
|
|
23
|
+
var ReactSurface = lazy(() => import("./react-surface-N67GNKC2.mjs"));
|
|
24
|
+
var ScriptSettings2 = lazy(() => import("./settings-GR4O2WHZ.mjs"));
|
|
25
|
+
var Artifact = lazy(() => import("./artifact-7H4HGX5W.mjs"));
|
|
31
26
|
|
|
32
|
-
// packages/plugins/experimental/plugin-script/src/
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
var defaultOptions = {
|
|
38
|
-
lib: [
|
|
39
|
-
"DOM",
|
|
40
|
-
"es2022"
|
|
41
|
-
],
|
|
42
|
-
target: ts.ScriptTarget.ES2022
|
|
43
|
-
};
|
|
44
|
-
var Compiler = class {
|
|
45
|
-
constructor(_options = defaultOptions) {
|
|
46
|
-
this._options = _options;
|
|
47
|
-
}
|
|
48
|
-
async initialize() {
|
|
49
|
-
if (this._env) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
this._fsMap = await createDefaultMapFromCDN(this._options, "5.5.4", true, ts);
|
|
53
|
-
const system = createSystem(this._fsMap);
|
|
54
|
-
this._env = createVirtualTypeScriptEnvironment(system, [], ts, this._options);
|
|
55
|
-
}
|
|
56
|
-
get environment() {
|
|
57
|
-
invariant(this._env, "Compiler environment not initialized.", {
|
|
58
|
-
F: __dxlog_file,
|
|
59
|
-
L: 39,
|
|
60
|
-
S: this,
|
|
61
|
-
A: [
|
|
62
|
-
"this._env",
|
|
63
|
-
"'Compiler environment not initialized.'"
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
return this._env;
|
|
67
|
-
}
|
|
68
|
-
setFile(fileName, content) {
|
|
69
|
-
invariant(this._fsMap, "File system map not initialized.", {
|
|
70
|
-
F: __dxlog_file,
|
|
71
|
-
L: 44,
|
|
72
|
-
S: this,
|
|
73
|
-
A: [
|
|
74
|
-
"this._fsMap",
|
|
75
|
-
"'File system map not initialized.'"
|
|
76
|
-
]
|
|
77
|
-
});
|
|
78
|
-
this.environment.createFile(fileName, content);
|
|
79
|
-
}
|
|
80
|
-
compile(fileName) {
|
|
81
|
-
return this.environment.languageService.getEmitOutput(fileName);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// packages/plugins/experimental/plugin-script/src/components/index.ts
|
|
86
|
-
import { lazy } from "react";
|
|
87
|
-
|
|
88
|
-
// packages/plugins/experimental/plugin-script/src/components/ScriptSettings/ScriptSettings.tsx
|
|
89
|
-
import React from "react";
|
|
90
|
-
import { useClient } from "@dxos/react-client";
|
|
91
|
-
import { Button, useTranslation } from "@dxos/react-ui";
|
|
92
|
-
import { DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
93
|
-
var ScriptSettings = ({ settings }) => {
|
|
94
|
-
const { t } = useTranslation(SCRIPT_PLUGIN);
|
|
95
|
-
const client = useClient();
|
|
96
|
-
const handleAuthenticate = async () => {
|
|
97
|
-
const { identityKey } = client.halo.identity.get();
|
|
98
|
-
await client.halo.writeCredentials([
|
|
99
|
-
{
|
|
100
|
-
issuer: identityKey,
|
|
101
|
-
issuanceDate: /* @__PURE__ */ new Date(),
|
|
102
|
-
subject: {
|
|
103
|
-
id: identityKey,
|
|
104
|
-
assertion: {
|
|
105
|
-
"@type": "dxos.halo.credentials.ServiceAccess",
|
|
106
|
-
serverName: "hub.dxos.network",
|
|
107
|
-
serverKey: identityKey,
|
|
108
|
-
identityKey,
|
|
109
|
-
capabilities: [
|
|
110
|
-
"composer:beta"
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
]);
|
|
116
|
-
};
|
|
117
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DeprecatedFormInput, {
|
|
118
|
-
label: t("authenticate action label")
|
|
119
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
120
|
-
onClick: handleAuthenticate
|
|
121
|
-
}, t("authenticate button label"))));
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// packages/plugins/experimental/plugin-script/src/components/ScriptSettingsPanel.tsx
|
|
125
|
-
import React2, { useCallback } from "react";
|
|
126
|
-
import { useClient as useClient2 } from "@dxos/react-client";
|
|
127
|
-
import { Filter, getMeta, getSpace, useQuery } from "@dxos/react-client/echo";
|
|
128
|
-
import { Button as Button2, Icon, Input, useControlledValue, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
129
|
-
var ScriptSettingsPanel = ({ script }) => {
|
|
130
|
-
const { t } = useTranslation2(SCRIPT_PLUGIN);
|
|
131
|
-
const client = useClient2();
|
|
132
|
-
const space = getSpace(script);
|
|
133
|
-
const [fn] = useQuery(space, Filter.schema(FunctionType, {
|
|
134
|
-
source: script
|
|
135
|
-
}));
|
|
136
|
-
const handleNameChange = useCallback((event) => {
|
|
137
|
-
script.name = event.target.value;
|
|
138
|
-
}, [
|
|
139
|
-
script
|
|
140
|
-
]);
|
|
141
|
-
const [binding, setBinding] = useControlledValue(fn?.binding ?? "");
|
|
142
|
-
const handleBindingChange = useCallback((event) => {
|
|
143
|
-
setBinding(event.target.value);
|
|
144
|
-
}, [
|
|
145
|
-
setBinding
|
|
146
|
-
]);
|
|
147
|
-
const handleBindingBlur = useCallback(() => {
|
|
148
|
-
fn.binding = binding;
|
|
149
|
-
}, [
|
|
150
|
-
fn,
|
|
151
|
-
binding
|
|
152
|
-
]);
|
|
153
|
-
const functionPath = fn && getUserFunctionUrlInMetadata(getMeta(fn));
|
|
154
|
-
const functionUrl = functionPath && getInvocationUrl(functionPath, client.config.values.runtime?.services?.edge?.url ?? "", {
|
|
155
|
-
spaceId: space?.id
|
|
156
|
-
});
|
|
157
|
-
const handleCopy = useCallback(() => functionUrl && navigator.clipboard.writeText(functionUrl), [
|
|
158
|
-
functionUrl
|
|
159
|
-
]);
|
|
160
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
161
|
-
role: "form",
|
|
162
|
-
className: "flex flex-col w-full p-2 gap-4"
|
|
163
|
-
}, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement("div", {
|
|
164
|
-
role: "none",
|
|
165
|
-
className: "flex flex-col gap-1"
|
|
166
|
-
}, /* @__PURE__ */ React2.createElement(Input.Label, null, t("name label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
167
|
-
placeholder: t("object title placeholder"),
|
|
168
|
-
value: script.name ?? "",
|
|
169
|
-
onChange: handleNameChange
|
|
170
|
-
}))), fn && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("hr", {
|
|
171
|
-
className: "border-separator"
|
|
172
|
-
}), /* @__PURE__ */ React2.createElement("h2", null, t("remote function settings heading")), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement("div", {
|
|
173
|
-
role: "none",
|
|
174
|
-
className: "flex flex-col gap-1"
|
|
175
|
-
}, /* @__PURE__ */ React2.createElement(Input.Label, null, t("function url label")), /* @__PURE__ */ React2.createElement("div", {
|
|
176
|
-
role: "none",
|
|
177
|
-
className: "flex gap-1"
|
|
178
|
-
}, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
179
|
-
disabled: true,
|
|
180
|
-
value: functionUrl,
|
|
181
|
-
onChange: (event) => {
|
|
182
|
-
fn.name = event.target.value;
|
|
183
|
-
}
|
|
184
|
-
}), /* @__PURE__ */ React2.createElement(Button2, {
|
|
185
|
-
onClick: handleCopy
|
|
186
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
187
|
-
icon: "ph--copy--regular",
|
|
188
|
-
size: 4
|
|
189
|
-
}))))), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement("div", {
|
|
190
|
-
role: "none",
|
|
191
|
-
className: "flex flex-col gap-1"
|
|
192
|
-
}, /* @__PURE__ */ React2.createElement(Input.Label, null, t("function binding label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
193
|
-
placeholder: t("function binding placeholder"),
|
|
194
|
-
value: binding,
|
|
195
|
-
onChange: handleBindingChange,
|
|
196
|
-
onBlur: handleBindingBlur
|
|
197
|
-
})))));
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// packages/plugins/experimental/plugin-script/src/components/index.ts
|
|
201
|
-
var AutomationPanel = lazy(() => import("./AutomationPanel-ETQEDY5I.mjs"));
|
|
202
|
-
var ScriptContainer = lazy(() => import("./ScriptContainer-3PKDW34A.mjs"));
|
|
27
|
+
// packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx
|
|
28
|
+
import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
29
|
+
import { FunctionType, ScriptType as ScriptType2 } from "@dxos/functions";
|
|
30
|
+
import { RefArray } from "@dxos/live-object";
|
|
31
|
+
import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
|
|
203
32
|
|
|
204
33
|
// packages/plugins/experimental/plugin-script/src/translations.ts
|
|
34
|
+
import { ScriptType } from "@dxos/functions";
|
|
205
35
|
var translations_default = [
|
|
206
36
|
{
|
|
207
37
|
"en-US": {
|
|
@@ -213,6 +43,8 @@ var translations_default = [
|
|
|
213
43
|
"object title placeholder": "New script",
|
|
214
44
|
"create object label": "Create script",
|
|
215
45
|
"create stack section label": "Create script",
|
|
46
|
+
"description label": "Description",
|
|
47
|
+
"description placeholder": "Describe what the script does.",
|
|
216
48
|
"binding placeholder": "Function name",
|
|
217
49
|
"function request placeholder": "Function request",
|
|
218
50
|
"deploy label": "Deploy",
|
|
@@ -227,186 +59,106 @@ var translations_default = [
|
|
|
227
59
|
"remote function settings heading": "Remote Function",
|
|
228
60
|
"function url label": "Invocation URL",
|
|
229
61
|
"function binding label": "Function binding",
|
|
230
|
-
"function binding placeholder": "BINDING"
|
|
62
|
+
"function binding placeholder": "BINDING",
|
|
63
|
+
"script publish settings label": "Publishing",
|
|
64
|
+
"script publish settings description": "Scripts can be shared publicly as Github gists.",
|
|
65
|
+
"no github token label": "This space has no Github access token available.",
|
|
66
|
+
"open token manager label": "Open Token Manager",
|
|
67
|
+
"publish label": "Publish",
|
|
68
|
+
"publishing label": "Publishing",
|
|
69
|
+
"editor input mode label": "Editor input mode",
|
|
70
|
+
"select editor input mode placeholder": "Select editor input mode\u2026",
|
|
71
|
+
"settings editor input mode default label": "Default",
|
|
72
|
+
"settings editor input mode vim label": "Vim",
|
|
73
|
+
"settings editor input mode vscode label": "VS Code",
|
|
74
|
+
"view group label": "View",
|
|
75
|
+
"view editor label": "Editor",
|
|
76
|
+
"view split label": "Split",
|
|
77
|
+
"view debug label": "Debug",
|
|
78
|
+
"template select group label": "Select template"
|
|
231
79
|
}
|
|
232
80
|
}
|
|
233
81
|
}
|
|
234
82
|
];
|
|
235
83
|
|
|
236
84
|
// packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx
|
|
237
|
-
var ScriptPlugin = () =>
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
85
|
+
var ScriptPlugin = () => definePlugin(meta, [
|
|
86
|
+
defineModule({
|
|
87
|
+
id: `${meta.id}/module/settings`,
|
|
88
|
+
activatesOn: Events.SetupSettings,
|
|
89
|
+
activate: ScriptSettings2
|
|
90
|
+
}),
|
|
91
|
+
defineModule({
|
|
92
|
+
id: `${meta.id}/module/compiler`,
|
|
93
|
+
activatesOn: Events.Startup,
|
|
94
|
+
activate: Compiler
|
|
95
|
+
}),
|
|
96
|
+
defineModule({
|
|
97
|
+
id: `${meta.id}/module/translations`,
|
|
98
|
+
activatesOn: Events.SetupTranslations,
|
|
99
|
+
activate: () => contributes(Capabilities.Translations, translations_default)
|
|
100
|
+
}),
|
|
101
|
+
defineModule({
|
|
102
|
+
id: `${meta.id}/module/metadata`,
|
|
103
|
+
activatesOn: Events.SetupMetadata,
|
|
104
|
+
activate: () => contributes(Capabilities.Metadata, {
|
|
105
|
+
id: ScriptType2.typename,
|
|
255
106
|
metadata: {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
icon: "ph--code--regular",
|
|
266
|
-
// TODO(wittjosiah): Move out of metadata.
|
|
267
|
-
loadReferences: (script) => loadObjectReferences(script, (script2) => [
|
|
268
|
-
script2.source
|
|
269
|
-
])
|
|
107
|
+
creationSchema: ScriptAction.CreateScriptSchema,
|
|
108
|
+
createObject: (props, { space }) => createIntent(ScriptAction.Create, {
|
|
109
|
+
...props,
|
|
110
|
+
space
|
|
111
|
+
}),
|
|
112
|
+
placeholder: [
|
|
113
|
+
"object title placeholder",
|
|
114
|
+
{
|
|
115
|
+
ns: SCRIPT_PLUGIN
|
|
270
116
|
}
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
translations: translations_default,
|
|
274
|
-
echo: {
|
|
275
|
-
schema: [
|
|
276
|
-
ScriptType
|
|
277
117
|
],
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
builder: (plugins) => {
|
|
284
|
-
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
285
|
-
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
|
|
286
|
-
if (!client || !dispatch) {
|
|
287
|
-
return [];
|
|
288
|
-
}
|
|
289
|
-
return createExtension({
|
|
290
|
-
id: ScriptAction.CREATE,
|
|
291
|
-
filter: (node) => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),
|
|
292
|
-
actions: ({ node }) => {
|
|
293
|
-
const id = node.id.split("/").at(-1);
|
|
294
|
-
const [spaceId, objectId] = id?.split(":") ?? [];
|
|
295
|
-
const space = client.spaces.get().find((space2) => space2.id === spaceId);
|
|
296
|
-
const object = objectId && space?.db.getObjectById(objectId);
|
|
297
|
-
const target = objectId ? object : space;
|
|
298
|
-
if (!target) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
return [
|
|
302
|
-
{
|
|
303
|
-
id: `${SCRIPT_PLUGIN}/create/${node.id}`,
|
|
304
|
-
data: async () => {
|
|
305
|
-
await dispatch([
|
|
306
|
-
{
|
|
307
|
-
plugin: SCRIPT_PLUGIN,
|
|
308
|
-
action: ScriptAction.CREATE
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
action: SpaceAction.ADD_OBJECT,
|
|
312
|
-
data: {
|
|
313
|
-
target
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
action: NavigationAction.OPEN
|
|
318
|
-
}
|
|
319
|
-
]);
|
|
320
|
-
},
|
|
321
|
-
properties: {
|
|
322
|
-
label: [
|
|
323
|
-
"create object label",
|
|
324
|
-
{
|
|
325
|
-
ns: SCRIPT_PLUGIN
|
|
326
|
-
}
|
|
327
|
-
],
|
|
328
|
-
icon: "ph--code--regular",
|
|
329
|
-
testId: "scriptPlugin.createObject"
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
];
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
surface: {
|
|
338
|
-
component: ({ data, role }) => {
|
|
339
|
-
switch (role) {
|
|
340
|
-
case "settings": {
|
|
341
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */ React3.createElement(ScriptSettings, {
|
|
342
|
-
settings: {}
|
|
343
|
-
}) : null;
|
|
344
|
-
}
|
|
345
|
-
case "article": {
|
|
346
|
-
if (data.object instanceof ScriptType) {
|
|
347
|
-
return /* @__PURE__ */ React3.createElement(ScriptContainer, {
|
|
348
|
-
script: data.object,
|
|
349
|
-
env: compiler.environment
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
case "complementary--automation": {
|
|
355
|
-
if (data.subject instanceof ScriptType) {
|
|
356
|
-
return {
|
|
357
|
-
node: /* @__PURE__ */ React3.createElement(AutomationPanel, {
|
|
358
|
-
subject: data.subject
|
|
359
|
-
}),
|
|
360
|
-
disposition: "hoist"
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
case "complementary--settings": {
|
|
366
|
-
if (data.subject instanceof ScriptType) {
|
|
367
|
-
return /* @__PURE__ */ React3.createElement(ScriptSettingsPanel, {
|
|
368
|
-
script: data.subject
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
intent: {
|
|
378
|
-
resolver: (intent) => {
|
|
379
|
-
switch (intent.action) {
|
|
380
|
-
case ScriptAction.CREATE: {
|
|
381
|
-
return {
|
|
382
|
-
data: create(ScriptType, {
|
|
383
|
-
source: create(TextType, {
|
|
384
|
-
content: templates[0].source
|
|
385
|
-
})
|
|
386
|
-
})
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
118
|
+
icon: "ph--code--regular",
|
|
119
|
+
// TODO(wittjosiah): Move out of metadata.
|
|
120
|
+
loadReferences: async (script) => await RefArray.loadAll([
|
|
121
|
+
script.source
|
|
122
|
+
])
|
|
391
123
|
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
124
|
+
})
|
|
125
|
+
}),
|
|
126
|
+
defineModule({
|
|
127
|
+
id: `${meta.id}/module/schema`,
|
|
128
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
129
|
+
activate: () => [
|
|
130
|
+
contributes(ClientCapabilities.SystemSchema, [
|
|
131
|
+
FunctionType
|
|
132
|
+
]),
|
|
133
|
+
contributes(ClientCapabilities.Schema, [
|
|
134
|
+
ScriptType2
|
|
135
|
+
])
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
defineModule({
|
|
139
|
+
id: `${meta.id}/module/react-surface`,
|
|
140
|
+
activatesOn: Events.SetupSurfaces,
|
|
141
|
+
activate: ReactSurface
|
|
142
|
+
}),
|
|
143
|
+
defineModule({
|
|
144
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
145
|
+
activatesOn: Events.SetupIntents,
|
|
146
|
+
activate: IntentResolver
|
|
147
|
+
}),
|
|
148
|
+
defineModule({
|
|
149
|
+
id: `${meta.id}/module/artifact`,
|
|
150
|
+
activatesOn: Events.Startup,
|
|
151
|
+
activate: Artifact
|
|
152
|
+
})
|
|
153
|
+
]);
|
|
398
154
|
export {
|
|
399
155
|
AutomationPanel,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
FunctionType,
|
|
403
|
-
ScriptAction,
|
|
156
|
+
SCRIPT_PLUGIN,
|
|
157
|
+
ScriptCapabilities,
|
|
404
158
|
ScriptContainer,
|
|
405
159
|
ScriptPlugin,
|
|
406
160
|
ScriptSettings,
|
|
407
161
|
ScriptSettingsPanel,
|
|
408
|
-
|
|
409
|
-
src_default as default,
|
|
410
|
-
initializeBundler
|
|
162
|
+
meta
|
|
411
163
|
};
|
|
412
164
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\n// @ts-ignore\nimport wasmUrl from 'esbuild-wasm/esbuild.wasm?url';\nimport React from 'react';\n\nimport { NavigationAction, parseIntentPlugin, type PluginDefinition, resolvePlugin } from '@dxos/app-framework';\nimport { create } from '@dxos/live-object';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';\nimport { TextType } from '@dxos/plugin-markdown/types';\nimport { SpaceAction } from '@dxos/plugin-space';\nimport { loadObjectReferences } from '@dxos/react-client/echo';\n\nimport { initializeBundler } from './bundler';\nimport { Compiler } from './compiler';\nimport { AutomationPanel, ScriptContainer, ScriptSettings, ScriptSettingsPanel } from './components';\nimport meta, { SCRIPT_PLUGIN } from './meta';\nimport { templates } from './templates';\nimport translations from './translations';\nimport { FunctionType, ScriptAction, type ScriptPluginProvides, ScriptType } from './types';\n\nexport const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {\n const compiler = new Compiler();\n\n return {\n meta,\n initialize: async () => {\n await compiler.initialize();\n // TODO(wittjosiah): Fetch types for https modules.\n compiler.setFile('/src/typings.d.ts', \"declare module 'https://*';\");\n // TODO(wittjosiah): Proper function handler types.\n // TODO(wittjosiah): Remove.\n compiler.setFile(\n '/src/runtime.ts',\n `\n export const Filter: any = {};\n export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;\n export const functionHandler = (handler: FunctionHandler) => handler;\n `,\n );\n await initializeBundler({ wasmUrl });\n },\n provides: {\n settings: {},\n metadata: {\n records: {\n [ScriptType.typename]: {\n createObject: ScriptAction.CREATE,\n placeholder: ['object title placeholder', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--code--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: (script: ScriptType) => loadObjectReferences(script, (script) => [script.source]),\n },\n },\n },\n translations,\n echo: {\n schema: [ScriptType],\n system: [FunctionType],\n },\n graph: {\n builder: (plugins) => {\n const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;\n const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;\n if (!client || !dispatch) {\n return [];\n }\n\n return createExtension({\n id: ScriptAction.CREATE,\n filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),\n actions: ({ node }) => {\n const id = node.id.split('/').at(-1);\n const [spaceId, objectId] = id?.split(':') ?? [];\n const space = client.spaces.get().find((space) => space.id === spaceId);\n const object = objectId && space?.db.getObjectById(objectId);\n const target = objectId ? object : space;\n if (!target) {\n return;\n }\n\n return [\n {\n id: `${SCRIPT_PLUGIN}/create/${node.id}`,\n data: async () => {\n await dispatch([\n { plugin: SCRIPT_PLUGIN, action: ScriptAction.CREATE },\n { action: SpaceAction.ADD_OBJECT, data: { target } },\n { action: NavigationAction.OPEN },\n ]);\n },\n properties: {\n label: ['create object label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--code--regular',\n testId: 'scriptPlugin.createObject',\n },\n },\n ];\n },\n });\n },\n },\n surface: {\n component: ({ data, role }) => {\n switch (role) {\n case 'settings': {\n return data.plugin === meta.id ? <ScriptSettings settings={{}} /> : null;\n }\n\n case 'article': {\n if (data.object instanceof ScriptType) {\n return <ScriptContainer script={data.object} env={compiler.environment} />;\n }\n break;\n }\n\n case 'complementary--automation': {\n if (data.subject instanceof ScriptType) {\n return {\n node: <AutomationPanel subject={data.subject as any} />,\n disposition: 'hoist',\n };\n }\n break;\n }\n\n case 'complementary--settings': {\n if (data.subject instanceof ScriptType) {\n return <ScriptSettingsPanel script={data.subject} />;\n }\n break;\n }\n }\n\n return null;\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case ScriptAction.CREATE: {\n return {\n data: create(ScriptType, {\n source: create(TextType, {\n content: templates[0].source,\n }),\n }),\n };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n createDefaultMapFromCDN,\n createSystem,\n createVirtualTypeScriptEnvironment,\n type VirtualTypeScriptEnvironment,\n} from '@typescript/vfs';\nimport ts from 'typescript';\n\nimport { invariant } from '@dxos/invariant';\n\nconst defaultOptions: ts.CompilerOptions = {\n lib: ['DOM', 'es2022'],\n target: ts.ScriptTarget.ES2022,\n};\n\nexport class Compiler {\n private _env: VirtualTypeScriptEnvironment | undefined;\n private _fsMap: Map<string, string> | undefined;\n\n constructor(private readonly _options: ts.CompilerOptions = defaultOptions) {}\n\n async initialize() {\n if (this._env) {\n return;\n }\n\n // TODO(wittjosiah): Figure out how to get workers working in plugin packages.\n // https://github.com/val-town/codemirror-ts?tab=readme-ov-file#setup-worker\n this._fsMap = await createDefaultMapFromCDN(this._options, '5.5.4', true, ts);\n const system = createSystem(this._fsMap);\n this._env = createVirtualTypeScriptEnvironment(system, [], ts, this._options);\n }\n\n get environment() {\n invariant(this._env, 'Compiler environment not initialized.');\n return this._env;\n }\n\n setFile(fileName: string, content: string) {\n invariant(this._fsMap, 'File system map not initialized.');\n this.environment.createFile(fileName, content);\n }\n\n compile(fileName: string) {\n return this.environment.languageService.getEmitOutput(fileName);\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './ScriptSettings';\nexport * from './ScriptSettingsPanel';\n\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const ScriptContainer = lazy(() => import('./ScriptContainer'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\nimport { useClient } from '@dxos/react-client';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { SCRIPT_PLUGIN } from '../../meta';\nimport { type ScriptSettingsProps } from '../../types';\n\nexport const ScriptSettings = ({ settings }: { settings: ScriptSettingsProps }) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const client = useClient();\n\n // TODO(burdon): Check token.\n const handleAuthenticate = async () => {\n const { identityKey } = client.halo.identity.get()!;\n await client.halo.writeCredentials([\n {\n issuer: identityKey,\n issuanceDate: new Date(),\n subject: {\n id: identityKey,\n assertion: {\n '@type': 'dxos.halo.credentials.ServiceAccess',\n serverName: 'hub.dxos.network',\n serverKey: identityKey,\n identityKey,\n capabilities: ['composer:beta'],\n },\n },\n } satisfies Credential,\n ]);\n };\n\n return (\n <>\n <DeprecatedFormInput label={t('authenticate action label')}>\n <Button onClick={handleAuthenticate}>{t('authenticate button label')}</Button>\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ChangeEvent, useCallback } from 'react';\n\nimport { useClient } from '@dxos/react-client';\nimport { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Button, Icon, Input, useControlledValue, useTranslation } from '@dxos/react-ui';\n\nimport { getInvocationUrl, getUserFunctionUrlInMetadata } from '../edge';\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { FunctionType, type ScriptType } from '../types';\n\nexport type ScriptSettingsPanelProps = {\n script: ScriptType;\n};\n\nexport const ScriptSettingsPanel = ({ script }: ScriptSettingsPanelProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const client = useClient();\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n\n const handleNameChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n script.name = event.target.value;\n },\n [script],\n );\n\n const [binding, setBinding] = useControlledValue(fn?.binding ?? '');\n const handleBindingChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setBinding(event.target.value);\n },\n [setBinding],\n );\n const handleBindingBlur = useCallback(() => {\n fn.binding = binding;\n }, [fn, binding]);\n\n const functionPath = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n const functionUrl =\n functionPath &&\n getInvocationUrl(functionPath, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n });\n\n // TODO(wittjosiah): Use ClipboardProvider.\n const handleCopy = useCallback(() => functionUrl && navigator.clipboard.writeText(functionUrl), [functionUrl]);\n\n return (\n <div role='form' className='flex flex-col w-full p-2 gap-4'>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('name label')}</Input.Label>\n <Input.TextInput\n placeholder={t('object title placeholder')}\n value={script.name ?? ''}\n onChange={handleNameChange}\n />\n </div>\n </Input.Root>\n {fn && (\n <>\n <hr className='border-separator' />\n <h2>{t('remote function settings heading')}</h2>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('function url label')}</Input.Label>\n <div role='none' className='flex gap-1'>\n <Input.TextInput\n disabled\n value={functionUrl}\n onChange={(event) => {\n fn.name = event.target.value;\n }}\n />\n <Button onClick={handleCopy}>\n <Icon icon='ph--copy--regular' size={4} />\n </Button>\n </div>\n </div>\n </Input.Root>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('function binding label')}</Input.Label>\n <Input.TextInput\n placeholder={t('function binding placeholder')}\n value={binding}\n onChange={handleBindingChange}\n onBlur={handleBindingBlur}\n />\n </div>\n </Input.Root>\n </>\n )}\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SCRIPT_PLUGIN } from './meta';\nimport { ScriptType } from './types';\n\nexport default [\n {\n 'en-US': {\n [ScriptType.typename]: {\n 'typename label': 'Script',\n },\n [SCRIPT_PLUGIN]: {\n 'plugin name': 'Scripts',\n 'object title placeholder': 'New script',\n 'create object label': 'Create script',\n 'create stack section label': 'Create script',\n 'binding placeholder': 'Function name',\n 'function request placeholder': 'Function request',\n 'deploy label': 'Deploy',\n 'deployed label': 'Current version of the script is deployed',\n 'upload failed label': 'Upload failed',\n 'copy link label': 'Copy function link',\n 'format label': 'Format',\n 'toggle details label': 'Toggle details panel',\n 'authenticate action label': 'Authenticate functions service',\n 'authenticate button label': 'Authenticate',\n 'name label': 'Name',\n 'remote function settings heading': 'Remote Function',\n 'function url label': 'Invocation URL',\n 'function binding label': 'Function binding',\n 'function binding placeholder': 'BINDING',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ScriptPlugin } from './ScriptPlugin';\n\nexport default ScriptPlugin;\n\nexport * from './bundler';\nexport * from './compiler';\nexport * from './components';\nexport * from './types';\n\nexport * from './ScriptPlugin';\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/capabilities/index.ts", "../../../src/ScriptPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Compiler = lazy(() => import('./compiler'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const ScriptSettings = lazy(() => import('./settings'));\nexport const Artifact = lazy(() => import('./artifact'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// @ts-ignore\n\nimport { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { type Space } from '@dxos/client/echo';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { RefArray } from '@dxos/live-object';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { Artifact, Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';\nimport { meta, SCRIPT_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ScriptAction } from './types';\n\nexport const ScriptPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/settings`,\n activatesOn: Events.SetupSettings,\n activate: ScriptSettings,\n }),\n defineModule({\n id: `${meta.id}/module/compiler`,\n activatesOn: Events.Startup,\n activate: Compiler,\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: ScriptType.typename,\n metadata: {\n creationSchema: ScriptAction.CreateScriptSchema,\n createObject: (props: ScriptAction.CreateScriptProps, { space }: { space: Space }) =>\n createIntent(ScriptAction.Create, { ...props, space }),\n placeholder: ['object title placeholder', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--code--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: async (script: ScriptType) => await RefArray.loadAll([script.source]),\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => [\n contributes(ClientCapabilities.SystemSchema, [FunctionType]),\n contributes(ClientCapabilities.Schema, [ScriptType]),\n ],\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupSurfaces,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: IntentResolver,\n }),\n defineModule({\n id: `${meta.id}/module/artifact`,\n activatesOn: Events.Startup,\n activate: Artifact,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ScriptType } from '@dxos/functions';\n\nimport { SCRIPT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [ScriptType.typename]: {\n 'typename label': 'Script',\n },\n [SCRIPT_PLUGIN]: {\n 'plugin name': 'Scripts',\n 'object title placeholder': 'New script',\n 'create object label': 'Create script',\n 'create stack section label': 'Create script',\n 'description label': 'Description',\n 'description placeholder': 'Describe what the script does.',\n 'binding placeholder': 'Function name',\n 'function request placeholder': 'Function request',\n 'deploy label': 'Deploy',\n 'deployed label': 'Current version of the script is deployed',\n 'upload failed label': 'Upload failed',\n 'copy link label': 'Copy function link',\n 'format label': 'Format',\n 'toggle details label': 'Toggle details panel',\n 'authenticate action label': 'Authenticate functions service',\n 'authenticate button label': 'Authenticate',\n 'name label': 'Name',\n 'remote function settings heading': 'Remote Function',\n 'function url label': 'Invocation URL',\n 'function binding label': 'Function binding',\n 'function binding placeholder': 'BINDING',\n 'script publish settings label': 'Publishing',\n 'script publish settings description': 'Scripts can be shared publicly as Github gists.',\n 'no github token label': 'This space has no Github access token available.',\n 'open token manager label': 'Open Token Manager',\n 'publish label': 'Publish',\n 'publishing label': 'Publishing',\n 'editor input mode label': 'Editor input mode',\n 'select editor input mode placeholder': 'Select editor input mode…',\n 'settings editor input mode default label': 'Default',\n 'settings editor input mode vim label': 'Vim',\n 'settings editor input mode vscode label': 'VS Code',\n 'view group label': 'View',\n 'view editor label': 'Editor',\n 'view split label': 'Split',\n 'view debug label': 'Debug',\n 'template select group label': 'Select template',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAEd,IAAMC,WAAWC,KAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,eAAeF,KAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,kBAAiBH,KAAK,MAAM,OAAO,yBAAA,CAAA;AACzC,IAAMI,WAAWJ,KAAK,MAAM,OAAO,yBAAA,CAAA;;;ACJ1C,SAASK,cAAcC,aAAaC,cAAcC,cAAcC,cAAcC,cAAc;AAE5F,SAASC,cAAcC,cAAAA,mBAAkB;AACzC,SAASC,gBAAgB;AACzB,SAASC,oBAAoBC,oBAAoB;;;ACNjD,SAASC,kBAAkB;AAI3B,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,WAAWC,QAAQ,GAAG;QACrB,kBAAkB;MACpB;MACA,CAACC,aAAAA,GAAgB;QACf,eAAe;QACf,4BAA4B;QAC5B,uBAAuB;QACvB,8BAA8B;QAC9B,qBAAqB;QACrB,2BAA2B;QAC3B,uBAAuB;QACvB,gCAAgC;QAChC,gBAAgB;QAChB,kBAAkB;QAClB,uBAAuB;QACvB,mBAAmB;QACnB,gBAAgB;QAChB,wBAAwB;QACxB,6BAA6B;QAC7B,6BAA6B;QAC7B,cAAc;QACd,oCAAoC;QACpC,sBAAsB;QACtB,0BAA0B;QAC1B,gCAAgC;QAChC,iCAAiC;QACjC,uCAAuC;QACvC,yBAAyB;QACzB,4BAA4B;QAC5B,iBAAiB;QACjB,oBAAoB;QACpB,2BAA2B;QAC3B,wCAAwC;QACxC,4CAA4C;QAC5C,wCAAwC;QACxC,2CAA2C;QAC3C,oBAAoB;QACpB,qBAAqB;QACrB,oBAAoB;QACpB,oBAAoB;QACpB,+BAA+B;MACjC;IACF;EACF;;;;ADrCK,IAAMC,eAAe,MAC1BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAUC;EACZ,CAAA;EACAN,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOI;IACpBF,UAAUG;EACZ,CAAA;EACAR,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOM;IACpBJ,UAAU,MAAMK,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAb,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOW;IACpBT,UAAU,MACRK,YAAYC,aAAaI,UAAU;MACjCd,IAAIe,YAAWC;MACfC,UAAU;QACRC,gBAAgBC,aAAaC;QAC7BC,cAAc,CAACC,OAAuC,EAAEC,MAAK,MAC3DC,aAAaL,aAAaM,QAAQ;UAAE,GAAGH;UAAOC;QAAM,CAAA;QACtDG,aAAa;UAAC;UAA4B;YAAEC,IAAIC;UAAc;;QAC9DC,MAAM;;QAENC,gBAAgB,OAAOC,WAAuB,MAAMC,SAASC,QAAQ;UAACF,OAAOG;SAAO;MACtF;IACF,CAAA;EACJ,CAAA;EACAnC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAakC,aAAaC;IAC1BhC,UAAU,MAAM;MACdK,YAAY4B,mBAAmBC,cAAc;QAACC;OAAa;MAC3D9B,YAAY4B,mBAAmBG,QAAQ;QAACzB;OAAW;;EAEvD,CAAA;EACAhB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOuC;IACpBrC,UAAUsC;EACZ,CAAA;EACA3C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOyC;IACpBvC,UAAUwC;EACZ,CAAA;EACA7C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOI;IACpBF,UAAUyC;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["lazy", "Compiler", "lazy", "IntentResolver", "ReactSurface", "ScriptSettings", "Artifact", "Capabilities", "contributes", "createIntent", "defineModule", "definePlugin", "Events", "FunctionType", "ScriptType", "RefArray", "ClientCapabilities", "ClientEvents", "ScriptType", "ScriptType", "typename", "SCRIPT_PLUGIN", "ScriptPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupSettings", "activate", "ScriptSettings", "Startup", "Compiler", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "ScriptType", "typename", "metadata", "creationSchema", "ScriptAction", "CreateScriptSchema", "createObject", "props", "space", "createIntent", "Create", "placeholder", "ns", "SCRIPT_PLUGIN", "icon", "loadReferences", "script", "RefArray", "loadAll", "source", "ClientEvents", "SetupSchema", "ClientCapabilities", "SystemSchema", "FunctionType", "Schema", "SetupSurfaces", "ReactSurface", "SetupIntents", "IntentResolver", "Artifact"]
|
|
7
7
|
}
|