@theoremjs/studio 0.3.4-next.429.g04f32ef → 0.3.4-next.431.ge13f488

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +1 -1
  2. package/compile.js +5 -1
  3. package/package.json +4 -4
  4. package/page/assets/{Banner-BXxhF-o1.js → Banner-CnPs4KTr.js} +2 -2
  5. package/page/assets/{ConsoleFrame-Zogp88Wc.js → ConsoleFrame-wtGxMrsA.js} +1 -1
  6. package/page/assets/{ContextMenu-CBOyKWd3.js → ContextMenu-DeNXjcz1.js} +2 -2
  7. package/page/assets/{ToolResultCharts-DoQ48Rsd.js → ToolResultCharts-B8CzXIqT.js} +1 -1
  8. package/page/assets/{TraceInspector-75n9__a7.js → TraceInspector-ZowpFy4M.js} +1 -1
  9. package/page/assets/{TraceOverview-UM4eJDLe.js → TraceOverview-Cqs1E-WL.js} +1 -1
  10. package/page/assets/{browser-engine-bQlfBE9p.js → browser-engine-BGts-9-X.js} +1 -1
  11. package/page/assets/{browser-transport-DxIOg1UT.js → browser-transport-BFjGvFHY.js} +4 -4
  12. package/page/assets/{export-agent-DX9oOrot.js → export-agent-D914R2_U.js} +1 -1
  13. package/page/assets/{guardrail-tester-BNJdJRUn.js → guardrail-tester-W5uDWW7h.js} +1 -1
  14. package/page/assets/{index-DF970vI_.js → index-MqEkSrS5.js} +6 -6
  15. package/page/assets/{studio-code-pane-B8JqSxFl.js → studio-code-pane-0D6foJdq.js} +1 -1
  16. package/page/assets/{studio-console-BbXL5cQm.js → studio-console-CE7YLrvN.js} +1 -1
  17. package/page/assets/{studio-decision-BX7Q1Ux3.js → studio-decision-D-j5C59K.js} +1 -1
  18. package/page/assets/{studio-embedding-CaD6jPeS.js → studio-embedding-CzrDbeQs.js} +1 -1
  19. package/page/assets/{studio-host-console-Cc0ph_Fn.js → studio-host-console-TCCnn8Gq.js} +2 -2
  20. package/page/assets/{studio-labels-J8Gxj-VB.js → studio-labels-COswYshV.js} +1 -1
  21. package/page/assets/{studio-live-TQtVqURP.js → studio-live-CSEXVOhs.js} +1 -1
  22. package/page/assets/{studio-map-D-aUd36N.js → studio-map-BVsqyzJ6.js} +1 -1
  23. package/page/assets/{studio-trace-replay-DHRQV1xK.js → studio-trace-replay-CNW1GAHH.js} +1 -1
  24. package/page/assets/{use-one-call-DOmiIAXx.js → use-one-call-DIbYGoc1.js} +1 -1
  25. package/page/index.html +5 -5
  26. package/ui/studio-screen.d.ts +7 -6
  27. package/ui/studio-screen.js +23 -25
@@ -1,4 +1,4 @@
1
- import { type FilesMerge, type SharedEntry, type StudioDraft, type StudioWorkspace } from '../mod.ts';
1
+ import { type FilesMerge, type SharedEntry, type StudioDraft, type StudioRunsOn, type StudioWorkspace } from '../mod.ts';
2
2
  import { type Dispatch, type SetStateAction } from 'react';
3
3
  import { type ProjectFiles, type ProjectSession } from './lib/studio-project.ts';
4
4
  import { type RestoredStudio } from './lib/studio-session.ts';
@@ -54,13 +54,14 @@ declare function useStudioWorkspace(start: RestoredStudio, project: ProjectSessi
54
54
  };
55
55
  export type StudioWorkspaceState = ReturnType<typeof useStudioWorkspace>;
56
56
  /**
57
- * The studio's tree for a workspace, open on its `selected` node, where nothing changes anything:
58
- * a picture of the studio for a page that is not the studio, such as a home page. It writes no
59
- * storage and reports nothing.
57
+ * The studio's editor for a workspace, open on its `selected` node: the toolbar, with the issue
58
+ * count, over the inspector, with each issue on its row. Nothing on it changes anything: a picture
59
+ * of the studio for a page that is not the studio, such as a home page. It writes no storage and
60
+ * reports nothing. `on` is where the page's studio runs, so the issues are the ones it would show.
60
61
  */
61
- export declare function StudioTreePreview({ workspace, kernelVersion, }: {
62
+ export declare function StudioEditorPreview({ workspace, on, }: {
62
63
  workspace: StudioWorkspace;
63
- kernelVersion: string;
64
+ on: StudioRunsOn;
64
65
  }): import("react").JSX.Element;
65
66
  /** The studio, opened on `opened`, with what the page showing it provides. */
66
67
  export declare function StudioScreen({ opened, host }: {
@@ -1523,38 +1523,36 @@ const TreeColumn = memo(function TreeColumn({ tree, draft, onAddAgent, listRef,
1523
1523
  return (_jsx(Section, { variant: "transparent", width: TREE_WIDTH, height: "100%", padding: 4, dividers: ['end'], children: _jsxs(VStack, { gap: 4, height: "100%", children: [_jsxs(HStack, { gap: 2, vAlign: "start", children: [_jsx(StackItem, { size: "fill", children: _jsxs(VStack, { gap: 1, children: [_jsx(Heading, { level: 3, children: "theorem studio" }), _jsx(Text, { type: "supporting", color: "secondary", children: `${project ? `${project.name} · ` : ''}@theoremjs/agents ${kernelVersion}` })] }) }), _jsx(SheetButton, { label: "Close sections", icon: IconX, sheet: null, setSheet: setSheet })] }), _jsx(StackItem, { size: "fill", children: _jsx(WorkspaceTreeLists, { tree: tree, draft: draft, onAddAgent: onAddAgent, listRef: listRef }) })] }) }));
1524
1524
  });
1525
1525
  /**
1526
- * The studio's tree for a workspace, open on its `selected` node, where nothing changes anything:
1527
- * a picture of the studio for a page that is not the studio, such as a home page. It writes no
1528
- * storage and reports nothing.
1526
+ * The studio's editor for a workspace, open on its `selected` node: the toolbar, with the issue
1527
+ * count, over the inspector, with each issue on its row. Nothing on it changes anything: a picture
1528
+ * of the studio for a page that is not the studio, such as a home page. It writes no storage and
1529
+ * reports nothing. `on` is where the page's studio runs, so the issues are the ones it would show.
1529
1530
  */
1530
- export function StudioTreePreview({ workspace, kernelVersion, }) {
1531
- const listRef = useRef(null);
1532
- const selectedId = workspace.selected;
1533
- const at = workspaceNodeRef(workspace, selectedId);
1531
+ export function StudioEditorPreview({ workspace, on, }) {
1532
+ const selected = workspace.selected;
1533
+ const at = workspaceNodeRef(workspace, selected);
1534
1534
  const focus = at && 'agent' in at ? at.agent : (workspace.agents[0]?.key ?? '');
1535
1535
  const draft = libraryDraft(workspace, focus) ?? createBlankDraft();
1536
+ const compiled = useMemo(() => compileWorkspace(workspace, on), [workspace, on]);
1537
+ const editing = innerNodeId(selected, focus) ?? 'identity';
1536
1538
  const still = () => { };
1537
- const tree = {
1538
- workspace,
1539
- focus,
1540
- selectedId,
1541
- list: 'agents',
1542
- ownsProviders: false,
1543
- setList: still,
1544
- onSelect: still,
1545
- update: still,
1546
- setDraft: still,
1547
- reset: () => undefined,
1548
- keys: null,
1539
+ const view = {
1540
+ keysOpen: false,
1541
+ setKeysOpen: still,
1542
+ editorView: 'editor',
1543
+ setEditorView: still,
1544
+ mapOpen: false,
1545
+ setMapOpen: still,
1546
+ settingsOpen: false,
1547
+ open: still,
1549
1548
  };
1550
- return (_jsx(StudioHostContext.Provider, { value: { kernelVersion }, children: _jsx(TreeColumn, { tree: tree, draft: draft, onAddAgent: still, listRef: listRef, setSheet: still }) }));
1549
+ return (_jsxs(VStack, { height: "100%", children: [_jsx(EditorToolbar, { heading: editorTitle(draft, editing), compiled: compiled, selected: selected, view: view, onIssue: still, getCode: null, project: null, setSheet: still }), _jsx(StackItem, { size: "fill", children: _jsx(RunsOn.Provider, { value: on, children: _jsx(ProfileEditor, { draft: draft, setDraft: still, selectedId: editing, onSelect: still, issues: editorIssuesOf(compiled, focus) }) }) })] }));
1551
1550
  }
1552
1551
  /**
1553
1552
  * The issue count, which goes to the next issue after the selected node and shows it there. Hidden
1554
1553
  * with none. It counts every issue, so what blocks a run or Save always has a way to it.
1555
1554
  */
1556
- function IssueToken({ compile, selected, onIssue, }) {
1557
- const { compiled } = compile;
1555
+ function IssueToken({ compiled, selected, onIssue, }) {
1558
1556
  if (compiled.ok)
1559
1557
  return null;
1560
1558
  const issues = issuesLabel(compiled.issues.length);
@@ -1625,8 +1623,8 @@ function useDiscardAll({ store, filesChanged }) {
1625
1623
  }, [store, filesChanged, toast]);
1626
1624
  }
1627
1625
  /** The editor column's header: its title, the next issue, what to start from, Get code, and the view toggle. */
1628
- function EditorToolbar({ heading, compile, selected, view, onIssue, project, getCode, setSheet, }) {
1629
- return (_jsx(Section, { variant: "transparent", padding: 3, dividers: ['bottom'], children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(SheetButton, { label: "Sections", icon: IconMenu2, sheet: "tree", setSheet: setSheet }), _jsx(StackItem, { size: "fill", children: heading && (_jsx("span", { title: heading, children: _jsx(Heading, { level: 4, maxLines: 1, children: heading }) })) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(IssueToken, { compile: compile, selected: selected, onIssue: onIssue }), project] }) }), getCode, _jsx(ViewToggleButton, { view: view }), _jsx(SheetButton, { label: "Preview", icon: IconPlayerPlay, sheet: "preview", setSheet: setSheet })] }) }));
1626
+ function EditorToolbar({ heading, compiled, selected, view, onIssue, project, getCode, setSheet, }) {
1627
+ return (_jsx(Section, { variant: "transparent", padding: 3, dividers: ['bottom'], children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(SheetButton, { label: "Sections", icon: IconMenu2, sheet: "tree", setSheet: setSheet }), _jsx(StackItem, { size: "fill", children: heading && (_jsx("span", { title: heading, children: _jsx(Heading, { level: 4, maxLines: 1, children: heading }) })) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(IssueToken, { compiled: compiled, selected: selected, onIssue: onIssue }), project] }) }), getCode, _jsx(ViewToggleButton, { view: view }), _jsx(SheetButton, { label: "Preview", icon: IconPlayerPlay, sheet: "preview", setSheet: setSheet })] }) }));
1630
1628
  }
1631
1629
  /** Opens the Keys page, above the providers list, in the same form as Add provider. */
1632
1630
  function ManageKeysButton({ keys }) {
@@ -2145,7 +2143,7 @@ function EditorColumn({ heading, state, connection, view, compile, selected, edi
2145
2143
  }, [state.origins, state.workspace, selected, openOrigin]);
2146
2144
  const whole = rowOrigins?.scope.section;
2147
2145
  const said = over ? undefined : (whole ?? rowOrigins?.scope.partly);
2148
- return (_jsxs(VStack, { height: "100%", children: [_jsx(EditorToolbar, { heading: heading, compile: compile, selected: selected, view: view, onIssue: goToIssue, getCode: _jsx(ExportMenu, { store: state.store, compile: compile, copy: copy }), project: project && (_jsxs(_Fragment, { children: [state.conflict && (_jsx(Token, { label: conflictsLabel(state.conflict.merge.conflicts.length), color: "orange", description: "Choose between studio edits and source code", onClick: () => {
2146
+ return (_jsxs(VStack, { height: "100%", children: [_jsx(EditorToolbar, { heading: heading, compiled: compile.compiled, selected: selected, view: view, onIssue: goToIssue, getCode: _jsx(ExportMenu, { store: state.store, compile: compile, copy: copy }), project: project && (_jsxs(_Fragment, { children: [state.conflict && (_jsx(Token, { label: conflictsLabel(state.conflict.merge.conflicts.length), color: "orange", description: "Choose between studio edits and source code", onClick: () => {
2149
2147
  state.showConflict(true);
2150
2148
  } })), _jsx(ProjectTokens, { project: project, unloaded: state.files?.unloaded })] })), setSheet: setSheet }), shared && (_jsx(SharedLine, { entry: shared, workspace: state.workspace, selected: selected, onOpen: project
2151
2149
  ? () => {