@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { marks } from './marks.js';
|
|
4
|
+
import { markedScreens, marksMessage } from './marks-message.js';
|
|
5
|
+
/** A chat message carries at most this many pictures (the send route's limit). */
|
|
6
|
+
export const PICTURES = 8;
|
|
7
|
+
/** One marked screen's picture request: where it is, its size, and its marks with their numbers. */
|
|
8
|
+
export function shotBody(screen, all, page) {
|
|
9
|
+
const first = screen[0];
|
|
10
|
+
const { journey, step, data } = first.place;
|
|
11
|
+
return {
|
|
12
|
+
...(journey ? { journey, step: step ?? 0 } : {}),
|
|
13
|
+
...(!journey && data ? { data: data } : {}),
|
|
14
|
+
locale: page.locale,
|
|
15
|
+
mode: page.mode,
|
|
16
|
+
...(first.scroll ? { scroll: first.scroll } : {}),
|
|
17
|
+
view: first.view,
|
|
18
|
+
marks: screen.map((mark) => ({
|
|
19
|
+
n: all.indexOf(mark) + 1,
|
|
20
|
+
kind: mark.kind,
|
|
21
|
+
...(mark.box ? { box: mark.box } : {}),
|
|
22
|
+
...(mark.points ? { points: mark.points.map(([x, y]) => [x, y]) } : {}),
|
|
23
|
+
})),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** A picture of each marked screen; `missing` counts the screens that could not be shot. */
|
|
27
|
+
async function pictures(sheet, page) {
|
|
28
|
+
const screens = markedScreens(sheet.marks).slice(0, PICTURES);
|
|
29
|
+
if (!page.shoot)
|
|
30
|
+
return { attachments: [], missing: 0 };
|
|
31
|
+
const shot = await Promise.all(
|
|
32
|
+
// Only the customer app is shot: the console is not pictured (its marks are not made yet).
|
|
33
|
+
screens.map((screen) => screen[0]?.place.app === 'console'
|
|
34
|
+
? undefined
|
|
35
|
+
: page.shoot?.(shotBody(screen, sheet.marks, page)).catch(() => undefined)));
|
|
36
|
+
const attachments = shot.filter((picture) => !!picture);
|
|
37
|
+
return { attachments, missing: screens.length - attachments.length };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Send every mark as one message; `shooting` while the pictures are taken. A picture that could
|
|
41
|
+
* not be taken stops the send and says so (`missing`): the marks stay, Send tries again, and
|
|
42
|
+
* `send(true)` sends without the pictures. Only the marks that went leave the sheet.
|
|
43
|
+
*/
|
|
44
|
+
export function useSendMarks(page, sheet, composer) {
|
|
45
|
+
const t = useT();
|
|
46
|
+
const { locale } = useLocale();
|
|
47
|
+
const [shooting, setShooting] = useState(false);
|
|
48
|
+
const [missing, setMissing] = useState(0);
|
|
49
|
+
const send = async (withoutPictures = false) => {
|
|
50
|
+
if (shooting || !sheet.marks.length || !composer?.onMarks)
|
|
51
|
+
return;
|
|
52
|
+
setMissing(0);
|
|
53
|
+
setShooting(true);
|
|
54
|
+
// The marks on screen now go, once the app said how far each was scrolled (or gave up); what
|
|
55
|
+
// is marked meanwhile stays.
|
|
56
|
+
await marks.answered(sheet.marks);
|
|
57
|
+
const ids = new Set(sheet.marks.map((mark) => mark.id));
|
|
58
|
+
const latest = marks.sheet(page.key);
|
|
59
|
+
const going = { ...latest, marks: latest.marks.filter((mark) => ids.has(mark.id)) };
|
|
60
|
+
if (!going.marks.length)
|
|
61
|
+
return setShooting(false);
|
|
62
|
+
let attachments = [];
|
|
63
|
+
if (withoutPictures)
|
|
64
|
+
setShooting(false);
|
|
65
|
+
else {
|
|
66
|
+
const shot = await pictures(going, page).finally(() => setShooting(false));
|
|
67
|
+
if (shot.missing)
|
|
68
|
+
return setMissing(shot.missing);
|
|
69
|
+
attachments = shot.attachments;
|
|
70
|
+
}
|
|
71
|
+
const about = { change: page.change, version: page.version, pictures: attachments.length };
|
|
72
|
+
composer.onMarks({
|
|
73
|
+
text: marksMessage(going, about, t, locale),
|
|
74
|
+
attachments,
|
|
75
|
+
card: { ...about, marks: going.marks },
|
|
76
|
+
sent: () => marks.sent(page.key, going),
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return { send, shooting, missing, ready: !!composer?.onMarks };
|
|
80
|
+
}
|
|
@@ -160,6 +160,11 @@ export declare function scaleFacts(): {
|
|
|
160
160
|
brief: {
|
|
161
161
|
sections: Record<string, string>;
|
|
162
162
|
kind?: "b2b" | "b2c" | undefined;
|
|
163
|
+
parts?: {
|
|
164
|
+
heading: string;
|
|
165
|
+
summary: string[];
|
|
166
|
+
text: string;
|
|
167
|
+
}[] | undefined;
|
|
163
168
|
} | null;
|
|
164
169
|
milestones: {
|
|
165
170
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buffcore/admin-shell",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.46",
|
|
4
4
|
"description": "The React DOM admin console for a BuffCore product, with its prototype viewer.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "BuffApe",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@tanstack/react-router": "1.170.42",
|
|
38
38
|
"firebase": "12.19.0",
|
|
39
39
|
"qrcode": "1.5.4",
|
|
40
|
-
"@buffcore/config": "0.8.
|
|
41
|
-
"@buffcore/
|
|
42
|
-
"@buffcore/
|
|
43
|
-
"@buffcore/
|
|
44
|
-
"@buffcore/contracts": "0.8.
|
|
40
|
+
"@buffcore/config": "0.8.46",
|
|
41
|
+
"@buffcore/tokens": "0.8.46",
|
|
42
|
+
"@buffcore/sdk": "0.8.46",
|
|
43
|
+
"@buffcore/i18n": "0.8.46",
|
|
44
|
+
"@buffcore/contracts": "0.8.46"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=19",
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Plan a change, from inside the full-screen prototype: the person marks what should change, says
|
|
3
|
-
// it in their words, and the agent turns exactly that into a change: its steps, what it touches and
|
|
4
|
-
// the approvals that stay theirs. Nothing is built until they say so.
|
|
5
|
-
import { useT } from '@buffcore/i18n/react';
|
|
6
|
-
import { Button } from '../../../components/Button.js';
|
|
7
|
-
import { Chip } from '../../../components/Chip.js';
|
|
8
|
-
import { Icon } from '../../../components/Icon.js';
|
|
9
|
-
import { IconButton } from '../../../components/IconButton.js';
|
|
10
|
-
import { Panel } from '../../../components/Panel.js';
|
|
11
|
-
import { bodyText, captionText, monoText } from '../../../components/styles.js';
|
|
12
|
-
import { Tabs } from '../../../components/Tabs.js';
|
|
13
|
-
import { TextArea } from '../../../components/TextArea.js';
|
|
14
|
-
import { row, Seal } from './parts.js';
|
|
15
|
-
const KIND_ICON = {
|
|
16
|
-
select: 'mouse-pointer',
|
|
17
|
-
draw: 'pencil',
|
|
18
|
-
area: 'layers',
|
|
19
|
-
};
|
|
20
|
-
function Mark({ m }) {
|
|
21
|
-
const t = useT();
|
|
22
|
-
return (_jsxs("li", { style: { display: 'grid', gap: 'var(--space-2)' }, children: [_jsxs("div", { style: row, children: [_jsx("span", { "aria-hidden": "true", style: {
|
|
23
|
-
width: 'var(--space-6)',
|
|
24
|
-
height: 'var(--space-6)',
|
|
25
|
-
borderRadius: 'var(--radius-pill)',
|
|
26
|
-
background: 'var(--info-solid)',
|
|
27
|
-
color: 'var(--info-on-solid)',
|
|
28
|
-
display: 'inline-flex',
|
|
29
|
-
alignItems: 'center',
|
|
30
|
-
justifyContent: 'center',
|
|
31
|
-
fontSize: 'var(--font-size-caption)',
|
|
32
|
-
fontWeight: 'var(--weight-bold)',
|
|
33
|
-
}, children: m.n }), _jsx(Icon, { name: KIND_ICON[m.kind], size: "var(--icon-sm)" }), _jsx("span", { style: { ...bodyText, flex: 1, minWidth: 0 }, children: m.where }), _jsx("span", { style: captionText, children: t(`studio.loop.proto.device.${m.device === 'phone' ? 'mobile' : m.device}`) }), _jsx(IconButton, { icon: "trash-2", size: "sm", label: t('studio.loop.fs.removeMark', { n: m.n }) })] }), _jsx(TextArea, { label: t('studio.loop.fs.markNote', { n: m.n }), value: m.note, rows: 2 })] }));
|
|
34
|
-
}
|
|
35
|
-
/** The agent's draft plan: only what the person marked and said, never a canned one. */
|
|
36
|
-
function PlanCard({ plan, level }) {
|
|
37
|
-
const t = useT();
|
|
38
|
-
return (_jsxs(Panel, { title: _jsxs("span", { style: row, children: [_jsx("span", { translate: "no", style: monoText, children: plan.id }), t('studio.loop.fs.draftPlan')] }), children: [_jsx("h3", { style: { margin: 0, fontSize: 'var(--font-size-body)', color: 'var(--text-strong)' }, children: plan.title }), _jsx("ol", { style: {
|
|
39
|
-
...bodyText,
|
|
40
|
-
margin: 0,
|
|
41
|
-
paddingInlineStart: 'var(--space-5)',
|
|
42
|
-
display: 'grid',
|
|
43
|
-
gap: 'var(--space-1)',
|
|
44
|
-
}, children: plan.steps.map((s) => (_jsx("li", { children: s }, s))) }), _jsxs("div", { style: row, children: [_jsx("span", { style: captionText, children: t('studio.loop.fs.touches') }), plan.touches.map((x) => (_jsx(Chip, { size: "sm", children: _jsx("span", { translate: "no", children: x }) }, x)))] }), _jsx(Seal, { children: t('studio.loop.fs.sealPrototype', { level: level ?? 'unknown' }) }), _jsxs("div", { style: row, children: [_jsx(Button, { size: "sm", children: t('studio.loop.fs.draftNow') }), _jsx(Button, { size: "sm", variant: "secondary", children: t('studio.loop.fs.addToPlan') })] })] }));
|
|
45
|
-
}
|
|
46
|
-
export function PlanPanel({ fs, base, level }) {
|
|
47
|
-
const t = useT();
|
|
48
|
-
const { plan } = fs;
|
|
49
|
-
return (_jsxs("aside", { "aria-label": t('studio.loop.fs.plan'), style: {
|
|
50
|
-
height: '100%',
|
|
51
|
-
overflow: 'auto',
|
|
52
|
-
boxSizing: 'border-box',
|
|
53
|
-
padding: 'var(--space-4)',
|
|
54
|
-
display: 'grid',
|
|
55
|
-
gap: 'var(--space-3)',
|
|
56
|
-
alignContent: 'start',
|
|
57
|
-
background: 'var(--surface-page)',
|
|
58
|
-
borderInlineStart: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
59
|
-
}, children: [_jsx("h2", { style: { margin: 0, fontSize: 'var(--font-size-title)', color: 'var(--text-strong)' }, children: t('studio.loop.fs.plan') }), _jsx("p", { style: { ...bodyText, margin: 0, color: 'var(--text-muted)' }, children: t('studio.loop.fs.startsFrom', { base }) }), _jsx("ol", { style: { listStyle: 'none', margin: 0, padding: 0, display: 'grid', gap: 'var(--space-3)' }, children: fs.marks.map((m) => (_jsx(Mark, { m: m }, m.n))) }), _jsx(Tabs, { label: t('studio.loop.fs.kind'), value: "add", onChange: () => { }, tabs: [
|
|
60
|
-
['change', t('studio.loop.fs.kind.change')],
|
|
61
|
-
['add', t('studio.loop.fs.kind.add')],
|
|
62
|
-
['remove', t('studio.loop.fs.kind.remove')],
|
|
63
|
-
] }), _jsx(TextArea, { label: t('studio.loop.fs.words'), value: fs.text, rows: 3 }), _jsx(Button, { icon: "sparkles", children: t('studio.loop.fs.planIt') }), _jsx(PlanCard, { plan: plan, level: level })] }));
|
|
64
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// The full-screen stage: Play (one device at a size, the real app) or Overview (every screen laid
|
|
3
|
-
// out, in order), with the person's marks drawn over what they mark.
|
|
4
|
-
import { useT } from '@buffcore/i18n/react';
|
|
5
|
-
import { Chip } from '../../../components/Chip.js';
|
|
6
|
-
import { captionText } from '../../../components/styles.js';
|
|
7
|
-
import { AppScene, ConsoleScene } from '../frame/RealApp.js';
|
|
8
|
-
import { Peek, row } from './parts.js';
|
|
9
|
-
/** The marks over a screen: an area is a dashed box, a selection and a drawing are pinned. */
|
|
10
|
-
function Marks({ marks }) {
|
|
11
|
-
return (_jsx(_Fragment, { children: marks.map((m) => (_jsx("span", { "data-mark": m.kind, style: {
|
|
12
|
-
position: 'absolute',
|
|
13
|
-
insetInlineStart: `${m.at.x}%`,
|
|
14
|
-
insetBlockStart: `${m.at.y}%`,
|
|
15
|
-
width: m.at.w ? `${m.at.w}%` : undefined,
|
|
16
|
-
height: m.at.h ? `${m.at.h}%` : undefined,
|
|
17
|
-
border: m.kind === 'area'
|
|
18
|
-
? 'var(--border-width-selected) dashed var(--info-solid)'
|
|
19
|
-
: m.kind === 'draw'
|
|
20
|
-
? 'var(--border-width-selected) solid var(--info-solid)'
|
|
21
|
-
: undefined,
|
|
22
|
-
background: m.kind === 'area'
|
|
23
|
-
? 'color-mix(in srgb, var(--info-solid) 12%, transparent)'
|
|
24
|
-
: undefined,
|
|
25
|
-
borderRadius: m.kind === 'draw' ? 'var(--radius-pill)' : undefined,
|
|
26
|
-
pointerEvents: 'none',
|
|
27
|
-
}, children: _jsx("span", { "aria-hidden": "true", style: {
|
|
28
|
-
position: 'absolute',
|
|
29
|
-
insetBlockStart: 'calc(var(--space-3) * -1)',
|
|
30
|
-
insetInlineStart: 'calc(var(--space-3) * -1)',
|
|
31
|
-
width: 'var(--space-6)',
|
|
32
|
-
height: 'var(--space-6)',
|
|
33
|
-
borderRadius: 'var(--radius-pill)',
|
|
34
|
-
background: 'var(--info-solid)',
|
|
35
|
-
color: 'var(--info-on-solid)',
|
|
36
|
-
display: 'inline-flex',
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
fontSize: 'var(--font-size-caption)',
|
|
40
|
-
fontWeight: 'var(--weight-bold)',
|
|
41
|
-
}, children: m.n }) }, m.n))) }));
|
|
42
|
-
}
|
|
43
|
-
function Overview({ sample }) {
|
|
44
|
-
const t = useT();
|
|
45
|
-
const { proto, journeys } = sample;
|
|
46
|
-
const steps = journeys[0]?.journeys[0]?.steps ?? [];
|
|
47
|
-
const cell = (scene, label, n) => (_jsxs("div", { style: { display: 'grid', gap: 'var(--space-2)', minWidth: 0 }, children: [_jsxs("span", { style: { ...row, ...captionText }, children: [n !== undefined && _jsx(Chip, { size: "sm", children: n }), _jsx("span", { children: label })] }), _jsx(Peek, { height: "13rem", children: _jsx(AppScene, { scene: scene, title: label }) })] }, `${scene}-${label}`));
|
|
48
|
-
const grid = {
|
|
49
|
-
display: 'grid',
|
|
50
|
-
gap: 'var(--space-4)',
|
|
51
|
-
gridTemplateColumns: 'repeat(auto-fill, minmax(8rem, 9.5rem))',
|
|
52
|
-
};
|
|
53
|
-
return (_jsxs("div", { style: { display: 'grid', gap: 'var(--space-4)', padding: 'var(--space-4)' }, children: [_jsx("span", { style: captionText, children: steps.length > 0 && journeys[0]?.journeys[0]?.name }), _jsx("div", { style: grid, children: proto.stepScenes.map((s, i) => cell(s, steps[i] ?? s, i + 1)) }), _jsx("span", { style: captionText, children: t('studio.loop.fs.otherScreens') }), _jsx("div", { style: grid, children: proto.others.map((o) => cell(o.scene, o.label)) })] }));
|
|
54
|
-
}
|
|
55
|
-
export function FsStage({ sample, view }) {
|
|
56
|
-
const t = useT();
|
|
57
|
-
const { proto, fs } = sample;
|
|
58
|
-
if (view.mode === 'overview')
|
|
59
|
-
return _jsx(Overview, { sample: sample });
|
|
60
|
-
return (_jsxs("div", { style: {
|
|
61
|
-
display: 'grid',
|
|
62
|
-
gap: 'var(--space-3)',
|
|
63
|
-
justifyItems: 'center',
|
|
64
|
-
padding: 'var(--space-4)',
|
|
65
|
-
}, children: [_jsxs("p", { style: { ...captionText, margin: 0 }, children: [view.app === 'console'
|
|
66
|
-
? t('studio.loop.proto.show.console')
|
|
67
|
-
: t('studio.loop.proto.show.patient'), view.planning && ` · ${t(`studio.loop.fs.tool.${view.tool}`)}`] }), _jsxs("div", { style: {
|
|
68
|
-
position: 'relative',
|
|
69
|
-
width: '100%',
|
|
70
|
-
maxWidth: view.app === 'console' ? '52rem' : view.device === 'tablet' ? '34rem' : '18rem',
|
|
71
|
-
}, children: [view.app === 'console' ? (_jsx(ConsoleScene, { scene: proto.scenes.console, title: t('studio.loop.proto.show.console') })) : (_jsx(AppScene, { scene: view.device === 'tablet'
|
|
72
|
-
? proto.scenes.tablet
|
|
73
|
-
: (proto.stepScenes[1] ?? proto.scenes.app), frame: view.device === 'tablet' ? 'tablet' : 'phone', title: t('studio.loop.proto.show.patient') })), view.planning && _jsx(Marks, { marks: fs.marks })] })] }));
|
|
74
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// The full-screen prototype's toolbar, as design tools have it: exit, the way to look (Play one
|
|
3
|
-
// device, or Overview of every screen), the app, the device, the tools, zoom, the panels and
|
|
4
|
-
// "Plan a change".
|
|
5
|
-
import { useT } from '@buffcore/i18n/react';
|
|
6
|
-
import { Button } from '../../../components/Button.js';
|
|
7
|
-
import { Chip } from '../../../components/Chip.js';
|
|
8
|
-
import { IconButton } from '../../../components/IconButton.js';
|
|
9
|
-
import { Select } from '../../../components/Select.js';
|
|
10
|
-
import { Tabs } from '../../../components/Tabs.js';
|
|
11
|
-
import { TOOLS } from './fsViews.js';
|
|
12
|
-
const TOOL_ICON = {
|
|
13
|
-
interact: 'play',
|
|
14
|
-
select: 'mouse-pointer',
|
|
15
|
-
comment: 'message-square',
|
|
16
|
-
draw: 'pencil',
|
|
17
|
-
area: 'layers',
|
|
18
|
-
};
|
|
19
|
-
const DEVICE_ICON = { phone: 'smartphone', tablet: 'smartphone', desktop: 'monitor' };
|
|
20
|
-
function Devices({ device }) {
|
|
21
|
-
const t = useT();
|
|
22
|
-
return (_jsx("fieldset", { "aria-label": t('studio.loop.proto.device'), style: {
|
|
23
|
-
display: 'flex',
|
|
24
|
-
gap: 'var(--space-1)',
|
|
25
|
-
border: 0,
|
|
26
|
-
margin: 0,
|
|
27
|
-
padding: 0,
|
|
28
|
-
minWidth: 0,
|
|
29
|
-
}, children: ['phone', 'tablet', 'desktop'].map((d) => (_jsx(IconButton, { icon: DEVICE_ICON[d], label: t(`studio.loop.proto.device.${d === 'phone' ? 'mobile' : d}`), pressed: device === d, size: "sm" }, d))) }));
|
|
30
|
-
}
|
|
31
|
-
function Tools({ tool: current }) {
|
|
32
|
-
const t = useT();
|
|
33
|
-
return (_jsx("div", { role: "toolbar", "aria-label": t('studio.loop.fs.tools'), style: { display: 'flex', gap: 'var(--space-1)' }, children: TOOLS.map((tool) => (_jsx(IconButton, { icon: TOOL_ICON[tool], label: t(`studio.loop.fs.tool.${tool}`), pressed: current === tool, size: "sm" }, tool))) }));
|
|
34
|
-
}
|
|
35
|
-
function Views({ view }) {
|
|
36
|
-
const t = useT();
|
|
37
|
-
return (_jsxs(_Fragment, { children: [_jsx(Tabs, { label: t('studio.loop.fs.view'), value: view.mode, onChange: () => { }, tabs: [
|
|
38
|
-
['play', t('studio.loop.fs.play')],
|
|
39
|
-
['overview', t('studio.loop.fs.overview')],
|
|
40
|
-
] }), _jsx(Tabs, { label: t('studio.loop.fs.app'), value: view.app, onChange: () => { }, tabs: [
|
|
41
|
-
['patient', t('studio.loop.proto.show.patient')],
|
|
42
|
-
['console', t('studio.loop.proto.show.console')],
|
|
43
|
-
] })] }));
|
|
44
|
-
}
|
|
45
|
-
export function FsToolbar({ sample, view }) {
|
|
46
|
-
const t = useT();
|
|
47
|
-
const { proto, fs } = sample;
|
|
48
|
-
return (_jsxs("header", { style: {
|
|
49
|
-
display: 'flex',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
flexWrap: 'wrap',
|
|
52
|
-
gap: 'var(--space-3)',
|
|
53
|
-
padding: 'var(--space-2) var(--space-4)',
|
|
54
|
-
background: 'var(--surface-page)',
|
|
55
|
-
borderBlockEnd: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
56
|
-
}, children: [_jsx(Button, { size: "sm", variant: "ghost", icon: "x", children: t('studio.loop.fs.exit') }), _jsxs("strong", { style: { color: 'var(--text-strong)' }, children: [_jsx("span", { translate: "no", style: { fontFamily: 'var(--font-mono)' }, children: proto.change.id }), ' ', _jsx(Chip, { size: "sm", icon: "shield-check", tone: "brand", children: "v2" })] }), _jsx(Views, { view: view }), _jsx(Devices, { device: view.device }), _jsx("span", { style: { flex: 1 } }), _jsx(Tools, { tool: view.tool }), _jsx(Select, { label: t('studio.loop.fs.zoom'), labelHidden: true, size: "sm", value: "fit", onChange: () => { }, options: [
|
|
57
|
-
{ value: 'fit', label: t('studio.loop.fs.fit') },
|
|
58
|
-
{ value: '50', label: '50%' },
|
|
59
|
-
{ value: '100', label: '100%' },
|
|
60
|
-
] }), _jsxs(Button, { size: "sm", icon: "sparkles", children: [t('studio.loop.fs.planButton'), view.planning && (_jsx(Chip, { size: "sm", tone: "neutral", children: fs.marks.length }))] })] }));
|
|
61
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// The prototype in full screen, as design tools do it: a toolbar, journeys and screens on the left,
|
|
3
|
-
// the stage in the middle and, when a change is being planned, Plan a change on the right. It covers
|
|
4
|
-
// the frame, so the loop's rail and the agent's panel are out of the way.
|
|
5
|
-
import { useT } from '@buffcore/i18n/react';
|
|
6
|
-
import { Button } from '../../../components/Button.js';
|
|
7
|
-
import { Icon } from '../../../components/Icon.js';
|
|
8
|
-
import { bodyText, captionText } from '../../../components/styles.js';
|
|
9
|
-
import { Tabs } from '../../../components/Tabs.js';
|
|
10
|
-
import { PlanPanel } from './FsPlan.js';
|
|
11
|
-
import { FsStage } from './FsStage.js';
|
|
12
|
-
import { FsToolbar } from './FsToolbar.js';
|
|
13
|
-
import { FS_VIEWS } from './fsViews.js';
|
|
14
|
-
import { MOMENTS } from './moments.js';
|
|
15
|
-
import { row } from './parts.js';
|
|
16
|
-
const DATA = ['full', 'empty', 'loading', 'error'];
|
|
17
|
-
/** One role's journeys; the first journey is open, with its steps. */
|
|
18
|
-
function RoleJourneys({ role, first }) {
|
|
19
|
-
return (_jsxs("div", { style: { display: 'grid', gap: 'var(--space-1)' }, children: [_jsx("span", { style: {
|
|
20
|
-
...captionText,
|
|
21
|
-
textTransform: 'uppercase',
|
|
22
|
-
letterSpacing: 'var(--tracking-caps)',
|
|
23
|
-
}, children: role.role }), role.journeys.map((j) => (_jsxs("div", { style: { display: 'grid', gap: 'var(--space-1)' }, children: [_jsxs("span", { style: {
|
|
24
|
-
...bodyText,
|
|
25
|
-
display: 'flex',
|
|
26
|
-
gap: 'var(--space-2)',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
fontWeight: j === first ? 'var(--weight-bold)' : 'var(--weight-regular)',
|
|
29
|
-
color: 'var(--text-strong)',
|
|
30
|
-
}, children: [_jsx(Icon, { name: role.where === 'app' ? 'smartphone' : 'monitor', size: "var(--icon-sm)" }), j.name] }), j === first && _jsx(OpenSteps, { j: j })] }, j.id)))] }));
|
|
31
|
-
}
|
|
32
|
-
function Left({ sample }) {
|
|
33
|
-
const t = useT();
|
|
34
|
-
const first = sample.journeys[0]?.journeys[0];
|
|
35
|
-
return (_jsxs("aside", { "aria-label": t('studio.loop.fs.left'), style: {
|
|
36
|
-
height: '100%',
|
|
37
|
-
overflow: 'auto',
|
|
38
|
-
boxSizing: 'border-box',
|
|
39
|
-
padding: 'var(--space-3)',
|
|
40
|
-
display: 'grid',
|
|
41
|
-
gap: 'var(--space-3)',
|
|
42
|
-
alignContent: 'start',
|
|
43
|
-
background: 'var(--surface-page)',
|
|
44
|
-
borderInlineEnd: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
45
|
-
}, children: [_jsx(Tabs, { label: t('studio.loop.fs.left'), value: "journeys", onChange: () => { }, tabs: [
|
|
46
|
-
['journeys', t('studio.frame.page.journeys')],
|
|
47
|
-
['screens', t('studio.loop.fs.screens')],
|
|
48
|
-
] }), sample.journeys.map((r) => (_jsx(RoleJourneys, { role: r, first: first }, r.role))), _jsxs("div", { style: { display: 'grid', gap: 'var(--space-2)' }, children: [_jsx("span", { style: {
|
|
49
|
-
...captionText,
|
|
50
|
-
textTransform: 'uppercase',
|
|
51
|
-
letterSpacing: 'var(--tracking-caps)',
|
|
52
|
-
}, children: t('studio.loop.fs.sampleData') }), _jsx(Tabs, { label: t('studio.loop.proto.data'), value: "full", onChange: () => { }, tabs: DATA.map((d) => [d, t(`studio.loop.proto.data.${d}`)]) })] })] }));
|
|
53
|
-
}
|
|
54
|
-
function OpenSteps({ j }) {
|
|
55
|
-
const t = useT();
|
|
56
|
-
return (_jsxs(_Fragment, { children: [_jsx("ol", { style: {
|
|
57
|
-
listStyle: 'none',
|
|
58
|
-
margin: 0,
|
|
59
|
-
padding: 0,
|
|
60
|
-
display: 'grid',
|
|
61
|
-
gap: 'var(--space-1)',
|
|
62
|
-
}, children: j.steps.map((s, n) => (_jsxs("li", { style: {
|
|
63
|
-
...bodyText,
|
|
64
|
-
padding: 'var(--space-1) var(--space-2)',
|
|
65
|
-
borderRadius: 'var(--radius-control)',
|
|
66
|
-
background: n === 0 ? 'var(--brand-tint)' : undefined,
|
|
67
|
-
}, children: [n + 1, " \u00B7 ", s] }, s))) }), _jsxs("div", { style: row, children: [_jsx(Button, { size: "sm", variant: "secondary", icon: "play", children: t('studio.loop.proto.play') }), _jsx(Button, { size: "sm", variant: "ghost", icon: "undo-2", children: t('studio.loop.proto.startOver') })] })] }));
|
|
68
|
-
}
|
|
69
|
-
export function FullScreen({ sample, moment }) {
|
|
70
|
-
const t = useT();
|
|
71
|
-
const view = FS_VIEWS[moment];
|
|
72
|
-
if (!view)
|
|
73
|
-
return null;
|
|
74
|
-
return (_jsxs("section", { "aria-label": t('studio.loop.fs.label'), style: {
|
|
75
|
-
height: '100%',
|
|
76
|
-
display: 'grid',
|
|
77
|
-
gridTemplateRows: 'auto minmax(0, 1fr)',
|
|
78
|
-
background: 'var(--surface-canvas)',
|
|
79
|
-
}, children: [_jsx(FsToolbar, { sample: sample, view: view }), _jsxs("div", { style: {
|
|
80
|
-
display: 'grid',
|
|
81
|
-
minHeight: 0,
|
|
82
|
-
gridTemplateColumns: `minmax(14rem, 17rem) minmax(0, 1fr)${view.planning ? ' minmax(18rem, 23rem)' : ''}`,
|
|
83
|
-
}, children: [_jsx(Left, { sample: sample }), _jsx("main", { style: {
|
|
84
|
-
overflow: 'auto',
|
|
85
|
-
minHeight: 0,
|
|
86
|
-
backgroundImage: 'radial-gradient(var(--border-default) 1px, transparent 1px)',
|
|
87
|
-
backgroundSize: 'var(--space-4) var(--space-4)',
|
|
88
|
-
}, children: _jsx(FsStage, { sample: sample, view: view }) }), view.planning && (_jsx(PlanPanel, { fs: sample.fs, base: t('studio.loop.fs.base', { change: sample.proto.change.id }), level: MOMENTS[moment].level }))] })] }));
|
|
89
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { PreviewToolbarProps } from './PrototypePreviewToolbar.tsx';
|
|
3
|
-
export declare function PreviewMenu({ id, title, narrow, end, onClose, children, }: {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
narrow: boolean;
|
|
7
|
-
end?: boolean;
|
|
8
|
-
onClose: () => void;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}): import("react").JSX.Element;
|
|
11
|
-
export declare function JourneyChoices({ groups, left, journey, onPlay, onSelect, }: PreviewToolbarProps & {
|
|
12
|
-
onSelect: (id: string) => void;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
14
|
-
export declare function Options({ device, data, dataStates, narrow, onDevice, onData, onHelp, close, }: PreviewToolbarProps & {
|
|
15
|
-
narrow: boolean;
|
|
16
|
-
onHelp: () => void;
|
|
17
|
-
close: () => void;
|
|
18
|
-
}): import("react").JSX.Element;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useT } from '@buffcore/i18n/react';
|
|
3
|
-
import { Button } from '../../../components/Button.js';
|
|
4
|
-
import { Icon } from '../../../components/Icon.js';
|
|
5
|
-
import { Sheet } from '../../../components/Sheet.js';
|
|
6
|
-
import { captionText } from '../../../components/styles.js';
|
|
7
|
-
import { LeftOut } from './PrototypeLeftOut.js';
|
|
8
|
-
export function PreviewMenu({ id, title, narrow, end, onClose, children, }) {
|
|
9
|
-
if (narrow)
|
|
10
|
-
return (_jsx(Sheet, { id: id, title: title, onClose: onClose, manageFocus: false, children: children }));
|
|
11
|
-
return (_jsx("section", { id: id, tabIndex: -1, "aria-label": title, style: {
|
|
12
|
-
position: 'absolute',
|
|
13
|
-
insetBlockStart: '100%',
|
|
14
|
-
insetInlineEnd: end ? 0 : undefined,
|
|
15
|
-
insetInlineStart: end ? undefined : 0,
|
|
16
|
-
marginBlockStart: 'var(--space-1)',
|
|
17
|
-
zIndex: 5,
|
|
18
|
-
inlineSize: 'max-content',
|
|
19
|
-
minInlineSize: 'var(--width-margin)',
|
|
20
|
-
maxInlineSize: 'calc(var(--width-margin) * 1.4)',
|
|
21
|
-
maxBlockSize: 'calc(100dvh - var(--space-20) * 3)',
|
|
22
|
-
overflow: 'auto',
|
|
23
|
-
boxSizing: 'border-box',
|
|
24
|
-
padding: 'var(--space-3)',
|
|
25
|
-
background: 'var(--surface-panel)',
|
|
26
|
-
border: 'var(--border-width-hairline) solid var(--border-default)',
|
|
27
|
-
borderRadius: 'var(--radius-overlay)',
|
|
28
|
-
boxShadow: 'var(--shadow-overlay)',
|
|
29
|
-
color: 'var(--text-body)',
|
|
30
|
-
}, children: children }));
|
|
31
|
-
}
|
|
32
|
-
function Item({ icon, selected, disabled, onClick, children, title, journey, }) {
|
|
33
|
-
return (_jsxs(Button, { variant: selected ? 'tonal' : 'ghost', icon: icon, fullWidth: true, "aria-current": selected ? 'true' : undefined, disabled: disabled, onClick: onClick, "data-journey-choice": journey, title: title, style: {
|
|
34
|
-
justifyContent: 'flex-start',
|
|
35
|
-
textAlign: 'start',
|
|
36
|
-
overflowWrap: 'anywhere',
|
|
37
|
-
paddingBlock: 'var(--space-1)',
|
|
38
|
-
boxSizing: 'border-box',
|
|
39
|
-
}, children: [_jsx("span", { style: { flex: 1, minInlineSize: 0 }, children: children }), selected && _jsx(Icon, { name: "check", size: "var(--icon-sm)" })] }));
|
|
40
|
-
}
|
|
41
|
-
function Heading({ children }) {
|
|
42
|
-
return (_jsx("h3", { style: {
|
|
43
|
-
...captionText,
|
|
44
|
-
margin: 0,
|
|
45
|
-
padding: 'var(--space-2) var(--space-3) var(--space-1)',
|
|
46
|
-
fontWeight: 'var(--weight-bold)',
|
|
47
|
-
}, children: children }));
|
|
48
|
-
}
|
|
49
|
-
const rule = (_jsx("hr", { style: {
|
|
50
|
-
border: 0,
|
|
51
|
-
borderBlockStart: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
52
|
-
margin: 'var(--space-2) 0',
|
|
53
|
-
} }));
|
|
54
|
-
export function JourneyChoices({ groups, left, journey, onPlay, onSelect, }) {
|
|
55
|
-
const t = useT();
|
|
56
|
-
if (groups.length === 0)
|
|
57
|
-
return (_jsxs(_Fragment, { children: [_jsx("p", { style: { margin: 0 }, children: t('studio.prototype.none') }), _jsx(LeftOut, { left: left })] }));
|
|
58
|
-
const choices = groups.map((group, index) => {
|
|
59
|
-
const label = group.role ? t('simple.try.for', { role: group.role }) : t('simple.try.other');
|
|
60
|
-
return (_jsxs("section", { "aria-label": label, children: [index > 0 && rule, _jsx(Heading, { children: label }), group.journeys.map((choice) => (_jsx(Item, { journey: choice.key, title: choice.title, selected: choice.key === journey, disabled: !onPlay, onClick: () => onSelect(choice.key), children: _jsx("span", { translate: "no", children: choice.title }) }, choice.key)))] }, group.role ?? ''));
|
|
61
|
-
});
|
|
62
|
-
return (_jsxs(_Fragment, { children: [choices, _jsx(LeftOut, { left: left })] }));
|
|
63
|
-
}
|
|
64
|
-
const DEVICES = ['mobile', 'tablet', 'desktop'];
|
|
65
|
-
const DATA = ['full', 'empty', 'loading', 'error'];
|
|
66
|
-
export function Options({ device, data, dataStates, narrow, onDevice, onData, onHelp, close, }) {
|
|
67
|
-
const t = useT();
|
|
68
|
-
return (_jsxs(_Fragment, { children: [!narrow && (_jsxs(_Fragment, { children: [_jsxs("section", { "aria-label": t('simple.device'), children: [_jsx(Heading, { children: t('simple.device') }), DEVICES.map((choice) => (_jsx(Item, { selected: choice === device, disabled: !onDevice, onClick: () => {
|
|
69
|
-
onDevice?.(choice);
|
|
70
|
-
close();
|
|
71
|
-
}, children: t(`simple.device.${choice === 'mobile' ? 'phone' : choice}`) }, choice)))] }), rule] })), _jsxs("section", { "aria-label": t('simple.options.data'), children: [_jsx(Heading, { children: t('simple.options.data') }), DATA.map((state) => (_jsx(Item, { selected: state === data, disabled: !onData || !dataStates?.includes(state), title: !onData || !dataStates?.includes(state) ? t('simple.data.unavailable') : undefined, onClick: () => {
|
|
72
|
-
onData?.(state);
|
|
73
|
-
close();
|
|
74
|
-
}, children: t(`simple.data.${state}`) }, state)))] }), rule, _jsx(Item, { icon: "circle-help", onClick: onHelp, children: t('simple.options.signin') })] }));
|
|
75
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Left, PlayableJourney } from './prototype-bridge.ts';
|
|
2
|
-
import type { DataState, ProtoView } from './protoView.ts';
|
|
3
|
-
type Device = NonNullable<ProtoView['device']>;
|
|
4
|
-
type MenuName = 'journeys' | 'options';
|
|
5
|
-
export type PreviewGroup = {
|
|
6
|
-
role?: string;
|
|
7
|
-
journeys: readonly PlayableJourney[];
|
|
8
|
-
};
|
|
9
|
-
export interface PreviewToolbarProps {
|
|
10
|
-
product: string;
|
|
11
|
-
groups: readonly PreviewGroup[];
|
|
12
|
-
left?: readonly Left[];
|
|
13
|
-
journey?: string;
|
|
14
|
-
device: Device;
|
|
15
|
-
data?: DataState;
|
|
16
|
-
dataStates?: readonly DataState[];
|
|
17
|
-
href?: string;
|
|
18
|
-
onPlay?: (id: string) => void;
|
|
19
|
-
ready?: boolean;
|
|
20
|
-
onDevice?: (device: Device) => void;
|
|
21
|
-
onData?: (data: DataState) => void;
|
|
22
|
-
initialMenu?: MenuName;
|
|
23
|
-
}
|
|
24
|
-
export declare function PreviewToolbar({ narrow, initialMenu, ...props }: PreviewToolbarProps & {
|
|
25
|
-
narrow: boolean;
|
|
26
|
-
}): import("react").JSX.Element;
|
|
27
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useT } from '@buffcore/i18n/react';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { Button } from '../../../components/Button.js';
|
|
5
|
-
import { IconButton } from '../../../components/IconButton.js';
|
|
6
|
-
import { Sheet } from '../../../components/Sheet.js';
|
|
7
|
-
import { JourneyChoices, Options, PreviewMenu } from './PrototypePreviewMenus.js';
|
|
8
|
-
import { PrototypeUnavailable } from './PrototypeUnavailable.js';
|
|
9
|
-
import { prototypePanelId, usePrototypePanel } from './prototype-focus.js';
|
|
10
|
-
export function PreviewToolbar({ narrow, initialMenu, ...props }) {
|
|
11
|
-
const t = useT();
|
|
12
|
-
const [menu, setMenu] = useState(initialMenu);
|
|
13
|
-
const close = usePrototypePanel(menu, () => setMenu(undefined));
|
|
14
|
-
const unavailable = props.ready === false;
|
|
15
|
-
const toggle = (name) => {
|
|
16
|
-
if (menu === name)
|
|
17
|
-
close();
|
|
18
|
-
else
|
|
19
|
-
setMenu(name);
|
|
20
|
-
};
|
|
21
|
-
const current = props.groups
|
|
22
|
-
.flatMap((group) => group.journeys)
|
|
23
|
-
.find((j) => j.key === props.journey);
|
|
24
|
-
return (_jsxs("div", { "data-prototype-header": true, "data-prototype-focus-group": "toolbar", style: {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
justifyContent: 'space-between',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
gap: 'var(--space-2)',
|
|
29
|
-
padding: 'var(--space-2) var(--space-4)',
|
|
30
|
-
minInlineSize: 0,
|
|
31
|
-
}, children: [_jsxs("div", { style: { position: 'relative', display: 'flex', minWidth: 0, flex: narrow ? 1 : undefined }, children: [_jsx(Button, { variant: "secondary", icon: "list-checks", iconEnd: "chevron-down", "data-journey-picker": true, "data-prototype-trigger": "journeys", "aria-expanded": menu === 'journeys', "aria-disabled": unavailable || undefined, onClick: unavailable ? undefined : () => toggle('journeys'), style: {
|
|
32
|
-
minInlineSize: 'var(--control-md)',
|
|
33
|
-
maxInlineSize: '100%',
|
|
34
|
-
flex: narrow ? 1 : undefined,
|
|
35
|
-
...(unavailable && {
|
|
36
|
-
background: 'var(--surface-sunken)',
|
|
37
|
-
color: 'var(--text-disabled)',
|
|
38
|
-
cursor: 'default',
|
|
39
|
-
}),
|
|
40
|
-
}, children: _jsx("span", { title: current?.title, style: {
|
|
41
|
-
minWidth: 0,
|
|
42
|
-
overflow: 'hidden',
|
|
43
|
-
textOverflow: 'ellipsis',
|
|
44
|
-
whiteSpace: 'nowrap',
|
|
45
|
-
}, children: current?.title ?? t('simple.try') }) }), menu === 'journeys' && (_jsx(PreviewMenu, { id: prototypePanelId('journeys'), title: t('simple.try'), narrow: narrow, onClose: close, children: _jsx(JourneyChoices, { ...props, onSelect: (id) => {
|
|
46
|
-
close();
|
|
47
|
-
props.onPlay?.(id);
|
|
48
|
-
} }) }))] }), _jsxs("div", { style: { position: 'relative' }, children: [_jsx(IconButton, { icon: "sliders-horizontal", "data-prototype-trigger": "options signin", label: t('simple.options'), variant: "secondary", pressed: menu === 'options', "aria-expanded": menu === 'options', onClick: () => toggle('options') }), menu === 'options' && (_jsx(PreviewMenu, { id: prototypePanelId('options'), end: true, title: t('simple.options'), narrow: narrow, onClose: close, children: _jsx(Options, { ...props, narrow: narrow, close: close, onHelp: () => {
|
|
49
|
-
close();
|
|
50
|
-
setMenu('signin');
|
|
51
|
-
} }) }))] }), menu === 'signin' && (_jsx(Sheet, { id: prototypePanelId('signin'), title: t('simple.options.signin'), onClose: close, manageFocus: false, children: _jsx(PrototypeUnavailable, { status: "cookies", product: props.product, href: props.href, onOpen: close }) }))] }));
|
|
52
|
-
}
|