@dxos/plugin-script 0.9.0 → 0.9.1-main.c7dcc2e112
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/neutral/{DeploymentDialog-M3AFYQHC.mjs → DeploymentDialog-7OIIL7LB.mjs} +10 -10
- package/dist/lib/neutral/DeploymentDialog-7OIIL7LB.mjs.map +7 -0
- package/dist/lib/neutral/{NotebookArticle-NV4AHOOS.mjs → NotebookArticle-E35G2Y2I.mjs} +2 -2
- package/dist/lib/neutral/NotebookArticle-E35G2Y2I.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +2 -2
- package/dist/lib/neutral/ScriptPlugin.mjs.map +4 -4
- package/dist/lib/neutral/{ScriptPluginSettings-T4JMUSHN.mjs → ScriptPluginSettings-5AURDJTI.mjs} +3 -3
- package/dist/lib/neutral/ScriptPluginSettings-5AURDJTI.mjs.map +7 -0
- package/dist/lib/neutral/{ScriptProperties-RLXNAN3N.mjs → ScriptProperties-ADTWXG6O.mjs} +9 -10
- package/dist/lib/neutral/ScriptProperties-ADTWXG6O.mjs.map +7 -0
- package/dist/lib/neutral/{app-graph-builder-7AWFCEQF.mjs → app-graph-builder-POP3CX6G.mjs} +3 -3
- package/dist/lib/neutral/{app-graph-builder-7AWFCEQF.mjs.map → app-graph-builder-POP3CX6G.mjs.map} +3 -3
- package/dist/lib/neutral/blueprints/index.mjs +1 -1
- package/dist/lib/neutral/capabilities/index.mjs +4 -4
- package/dist/lib/neutral/capabilities/index.mjs.map +2 -2
- package/dist/lib/neutral/capabilities/node.mjs +2 -2
- package/dist/lib/neutral/capabilities/node.mjs.map +2 -2
- package/dist/lib/neutral/{chunk-BKXYHCJ6.mjs → chunk-JAJ64B3E.mjs} +2 -2
- package/dist/lib/neutral/chunk-NVV5UYY4.mjs +50 -0
- package/dist/lib/neutral/chunk-NVV5UYY4.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-XFM63AKT.mjs → chunk-O6A5PTB3.mjs} +2 -2
- package/dist/lib/neutral/{chunk-PHKPB5JN.mjs → chunk-QV6NCUGM.mjs} +12 -12
- package/dist/lib/neutral/chunk-QV6NCUGM.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-HABDH5SS.mjs → chunk-ZPFRRBZW.mjs} +6 -6
- package/dist/lib/neutral/{chunk-HABDH5SS.mjs.map → chunk-ZPFRRBZW.mjs.map} +3 -3
- package/dist/lib/neutral/components/index.mjs +13 -11
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +3 -3
- package/dist/lib/neutral/{create-AAA53WDL.mjs → create-6LC57CCC.mjs} +1 -1
- package/dist/lib/neutral/{create-script-P46JOEHH.mjs → create-script-YW437XYZ.mjs} +3 -3
- package/dist/lib/neutral/hooks/index.mjs +5 -5
- package/dist/lib/neutral/hooks/index.mjs.map +3 -3
- package/dist/lib/neutral/index.mjs +4 -4
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{operation-handler-YMUADD7Y.mjs → operation-handler-6IZ7L4L2.mjs} +2 -2
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{react-surface-ACNZ35FV.mjs → react-surface-2TZDZQYA.mjs} +4 -4
- package/dist/lib/neutral/react-surface-2TZDZQYA.mjs.map +7 -0
- package/dist/lib/neutral/{settings-VJBW4OMK.mjs → settings-FD7HXEY6.mjs} +3 -3
- package/dist/lib/neutral/{settings-VJBW4OMK.mjs.map → settings-FD7HXEY6.mjs.map} +3 -3
- package/dist/lib/neutral/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +1 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +2 -2
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -17
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +4 -15
- package/dist/types/src/capabilities/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +10 -2
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +5 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +5 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +28 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/ScriptEvents.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +26 -0
- package/package.json +58 -57
- package/src/ScriptPlugin.test.ts +1 -1
- package/src/ScriptPlugin.tsx +1 -1
- package/src/capabilities/app-graph-builder.ts +2 -2
- package/src/capabilities/index.ts +1 -7
- package/src/capabilities/node.ts +1 -7
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/capabilities/settings.ts +2 -2
- package/src/components/NotebookStack/NotebookCell.tsx +2 -2
- package/src/components/NotebookStack/NotebookMenu.tsx +1 -1
- package/src/components/NotebookStack/NotebookStack.tsx +1 -1
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +2 -2
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +3 -2
- package/src/components/TestPanel/TestPanel.tsx +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +2 -1
- package/src/constants.ts +1 -1
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +15 -9
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +2 -1
- package/src/containers/NotebookArticle/NotebookArticle.tsx +1 -1
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +1 -1
- package/src/containers/ScriptProperties/FunctionBinding.tsx +1 -1
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +1 -1
- package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -5
- package/src/hooks/deploy.ts +3 -3
- package/src/hooks/format.ts +1 -1
- package/src/meta.ts +3 -19
- package/src/templates/commentary.ts +4 -3
- package/src/translations.ts +1 -1
- package/src/types/ScriptCapabilities.ts +4 -2
- package/src/types/ScriptEvents.ts +1 -1
- package/src/types/ScriptOperation.ts +1 -1
- package/dist/lib/neutral/DeploymentDialog-M3AFYQHC.mjs.map +0 -7
- package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +0 -7
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +0 -7
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +0 -7
- package/dist/lib/neutral/chunk-PHKPB5JN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs +0 -38
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs.map +0 -7
- /package/dist/lib/neutral/{chunk-BKXYHCJ6.mjs.map → chunk-JAJ64B3E.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-XFM63AKT.mjs.map → chunk-O6A5PTB3.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-AAA53WDL.mjs.map → create-6LC57CCC.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-script-P46JOEHH.mjs.map → create-script-YW437XYZ.mjs.map} +0 -0
- /package/dist/lib/neutral/{operation-handler-YMUADD7Y.mjs.map → operation-handler-6IZ7L4L2.mjs.map} +0 -0
|
@@ -11,7 +11,7 @@ import React from "react";
|
|
|
11
11
|
import { DropdownMenu, useTranslation } from "@dxos/react-ui";
|
|
12
12
|
import { meta } from "#meta";
|
|
13
13
|
var NotebookMenu = ({ cell, onCellInsert, onCellDelete }) => {
|
|
14
|
-
const { t } = useTranslation(meta.
|
|
14
|
+
const { t } = useTranslation(meta.profile.key);
|
|
15
15
|
return /* @__PURE__ */ React.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
16
16
|
onClick: () => onCellInsert?.("script", cell?.id)
|
|
17
17
|
}, t("notebook-cell-insert-script.label")), /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
@@ -35,7 +35,7 @@ import { meta as meta3 } from "#meta";
|
|
|
35
35
|
// src/components/NotebookStack/NotebookCell.tsx
|
|
36
36
|
import React3, { useCallback, useMemo } from "react";
|
|
37
37
|
import { Surface } from "@dxos/app-framework/ui";
|
|
38
|
-
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
38
|
+
import { AppSurface as AppSurface2 } from "@dxos/app-toolkit/ui";
|
|
39
39
|
import { Obj } from "@dxos/echo";
|
|
40
40
|
import { createDocAccessor } from "@dxos/echo-client";
|
|
41
41
|
import { invariant } from "@dxos/invariant";
|
|
@@ -60,6 +60,7 @@ import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
|
60
60
|
import { continueKeymap } from "@valtown/codemirror-continue";
|
|
61
61
|
import { tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from "@valtown/codemirror-ts";
|
|
62
62
|
import React2 from "react";
|
|
63
|
+
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
63
64
|
import { useThemeContext } from "@dxos/react-ui";
|
|
64
65
|
import { composable, composableProps } from "@dxos/react-ui";
|
|
65
66
|
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
@@ -80,7 +81,7 @@ var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode
|
|
|
80
81
|
indentWithTab: true,
|
|
81
82
|
lineNumbers: true,
|
|
82
83
|
lineWrapping: false,
|
|
83
|
-
scrollPastEnd: role !==
|
|
84
|
+
scrollPastEnd: role !== AppSurface.Section.role,
|
|
84
85
|
search: true,
|
|
85
86
|
...options
|
|
86
87
|
}),
|
|
@@ -162,7 +163,7 @@ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components
|
|
|
162
163
|
var editorStyles = "p-2 ps-3";
|
|
163
164
|
var valueStyles = "p-1 ps-3";
|
|
164
165
|
var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
165
|
-
const { t } = useTranslation2(meta2.
|
|
166
|
+
const { t } = useTranslation2(meta2.profile.key);
|
|
166
167
|
const extensions = useMemo(() => {
|
|
167
168
|
return cell.source?.target ? [
|
|
168
169
|
createDataExtensions({
|
|
@@ -231,7 +232,7 @@ var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
|
231
232
|
value: cell.source.target.content,
|
|
232
233
|
onChange: handleQueryChange
|
|
233
234
|
}), explorerGraph && !dragging && /* @__PURE__ */ React3.createElement(Surface.Surface, {
|
|
234
|
-
type:
|
|
235
|
+
type: AppSurface2.Section,
|
|
235
236
|
limit: 1,
|
|
236
237
|
data: {
|
|
237
238
|
subject: explorerGraph,
|
|
@@ -286,7 +287,7 @@ var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
|
286
287
|
}));
|
|
287
288
|
};
|
|
288
289
|
var NotebookTextEditor = ({ extensions: extensionsProp, readOnly, ...props }) => {
|
|
289
|
-
const { t } = useTranslation2(meta2.
|
|
290
|
+
const { t } = useTranslation2(meta2.profile.key);
|
|
290
291
|
const { themeMode } = useThemeContext2();
|
|
291
292
|
const extensions = useMemo(() => {
|
|
292
293
|
return [
|
|
@@ -337,7 +338,7 @@ var NotebookStack = composable2(({ notebook, onRearrange, db, graph, promptResul
|
|
|
337
338
|
})));
|
|
338
339
|
});
|
|
339
340
|
var NotebookSection = ({ cell, db, env, promptResults, onCellInsert, onCellDelete, ...props }) => {
|
|
340
|
-
const { t } = useTranslation3(meta3.
|
|
341
|
+
const { t } = useTranslation3(meta3.profile.key);
|
|
341
342
|
const resizable = cell.type === "query";
|
|
342
343
|
return /* @__PURE__ */ React4.createElement(StackItem.Root, {
|
|
343
344
|
role: "section",
|
|
@@ -426,13 +427,14 @@ var QueryEditor2 = (props) => {
|
|
|
426
427
|
// src/components/ScriptToolbar/ScriptToolbar.tsx
|
|
427
428
|
import { Atom } from "@effect-atom/atom-react";
|
|
428
429
|
import React6, { useMemo as useMemo2 } from "react";
|
|
430
|
+
import { AppSurface as AppSurface3 } from "@dxos/app-toolkit/ui";
|
|
429
431
|
import { ElevationProvider, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
430
432
|
import { composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
|
|
431
433
|
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
432
434
|
import { createDeploy, createFormat, createTemplateSelect, useDeployDeps } from "#hooks";
|
|
433
435
|
import { meta as meta4 } from "#meta";
|
|
434
436
|
var ScriptToolbar = composable3(({ script, attendableId, role, state, ...props }, forwardedRef) => {
|
|
435
|
-
const { t } = useTranslation4(meta4.
|
|
437
|
+
const { t } = useTranslation4(meta4.profile.key);
|
|
436
438
|
const options = useDeployDeps({
|
|
437
439
|
script
|
|
438
440
|
});
|
|
@@ -449,7 +451,7 @@ var ScriptToolbar = composable3(({ script, attendableId, role, state, ...props }
|
|
|
449
451
|
]);
|
|
450
452
|
const menuActions = useMenuActions(menuCreator);
|
|
451
453
|
return /* @__PURE__ */ React6.createElement(ElevationProvider, {
|
|
452
|
-
elevation: role ===
|
|
454
|
+
elevation: role === AppSurface3.Section.role ? "positioned" : "base"
|
|
453
455
|
}, /* @__PURE__ */ React6.createElement(Menu.Root, {
|
|
454
456
|
...menuActions,
|
|
455
457
|
attendableId
|
|
@@ -494,7 +496,7 @@ import { mx as mx2 } from "@dxos/ui-theme";
|
|
|
494
496
|
import { meta as meta5 } from "#meta";
|
|
495
497
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
496
498
|
var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
497
|
-
const { t } = useTranslation5(meta5.
|
|
499
|
+
const { t } = useTranslation5(meta5.profile.key);
|
|
498
500
|
const inputRef = useRef(null);
|
|
499
501
|
const [input, setInput] = useState2("");
|
|
500
502
|
const [state, setState] = useState2(null);
|
|
@@ -651,7 +653,7 @@ var RobotAvatar = () => /* @__PURE__ */ React7.createElement(Avatar.Root, null,
|
|
|
651
653
|
}));
|
|
652
654
|
|
|
653
655
|
// src/components/index.ts
|
|
654
|
-
var ScriptPluginSettings = lazy(() => import("../ScriptPluginSettings-
|
|
656
|
+
var ScriptPluginSettings = lazy(() => import("../ScriptPluginSettings-5AURDJTI.mjs"));
|
|
655
657
|
export {
|
|
656
658
|
NotebookMenu,
|
|
657
659
|
NotebookStack,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/index.ts", "../../../../src/components/NotebookStack/NotebookMenu.tsx", "../../../../src/components/NotebookStack/NotebookStack.tsx", "../../../../src/components/NotebookStack/NotebookCell.tsx", "../../../../src/components/TypescriptEditor/TypescriptEditor.tsx", "../../../../src/components/QueryEditor/QueryEditor.tsx", "../../../../src/components/ScriptToolbar/ScriptToolbar.tsx", "../../../../src/components/TestPanel/TestPanel.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type ComponentType, lazy } from 'react';\n\nexport * from './NotebookStack';\nexport * from './QueryEditor';\nexport * from './ScriptToolbar';\nexport * from './TestPanel';\nexport * from './TypescriptEditor';\n\nexport const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DropdownMenu, useTranslation } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\nimport { type Notebook } from '#types';\n\nexport type NotebookMenuProps = {\n cell?: Notebook.Cell;\n onCellInsert?: (type: Notebook.CellType, after: string | undefined) => void;\n onCellDelete?: (id: string) => void;\n};\n\n// TODO(burdon): Better way to organize menu?\nexport const NotebookMenu = ({ cell, onCellInsert, onCellDelete }: NotebookMenuProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n <DropdownMenu.Item onClick={() => onCellInsert?.('script', cell?.id)}>\n {t('notebook-cell-insert-script.label')}\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onCellInsert?.('prompt', cell?.id)}>\n {t('notebook-cell-insert-prompt.label')}\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onCellInsert?.('query', cell?.id)}>\n {t('notebook-cell-insert-query.label')}\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onCellInsert?.('markdown', cell?.id)}>\n {t('notebook-cell-insert-markdown.label')}\n </DropdownMenu.Item>\n {cell && onCellDelete && (\n <DropdownMenu.Item onClick={() => onCellDelete?.(cell.id)}>\n {t('notebook-cell-delete.label')}\n </DropdownMenu.Item>\n )}\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DropdownMenu, IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { Stack, StackItem, type StackProps } from '@dxos/react-ui-stack';\n\nimport { meta } from '#meta';\nimport { type Notebook } from '#types';\n\nimport { type TypescriptEditorProps } from '../TypescriptEditor';\nimport { NotebookCell, type NotebookCellProps } from './NotebookCell';\nimport { NotebookMenu } from './NotebookMenu';\n\nconst minSectionHeight = 'min-h-[16rem]';\n\nexport type NotebookStackProps = ThemedClassName<\n {\n notebook?: Notebook.Notebook;\n onRearrange?: StackProps['onRearrange'];\n } & (Pick<NotebookSectionProps, 'db' | 'graph' | 'promptResults' | 'onCellInsert' | 'onCellDelete'> &\n Pick<TypescriptEditorProps, 'env'>)\n>;\n\n// TODO(burdon): Option for narrow rail (with compact buttons that align with first button in toolbar).\nexport const NotebookStack = composable<HTMLDivElement, NotebookStackProps>(\n ({ notebook, onRearrange, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {\n const sectionProps = { db, graph, promptResults, onCellInsert, onCellDelete, env };\n return (\n <Stack\n {...composableProps(props)}\n orientation='vertical'\n size='contain'\n rail\n onRearrange={onRearrange}\n ref={forwardedRef}\n >\n {notebook?.cells.map((cell, i) => (\n <NotebookSection key={i} cell={cell} {...sectionProps} />\n ))}\n </Stack>\n );\n },\n);\n\ntype NotebookSectionProps = NotebookCellProps;\n\nconst NotebookSection = ({\n cell,\n db,\n env,\n promptResults,\n onCellInsert,\n onCellDelete,\n ...props\n}: NotebookSectionProps) => {\n const { t } = useTranslation(meta.id);\n const resizable = cell.type === 'query';\n\n return (\n <StackItem.Root role='section' item={cell} draggable classNames={resizable && minSectionHeight}>\n <StackItem.Heading classNames='h-full p-1 justify-between dx-attention-surface'>\n <StackItem.DragHandle asChild>\n <IconButton variant='ghost' icon='ph--dots-six-vertical--regular' iconOnly label='Drag handle' />\n </StackItem.DragHandle>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n variant='ghost'\n icon='ph--dots-three--regular'\n iconOnly\n label={t('notebook-cell-insert.label')}\n />\n </DropdownMenu.Trigger>\n <NotebookMenu cell={cell} onCellInsert={onCellInsert} onCellDelete={onCellDelete} />\n </DropdownMenu.Root>\n {resizable && <StackItem.ResizeHandle />}\n </StackItem.Heading>\n\n {/* TODO(burdon): Move drag preview to outer stack (uniformly). */}\n <StackItem.DragPreview>\n {({ item: cell }) => (\n <StackItem.Content classNames='overflow-visible bg-group-surface border border-subdued-separator'>\n <NotebookCell db={db} cell={cell} env={env} dragging />\n </StackItem.Content>\n )}\n </StackItem.DragPreview>\n\n <StackItem.Content classNames='overflow-visible'>\n <NotebookCell db={db} cell={cell} env={env} promptResults={promptResults} {...props} />\n </StackItem.Content>\n </StackItem.Root>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Database, Obj } from '@dxos/echo';\nimport { createDocAccessor } from '@dxos/echo-client';\nimport { invariant } from '@dxos/invariant';\nimport { TemplateEditor } from '@dxos/plugin-assistant/components';\nimport { useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport { Editor, type EditorViewProps } from '@dxos/react-ui-editor';\nimport {\n type BasicExtensionsOptions,\n createBasicExtensions,\n createDataExtensions,\n createMarkdownExtensions,\n createThemeExtensions,\n decorateMarkdown,\n} from '@dxos/ui-editor';\nimport { mx } from '@dxos/ui-theme';\nimport { isNonNullable } from '@dxos/util';\n\nimport { meta } from '#meta';\nimport { type Notebook } from '#types';\n\nimport { type ComputeGraph } from '../../notebook';\nimport { TypescriptEditor, type TypescriptEditorProps } from '../TypescriptEditor';\nimport { type NotebookMenuProps } from './NotebookMenu';\n\nconst editorStyles = 'p-2 ps-3';\nconst valueStyles = 'p-1 ps-3';\n\nexport type NotebookCellProps = {\n db?: Database.Database;\n graph?: ComputeGraph;\n dragging?: boolean;\n cell: Notebook.Cell;\n promptResults?: Record<string, string>;\n} & (Pick<NotebookMenuProps, 'onCellInsert' | 'onCellDelete'> & Pick<TypescriptEditorProps, 'env'>);\n\n// TODO(burdon): Show evaluation errors.\nexport const NotebookCell = ({ db, graph, dragging, cell, promptResults, env }: NotebookCellProps) => {\n const { t } = useTranslation(meta.id);\n\n const extensions = useMemo(() => {\n return cell.source?.target\n ? [\n createDataExtensions({\n id: cell.id,\n text: createDocAccessor(cell.source.target, ['content']),\n }),\n ].filter(isNonNullable)\n : [];\n }, [cell.source?.target]);\n\n const explorerGraph = cell.graph?.target;\n\n const handleQueryChange = useCallback<NonNullable<QueryEditorProps['onChange']>>(\n (value: string) => {\n invariant(cell.source?.target);\n Obj.update(cell.source.target, (obj) => {\n obj.content = value;\n });\n },\n [cell],\n );\n\n switch (cell.type) {\n case 'markdown':\n if (!cell.source?.target) {\n return null;\n }\n\n return (\n <NotebookTextEditor\n id={cell.id}\n classNames={editorStyles}\n initialValue={cell.source.target.content}\n extensions={extensions}\n />\n );\n\n case 'script':\n if (!cell.source?.target) {\n return null;\n }\n\n return (\n <>\n <TypescriptEditor\n id={cell.id}\n role='section'\n classNames={editorStyles}\n initialValue={cell.source.target.content}\n extensions={extensions}\n env={env}\n options={{\n placeholder: t('notebook-cell.placeholder'),\n highlightActiveLine: false,\n lineNumbers: false,\n }}\n />\n <NotebookCellValue cell={cell} graph={graph} />\n </>\n );\n\n case 'query':\n if (!cell.source?.target) {\n return null;\n }\n\n // TODO(burdon): Remove app-framework deps (via render prop).\n return (\n <div className={mx('h-full overflow-hidden grid', explorerGraph && !dragging && 'grid-rows-[min-content_1fr]')}>\n <QueryEditor\n id={cell.id}\n classNames={[editorStyles, 'border-b border-subdued-separator']}\n db={db}\n value={cell.source.target.content}\n onChange={handleQueryChange}\n />\n {explorerGraph && !dragging && (\n <Surface.Surface\n type={AppSurface.Section}\n limit={1}\n data={{ subject: explorerGraph, attendableId: cell.id }}\n />\n )}\n </div>\n );\n\n // TODO(burdon): Use streaming response from Chat.\n case 'prompt':\n if (!cell.prompt?.target) {\n return null;\n }\n\n return (\n <>\n <TemplateEditor\n id={cell.id}\n source={cell.prompt.target.instructions}\n lineNumbers={false}\n classNames={editorStyles}\n />\n <NotebookPromptResult cell={cell} promptResults={promptResults} />\n </>\n );\n\n default:\n return null;\n }\n};\n\nconst NotebookCellValue = ({ cell, graph }: NotebookCellProps) => {\n const name = graph?.getExpressions()[cell.id]?.name;\n const value = graph?.getValue(cell.id);\n if (value == null) {\n return null;\n }\n\n return (\n <div\n className={mx(\n 'flex w-full bg-group-surface border-y border-subdued-separator text-description font-mono',\n valueStyles,\n )}\n >\n {name && (\n <>\n <span className='text-success-text'>{name}</span>\n <span className='text-description'> = </span>\n </>\n )}\n <span>{value}</span>\n </div>\n );\n};\n\nconst NotebookPromptResult = ({ cell, promptResults }: NotebookCellProps) => {\n if (!cell.prompt) {\n return null;\n }\n\n const value = promptResults?.[cell.prompt.uri];\n if (value == null) {\n return null;\n }\n\n return (\n <div className={mx('flex w-full bg-group-surface text-description border-y border-subdued-separator', valueStyles)}>\n <NotebookTextEditor readOnly value={value} />\n </div>\n );\n};\n\nconst NotebookTextEditor = ({\n extensions: extensionsProp,\n readOnly,\n ...props\n}: EditorViewProps & Pick<BasicExtensionsOptions, 'readOnly'>) => {\n const { t } = useTranslation(meta.id);\n const { themeMode } = useThemeContext();\n const extensions = useMemo(() => {\n return [\n createBasicExtensions({\n placeholder: t('notebook-markdown.placeholder'),\n readOnly,\n }),\n createThemeExtensions({ themeMode, syntaxHighlighting: true }),\n createMarkdownExtensions(),\n decorateMarkdown(),\n extensionsProp,\n ].filter(isNonNullable);\n }, [extensionsProp]);\n\n return (\n <Editor.Root>\n <Editor.View {...props} extensions={extensions} selectionEnd />\n </Editor.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { autocompletion, completionKeymap } from '@codemirror/autocomplete';\nimport { javascript } from '@codemirror/lang-javascript';\nimport { HighlightStyle } from '@codemirror/language';\nimport { lintKeymap } from '@codemirror/lint';\nimport { Prec } from '@codemirror/state';\nimport { keymap } from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { type VirtualTypeScriptEnvironment } from '@typescript/vfs';\nimport { continueKeymap } from '@valtown/codemirror-continue';\nimport { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';\nimport React from 'react';\n\nimport { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';\nimport { Domino } from '@dxos/ui';\nimport {\n type BasicExtensionsOptions,\n InputModeExtensions,\n createBasicExtensions,\n createThemeExtensions,\n defaultStyles,\n} from '@dxos/ui-editor';\nimport { type EditorInputMode } from '@dxos/ui-editor/types';\nimport { isNonNullable } from '@dxos/util';\n\nexport type TypescriptEditorProps = ThemedClassName<\n {\n id: string;\n role?: string;\n inputMode?: EditorInputMode;\n toolbar?: boolean;\n env?: VirtualTypeScriptEnvironment;\n options?: BasicExtensionsOptions;\n } & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>\n>;\n\nexport const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps>(\n (\n {\n classNames,\n id,\n role = 'article',\n inputMode = 'vscode',\n env,\n options,\n initialValue,\n extensions,\n scrollTo,\n selection,\n ...props\n },\n forwardedRef,\n ) => {\n const { themeMode } = useThemeContext();\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n initialValue,\n selection,\n scrollTo,\n extensions: [\n extensions,\n createBasicExtensions({\n highlightActiveLine: true,\n indentWithTab: true,\n lineNumbers: true,\n lineWrapping: false,\n scrollPastEnd: role !== 'section',\n search: true,\n ...options,\n }),\n createThemeExtensions({\n monospace: true,\n themeMode,\n syntaxHighlighting: true,\n }),\n\n InputModeExtensions[inputMode],\n javascript({ typescript: true }),\n autocompletion({ override: env ? [tsAutocomplete()] : undefined }),\n\n // Continues block comments when pressing Enter.\n Prec.high(keymap.of(continueKeymap)),\n keymap.of(completionKeymap),\n keymap.of(lintKeymap),\n\n // https://github.com/val-town/codemirror-ts\n env && [\n // TODO(burdon): Fix type.\n tsFacet.of({ env: env as any, path: `./src/${id}.ts` }),\n tsSync(),\n tsLinter(),\n tsHover({ renderTooltip: createTooltipRenderer(themeMode) }),\n ],\n ].filter(isNonNullable),\n }),\n [themeMode, id, extensions, inputMode, selection, scrollTo, env],\n );\n\n return (\n <div {...composableProps(props, { classNames, ...focusAttributes })} ref={composeRefs(parentRef, forwardedRef)} />\n );\n },\n);\n\n// TODO(burdon): Factor out (react-ui-editor).\nconst createTooltipRenderer = (themeMode: ThemeMode) => {\n const theme = HighlightStyle.define(themeMode === 'dark' ? defaultStyles.dark : defaultStyles.light);\n\n const classFromKind = (_kind: string) => {\n // E.g., localName, methodName, parameterName, etc.\n const kind = _kind.endsWith('Name') ? 'name' : _kind;\n const validTag = kind in tags;\n if (!validTag) {\n return '';\n }\n\n const tag = tags[kind as keyof typeof tags];\n if (typeof tag === 'function') {\n return '';\n }\n\n return theme.style([tag]) ?? '';\n };\n\n return (info: HoverInfo) => {\n const children =\n info.quickInfo?.displayParts?.map(({ kind, text }) =>\n Domino.of('span').classNames(classFromKind(kind)).text(text),\n ) ?? [];\n return {\n dom: Domino.of('div')\n .classNames('xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator')\n .append(...children).root,\n };\n };\n};\n\nexport default TypescriptEditor;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\nimport { ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport queryApi from '@dxos/echo-query/api.d.ts?raw';\nimport { useAsyncEffect } from '@dxos/react-ui';\n\nimport { Compiler } from '../../compiler';\nimport { TypescriptEditor, type TypescriptEditorProps } from '../TypescriptEditor';\n\nconst GLOBALS = `\n namespace QueryAPI {\n ${queryApi}\n }\n\n declare global {\n const Query: typeof QueryAPI.Query;\n const Filter: typeof QueryAPI.Filter;\n const Order: typeof QueryAPI.Order;\n }\n\n export {};\n`;\n\nexport type QueryEditorProps = Omit<TypescriptEditorProps, 'env'>;\n\nexport const QueryEditor = (props: QueryEditorProps) => {\n const [compiler, setCompiler] = useState<Compiler>();\n\n useAsyncEffect(async () => {\n const compiler = new Compiler({\n lib: ['ES5'],\n target: ScriptTarget.ES2022,\n // Avoid `@typescript/vfs`'s deprecated `node10` default (rejected by TS 6).\n moduleResolution: ModuleResolutionKind.Bundler,\n });\n await compiler.initialize(GLOBALS);\n setCompiler(compiler);\n }, []);\n\n if (!compiler) {\n return null;\n }\n\n return <TypescriptEditor {...props} env={compiler.environment} />;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport React, { useMemo } from 'react';\n\nimport { type Script } from '@dxos/compute';\nimport { ElevationProvider, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { type ActionGraphProps, Menu, MenuRootProps, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';\n\nimport {\n type CreateDeployOptions,\n type ScriptToolbarStateStore,\n createDeploy,\n createFormat,\n createTemplateSelect,\n useDeployDeps,\n} from '#hooks';\nimport { meta } from '#meta';\n\nexport type ScriptToolbarProps = Pick<MenuRootProps, 'attendableId'> & {\n script: Script.Script;\n state: ScriptToolbarStateStore;\n};\n\nexport const ScriptToolbar = composable<HTMLDivElement, ScriptToolbarProps>(\n ({ script, attendableId, role, state, ...props }, forwardedRef) => {\n const { t } = useTranslation(meta.id);\n const options = useDeployDeps({ script });\n const menuCreator = useMemo(\n () => createToolbarActions({ state, script, t, ...options }),\n [state, script, options, t],\n );\n const menuActions = useMenuActions(menuCreator);\n\n return (\n <ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>\n <Menu.Root {...menuActions} attendableId={attendableId}>\n <Menu.Toolbar {...composableProps(props)} ref={forwardedRef} />\n </Menu.Root>\n </ElevationProvider>\n );\n },\n);\n\nconst createToolbarActions = ({ state, script, ...options }: CreateDeployOptions): Atom.Atom<ActionGraphProps> =>\n Atom.make((get) => {\n // Subscribe to state changes.\n get(state.atom);\n const templateSelect = createTemplateSelect(script);\n const format = createFormat(script);\n const gap = createGapSeparator();\n const deploy = createDeploy({ state, script, ...options });\n return {\n nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes],\n edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges],\n };\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { forwardRef, useRef, useState } from 'react';\n\nimport { log } from '@dxos/log';\nimport { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\ntype State = 'pending';\n\n/**\n * Request or response.\n */\ntype Message = {\n type: 'request' | 'response';\n text?: string;\n data?: any;\n error?: Error;\n};\n\nexport type TestPanelProps = ThemedClassName<{\n onInvoke?: (input: unknown) => Promise<unknown>;\n}>;\n\n// TODO(burdon): Need persistent history (currently lost when switching tabs).\nexport const TestPanel = composable<HTMLDivElement, TestPanelProps>(\n ({ classNames, onInvoke, ...props }, forwardedRef) => {\n const { t } = useTranslation(meta.id);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const [input, setInput] = useState('');\n const [state, setState] = useState<State | null>(null);\n\n // TODO(burdon): Persistent history (thread).\n const [history, setHistory] = useState<Message[]>([]);\n\n const scrollerRef = useRef<HTMLDivElement>(null);\n const handleScroll = () => {\n if (scrollerRef.current) {\n scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;\n }\n };\n\n const handleClear = () => {\n setInput('');\n setHistory([]);\n inputRef.current?.focus();\n };\n\n const handleResponse = ({\n text,\n data,\n error,\n }: {\n text?: string;\n data?: any;\n error?: Error;\n } = {}) => {\n setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);\n setState(null);\n handleScroll();\n };\n\n const handleRequest = async (input: string) => {\n if (!onInvoke) {\n handleResponse({ error: new Error('Function not deployed') });\n return;\n }\n\n let data: unknown = input;\n let displayText = input;\n if (input.charAt(0) === '{') {\n try {\n const validJsonString = input.replace(/'/g, '\"').replace(/([{,]\\s*)([a-zA-Z0-9_]+)(\\s*:)/g, '$1\"$2\"$3');\n data = JSON.parse(validJsonString);\n displayText = JSON.stringify(data, null, 2);\n } catch (err) {\n handleResponse({ error: new Error('Invalid JSON input') });\n return;\n }\n }\n\n try {\n setState('pending');\n setInput('');\n setHistory((history) => [...history, { type: 'request', text: displayText }]);\n setTimeout(handleScroll);\n\n const result = await onInvoke(data);\n\n if (typeof result === 'string') {\n handleResponse({ text: result });\n } else {\n handleResponse({ data: result });\n }\n } catch (err: any) {\n const error = err instanceof Error ? err : new Error(String(err));\n handleResponse({ error });\n log.catch(err);\n }\n };\n\n return (\n <div\n {...composableProps(props, { classNames: ['flex flex-col h-full overflow-hidden', classNames] })}\n ref={forwardedRef}\n >\n {/* TODO(burdon): Replace with Thread. */}\n <MessageThread ref={scrollerRef} state={state} history={history} />\n {/* TODO(burdon): Replace with Form based on the function's input schema. */}\n <Toolbar.Root>\n <Input.Root>\n <Input.TextInput\n ref={inputRef}\n autoFocus\n placeholder={t('function-request.placeholder')}\n value={input}\n onChange={(ev) => setInput(ev.target.value)}\n onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}\n />\n </Input.Root>\n <Toolbar.IconButton icon='ph--play--regular' label='Execute' iconOnly onClick={() => handleRequest(input)} />\n <Toolbar.IconButton icon='ph--trash--regular' label='Clear' iconOnly onClick={handleClear} />\n </Toolbar.Root>\n </div>\n );\n },\n);\n\n// TODO(burdon): Replace with thread?\n// TODO(burdon): Button to edit/re-run question.\ntype MessageThreadProps = {\n state: State | null;\n history: Message[];\n};\n\nconst MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(\n ({ state, history }: MessageThreadProps, forwardedRef) => {\n return (\n <ScrollArea.Root orientation='vertical' classNames='h-full' ref={forwardedRef}>\n <ScrollArea.Viewport classNames='gap-6 p-2'>\n {history.map((message, i) => (\n <div key={i} className='grid grid-cols-[2rem_1fr_2rem]'>\n <div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>\n <div className='overflow-auto'>\n <MessageItem message={message} />\n </div>\n </div>\n ))}\n\n {state === 'pending' && (\n <div className='grid grid-cols-[2rem_1fr_2rem]'>\n <div className='p-1'>\n <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />\n </div>\n </div>\n )}\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n },\n);\n\nconst MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {\n const { type, text, data, error } = message;\n const wrapper = 'p-1 px-2 rounded-md bg-hover-surface overflow-auto';\n return (\n <div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>\n {error && <div className={mx(wrapper, 'whitespace-pre text-error-text')}>{String(error)}</div>}\n\n {text !== undefined && (\n <div className={mx(wrapper, type === 'request' && 'bg-primary-500 dark:bg-primary-600')}>\n {text || '\\u00D8'}\n </div>\n )}\n\n {data && <JsonHighlighter data={data} classNames={mx(wrapper, 'text-xs')} />}\n </div>\n );\n};\n\nconst RobotAvatar = () => (\n <Avatar.Root>\n <Avatar.Content size={6} variant='circle' icon='ph--drone--regular' />\n </Avatar.Root>\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAA6BA,YAAY;;;ACAzC,OAAOC,WAAW;AAElB,SAASC,cAAcC,sBAAsB;AAE7C,SAASC,YAAY;AAUd,IAAMC,eAAe,CAAC,EAAEC,MAAMC,cAAcC,aAAY,MAAqB;AAClF,QAAM,EAAEC,EAAC,IAAKN,eAAeC,KAAKM,EAAE;AACpC,SACE,sBAAA,cAACR,aAAaS,QAAM,MAClB,sBAAA,cAACT,aAAaU,S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,MACE,MAAA,IAAA;QAAKD,UAAWzC;SACbc,gBAAAA,OAAS,cAAA,OAAC6B;IAAIF,WAAWzC,IAAG4C,QAAAA,SAAS,YAAA,0BAAA,aAAA,UAAA;KAAoCC,SAEzEjC,gBAAAA,OAASkC,cAAAA,OAAAA;IACHL,WAAWzC,IAAG4C,SAASG,gCAAsB;KAC/CnC,OAAAA,KAAQ,CAAA,GAAA,SAIZC,UAAQ,gBAAA3B,OAAA,cAACa,OAAAA;IAAgBc,WAAMA,IAAAA,SAAAA,SAAAA,aAAAA,oCAAAA;aAAMW,MAAeoB,GAAAA,QAAS,gBAAA1D,OAAA,cAAA,iBAAA;;IAGpE,YAAAc,IAAA,SAAA,SAAA;EAEA,CAAA,CAAMgD;;kBAE+B,MAAA,gBAAA9D,OAAA,cAAA,OAAA,MAAA,MAAA,gBAAAA,OAAA,cAAA,OAAA,SAAA;EAASgD,MAAK;;;;;;APjL5C,IAAMe,uBAA2CC,KAAK,MAAM,OAAO,sCAAA,CAAA;",
|
|
6
|
-
"names": ["lazy", "React", "DropdownMenu", "useTranslation", "meta", "NotebookMenu", "cell", "onCellInsert", "onCellDelete", "t", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type ComponentType, lazy } from 'react';\n\nexport * from './NotebookStack';\nexport * from './QueryEditor';\nexport * from './ScriptToolbar';\nexport * from './TestPanel';\nexport * from './TypescriptEditor';\n\nexport const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DropdownMenu, useTranslation } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\nimport { type Notebook } from '#types';\n\nexport type NotebookMenuProps = {\n cell?: Notebook.Cell;\n onCellInsert?: (type: Notebook.CellType, after: string | undefined) => void;\n onCellDelete?: (id: string) => void;\n};\n\n// TODO(burdon): Better way to organize menu?\nexport const NotebookMenu = ({ cell, onCellInsert, onCellDelete }: NotebookMenuProps) => {\n const { t } = useTranslation(meta.profile.key);\n return (\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n <DropdownMenu.Item onClick={() => onCellInsert?.('script', cell?.id)}>\n {t('notebook-cell-insert-script.label')}\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onCellInsert?.('prompt', cell?.id)}>\n {t('notebook-cell-insert-prompt.label')}\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onCellInsert?.('query', cell?.id)}>\n {t('notebook-cell-insert-query.label')}\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onCellInsert?.('markdown', cell?.id)}>\n {t('notebook-cell-insert-markdown.label')}\n </DropdownMenu.Item>\n {cell && onCellDelete && (\n <DropdownMenu.Item onClick={() => onCellDelete?.(cell.id)}>\n {t('notebook-cell-delete.label')}\n </DropdownMenu.Item>\n )}\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { DropdownMenu, IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { Stack, StackItem, type StackProps } from '@dxos/react-ui-stack';\n\nimport { meta } from '#meta';\nimport { type Notebook } from '#types';\n\nimport { type TypescriptEditorProps } from '../TypescriptEditor';\nimport { NotebookCell, type NotebookCellProps } from './NotebookCell';\nimport { NotebookMenu } from './NotebookMenu';\n\nconst minSectionHeight = 'min-h-[16rem]';\n\nexport type NotebookStackProps = ThemedClassName<\n {\n notebook?: Notebook.Notebook;\n onRearrange?: StackProps['onRearrange'];\n } & (Pick<NotebookSectionProps, 'db' | 'graph' | 'promptResults' | 'onCellInsert' | 'onCellDelete'> &\n Pick<TypescriptEditorProps, 'env'>)\n>;\n\n// TODO(burdon): Option for narrow rail (with compact buttons that align with first button in toolbar).\nexport const NotebookStack = composable<HTMLDivElement, NotebookStackProps>(\n ({ notebook, onRearrange, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {\n const sectionProps = { db, graph, promptResults, onCellInsert, onCellDelete, env };\n return (\n <Stack\n {...composableProps(props)}\n orientation='vertical'\n size='contain'\n rail\n onRearrange={onRearrange}\n ref={forwardedRef}\n >\n {notebook?.cells.map((cell, i) => (\n <NotebookSection key={i} cell={cell} {...sectionProps} />\n ))}\n </Stack>\n );\n },\n);\n\ntype NotebookSectionProps = NotebookCellProps;\n\nconst NotebookSection = ({\n cell,\n db,\n env,\n promptResults,\n onCellInsert,\n onCellDelete,\n ...props\n}: NotebookSectionProps) => {\n const { t } = useTranslation(meta.profile.key);\n const resizable = cell.type === 'query';\n\n return (\n <StackItem.Root role='section' item={cell} draggable classNames={resizable && minSectionHeight}>\n <StackItem.Heading classNames='h-full p-1 justify-between dx-attention-surface'>\n <StackItem.DragHandle asChild>\n <IconButton variant='ghost' icon='ph--dots-six-vertical--regular' iconOnly label='Drag handle' />\n </StackItem.DragHandle>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n variant='ghost'\n icon='ph--dots-three--regular'\n iconOnly\n label={t('notebook-cell-insert.label')}\n />\n </DropdownMenu.Trigger>\n <NotebookMenu cell={cell} onCellInsert={onCellInsert} onCellDelete={onCellDelete} />\n </DropdownMenu.Root>\n {resizable && <StackItem.ResizeHandle />}\n </StackItem.Heading>\n\n {/* TODO(burdon): Move drag preview to outer stack (uniformly). */}\n <StackItem.DragPreview>\n {({ item: cell }) => (\n <StackItem.Content classNames='overflow-visible bg-group-surface border border-subdued-separator'>\n <NotebookCell db={db} cell={cell} env={env} dragging />\n </StackItem.Content>\n )}\n </StackItem.DragPreview>\n\n <StackItem.Content classNames='overflow-visible'>\n <NotebookCell db={db} cell={cell} env={env} promptResults={promptResults} {...props} />\n </StackItem.Content>\n </StackItem.Root>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Database, Obj } from '@dxos/echo';\nimport { createDocAccessor } from '@dxos/echo-client';\nimport { invariant } from '@dxos/invariant';\nimport { TemplateEditor } from '@dxos/plugin-assistant/components';\nimport { useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport { Editor, type EditorViewProps } from '@dxos/react-ui-editor';\nimport {\n type BasicExtensionsOptions,\n createBasicExtensions,\n createDataExtensions,\n createMarkdownExtensions,\n createThemeExtensions,\n decorateMarkdown,\n} from '@dxos/ui-editor';\nimport { mx } from '@dxos/ui-theme';\nimport { isNonNullable } from '@dxos/util';\n\nimport { meta } from '#meta';\nimport { type Notebook } from '#types';\n\nimport { type ComputeGraph } from '../../notebook';\nimport { TypescriptEditor, type TypescriptEditorProps } from '../TypescriptEditor';\nimport { type NotebookMenuProps } from './NotebookMenu';\n\nconst editorStyles = 'p-2 ps-3';\nconst valueStyles = 'p-1 ps-3';\n\nexport type NotebookCellProps = {\n db?: Database.Database;\n graph?: ComputeGraph;\n dragging?: boolean;\n cell: Notebook.Cell;\n promptResults?: Record<string, string>;\n} & (Pick<NotebookMenuProps, 'onCellInsert' | 'onCellDelete'> & Pick<TypescriptEditorProps, 'env'>);\n\n// TODO(burdon): Show evaluation errors.\nexport const NotebookCell = ({ db, graph, dragging, cell, promptResults, env }: NotebookCellProps) => {\n const { t } = useTranslation(meta.profile.key);\n\n const extensions = useMemo(() => {\n return cell.source?.target\n ? [\n createDataExtensions({\n id: cell.id,\n text: createDocAccessor(cell.source.target, ['content']),\n }),\n ].filter(isNonNullable)\n : [];\n }, [cell.source?.target]);\n\n const explorerGraph = cell.graph?.target;\n\n const handleQueryChange = useCallback<NonNullable<QueryEditorProps['onChange']>>(\n (value: string) => {\n invariant(cell.source?.target);\n Obj.update(cell.source.target, (obj) => {\n obj.content = value;\n });\n },\n [cell],\n );\n\n switch (cell.type) {\n case 'markdown':\n if (!cell.source?.target) {\n return null;\n }\n\n return (\n <NotebookTextEditor\n id={cell.id}\n classNames={editorStyles}\n initialValue={cell.source.target.content}\n extensions={extensions}\n />\n );\n\n case 'script':\n if (!cell.source?.target) {\n return null;\n }\n\n return (\n <>\n <TypescriptEditor\n id={cell.id}\n role='section'\n classNames={editorStyles}\n initialValue={cell.source.target.content}\n extensions={extensions}\n env={env}\n options={{\n placeholder: t('notebook-cell.placeholder'),\n highlightActiveLine: false,\n lineNumbers: false,\n }}\n />\n <NotebookCellValue cell={cell} graph={graph} />\n </>\n );\n\n case 'query':\n if (!cell.source?.target) {\n return null;\n }\n\n // TODO(burdon): Remove app-framework deps (via render prop).\n return (\n <div className={mx('h-full overflow-hidden grid', explorerGraph && !dragging && 'grid-rows-[min-content_1fr]')}>\n <QueryEditor\n id={cell.id}\n classNames={[editorStyles, 'border-b border-subdued-separator']}\n db={db}\n value={cell.source.target.content}\n onChange={handleQueryChange}\n />\n {explorerGraph && !dragging && (\n <Surface.Surface\n type={AppSurface.Section}\n limit={1}\n data={{ subject: explorerGraph, attendableId: cell.id }}\n />\n )}\n </div>\n );\n\n // TODO(burdon): Use streaming response from Chat.\n case 'prompt':\n if (!cell.prompt?.target) {\n return null;\n }\n\n return (\n <>\n <TemplateEditor\n id={cell.id}\n source={cell.prompt.target.instructions}\n lineNumbers={false}\n classNames={editorStyles}\n />\n <NotebookPromptResult cell={cell} promptResults={promptResults} />\n </>\n );\n\n default:\n return null;\n }\n};\n\nconst NotebookCellValue = ({ cell, graph }: NotebookCellProps) => {\n const name = graph?.getExpressions()[cell.id]?.name;\n const value = graph?.getValue(cell.id);\n if (value == null) {\n return null;\n }\n\n return (\n <div\n className={mx(\n 'flex w-full bg-group-surface border-y border-subdued-separator text-description font-mono',\n valueStyles,\n )}\n >\n {name && (\n <>\n <span className='text-success-text'>{name}</span>\n <span className='text-description'> = </span>\n </>\n )}\n <span>{value}</span>\n </div>\n );\n};\n\nconst NotebookPromptResult = ({ cell, promptResults }: NotebookCellProps) => {\n if (!cell.prompt) {\n return null;\n }\n\n const value = promptResults?.[cell.prompt.uri];\n if (value == null) {\n return null;\n }\n\n return (\n <div className={mx('flex w-full bg-group-surface text-description border-y border-subdued-separator', valueStyles)}>\n <NotebookTextEditor readOnly value={value} />\n </div>\n );\n};\n\nconst NotebookTextEditor = ({\n extensions: extensionsProp,\n readOnly,\n ...props\n}: EditorViewProps & Pick<BasicExtensionsOptions, 'readOnly'>) => {\n const { t } = useTranslation(meta.profile.key);\n const { themeMode } = useThemeContext();\n const extensions = useMemo(() => {\n return [\n createBasicExtensions({\n placeholder: t('notebook-markdown.placeholder'),\n readOnly,\n }),\n createThemeExtensions({ themeMode, syntaxHighlighting: true }),\n createMarkdownExtensions(),\n decorateMarkdown(),\n extensionsProp,\n ].filter(isNonNullable);\n }, [extensionsProp]);\n\n return (\n <Editor.Root>\n <Editor.View {...props} extensions={extensions} selectionEnd />\n </Editor.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { autocompletion, completionKeymap } from '@codemirror/autocomplete';\nimport { javascript } from '@codemirror/lang-javascript';\nimport { HighlightStyle } from '@codemirror/language';\nimport { lintKeymap } from '@codemirror/lint';\nimport { Prec } from '@codemirror/state';\nimport { keymap } from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { type VirtualTypeScriptEnvironment } from '@typescript/vfs';\nimport { continueKeymap } from '@valtown/codemirror-continue';\nimport { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';\nimport React from 'react';\n\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';\nimport { Domino } from '@dxos/ui';\nimport {\n type BasicExtensionsOptions,\n InputModeExtensions,\n createBasicExtensions,\n createThemeExtensions,\n defaultStyles,\n} from '@dxos/ui-editor';\nimport { type EditorInputMode } from '@dxos/ui-editor/types';\nimport { isNonNullable } from '@dxos/util';\n\nexport type TypescriptEditorProps = ThemedClassName<\n {\n id: string;\n role?: string;\n inputMode?: EditorInputMode;\n toolbar?: boolean;\n env?: VirtualTypeScriptEnvironment;\n options?: BasicExtensionsOptions;\n } & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>\n>;\n\nexport const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps>(\n (\n {\n classNames,\n id,\n role = 'article',\n inputMode = 'vscode',\n env,\n options,\n initialValue,\n extensions,\n scrollTo,\n selection,\n ...props\n },\n forwardedRef,\n ) => {\n const { themeMode } = useThemeContext();\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n initialValue,\n selection,\n scrollTo,\n extensions: [\n extensions,\n createBasicExtensions({\n highlightActiveLine: true,\n indentWithTab: true,\n lineNumbers: true,\n lineWrapping: false,\n scrollPastEnd: role !== AppSurface.Section.role,\n search: true,\n ...options,\n }),\n createThemeExtensions({\n monospace: true,\n themeMode,\n syntaxHighlighting: true,\n }),\n\n InputModeExtensions[inputMode],\n javascript({ typescript: true }),\n autocompletion({ override: env ? [tsAutocomplete()] : undefined }),\n\n // Continues block comments when pressing Enter.\n Prec.high(keymap.of(continueKeymap)),\n keymap.of(completionKeymap),\n keymap.of(lintKeymap),\n\n // https://github.com/val-town/codemirror-ts\n env && [\n // TODO(burdon): Fix type.\n tsFacet.of({ env: env as any, path: `./src/${id}.ts` }),\n tsSync(),\n tsLinter(),\n tsHover({ renderTooltip: createTooltipRenderer(themeMode) }),\n ],\n ].filter(isNonNullable),\n }),\n [themeMode, id, extensions, inputMode, selection, scrollTo, env],\n );\n\n return (\n <div {...composableProps(props, { classNames, ...focusAttributes })} ref={composeRefs(parentRef, forwardedRef)} />\n );\n },\n);\n\n// TODO(burdon): Factor out (react-ui-editor).\nconst createTooltipRenderer = (themeMode: ThemeMode) => {\n const theme = HighlightStyle.define(themeMode === 'dark' ? defaultStyles.dark : defaultStyles.light);\n\n const classFromKind = (_kind: string) => {\n // E.g., localName, methodName, parameterName, etc.\n const kind = _kind.endsWith('Name') ? 'name' : _kind;\n const validTag = kind in tags;\n if (!validTag) {\n return '';\n }\n\n const tag = tags[kind as keyof typeof tags];\n if (typeof tag === 'function') {\n return '';\n }\n\n return theme.style([tag]) ?? '';\n };\n\n return (info: HoverInfo) => {\n const children =\n info.quickInfo?.displayParts?.map(({ kind, text }) =>\n Domino.of('span').classNames(classFromKind(kind)).text(text),\n ) ?? [];\n return {\n dom: Domino.of('div')\n .classNames('xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator')\n .append(...children).root,\n };\n };\n};\n\nexport default TypescriptEditor;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\nimport { ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport queryApi from '@dxos/echo-query/api.d.ts?raw';\nimport { useAsyncEffect } from '@dxos/react-ui';\n\nimport { Compiler } from '../../compiler';\nimport { TypescriptEditor, type TypescriptEditorProps } from '../TypescriptEditor';\n\nconst GLOBALS = `\n namespace QueryAPI {\n ${queryApi}\n }\n\n declare global {\n const Query: typeof QueryAPI.Query;\n const Filter: typeof QueryAPI.Filter;\n const Order: typeof QueryAPI.Order;\n }\n\n export {};\n`;\n\nexport type QueryEditorProps = Omit<TypescriptEditorProps, 'env'>;\n\nexport const QueryEditor = (props: QueryEditorProps) => {\n const [compiler, setCompiler] = useState<Compiler>();\n\n useAsyncEffect(async () => {\n const compiler = new Compiler({\n lib: ['ES5'],\n target: ScriptTarget.ES2022,\n // Avoid `@typescript/vfs`'s deprecated `node10` default (rejected by TS 6).\n moduleResolution: ModuleResolutionKind.Bundler,\n });\n await compiler.initialize(GLOBALS);\n setCompiler(compiler);\n }, []);\n\n if (!compiler) {\n return null;\n }\n\n return <TypescriptEditor {...props} env={compiler.environment} />;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport React, { useMemo } from 'react';\n\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Script } from '@dxos/compute';\nimport { ElevationProvider, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { type ActionGraphProps, Menu, MenuRootProps, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';\n\nimport {\n type CreateDeployOptions,\n type ScriptToolbarStateStore,\n createDeploy,\n createFormat,\n createTemplateSelect,\n useDeployDeps,\n} from '#hooks';\nimport { meta } from '#meta';\n\nexport type ScriptToolbarProps = Pick<MenuRootProps, 'attendableId'> & {\n script: Script.Script;\n state: ScriptToolbarStateStore;\n};\n\nexport const ScriptToolbar = composable<HTMLDivElement, ScriptToolbarProps>(\n ({ script, attendableId, role, state, ...props }, forwardedRef) => {\n const { t } = useTranslation(meta.profile.key);\n const options = useDeployDeps({ script });\n const menuCreator = useMemo(\n () => createToolbarActions({ state, script, t, ...options }),\n [state, script, options, t],\n );\n const menuActions = useMenuActions(menuCreator);\n\n return (\n <ElevationProvider elevation={role === AppSurface.Section.role ? 'positioned' : 'base'}>\n <Menu.Root {...menuActions} attendableId={attendableId}>\n <Menu.Toolbar {...composableProps(props)} ref={forwardedRef} />\n </Menu.Root>\n </ElevationProvider>\n );\n },\n);\n\nconst createToolbarActions = ({ state, script, ...options }: CreateDeployOptions): Atom.Atom<ActionGraphProps> =>\n Atom.make((get) => {\n // Subscribe to state changes.\n get(state.atom);\n const templateSelect = createTemplateSelect(script);\n const format = createFormat(script);\n const gap = createGapSeparator();\n const deploy = createDeploy({ state, script, ...options });\n return {\n nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes],\n edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges],\n };\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { forwardRef, useRef, useState } from 'react';\n\nimport { log } from '@dxos/log';\nimport { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\ntype State = 'pending';\n\n/**\n * Request or response.\n */\ntype Message = {\n type: 'request' | 'response';\n text?: string;\n data?: any;\n error?: Error;\n};\n\nexport type TestPanelProps = ThemedClassName<{\n onInvoke?: (input: unknown) => Promise<unknown>;\n}>;\n\n// TODO(burdon): Need persistent history (currently lost when switching tabs).\nexport const TestPanel = composable<HTMLDivElement, TestPanelProps>(\n ({ classNames, onInvoke, ...props }, forwardedRef) => {\n const { t } = useTranslation(meta.profile.key);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const [input, setInput] = useState('');\n const [state, setState] = useState<State | null>(null);\n\n // TODO(burdon): Persistent history (thread).\n const [history, setHistory] = useState<Message[]>([]);\n\n const scrollerRef = useRef<HTMLDivElement>(null);\n const handleScroll = () => {\n if (scrollerRef.current) {\n scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;\n }\n };\n\n const handleClear = () => {\n setInput('');\n setHistory([]);\n inputRef.current?.focus();\n };\n\n const handleResponse = ({\n text,\n data,\n error,\n }: {\n text?: string;\n data?: any;\n error?: Error;\n } = {}) => {\n setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);\n setState(null);\n handleScroll();\n };\n\n const handleRequest = async (input: string) => {\n if (!onInvoke) {\n handleResponse({ error: new Error('Function not deployed') });\n return;\n }\n\n let data: unknown = input;\n let displayText = input;\n if (input.charAt(0) === '{') {\n try {\n const validJsonString = input.replace(/'/g, '\"').replace(/([{,]\\s*)([a-zA-Z0-9_]+)(\\s*:)/g, '$1\"$2\"$3');\n data = JSON.parse(validJsonString);\n displayText = JSON.stringify(data, null, 2);\n } catch (err) {\n handleResponse({ error: new Error('Invalid JSON input') });\n return;\n }\n }\n\n try {\n setState('pending');\n setInput('');\n setHistory((history) => [...history, { type: 'request', text: displayText }]);\n setTimeout(handleScroll);\n\n const result = await onInvoke(data);\n\n if (typeof result === 'string') {\n handleResponse({ text: result });\n } else {\n handleResponse({ data: result });\n }\n } catch (err: any) {\n const error = err instanceof Error ? err : new Error(String(err));\n handleResponse({ error });\n log.catch(err);\n }\n };\n\n return (\n <div\n {...composableProps(props, { classNames: ['flex flex-col h-full overflow-hidden', classNames] })}\n ref={forwardedRef}\n >\n {/* TODO(burdon): Replace with Thread. */}\n <MessageThread ref={scrollerRef} state={state} history={history} />\n {/* TODO(burdon): Replace with Form based on the function's input schema. */}\n <Toolbar.Root>\n <Input.Root>\n <Input.TextInput\n ref={inputRef}\n autoFocus\n placeholder={t('function-request.placeholder')}\n value={input}\n onChange={(ev) => setInput(ev.target.value)}\n onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}\n />\n </Input.Root>\n <Toolbar.IconButton icon='ph--play--regular' label='Execute' iconOnly onClick={() => handleRequest(input)} />\n <Toolbar.IconButton icon='ph--trash--regular' label='Clear' iconOnly onClick={handleClear} />\n </Toolbar.Root>\n </div>\n );\n },\n);\n\n// TODO(burdon): Replace with thread?\n// TODO(burdon): Button to edit/re-run question.\ntype MessageThreadProps = {\n state: State | null;\n history: Message[];\n};\n\nconst MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(\n ({ state, history }: MessageThreadProps, forwardedRef) => {\n return (\n <ScrollArea.Root orientation='vertical' classNames='h-full' ref={forwardedRef}>\n <ScrollArea.Viewport classNames='gap-6 p-2'>\n {history.map((message, i) => (\n <div key={i} className='grid grid-cols-[2rem_1fr_2rem]'>\n <div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>\n <div className='overflow-auto'>\n <MessageItem message={message} />\n </div>\n </div>\n ))}\n\n {state === 'pending' && (\n <div className='grid grid-cols-[2rem_1fr_2rem]'>\n <div className='p-1'>\n <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />\n </div>\n </div>\n )}\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n },\n);\n\nconst MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {\n const { type, text, data, error } = message;\n const wrapper = 'p-1 px-2 rounded-md bg-hover-surface overflow-auto';\n return (\n <div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>\n {error && <div className={mx(wrapper, 'whitespace-pre text-error-text')}>{String(error)}</div>}\n\n {text !== undefined && (\n <div className={mx(wrapper, type === 'request' && 'bg-primary-500 dark:bg-primary-600')}>\n {text || '\\u00D8'}\n </div>\n )}\n\n {data && <JsonHighlighter data={data} classNames={mx(wrapper, 'text-xs')} />}\n </div>\n );\n};\n\nconst RobotAvatar = () => (\n <Avatar.Root>\n <Avatar.Content size={6} variant='circle' icon='ph--drone--regular' />\n </Avatar.Root>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAA6BA,YAAY;;;ACAzC,OAAOC,WAAW;AAElB,SAASC,cAAcC,sBAAsB;AAE7C,SAASC,YAAY;AAUd,IAAMC,eAAe,CAAC,EAAEC,MAAMC,cAAcC,aAAY,MAAqB;AAClF,QAAM,EAAEC,EAAC,IAAKN,eAAeC,KAAKM,QAAQC,GAAG;AAC7C,SACE,sBAAA,cAACT,aAAaU,QAAM,MAClB,sBAAA,cAACV,aAAaW,SAAO,MACnB,sBAAA,cAACX,aAAaY,UAAQ,MACpB,sBAAA,cAACZ,aAAaa,MAAI;IAACC,SAAS,MAAMT,eAAe,UAAUD,MAAMW,EAAAA;KAC9DR,EAAE,mCAAA,CAAA,GAEL,sBAAA,cAACP,aAAaa,MAAI;IAACC,SAAS,MAAMT,eAAe,UAAUD,MAAMW,EAAAA;KAC9DR,EAAE,mCAAA,CAAA,GAEL,sBAAA,cAACP,aAAaa,MAAI;IAACC,SAAS,MAAMT,eAAe,S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AAAA;IACHL,WAAWzC,IAAG4C,SAASG,gCAAsB;KAC/CnC,OAAAA,KAAQ,CAAA,GAAA,SAIZC,UAAQ,gBAAA3B,OAAA,cAACa,OAAAA;IAAgBc,WAAMA,IAAAA,SAAAA,SAAAA,aAAAA,oCAAAA;aAAMW,MAAeoB,GAAAA,QAAS,gBAAA1D,OAAA,cAAA,iBAAA;;IAGpE,YAAAc,IAAA,SAAA,SAAA;EAEA,CAAA,CAAMgD;;kBAE+B,MAAA,gBAAA9D,OAAA,cAAA,OAAA,MAAA,MAAA,gBAAAA,OAAA,cAAA,OAAA,SAAA;EAASgD,MAAK;;;;;;APjL5C,IAAMe,uBAA2CC,KAAK,MAAM,OAAO,sCAAA,CAAA;",
|
|
6
|
+
"names": ["lazy", "React", "DropdownMenu", "useTranslation", "meta", "NotebookMenu", "cell", "onCellInsert", "onCellDelete", "t", "profile", "key", "Portal", "Content", "Viewport", "Item", "onClick", "id", "Arrow", "React", "DropdownMenu", "IconButton", "useTranslation", "composable", "composableProps", "Stack", "StackItem", "meta", "React", "useCallback", "useMemo", "Surface", "AppSurface", "Obj", "createDocAccessor", "invariant", "TemplateEditor", "useThemeContext", "useTranslation", "QueryEditor", "Editor", "createBasicExtensions", "createDataExtensions", "createMarkdownExtensions", "createThemeExtensions", "decorateMarkdown", "mx", "isNonNullable", "meta", "autocompletion", "completionKeymap", "javascript", "HighlightStyle", "lintKeymap", "Prec", "keymap", "tags", "composeRefs", "continueKeymap", "tsAutocomplete", "tsFacet", "tsHover", "tsLinter", "tsSync", "React", "AppSurface", "useThemeContext", "composable", "composableProps", "useTextEditor", "Domino", "InputModeExtensions", "createBasicExtensions", "createThemeExtensions", "defaultStyles", "isNonNullable", "TypescriptEditor", "classNames", "id", "role", "inputMode", "env", "options", "initialValue", "extensions", "scrollTo", "selection", "props", "forwardedRef", "themeMode", "parentRef", "focusAttributes", "highlightActiveLine", "indentWithTab", "lineNumbers", "lineWrapping", "scrollPastEnd", "Section", "search", "monospace", "syntaxHighlighting", "typescript", "override", "undefined", "high", "of", "path", "renderTooltip", "createTooltipRenderer", "filter", "div", "ref", "theme", "define", "dark", "light", "classFromKind", "_kind", "kind", "endsWith", "validTag", "tag", "style", "info", "children", "quickInfo", "displayParts", "map", "text", "dom", "append", "root", "editorStyles", "NotebookCell", "extensions", "useMemo", "cell", "target", "createDataExtensions", "createDocAccessor", "isNonNullable", "source", "explorerGraph", "invariant", "Obj", "obj", "content", "value", "initialValue", "React", "classNames", "env", "options", "highlightActiveLine", "lineNumbers", "graph", "QueryEditor", "id", "db", "onChange", "dragging", "type", "AppSurface", "limit", "data", "subject", "attendableId", "prompt", "instructions", "promptResults", "getValue", "name", "className", "span", "NotebookPromptResult", "NotebookTextEditor", "readOnly", "useThemeContext", "meta", "createBasicExtensions", "createThemeExtensions", "syntaxHighlighting", "createMarkdownExtensions", "decorateMarkdown", "extensionsProp", "filter", "selectionEnd", "minSectionHeight", "NotebookStack", "composable", "notebook", "onRearrange", "db", "graph", "promptResults", "onCellInsert", "onCellDelete", "env", "props", "forwardedRef", "sectionProps", "React", "Stack", "composableProps", "orientation", "size", "rail", "ref", "cells", "map", "cell", "i", "NotebookSection", "key", "t", "useTranslation", "meta", "profile", "resizable", "type", "StackItem", "Root", "role", "item", "draggable", "classNames", "Heading", "DragHandle", "asChild", "IconButton", "variant", "icon", "iconOnly", "label", "DropdownMenu", "Trigger", "NotebookMenu", "ResizeHandle", "DragPreview", "Content", "NotebookCell", "dragging", "React", "useState", "ModuleResolutionKind", "ScriptTarget", "queryApi", "useAsyncEffect", "GLOBALS", "queryApi", "QueryEditor", "props", "compiler", "setCompiler", "useState", "useAsyncEffect", "Compiler", "lib", "target", "ScriptTarget", "ES2022", "moduleResolution", "ModuleResolutionKind", "Bundler", "initialize", "React", "TypescriptEditor", "env", "environment", "Atom", "React", "useMemo", "AppSurface", "ElevationProvider", "useTranslation", "composable", "composableProps", "Menu", "createGapSeparator", "useMenuActions", "createDeploy", "createFormat", "createTemplateSelect", "useDeployDeps", "meta", "ScriptToolbar", "script", "attendableId", "role", "state", "props", "forwardedRef", "t", "profile", "key", "options", "menuCreator", "createToolbarActions", "menuActions", "elevation", "Section", "Root", "Toolbar", "ref", "make", "get", "atom", "templateSelect", "format", "gap", "deploy", "nodes", "edges", "React", "forwardRef", "useRef", "useState", "log", "Avatar", "Icon", "Input", "ScrollArea", "Toolbar", "useTranslation", "composable", "composableProps", "JsonHighlighter", "mx", "meta", "__dxlog_file", "inputRef", "input", "setInput", "setState", "history", "setHistory", "handleScroll", "current", "handleResponse", "text", "data", "error", "handleRequest", "charAt", "validJsonString", "displayText", "stringify", "err", "setTimeout", "result", "catch", "classNames", "ref", "scrollerRef", "state", "autoFocus", "placeholder", "value", "onChange", "ev", "onKeyDown", "icon", "iconOnly", "onClick", "MessageThread", "forwardedRef", "message", "i", "className", "MessageItem", "div", "wrapper", "String", "undefined", "type", "RobotAvatar", "ScriptPluginSettings", "lazy"]
|
|
7
7
|
}
|
|
@@ -2,10 +2,10 @@ import "../chunk-J5LGTIGS.mjs";
|
|
|
2
2
|
|
|
3
3
|
// src/containers/index.ts
|
|
4
4
|
import { lazy } from "react";
|
|
5
|
-
var DeploymentDialog = lazy(() => import("../DeploymentDialog-
|
|
6
|
-
var NotebookArticle = lazy(() => import("../NotebookArticle-
|
|
5
|
+
var DeploymentDialog = lazy(() => import("../DeploymentDialog-7OIIL7LB.mjs"));
|
|
6
|
+
var NotebookArticle = lazy(() => import("../NotebookArticle-E35G2Y2I.mjs"));
|
|
7
7
|
var ScriptArticle = lazy(() => import("../ScriptArticle-QW26LOKU.mjs"));
|
|
8
|
-
var ScriptProperties = lazy(() => import("../ScriptProperties-
|
|
8
|
+
var ScriptProperties = lazy(() => import("../ScriptProperties-ADTWXG6O.mjs"));
|
|
9
9
|
var TestContainer = lazy(() => import("../TestContainer-AFVTBYSJ.mjs"));
|
|
10
10
|
export {
|
|
11
11
|
DeploymentDialog,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ScriptOperation_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZPFRRBZW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
templates
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QV6NCUGM.mjs";
|
|
7
7
|
import "./chunk-J5LGTIGS.mjs";
|
|
8
8
|
|
|
9
9
|
// src/operations/create-script.ts
|
|
@@ -42,4 +42,4 @@ var create_script_default = handler;
|
|
|
42
42
|
export {
|
|
43
43
|
create_script_default as default
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=create-script-
|
|
45
|
+
//# sourceMappingURL=create-script-YW437XYZ.mjs.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../chunk-VXDJH6OL.mjs";
|
|
6
6
|
import {
|
|
7
7
|
templates
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-QV6NCUGM.mjs";
|
|
9
9
|
import "../chunk-J5LGTIGS.mjs";
|
|
10
10
|
|
|
11
11
|
// src/hooks/deploy.ts
|
|
@@ -27,7 +27,7 @@ var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t })
|
|
|
27
27
|
label: value.error ?? [
|
|
28
28
|
"no-error.label",
|
|
29
29
|
{
|
|
30
|
-
ns: meta.
|
|
30
|
+
ns: meta.profile.key
|
|
31
31
|
}
|
|
32
32
|
],
|
|
33
33
|
icon: "ph--warning-circle--regular",
|
|
@@ -57,7 +57,7 @@ var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t })
|
|
|
57
57
|
label: [
|
|
58
58
|
value.deploying ? "publishing.label" : "deploy.label",
|
|
59
59
|
{
|
|
60
|
-
ns: meta.
|
|
60
|
+
ns: meta.profile.key
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
63
|
icon: value.deploying ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
|
|
@@ -73,7 +73,7 @@ var createDeploy = ({ state, script, space, fn, client, existingFunctionId, t })
|
|
|
73
73
|
label: [
|
|
74
74
|
"copy-link.label",
|
|
75
75
|
{
|
|
76
|
-
ns: meta.
|
|
76
|
+
ns: meta.profile.key
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
icon: "ph--link--regular",
|
|
@@ -189,7 +189,7 @@ var createFormat = (script) => {
|
|
|
189
189
|
label: [
|
|
190
190
|
"format.label",
|
|
191
191
|
{
|
|
192
|
-
ns: meta2.
|
|
192
|
+
ns: meta2.profile.key
|
|
193
193
|
}
|
|
194
194
|
],
|
|
195
195
|
icon: "ph--magic-wand--regular"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/deploy.ts", "../../../../src/hooks/format.ts", "../../../../src/hooks/template.ts", "../../../../src/hooks/useCreateAndDeployScriptTemplates.ts", "../../../../src/hooks/useToolbarState.ts", "../../../../src/hooks/useCompiler.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport { Script, Operation } from '@dxos/compute';\nimport { Obj, Query, Ref } from '@dxos/echo';\nimport { getUserFunctionIdInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { type TFunction } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\nimport { messageValence } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\nimport { deployScript, getFunctionUrl, isScriptDeployed } from '../util';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nimport { type ScriptToolbarStateStore } from './useToolbarState';\n\nexport type CreateDeployOptions = {\n state: ScriptToolbarStateStore;\n script: Script.Script;\n fn: Operation.PersistentOperation;\n space?: Space;\n existingFunctionId?: string;\n client: Client;\n t: TFunction;\n};\n\nexport const createDeploy = ({ state, script, space, fn, client, existingFunctionId, t }: CreateDeployOptions) => {\n const { value } = state;\n\n // TODO(wittjosiah): Should this be an action?\n const errorItem = createMenuAction('error', () => {}, {\n label: value.error ?? ['no-error.label', { ns: meta.id }],\n icon: 'ph--warning-circle--regular',\n hidden: !value.error,\n classNames: value.error && messageValence('error'),\n });\n\n const deployAction = createMenuAction<DeployActionProperties>(\n 'deploy',\n async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.set('error', undefined);\n state.set('deploying', true);\n\n const result = await deployScript({ script, client, space, fn, existingFunctionId });\n\n if (!result.success) {\n log.catch(result.error);\n state.set('error', t('upload-failed.label'));\n }\n\n state.set('deploying', false);\n },\n {\n type: 'deploy',\n label: [value.deploying ? 'publishing.label' : 'deploy.label', { ns: meta.id }],\n icon: value.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: value.deploying,\n classNames: value.deploying ? '[&_svg]:animate-spin' : '',\n },\n );\n\n const copyAction = createMenuAction<DeployActionProperties>(\n 'copy',\n async () => {\n if (value.functionUrl) {\n await navigator.clipboard.writeText(value.functionUrl);\n }\n },\n {\n type: 'copy',\n label: ['copy-link.label', { ns: meta.id }],\n icon: 'ph--link--regular',\n disabled: !value.functionUrl,\n },\n );\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error', relation: 'child' },\n { source: 'root', target: 'deploy', relation: 'child' },\n { source: 'root', target: 'copy', relation: 'child' },\n ],\n };\n};\n\nexport const useDeployState = ({ state, script }: { state: ScriptToolbarStateStore; script: Script.Script }) => {\n const { space, client, fn, existingFunctionId } = useDeployDeps({ script });\n useEffect(() => {\n if (!existingFunctionId) {\n return;\n }\n\n state.set(\n 'functionUrl',\n getFunctionUrl({\n script,\n fn,\n edgeUrl: client.config.values.runtime?.services?.edge?.url ?? '',\n }),\n );\n }, [existingFunctionId, space, fn, script, client.config.values.runtime?.services?.edge?.url, state]);\n\n useEffect(() => {\n state.set('deployed', isScriptDeployed({ script, fn }));\n }, [script.changed, existingFunctionId, fn, script, state]);\n};\n\nexport const useDeployDeps = ({ script }: { script: Script.Script }) => {\n const client = useClient();\n const space = getSpace(script);\n const [fn] = useQuery(space?.db, Query.type(Operation.PersistentOperation, { source: Ref.make(script) }));\n const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(Obj.getMeta(fn)), [fn]);\n return { client, space, fn, existingFunctionId };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\n\nimport { type Script } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { log } from '@dxos/log';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { meta } from '#meta';\n\nexport type FormatActionProperties = { type: 'format' };\n\nexport const createFormat = (script: Script.Script) => {\n const formatAction = createMenuAction(\n 'format',\n async () => {\n if (!script.source) {\n return;\n }\n\n try {\n const formatted = await format(script.source.target!.content, {\n parser: 'typescript',\n plugins: [prettierPluginEstree, prettierPluginTypescript],\n semi: true,\n singleQuote: true,\n });\n Obj.update(script.source.target!, (obj) => {\n obj.content = formatted;\n });\n } catch (err: any) {\n // TODO(wittjosiah): Show error in UI.\n log.catch(err);\n }\n },\n {\n label: ['format.label', { ns: meta.id }],\n icon: 'ph--magic-wand--regular',\n },\n );\n\n return {\n nodes: [formatAction],\n edges: [\n {\n source: 'root',\n target: 'format',\n relation: 'child',\n },\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Script } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { FUNCTIONS_PRESET_META_KEY } from '@dxos/functions';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { templates } from '../templates';\n\nexport type TemplateActionProperties = { type: 'template'; value: string };\n\nconst createTemplateSelectActions = (script: Script.Script) => {\n return templates.map((template) => {\n return createMenuAction<TemplateActionProperties>(\n `template--${template.id}`,\n () => {\n Obj.update(script, (script) => {\n script.name = template.name;\n const meta = Obj.getMeta(script);\n const oldPresetIndex = meta.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n meta.keys.splice(oldPresetIndex, 1);\n }\n if ('presetId' in template) {\n meta.keys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n });\n if (script.source?.target) {\n Obj.update(script.source.target, (obj) => {\n obj.content = template.source;\n });\n }\n },\n {\n label: template.name,\n value: template.id,\n type: 'template',\n },\n );\n });\n};\n\nexport const createTemplateSelect = (script: Script.Script) => {\n const templateSelectActions = createTemplateSelectActions(script);\n return {\n nodes: [...templateSelectActions],\n edges: [\n { source: 'root', target: 'template-select', relation: 'child' },\n ...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id, relation: 'child' })),\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { Script } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceOperation } from '@dxos/plugin-space';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { ScriptOperation } from '#types';\n\nimport { type Template } from '../templates';\nimport { deployScript } from '../util';\n\ntype DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';\n\n/**\n * Hook for creating and deploying multiple script templates concurrently.\n *\n * Takes a space and an array of script template IDs, then provides a callback\n * function that creates each script from its template and deploys it to the space.\n * All creation / deployment operations run concurrently for improved performance.\n */\nexport const useCreateAndDeployScriptTemplates = (space: Space | undefined, scriptTemplates: Template[]) => {\n const { invokePromise } = useOperationInvoker();\n const client = useClient();\n const [status, setStatus] = useState<DeploymentStatus>('idle');\n const [error, setError] = useState<Error | undefined>(undefined);\n\n const handleCreateAndDeployScripts = useCallback(async () => {\n invariant(space);\n setStatus('pending');\n setError(undefined);\n\n const deploymentResults = await Promise.all(\n scriptTemplates.map(async (template) => {\n const createResult = await invokePromise(ScriptOperation.CreateScript, {\n db: space.db,\n initialTemplateId: template.id as any,\n });\n invariant(Obj.instanceOf(Script.Script, createResult.data?.object));\n await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });\n\n return deployScript({ space, client, script: createResult.data.object });\n }),\n );\n\n const hasErrors = deploymentResults.some((result) => !result.success);\n setStatus(hasErrors ? 'error' : 'success');\n }, [space, invokePromise, client, scriptTemplates]);\n\n // TODO(burdon): Return onCreateAndDeployScripts.\n return { handleCreateAndDeployScripts, status, error };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport { useMemo } from 'react';\n\nimport { Capabilities } from '@dxos/app-framework';\nimport { useCapability } from '@dxos/app-framework/ui';\n\nimport { type DeployState } from './deploy';\n\nexport type ScriptToolbarState = Partial<DeployState>;\n\nexport type ScriptToolbarStateStore = {\n atom: Atom.Writable<ScriptToolbarState>;\n get value(): ScriptToolbarState;\n update: (updater: (current: ScriptToolbarState) => ScriptToolbarState) => void;\n set: <K extends keyof ScriptToolbarState>(key: K, value: ScriptToolbarState[K]) => void;\n};\n\nexport const useToolbarState = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {\n const registry = useCapability(Capabilities.AtomRegistry);\n const atom = useMemo(() => Atom.make<ScriptToolbarState>(initialState), []);\n\n return useMemo(\n () => ({\n atom,\n get value() {\n return registry.get(atom);\n },\n update: (updater: (current: ScriptToolbarState) => ScriptToolbarState) => {\n registry.set(atom, updater(registry.get(atom)));\n },\n set: <K extends keyof ScriptToolbarState>(key: K, v: ScriptToolbarState[K]) => {\n registry.set(atom, { ...registry.get(atom), [key]: v });\n },\n }),\n [atom, registry],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';\nimport { EffectEx } from '@dxos/effect';\nimport { useAsyncEffect } from '@dxos/react-ui';\n\nimport { ScriptEvents } from '#types';\nimport { ScriptCapabilities } from '#types';\n\nimport type { Compiler } from '../compiler';\n\n/**\n * Asynchronously sets up the compiler and returns it.\n * @returns The compiler instance or undefined if it is not ready.\n */\nexport const useCompiler = (): Compiler | undefined => {\n const manager = usePluginManager();\n useAsyncEffect(async () => {\n await manager.activate(ScriptEvents.SetupCompiler).pipe(EffectEx.runAndForwardErrors);\n }, [manager]);\n const [compiler] = useCapabilities(ScriptCapabilities.Compiler);\n return compiler;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAIA,SAASA,WAAWC,eAAe;AAEnC,SAAiBC,iBAAiB;AAClC,SAASC,KAAKC,OAAOC,WAAW;AAChC,SAASC,mCAAmC;AAC5C,SAASC,WAAW;AACpB,SAAsBC,iBAAiB;AACvC,SAAqBC,UAAUC,gBAAgB;AAE/C,SAASC,wBAAwB;AACjC,SAASC,sBAAsB;AAE/B,SAASC,YAAY;AAyBrB,IAAA,eAAaC;AAGX,IAAA,eAAA,CAAA,EAAA,OAAA,QAAA,OAA8C,IAAA,QAAA,oBAAA,EAAA,MAAA;AAC9C,QAAMC,EAAAA,MAAAA,IAAYC;oBACO,iBAAA,SAAA,MAAA;EAAA,GAAA;WAAkB,MAAA,SAAA;;
|
|
6
|
-
"names": ["useEffect", "useMemo", "Operation", "Obj", "Query", "Ref", "getUserFunctionIdInMetadata", "log", "useClient", "getSpace", "useQuery", "createMenuAction", "messageValence", "meta", "createDeploy", "errorItem", "createMenuAction", "icon", "hidden", "classNames", "deployAction", "state", "result", "deployScript", "script", "client", "space", "fn", "existingFunctionId", "set", "type", "value", "ns", "disabled", "deploying", "copyAction", "navigator", "writeText", "functionUrl", "edges", "relation", "useEffect", "edgeUrl", "useQuery", "source", "Ref", "useMemo", "format", "prettierPluginEstree", "prettierPluginTypescript", "Obj", "log", "createMenuAction", "meta", "__dxlog_file", "createFormat", "script", "plugins", "semi", "singleQuote", "update", "err", "catch", "label", "icon", "edges", "relation", "Obj", "FUNCTIONS_PRESET_META_KEY", "createMenuAction", "createTemplateSelectActions", "script", "templates", "map", "template", "createMenuAction", "id", "Obj", "update", "name", "meta", "getMeta", "oldPresetIndex", "keys", "findIndex", "key", "source", "FUNCTIONS_PRESET_META_KEY", "splice", "push", "presetId", "target", "obj", "content", "label", "value", "type", "createTemplateSelect", "templateSelectActions", "nodes", "edges", "relation", "action", "useCallback", "useState", "useOperationInvoker", "Script", "Obj", "invariant", "SpaceOperation", "useClient", "ScriptOperation", "__dxlog_file", "client", "useClient", "status", "setStatus", "setError", "handleCreateAndDeployScripts", "useCallback", "invariant", "space", "undefined", "deploymentResults", "createResult", "initialTemplateId", "template", "instanceOf", "Script", "target", "object", "deployScript", "script", "scriptTemplates", "error", "Atom", "useMemo", "Capabilities", "useCapability", "useToolbarState", "initialState", "registry", "AtomRegistry", "atom", "make", "value", "get", "update", "updater", "set", "key", "v", "useCapabilities", "usePluginManager", "EffectEx", "useAsyncEffect", "ScriptEvents", "ScriptCapabilities", "useCompiler", "manager", "activate", "SetupCompiler", "pipe", "runAndForwardErrors", "compiler", "Compiler"]
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport { Script, Operation } from '@dxos/compute';\nimport { Obj, Query, Ref } from '@dxos/echo';\nimport { getUserFunctionIdInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { type Space, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { type TFunction } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\nimport { messageValence } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\nimport { deployScript, getFunctionUrl, isScriptDeployed } from '../util';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nimport { type ScriptToolbarStateStore } from './useToolbarState';\n\nexport type CreateDeployOptions = {\n state: ScriptToolbarStateStore;\n script: Script.Script;\n fn: Operation.PersistentOperation;\n space?: Space;\n existingFunctionId?: string;\n client: Client;\n t: TFunction;\n};\n\nexport const createDeploy = ({ state, script, space, fn, client, existingFunctionId, t }: CreateDeployOptions) => {\n const { value } = state;\n\n // TODO(wittjosiah): Should this be an action?\n const errorItem = createMenuAction('error', () => {}, {\n label: value.error ?? ['no-error.label', { ns: meta.profile.key }],\n icon: 'ph--warning-circle--regular',\n hidden: !value.error,\n classNames: value.error && messageValence('error'),\n });\n\n const deployAction = createMenuAction<DeployActionProperties>(\n 'deploy',\n async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.set('error', undefined);\n state.set('deploying', true);\n\n const result = await deployScript({ script, client, space, fn, existingFunctionId });\n\n if (!result.success) {\n log.catch(result.error);\n state.set('error', t('upload-failed.label'));\n }\n\n state.set('deploying', false);\n },\n {\n type: 'deploy',\n label: [value.deploying ? 'publishing.label' : 'deploy.label', { ns: meta.profile.key }],\n icon: value.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: value.deploying,\n classNames: value.deploying ? '[&_svg]:animate-spin' : '',\n },\n );\n\n const copyAction = createMenuAction<DeployActionProperties>(\n 'copy',\n async () => {\n if (value.functionUrl) {\n await navigator.clipboard.writeText(value.functionUrl);\n }\n },\n {\n type: 'copy',\n label: ['copy-link.label', { ns: meta.profile.key }],\n icon: 'ph--link--regular',\n disabled: !value.functionUrl,\n },\n );\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error', relation: 'child' },\n { source: 'root', target: 'deploy', relation: 'child' },\n { source: 'root', target: 'copy', relation: 'child' },\n ],\n };\n};\n\nexport const useDeployState = ({ state, script }: { state: ScriptToolbarStateStore; script: Script.Script }) => {\n const { space, client, fn, existingFunctionId } = useDeployDeps({ script });\n useEffect(() => {\n if (!existingFunctionId) {\n return;\n }\n\n state.set(\n 'functionUrl',\n getFunctionUrl({\n script,\n fn,\n edgeUrl: client.config.values.runtime?.services?.edge?.url ?? '',\n }),\n );\n }, [existingFunctionId, space, fn, script, client.config.values.runtime?.services?.edge?.url, state]);\n\n useEffect(() => {\n state.set('deployed', isScriptDeployed({ script, fn }));\n }, [script.changed, existingFunctionId, fn, script, state]);\n};\n\nexport const useDeployDeps = ({ script }: { script: Script.Script }) => {\n const client = useClient();\n const space = getSpace(script);\n const [fn] = useQuery(space?.db, Query.type(Operation.PersistentOperation, { source: Ref.make(script) }));\n const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(Obj.getMeta(fn)), [fn]);\n return { client, space, fn, existingFunctionId };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\n\nimport { type Script } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { log } from '@dxos/log';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { meta } from '#meta';\n\nexport type FormatActionProperties = { type: 'format' };\n\nexport const createFormat = (script: Script.Script) => {\n const formatAction = createMenuAction(\n 'format',\n async () => {\n if (!script.source) {\n return;\n }\n\n try {\n const formatted = await format(script.source.target!.content, {\n parser: 'typescript',\n plugins: [prettierPluginEstree, prettierPluginTypescript],\n semi: true,\n singleQuote: true,\n });\n Obj.update(script.source.target!, (obj) => {\n obj.content = formatted;\n });\n } catch (err: any) {\n // TODO(wittjosiah): Show error in UI.\n log.catch(err);\n }\n },\n {\n label: ['format.label', { ns: meta.profile.key }],\n icon: 'ph--magic-wand--regular',\n },\n );\n\n return {\n nodes: [formatAction],\n edges: [\n {\n source: 'root',\n target: 'format',\n relation: 'child',\n },\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Script } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { FUNCTIONS_PRESET_META_KEY } from '@dxos/functions';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { templates } from '../templates';\n\nexport type TemplateActionProperties = { type: 'template'; value: string };\n\nconst createTemplateSelectActions = (script: Script.Script) => {\n return templates.map((template) => {\n return createMenuAction<TemplateActionProperties>(\n `template--${template.id}`,\n () => {\n Obj.update(script, (script) => {\n script.name = template.name;\n const meta = Obj.getMeta(script);\n const oldPresetIndex = meta.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n meta.keys.splice(oldPresetIndex, 1);\n }\n if ('presetId' in template) {\n meta.keys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n });\n if (script.source?.target) {\n Obj.update(script.source.target, (obj) => {\n obj.content = template.source;\n });\n }\n },\n {\n label: template.name,\n value: template.id,\n type: 'template',\n },\n );\n });\n};\n\nexport const createTemplateSelect = (script: Script.Script) => {\n const templateSelectActions = createTemplateSelectActions(script);\n return {\n nodes: [...templateSelectActions],\n edges: [\n { source: 'root', target: 'template-select', relation: 'child' },\n ...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id, relation: 'child' })),\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { Script } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceOperation } from '@dxos/plugin-space';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { ScriptOperation } from '#types';\n\nimport { type Template } from '../templates';\nimport { deployScript } from '../util';\n\ntype DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';\n\n/**\n * Hook for creating and deploying multiple script templates concurrently.\n *\n * Takes a space and an array of script template IDs, then provides a callback\n * function that creates each script from its template and deploys it to the space.\n * All creation / deployment operations run concurrently for improved performance.\n */\nexport const useCreateAndDeployScriptTemplates = (space: Space | undefined, scriptTemplates: Template[]) => {\n const { invokePromise } = useOperationInvoker();\n const client = useClient();\n const [status, setStatus] = useState<DeploymentStatus>('idle');\n const [error, setError] = useState<Error | undefined>(undefined);\n\n const handleCreateAndDeployScripts = useCallback(async () => {\n invariant(space);\n setStatus('pending');\n setError(undefined);\n\n const deploymentResults = await Promise.all(\n scriptTemplates.map(async (template) => {\n const createResult = await invokePromise(ScriptOperation.CreateScript, {\n db: space.db,\n initialTemplateId: template.id as any,\n });\n invariant(Obj.instanceOf(Script.Script, createResult.data?.object));\n await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });\n\n return deployScript({ space, client, script: createResult.data.object });\n }),\n );\n\n const hasErrors = deploymentResults.some((result) => !result.success);\n setStatus(hasErrors ? 'error' : 'success');\n }, [space, invokePromise, client, scriptTemplates]);\n\n // TODO(burdon): Return onCreateAndDeployScripts.\n return { handleCreateAndDeployScripts, status, error };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport { useMemo } from 'react';\n\nimport { Capabilities } from '@dxos/app-framework';\nimport { useCapability } from '@dxos/app-framework/ui';\n\nimport { type DeployState } from './deploy';\n\nexport type ScriptToolbarState = Partial<DeployState>;\n\nexport type ScriptToolbarStateStore = {\n atom: Atom.Writable<ScriptToolbarState>;\n get value(): ScriptToolbarState;\n update: (updater: (current: ScriptToolbarState) => ScriptToolbarState) => void;\n set: <K extends keyof ScriptToolbarState>(key: K, value: ScriptToolbarState[K]) => void;\n};\n\nexport const useToolbarState = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {\n const registry = useCapability(Capabilities.AtomRegistry);\n const atom = useMemo(() => Atom.make<ScriptToolbarState>(initialState), []);\n\n return useMemo(\n () => ({\n atom,\n get value() {\n return registry.get(atom);\n },\n update: (updater: (current: ScriptToolbarState) => ScriptToolbarState) => {\n registry.set(atom, updater(registry.get(atom)));\n },\n set: <K extends keyof ScriptToolbarState>(key: K, v: ScriptToolbarState[K]) => {\n registry.set(atom, { ...registry.get(atom), [key]: v });\n },\n }),\n [atom, registry],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';\nimport { EffectEx } from '@dxos/effect';\nimport { useAsyncEffect } from '@dxos/react-ui';\n\nimport { ScriptEvents } from '#types';\nimport { ScriptCapabilities } from '#types';\n\nimport type { Compiler } from '../compiler';\n\n/**\n * Asynchronously sets up the compiler and returns it.\n * @returns The compiler instance or undefined if it is not ready.\n */\nexport const useCompiler = (): Compiler | undefined => {\n const manager = usePluginManager();\n useAsyncEffect(async () => {\n await manager.activate(ScriptEvents.SetupCompiler).pipe(EffectEx.runAndForwardErrors);\n }, [manager]);\n const [compiler] = useCapabilities(ScriptCapabilities.Compiler);\n return compiler;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAIA,SAASA,WAAWC,eAAe;AAEnC,SAAiBC,iBAAiB;AAClC,SAASC,KAAKC,OAAOC,WAAW;AAChC,SAASC,mCAAmC;AAC5C,SAASC,WAAW;AACpB,SAAsBC,iBAAiB;AACvC,SAAqBC,UAAUC,gBAAgB;AAE/C,SAASC,wBAAwB;AACjC,SAASC,sBAAsB;AAE/B,SAASC,YAAY;AAyBrB,IAAA,eAAaC;AAGX,IAAA,eAAA,CAAA,EAAA,OAAA,QAAA,OAA8C,IAAA,QAAA,oBAAA,EAAA,MAAA;AAC9C,QAAMC,EAAAA,MAAAA,IAAYC;oBACO,iBAAA,SAAA,MAAA;EAAA,GAAA;WAAkB,MAAA,SAAA;;MAAuB;QAAE,IAAA,KAAA,QAAA;MAClEC;IACAC;IACAC,MAAAA;IACF,QAAA,CAAA,MAAA;IAEA,YAAMC,MAAeJ,SAAAA,eACnB,OACA;;uBAEI,iBAAA,UAAA,YAAA;AACF,QAAA,CAAA,OAAA,UAAA,CAAA,OAAA;AAEAK;IACA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AAe;AAExB,SAASC,oBAAoB;AAC7B,SAASC,qBAAqB;AAavB,IAAMC,kBAAkB,CAACC,eAAmC,CAAC,MAAC;AACnE,QAAMC,WAAWH,cAAcD,aAAaK,YAAY;AACxD,QAAMC,OAAOP,SAAQ,MAAMD,KAAKS,KAAyBJ,YAAAA,GAAe,CAAA,CAAE;AAE1E,SAAOJ,SACL,OAAO;IACLO;IACA,IAAIE,QAAQ;AACV,aAAOJ,SAASK,IAAIH,IAAAA;IACtB;IACAI,QAAQ,CAACC,YAAAA;AACPP,eAASQ,IAAIN,MAAMK,QAAQP,SAASK,IAAIH,IAAAA,CAAAA,CAAAA;IAC1C;IACAM,KAAK,CAAqCC,KAAQC,MAAAA;AAChDV,eAASQ,IAAIN,MAAM;QAAE,GAAGF,SAASK,IAAIH,IAAAA;QAAO,CAACO,GAAAA,GAAMC;MAAE,CAAA;IACvD;EACF,IACA;IAACR;IAAMF;GAAS;AAEpB;;;ACpCA,SAASW,iBAAiBC,wBAAwB;AAClD,SAASC,gBAAgB;AACzB,SAASC,sBAAsB;AAE/B,SAASC,oBAAoB;AAC7B,SAASC,0BAA0B;AAQ5B,IAAMC,cAAc,MAAA;AACzB,QAAMC,UAAUN,iBAAAA;AAChBE,iBAAe,YAAA;AACb,UAAMI,QAAQC,SAASJ,aAAaK,aAAa,EAAEC,KAAKR,SAASS,mBAAmB;EACtF,GAAG;IAACJ;GAAQ;AACZ,QAAM,CAACK,QAAAA,IAAYZ,gBAAgBK,mBAAmBQ,QAAQ;AAC9D,SAAOD;AACT;",
|
|
6
|
+
"names": ["useEffect", "useMemo", "Operation", "Obj", "Query", "Ref", "getUserFunctionIdInMetadata", "log", "useClient", "getSpace", "useQuery", "createMenuAction", "messageValence", "meta", "createDeploy", "errorItem", "createMenuAction", "icon", "hidden", "classNames", "deployAction", "state", "result", "deployScript", "script", "client", "space", "fn", "existingFunctionId", "set", "type", "value", "ns", "profile", "disabled", "deploying", "copyAction", "navigator", "writeText", "functionUrl", "edges", "relation", "useEffect", "edgeUrl", "useQuery", "source", "Ref", "useMemo", "format", "prettierPluginEstree", "prettierPluginTypescript", "Obj", "log", "createMenuAction", "meta", "__dxlog_file", "createFormat", "script", "plugins", "semi", "singleQuote", "update", "err", "catch", "label", "icon", "edges", "relation", "Obj", "FUNCTIONS_PRESET_META_KEY", "createMenuAction", "createTemplateSelectActions", "script", "templates", "map", "template", "createMenuAction", "id", "Obj", "update", "name", "meta", "getMeta", "oldPresetIndex", "keys", "findIndex", "key", "source", "FUNCTIONS_PRESET_META_KEY", "splice", "push", "presetId", "target", "obj", "content", "label", "value", "type", "createTemplateSelect", "templateSelectActions", "nodes", "edges", "relation", "action", "useCallback", "useState", "useOperationInvoker", "Script", "Obj", "invariant", "SpaceOperation", "useClient", "ScriptOperation", "__dxlog_file", "client", "useClient", "status", "setStatus", "setError", "handleCreateAndDeployScripts", "useCallback", "invariant", "space", "undefined", "deploymentResults", "createResult", "initialTemplateId", "template", "instanceOf", "Script", "target", "object", "deployScript", "script", "scriptTemplates", "error", "Atom", "useMemo", "Capabilities", "useCapability", "useToolbarState", "initialState", "registry", "AtomRegistry", "atom", "make", "value", "get", "update", "updater", "set", "key", "v", "useCapabilities", "usePluginManager", "EffectEx", "useAsyncEffect", "ScriptEvents", "ScriptCapabilities", "useCompiler", "manager", "activate", "SetupCompiler", "pipe", "runAndForwardErrors", "compiler", "Compiler"]
|
|
7
7
|
}
|
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
defaultScriptsForIntegration,
|
|
10
10
|
meta
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NVV5UYY4.mjs";
|
|
12
12
|
import {
|
|
13
13
|
Notebook_exports,
|
|
14
14
|
ScriptCapabilities_exports,
|
|
15
15
|
ScriptEvents_exports,
|
|
16
16
|
ScriptOperation_exports,
|
|
17
17
|
Settings_exports
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-ZPFRRBZW.mjs";
|
|
19
|
+
import "./chunk-QV6NCUGM.mjs";
|
|
20
20
|
import {
|
|
21
21
|
script_blueprint_default
|
|
22
22
|
} from "./chunk-BDHDBPVM.mjs";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-O6A5PTB3.mjs";
|
|
24
24
|
import "./chunk-TRKXIP2Q.mjs";
|
|
25
25
|
import "./chunk-J5LGTIGS.mjs";
|
|
26
26
|
export {
|