@buffcore/admin-shell 0.8.40 → 0.8.42
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/admin.js +2 -1
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +7 -2
- package/dist/components/DeviceFrame.d.ts +6 -1
- package/dist/components/DeviceFrame.js +2 -2
- package/dist/components/look.d.ts +5 -0
- package/dist/components/look.js +5 -0
- package/dist/console-settings.js +4 -1
- package/dist/design-fonts.d.ts +5 -0
- package/dist/design-fonts.js +20 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +3 -0
- package/dist/i18n/es.json +3 -0
- package/dist/prototype/PageLook.js +3 -2
- package/dist/prototype/create.d.ts +3 -1
- package/dist/prototype/create.js +0 -1
- package/dist/prototype/page.d.ts +19 -2
- package/dist/prototype/page.js +20 -2
- package/dist/prototype/shown.js +1 -1
- package/dist/prototype/viewer.d.ts +2 -0
- package/dist/prototype/viewer.js +6 -2
- package/dist/workbench/app/ServedPrototype.js +19 -1
- package/dist/workbench/app/ServedSetup.js +8 -1
- package/dist/workbench/app/StudioApp.js +41 -20
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +3 -3
- package/dist/workbench/app/actions.d.ts +12 -1
- package/dist/workbench/app/actions.js +14 -2
- package/dist/workbench/app/ask-card.d.ts +10 -0
- package/dist/workbench/app/ask-card.js +34 -0
- package/dist/workbench/app/chat-session.d.ts +44 -0
- package/dist/workbench/app/chat.d.ts +59 -0
- package/dist/workbench/app/chat.js +1 -0
- package/dist/workbench/app/frame.js +4 -2
- package/dist/workbench/app/host-part-loader.d.ts +5 -2
- package/dist/workbench/app/host-part-module.d.ts +17 -0
- package/dist/workbench/app/host-part-module.js +55 -0
- package/dist/workbench/app/host-parts.d.ts +2 -11
- package/dist/workbench/app/host-parts.js +53 -67
- package/dist/workbench/app/level-choice.d.ts +3 -0
- package/dist/workbench/app/loop.js +10 -4
- package/dist/workbench/app/mount.d.ts +4 -1
- package/dist/workbench/app/mount.js +2 -2
- package/dist/workbench/app/panel-cards.d.ts +10 -0
- package/dist/workbench/app/panel-cards.js +29 -0
- package/dist/workbench/app/places.d.ts +17 -2
- package/dist/workbench/app/places.js +14 -2
- package/dist/workbench/app/scene-address.d.ts +10 -0
- package/dist/workbench/app/scene-address.js +14 -0
- package/dist/workbench/app/studio-post.js +2 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +30 -2
- package/dist/workbench/app/usePrototypeUi.js +14 -0
- package/dist/workbench/app/work.d.ts +7 -7
- package/dist/workbench/host-theme.d.ts +3 -0
- package/dist/workbench/host-theme.js +14 -0
- package/dist/workbench/index.d.ts +1 -0
- package/dist/workbench/index.js +1 -0
- package/dist/workbench/studio/frame/AllowFolderCard.d.ts +16 -0
- package/dist/workbench/studio/frame/AllowFolderCard.js +63 -0
- package/dist/workbench/studio/frame/HostRailEntries.d.ts +3 -0
- package/dist/workbench/studio/frame/HostRailEntries.js +15 -0
- package/dist/workbench/studio/frame/HostSide.d.ts +6 -0
- package/dist/workbench/studio/frame/HostSide.js +31 -0
- package/dist/workbench/studio/frame/LevelChip.js +2 -1
- package/dist/workbench/studio/frame/LevelChoices.js +24 -8
- package/dist/workbench/studio/frame/NeverAskSetting.d.ts +7 -0
- package/dist/workbench/studio/frame/NeverAskSetting.js +24 -0
- package/dist/workbench/studio/frame/PanelList.js +11 -3
- package/dist/workbench/studio/frame/PanelMessage.d.ts +2 -0
- package/dist/workbench/studio/frame/PanelMessage.js +1 -1
- package/dist/workbench/studio/frame/PanelNotice.js +2 -1
- package/dist/workbench/studio/frame/PanelPermission.d.ts +2 -0
- package/dist/workbench/studio/frame/PanelPermission.js +4 -0
- package/dist/workbench/studio/frame/PanelScenes.d.ts +5 -0
- package/dist/workbench/studio/frame/PanelScenes.js +38 -0
- package/dist/workbench/studio/frame/PermissionAskCard.d.ts +18 -0
- package/dist/workbench/studio/frame/PermissionAskCard.js +60 -0
- package/dist/workbench/studio/frame/PermissionAskFold.d.ts +12 -0
- package/dist/workbench/studio/frame/PermissionAskFold.js +54 -0
- package/dist/workbench/studio/frame/Place.d.ts +6 -2
- package/dist/workbench/studio/frame/Place.js +13 -5
- package/dist/workbench/studio/frame/PlatformsCard.d.ts +10 -0
- package/dist/workbench/studio/frame/PlatformsCard.js +26 -0
- package/dist/workbench/studio/frame/SettingsSheet.js +6 -1
- package/dist/workbench/studio/frame/StudioRail.js +2 -1
- package/dist/workbench/studio/frame/WaitingBanner.d.ts +5 -0
- package/dist/workbench/studio/frame/WaitingBanner.js +17 -0
- package/dist/workbench/studio/frame/panelControls.d.ts +29 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +1 -0
- package/dist/workbench/studio/frame/useTurnDraft.js +3 -1
- package/dist/workbench/studio/i18n/frame.en.d.ts +44 -0
- package/dist/workbench/studio/i18n/frame.en.js +45 -1
- package/dist/workbench/studio/i18n/frame.es.json +46 -2
- package/dist/workbench/studio/i18n/levels.en.d.ts +8 -3
- package/dist/workbench/studio/i18n/levels.en.js +8 -3
- package/dist/workbench/studio/i18n/levels.es.json +9 -4
- package/dist/workbench/studio/i18n/loop.en.d.ts +16 -0
- package/dist/workbench/studio/i18n/loop.en.js +18 -2
- package/dist/workbench/studio/i18n/loop.es.json +18 -2
- package/dist/workbench/studio/i18n/save.en.d.ts +1 -3
- package/dist/workbench/studio/i18n/save.en.js +13 -15
- package/dist/workbench/studio/i18n/save.es.json +14 -16
- package/dist/workbench/studio/i18n/structure.en.d.ts +6 -0
- package/dist/workbench/studio/i18n/structure.en.js +6 -0
- package/dist/workbench/studio/i18n/structure.es.d.ts +6 -0
- package/dist/workbench/studio/i18n/structure.es.js +6 -0
- package/dist/workbench/studio/loop/PrototypePage.js +4 -3
- package/dist/workbench/studio/loop/PrototypeScenes.js +1 -2
- package/dist/workbench/studio/loop/PrototypeSimplePage.js +7 -6
- package/dist/workbench/studio/loop/PrototypeSnapshot.js +5 -1
- package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
- package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
- package/dist/workbench/studio/loop/ServedBrand.js +3 -3
- package/dist/workbench/studio/loop/StructurePage.d.ts +2 -0
- package/dist/workbench/studio/loop/StructurePage.js +1 -1
- package/dist/workbench/studio/loop/StructurePreview.js +4 -4
- package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
- package/dist/workbench/studio/loop/step-state.d.ts +1 -1
- package/dist/workbench/studio/loop/step-state.js +9 -8
- package/dist/workbench/studio/loop/structure-answers.d.ts +8 -0
- package/dist/workbench/studio/loop/structure-answers.js +34 -0
- package/dist/workbench/studio/loop/usePlanningDraft.js +2 -1
- package/dist/workbench/studio/loop/usePlanningSave.d.ts +16 -2
- package/dist/workbench/studio/loop/usePlanningSave.js +40 -2
- package/dist/workbench/studio/loop/usePrototypeRecord.js +5 -4
- package/dist/workbench/studio/loop/useReviewedSave.d.ts +9 -4
- package/dist/workbench/studio/loop/useReviewedSave.js +89 -30
- package/dist/workbench/studio/run/LiveServers.js +1 -1
- package/dist/workbench/studio/run/ReleasePage.js +1 -1
- package/dist/workbench/studio/run/ReleasesPage.js +2 -2
- package/dist/workbench/studio/run/ServedRelease.js +1 -1
- package/dist/workbench/studio/run/WhereItRuns.d.ts +5 -0
- package/dist/workbench/studio/run/WhereItRuns.js +37 -17
- package/dist/workbench/studio/work/work-test-data.d.ts +4 -1
- package/package.json +6 -6
- package/vite.d.ts +6 -1
- package/vite.js +78 -5
|
@@ -34,5 +34,11 @@ declare const _default: {
|
|
|
34
34
|
'studio.structure.state.saved': string;
|
|
35
35
|
'studio.structure.next': string;
|
|
36
36
|
'studio.structure.wait': string;
|
|
37
|
+
'studio.structure.planned': string;
|
|
38
|
+
'studio.structure.a.none': string;
|
|
39
|
+
'studio.structure.a.main': string;
|
|
40
|
+
'studio.structure.a.people': string;
|
|
41
|
+
'studio.structure.a.screen': string;
|
|
42
|
+
'studio.structure.a.planned': string;
|
|
37
43
|
};
|
|
38
44
|
export default _default;
|
|
@@ -34,4 +34,10 @@ export default {
|
|
|
34
34
|
'studio.structure.state.saved': 'Guardado',
|
|
35
35
|
'studio.structure.next': 'Está bien. Haz el prototipo',
|
|
36
36
|
'studio.structure.wait': 'Revisa y guarda la estructura antes de hacer el prototipo.',
|
|
37
|
+
'studio.structure.planned': 'planificada, {change}',
|
|
38
|
+
'studio.structure.a.none': 'Responde esto en el chat',
|
|
39
|
+
'studio.structure.a.main': '{sections} quedan siempre a mano; {first} va primero.',
|
|
40
|
+
'studio.structure.a.people': '{who}: {sections}',
|
|
41
|
+
'studio.structure.a.screen': '{section} empieza en {screen}',
|
|
42
|
+
'studio.structure.a.planned': '{section} empezará en {screen} (planificada, {change})',
|
|
37
43
|
};
|
|
@@ -5,6 +5,7 @@ import { IsolatedFrames } from '../../../components/frame-isolation.js';
|
|
|
5
5
|
import { Page } from '../../../components/Page.js';
|
|
6
6
|
import { Loading } from '../../../components/states.js';
|
|
7
7
|
import { captionText } from '../../../components/styles.js';
|
|
8
|
+
import { HostSide } from '../frame/HostSide.js';
|
|
8
9
|
import { Place } from '../frame/Place.js';
|
|
9
10
|
import { Row } from '../work/parts.js';
|
|
10
11
|
import { hasRuleSigners } from './ApprovalSignatures.js';
|
|
@@ -30,9 +31,9 @@ export function PrototypePage(props) {
|
|
|
30
31
|
return (_jsx(PrototypeSimplePage, { ...props, view: view, preview: _jsx(PrototypeApp, { ...props.home, preview: { roles: sample.journeys, device: view.device, onDevice: props.onDevice } }) }));
|
|
31
32
|
const approve = canApprove(view);
|
|
32
33
|
const legacyHref = !props.home ? prototypeAddress(props.appUrl)?.href : undefined;
|
|
33
|
-
return (_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', {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
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
|
+
name: sample.product.name,
|
|
36
|
+
}), 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') }), _jsx(PrototypeApp, { ...props.home }), _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" })] }) }));
|
|
36
37
|
}
|
|
37
38
|
function prototypeCrumb(sample, view, t) {
|
|
38
39
|
const { proto } = sample;
|
|
@@ -2,7 +2,6 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { useLayout } from '../frame/layout.js';
|
|
5
|
-
import { Place } from '../frame/Place.js';
|
|
6
5
|
import { CanvasBar } from './CanvasBar.js';
|
|
7
6
|
import { ControlReason } from './ControlReason.js';
|
|
8
7
|
import { Canvas, Parts } from './ProtoCanvas.js';
|
|
@@ -26,7 +25,7 @@ function JourneyColumn(props) {
|
|
|
26
25
|
const journeys = sample.journeys.flatMap((role) => role.journeys);
|
|
27
26
|
const chosen = journeys.find((journey) => journey.id === view.journey) ?? journeys[0];
|
|
28
27
|
const show = !view.live || journeys.some((journey) => journey.steps.length > 0);
|
|
29
|
-
return (
|
|
28
|
+
return (_jsx(ControlReason, { style: { flex: '1 1 14rem', maxWidth: narrow ? undefined : '18rem' }, disabled: show && (!props.onJourney || !props.onPlayer || !chosen?.steps.length), children: show && (_jsx(ProtoJourneys, { ...props, step: view.step, journey: view.journey, playing: view.playing })) }));
|
|
30
29
|
}
|
|
31
30
|
export function PrototypeScenes(props) {
|
|
32
31
|
const t = useT();
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { visuallyHidden } from '../../../components/field.js';
|
|
4
4
|
import { IsolatedFrames } from '../../../components/frame-isolation.js';
|
|
5
|
+
import { HostSide } from '../frame/HostSide.js';
|
|
5
6
|
import { usePrototypeNarrow } from '../frame/layout.js';
|
|
6
7
|
import { Place } from '../frame/Place.js';
|
|
7
8
|
import { Compare } from './ProtoCompare.js';
|
|
@@ -22,12 +23,12 @@ export function PrototypeSimplePage(props) {
|
|
|
22
23
|
problems?.scrollIntoView({ block: 'start' });
|
|
23
24
|
}
|
|
24
25
|
: undefined;
|
|
25
|
-
return (_jsx(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: _jsx(PrototypeFocus, { value: focus, children: _jsxs("div", { ref: focus.root, style: { display: 'contents' }, children: [_jsxs("section", { "data-prototype-simple": true, style: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
return (_jsx(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: _jsx(PrototypeFocus, { value: focus, children: _jsxs("div", { ref: focus.root, style: { display: 'contents' }, children: [_jsx(HostSide, { subject: { change: sample.proto.change.id, version: view.version }, children: _jsxs("section", { "data-prototype-simple": true, style: {
|
|
27
|
+
display: 'grid',
|
|
28
|
+
gridTemplateRows: 'auto minmax(calc(var(--width-margin) * .6), 1fr)',
|
|
29
|
+
blockSize: '100%',
|
|
30
|
+
minBlockSize: 'calc(var(--width-margin) + var(--control-lg))',
|
|
31
|
+
}, children: [_jsx("h1", { id: prototypeHeadingId, tabIndex: -1, style: visuallyHidden, children: props.title ?? t('studio.frame.page.prototype') }), _jsx(PrototypeVersionBar, { ...props, checks: props.simple?.checks, onProblems: showProblems }), _jsx("div", { hidden: view.compare || undefined, style: { display: view.compare ? 'none' : 'grid', minBlockSize: 0 }, children: preview }), view.compare && _jsx(PrototypeComparison, { sample, view, onCompare, onPair })] }) }), home && (_jsxs("div", { style: {
|
|
31
32
|
display: 'grid',
|
|
32
33
|
padding: 'var(--space-4)',
|
|
33
34
|
gap: 'var(--space-3)',
|
|
@@ -49,7 +49,7 @@ export function PrototypeSnapshot(props) {
|
|
|
49
49
|
? sourceMissing
|
|
50
50
|
? 'studio.loop.snapshot.addChange'
|
|
51
51
|
: 'studio.loop.snapshot.empty'
|
|
52
|
-
: snapshotReadFailure(props.failure)) }))), reply?.source.dirty && !linked && (_jsx("p", { role: "status", children: t('studio.loop.snapshot.status.unsaved') })), saveNeeded && (_jsx(Button, { variant: props.quiet ? 'secondary' : undefined, size: "lg", style: button, disabled: running || record.busy, onClick: onSave, children: t('studio.loop.snapshot.save') })), _jsx(RecordFeedback, { result: record })] }), _jsxs(Panel, { title: t('studio.loop.snapshot.take'), children: [result && (_jsx("p", { role: "status", style: { margin: 0 }, children: t('studio.loop.snapshot.result', { count: result.scenes }) })), running && (_jsx("p", { role: "status", style: { margin: 0 }, children: t(reply?.status === 'running' && reply.progress?.total !== undefined
|
|
52
|
+
: snapshotReadFailure(props.failure)) }))), reply?.source.dirty && !linked && (_jsx("p", { role: "status", children: t('studio.loop.snapshot.status.unsaved') })), saveNeeded && !listing(record) && (_jsx(Button, { variant: props.quiet ? 'secondary' : undefined, size: "lg", style: button, disabled: running || record.busy, onClick: onSave, children: t('studio.loop.snapshot.save') })), _jsx(RecordFeedback, { result: record })] }), _jsxs(Panel, { title: t('studio.loop.snapshot.take'), children: [result && (_jsx("p", { role: "status", style: { margin: 0 }, children: t('studio.loop.snapshot.result', { count: result.scenes }) })), running && (_jsx("p", { role: "status", style: { margin: 0 }, children: t(reply?.status === 'running' && reply.progress?.total !== undefined
|
|
53
53
|
? 'studio.loop.snapshot.progress'
|
|
54
54
|
: 'studio.loop.snapshot.status.running', {
|
|
55
55
|
done: reply?.progress?.done ?? 0,
|
|
@@ -77,3 +77,7 @@ function Identity({ source }) {
|
|
|
77
77
|
const t = useT();
|
|
78
78
|
return (_jsxs("dl", { style: { ...stack, margin: 0, gap: 'var(--space-1)', overflowWrap: 'anywhere' }, children: [_jsx("dt", { style: captionText, children: t('studio.loop.snapshot.checkout') }), _jsx("dd", { translate: "no", style: { margin: 0 }, children: source.checkout }), _jsx("dt", { style: captionText, children: t('studio.loop.snapshot.commit') }), _jsx("dd", { translate: "no", style: { margin: 0 }, children: source.commit })] }));
|
|
79
79
|
}
|
|
80
|
+
/** The file list's own Save stands in for the panel's while the list shows. */
|
|
81
|
+
function listing(record) {
|
|
82
|
+
return ['loading', 'preview', 'changed', 'refused', 'saving'].includes(record.review?.phase ?? '');
|
|
83
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReviewedSave } from './useReviewedSave.ts';
|
|
2
|
-
/** The same
|
|
2
|
+
/** The same one-click save for every studio step: the files shown, ticked, and one Save. */
|
|
3
3
|
export declare function ReviewedSaveView({ save }: {
|
|
4
4
|
save: ReviewedSave;
|
|
5
5
|
}): import("react").JSX.Element;
|
|
@@ -15,7 +15,7 @@ const button = {
|
|
|
15
15
|
paddingBlock: 'var(--space-2)',
|
|
16
16
|
};
|
|
17
17
|
const code = { ...monoText, overflowWrap: 'anywhere' };
|
|
18
|
-
/** The same
|
|
18
|
+
/** The same one-click save for every studio step: the files shown, ticked, and one Save. */
|
|
19
19
|
export function ReviewedSaveView({ save }) {
|
|
20
20
|
const t = useT();
|
|
21
21
|
const completed = ['saved', 'recovery'].includes(save.phase);
|
|
@@ -25,13 +25,5 @@ export function ReviewedSaveView({ save }) {
|
|
|
25
25
|
gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, calc(var(--space-6) * 18)), 1fr))',
|
|
26
26
|
}, children: [_jsxs(Panel, { title: t(completed ? 'studio.save.savedFiles' : 'studio.save.title'), children: [!completed && _jsx("span", { children: t('studio.save.count', { count: save.files.length }) }), !completed && (_jsx("p", { style: { margin: 0 }, children: t(save.step === 'prototype'
|
|
27
27
|
? 'studio.save.prototypeSelectionRule'
|
|
28
|
-
: 'studio.save.selectionRule') })), _jsx(ReviewedSaveFiles, { save: save }), save.fingerprint && (_jsxs(_Fragment, { children: [_jsx("span", { children: t('studio.save.identity') }), _jsx("code", { translate: "no", style: code, children: save.fingerprint })] })), save.
|
|
29
|
-
save.reviewed === save.fingerprint &&
|
|
30
|
-
save.files.length
|
|
31
|
-
? save.confirm
|
|
32
|
-
: save.review, children: t(save.phase === 'reviewed' &&
|
|
33
|
-
save.reviewed === save.fingerprint &&
|
|
34
|
-
save.files.length
|
|
35
|
-
? 'studio.save.confirm'
|
|
36
|
-
: 'studio.save.review') })] }))] })), save.detail && (_jsx("p", { role: "status", style: { margin: 0, whiteSpace: 'pre-wrap' }, children: save.detail }))] }));
|
|
28
|
+
: 'studio.save.selectionRule') })), _jsx(ReviewedSaveFiles, { save: save }), save.fingerprint && (_jsxs(_Fragment, { children: [_jsx("span", { children: t('studio.save.identity') }), _jsx("code", { translate: "no", style: code, children: save.fingerprint })] })), save.commit && (_jsx("code", { translate: "no", style: code, children: save.commit }))] }), !completed && (_jsx(Panel, { title: t('studio.save.excluded'), children: _jsx("p", { style: { margin: 0 }, children: t('studio.save.excludeNote') }) }))] }), save.phase === 'recovery' && (_jsxs(_Fragment, { children: [_jsx("p", { style: { margin: 0 }, children: t('studio.save.recoveryNote') }), _jsx(Button, { size: "lg", style: button, onClick: save.reload, children: t('studio.save.reload') })] })), save.phase === 'refused' && (_jsxs(Panel, { title: t('studio.save.hook'), children: [save.refusal?.file && (_jsx("code", { translate: "no", style: code, children: savePathLabel(save.refusal.file) })), _jsx("p", { style: { margin: 0, whiteSpace: 'pre-wrap' }, children: save.refusal?.reason }), _jsx("p", { style: { margin: 0 }, children: t('studio.save.retryNote') }), _jsx(Button, { size: "lg", style: button, onClick: save.confirm, children: t('studio.save.retry') })] })), ['preview', 'changed'].includes(save.phase) && (_jsxs(_Fragment, { children: [!save.files.length && _jsx("p", { style: { margin: 0 }, children: t('studio.save.empty') }), !save.files.length && (_jsx(Button, { size: "lg", style: button, onClick: save.reload, children: t('studio.save.reload') })), save.checking && (_jsx("p", { role: "status", style: { margin: 0 }, children: t('studio.save.checking') })), _jsx(Button, { size: "lg", style: button, disabled: !save.files.length || !!save.checking, onClick: save.confirm, children: t('studio.save.confirm') })] }))] })), save.detail && (_jsx("p", { role: "status", style: { margin: 0, whiteSpace: 'pre-wrap' }, children: save.detail }))] }));
|
|
37
29
|
}
|
|
@@ -8,7 +8,7 @@ import { useIconUpload } from '../../app/useIcon.js';
|
|
|
8
8
|
import { BrandChangedCard, brandFrom } from './BrandApproval.js';
|
|
9
9
|
import { BrandPage } from './BrandPage.js';
|
|
10
10
|
import { useDesignApproval } from './useDesignApproval.js';
|
|
11
|
-
import { usePlanningSave } from './usePlanningSave.js';
|
|
11
|
+
import { useListOnOpen, usePlanningSave, viewerCanBuild } from './usePlanningSave.js';
|
|
12
12
|
export function ServedBrand(props) {
|
|
13
13
|
const { state, onStep, actions, iconSrc } = props;
|
|
14
14
|
const t = useT();
|
|
@@ -16,8 +16,7 @@ export function ServedBrand(props) {
|
|
|
16
16
|
const picked = direction ?? (state.plan?.brandChanged ? state.plan.theme : undefined);
|
|
17
17
|
const brand = productBrand(brandProps(state, t, picked), state, t);
|
|
18
18
|
const writing = state.chats?.some((chat) => !chat.change && chat.state === 'running') ?? false;
|
|
19
|
-
const
|
|
20
|
-
const upload = useIconUpload(!rights || rights === 'all' || rights.includes('build') ? actions.uploadIcon : undefined);
|
|
19
|
+
const upload = useIconUpload(viewerCanBuild(state) ? actions.uploadIcon : undefined);
|
|
21
20
|
const icon = brand.icon && {
|
|
22
21
|
...brand.icon,
|
|
23
22
|
src: iconSrc,
|
|
@@ -85,6 +84,7 @@ function BrandStep(props) {
|
|
|
85
84
|
const level = state.effectiveLevel;
|
|
86
85
|
const applied = state.plan?.theme === brand.brandPick.id;
|
|
87
86
|
const approval = brandApproval(state, brand);
|
|
87
|
+
useListOnOpen(approval ? undefined : draft, viewerCanBuild(state));
|
|
88
88
|
return (_jsxs(_Fragment, { children: [_jsx(BrandChangedCard, { changed: state.plan?.brandChanged }), _jsx(BrandPage, { sample: brand, icon: icon, level: level ?? null, picked: brand.brandPick.id, onPick: onPick, sub: applied
|
|
89
89
|
? brand.directions.find((item) => item.id === brand.brandPick.id)?.description
|
|
90
90
|
: t('studio.loop.brand.applying'), approvalPending: !applied, needsRight: missingApproval(state.viewer, 'approve:brand'), approvalWhy: !state.plan?.themeFingerprint ? t('studio.loop.brand.whyColors') : undefined, draft: approval ? undefined : draft, approval: approval, approvedBy: approval?.name, approvalResult: signing.result, ...brandHandlers(props, signing, applied && draft.save?.state === 'saved', t) })] }));
|
|
@@ -16,5 +16,5 @@ export function StructurePage(props) {
|
|
|
16
16
|
const why = problem ||
|
|
17
17
|
nextReason(draft, t) ||
|
|
18
18
|
(progress !== 'saved' ? t('studio.structure.wait') : undefined);
|
|
19
|
-
return (_jsxs(Page, { crumbs: [t('studio.frame.rail.step', { n: 5 }), t('studio.frame.page.structure')], title: t('studio.structure.title'), sub: t('studio.structure.sub'), actions: _jsx(ReasonButton, { size: "sm", disabled: !onNext, why: why, onClick: () => onNext?.(label), children: label }), children: [_jsx(Badge, { tone: progress === 'saved' ? 'success' : 'neutral', style: { justifySelf: 'start' }, children: t(`studio.structure.state.${progress}`) }), draft && progress !== 'not-started' && _jsx(StepNotes, { draft: draft, agent: agent }), problem && _jsx(Banner, { tone: "error", children: problem }), _jsx(TwoColumns, { main: _jsx(StructurePrompts, { ...props }), side: _jsx(StructureFile, { structure: structure, problem: problem }) })] }));
|
|
19
|
+
return (_jsxs(Page, { crumbs: [t('studio.frame.rail.step', { n: 5 }), t('studio.frame.page.structure')], title: t('studio.structure.title'), sub: t('studio.structure.sub'), actions: _jsx(ReasonButton, { size: "sm", disabled: !onNext, why: why, onClick: () => onNext?.(label), children: label }), children: [_jsx(Badge, { tone: progress === 'saved' ? 'success' : 'neutral', style: { justifySelf: 'start', alignSelf: 'flex-start' }, children: t(`studio.structure.state.${progress}`) }), draft && progress !== 'not-started' && _jsx(StepNotes, { draft: draft, agent: agent }), problem && _jsx(Banner, { tone: "error", children: problem }), _jsx(TwoColumns, { main: _jsx(StructurePrompts, { ...props }), side: _jsx(StructureFile, { structure: structure, problem: problem }) })] }));
|
|
20
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { Panel } from '../../../components/Panel.js';
|
|
4
|
-
import { bodyText, monoText } from '../../../components/styles.js';
|
|
4
|
+
import { bodyText, captionText, monoText } from '../../../components/styles.js';
|
|
5
5
|
export function StructureFile({ structure, problem, }) {
|
|
6
6
|
const t = useT();
|
|
7
7
|
return (_jsxs(Panel, { title: t('studio.structure.file'), children: [_jsx("code", { translate: "no", style: monoText, children: "plan/structure.md" }), _jsx("p", { style: { margin: 0 }, children: t('studio.structure.fileHelp') }), structure?.rows.length ? (_jsx(StructurePreview, { structure: structure })) : (_jsx("p", { style: { margin: 0 }, children: t(problem ? 'studio.structure.invalid' : 'studio.structure.empty') })), _jsx("p", { style: { ...bodyText, margin: 0 }, children: t('studio.structure.boundary') })] }));
|
|
@@ -12,15 +12,15 @@ function StructurePreview({ structure }) {
|
|
|
12
12
|
...bodyText,
|
|
13
13
|
borderCollapse: 'collapse',
|
|
14
14
|
inlineSize: '100%',
|
|
15
|
-
|
|
16
|
-
overflowWrap: '
|
|
15
|
+
// Words stay whole; a cell too long for a phone scrolls inside the table's own frame.
|
|
16
|
+
overflowWrap: 'break-word',
|
|
17
17
|
}, children: [_jsx("caption", { style: { textAlign: 'start', paddingBlockEnd: 'var(--space-2)' }, children: t('studio.structure.order') }), _jsx("thead", { children: _jsx("tr", { children: ['section', 'screen', 'who', 'place', 'main'].map((key) => (_jsx("th", { scope: "col", style: { textAlign: 'start', padding: 'var(--space-2)' }, children: t(`studio.structure.column.${key}`) }, key))) }) }), _jsx(StructureRows, { rows: structure.rows })] }) }), structure.notes.map((note) => (_jsx("p", { style: { margin: 0 }, children: note }, note)))] }));
|
|
18
18
|
}
|
|
19
19
|
function StructureRows({ rows }) {
|
|
20
20
|
const t = useT();
|
|
21
21
|
return (_jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: [
|
|
22
22
|
row.section,
|
|
23
|
-
row.screen,
|
|
23
|
+
row.planned ? (_jsxs(_Fragment, { children: [row.screen, _jsx("span", { style: { ...captionText, display: 'block' }, children: t('studio.structure.planned', { change: row.planned }) })] })) : (row.screen),
|
|
24
24
|
row.who,
|
|
25
25
|
row.place,
|
|
26
26
|
t(row.main ? 'studio.structure.yes' : 'studio.structure.no'),
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useT } from '@buffcore/i18n/react';
|
|
2
|
+
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { Panel } from '../../../components/Panel.js';
|
|
4
|
+
import { captionText } from '../../../components/styles.js';
|
|
4
5
|
import { ReasonButton } from './ReasonButton.js';
|
|
6
|
+
import { structureAnswers } from './structure-answers.js';
|
|
5
7
|
export function StructurePrompts(props) {
|
|
6
|
-
return (_jsxs(_Fragment, { children: [_jsx(StructureQuestions, {}), _jsx(StructureJourneys, { ...props })] }));
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx(StructureQuestions, { structure: props.structure }), _jsx(StructureJourneys, { ...props })] }));
|
|
7
9
|
}
|
|
8
|
-
|
|
10
|
+
/** Each question with its answer from `plan/structure.md`, or a pointer to the chat. */
|
|
11
|
+
function StructureQuestions({ structure }) {
|
|
9
12
|
const t = useT();
|
|
13
|
+
const { locale } = useLocale();
|
|
14
|
+
const answers = structureAnswers(structure, t, locale);
|
|
10
15
|
return (_jsxs(Panel, { title: t('studio.structure.questions'), children: [_jsx("ul", { style: {
|
|
11
16
|
margin: 0,
|
|
12
17
|
paddingInlineStart: 'var(--space-5)',
|
|
13
18
|
display: 'grid',
|
|
14
19
|
gap: 'var(--space-3)',
|
|
15
|
-
}, children: ['sections', 'main', 'people', 'screens'].map((key) => (
|
|
20
|
+
}, children: ['sections', 'main', 'people', 'screens'].map((key) => (_jsxs("li", { style: { display: 'grid', gap: 'var(--space-1)', minInlineSize: 0 }, children: [_jsx("strong", { style: { color: 'var(--text-strong)' }, children: t(`studio.structure.q.${key}`) }), answers[key].length ? (answers[key].map((answer) => (_jsx("span", { style: { overflowWrap: 'anywhere' }, children: answer }, answer)))) : (_jsx("span", { style: captionText, children: t('studio.structure.a.none') }))] }, key))) }), _jsx("p", { style: { margin: 0 }, children: t('studio.structure.askAgain') })] }));
|
|
16
21
|
}
|
|
17
22
|
function StructureJourneys({ agent, journeys, draft, onStart, structure, problem, }) {
|
|
18
23
|
const t = useT();
|
|
@@ -4,7 +4,7 @@ type StepReview = Pick<ReviewedSave, 'phase' | 'files' | 'candidates' | 'other'>
|
|
|
4
4
|
/**
|
|
5
5
|
* The one save decision for a step. Planning steps know their own unsaved files from the poll:
|
|
6
6
|
* none listed (or a review that offers none, also after a recovered commit) is clean, and a poll
|
|
7
|
-
* that lists one reopens a finished review. Every step stays unsaved while one of its own files
|
|
7
|
+
* that lists one reopens a finished review; Brand's own list offering none is clean too. Every step stays unsaved while one of its own files
|
|
8
8
|
* is left out of the save or cannot be saved here.
|
|
9
9
|
*/
|
|
10
10
|
export declare function stepState<R extends StepReview>(step: SaveStep, unsaved: readonly string[] | undefined, review: R | undefined, hasContent?: boolean, valid?: boolean): {
|
|
@@ -2,7 +2,7 @@ import { stepOwnsFile } from '@buffcore/contracts/workbench';
|
|
|
2
2
|
/**
|
|
3
3
|
* The one save decision for a step. Planning steps know their own unsaved files from the poll:
|
|
4
4
|
* none listed (or a review that offers none, also after a recovered commit) is clean, and a poll
|
|
5
|
-
* that lists one reopens a finished review. Every step stays unsaved while one of its own files
|
|
5
|
+
* that lists one reopens a finished review; Brand's own list offering none is clean too. Every step stays unsaved while one of its own files
|
|
6
6
|
* is left out of the save or cannot be saved here.
|
|
7
7
|
*/
|
|
8
8
|
export function stepState(step, unsaved, review, hasContent = true, valid = true) {
|
|
@@ -11,13 +11,14 @@ export function stepState(step, unsaved, review, hasContent = true, valid = true
|
|
|
11
11
|
const left = review?.other?.filter(owns) ?? [];
|
|
12
12
|
// Protected or secret step files are never offered, so the review leaves them out.
|
|
13
13
|
const blocked = left.some((file) => !review?.candidates.includes(file));
|
|
14
|
-
const
|
|
15
|
-
(review
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const offersNone = !!review &&
|
|
15
|
+
['preview', 'changed', 'saved'].includes(review.phase) &&
|
|
16
|
+
!review.files.length &&
|
|
17
|
+
!left.length &&
|
|
18
|
+
!review.candidates.some(owns);
|
|
19
|
+
// Brand has no poll of its own files, but its list (asked for on opening) can offer none.
|
|
20
|
+
const nothing = (planning && (review ? offersNone : unsaved?.some(owns) === false)) ||
|
|
21
|
+
(step === 'brand' && offersNone);
|
|
21
22
|
const saved = hasContent && valid && !left.length && (nothing || review?.phase === 'saved');
|
|
22
23
|
return {
|
|
23
24
|
progress: !hasContent
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { T } from '@buffcore/i18n';
|
|
2
|
+
import type { StructurePlan } from './StructurePage.tsx';
|
|
3
|
+
export type StructureQuestion = 'sections' | 'main' | 'people' | 'screens';
|
|
4
|
+
/**
|
|
5
|
+
* "Your app, in plain words": each question's answer, drawn only from the structure file's rows.
|
|
6
|
+
* No rows (or none that answer it) leaves the question for the chat: an empty list.
|
|
7
|
+
*/
|
|
8
|
+
export declare function structureAnswers(structure: StructurePlan | null | undefined, t: T, locale: string): Record<StructureQuestion, string[]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const unique = (values) => [...new Set(values)];
|
|
2
|
+
/**
|
|
3
|
+
* "Your app, in plain words": each question's answer, drawn only from the structure file's rows.
|
|
4
|
+
* No rows (or none that answer it) leaves the question for the chat: an empty list.
|
|
5
|
+
*/
|
|
6
|
+
export function structureAnswers(structure, t, locale) {
|
|
7
|
+
const rows = structure?.rows ?? [];
|
|
8
|
+
const list = (values) => new Intl.ListFormat(locale, { style: 'long', type: 'conjunction' }).format(unique(values));
|
|
9
|
+
const main = rows.filter((row) => row.main);
|
|
10
|
+
const people = unique(rows.map((row) => row.who));
|
|
11
|
+
return {
|
|
12
|
+
sections: rows.length ? [list(rows.map((row) => row.section))] : [],
|
|
13
|
+
main: main[0]
|
|
14
|
+
? [
|
|
15
|
+
t('studio.structure.a.main', {
|
|
16
|
+
sections: list(main.map((row) => row.section)),
|
|
17
|
+
first: main[0].section,
|
|
18
|
+
}),
|
|
19
|
+
]
|
|
20
|
+
: [],
|
|
21
|
+
people: people.map((who) => t('studio.structure.a.people', {
|
|
22
|
+
who,
|
|
23
|
+
sections: list(rows.filter((row) => row.who === who).map((row) => row.section)),
|
|
24
|
+
})),
|
|
25
|
+
// Two rows on one section and screen (for two kinds of people) answer once.
|
|
26
|
+
screens: unique(rows.map((row) => row.planned
|
|
27
|
+
? t('studio.structure.a.planned', {
|
|
28
|
+
section: row.section,
|
|
29
|
+
screen: row.screen,
|
|
30
|
+
change: row.planned,
|
|
31
|
+
})
|
|
32
|
+
: t('studio.structure.a.screen', { section: row.section, screen: row.screen }))),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -3,7 +3,7 @@ import { newChatFor } from '../../app/chat.js';
|
|
|
3
3
|
import { briefHasContent, briefProps } from '../../app/loop.js';
|
|
4
4
|
import { stepWaiting } from '../../app/loop-stage.js';
|
|
5
5
|
import { nextReason } from './SaveStep.js';
|
|
6
|
-
import { usePlanningSave } from './usePlanningSave.js';
|
|
6
|
+
import { useListOnArrival, usePlanningSave, viewerCanBuild } from './usePlanningSave.js';
|
|
7
7
|
function planningStep(page) {
|
|
8
8
|
return page === 'structure'
|
|
9
9
|
? 'structure'
|
|
@@ -28,6 +28,7 @@ export function usePlanningDraft({ state, page, actions, onStep }) {
|
|
|
28
28
|
const writing = state.chats?.some((chat) => chat.title === step && !chat.change && chat.state === 'running') ??
|
|
29
29
|
false;
|
|
30
30
|
const draft = usePlanningSave(state, step, actions, writing);
|
|
31
|
+
useListOnArrival(draft, step, state.plan?.unsaved, viewerCanBuild(state));
|
|
31
32
|
const hasContent = planningContent(state, page);
|
|
32
33
|
draft.why = writing
|
|
33
34
|
? t('studio.loop.planning.why.writing', { agent: briefProps(state).product.agent.name })
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type StudioState } from '@buffcore/contracts/workbench';
|
|
2
2
|
import type { SaveStep, StudioActions } from '../../app/actions.ts';
|
|
3
3
|
import type { StepDraft } from './SaveStep.tsx';
|
|
4
|
-
/** Every step
|
|
4
|
+
/** Every step saves through the same one-click flow: its files list themselves, then one Save. */
|
|
5
5
|
export declare function usePlanningSave(state: StudioState, step: SaveStep, actions: StudioActions, writing: boolean): StepDraft;
|
|
6
|
+
/** Saving and listing a step's files need the `build` right; a local studio has every right. */
|
|
7
|
+
export declare function viewerCanBuild(state: Pick<StudioState, 'viewer'>): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* One click saves (0.8.42): on a step page, the step's own unsaved files list themselves, ticked,
|
|
10
|
+
* so the person's one Save commits them. A page calls it beside its save; the save hook alone
|
|
11
|
+
* lists nothing until asked, and a viewer without the `build` right is never asked for a list.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useListOnArrival(draft: StepDraft, step: SaveStep, unsaved: readonly string[] | undefined, canBuild: boolean): void;
|
|
14
|
+
/**
|
|
15
|
+
* Brand's one click: the poll has no unsaved-files signal for its design files, so the page asks
|
|
16
|
+
* the server for its list once when it opens, and again when its files change (a new theme
|
|
17
|
+
* fingerprint or a finished turn opens a fresh review). A list offering none reads as saved.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useListOnOpen(draft: StepDraft | undefined, canBuild: boolean): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { stepOwnsFile } from '@buffcore/contracts/workbench';
|
|
1
2
|
import { useT } from '@buffcore/i18n/react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
3
4
|
import { stepState } from './step-state.js';
|
|
4
5
|
import { useReviewedSave } from './useReviewedSave.js';
|
|
5
|
-
/** Every step
|
|
6
|
+
/** Every step saves through the same one-click flow: its files list themselves, then one Save. */
|
|
6
7
|
export function usePlanningSave(state, step, actions, writing) {
|
|
7
8
|
const t = useT();
|
|
8
9
|
const saveWriting = state.chats?.some((chat) => !chat.change && chat.state === 'running') ?? false;
|
|
@@ -34,3 +35,40 @@ export function usePlanningSave(state, step, actions, writing) {
|
|
|
34
35
|
},
|
|
35
36
|
};
|
|
36
37
|
}
|
|
38
|
+
/** Saving and listing a step's files need the `build` right; a local studio has every right. */
|
|
39
|
+
export function viewerCanBuild(state) {
|
|
40
|
+
const rights = state.viewer?.rights;
|
|
41
|
+
return !rights || rights === 'all' || rights.includes('build');
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One click saves (0.8.42): on a step page, the step's own unsaved files list themselves, ticked,
|
|
45
|
+
* so the person's one Save commits them. A page calls it beside its save; the save hook alone
|
|
46
|
+
* lists nothing until asked, and a viewer without the `build` right is never asked for a list.
|
|
47
|
+
*/
|
|
48
|
+
export function useListOnArrival(draft, step, unsaved, canBuild) {
|
|
49
|
+
const listFiles = canBuild &&
|
|
50
|
+
!!draft.save?.unlisted &&
|
|
51
|
+
!draft.writing &&
|
|
52
|
+
draft.save.state !== 'writing' &&
|
|
53
|
+
!!unsaved?.some((file) => stepOwnsFile(step, file));
|
|
54
|
+
const { onSave } = draft;
|
|
55
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: list once each time it becomes needed.
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (listFiles)
|
|
58
|
+
onSave?.();
|
|
59
|
+
}, [listFiles]);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Brand's one click: the poll has no unsaved-files signal for its design files, so the page asks
|
|
63
|
+
* the server for its list once when it opens, and again when its files change (a new theme
|
|
64
|
+
* fingerprint or a finished turn opens a fresh review). A list offering none reads as saved.
|
|
65
|
+
*/
|
|
66
|
+
export function useListOnOpen(draft, canBuild) {
|
|
67
|
+
const listFiles = canBuild && !!draft?.save?.unlisted && !draft.writing && draft.save.state !== 'writing';
|
|
68
|
+
const onSave = draft?.onSave;
|
|
69
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: list once each time it becomes needed.
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (listFiles)
|
|
72
|
+
onSave?.();
|
|
73
|
+
}, [listFiles]);
|
|
74
|
+
}
|
|
@@ -70,10 +70,11 @@ export function usePrototypeRecord(actions, change, run, approving = false, vers
|
|
|
70
70
|
intent.current = { scope: change, record: true };
|
|
71
71
|
if (status.saved)
|
|
72
72
|
await saving.start();
|
|
73
|
-
else if (status.review
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
else if (status.review && ['preview', 'changed', 'refused'].includes(status.review.phase)) {
|
|
74
|
+
// The list shown is what Record saves: one click, its fingerprint checked by the server.
|
|
75
|
+
if (status.review.files.length && !status.review.checking)
|
|
76
|
+
status.review.confirm();
|
|
77
|
+
}
|
|
77
78
|
else {
|
|
78
79
|
setResult({ scope: change });
|
|
79
80
|
await saving.start();
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import type { SaveResult, SaveStep, StudioActions } from '../../app/actions.ts';
|
|
2
2
|
export interface ReviewedSave {
|
|
3
3
|
step?: SaveStep;
|
|
4
|
-
phase: 'loading' | 'preview' | '
|
|
4
|
+
phase: 'loading' | 'preview' | 'changed' | 'saving' | 'refused' | 'unknown' | 'saved' | 'recovery';
|
|
5
5
|
files: readonly string[];
|
|
6
6
|
candidates: readonly string[];
|
|
7
7
|
other?: readonly string[];
|
|
8
8
|
kinds?: SaveResult['kinds'];
|
|
9
9
|
earlierSnapshots?: readonly string[];
|
|
10
|
+
/** The server's fingerprint of the files shown; Save sends it, and only a match commits. */
|
|
10
11
|
fingerprint?: string;
|
|
11
|
-
|
|
12
|
+
/** Asking for a changed list's fingerprint; Save waits for it. */
|
|
13
|
+
checking?: boolean;
|
|
12
14
|
commit?: string;
|
|
13
15
|
refusal?: SaveResult['refused'];
|
|
14
16
|
detail?: string;
|
|
15
17
|
toggle: (file: string) => void;
|
|
16
|
-
review: () => void;
|
|
17
18
|
confirm: () => void;
|
|
18
19
|
reload: () => void;
|
|
19
20
|
}
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* One click saves (0.8.42): the list loads with the step's files ticked and the server's fingerprint
|
|
23
|
+
* of that list; Save sends it. A changed tick asks for the new list's fingerprint before Save works
|
|
24
|
+
* again. When the files changed since, the server answers with the new list ("changed").
|
|
25
|
+
*/
|
|
21
26
|
export declare function useReviewedSave(actions: StudioActions, step: SaveStep, scope: string, writing?: boolean, onSaved?: (saved: SaveResult) => Promise<void>): {
|
|
22
27
|
review: ReviewedSave | undefined;
|
|
23
28
|
start: () => Promise<void>;
|