@buffcore/admin-shell 0.8.43 → 0.8.45
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/workbench/app/ServedPrototype.d.ts +2 -0
- package/dist/workbench/app/ServedPrototype.js +11 -1
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
- 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 +5 -5
- package/dist/workbench/app/chat-session.js +8 -3
- package/dist/workbench/app/chat.d.ts +17 -4
- package/dist/workbench/app/chat.js +9 -4
- package/dist/workbench/app/frame.js +5 -1
- package/dist/workbench/app/loop.js +2 -18
- package/dist/workbench/app/pages.js +10 -2
- package/dist/workbench/app/prototype.js +3 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +13 -1
- package/dist/workbench/app/useStudio.d.ts +2 -1
- package/dist/workbench/studio/frame/AgentPanel.js +24 -1
- package/dist/workbench/studio/frame/Composer.js +13 -10
- 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/SettingsSheet.js +10 -9
- package/dist/workbench/studio/frame/StudioFrame.js +7 -6
- 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 -0
- package/dist/workbench/studio/frame/scrollbars.js +12 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +22 -2
- package/dist/workbench/studio/frame/useTurnDraft.js +48 -16
- package/dist/workbench/studio/i18n/frame.en.d.ts +3 -0
- package/dist/workbench/studio/i18n/frame.en.js +4 -1
- package/dist/workbench/studio/i18n/frame.es.json +4 -1
- 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 +12 -1
- package/dist/workbench/studio/loop/PrototypeApp.js +30 -13
- package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
- package/dist/workbench/studio/loop/PrototypeAttempt.js +94 -29
- 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 +127 -76
- 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-bridge.d.ts +8 -0
- package/dist/workbench/studio/loop/prototype-bridge.js +16 -0
- package/dist/workbench/studio/loop/prototype-document.d.ts +9 -0
- package/dist/workbench/studio/loop/prototype-document.js +90 -2
- 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 +6 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.js +4 -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/types.d.ts +2 -0
- package/dist/workbench/studio/work/StudioLater.js +0 -1
- package/dist/workbench/studio/work/work-test-data.d.ts +6 -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"/>',
|
|
@@ -10,6 +10,8 @@ interface ServedPrototypeProps {
|
|
|
10
10
|
onComment?: (text: string) => void;
|
|
11
11
|
onStep?: (body: NewChat, text: string) => void;
|
|
12
12
|
journey?: string;
|
|
13
|
+
/** The journey Play asked for was played here, so the page forgets the request. */
|
|
14
|
+
onPlayed?: () => void;
|
|
13
15
|
prototypeTurn?: Pick<Chat, 'work' | 'state' | 'change'>;
|
|
14
16
|
}
|
|
15
17
|
export declare function ServedPrototype(props: ServedPrototypeProps): import("react").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
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,12 @@ 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);
|
|
33
|
+
// One object per request, so the preview tries it once, not on every render.
|
|
34
|
+
const name = props.journey ? model.planned(props.journey) : undefined;
|
|
35
|
+
const play = useMemo(() => (props.journey ? { id: props.journey, name } : undefined), [props.journey, name]);
|
|
29
36
|
return {
|
|
30
37
|
page: {
|
|
31
38
|
comp,
|
|
@@ -40,9 +47,11 @@ function usePrototypePage(props) {
|
|
|
40
47
|
source: model.home,
|
|
41
48
|
previewIdentity: JSON.stringify([stack.app, model.change]),
|
|
42
49
|
product: props.state.product.name,
|
|
50
|
+
...(play ? { play, onPlayed: props.onPlayed } : {}),
|
|
43
51
|
onDev: () => props.actions.go?.('dev'),
|
|
44
52
|
}
|
|
45
53
|
: undefined,
|
|
54
|
+
workspace,
|
|
46
55
|
sample: model.sample,
|
|
47
56
|
level: level ?? null,
|
|
48
57
|
view: feedbackView(model.view, model.recording, model.signing, model.t),
|
|
@@ -139,6 +148,7 @@ function usePrototypeModel(props) {
|
|
|
139
148
|
home,
|
|
140
149
|
snapshot: { ...snapshot, own, start: takeSnapshot },
|
|
141
150
|
critique,
|
|
151
|
+
planned: (id) => journeys.find((entry) => entry.id === id)?.name,
|
|
142
152
|
};
|
|
143
153
|
}
|
|
144
154
|
function prototypeHandlers(model) {
|