@buffcore/admin-shell 0.8.44 → 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.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,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// The console in the workspace: the product's own console, framed live at its address, with the
|
|
3
|
+
// same checks as the customer app's frame (never this page's own site, never plain HTTP from HTTPS).
|
|
4
|
+
// The console does not answer the prototype's messages, so its journeys are followed by hand.
|
|
5
|
+
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
6
|
+
import { pageMode } from '../frame/layout.js';
|
|
7
|
+
import { prototypeAddress } from './prototype-bridge.js';
|
|
8
|
+
import { framedAddress } from './prototype-site.js';
|
|
9
|
+
export function consoleAddress(url, locale, mode) {
|
|
10
|
+
const address = prototypeAddress(url);
|
|
11
|
+
if (!address)
|
|
12
|
+
return { status: 'stopped' };
|
|
13
|
+
const framed = framedAddress(address);
|
|
14
|
+
const blocked = [address, framed].some((checked) => checked.host === location.host ||
|
|
15
|
+
(location.protocol === 'https:' && checked.protocol === 'http:'));
|
|
16
|
+
if (blocked)
|
|
17
|
+
return { status: 'blocked' };
|
|
18
|
+
framed.search = new URLSearchParams({ locale, mode }).toString();
|
|
19
|
+
return { href: framed.href };
|
|
20
|
+
}
|
|
21
|
+
export function ConsoleFrame({ url }) {
|
|
22
|
+
const t = useT();
|
|
23
|
+
const { locale } = useLocale();
|
|
24
|
+
// The address is read once per language and look: a new one loads the console afresh.
|
|
25
|
+
const shown = consoleAddress(url, locale, pageMode() ?? 'light');
|
|
26
|
+
if (!shown.href)
|
|
27
|
+
return (_jsx("p", { role: "status", style: { margin: 0, padding: 'var(--space-4)' }, children: t(`studio.workspace.console.${shown.status}`) }));
|
|
28
|
+
return (_jsx("iframe", { "data-workspace-console": true, title: t('studio.workspace.console.frame'), src: shown.href, sandbox: "allow-scripts allow-same-origin", referrerPolicy: "no-referrer", style: { display: 'block', inlineSize: '100%', blockSize: '100%', border: 0 } }));
|
|
29
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export interface NotThisCardProps {
|
|
2
2
|
lines: readonly string[];
|
|
3
|
+
/** The product's name, for the lead. */
|
|
4
|
+
name: string;
|
|
3
5
|
/** A line being typed at the start (a scene or a test). */
|
|
4
6
|
typing?: string;
|
|
5
7
|
onAdd?: (line: string) => void;
|
|
8
|
+
/** Asks the agent to change a line to new words. */
|
|
9
|
+
onEdit?: (line: string, to: string) => void;
|
|
10
|
+
first?: boolean;
|
|
6
11
|
}
|
|
7
|
-
export declare function NotThisCard({ lines, typing, onAdd }: NotThisCardProps): import("react").JSX.Element;
|
|
12
|
+
export declare function NotThisCard({ lines, name, typing, onAdd, onEdit, first }: NotThisCardProps): import("react").JSX.Element;
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// The Brief's "Not this project": the lines the owner never wants, in their words
|
|
3
|
-
//
|
|
2
|
+
// The Brief's "Not this project": the lines the owner never wants, in their words, each with Edit,
|
|
3
|
+
// and Add a line. An edit or a new line goes through the Brief chat (the agent edits
|
|
4
|
+
// plan/not-this.md; Save keeps it), so there is no write here.
|
|
4
5
|
import { useT } from '@buffcore/i18n/react';
|
|
5
6
|
import { useState } from 'react';
|
|
7
|
+
import { Badge } from '../../../components/Badge.js';
|
|
6
8
|
import { Button } from '../../../components/Button.js';
|
|
7
|
-
import {
|
|
8
|
-
import { bodyText, captionText } from '../../../components/styles.js';
|
|
9
|
+
import { captionText } from '../../../components/styles.js';
|
|
9
10
|
import { TextField } from '../../../components/TextField.js';
|
|
10
|
-
import {
|
|
11
|
-
|
|
11
|
+
import { BriefSection, briefMuted, briefText, hairline, plainList } from './BriefSection.js';
|
|
12
|
+
import { row } from './parts.js';
|
|
13
|
+
/** A line's words, a field and a send: Add a line and Edit share it. */
|
|
14
|
+
function LineField(props) {
|
|
12
15
|
const t = useT();
|
|
13
|
-
const [draft, setDraft] = useState(
|
|
16
|
+
const [draft, setDraft] = useState(props.start);
|
|
14
17
|
const line = draft.trim();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (_jsxs(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
return (_jsxs("div", { style: { ...row, alignItems: 'flex-end' }, children: [_jsx(TextField, { label: props.label, value: draft, onChange: setDraft, autoFocus: true, style: { flex: '1 1 12rem' } }), _jsx(Button, { variant: "secondary", disabled: !props.onSend || !line || (props.edit && line === props.start.trim()), onClick: () => props.onSend?.(line), children: props.action }), _jsx(Button, { variant: "ghost", onClick: props.onCancel, children: t('admin.common.cancel') })] }));
|
|
19
|
+
}
|
|
20
|
+
export function NotThisCard({ lines, name, typing, onAdd, onEdit, first }) {
|
|
21
|
+
const t = useT();
|
|
22
|
+
const [adding, setAdding] = useState(typing !== undefined);
|
|
23
|
+
const [editing, setEditing] = useState();
|
|
24
|
+
return (_jsxs(BriefSection, { first: first, title: t('studio.start.not.title'), badge: lines.length ? _jsx(Badge, { children: String(lines.length) }) : undefined, children: [_jsx("p", { style: briefMuted, children: t('studio.start.not.lead', { name }) }), lines.length ? (_jsx("ul", { style: { ...plainList, gap: 0 }, children: lines.map((line, i) => (_jsx("li", { style: {
|
|
25
|
+
paddingBlock: 'var(--space-1)',
|
|
26
|
+
...(i ? { borderBlockStart: hairline } : {}),
|
|
27
|
+
}, children: editing === i ? (_jsx(LineField, { label: t('studio.start.not.editField'), start: line, edit: true, action: t('studio.start.not.editSend'), onSend: onEdit &&
|
|
28
|
+
((to) => {
|
|
29
|
+
onEdit(line, to);
|
|
30
|
+
setEditing(undefined);
|
|
31
|
+
}), onCancel: () => setEditing(undefined) })) : (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 'var(--space-3)' }, children: [_jsx("span", { translate: "no", style: { ...briefText, flex: 1, minWidth: 0, overflowWrap: 'anywhere' }, children: line }), _jsx(Button, { variant: "ghost", icon: "pencil", "aria-label": t('studio.start.not.editAbout', { line }), disabled: !onEdit, onClick: () => setEditing(i), children: t('studio.start.not.edit') })] })) }, i))) })) : (_jsx("p", { style: briefText, children: t('studio.start.not.empty') })), adding ? (_jsx(LineField, { label: t('studio.start.not.field'), start: typing ?? '', action: t('studio.start.not.add'), onSend: onAdd &&
|
|
32
|
+
((line) => {
|
|
33
|
+
onAdd(line);
|
|
34
|
+
setAdding(false);
|
|
35
|
+
}), onCancel: () => setAdding(false) })) : (_jsx("div", { children: _jsx(Button, { variant: "secondary", icon: "plus", onClick: () => setAdding(true), children: t('studio.start.not.field') }) })), _jsx("span", { style: captionText, children: t('studio.start.not.note') })] }));
|
|
28
36
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PlayableJourney } from './prototype-bridge.ts';
|
|
3
|
-
import type { JourneyRole, LoopSample } from './types.ts';
|
|
4
|
-
export declare function plannedJourney(roles: readonly JourneyRole[], journey: PlayableJourney): {
|
|
5
|
-
role: string;
|
|
6
|
-
entry: import("./types.ts").JourneyDef;
|
|
7
|
-
} | undefined;
|
|
8
|
-
export declare function groupJourneys(journeys: readonly PlayableJourney[], roles: readonly JourneyRole[]): PreviewGroup[];
|
|
1
|
+
import type { LoopSample } from './types.ts';
|
|
9
2
|
export declare function ProtoJourneys({ sample, step, journey, playing, onJourney, onPlayer, }: {
|
|
10
3
|
sample: Pick<LoopSample, 'journeys'>;
|
|
11
4
|
step: number;
|
|
@@ -8,20 +8,6 @@ import { Panel } from '../../../components/Panel.js';
|
|
|
8
8
|
import { Select } from '../../../components/Select.js';
|
|
9
9
|
import { bodyText, captionText } from '../../../components/styles.js';
|
|
10
10
|
import { row } from './parts.js';
|
|
11
|
-
export function plannedJourney(roles, journey) {
|
|
12
|
-
const matches = roles.flatMap((group) => group.journeys.flatMap((entry) => entry.id === journey.key || entry.name === journey.title ? [{ role: group.role, entry }] : []));
|
|
13
|
-
return matches.length === 1 ? matches[0] : undefined;
|
|
14
|
-
}
|
|
15
|
-
export function groupJourneys(journeys, roles) {
|
|
16
|
-
const groups = new Map();
|
|
17
|
-
for (const journey of journeys) {
|
|
18
|
-
const role = journey.role || plannedJourney(roles, journey)?.role;
|
|
19
|
-
const group = groups.get(role) ?? [];
|
|
20
|
-
group.push(journey);
|
|
21
|
-
groups.set(role, group);
|
|
22
|
-
}
|
|
23
|
-
return Array.from(groups, ([role, journeys]) => ({ role, journeys }));
|
|
24
|
-
}
|
|
25
11
|
function StepList({ steps, step }) {
|
|
26
12
|
return (_jsx("ol", { style: { listStyle: 'none', margin: 0, padding: 0, display: 'grid', gap: 'var(--space-1)' }, children: steps.map((s, n) => (_jsxs("li", { "aria-current": n === step ? 'step' : undefined, style: {
|
|
27
13
|
...bodyText,
|
|
@@ -29,9 +29,11 @@ export type Props = PrototypeAppProps & {
|
|
|
29
29
|
roles: readonly JourneyRole[];
|
|
30
30
|
device?: ProtoView['device'];
|
|
31
31
|
onDevice?: (device: NonNullable<ProtoView['device']>) => void;
|
|
32
|
+
orientation?: ProtoView['orientation'];
|
|
33
|
+
onOrientation?: (orientation: NonNullable<ProtoView['orientation']>) => void;
|
|
32
34
|
};
|
|
33
35
|
};
|
|
34
|
-
export declare function PrototypeApp(props: Props): import("react").JSX.Element;
|
|
36
|
+
export declare function PrototypeApp(props: Props): false | import("react").JSX.Element;
|
|
35
37
|
export type LoadedProps = Props & {
|
|
36
38
|
address: string;
|
|
37
39
|
given: string;
|
|
@@ -4,7 +4,7 @@ import { createContext, useCallback, useContext, useEffect, useRef, useState, }
|
|
|
4
4
|
import { pageMode } from '../frame/layout.js';
|
|
5
5
|
import { PrototypeAppView } from './PrototypeAppView.js';
|
|
6
6
|
import { PrototypeAttempt } from './PrototypeAttempt.js';
|
|
7
|
-
import {
|
|
7
|
+
import { PreviewSlot } from './PrototypePreviewSlot.js';
|
|
8
8
|
import { PrototypeUnavailable } from './PrototypeUnavailable.js';
|
|
9
9
|
import { prototypeAddress, prototypeNavigationId, } from './prototype-bridge.js';
|
|
10
10
|
import { framedAddress } from './prototype-site.js';
|
|
@@ -49,15 +49,30 @@ export function PrototypeApp(props) {
|
|
|
49
49
|
: blocked
|
|
50
50
|
? 'blocked'
|
|
51
51
|
: undefined;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const unavailable = !!status || !address || !framed;
|
|
53
|
+
const shownHref = props.running && (status !== 'refused' || local) ? href?.href : undefined;
|
|
54
|
+
const body = status || !address || !framed ? (!props.preview && (_jsx(UnavailablePreview, { ...props, status: status ?? 'blocked', href: shownHref }))) : (_jsx(PlayableApp, { ...props, previewIdentity: previewIdentity, address: framed.href, given: address.href, href: href?.href ?? address.href, locale: locale, mode: mode }, identity));
|
|
55
|
+
if (!props.preview)
|
|
56
|
+
return body;
|
|
57
|
+
// One workspace whatever the app's state: only the app's slot changes, the console stays put.
|
|
58
|
+
return (_jsx(PreviewSlot, { live: !unavailable, waiting: waiting({ ...props, preview: props.preview }, status ?? (unavailable ? 'blocked' : 'loading'), unavailable ? shownHref : (href?.href ?? address?.href)), children: body }));
|
|
59
|
+
}
|
|
60
|
+
/** What the workspace shows while the app is not running in it (or has not answered yet). */
|
|
61
|
+
function waiting(props, status, href) {
|
|
62
|
+
return {
|
|
63
|
+
product: props.product,
|
|
64
|
+
roles: props.preview.roles,
|
|
65
|
+
journeys: [],
|
|
66
|
+
app: (_jsx(PrototypeUnavailable, { status: status, quiet: true, product: props.product, onDev: props.onDev, href: href })),
|
|
67
|
+
ready: false,
|
|
68
|
+
device: props.preview.device ?? 'mobile',
|
|
69
|
+
orientation: props.preview.orientation,
|
|
70
|
+
onDevice: props.preview.onDevice,
|
|
71
|
+
onOrientation: props.preview.onOrientation,
|
|
72
|
+
};
|
|
55
73
|
}
|
|
56
74
|
function UnavailablePreview({ status, href, ...props }) {
|
|
57
|
-
|
|
58
|
-
if (props.preview)
|
|
59
|
-
return (_jsx(PrototypePreview, { product: props.product, groups: [], app: app, ready: false, device: props.preview.device ?? 'mobile', onDevice: props.preview.onDevice }));
|
|
60
|
-
return (_jsx(PrototypeAppView, { title: props.product, ready: false, journeys: [], onPlay: () => { }, app: app, reviewPanel: props.reviewPanel?.(false, !!(props.snapshotReady ?? props.running) && status !== 'missing') }));
|
|
75
|
+
return (_jsx(PrototypeAppView, { title: props.product, ready: false, journeys: [], onPlay: () => { }, app: _jsx(PrototypeUnavailable, { status: status, product: props.product, onDev: props.onDev, href: href }), reviewPanel: props.reviewPanel?.(false, !!(props.snapshotReady ?? props.running) && status !== 'missing') }));
|
|
61
76
|
}
|
|
62
77
|
export const PreviewChoiceContext = createContext(null);
|
|
63
78
|
function PlayableApp(props) {
|
|
@@ -82,7 +97,7 @@ function PlayableApp(props) {
|
|
|
82
97
|
const useGivenAddress = useCallback(() => setAsGiven(true), []);
|
|
83
98
|
const container = useRef(null);
|
|
84
99
|
if (!navigation)
|
|
85
|
-
return _jsx(UnavailablePreview, { ...props, status: "loading" });
|
|
100
|
+
return props.preview ? null : _jsx(UnavailablePreview, { ...props, status: "loading" });
|
|
86
101
|
const navigate = (choice, shown) => {
|
|
87
102
|
setRestore(false);
|
|
88
103
|
props.onPlayed?.();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo } from 'react';
|
|
3
|
-
import { groupJourneys } from './ProtoJourneys.js';
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
4
3
|
import { PrototypeAppFrame } from './PrototypeAppFrame.js';
|
|
5
4
|
import { PrototypeAppView } from './PrototypeAppView.js';
|
|
6
|
-
import {
|
|
5
|
+
import { useShowPreview } from './PrototypePreviewSlot.js';
|
|
7
6
|
import { usePrototypeFrame } from './usePrototypeFrame.js';
|
|
8
7
|
export function PrototypeAttempt({ navigation, onNavigate, onSwitch, ...props }) {
|
|
9
8
|
const model = usePrototypeFrame(new URL(props.address).origin, navigation.id, props.address !== props.given ? onSwitch : undefined,
|
|
@@ -56,6 +55,7 @@ function frameAddress(props, navigation, previewing) {
|
|
|
56
55
|
}).toString();
|
|
57
56
|
return url;
|
|
58
57
|
}
|
|
58
|
+
/** The running app's part of the workspace, shown in the slot above it (PrototypePreviewSlot). */
|
|
59
59
|
function LivePreview({ app, product, href, preview, model, navigation, onNavigate, play, }) {
|
|
60
60
|
const ready = model.journeys !== undefined;
|
|
61
61
|
const journeys = model.journeys ?? [];
|
|
@@ -66,23 +66,64 @@ function LivePreview({ app, product, href, preview, model, navigation, onNavigat
|
|
|
66
66
|
const step = current && requested < current.steps ? requested : 0;
|
|
67
67
|
const caption = model.stepCaption;
|
|
68
68
|
const data = navigation.data ?? 'full';
|
|
69
|
-
|
|
69
|
+
// One step mover for as long as the app runs: what draws over the stage keeps its hold on it.
|
|
70
|
+
const latest = useRef({ selected, model, onNavigate, preview });
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
|
+
latest.current = { selected, model, onNavigate, preview };
|
|
73
|
+
});
|
|
74
|
+
const onStep = useCallback((next) => {
|
|
75
|
+
const { selected, model, onNavigate } = latest.current;
|
|
76
|
+
if (selected && model.preview && model.alive() && next >= 0 && next < selected.steps)
|
|
77
|
+
onNavigate({ journey: selected, step: next, overlay: true });
|
|
78
|
+
}, []);
|
|
79
|
+
const partAt = useCallback((x, y) => latest.current.model.partAt(x, y), []);
|
|
80
|
+
// A mark in the change list shows its device, and its journey step or sample data, again.
|
|
81
|
+
const onShow = useCallback((place) => {
|
|
82
|
+
const { model, onNavigate, preview } = latest.current;
|
|
83
|
+
preview.onDevice?.(place.device);
|
|
84
|
+
if (place.device === 'tablet')
|
|
85
|
+
preview.onOrientation?.(place.orientation ?? 'portrait');
|
|
86
|
+
if (!model.alive())
|
|
87
|
+
return;
|
|
88
|
+
const journey = model.journeys?.find((entry) => entry.key === place.journey);
|
|
89
|
+
const data = (place.data ?? 'full');
|
|
90
|
+
if (journey)
|
|
91
|
+
onNavigate({ journey, step: place.step ?? 0, overlay: true });
|
|
92
|
+
else if (!place.journey && model.preview?.includes(data))
|
|
93
|
+
onNavigate({ data });
|
|
94
|
+
}, []);
|
|
95
|
+
useShowPreview({
|
|
96
|
+
product,
|
|
97
|
+
app,
|
|
98
|
+
ready,
|
|
99
|
+
href: ready ? href : undefined,
|
|
100
|
+
roles: preview.roles,
|
|
101
|
+
journeys,
|
|
102
|
+
left: model.left,
|
|
103
|
+
journey: selected?.key,
|
|
104
|
+
device: preview.device ?? 'mobile',
|
|
105
|
+
orientation: preview.orientation,
|
|
106
|
+
onDevice: preview.onDevice,
|
|
107
|
+
onOrientation: preview.onOrientation,
|
|
108
|
+
dataStates: model.preview,
|
|
109
|
+
data: !selected && model.preview?.includes(data) ? data : undefined,
|
|
110
|
+
onPlay: play,
|
|
111
|
+
partAt,
|
|
112
|
+
onShow,
|
|
113
|
+
onData: (choice) => {
|
|
70
114
|
if (model.alive() && model.preview?.includes(choice))
|
|
71
115
|
onNavigate({ data: choice });
|
|
72
|
-
},
|
|
116
|
+
},
|
|
117
|
+
play: current && (model.preview || opening)
|
|
73
118
|
? {
|
|
119
|
+
title: current.title,
|
|
74
120
|
step,
|
|
75
121
|
total: current.steps,
|
|
76
122
|
caption: caption?.key === current.key && caption.step === step ? caption.text : '',
|
|
77
123
|
pending: !ready,
|
|
78
|
-
onStep
|
|
79
|
-
if (selected &&
|
|
80
|
-
model.preview &&
|
|
81
|
-
model.alive() &&
|
|
82
|
-
next >= 0 &&
|
|
83
|
-
next < selected.steps)
|
|
84
|
-
onNavigate({ journey: selected, step: next, overlay: true });
|
|
85
|
-
},
|
|
124
|
+
onStep,
|
|
86
125
|
}
|
|
87
|
-
: undefined
|
|
126
|
+
: undefined,
|
|
127
|
+
});
|
|
128
|
+
return null;
|
|
88
129
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import type { PrototypeComment } from '../../app/prototype.ts';
|
|
3
3
|
import type { Level } from '../types.ts';
|
|
4
4
|
import { type PrototypeAppProps } from './PrototypeApp.tsx';
|
|
@@ -6,6 +6,7 @@ import type { PrototypeSnapshotProps } from './PrototypeSnapshot.tsx';
|
|
|
6
6
|
import type { PrototypeChecks } from './PrototypeVersionBar.tsx';
|
|
7
7
|
import { type ProtoView } from './protoView.ts';
|
|
8
8
|
import type { LoopMoment, LoopSample } from './types.ts';
|
|
9
|
+
import { type WorkspaceSetup } from './workspace-state.tsx';
|
|
9
10
|
export type PrototypeSample = Pick<LoopSample, 'product' | 'proto' | 'journeys' | 'choices'>;
|
|
10
11
|
/** The comp (`PrototypeComp`): shown in the app's place while `open`, else its summary below. */
|
|
11
12
|
export interface CompSlot {
|
|
@@ -44,9 +45,10 @@ export interface PrototypePageProps {
|
|
|
44
45
|
onPlayer?: (action: 'play' | 'next' | 'start') => void;
|
|
45
46
|
onData?: (data: ProtoView['data']) => void;
|
|
46
47
|
onMarks?: (on: boolean) => void;
|
|
47
|
-
onFullScreen?: () => void;
|
|
48
48
|
onCatchUp?: () => void;
|
|
49
49
|
onAction?: (action: string) => void;
|
|
50
50
|
level?: Level | null;
|
|
51
|
+
/** What marking adds to the workspace: the overlay over the device, the marks' count, the tool. */
|
|
52
|
+
workspace?: Pick<WorkspaceSetup, 'overlay' | 'changes' | 'tool' | 'onTool'>;
|
|
51
53
|
}
|
|
52
54
|
export declare function PrototypePage(props: PrototypePageProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// The product app first; saved review below it, and the existing scenes last.
|
|
3
3
|
import { useT } from '@buffcore/i18n/react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
4
5
|
import { IsolatedFrames } from '../../../components/frame-isolation.js';
|
|
5
6
|
import { Page } from '../../../components/Page.js';
|
|
6
7
|
import { Loading } from '../../../components/states.js';
|
|
@@ -17,9 +18,11 @@ import { PrototypeSimplePage } from './PrototypeSimplePage.js';
|
|
|
17
18
|
import { prototypeAddress } from './prototype-bridge.js';
|
|
18
19
|
import { PROTOTYPE_HOME_LAYOUT } from './prototype-home-layout.js';
|
|
19
20
|
import { canApprove, PROTO_VIEWS } from './protoView.js';
|
|
21
|
+
import { PrototypeWorkspace } from './workspace-state.js';
|
|
20
22
|
export function PrototypePage(props) {
|
|
21
23
|
const { sample, moment, view: suppliedView, onApprove } = props;
|
|
22
24
|
const t = useT();
|
|
25
|
+
const setup = useWorkspaceSetup(props);
|
|
23
26
|
const source = suppliedView ?? (moment ? PROTO_VIEWS[moment] : undefined);
|
|
24
27
|
const view = source && {
|
|
25
28
|
...source,
|
|
@@ -28,13 +31,34 @@ export function PrototypePage(props) {
|
|
|
28
31
|
if (!view)
|
|
29
32
|
return _jsx(Loading, {});
|
|
30
33
|
if (props.simple && props.home)
|
|
31
|
-
return (_jsx(PrototypeSimplePage, { ...props, view: view, preview: _jsx(
|
|
34
|
+
return (_jsx(PrototypeSimplePage, { ...props, view: view, preview: _jsx(PrototypeWorkspace, { setup: setup, children: _jsx(PrototypeApp, { ...props.home, preview: {
|
|
35
|
+
roles: sample.journeys,
|
|
36
|
+
device: view.device,
|
|
37
|
+
onDevice: props.onDevice,
|
|
38
|
+
orientation: view.orientation,
|
|
39
|
+
onOrientation: props.onOrientation,
|
|
40
|
+
} }) }) }));
|
|
32
41
|
const approve = canApprove(view);
|
|
33
42
|
const legacyHref = !props.home ? prototypeAddress(props.appUrl)?.href : undefined;
|
|
34
43
|
return (_jsx(HostSide, { subject: { change: sample.proto.change.id, version: view.version }, children: _jsxs(Page, { boundedHeader: !!props.home, crumbs: [prototypeCrumb(sample, view, t)].filter(Boolean), title: props.title ?? t('studio.frame.page.prototype'), sub: t(props.home ? 'studio.prototype.intro' : 'studio.loop.proto.lead', {
|
|
35
44
|
name: sample.product.name,
|
|
36
45
|
}), actions: !props.home && (approve || legacyHref) ? (_jsxs(Row, { children: [legacyHref && (_jsx("a", { href: legacyHref, target: "_blank", rel: "noopener noreferrer", style: { color: 'var(--brand-ink)' }, children: t('studio.loop.proto.open') })), approve && _jsx(ApproveBlock, { view: view, onApprove: onApprove })] })) : undefined, children: [props.home && _jsx("style", { children: PROTOTYPE_HOME_LAYOUT }), props.home ? (_jsxs(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: [_jsx("span", { "data-prototype-draft": true, title: t('studio.prototype.draft'), style: captionText, children: t('studio.prototype.draft') }), props.comp?.open && props.comp.view, _jsx("div", { hidden: props.comp?.open || undefined, style: { display: props.comp?.open ? 'none' : 'contents' }, children: _jsx(PrototypeApp, { ...props.home }) }), !props.comp?.open && props.comp?.summary, _jsx(PrototypeReview, { ...props, view: view, snapshotOk: (props.home.snapshotReady ?? props.home.running) && props.home.source !== 'missing' }), _jsx(PrototypeScenes, { ...props, view: view })] })) : (_jsxs(_Fragment, { children: [_jsx(DesignLevel, { level: props.level === null ? undefined : (props.level ?? 'guide'), needsRight: !!view.needsRight, named: hasRuleSigners(view.signatures) }), _jsx(ApproveWhy, { view: view }), _jsx(PrototypeReview, { ...props, view: view })] })), _jsx(Place, { id: "approve:prototype" })] }) }));
|
|
37
46
|
}
|
|
47
|
+
/** What the page gives the workspace, kept while none of it changes (the stage reads it). */
|
|
48
|
+
function useWorkspaceSetup({ sample, home, workspace }) {
|
|
49
|
+
const { consoleUrl, others, consoleOthers } = sample.proto;
|
|
50
|
+
const { overlay, changes, tool, onTool } = workspace ?? {};
|
|
51
|
+
const appUrl = home?.url;
|
|
52
|
+
return useMemo(() => ({
|
|
53
|
+
overlay,
|
|
54
|
+
changes,
|
|
55
|
+
tool,
|
|
56
|
+
onTool,
|
|
57
|
+
appUrl,
|
|
58
|
+
consoleUrl,
|
|
59
|
+
screens: { app: others, console: consoleOthers ?? [] },
|
|
60
|
+
}), [overlay, changes, tool, onTool, appUrl, consoleUrl, others, consoleOthers]);
|
|
61
|
+
}
|
|
38
62
|
function prototypeCrumb(sample, view, t) {
|
|
39
63
|
const { proto } = sample;
|
|
40
64
|
const picked = proto.lanes.find((lane) => lane.id === view.lane);
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Left, PlayableJourney } from './prototype-bridge.ts';
|
|
3
|
+
import type { DataState, ProtoView } from './protoView.ts';
|
|
4
|
+
import type { JourneyRole } from './types.ts';
|
|
5
|
+
import { type WorkspaceStage as Stage } from './workspace-state.tsx';
|
|
6
|
+
type Device = NonNullable<ProtoView['device']>;
|
|
7
|
+
type Orientation = NonNullable<ProtoView['orientation']>;
|
|
8
|
+
/** The customer app's journey playing: its step, the app's words for it, and how to move. */
|
|
3
9
|
export interface PreviewPlay {
|
|
10
|
+
title: string;
|
|
4
11
|
step: number;
|
|
5
12
|
total: number;
|
|
6
13
|
caption: string;
|
|
7
14
|
pending?: boolean;
|
|
8
15
|
onStep: (step: number) => void;
|
|
9
16
|
}
|
|
10
|
-
export
|
|
17
|
+
export interface PrototypePreviewProps {
|
|
18
|
+
product: string;
|
|
19
|
+
/** The customer app's frame, or what stands in for it. */
|
|
11
20
|
app: ReactNode;
|
|
21
|
+
ready?: boolean;
|
|
22
|
+
href?: string;
|
|
23
|
+
/** The plan's journeys, by role and app. */
|
|
24
|
+
roles: readonly JourneyRole[];
|
|
25
|
+
/** The journeys the running app plays. */
|
|
26
|
+
journeys: readonly PlayableJourney[];
|
|
27
|
+
left?: readonly Left[];
|
|
28
|
+
/** The app's journey playing (its key). */
|
|
29
|
+
journey?: string;
|
|
30
|
+
device: Device;
|
|
31
|
+
orientation?: Orientation;
|
|
32
|
+
onDevice?: (device: Device) => void;
|
|
33
|
+
onOrientation?: (orientation: Orientation) => void;
|
|
34
|
+
data?: DataState;
|
|
35
|
+
dataStates?: readonly DataState[];
|
|
36
|
+
onData?: (data: DataState) => void;
|
|
37
|
+
onPlay?: (key: string) => void;
|
|
12
38
|
play?: PreviewPlay;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
/** The running app's part at a point, and showing a marked place again (marking reads them). */
|
|
40
|
+
partAt?: Stage['partAt'];
|
|
41
|
+
onShow?: Stage['show'];
|
|
42
|
+
}
|
|
43
|
+
export declare function PrototypePreview(props: PrototypePreviewProps): import("react").JSX.Element;
|
|
44
|
+
export {};
|