@dxos/plugin-script 0.6.13 → 0.6.14-main.1366248

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.
Files changed (206) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/browser/AutomationPanel-XLL2ZXGS.mjs +78 -0
  3. package/dist/lib/browser/AutomationPanel-XLL2ZXGS.mjs.map +7 -0
  4. package/dist/lib/browser/ScriptContainer-YXH4MFEO.mjs +415 -0
  5. package/dist/lib/browser/ScriptContainer-YXH4MFEO.mjs.map +7 -0
  6. package/dist/lib/browser/chunk-C7VBULMK.mjs +18 -0
  7. package/dist/lib/browser/chunk-C7VBULMK.mjs.map +7 -0
  8. package/dist/lib/browser/{chunk-RHEZ5LUU.mjs → chunk-G6H56WFS.mjs} +51 -2
  9. package/dist/lib/browser/{chunk-RHEZ5LUU.mjs.map → chunk-G6H56WFS.mjs.map} +4 -4
  10. package/dist/lib/browser/{chunk-DL5XQRQM.mjs → chunk-KHNN3F7J.mjs} +18 -6
  11. package/dist/lib/browser/chunk-KHNN3F7J.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-NCZUJKJE.mjs +236 -0
  13. package/dist/lib/browser/chunk-NCZUJKJE.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-O4LWBX6A.mjs → chunk-USXWNH3S.mjs} +2 -2
  15. package/dist/lib/browser/{chunk-O4LWBX6A.mjs.map → chunk-USXWNH3S.mjs.map} +2 -2
  16. package/dist/lib/browser/edge/index.mjs +5 -1
  17. package/dist/lib/browser/index.mjs +185 -62
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/meta.json +1 -1
  20. package/dist/lib/browser/meta.mjs +1 -1
  21. package/dist/lib/browser/types/index.mjs +2 -2
  22. package/dist/lib/node/AutomationPanel-OSPAFWZU.cjs +100 -0
  23. package/dist/lib/node/AutomationPanel-OSPAFWZU.cjs.map +7 -0
  24. package/dist/lib/node/ScriptContainer-FWHFEIHK.cjs +417 -0
  25. package/dist/lib/node/ScriptContainer-FWHFEIHK.cjs.map +7 -0
  26. package/dist/lib/node/{TypescriptEditor-M3WWFIP2.cjs → chunk-6LYX73ZT.cjs} +19 -8
  27. package/dist/lib/node/chunk-6LYX73ZT.cjs.map +7 -0
  28. package/dist/lib/node/{chunk-4GTXIELQ.cjs → chunk-ACLCRWDB.cjs} +44 -6
  29. package/dist/lib/node/chunk-ACLCRWDB.cjs.map +7 -0
  30. package/dist/lib/node/chunk-BJ4WIWCP.cjs +265 -0
  31. package/dist/lib/node/chunk-BJ4WIWCP.cjs.map +7 -0
  32. package/dist/lib/node/{chunk-5RBVXKXT.cjs → chunk-CPNHUAFN.cjs} +6 -6
  33. package/dist/lib/node/{chunk-5RBVXKXT.cjs.map → chunk-CPNHUAFN.cjs.map} +2 -2
  34. package/dist/lib/node/{chunk-PFH3ROEH.cjs → chunk-FY5KKL5N.cjs} +22 -8
  35. package/dist/lib/node/chunk-FY5KKL5N.cjs.map +7 -0
  36. package/dist/lib/node/edge/index.cjs +12 -8
  37. package/dist/lib/node/edge/index.cjs.map +2 -2
  38. package/dist/lib/node/index.cjs +196 -81
  39. package/dist/lib/node/index.cjs.map +4 -4
  40. package/dist/lib/node/meta.cjs +3 -3
  41. package/dist/lib/node/meta.cjs.map +1 -1
  42. package/dist/lib/node/meta.json +1 -1
  43. package/dist/lib/node/types/index.cjs +5 -5
  44. package/dist/lib/node/types/index.cjs.map +1 -1
  45. package/dist/lib/node-esm/AutomationPanel-KJNL6ARP.mjs +79 -0
  46. package/dist/lib/node-esm/AutomationPanel-KJNL6ARP.mjs.map +7 -0
  47. package/dist/lib/node-esm/ScriptContainer-6U5WJFRB.mjs +416 -0
  48. package/dist/lib/node-esm/ScriptContainer-6U5WJFRB.mjs.map +7 -0
  49. package/dist/lib/node-esm/chunk-2NPZGQGA.mjs +47 -0
  50. package/dist/lib/node-esm/chunk-2NPZGQGA.mjs.map +7 -0
  51. package/dist/lib/node-esm/chunk-DXWSRDEN.mjs +237 -0
  52. package/dist/lib/node-esm/chunk-DXWSRDEN.mjs.map +7 -0
  53. package/dist/lib/node-esm/chunk-LDLNTVAK.mjs +280 -0
  54. package/dist/lib/node-esm/chunk-LDLNTVAK.mjs.map +7 -0
  55. package/dist/lib/node-esm/chunk-QMTTZYLF.mjs +255 -0
  56. package/dist/lib/node-esm/chunk-QMTTZYLF.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-SLTZMY34.mjs +20 -0
  58. package/dist/lib/node-esm/chunk-SLTZMY34.mjs.map +7 -0
  59. package/dist/lib/node-esm/edge/index.mjs +24 -0
  60. package/dist/lib/node-esm/index.mjs +415 -0
  61. package/dist/lib/node-esm/index.mjs.map +7 -0
  62. package/dist/lib/node-esm/meta.json +1 -0
  63. package/dist/lib/node-esm/meta.mjs +10 -0
  64. package/dist/lib/node-esm/meta.mjs.map +7 -0
  65. package/dist/lib/node-esm/types/index.mjs +13 -0
  66. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  67. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  68. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +17 -0
  69. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -0
  70. package/dist/types/src/components/AutomationPanel/index.d.ts +4 -0
  71. package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -0
  72. package/dist/types/src/components/DebugPanel/DebugPanel.d.ts +7 -0
  73. package/dist/types/src/components/DebugPanel/DebugPanel.d.ts.map +1 -0
  74. package/dist/types/src/components/DebugPanel/index.d.ts +2 -0
  75. package/dist/types/src/components/DebugPanel/index.d.ts.map +1 -0
  76. package/dist/types/src/components/{ScriptBlock/FrameContainer → FrameContainer}/FrameContainer.d.ts +1 -1
  77. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -0
  78. package/dist/types/src/components/FrameContainer/frame.d.ts.map +1 -0
  79. package/dist/types/src/components/FrameContainer/index.d.ts.map +1 -0
  80. package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts +1 -3
  81. package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +1 -1
  82. package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +3 -8
  83. package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +1 -1
  84. package/dist/types/src/components/ScriptContainer.d.ts +5 -0
  85. package/dist/types/src/components/ScriptContainer.d.ts.map +1 -0
  86. package/dist/types/src/components/ScriptEditor.d.ts +4 -5
  87. package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
  88. package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts +6 -0
  89. package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts.map +1 -0
  90. package/dist/types/src/components/ScriptSettings/index.d.ts +2 -0
  91. package/dist/types/src/components/ScriptSettings/index.d.ts.map +1 -0
  92. package/dist/types/src/components/ScriptSettingsPanel.d.ts +7 -0
  93. package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -0
  94. package/dist/types/src/components/Toolbar/Toolbar.d.ts +23 -0
  95. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  96. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +14 -0
  97. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -0
  98. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  99. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  100. package/dist/types/src/components/{TypescriptEditor.d.ts → TypescriptEditor/TypescriptEditor.d.ts} +1 -2
  101. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -0
  102. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +6 -0
  103. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -0
  104. package/dist/types/src/components/TypescriptEditor/index.d.ts +2 -0
  105. package/dist/types/src/components/TypescriptEditor/index.d.ts.map +1 -0
  106. package/dist/types/src/components/index.d.ts +4 -3
  107. package/dist/types/src/components/index.d.ts.map +1 -1
  108. package/dist/types/src/edge/functions.d.ts +7 -0
  109. package/dist/types/src/edge/functions.d.ts.map +1 -1
  110. package/dist/types/src/meta.d.ts +5 -9
  111. package/dist/types/src/meta.d.ts.map +1 -1
  112. package/dist/types/src/templates/chat.d.ts +6 -0
  113. package/dist/types/src/templates/chat.d.ts.map +1 -0
  114. package/dist/types/src/templates/chess.d.ts +6 -0
  115. package/dist/types/src/templates/chess.d.ts.map +1 -0
  116. package/dist/types/src/templates/echo.d.ts +6 -0
  117. package/dist/types/src/templates/echo.d.ts.map +1 -0
  118. package/dist/types/src/templates/email.d.ts +6 -0
  119. package/dist/types/src/templates/email.d.ts.map +1 -0
  120. package/dist/types/src/templates/forex.d.ts +6 -0
  121. package/dist/types/src/templates/forex.d.ts.map +1 -0
  122. package/dist/types/src/templates.d.ts +8 -0
  123. package/dist/types/src/templates.d.ts.map +1 -0
  124. package/dist/types/src/translations.d.ts +7 -0
  125. package/dist/types/src/translations.d.ts.map +1 -1
  126. package/dist/types/src/types/script.d.ts +4 -4
  127. package/dist/types/src/types/types.d.ts +4 -3
  128. package/dist/types/src/types/types.d.ts.map +1 -1
  129. package/package.json +59 -64
  130. package/src/ScriptPlugin.tsx +47 -41
  131. package/src/bundler/bundler.test.ts +12 -2
  132. package/src/components/AutomationPanel/AutomationPanel.tsx +101 -0
  133. package/src/components/AutomationPanel/index.ts +9 -0
  134. package/src/components/{DebugPanel.tsx → DebugPanel/DebugPanel.tsx} +74 -96
  135. package/src/components/DebugPanel/index.ts +5 -0
  136. package/src/components/{ScriptBlock/FrameContainer → FrameContainer}/FrameContainer.tsx +1 -1
  137. package/src/components/ScriptBlock/ScriptBlock.stories.tsx +15 -14
  138. package/src/components/ScriptBlock/ScriptBlock.tsx +23 -51
  139. package/src/components/ScriptContainer.tsx +22 -0
  140. package/src/components/ScriptEditor.tsx +51 -62
  141. package/src/components/ScriptSettings/ScriptSettings.tsx +47 -0
  142. package/src/components/ScriptSettings/index.ts +5 -0
  143. package/src/components/ScriptSettingsPanel.tsx +105 -0
  144. package/src/components/Toolbar/Toolbar.stories.tsx +30 -0
  145. package/src/components/Toolbar/Toolbar.tsx +177 -0
  146. package/src/components/{ScriptBlock/Splitter → Toolbar}/index.ts +1 -1
  147. package/src/components/{TypescriptEditor.stories.tsx → TypescriptEditor/TypescriptEditor.stories.tsx} +17 -35
  148. package/src/components/{TypescriptEditor.tsx → TypescriptEditor/TypescriptEditor.tsx} +1 -3
  149. package/src/components/TypescriptEditor/index.ts +5 -0
  150. package/src/components/index.ts +6 -3
  151. package/src/edge/functions.ts +19 -0
  152. package/src/meta.ts +16 -0
  153. package/src/templates/chat.ts +102 -0
  154. package/src/templates/chess.ts +41 -0
  155. package/src/templates/echo.ts +15 -0
  156. package/src/templates/email.ts +38 -0
  157. package/src/templates/forex.ts +21 -0
  158. package/src/templates.ts +54 -0
  159. package/src/translations.ts +7 -0
  160. package/src/types/types.ts +9 -5
  161. package/dist/lib/browser/ScriptEditor-5Y3EROG3.mjs +0 -513
  162. package/dist/lib/browser/ScriptEditor-5Y3EROG3.mjs.map +0 -7
  163. package/dist/lib/browser/TypescriptEditor-GPE72Y6I.mjs +0 -9
  164. package/dist/lib/browser/chunk-DL5XQRQM.mjs.map +0 -7
  165. package/dist/lib/browser/chunk-JBACGDOJ.mjs +0 -21
  166. package/dist/lib/browser/chunk-JBACGDOJ.mjs.map +0 -7
  167. package/dist/lib/browser/chunk-MRGOT5RF.mjs +0 -78
  168. package/dist/lib/browser/chunk-MRGOT5RF.mjs.map +0 -7
  169. package/dist/lib/node/ScriptEditor-YCUQFWQM.cjs +0 -526
  170. package/dist/lib/node/ScriptEditor-YCUQFWQM.cjs.map +0 -7
  171. package/dist/lib/node/TypescriptEditor-M3WWFIP2.cjs.map +0 -7
  172. package/dist/lib/node/chunk-4GTXIELQ.cjs.map +0 -7
  173. package/dist/lib/node/chunk-4VMNBXWU.cjs +0 -54
  174. package/dist/lib/node/chunk-4VMNBXWU.cjs.map +0 -7
  175. package/dist/lib/node/chunk-IMLDKD5Y.cjs +0 -111
  176. package/dist/lib/node/chunk-IMLDKD5Y.cjs.map +0 -7
  177. package/dist/lib/node/chunk-PFH3ROEH.cjs.map +0 -7
  178. package/dist/types/src/components/DebugPanel.d.ts +0 -9
  179. package/dist/types/src/components/DebugPanel.d.ts.map +0 -1
  180. package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts.map +0 -1
  181. package/dist/types/src/components/ScriptBlock/FrameContainer/frame.d.ts.map +0 -1
  182. package/dist/types/src/components/ScriptBlock/FrameContainer/index.d.ts.map +0 -1
  183. package/dist/types/src/components/ScriptBlock/Splitter/Splitter.d.ts +0 -15
  184. package/dist/types/src/components/ScriptBlock/Splitter/Splitter.d.ts.map +0 -1
  185. package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts +0 -13
  186. package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts.map +0 -1
  187. package/dist/types/src/components/ScriptBlock/Splitter/index.d.ts +0 -2
  188. package/dist/types/src/components/ScriptBlock/Splitter/index.d.ts.map +0 -1
  189. package/dist/types/src/components/Toolbar.d.ts +0 -13
  190. package/dist/types/src/components/Toolbar.d.ts.map +0 -1
  191. package/dist/types/src/components/Toolbar.stories.d.ts +0 -14
  192. package/dist/types/src/components/Toolbar.stories.d.ts.map +0 -1
  193. package/dist/types/src/components/TypescriptEditor.d.ts.map +0 -1
  194. package/dist/types/src/components/TypescriptEditor.stories.d.ts +0 -10
  195. package/dist/types/src/components/TypescriptEditor.stories.d.ts.map +0 -1
  196. package/src/components/ScriptBlock/Splitter/Splitter.stories.tsx +0 -37
  197. package/src/components/ScriptBlock/Splitter/Splitter.tsx +0 -52
  198. package/src/components/Toolbar.stories.tsx +0 -17
  199. package/src/components/Toolbar.tsx +0 -147
  200. package/src/meta.tsx +0 -19
  201. /package/dist/lib/{browser/TypescriptEditor-GPE72Y6I.mjs.map → node-esm/edge/index.mjs.map} +0 -0
  202. /package/dist/types/src/components/{ScriptBlock/FrameContainer → FrameContainer}/frame.d.ts +0 -0
  203. /package/dist/types/src/components/{ScriptBlock/FrameContainer → FrameContainer}/index.d.ts +0 -0
  204. /package/src/components/{ScriptBlock/FrameContainer → FrameContainer}/frame.html +0 -0
  205. /package/src/components/{ScriptBlock/FrameContainer → FrameContainer}/frame.tsx +0 -0
  206. /package/src/components/{ScriptBlock/FrameContainer → FrameContainer}/index.ts +0 -0
package/package.json CHANGED
@@ -1,39 +1,32 @@
1
1
  {
2
2
  "name": "@dxos/plugin-script",
3
- "version": "0.6.13",
3
+ "version": "0.6.14-main.1366248",
4
4
  "description": "Braneframe notebook plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
+ "sideEffects": true,
9
10
  "exports": {
10
- ".": {
11
- "browser": "./dist/lib/browser/index.mjs",
12
- "node": {
13
- "default": "./dist/lib/node/index.cjs"
14
- },
15
- "types": "./dist/types/src/index.d.ts"
16
- },
17
11
  "./edge": {
12
+ "types": "./dist/types/src/edge/index.d.ts",
18
13
  "browser": "./dist/lib/browser/edge/index.mjs",
19
- "node": {
20
- "default": "./dist/lib/node/edge/index.cjs"
21
- },
22
- "types": "./dist/types/src/edge/index.d.ts"
14
+ "node": "./dist/lib/node-esm/edge/index.mjs"
15
+ },
16
+ ".": {
17
+ "types": "./dist/types/src/index.d.ts",
18
+ "browser": "./dist/lib/browser/index.mjs",
19
+ "node": "./dist/lib/node-esm/index.mjs"
23
20
  },
24
21
  "./meta": {
22
+ "types": "./dist/types/src/meta.d.ts",
25
23
  "browser": "./dist/lib/browser/meta.mjs",
26
- "node": {
27
- "default": "./dist/lib/node/meta.cjs"
28
- },
29
- "types": "./dist/types/src/meta.d.ts"
24
+ "node": "./dist/lib/node-esm/meta.mjs"
30
25
  },
31
26
  "./types": {
27
+ "types": "./dist/types/src/types/index.d.ts",
32
28
  "browser": "./dist/lib/browser/types/index.mjs",
33
- "node": {
34
- "default": "./dist/lib/node/types/index.cjs"
35
- },
36
- "types": "./dist/types/src/types/index.d.ts"
29
+ "node": "./dist/lib/node-esm/types/index.mjs"
37
30
  }
38
31
  },
39
32
  "types": "dist/types/src/index.d.ts",
@@ -55,14 +48,15 @@
55
48
  "src"
56
49
  ],
57
50
  "dependencies": {
58
- "@codemirror/autocomplete": "^6.18.0",
51
+ "@codemirror/autocomplete": "^6.18.1",
59
52
  "@codemirror/lang-javascript": "^6.2.2",
60
- "@codemirror/language": "^6.10.2",
61
- "@codemirror/lint": "^6.8.1",
53
+ "@codemirror/language": "^6.10.3",
54
+ "@codemirror/lint": "^6.8.2",
62
55
  "@codemirror/state": "^6.4.1",
63
56
  "@codemirror/theme-one-dark": "^6.1.2",
64
- "@codemirror/view": "^6.29.1",
65
- "@lezer/common": "^1.2.1",
57
+ "@codemirror/view": "^6.34.1",
58
+ "@effect/schema": "^0.75.1",
59
+ "@lezer/common": "^1.2.2",
66
60
  "@preact/signals-core": "^1.6.0",
67
61
  "@typescript/vfs": "^1.6.0",
68
62
  "@valtown/codemirror-ts": "^2.2.0",
@@ -72,32 +66,33 @@
72
66
  "lodash.get": "^4.4.2",
73
67
  "prettier": "^3.2.4",
74
68
  "react-syntax-highlighter": "^15.5.0",
75
- "typescript": "^5.5.4",
76
- "@dxos/app-framework": "0.6.13",
77
- "@dxos/crypto": "0.6.13",
78
- "@dxos/client": "0.6.13",
79
- "@dxos/client-protocol": "0.6.13",
80
- "@dxos/async": "0.6.13",
81
- "@dxos/echo-schema": "0.6.13",
82
- "@dxos/debug": "0.6.13",
83
- "@dxos/invariant": "0.6.13",
84
- "@dxos/keys": "0.6.13",
85
- "@dxos/log": "0.6.13",
86
- "@dxos/plugin-explorer": "0.6.13",
87
- "@dxos/plugin-graph": "0.6.13",
88
- "@dxos/plugin-client": "0.6.13",
89
- "@dxos/plugin-markdown": "0.6.13",
90
- "@dxos/plugin-space": "0.6.13",
91
- "@dxos/plugin-stack": "0.6.13",
92
- "@dxos/protocols": "0.6.13",
93
- "@dxos/plugin-theme": "0.6.13",
94
- "@dxos/react-client": "0.6.13",
95
- "@dxos/react-ui-editor": "0.6.13",
96
- "@dxos/react-ui-attention": "0.6.13",
97
- "@dxos/rpc": "0.6.13",
98
- "@dxos/react-ui-syntax-highlighter": "0.6.13",
99
- "@dxos/rpc-tunnel": "0.6.13",
100
- "@dxos/util": "0.6.13"
69
+ "typescript": "^5.6.2",
70
+ "@dxos/app-framework": "0.6.14-main.1366248",
71
+ "@dxos/client": "0.6.14-main.1366248",
72
+ "@dxos/client-protocol": "0.6.14-main.1366248",
73
+ "@dxos/async": "0.6.14-main.1366248",
74
+ "@dxos/debug": "0.6.14-main.1366248",
75
+ "@dxos/echo-schema": "0.6.14-main.1366248",
76
+ "@dxos/invariant": "0.6.14-main.1366248",
77
+ "@dxos/keys": "0.6.14-main.1366248",
78
+ "@dxos/crypto": "0.6.14-main.1366248",
79
+ "@dxos/log": "0.6.14-main.1366248",
80
+ "@dxos/plugin-client": "0.6.14-main.1366248",
81
+ "@dxos/plugin-graph": "0.6.14-main.1366248",
82
+ "@dxos/plugin-explorer": "0.6.14-main.1366248",
83
+ "@dxos/plugin-markdown": "0.6.14-main.1366248",
84
+ "@dxos/plugin-theme": "0.6.14-main.1366248",
85
+ "@dxos/plugin-stack": "0.6.14-main.1366248",
86
+ "@dxos/plugin-space": "0.6.14-main.1366248",
87
+ "@dxos/protocols": "0.6.14-main.1366248",
88
+ "@dxos/react-client": "0.6.14-main.1366248",
89
+ "@dxos/react-ui-data": "0.6.14-main.1366248",
90
+ "@dxos/react-ui-attention": "0.6.14-main.1366248",
91
+ "@dxos/react-ui-editor": "0.6.14-main.1366248",
92
+ "@dxos/react-ui-syntax-highlighter": "0.6.14-main.1366248",
93
+ "@dxos/rpc-tunnel": "0.6.14-main.1366248",
94
+ "@dxos/rpc": "0.6.14-main.1366248",
95
+ "@dxos/util": "0.6.14-main.1366248"
101
96
  },
102
97
  "devDependencies": {
103
98
  "@phosphor-icons/react": "^2.1.5",
@@ -106,21 +101,21 @@
106
101
  "@types/react-dom": "~18.2.0",
107
102
  "react": "~18.2.0",
108
103
  "react-dom": "~18.2.0",
109
- "vite": "^5.3.4",
110
- "@dxos/echo-generator": "0.6.13",
111
- "@dxos/random": "0.6.13",
112
- "@dxos/react-ui": "0.6.13",
113
- "@dxos/react-ui-mosaic": "0.6.13",
114
- "@dxos/react-ui-theme": "0.6.13",
115
- "@dxos/storybook-utils": "0.6.13"
104
+ "vite": "5.4.7",
105
+ "@dxos/echo-generator": "0.6.14-main.1366248",
106
+ "@dxos/random": "0.6.14-main.1366248",
107
+ "@dxos/react-ui-mosaic": "0.6.14-main.1366248",
108
+ "@dxos/react-ui": "0.6.14-main.1366248",
109
+ "@dxos/react-ui-theme": "0.6.14-main.1366248",
110
+ "@dxos/storybook-utils": "0.6.14-main.1366248"
116
111
  },
117
- "optionalDependencies": {
112
+ "peerDependencies": {
118
113
  "@phosphor-icons/react": "^2.1.5",
119
- "react": "^18.0.0",
120
- "react-dom": "^18.0.0",
121
- "@dxos/react-ui": "0.6.13",
122
- "@dxos/react-ui-theme": "0.6.13",
123
- "@dxos/react-ui-mosaic": "0.6.13"
114
+ "react": "~18.2.0",
115
+ "react-dom": "~18.2.0",
116
+ "@dxos/react-ui": "0.6.14-main.1366248",
117
+ "@dxos/react-ui-mosaic": "0.6.14-main.1366248",
118
+ "@dxos/react-ui-theme": "0.6.14-main.1366248"
124
119
  },
125
120
  "publishConfig": {
126
121
  "access": "public"
@@ -2,12 +2,11 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Code, type IconProps } from '@phosphor-icons/react';
6
5
  // @ts-ignore
7
6
  import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
8
7
  import React from 'react';
9
8
 
10
- import { parseIntentPlugin, type PluginDefinition, resolvePlugin, NavigationAction } from '@dxos/app-framework';
9
+ import { NavigationAction, parseIntentPlugin, type PluginDefinition, resolvePlugin } from '@dxos/app-framework';
11
10
  import { create } from '@dxos/echo-schema';
12
11
  import { parseClientPlugin } from '@dxos/plugin-client';
13
12
  import { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';
@@ -17,11 +16,11 @@ import { loadObjectReferences } from '@dxos/react-client/echo';
17
16
 
18
17
  import { initializeBundler } from './bundler';
19
18
  import { Compiler } from './compiler';
20
- import { ScriptEditor } from './components';
19
+ import { AutomationPanel, ScriptContainer, ScriptSettings, ScriptSettingsPanel } from './components';
21
20
  import meta, { SCRIPT_PLUGIN } from './meta';
21
+ import { templates } from './templates';
22
22
  import translations from './translations';
23
- import { FunctionType, ScriptType } from './types';
24
- import { ScriptAction, type ScriptPluginProvides } from './types';
23
+ import { FunctionType, ScriptAction, type ScriptPluginProvides, ScriptType } from './types';
25
24
 
26
25
  export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
27
26
  const compiler = new Compiler();
@@ -45,12 +44,12 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
45
44
  await initializeBundler({ wasmUrl });
46
45
  },
47
46
  provides: {
47
+ settings: {},
48
48
  metadata: {
49
49
  records: {
50
50
  [ScriptType.typename]: {
51
51
  placeholder: ['object title placeholder', { ns: SCRIPT_PLUGIN }],
52
- icon: (props: IconProps) => <Code {...props} />,
53
- iconSymbol: 'ph--code--regular',
52
+ icon: 'ph--code--regular',
54
53
  // TODO(wittjosiah): Move out of metadata.
55
54
  loadReferences: (script: ScriptType) => loadObjectReferences(script, (script) => [script.source]),
56
55
  },
@@ -60,6 +59,12 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
60
59
  echo: {
61
60
  schema: [ScriptType, FunctionType],
62
61
  },
62
+ space: {
63
+ onSpaceCreate: {
64
+ label: ['create object label', { ns: SCRIPT_PLUGIN }],
65
+ action: ScriptAction.CREATE,
66
+ },
67
+ },
63
68
  graph: {
64
69
  builder: (plugins) => {
65
70
  const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
@@ -93,8 +98,7 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
93
98
  },
94
99
  properties: {
95
100
  label: ['create object label', { ns: SCRIPT_PLUGIN }],
96
- icon: (props: IconProps) => <Code {...props} />,
97
- iconSymbol: 'ph--code--regular',
101
+ icon: 'ph--code--regular',
98
102
  testId: 'scriptPlugin.createObject',
99
103
  },
100
104
  },
@@ -103,29 +107,36 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
103
107
  });
104
108
  },
105
109
  },
106
- stack: {
107
- creators: [
108
- {
109
- id: 'create-stack-section-script',
110
- testId: 'scriptPlugin.createSection',
111
- type: ['plugin name', { ns: SCRIPT_PLUGIN }],
112
- label: ['create stack section label', { ns: SCRIPT_PLUGIN }],
113
- icon: (props: any) => <Code {...props} />,
114
- intent: {
115
- plugin: SCRIPT_PLUGIN,
116
- action: ScriptAction.CREATE,
117
- },
118
- },
119
- ],
120
- },
121
110
  surface: {
122
111
  component: ({ data, role }) => {
123
- if (role && !['article', 'section'].includes(role)) {
124
- return null;
125
- }
112
+ switch (role) {
113
+ case 'settings': {
114
+ return data.plugin === meta.id ? <ScriptSettings settings={{}} /> : null;
115
+ }
116
+
117
+ case 'article': {
118
+ if (data.object instanceof ScriptType) {
119
+ return <ScriptContainer script={data.object} env={compiler.environment} />;
120
+ }
121
+ break;
122
+ }
123
+
124
+ case 'complementary--automation': {
125
+ if (data.subject instanceof ScriptType) {
126
+ return {
127
+ node: <AutomationPanel subject={data.subject as any} />,
128
+ disposition: 'hoist',
129
+ };
130
+ }
131
+ break;
132
+ }
126
133
 
127
- if (data.object instanceof ScriptType) {
128
- return <ScriptEditor env={compiler.environment} script={data.object} role={role} />;
134
+ case 'complementary--settings': {
135
+ if (data.subject instanceof ScriptType) {
136
+ return <ScriptSettingsPanel script={data.subject} />;
137
+ }
138
+ break;
139
+ }
129
140
  }
130
141
 
131
142
  return null;
@@ -135,7 +146,13 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
135
146
  resolver: (intent) => {
136
147
  switch (intent.action) {
137
148
  case ScriptAction.CREATE: {
138
- return { data: create(ScriptType, { source: create(TextType, { content: example }) }) };
149
+ return {
150
+ data: create(ScriptType, {
151
+ source: create(TextType, {
152
+ content: templates[0].source,
153
+ }),
154
+ }),
155
+ };
139
156
  }
140
157
  }
141
158
  },
@@ -143,14 +160,3 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
143
160
  },
144
161
  };
145
162
  };
146
-
147
- // TODO(burdon): Import.
148
- const example = [
149
- 'export default async ({ ',
150
- ' event: { data: { request } },',
151
- ' context: { space, ai } ',
152
- '}: any) => {',
153
- " return new Response('Hello DXOS!');",
154
- '};',
155
- '',
156
- ].join('\n');
@@ -2,11 +2,21 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { describe, expect, test } from 'vitest';
5
+ // @ts-ignore
6
+ import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
7
+ import { beforeAll, describe, expect, test } from 'vitest';
6
8
 
7
- import { Bundler } from './bundler';
9
+ import { isNode } from '@dxos/util';
10
+
11
+ import { Bundler, initializeBundler } from './bundler';
8
12
 
9
13
  describe('Bundler', () => {
14
+ beforeAll(async () => {
15
+ if (!isNode()) {
16
+ await initializeBundler({ wasmUrl });
17
+ }
18
+ });
19
+
10
20
  test('Basic', async () => {
11
21
  const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
12
22
  const result = await bundler.bundle('const x = 100'); // TODO(burdon): Test import.
@@ -0,0 +1,101 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { useMemo, useState } from 'react';
6
+
7
+ import { type EchoReactiveObject } from '@dxos/client/echo';
8
+ import { failUndefined } from '@dxos/debug';
9
+ import { useClient } from '@dxos/react-client';
10
+ import { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';
11
+ import { Select } from '@dxos/react-ui';
12
+
13
+ import { getInvocationUrl, getUserFunctionUrlInMetadata } from '../../edge';
14
+ import { FunctionType, ScriptType } from '../../types';
15
+ import { DebugPanel } from '../DebugPanel';
16
+
17
+ export interface AutomationPanelProps {
18
+ subject: EchoReactiveObject<any>;
19
+ }
20
+
21
+ export const AutomationPanel = ({ subject }: AutomationPanelProps) => {
22
+ const space = getSpace(subject);
23
+
24
+ // TODO(dmaretskyi): Parametric query.
25
+ const functions = useQuery(
26
+ space ?? undefined,
27
+ Filter.schema(FunctionType, (fn) => (subject instanceof ScriptType ? fn.source === subject : fn.binding != null)),
28
+ {},
29
+ [subject],
30
+ );
31
+ const [selectedFunction, setSelectedFunction] = useState<FunctionType | null>(null);
32
+ const functionToChatWith = subject instanceof ScriptType ? functions[0] : selectedFunction;
33
+
34
+ return (
35
+ <div className='h-full flex flex-col'>
36
+ {!(subject instanceof ScriptType) && (
37
+ <BindingSelect
38
+ selectedFunction={selectedFunction}
39
+ setSelectedFunction={setSelectedFunction}
40
+ functions={functions}
41
+ />
42
+ )}
43
+ {functionToChatWith && <ChatPanel fn={functionToChatWith} subject={subject} />}
44
+ {subject instanceof ScriptType && functions.length === 0 && <p>Deploy function to interact with it.</p>}
45
+ </div>
46
+ );
47
+ };
48
+
49
+ export interface ChatPanelProps {
50
+ fn: FunctionType;
51
+ subject: EchoReactiveObject<any>;
52
+ }
53
+
54
+ const ChatPanel = ({ fn, subject }: ChatPanelProps) => {
55
+ const client = useClient();
56
+ const space = getSpace(fn);
57
+ const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));
58
+ const functionUrl = useMemo(() => {
59
+ if (!existingFunctionUrl) {
60
+ return;
61
+ }
62
+
63
+ return getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? '', {
64
+ spaceId: space?.id,
65
+ subjectId: subject?.id,
66
+ });
67
+ }, [existingFunctionUrl, space, subject]);
68
+
69
+ return <DebugPanel functionUrl={functionUrl} classNames='flex-1' />;
70
+ };
71
+
72
+ export interface BindingSelectProps {
73
+ selectedFunction: FunctionType | null;
74
+ setSelectedFunction: (fn: FunctionType) => void;
75
+ functions: FunctionType[];
76
+ }
77
+
78
+ const BindingSelect = ({ selectedFunction, setSelectedFunction, functions }: BindingSelectProps) => {
79
+ return (
80
+ <Select.Root
81
+ value={selectedFunction?.id}
82
+ onValueChange={(id) => setSelectedFunction(functions.find((fn) => fn.id === id) ?? failUndefined())}
83
+ >
84
+ <Select.TriggerButton placeholder='Select value' />
85
+ <Select.Portal>
86
+ <Select.Content>
87
+ <Select.ScrollUpButton />
88
+ <Select.Viewport>
89
+ {functions.map(({ id, binding }) => (
90
+ <Select.Option key={id} value={id}>
91
+ {binding}
92
+ </Select.Option>
93
+ ))}
94
+ </Select.Viewport>
95
+ <Select.ScrollDownButton />
96
+ <Select.Arrow />
97
+ </Select.Content>
98
+ </Select.Portal>
99
+ </Select.Root>
100
+ );
101
+ };
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { AutomationPanel } from './AutomationPanel';
6
+
7
+ export * from './AutomationPanel';
8
+
9
+ export default AutomationPanel;