@theoremjs/studio 0.3.4-next.570.gfda95a3 → 0.3.4-next.574.g44edd0f

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 (29) hide show
  1. package/package.json +4 -4
  2. package/page/assets/{Banner-CrKy_Hwv.js → Banner-fCdA5xuX.js} +2 -2
  3. package/page/assets/{ConsoleFrame-mZpOKfZP.js → ConsoleFrame-DToEAKll.js} +1 -1
  4. package/page/assets/{ContextMenu-BAMCFPeG.js → ContextMenu-B8KwzKYT.js} +2 -2
  5. package/page/assets/{MenuBottomSheet-COMdKPyt.js → MenuBottomSheet-zGHY1Qv9.js} +1 -1
  6. package/page/assets/{SchemaFields-i5CGKHZw.js → SchemaFields-BixBUjiA.js} +1 -1
  7. package/page/assets/{ToolResultCharts-CM0D9rIN.js → ToolResultCharts-CwFb9gvT.js} +1 -1
  8. package/page/assets/{TraceInspector-BZ6XsVv6.js → TraceInspector-BiGZIuRD.js} +1 -1
  9. package/page/assets/{TraceOverview-B3KOSNYV.js → TraceOverview-CE_CJPgZ.js} +1 -1
  10. package/page/assets/{browser-engine-CG3geEGu.js → browser-engine-D8Z5HFdN.js} +1 -1
  11. package/page/assets/{browser-transport-Bh1HRv_X.js → browser-transport-CK1pmgre.js} +3 -3
  12. package/page/assets/{export-agent-BXoo4WkX.js → export-agent-BaT6Ugod.js} +1 -1
  13. package/page/assets/{guardrail-tester-BiFjW2iT.js → guardrail-tester-BC2B451Y.js} +1 -1
  14. package/page/assets/{index-Cy5Fau-l.js → index-pTlbT5-H.js} +12 -12
  15. package/page/assets/{studio-code-pane-BXowjDUi.js → studio-code-pane-DabjL4ZW.js} +1 -1
  16. package/page/assets/{studio-console-By2ZHfS3.js → studio-console-0do1lZHL.js} +1 -1
  17. package/page/assets/{studio-decision-CZJiH4yV.js → studio-decision-4s8gxCEw.js} +1 -1
  18. package/page/assets/{studio-embedding-DJ4PyagP.js → studio-embedding-Ca_LK3qT.js} +1 -1
  19. package/page/assets/{studio-host-console-Cq_V7aux.js → studio-host-console-CpSBV3GL.js} +2 -2
  20. package/page/assets/{studio-labels-DFzGkFod.js → studio-labels-BEisLSYH.js} +1 -1
  21. package/page/assets/{studio-live-DkMUAP67.js → studio-live-1hhXypVq.js} +1 -1
  22. package/page/assets/{studio-map-CWw5Sd6l.js → studio-map-CLJrLzii.js} +1 -1
  23. package/page/assets/{studio-trace-replay-DqWHUnOl.js → studio-trace-replay-BJ6EScXk.js} +1 -1
  24. package/page/assets/{use-one-call-BibUH5we.js → use-one-call-CWqJ5Ljp.js} +1 -1
  25. package/page/index.html +5 -5
  26. package/ui/lib/panel-motion.d.ts +8 -4
  27. package/ui/lib/panel-motion.js +58 -33
  28. package/ui/studio-screen.js +3 -7
  29. package/ui/studio-settings.js +3 -3
@@ -1,16 +1,30 @@
1
1
  /**
2
- * The panel takes the whole frame for the map or Settings, and gives it back. The preview eases
3
- * out, the panel's far edge moves over the room it gave up, and the map or Settings eases in as it
4
- * is uncovered. The tree and the editor stay where they are.
2
+ * The panel takes the whole frame for the map or Settings, and gives it back. What is on screen
3
+ * and will not stay eases out, the panel's far edge moves if its width changes, and what comes in
4
+ * eases in. The nav column is the studio's and Settings' both: its frame and head stay, and only
5
+ * the list under the head crosses.
5
6
  */
6
7
  import { HOLD_MS, prefersReducedMotion, sleep } from "../shell-motion.js";
7
8
  const MOVE_MS = 640;
8
9
  const FADE_MS = 280;
9
10
  const EASE = 'cubic-bezier(0.45, 0.02, 0.15, 1)';
10
- /** What fades out before the move and back in after it: the preview and the panel's handle. */
11
- const PARTS = '.studio-preview, .studio-side-handle';
12
- /** What eases in as the panel extends over it: the map, or Settings' list and body under its headers. */
13
- const INCOMING = '.studio-map-pane, .studio-settings-tree, .studio-settings-body';
11
+ const PARTS = {
12
+ tree: '.studio-tree .studio-nav-head ~ *',
13
+ editor: '.studio-view',
14
+ handle: '.studio-side-handle',
15
+ preview: '.studio-preview',
16
+ map: '.studio-map-pane, .studio-map-handle',
17
+ settingsNav: '.studio-settings .studio-nav-head ~ *, .studio-settings-tree',
18
+ settings: '.studio-settings-main',
19
+ };
20
+ function shown(view) {
21
+ if (view.settings)
22
+ return ['settingsNav', 'settings'];
23
+ if (view.map)
24
+ return ['tree', 'editor', 'map'];
25
+ return ['tree', 'editor', 'handle', 'preview'];
26
+ }
27
+ const isWide = (view) => view.map || view.settings;
14
28
  /** A phone's panel already takes the frame, and reduced motion moves nothing. */
15
29
  export function panelCanMove() {
16
30
  return globalThis.matchMedia('(min-width: 768px)').matches && !prefersReducedMotion();
@@ -21,54 +35,65 @@ function ended(animations, ms) {
21
35
  return Promise.race([all, sleep(ms + 200)]);
22
36
  }
23
37
  /**
24
- * Move the panel around `swap`, which puts the next view on screen and must have drawn it by the
25
- * time it returns. `widens` is the map or Settings opening; otherwise it is closing. Without a
26
- * panel to move, the swap happens at once.
38
+ * Move the panel from `from` to `to` around `swap`, which puts `to` on screen and must have drawn
39
+ * it by the time it returns. Without a panel to move, the swap happens at once.
27
40
  */
28
- export async function movePanel(widens, swap) {
41
+ export async function movePanel(from, to, swap) {
29
42
  const frame = document.querySelector('.studio-frame');
30
43
  const surface = frame?.querySelector('[data-shell-frame]');
31
44
  if (!frame || !surface || !panelCanMove()) {
32
45
  swap();
33
46
  return;
34
47
  }
35
- const parts = () => [...frame.querySelectorAll(PARTS)];
36
- const hidden = parts().map((part) => part.animate({ opacity: [1, 0] }, { duration: HOLD_MS, easing: 'ease', fill: 'forwards' }));
37
- await ended(hidden, HOLD_MS);
48
+ const find = (parts) => parts.flatMap((part) => [...frame.querySelectorAll(PARTS[part])]);
49
+ const before = shown(from);
50
+ const after = shown(to);
51
+ const leaving = find(before.filter((part) => !after.includes(part)));
52
+ const coming = after.filter((part) => !before.includes(part));
53
+ const held = [];
54
+ const hold = (els) => {
55
+ for (const each of els) {
56
+ held.push(each.animate({ opacity: [0, 0] }, { duration: MOVE_MS, fill: 'forwards' }));
57
+ }
58
+ };
59
+ const out = leaving.map((each) => each.animate({ opacity: [1, 0] }, { duration: HOLD_MS, easing: 'ease', fill: 'forwards' }));
60
+ await ended(out, HOLD_MS);
38
61
  // The panel is drawn at its full width, cut back to the width it rests at: only the cut moves.
39
62
  // The corners are the raised surface's own, which the frame wraps.
40
63
  const drawn = surface.firstElementChild ?? surface;
41
64
  const round = getComputedStyle(drawn).borderTopRightRadius || '0px';
42
65
  const cut = (width) => `inset(0 calc(100% - ${String(width)}px) 0 0 round ${round})`;
43
66
  const whole = `inset(0 0 0 0 round ${round})`;
44
- if (widens) {
67
+ const swapHidden = () => {
68
+ swap();
69
+ // invariant: what comes in is held out of sight in the same task as the swap, before a paint.
70
+ hold(find(coming));
71
+ };
72
+ let move;
73
+ if (isWide(to) && !isWide(from)) {
45
74
  const narrow = surface.offsetWidth;
46
75
  surface.dataset.rests = String(narrow);
47
- const move = surface.animate({ clipPath: [cut(narrow), whole] }, { duration: MOVE_MS, easing: EASE, fill: 'both' });
48
- swap();
49
- const incoming = frame.querySelectorAll(INCOMING);
50
- const fades = [...incoming].map((each) => each.animate({ opacity: [0, 1] }, { duration: MOVE_MS, easing: EASE, fill: 'both' }));
51
- await ended([move, ...fades], MOVE_MS);
52
- move.cancel();
53
- for (const each of fades)
54
- each.cancel();
76
+ move = surface.animate({ clipPath: [cut(narrow), whole] }, { duration: MOVE_MS, easing: EASE, fill: 'both' });
77
+ swapHidden();
78
+ await ended([move], MOVE_MS);
55
79
  }
56
- else {
80
+ else if (!isWide(to) && isWide(from)) {
57
81
  const narrow = Number(surface.dataset.rests);
58
82
  delete surface.dataset.rests;
59
83
  if (narrow > 0) {
60
- const move = surface.animate({ clipPath: [whole, cut(narrow)] }, { duration: MOVE_MS, easing: EASE, fill: 'both' });
84
+ move = surface.animate({ clipPath: [whole, cut(narrow)] }, { duration: MOVE_MS, easing: EASE, fill: 'both' });
61
85
  await ended([move], MOVE_MS);
62
- swap();
63
- move.cancel();
64
- }
65
- else {
66
- swap();
67
86
  }
87
+ swapHidden();
68
88
  }
69
- for (const part of parts()) {
70
- part.animate({ opacity: [0, 1] }, { duration: FADE_MS, easing: EASE });
89
+ else {
90
+ swapHidden();
71
91
  }
72
- for (const each of hidden)
92
+ const fades = find(coming).map((each) => each.animate({ opacity: [0, 1] }, { duration: FADE_MS, easing: EASE, fill: 'backwards' }));
93
+ for (const each of held)
94
+ each.cancel();
95
+ move?.cancel();
96
+ await ended(fades, FADE_MS);
97
+ for (const each of out)
73
98
  each.cancel();
74
99
  }
@@ -1364,8 +1364,8 @@ function offerEditsBack(toast, store, edits, key) {
1364
1364
  });
1365
1365
  setAside(key, edits);
1366
1366
  }
1367
+ /** The panel at rest: neither the map nor Settings. */
1367
1368
  const NARROW = { map: false, settings: false };
1368
- const isWide = (panel) => panel.map || panel.settings;
1369
1369
  /**
1370
1370
  * Which view stands in the editor column, whether the map is open beside it, and opening a node
1371
1371
  * there. The map takes the preview's place: the panel widens over it the way the shell moves after
@@ -1395,11 +1395,7 @@ function useEditorView(store) {
1395
1395
  setSettings(to.settings);
1396
1396
  });
1397
1397
  };
1398
- // Settings over an open map, and back: the panel is already as wide as it goes.
1399
- if (isWide(to) === isWide(was))
1400
- swap();
1401
- else
1402
- await movePanel(isWide(to), swap);
1398
+ await movePanel(was, to, swap);
1403
1399
  });
1404
1400
  }, []);
1405
1401
  const setMapOpen = useCallback((next) => {
@@ -1518,7 +1514,7 @@ function SheetButton({ label, icon, sheet, setSheet, }) {
1518
1514
  const TreeColumn = memo(function TreeColumn({ tree, draft, onAddAgent, listRef, setSheet, }) {
1519
1515
  const project = useProject();
1520
1516
  const { kernelVersion } = useStudioHost();
1521
- 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 }) })] }) }));
1517
+ 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", className: "studio-nav-head", 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 }) })] }) }));
1522
1518
  });
1523
1519
  /**
1524
1520
  * The studio's editor for a workspace, open on its `selected` node: the toolbar, with the issue
@@ -262,7 +262,7 @@ function SectionBody({ section, ...props }) {
262
262
  const isSection = (value) => SETTINGS_SECTIONS.includes(value);
263
263
  /** The nav's head, as the studio's tree and the docs head theirs: the name, what is open, then the search. */
264
264
  function SettingsNavHead({ project, version }) {
265
- return (_jsxs(VStack, { gap: 4, children: [_jsxs(VStack, { gap: 1, children: [_jsx(Heading, { level: 3, children: "theorem studio" }), _jsx(Text, { type: "supporting", color: "secondary", children: `${project.name} · @theoremjs/agents ${version}` })] }), _jsx(Typeahead, { label: "Search", isLabelHidden: true, placeholder: "Search settings...", searchSource: settingsSource, value: null, onChange: (item) => {
265
+ return (_jsxs(VStack, { gap: 4, children: [_jsxs(VStack, { gap: 1, className: "studio-nav-head", children: [_jsx(Heading, { level: 3, children: "theorem studio" }), _jsx(Text, { type: "supporting", color: "secondary", children: `${project.name} · @theoremjs/agents ${version}` })] }), _jsx(Typeahead, { label: "Search", isLabelHidden: true, placeholder: "Search settings...", searchSource: settingsSource, value: null, onChange: (item) => {
266
266
  const found = SETTINGS.find((setting) => setting.id === item?.id);
267
267
  if (found)
268
268
  showSettingsSection(found.section);
@@ -274,14 +274,14 @@ const SETTINGS_WIDTH = '72rem';
274
274
  export function StudioSettings(props) {
275
275
  const isNarrow = useMediaQuery('(max-width: 768px)');
276
276
  const { section } = useSettingsDoor();
277
- return (_jsx(Section, { variant: "transparent", height: "100%", padding: 0, children: _jsx(Layout, { height: "fill", start: isNarrow ? undefined : (_jsx(Section, { variant: "transparent", width: NAV_WIDTH, height: "100%", padding: 4, dividers: ['end'], children: _jsxs(VStack, { gap: 4, height: "100%", children: [_jsx(SettingsNavHead, { project: props.project, version: props.version }), _jsx(TreeList, { className: "studio-settings-tree", density: "compact", "aria-label": "Settings", items: SETTINGS_SECTIONS.map((each) => ({
277
+ return (_jsx(Section, { variant: "transparent", height: "100%", padding: 0, className: "studio-settings", children: _jsx(Layout, { height: "fill", start: isNarrow ? undefined : (_jsx(Section, { variant: "transparent", width: NAV_WIDTH, height: "100%", padding: 4, dividers: ['end'], children: _jsxs(VStack, { gap: 4, height: "100%", children: [_jsx(SettingsNavHead, { project: props.project, version: props.version }), _jsx(TreeList, { className: "studio-settings-tree", density: "compact", "aria-label": "Settings", items: SETTINGS_SECTIONS.map((each) => ({
278
278
  id: each,
279
279
  label: SECTION_LABELS[each],
280
280
  isSelected: section === each,
281
281
  onClick: () => {
282
282
  showSettingsSection(each);
283
283
  },
284
- })) })] }) })), content: _jsxs(LayoutContent, { padding: 0, children: [_jsx(Section, { variant: "transparent", padding: 3, dividers: ['bottom'], children: _jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(StackItem, { size: "fill", children: _jsx(Heading, { level: 4, maxLines: 1, children: SECTION_LABELS[section] }) }), _jsx(IconButton, { label: "Close settings", variant: "ghost", icon: _jsx(Icon, { icon: IconX, size: "sm" }), tooltip: "Back to the studio", onClick: closeSettings })] }) }), _jsx(Section, { variant: "transparent", padding: 3, maxWidth: SETTINGS_WIDTH, className: "studio-settings-body", children: _jsxs(VStack, { gap: 4, children: [isNarrow && _jsx(SettingsNavHead, { project: props.project, version: props.version }), isNarrow && (_jsx(VStack, { hAlign: "center", children: _jsx(TabList, { value: section, onChange: (next) => {
284
+ })) })] }) })), content: _jsxs(LayoutContent, { padding: 0, className: "studio-settings-main", children: [_jsx(Section, { variant: "transparent", padding: 3, dividers: ['bottom'], children: _jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(StackItem, { size: "fill", children: _jsx(Heading, { level: 4, maxLines: 1, children: SECTION_LABELS[section] }) }), _jsx(IconButton, { label: "Close settings", variant: "ghost", icon: _jsx(Icon, { icon: IconX, size: "sm" }), tooltip: "Back to the studio", onClick: closeSettings })] }) }), _jsx(Section, { variant: "transparent", padding: 3, maxWidth: SETTINGS_WIDTH, className: "studio-settings-body", children: _jsxs(VStack, { gap: 4, children: [isNarrow && _jsx(SettingsNavHead, { project: props.project, version: props.version }), isNarrow && (_jsx(VStack, { hAlign: "center", children: _jsx(TabList, { value: section, onChange: (next) => {
285
285
  if (isSection(next))
286
286
  showSettingsSection(next);
287
287
  }, children: SETTINGS_SECTIONS.map((each) => (_jsx(Tab, { value: each, label: SECTION_LABELS[each] }, each))) }) })), _jsx(SectionBody, { section: section, ...props })] }) })] }) }) }));