@buffcore/admin-shell 0.8.44 → 0.8.46
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/components/Markdown.d.ts +9 -3
- package/dist/components/Markdown.js +84 -34
- package/dist/components/Sheet.d.ts +5 -1
- package/dist/components/Sheet.js +8 -2
- package/dist/components/TextArea.d.ts +3 -1
- package/dist/components/TextArea.js +3 -3
- package/dist/components/icons.d.ts +1 -0
- package/dist/components/icons.js +1 -0
- package/dist/prototype/SceneSignal.d.ts +2 -1
- package/dist/prototype/SceneSignal.js +12 -1
- package/dist/prototype/scene-status.d.ts +1 -2
- package/dist/prototype/scene-status.js +1 -2
- package/dist/prototype/scene.d.ts +1 -1
- package/dist/prototype/scene.js +20 -3
- package/dist/workbench/app/ServedPrototype.js +5 -0
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +7 -7
- package/dist/workbench/app/actions.d.ts +4 -2
- package/dist/workbench/app/actions.js +9 -4
- package/dist/workbench/app/brief-short.d.ts +14 -0
- package/dist/workbench/app/brief-short.js +103 -0
- package/dist/workbench/app/chat-session.d.ts +3 -3
- package/dist/workbench/app/chat-session.js +8 -3
- package/dist/workbench/app/chat.d.ts +15 -2
- package/dist/workbench/app/chat.js +9 -4
- package/dist/workbench/app/loop.js +2 -18
- package/dist/workbench/app/prototype.js +3 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +10 -0
- package/dist/workbench/app/useStudio.d.ts +2 -1
- package/dist/workbench/studio/frame/AgentPanel.js +24 -1
- package/dist/workbench/studio/frame/PanelList.js +1 -1
- package/dist/workbench/studio/frame/Segmented.d.ts +3 -1
- package/dist/workbench/studio/frame/Segmented.js +4 -3
- package/dist/workbench/studio/frame/StudioFrame.js +3 -3
- package/dist/workbench/studio/frame/StudioRegions.js +4 -1
- package/dist/workbench/studio/frame/TurnControls.d.ts +2 -1
- package/dist/workbench/studio/frame/TurnControls.js +4 -1
- package/dist/workbench/studio/frame/layout.d.ts +2 -0
- package/dist/workbench/studio/frame/layout.js +2 -0
- package/dist/workbench/studio/frame/panelControls.d.ts +21 -1
- package/dist/workbench/studio/frame/scrollbars.d.ts +1 -1
- package/dist/workbench/studio/frame/scrollbars.js +5 -3
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +20 -2
- package/dist/workbench/studio/frame/useTurnDraft.js +39 -10
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/i18n/loop.en.d.ts +11 -38
- package/dist/workbench/studio/i18n/loop.en.js +11 -38
- package/dist/workbench/studio/i18n/loop.es.json +11 -38
- package/dist/workbench/studio/i18n/marks.en.d.ts +41 -0
- package/dist/workbench/studio/i18n/marks.en.js +42 -0
- package/dist/workbench/studio/i18n/marks.es.json +40 -0
- package/dist/workbench/studio/i18n/start.en.d.ts +5 -0
- package/dist/workbench/studio/i18n/start.en.js +7 -2
- package/dist/workbench/studio/i18n/start.es.json +7 -2
- package/dist/workbench/studio/i18n/workspace.en.d.ts +45 -0
- package/dist/workbench/studio/i18n/workspace.en.js +46 -0
- package/dist/workbench/studio/i18n/workspace.es.json +44 -0
- package/dist/workbench/studio/loop/BriefDocument.d.ts +9 -6
- package/dist/workbench/studio/loop/BriefDocument.js +48 -76
- package/dist/workbench/studio/loop/BriefLists.d.ts +11 -0
- package/dist/workbench/studio/loop/BriefLists.js +42 -0
- package/dist/workbench/studio/loop/BriefPage.d.ts +6 -2
- package/dist/workbench/studio/loop/BriefPage.js +32 -4
- package/dist/workbench/studio/loop/BriefReading.d.ts +19 -0
- package/dist/workbench/studio/loop/BriefReading.js +22 -0
- package/dist/workbench/studio/loop/BriefSection.d.ts +22 -0
- package/dist/workbench/studio/loop/BriefSection.js +47 -0
- package/dist/workbench/studio/loop/BriefWho.d.ts +6 -0
- package/dist/workbench/studio/loop/BriefWho.js +56 -0
- package/dist/workbench/studio/loop/CanvasBar.d.ts +0 -1
- package/dist/workbench/studio/loop/CanvasBar.js +2 -3
- package/dist/workbench/studio/loop/ConsoleFrame.d.ts +13 -0
- package/dist/workbench/studio/loop/ConsoleFrame.js +29 -0
- package/dist/workbench/studio/loop/NotThisCard.d.ts +6 -1
- package/dist/workbench/studio/loop/NotThisCard.js +28 -20
- package/dist/workbench/studio/loop/ProtoJourneys.d.ts +1 -8
- package/dist/workbench/studio/loop/ProtoJourneys.js +0 -14
- package/dist/workbench/studio/loop/PrototypeApp.d.ts +3 -1
- package/dist/workbench/studio/loop/PrototypeApp.js +24 -9
- package/dist/workbench/studio/loop/PrototypeAttempt.js +55 -14
- package/dist/workbench/studio/loop/PrototypePage.d.ts +4 -2
- package/dist/workbench/studio/loop/PrototypePage.js +25 -1
- package/dist/workbench/studio/loop/PrototypePreview.d.ts +35 -6
- package/dist/workbench/studio/loop/PrototypePreview.js +126 -80
- package/dist/workbench/studio/loop/PrototypePreviewSlot.d.ts +13 -0
- package/dist/workbench/studio/loop/PrototypePreviewSlot.js +23 -0
- package/dist/workbench/studio/loop/PrototypeScenes.d.ts +1 -1
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StudioLoop.d.ts +7 -2
- package/dist/workbench/studio/loop/StudioLoop.js +4 -10
- package/dist/workbench/studio/loop/WorkspaceBar.d.ts +15 -0
- package/dist/workbench/studio/loop/WorkspaceBar.js +52 -0
- package/dist/workbench/studio/loop/WorkspaceJourneys.d.ts +17 -0
- package/dist/workbench/studio/loop/WorkspaceJourneys.js +99 -0
- package/dist/workbench/studio/loop/WorkspaceLeft.d.ts +14 -0
- package/dist/workbench/studio/loop/WorkspaceLeft.js +42 -0
- package/dist/workbench/studio/loop/WorkspaceStage.d.ts +24 -0
- package/dist/workbench/studio/loop/WorkspaceStage.js +142 -0
- package/dist/workbench/studio/loop/WorkspaceSteps.d.ts +20 -0
- package/dist/workbench/studio/loop/WorkspaceSteps.js +96 -0
- package/dist/workbench/studio/loop/moments.js +0 -3
- package/dist/workbench/studio/loop/prototype-document.d.ts +2 -0
- package/dist/workbench/studio/loop/prototype-document.js +12 -0
- package/dist/workbench/studio/loop/prototype-part.d.ts +43 -0
- package/dist/workbench/studio/loop/prototype-part.js +104 -0
- package/dist/workbench/studio/loop/types.d.ts +26 -26
- package/dist/workbench/studio/loop/types.js +0 -3
- package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +3 -0
- package/dist/workbench/studio/loop/usePrototypeFrame.js +2 -0
- package/dist/workbench/studio/loop/workspace-journeys.d.ts +22 -0
- package/dist/workbench/studio/loop/workspace-journeys.js +63 -0
- package/dist/workbench/studio/loop/workspace-state.d.ts +94 -0
- package/dist/workbench/studio/loop/workspace-state.js +50 -0
- package/dist/workbench/studio/marks/ChangeList.d.ts +7 -0
- package/dist/workbench/studio/marks/ChangeList.js +70 -0
- package/dist/workbench/studio/marks/MarkHint.d.ts +18 -0
- package/dist/workbench/studio/marks/MarkHint.js +58 -0
- package/dist/workbench/studio/marks/MarkNumber.d.ts +6 -0
- package/dist/workbench/studio/marks/MarkNumber.js +24 -0
- package/dist/workbench/studio/marks/MarksLayer.d.ts +15 -0
- package/dist/workbench/studio/marks/MarksLayer.js +144 -0
- package/dist/workbench/studio/marks/PinNote.d.ts +13 -0
- package/dist/workbench/studio/marks/PinNote.js +49 -0
- package/dist/workbench/studio/marks/QueuedChanges.d.ts +6 -0
- package/dist/workbench/studio/marks/QueuedChanges.js +51 -0
- package/dist/workbench/studio/marks/WorkspaceMarks.d.ts +15 -0
- package/dist/workbench/studio/marks/WorkspaceMarks.js +67 -0
- package/dist/workbench/studio/marks/marks-message.d.ts +13 -0
- package/dist/workbench/studio/marks/marks-message.js +93 -0
- package/dist/workbench/studio/marks/marks.d.ts +105 -0
- package/dist/workbench/studio/marks/marks.js +133 -0
- package/dist/workbench/studio/marks/useMarking.d.ts +36 -0
- package/dist/workbench/studio/marks/useMarking.js +111 -0
- package/dist/workbench/studio/marks/useSendMarks.d.ts +18 -0
- package/dist/workbench/studio/marks/useSendMarks.js +80 -0
- package/dist/workbench/studio/work/StudioLater.js +0 -1
- package/dist/workbench/studio/work/work-test-data.d.ts +5 -0
- package/package.json +6 -6
- package/dist/workbench/studio/loop/FsPlan.d.ts +0 -7
- package/dist/workbench/studio/loop/FsPlan.js +0 -64
- package/dist/workbench/studio/loop/FsStage.d.ts +0 -6
- package/dist/workbench/studio/loop/FsStage.js +0 -74
- package/dist/workbench/studio/loop/FsToolbar.d.ts +0 -6
- package/dist/workbench/studio/loop/FsToolbar.js +0 -61
- package/dist/workbench/studio/loop/FullScreen.d.ts +0 -5
- package/dist/workbench/studio/loop/FullScreen.js +0 -89
- package/dist/workbench/studio/loop/PrototypePreviewMenus.d.ts +0 -18
- package/dist/workbench/studio/loop/PrototypePreviewMenus.js +0 -75
- package/dist/workbench/studio/loop/PrototypePreviewToolbar.d.ts +0 -27
- package/dist/workbench/studio/loop/PrototypePreviewToolbar.js +0 -52
- package/dist/workbench/studio/loop/fsViews.d.ts +0 -12
- package/dist/workbench/studio/loop/fsViews.js +0 -6
|
@@ -5,14 +5,20 @@ type Block = {
|
|
|
5
5
|
} | {
|
|
6
6
|
kind: 'list';
|
|
7
7
|
items: string[];
|
|
8
|
+
start?: number;
|
|
8
9
|
} | {
|
|
9
10
|
kind: 'paragraph';
|
|
10
11
|
text: string;
|
|
11
12
|
};
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The file's blocks: `#` headings, `-`/`*`/`+` and `1.` list items (an indented line continues an item),
|
|
15
|
+
* `>` quotes as plain paragraphs, and paragraphs between blank lines.
|
|
16
|
+
*/
|
|
13
17
|
export declare function markdownBlocks(source: string): Block[];
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
type Size = 'base' | 'read';
|
|
19
|
+
/** Markdown as read-only text, in the console's type, or set for reading. */
|
|
20
|
+
export declare function Markdown({ source, size }: {
|
|
16
21
|
source: string;
|
|
22
|
+
size?: Size;
|
|
17
23
|
}): import("react").JSX.Element;
|
|
18
24
|
export {};
|
|
@@ -1,71 +1,121 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Markdown: a product's own Markdown (a playbook), read-only. Headings, paragraphs, lists
|
|
3
|
-
//
|
|
2
|
+
// Markdown: a product's own Markdown (a playbook, a brief), read-only. Headings, paragraphs, lists
|
|
3
|
+
// (numbered where the file numbers them), bold and code: the little such a file uses. Text only,
|
|
4
|
+
// never HTML, and a link keeps only its words, so nothing in the file can run or lead away.
|
|
4
5
|
import { Fragment } from 'react';
|
|
5
6
|
import { bodyText } from './styles.js';
|
|
6
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The file's blocks: `#` headings, `-`/`*`/`+` and `1.` list items (an indented line continues an item),
|
|
9
|
+
* `>` quotes as plain paragraphs, and paragraphs between blank lines.
|
|
10
|
+
*/
|
|
7
11
|
export function markdownBlocks(source) {
|
|
8
12
|
const blocks = [];
|
|
9
13
|
let paragraph = [];
|
|
14
|
+
let list;
|
|
10
15
|
const flush = () => {
|
|
11
16
|
if (paragraph.length)
|
|
12
17
|
blocks.push({ kind: 'paragraph', text: paragraph.join(' ') });
|
|
13
18
|
paragraph = [];
|
|
14
19
|
};
|
|
15
20
|
for (const raw of source.split(/\r?\n/)) {
|
|
16
|
-
const line = raw.trim();
|
|
21
|
+
const line = raw.trim().replace(/^>\s?/, '');
|
|
17
22
|
const heading = /^(#{1,6})\s+(.*)$/.exec(line);
|
|
18
|
-
const item = /^[
|
|
23
|
+
const item = /^(?:[-*+]|(\d+)[.)])\s+(.*)$/.exec(line);
|
|
19
24
|
if (!line)
|
|
20
25
|
flush();
|
|
21
26
|
else if (heading?.[1] && heading[2] !== undefined) {
|
|
22
27
|
flush();
|
|
28
|
+
list = undefined;
|
|
23
29
|
blocks.push({ kind: 'heading', level: heading[1].length, text: heading[2] });
|
|
24
30
|
}
|
|
25
|
-
else if (item?.[
|
|
31
|
+
else if (item?.[2] !== undefined) {
|
|
26
32
|
flush();
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const start = item[1] === undefined ? undefined : Number(item[1]);
|
|
34
|
+
if (!list || (list.start === undefined) !== (start === undefined)) {
|
|
35
|
+
list = { kind: 'list', items: [], ...(start === undefined ? {} : { start }) };
|
|
36
|
+
blocks.push(list);
|
|
37
|
+
}
|
|
38
|
+
list.items.push(item[2]);
|
|
39
|
+
}
|
|
40
|
+
else if (list && /^\s/.test(raw)) {
|
|
41
|
+
list.items[list.items.length - 1] += ` ${line}`;
|
|
32
42
|
}
|
|
33
|
-
else
|
|
43
|
+
else {
|
|
44
|
+
list = undefined;
|
|
34
45
|
paragraph.push(line);
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
flush();
|
|
37
49
|
return blocks;
|
|
38
50
|
}
|
|
39
|
-
/** `**bold**` within a line. */
|
|
51
|
+
/** `**bold**` and `code` within a line; a link shows its words only. */
|
|
40
52
|
function inline(text) {
|
|
41
|
-
|
|
53
|
+
const words = text.replace(/!?\[([^\]]*)\]\((?:[^()]|\([^()]*\))*\)/g, '$1');
|
|
54
|
+
return words.split(/(\*\*[^*]+\*\*|`[^`]+`)/).map((part, i) => {
|
|
55
|
+
const key = `${i}`;
|
|
56
|
+
if (part.startsWith('**') && part.endsWith('**') && part.length > 4)
|
|
57
|
+
return _jsx("strong", { children: part.slice(2, -2) }, key);
|
|
58
|
+
if (part.startsWith('`') && part.endsWith('`') && part.length > 2)
|
|
59
|
+
return (_jsx("code", { translate: "no", style: { fontFamily: 'var(--font-mono)' }, children: part.slice(1, -1) }, key));
|
|
60
|
+
return _jsx(Fragment, { children: part }, key);
|
|
61
|
+
});
|
|
42
62
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
/** Read: the reading size, with room between lines and about 68 characters a line. */
|
|
64
|
+
const prose = (size) => size === 'read'
|
|
65
|
+
? {
|
|
66
|
+
margin: 0,
|
|
67
|
+
fontSize: 'var(--font-size-body-lg)',
|
|
68
|
+
lineHeight: 'var(--line-height-body-lg)',
|
|
69
|
+
color: 'var(--text-body)',
|
|
70
|
+
overflowWrap: 'break-word',
|
|
71
|
+
}
|
|
72
|
+
: { ...bodyText, margin: 0, overflowWrap: 'anywhere' };
|
|
73
|
+
const heading = (level, size) => {
|
|
74
|
+
const big = size === 'read' ? level <= 2 : level <= 1;
|
|
75
|
+
return {
|
|
76
|
+
margin: 0,
|
|
77
|
+
...(size === 'read' ? { marginBlockStart: 'var(--space-3)' } : {}),
|
|
78
|
+
overflowWrap: 'anywhere',
|
|
79
|
+
fontFamily: 'var(--font-display)',
|
|
80
|
+
fontWeight: 'var(--weight-heading)',
|
|
81
|
+
color: 'var(--text-strong)',
|
|
82
|
+
fontSize: big
|
|
83
|
+
? 'var(--font-size-title)'
|
|
84
|
+
: size === 'read'
|
|
85
|
+
? 'var(--font-size-body-lg)'
|
|
86
|
+
: 'var(--font-size-body)',
|
|
87
|
+
lineHeight: big
|
|
88
|
+
? 'var(--line-height-title)'
|
|
89
|
+
: size === 'read'
|
|
90
|
+
? 'var(--line-height-body-lg)'
|
|
91
|
+
: 'var(--line-height-body)',
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
/** Markdown as read-only text, in the console's type, or set for reading. */
|
|
95
|
+
export function Markdown({ source, size = 'base' }) {
|
|
96
|
+
const read = size === 'read';
|
|
97
|
+
return (_jsx("div", { style: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
flexDirection: 'column',
|
|
100
|
+
gap: read ? 'var(--space-4)' : 'var(--space-3)',
|
|
101
|
+
minWidth: 0,
|
|
102
|
+
...(read ? { maxInlineSize: '68ch' } : {}),
|
|
103
|
+
}, children: markdownBlocks(source).map((b, i) => {
|
|
54
104
|
const key = `${i}`;
|
|
55
105
|
if (b.kind === 'heading') {
|
|
56
|
-
const H = b.level <= 1 ? 'h2' : 'h3';
|
|
57
|
-
return (_jsx(H, { style: heading(b.level), children: inline(b.text) }, key));
|
|
106
|
+
const H = (read ? (b.level <= 2 ? 'h3' : 'h4') : b.level <= 1 ? 'h2' : 'h3');
|
|
107
|
+
return (_jsx(H, { style: heading(b.level, size), children: inline(b.text) }, key));
|
|
58
108
|
}
|
|
59
109
|
if (b.kind === 'list') {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
paddingInlineStart: 'var(--space-5)',
|
|
110
|
+
const List = b.start === undefined ? 'ul' : 'ol';
|
|
111
|
+
return (_jsx(List, { start: b.start, style: {
|
|
112
|
+
...prose(size),
|
|
113
|
+
paddingInlineStart: read ? 'var(--space-6)' : 'var(--space-5)',
|
|
64
114
|
display: 'flex',
|
|
65
115
|
flexDirection: 'column',
|
|
66
|
-
gap: 'var(--space-1)',
|
|
67
|
-
}, children: b.items.map((x) => (_jsx("li", { children: inline(x) },
|
|
116
|
+
gap: read ? 'var(--space-2)' : 'var(--space-1)',
|
|
117
|
+
}, children: b.items.map((x, n) => (_jsx("li", { children: inline(x) }, n))) }, key));
|
|
68
118
|
}
|
|
69
|
-
return (_jsx("p", { style:
|
|
119
|
+
return (_jsx("p", { style: prose(size), children: inline(b.text) }, key));
|
|
70
120
|
}) }));
|
|
71
121
|
}
|
|
@@ -7,6 +7,10 @@ export interface SheetProps {
|
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
footer?: ReactNode;
|
|
9
9
|
manageFocus?: boolean;
|
|
10
|
+
/** A line under the title (where the text comes from). */
|
|
11
|
+
sub?: ReactNode;
|
|
12
|
+
/** Read: text to read, at about 68 characters a line and the reading size, on any screen. */
|
|
13
|
+
size?: 'form' | 'read';
|
|
10
14
|
}
|
|
11
15
|
/** The one overlay for a form or details: a centered dialog. */
|
|
12
|
-
export declare function Sheet({ id, title, onClose, closeLabel, children, footer, manageFocus, }: SheetProps): import("react").JSX.Element;
|
|
16
|
+
export declare function Sheet({ id, title, onClose, closeLabel, children, footer, manageFocus, sub, size, }: SheetProps): import("react").JSX.Element;
|
package/dist/components/Sheet.js
CHANGED
|
@@ -8,6 +8,12 @@ const card = {
|
|
|
8
8
|
...overlayCard,
|
|
9
9
|
maxHeight: 'calc(100dvh - var(--space-6) * 2)',
|
|
10
10
|
};
|
|
11
|
+
const reading = {
|
|
12
|
+
...card,
|
|
13
|
+
// The measure plus the card's own padding: the text sets the width, not the page.
|
|
14
|
+
width: 'calc(68ch + 2 * var(--space-6))',
|
|
15
|
+
fontSize: 'var(--font-size-body-lg)',
|
|
16
|
+
};
|
|
11
17
|
const header = {
|
|
12
18
|
display: 'flex',
|
|
13
19
|
alignItems: 'center',
|
|
@@ -70,8 +76,8 @@ function SheetBody({ children, hasFooter }) {
|
|
|
70
76
|
return (_jsx("div", { ref: region, tabIndex: overflow ? 0 : -1, style: { ...body, boxShadow }, children: _jsx("div", { ref: contents, style: content, children: children }) }));
|
|
71
77
|
}
|
|
72
78
|
/** The one overlay for a form or details: a centered dialog. */
|
|
73
|
-
export function Sheet({ id, title, onClose, closeLabel, children, footer, manageFocus, }) {
|
|
79
|
+
export function Sheet({ id, title, onClose, closeLabel, children, footer, manageFocus, sub, size = 'form', }) {
|
|
74
80
|
const t = useT();
|
|
75
81
|
const { ref, onKeyDown } = useDialog(onClose, true, manageFocus);
|
|
76
|
-
return (_jsx("div", { style: scrim, onPointerDown: (e) => e.target === e.currentTarget && onClose(), children: _jsxs("div", { ref: ref, id: id, role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, onKeyDown: onKeyDown, style: card, children: [_jsxs("div", { style: header, children: [_jsx("h2", { style: dialogTitle, children: title }), _jsx(IconButton, { icon: "x", label: closeLabel ?? t('admin.common.close'), onClick: onClose })] }), _jsx(SheetBody, { hasFooter: Boolean(footer), children: children }), footer && _jsx("div", { style: actions, children: footer })] }) }));
|
|
82
|
+
return (_jsx("div", { style: scrim, onPointerDown: (e) => e.target === e.currentTarget && onClose(), children: _jsxs("div", { ref: ref, id: id, role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, onKeyDown: onKeyDown, style: size === 'read' ? reading : card, children: [_jsxs("div", { style: sub ? { ...header, alignItems: 'flex-start' } : header, children: [sub ? (_jsxs("div", { style: { flex: 1, minWidth: 0, display: 'grid', gap: 'var(--space-1)' }, children: [_jsx("h2", { style: dialogTitle, children: title }), sub] })) : (_jsx("h2", { style: dialogTitle, children: title })), _jsx(IconButton, { icon: "x", label: closeLabel ?? t('admin.common.close'), onClick: onClose })] }), _jsx(SheetBody, { hasFooter: Boolean(footer), children: children }), footer && _jsx("div", { style: actions, children: footer })] }) }));
|
|
77
83
|
}
|
|
@@ -12,9 +12,11 @@ export interface TextAreaProps extends TextareaExtras {
|
|
|
12
12
|
mono?: boolean;
|
|
13
13
|
/** Grow with the text, up to a third of the containing panel, then scroll. */
|
|
14
14
|
autoGrow?: boolean;
|
|
15
|
+
/** Keep the label for screen readers only (a mark's note, under its own heading). */
|
|
16
|
+
labelHidden?: boolean;
|
|
15
17
|
id?: string;
|
|
16
18
|
style?: CSSProperties;
|
|
17
19
|
}
|
|
18
20
|
/** A labeled box for a few lines of text. Grows by hand unless autoGrow is enabled. */
|
|
19
|
-
export declare function TextArea({ label, help, error, id, style, ...props }: TextAreaProps): import("react").JSX.Element;
|
|
21
|
+
export declare function TextArea({ label, help, error, id, style, labelHidden, ...props }: TextAreaProps): import("react").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// TextArea: a labeled box for a few lines of text (a note). Same look as TextField.
|
|
3
3
|
import { useId, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
-
import { controlStyle, FieldHelp, fieldLabel } from './field.js';
|
|
4
|
+
import { controlStyle, FieldHelp, fieldLabel, visuallyHidden } from './field.js';
|
|
5
5
|
function useGrowingArea(value, enabled) {
|
|
6
6
|
const ref = useRef(null);
|
|
7
7
|
useLayoutEffect(() => {
|
|
@@ -41,7 +41,7 @@ function AreaInput({ value = '', onChange, placeholder, help, error, disabled =
|
|
|
41
41
|
} }));
|
|
42
42
|
}
|
|
43
43
|
/** A labeled box for a few lines of text. Grows by hand unless autoGrow is enabled. */
|
|
44
|
-
export function TextArea({ label, help, error, id, style, ...props }) {
|
|
44
|
+
export function TextArea({ label, help, error, id, style, labelHidden = false, ...props }) {
|
|
45
45
|
const autoId = useId();
|
|
46
46
|
const fid = id ?? autoId;
|
|
47
47
|
return (_jsxs("div", { style: {
|
|
@@ -50,5 +50,5 @@ export function TextArea({ label, help, error, id, style, ...props }) {
|
|
|
50
50
|
gap: 'var(--space-2)',
|
|
51
51
|
minWidth: 0,
|
|
52
52
|
...style,
|
|
53
|
-
}, children: [_jsx("label", { htmlFor: fid, style: fieldLabel, children: label }), _jsx(AreaInput, { ...props, id: fid, help: help, error: error }), _jsx(FieldHelp, { id: `${fid}-h`, help: help, error: error })] }));
|
|
53
|
+
}, children: [_jsx("label", { htmlFor: fid, style: labelHidden ? visuallyHidden : fieldLabel, children: label }), _jsx(AreaInput, { ...props, id: fid, help: help, error: error }), _jsx(FieldHelp, { id: `${fid}-h`, help: help, error: error })] }));
|
|
54
54
|
}
|
|
@@ -50,6 +50,7 @@ export declare const ICON_PATHS: {
|
|
|
50
50
|
readonly 'sliders-horizontal': '<line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/>';
|
|
51
51
|
readonly sparkles: '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/>';
|
|
52
52
|
readonly sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>';
|
|
53
|
+
readonly tablet: '<rect width="16" height="20" x="4" y="2" rx="2" ry="2"/><line x1="12" x2="12.01" y1="18" y2="18"/>';
|
|
53
54
|
readonly tag: '<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>';
|
|
54
55
|
readonly 'trash-2': '<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>';
|
|
55
56
|
readonly 'triangle-alert': '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>';
|
package/dist/components/icons.js
CHANGED
|
@@ -52,6 +52,7 @@ export const ICON_PATHS = {
|
|
|
52
52
|
'sliders-horizontal': '<line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/>',
|
|
53
53
|
sparkles: '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/>',
|
|
54
54
|
sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
|
|
55
|
+
tablet: '<rect width="16" height="20" x="4" y="2" rx="2" ry="2"/><line x1="12" x2="12.01" y1="18" y2="18"/>',
|
|
55
56
|
tag: '<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>',
|
|
56
57
|
'trash-2': '<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',
|
|
57
58
|
'triangle-alert': '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
|
|
@@ -5,7 +5,8 @@ export declare function SceneSignal({ sceneKey, status }: {
|
|
|
5
5
|
status: Status;
|
|
6
6
|
}): null;
|
|
7
7
|
/** This sibling commits only when the view's Suspense/error boundary commits its content. */
|
|
8
|
-
export declare function ReadySignal({ sceneKey }: {
|
|
8
|
+
export declare function ReadySignal({ sceneKey, search }: {
|
|
9
9
|
sceneKey: string;
|
|
10
|
+
search: string;
|
|
10
11
|
}): import("react").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SCENE_LOOK_ATTR, SCENE_LOOK_REUSABLE } from '@buffcore/contracts/prototype';
|
|
2
3
|
import { useEffect, useLayoutEffect, useReducer, useRef } from 'react';
|
|
3
4
|
import { SCENE_STATUS } from './scene-status.js';
|
|
4
5
|
const report = (sceneKey, status) => window.parent.postMessage({ type: SCENE_STATUS, key: sceneKey, status }, '*');
|
|
@@ -42,6 +43,16 @@ export function SceneSignal({ sceneKey, status }) {
|
|
|
42
43
|
return null;
|
|
43
44
|
}
|
|
44
45
|
/** This sibling commits only when the view's Suspense/error boundary commits its content. */
|
|
45
|
-
export function ReadySignal({ sceneKey }) {
|
|
46
|
+
export function ReadySignal({ sceneKey, search }) {
|
|
47
|
+
useLayoutEffect(() => {
|
|
48
|
+
const html = document.documentElement;
|
|
49
|
+
html.setAttribute(SCENE_LOOK_ATTR, search);
|
|
50
|
+
// Any view can move in place: the snapshot checks each scene against a fresh load.
|
|
51
|
+
html.setAttribute(SCENE_LOOK_REUSABLE, '');
|
|
52
|
+
return () => {
|
|
53
|
+
html.removeAttribute(SCENE_LOOK_ATTR);
|
|
54
|
+
html.removeAttribute(SCENE_LOOK_REUSABLE);
|
|
55
|
+
};
|
|
56
|
+
}, [search]);
|
|
46
57
|
return _jsx(SceneSignal, { sceneKey: sceneKey, status: "ready" });
|
|
47
58
|
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const SCENE_STATUS = "buffcore:prototype-scene";
|
|
1
|
+
export { SCENE_STATUS } from '@buffcore/contracts/prototype';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const SCENE_STATUS = 'buffcore:prototype-scene';
|
|
1
|
+
export { SCENE_STATUS } from '@buffcore/contracts/prototype';
|
|
@@ -13,4 +13,4 @@ export interface AdminSceneProps {
|
|
|
13
13
|
/** The page's query: `?key&theme&mode&locale`. */
|
|
14
14
|
search: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function AdminScene(
|
|
16
|
+
export declare function AdminScene(props: AdminSceneProps): import("react").JSX.Element;
|
package/dist/prototype/scene.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
1
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
// One admin scene at /_scene?key&theme&mode&locale: only its view, with its sample props, in the
|
|
3
4
|
// asked theme, mode and language. No sign-in and no API calls: the view gets everything as props.
|
|
5
|
+
import { SCENE_LOOK_CHANGE } from '@buffcore/contracts/prototype';
|
|
4
6
|
import { createI18n } from '@buffcore/i18n';
|
|
5
7
|
import { I18nProvider, useT } from '@buffcore/i18n/react';
|
|
6
|
-
import { useMemo } from 'react';
|
|
8
|
+
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
7
9
|
import { EmptyState } from '../components/states.js';
|
|
8
10
|
import { PageLook } from './PageLook.js';
|
|
9
11
|
import { SceneBoundary } from './SceneBoundary.js';
|
|
@@ -12,7 +14,22 @@ function Missing({ sceneKey }) {
|
|
|
12
14
|
const t = useT();
|
|
13
15
|
return _jsx(EmptyState, { icon: "circle-help", title: t('admin.prototype.missing', { key: sceneKey }) });
|
|
14
16
|
}
|
|
15
|
-
export function AdminScene(
|
|
17
|
+
export function AdminScene(props) {
|
|
18
|
+
const [moved, setMoved] = useState();
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
const read = () => {
|
|
21
|
+
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
22
|
+
setMoved(window.location.search);
|
|
23
|
+
};
|
|
24
|
+
window.addEventListener(SCENE_LOOK_CHANGE, read);
|
|
25
|
+
return () => window.removeEventListener(SCENE_LOOK_CHANGE, read);
|
|
26
|
+
}, []);
|
|
27
|
+
// Only a move in place draws the look afresh, as a full load would. The router's own changes keep
|
|
28
|
+
// the page mounted and remount the view when the scene changes: remounting the whole look there
|
|
29
|
+
// made every scene the studio or a check steps through about 80 ms slower.
|
|
30
|
+
return _createElement(SceneLook, { ...props, key: moved, search: moved ?? props.search });
|
|
31
|
+
}
|
|
32
|
+
function SceneLook({ scenes, views, theme, themes, catalogs, search }) {
|
|
16
33
|
const params = new URLSearchParams(search);
|
|
17
34
|
const key = params.get('key') ?? '';
|
|
18
35
|
const locale = params.get('locale') ?? 'en';
|
|
@@ -20,5 +37,5 @@ export function AdminScene({ scenes, views, theme, themes, catalogs, search }) {
|
|
|
20
37
|
const look = themes.find((th) => th.key === params.get('theme')) ?? theme;
|
|
21
38
|
const scene = scenes.find((s) => s.surface === 'admin' && s.key === key);
|
|
22
39
|
const View = scene && views[scene.view];
|
|
23
|
-
return (_jsx(I18nProvider, { translator: translator, children: _jsx(PageLook, { theme: look, mode: params.get('mode') ?? undefined, locale: locale, children: _jsx("div", { style: { height: '100dvh' }, children: scene && View ? (_jsxs(SceneBoundary, { sceneKey: key, children: [_jsx(View, { ...scene.props }), _jsx(ReadySignal, { sceneKey: key })] }, key)) : (_jsxs(_Fragment, { children: [_jsx(Missing, { sceneKey: key }), _jsx(SceneSignal, { sceneKey: key, status: "missing" })] })) }) }) }));
|
|
40
|
+
return (_jsx(I18nProvider, { translator: translator, children: _jsx(PageLook, { theme: look, mode: params.get('mode') ?? undefined, locale: locale, children: _jsx("div", { style: { height: '100dvh' }, children: scene && View ? (_jsxs(SceneBoundary, { sceneKey: key, children: [_jsx(View, { ...scene.props }), _jsx(ReadySignal, { sceneKey: key, search: search })] }, key)) : (_jsxs(_Fragment, { children: [_jsx(Missing, { sceneKey: key }), _jsx(SceneSignal, { sceneKey: key, status: "missing" })] })) }) }) }));
|
|
24
41
|
}
|
|
@@ -5,6 +5,7 @@ import { PrototypePage } from '../studio/loop/PrototypePage.js';
|
|
|
5
5
|
import { useDesignApproval } from '../studio/loop/useDesignApproval.js';
|
|
6
6
|
import { viewerCanBuild } from '../studio/loop/usePlanningSave.js';
|
|
7
7
|
import { usePrototypeRecord } from '../studio/loop/usePrototypeRecord.js';
|
|
8
|
+
import { useWorkspaceMarks } from '../studio/marks/WorkspaceMarks.js';
|
|
8
9
|
import { catchUpChange } from './catch-up.js';
|
|
9
10
|
import { useFresh } from './fresh.js';
|
|
10
11
|
import { commentMessage, openPrototype, protoSample, protoView } from './prototype.js';
|
|
@@ -26,6 +27,9 @@ function usePrototypePage(props) {
|
|
|
26
27
|
// A missed probe can omit appUrl, including when a host set a different preview address.
|
|
27
28
|
const previewUrl = appUrl ?? (sameAddress && running !== true ? address.url : undefined) ?? stack.app;
|
|
28
29
|
const comp = useServedComp(props.actions.comp, model.view.needsRight);
|
|
30
|
+
const { change, view, locale } = model;
|
|
31
|
+
const marking = { change, version: view.version, locale, shoot: props.actions.markShot };
|
|
32
|
+
const workspace = useWorkspaceMarks(props.actions.prototypeHome ? marking : undefined);
|
|
29
33
|
// One object per request, so the preview tries it once, not on every render.
|
|
30
34
|
const name = props.journey ? model.planned(props.journey) : undefined;
|
|
31
35
|
const play = useMemo(() => (props.journey ? { id: props.journey, name } : undefined), [props.journey, name]);
|
|
@@ -47,6 +51,7 @@ function usePrototypePage(props) {
|
|
|
47
51
|
onDev: () => props.actions.go?.('dev'),
|
|
48
52
|
}
|
|
49
53
|
: undefined,
|
|
54
|
+
workspace,
|
|
50
55
|
sample: model.sample,
|
|
51
56
|
level: level ?? null,
|
|
52
57
|
view: feedbackView(model.view, model.recording, model.signing, model.t),
|