@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
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { useT } from '@buffcore/i18n/react';
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
|
|
3
|
+
const sameFiles = (a, b) => a.length === b.length && a.every((file, index) => file === b[index]);
|
|
4
|
+
/**
|
|
5
|
+
* One click saves (0.8.42): the list loads with the step's files ticked and the server's fingerprint
|
|
6
|
+
* of that list; Save sends it. A changed tick asks for the new list's fingerprint before Save works
|
|
7
|
+
* again. When the files changed since, the server answers with the new list ("changed").
|
|
8
|
+
*/
|
|
4
9
|
export function useReviewedSave(actions, step, scope, writing = false, onSaved) {
|
|
5
10
|
const t = useT();
|
|
6
11
|
const [state, setState] = useState({ scope, visit: {} });
|
|
@@ -15,33 +20,88 @@ export function useReviewedSave(actions, step, scope, writing = false, onSaved)
|
|
|
15
20
|
};
|
|
16
21
|
}, [state.visit]);
|
|
17
22
|
const locked = useRef(false);
|
|
23
|
+
const refreshing = useRef(false);
|
|
24
|
+
const again = useRef(false);
|
|
25
|
+
const selection = useRef([]);
|
|
18
26
|
const visit = state.visit;
|
|
19
27
|
const update = (patch) => setState((current) => (current.visit === visit ? { ...current, ...patch } : current));
|
|
20
|
-
// A failed
|
|
28
|
+
// A failed check or save keeps the person's selection to retry; a failed load lists nothing
|
|
21
29
|
// old (a recovered commit keeps its files).
|
|
22
|
-
const failed = (detail,
|
|
23
|
-
? { phase: 'preview', fingerprint: undefined,
|
|
30
|
+
const failed = (detail, kept) => kept
|
|
31
|
+
? { phase: 'preview', fingerprint: undefined, detail }
|
|
24
32
|
: {
|
|
25
33
|
phase: 'unknown',
|
|
26
34
|
files: state.recovered ? state.files : [],
|
|
27
35
|
candidates: state.recovered ? state.candidates : [],
|
|
28
36
|
fingerprint: undefined,
|
|
29
|
-
reviewed: undefined,
|
|
30
37
|
detail,
|
|
31
38
|
};
|
|
39
|
+
const listed = (answer, phase) => {
|
|
40
|
+
selection.current = answer.preview ?? [];
|
|
41
|
+
return {
|
|
42
|
+
phase,
|
|
43
|
+
files: answer.preview,
|
|
44
|
+
other: answer.other,
|
|
45
|
+
commit: undefined,
|
|
46
|
+
candidates: answer.candidates ?? answer.preview,
|
|
47
|
+
kinds: answer.kinds,
|
|
48
|
+
earlierSnapshots: answer.earlierSnapshots,
|
|
49
|
+
fingerprint: answer.fingerprint,
|
|
50
|
+
refusal: answer.refused,
|
|
51
|
+
detail: undefined,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
// A changed tick asks for the fingerprint of the new list. One question at a time: ticks made
|
|
55
|
+
// while one is out ask again with the latest list, and only that answer counts.
|
|
56
|
+
const refresh = async (same = 'preview') => {
|
|
57
|
+
if (refreshing.current) {
|
|
58
|
+
again.current = true;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
refreshing.current = true;
|
|
62
|
+
update({ checking: true });
|
|
63
|
+
try {
|
|
64
|
+
let files;
|
|
65
|
+
let answer;
|
|
66
|
+
do {
|
|
67
|
+
again.current = false;
|
|
68
|
+
files = selection.current;
|
|
69
|
+
if (!files.length)
|
|
70
|
+
return;
|
|
71
|
+
answer =
|
|
72
|
+
step === 'prototype'
|
|
73
|
+
? await actions.save(step, undefined, files, scope)
|
|
74
|
+
: await actions.save(step, undefined, files);
|
|
75
|
+
if (activeVisit.current !== visit)
|
|
76
|
+
return;
|
|
77
|
+
} while (again.current);
|
|
78
|
+
if (answer.preview && answer.fingerprint)
|
|
79
|
+
update(listed(answer, sameFiles(answer.preview, files) ? same : 'changed'));
|
|
80
|
+
else
|
|
81
|
+
update(failed(answer.detail ?? t('studio.save.failed'), files));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
update(failed(t('studio.save.failed'), selection.current));
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
refreshing.current = false;
|
|
88
|
+
update({ checking: undefined });
|
|
89
|
+
}
|
|
90
|
+
};
|
|
32
91
|
const request = async (confirm = false, files) => {
|
|
33
|
-
if (locked.current || writing)
|
|
92
|
+
if (locked.current || refreshing.current || writing)
|
|
34
93
|
return;
|
|
35
|
-
if (confirm && (!state.
|
|
94
|
+
if (confirm && (!state.fingerprint || !files?.length))
|
|
36
95
|
return;
|
|
37
96
|
locked.current = true;
|
|
97
|
+
let recheck = false;
|
|
38
98
|
update({
|
|
39
99
|
phase: confirm ? 'saving' : 'loading',
|
|
40
100
|
detail: undefined,
|
|
41
101
|
...(!confirm && !state.recovered ? { commit: undefined } : {}),
|
|
42
102
|
});
|
|
43
103
|
try {
|
|
44
|
-
const proof = confirm ? state.
|
|
104
|
+
const proof = confirm ? state.fingerprint : undefined;
|
|
45
105
|
// Only a prototype save names its change, so main can refuse one that lives in a checkout.
|
|
46
106
|
const answer = step === 'prototype'
|
|
47
107
|
? await actions.save(step, proof, files, scope)
|
|
@@ -57,7 +117,6 @@ export function useReviewedSave(actions, step, scope, writing = false, onSaved)
|
|
|
57
117
|
candidates: undefined,
|
|
58
118
|
commit: undefined,
|
|
59
119
|
fingerprint: undefined,
|
|
60
|
-
reviewed: undefined,
|
|
61
120
|
refusal: undefined,
|
|
62
121
|
detail: undefined,
|
|
63
122
|
recovered: undefined,
|
|
@@ -76,18 +135,12 @@ export function useReviewedSave(actions, step, scope, writing = false, onSaved)
|
|
|
76
135
|
await onSaved?.(answer);
|
|
77
136
|
}
|
|
78
137
|
else if (answer.preview && answer.fingerprint) {
|
|
138
|
+
// A check that changed the files hands back the fingerprint Save sent: ask for the new
|
|
139
|
+
// list's own, so the one Save after "changed" can commit it.
|
|
140
|
+
recheck = confirm && !answer.refused && answer.fingerprint === proof;
|
|
79
141
|
update({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
other: answer.other,
|
|
83
|
-
commit: undefined,
|
|
84
|
-
candidates: answer.candidates ?? answer.preview,
|
|
85
|
-
kinds: answer.kinds,
|
|
86
|
-
earlierSnapshots: answer.earlierSnapshots,
|
|
87
|
-
fingerprint: answer.fingerprint,
|
|
88
|
-
reviewed: answer.refused || (!confirm && files) ? answer.fingerprint : undefined,
|
|
89
|
-
refusal: answer.refused,
|
|
90
|
-
detail: undefined,
|
|
142
|
+
...listed(answer, answer.refused ? 'refused' : confirm ? 'changed' : 'preview'),
|
|
143
|
+
...(recheck ? { fingerprint: undefined } : {}),
|
|
91
144
|
});
|
|
92
145
|
}
|
|
93
146
|
else
|
|
@@ -99,6 +152,8 @@ export function useReviewedSave(actions, step, scope, writing = false, onSaved)
|
|
|
99
152
|
finally {
|
|
100
153
|
locked.current = false;
|
|
101
154
|
}
|
|
155
|
+
if (recheck)
|
|
156
|
+
await refresh('changed');
|
|
102
157
|
};
|
|
103
158
|
const current = state.scope === scope ? state : { scope, visit: {} };
|
|
104
159
|
const review = current.phase && {
|
|
@@ -110,28 +165,32 @@ export function useReviewedSave(actions, step, scope, writing = false, onSaved)
|
|
|
110
165
|
kinds: current.kinds,
|
|
111
166
|
earlierSnapshots: current.earlierSnapshots,
|
|
112
167
|
fingerprint: current.fingerprint,
|
|
113
|
-
|
|
168
|
+
checking: current.checking,
|
|
114
169
|
commit: current.commit,
|
|
115
170
|
refusal: current.refusal,
|
|
116
171
|
detail: current.detail,
|
|
117
172
|
toggle: (file) => {
|
|
118
173
|
if (locked.current || writing || current.phase === 'saved')
|
|
119
174
|
return;
|
|
175
|
+
const ticked = selection.current.includes(file)
|
|
176
|
+
? selection.current.filter((path) => path !== file)
|
|
177
|
+
: [...selection.current, file];
|
|
178
|
+
// The candidates' order, as the server lists a selection.
|
|
179
|
+
selection.current = (current.candidates ?? ticked).filter((path) => ticked.includes(path));
|
|
120
180
|
update({
|
|
121
181
|
phase: 'preview',
|
|
122
|
-
|
|
182
|
+
fingerprint: undefined,
|
|
123
183
|
refusal: undefined,
|
|
124
|
-
files: current
|
|
125
|
-
? current.files.filter((path) => path !== file)
|
|
126
|
-
: [...(current.files ?? []), file],
|
|
184
|
+
files: selection.current,
|
|
127
185
|
});
|
|
186
|
+
void refresh();
|
|
128
187
|
},
|
|
129
|
-
|
|
130
|
-
if (current.files?.length)
|
|
131
|
-
void request(false, current.files);
|
|
132
|
-
},
|
|
188
|
+
// Without a fingerprint (its question failed), Save asks again first; one already out waits.
|
|
133
189
|
confirm: () => {
|
|
134
|
-
|
|
190
|
+
if (current.fingerprint)
|
|
191
|
+
void request(true, current.files);
|
|
192
|
+
else if (!refreshing.current)
|
|
193
|
+
void refresh();
|
|
135
194
|
},
|
|
136
195
|
reload: () => {
|
|
137
196
|
void request();
|
|
@@ -60,7 +60,7 @@ function Server({ v }) {
|
|
|
60
60
|
const t = useT();
|
|
61
61
|
const tx = useTx();
|
|
62
62
|
const when = useWhen();
|
|
63
|
-
return (_jsxs(Panel, { title: _jsxs(Row, { children: [_jsx(Icon, { name: "circle-check" }), v.name, " ", _jsx(Mono, { children: v.host })] }), action: _jsxs(Row, { children: [_jsx(Badge, { icon: "user", children: t('studio.later.srv.youRun') }), _jsx(Badge, { children: _jsx(Mono, { children: v.version }) })] }), children: [_jsxs("span", { style: muted, children: [_jsx(D, { children: v.at }), " \u00B7 ", t('studio.later.srv.size', v.size)] }), v.off ? (_jsxs(Banner, { tone: "info", title: tx('studio.later.srv.off', { host: v.host }, { time: when.time(v.since ?? '') }), children: [t('studio.later.srv.offLine'), " ", tx('studio.later.srv.last', { version: v.version })] })) : (_jsxs(_Fragment, { children: [_jsx(Status, { v: v }), _jsx(Actions, { v: v })] })), _jsxs(Foot, { children: [t(v.off ? 'studio.later.srv.readThen' : 'studio.later.srv.read'), ' ', _jsx(Mono, { children: `ssh ${v.host} sudo docker compose logs` })] }), _jsx(Place, { id: "card:server", passed: v })] }));
|
|
63
|
+
return (_jsxs(Panel, { title: _jsxs(Row, { children: [_jsx(Icon, { name: "circle-check" }), v.name, " ", _jsx(Mono, { children: v.host })] }), action: _jsxs(Row, { children: [_jsx(Badge, { icon: "user", children: t('studio.later.srv.youRun') }), _jsx(Badge, { children: _jsx(Mono, { children: v.version }) })] }), children: [_jsxs("span", { style: muted, children: [_jsx(D, { children: v.at }), " \u00B7 ", t('studio.later.srv.size', v.size)] }), v.off ? (_jsxs(Banner, { tone: "info", title: tx('studio.later.srv.off', { host: v.host }, { time: when.time(v.since ?? '') }), children: [t('studio.later.srv.offLine'), " ", tx('studio.later.srv.last', { version: v.version })] })) : (_jsxs(_Fragment, { children: [_jsx(Status, { v: v }), _jsx(Actions, { v: v })] })), _jsxs(Foot, { children: [t(v.off ? 'studio.later.srv.readThen' : 'studio.later.srv.read'), ' ', _jsx(Mono, { children: `ssh ${v.host} sudo docker compose logs` })] }), _jsx(Place, { id: "card:server", passed: v, subject: v })] }));
|
|
64
64
|
}
|
|
65
65
|
export function LiveServers({ servers }) {
|
|
66
66
|
const t = useT();
|
|
@@ -27,5 +27,5 @@ function SampleRelease({ release: r, needsRight, onAction, }) {
|
|
|
27
27
|
gap: 'var(--space-4)',
|
|
28
28
|
gridTemplateColumns: 'repeat(auto-fit, minmax(min(22rem,100%), 1fr))',
|
|
29
29
|
alignItems: 'start',
|
|
30
|
-
}, children: [_jsxs(Stack, { children: [_jsx(Measured, { r: r }), _jsx(Where, { onAction: onAction, r: r })] }), _jsxs(Panel, { title: _jsxs(Row, { children: [_jsx(Seal, {}), t('studio.later.rel.gate')] }), children: [_jsxs("p", { style: muted, children: [t('studio.later.rel.gateLine'), " ", _jsx(Mono, { children: "ape deploy" })] }), _jsx(Row, { children: _jsx(RightAction, { onClick: () => onAction?.('rel.approve'), disabled: !onAction, icon: "shield-check", needsRight: needsRight, children: t('studio.later.rel.approve') }) }), _jsx(Place, { id: "approve:release" }), _jsx(Place, { id: "side:release" })] })] })] }));
|
|
30
|
+
}, children: [_jsxs(Stack, { children: [_jsx(Measured, { r: r }), _jsx(Where, { onAction: onAction, r: r })] }), _jsxs(Panel, { title: _jsxs(Row, { children: [_jsx(Seal, {}), t('studio.later.rel.gate')] }), children: [_jsxs("p", { style: muted, children: [t('studio.later.rel.gateLine'), " ", _jsx(Mono, { children: "ape deploy" })] }), _jsx(Row, { children: _jsx(RightAction, { onClick: () => onAction?.('rel.approve'), disabled: !onAction, icon: "shield-check", needsRight: needsRight, children: t('studio.later.rel.approve') }) }), _jsx(Place, { id: "approve:release", subject: { release: r.version } }), _jsx(Place, { id: "side:release" })] })] })] }));
|
|
31
31
|
}
|
|
@@ -26,7 +26,7 @@ function ServerCard({ s, runBy }) {
|
|
|
26
26
|
display: 'grid',
|
|
27
27
|
gap: 'var(--space-1)',
|
|
28
28
|
borderColor: s.state === 'hurt' ? 'var(--error-border)' : undefined,
|
|
29
|
-
}, children: [_jsxs(Row, { style: { justifyContent: 'space-between' }, children: [_jsx("strong", { style: strong, children: s.here ? t('studio.frame.rail.computer') : s.name }), _jsx(Badge, { status: s.state === 'ok' ? 'healthy' : 'down', children: _jsx(Mono, { children: s.version }) })] }), _jsx(Mono, { children: s.host }), _jsx("span", { style: muted, children: s.state === 'hurt' ? t('studio.later.rels.hurt') : s.note ? _jsx(D, { children: s.note }) : null }), runBy && !s.here && _jsx("span", { style: small, children: t('studio.later.rels.youRun') }), _jsx(Place, { id: "card:server", passed: s })] }));
|
|
29
|
+
}, children: [_jsxs(Row, { style: { justifyContent: 'space-between' }, children: [_jsx("strong", { style: strong, children: s.here ? t('studio.frame.rail.computer') : s.name }), _jsx(Badge, { status: s.state === 'ok' ? 'healthy' : 'down', children: _jsx(Mono, { children: s.version }) })] }), _jsx(Mono, { children: s.host }), _jsx("span", { style: muted, children: s.state === 'hurt' ? t('studio.later.rels.hurt') : s.note ? _jsx(D, { children: s.note }) : null }), runBy && !s.here && _jsx("span", { style: small, children: t('studio.later.rels.youRun') }), _jsx(Place, { id: "card:server", passed: s, subject: s })] }));
|
|
30
30
|
}
|
|
31
31
|
export function ServerCards({ servers, runBy, }) {
|
|
32
32
|
const t = useT();
|
|
@@ -56,7 +56,7 @@ function History({ rows, onAction, }) {
|
|
|
56
56
|
}
|
|
57
57
|
function Ready({ ready, onAction, }) {
|
|
58
58
|
const t = useT();
|
|
59
|
-
return (_jsxs(Panel, { title: _jsxs(Row, { children: [_jsx(Seal, {}), t('studio.later.rels.ready', { v: ready.v })] }), children: [_jsxs("p", { style: muted, children: [_jsx(D, { children: ready.what }), " ", t('studio.later.rels.readyLine')] }), _jsx(Row, { children: _jsx(Button, { onClick: () => onAction?.('rels.approve'), disabled: !onAction, icon: "shield-check", children: t('studio.later.rels.approve', { v: ready.v }) }) }), _jsx(Place, { id: "approve:release" })] }));
|
|
59
|
+
return (_jsxs(Panel, { title: _jsxs(Row, { children: [_jsx(Seal, {}), t('studio.later.rels.ready', { v: ready.v })] }), children: [_jsxs("p", { style: muted, children: [_jsx(D, { children: ready.what }), " ", t('studio.later.rels.readyLine')] }), _jsx(Row, { children: _jsx(Button, { onClick: () => onAction?.('rels.approve'), disabled: !onAction, icon: "shield-check", children: t('studio.later.rels.approve', { v: ready.v }) }) }), _jsx(Place, { id: "approve:release", subject: { release: ready.v } })] }));
|
|
60
60
|
}
|
|
61
61
|
function Stores({ stores }) {
|
|
62
62
|
const t = useT();
|
|
@@ -91,5 +91,5 @@ export function ServedRelease({ release, server = { destination: '', addressKind
|
|
|
91
91
|
return (_jsxs(Page, { title: t('studio.frame.page.release'), sub: t('studio.release.intro'), actions: _jsx(Button, { disabled: !onReleases, variant: "secondary", onClick: onReleases, style: actionStyle, children: t('studio.frame.place.release') }), children: [_jsx(Place, { id: "tabs:release" }), _jsx(WithHostSide, { id: "side:release", children: _jsxs(Stack, { children: [_jsx(DestinationPanel, { server: server, onServer: onServer, busy: busy, onReview: d.review }), _jsx(ReleasePrerequisites, { rows: rows, main: release.main }), _jsx(Decision, { statusKey: status, reason: reason, blocked: blocked, busy: busy, deploy: release.runs.deploy, onApprove: () => {
|
|
92
92
|
if (!blocked)
|
|
93
93
|
void d.decide(() => onRun?.('deploy', { ...server }));
|
|
94
|
-
} }), _jsx(Place, { id: "approve:release" })] }) })] }));
|
|
94
|
+
} }), _jsx(Place, { id: "approve:release", subject: release.main ? { release: release.main } : undefined })] }) })] }));
|
|
95
95
|
}
|
|
@@ -26,5 +26,10 @@ export interface WhereItRunsProps {
|
|
|
26
26
|
};
|
|
27
27
|
onEnable?: (platform: Platform, id: string) => void;
|
|
28
28
|
onDisable?: (platform: Platform) => void;
|
|
29
|
+
/** Chosen in a chat's platforms card: the section scrolls into view and opens each change's sheet. */
|
|
30
|
+
wanted?: {
|
|
31
|
+
ios: boolean;
|
|
32
|
+
android: boolean;
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
35
|
export declare function WhereItRuns(props: WhereItRunsProps): import("react").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// Setup's "Where it runs": Web is always on; iOS and Android are switches. Turning one on asks for its
|
|
3
3
|
// store ID first; turning one off confirms. The runner's refusal is one sentence under the row.
|
|
4
4
|
import { useT } from '@buffcore/i18n/react';
|
|
5
|
-
import { useState } from 'react';
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { Banner } from '../../../components/Banner.js';
|
|
7
7
|
import { Panel } from '../../../components/Panel.js';
|
|
8
8
|
import { Switch } from '../../../components/Switch.js';
|
|
@@ -11,6 +11,15 @@ import { captionText } from '../../../components/styles.js';
|
|
|
11
11
|
import { Foot, List, muted, strong } from '../work/parts.js';
|
|
12
12
|
import { TurnOffSheet, TurnOnSheet } from './StoreIdSheet.js';
|
|
13
13
|
import { suggestStoreId } from './store-id-suggest.js';
|
|
14
|
+
/** The sheets that turn the platforms into the wanted ones, in the rows' order. */
|
|
15
|
+
function changes(props) {
|
|
16
|
+
const { platforms, wanted } = props;
|
|
17
|
+
if (!platforms || !wanted)
|
|
18
|
+
return [];
|
|
19
|
+
return ['ios', 'android']
|
|
20
|
+
.filter((p) => platforms[p].on !== wanted[p])
|
|
21
|
+
.map((p) => ({ platform: p, mode: wanted[p] ? 'on' : 'off' }));
|
|
22
|
+
}
|
|
14
23
|
function stateLine(facts, t) {
|
|
15
24
|
if (!facts.on)
|
|
16
25
|
return t('studio.start.where.off');
|
|
@@ -29,21 +38,32 @@ function Row({ name, line, on, disabled, onChange, refusal, }) {
|
|
|
29
38
|
}
|
|
30
39
|
export function WhereItRuns(props) {
|
|
31
40
|
const t = useT();
|
|
32
|
-
const [
|
|
41
|
+
const [queue, setQueue] = useState(() => changes(props));
|
|
42
|
+
const [open, setOpen] = useState(props.open ?? queue[0] ?? null);
|
|
43
|
+
const section = useRef(null);
|
|
33
44
|
const { platforms } = props;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const chosen = !!props.wanted;
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (chosen)
|
|
48
|
+
section.current?.scrollIntoView?.({ block: 'start' });
|
|
49
|
+
}, [chosen]);
|
|
50
|
+
const close = () => {
|
|
51
|
+
const next = queue.filter((change) => change.platform !== open?.platform);
|
|
52
|
+
setQueue(next);
|
|
53
|
+
setOpen(next[0] ?? null);
|
|
54
|
+
};
|
|
55
|
+
return (_jsx("div", { ref: section, style: { scrollMarginBlockStart: 'var(--space-4)' }, children: _jsxs(Panel, { title: t('studio.start.where.title'), children: [platforms ? (_jsxs(List, { gap: "var(--space-4)", children: [_jsx(Row, { name: t('studio.start.where.web'), line: t('studio.start.where.webWhy'), on: true, disabled: true }), ['ios', 'android'].map((p) => (_jsx(Row, { name: t(`studio.start.where.${p}`), line: stateLine(platforms[p], t), on: platforms[p].on, disabled: platforms[p].on ? !props.onDisable : !props.onEnable, onChange: () => setOpen({ platform: p, mode: platforms[p].on ? 'off' : 'on' }), refusal: props.refusal?.platform === p ? props.refusal.text : undefined }, p)))] })) : (_jsx(EmptyState, { title: t('admin.status.unknown') })), _jsx(Foot, { children: t('studio.start.where.foot') }), platforms && open?.mode === 'on' && (_jsx(TurnOnSheet, { platform: open.platform, suggestion: suggestStoreId({
|
|
56
|
+
current: platforms[open.platform].id,
|
|
57
|
+
placeholder: platforms[open.platform].placeholder,
|
|
58
|
+
domain: props.domain,
|
|
59
|
+
name: props.name,
|
|
60
|
+
}), onEnable: props.onEnable &&
|
|
61
|
+
((p, id) => {
|
|
62
|
+
props.onEnable?.(p, id);
|
|
63
|
+
close();
|
|
64
|
+
}), onCancel: close })), platforms && open?.mode === 'off' && (_jsx(TurnOffSheet, { platform: open.platform, onDisable: props.onDisable &&
|
|
65
|
+
((p) => {
|
|
66
|
+
props.onDisable?.(p);
|
|
67
|
+
close();
|
|
68
|
+
}), onCancel: close }))] }) }));
|
|
49
69
|
}
|
|
@@ -23,6 +23,7 @@ export declare function scaleFacts(): {
|
|
|
23
23
|
model?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", string>> | undefined;
|
|
24
24
|
effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
|
|
25
25
|
level: "auto" | "guide" | "lead" | "review";
|
|
26
|
+
neverAsk?: boolean | undefined;
|
|
26
27
|
} | null;
|
|
27
28
|
found: {
|
|
28
29
|
id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
|
|
@@ -220,6 +221,7 @@ export declare function scaleFacts(): {
|
|
|
220
221
|
who: string;
|
|
221
222
|
place: string;
|
|
222
223
|
main: boolean;
|
|
224
|
+
planned?: string | undefined;
|
|
223
225
|
}[];
|
|
224
226
|
notes: string[];
|
|
225
227
|
problem?: string | undefined;
|
|
@@ -307,7 +309,7 @@ export declare function scaleFacts(): {
|
|
|
307
309
|
at: string;
|
|
308
310
|
commit: string;
|
|
309
311
|
change?: string | undefined;
|
|
310
|
-
direction?: "neutral" | "soft" | undefined;
|
|
312
|
+
direction?: "bold" | "clear" | "neutral" | "soft" | "warm" | undefined;
|
|
311
313
|
version?: number | undefined;
|
|
312
314
|
screen?: string | undefined;
|
|
313
315
|
revert?: string | undefined;
|
|
@@ -329,6 +331,7 @@ export declare function scaleFacts(): {
|
|
|
329
331
|
} | undefined;
|
|
330
332
|
committedLevel?: "auto" | "guide" | "lead" | "review" | undefined;
|
|
331
333
|
effectiveLevel?: "auto" | "guide" | "lead" | "review" | undefined;
|
|
334
|
+
neverAsk?: boolean | undefined;
|
|
332
335
|
level?: {
|
|
333
336
|
source: "host";
|
|
334
337
|
where: 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.42",
|
|
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/
|
|
41
|
-
"@buffcore/
|
|
42
|
-
"@buffcore/tokens": "0.8.
|
|
43
|
-
"@buffcore/
|
|
44
|
-
"@buffcore/
|
|
40
|
+
"@buffcore/config": "0.8.42",
|
|
41
|
+
"@buffcore/contracts": "0.8.42",
|
|
42
|
+
"@buffcore/tokens": "0.8.42",
|
|
43
|
+
"@buffcore/i18n": "0.8.42",
|
|
44
|
+
"@buffcore/sdk": "0.8.42"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=19",
|
package/vite.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
// Types for vite.js. The plugin's hooks are Vite's; a Vite config takes it as a plugin.
|
|
2
2
|
export const SERVICE_WORKER: '/firebase-messaging-sw.js';
|
|
3
3
|
export const MANIFEST: '/manifest.webmanifest';
|
|
4
|
+
export const FONT_LIST: 'buffcore-fonts';
|
|
5
|
+
|
|
6
|
+
/** The design system's font files (`design/fonts/` beside the product's `buffcore.config.ts`). */
|
|
7
|
+
export function designFontFiles(from: string): string[];
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
* Serves BuffCore's files at the console's root, in development and in the build: Firebase's
|
|
7
|
-
* service worker for pages on this device,
|
|
11
|
+
* service worker for pages on this device, a web app manifest for the home screen, and the design
|
|
12
|
+
* system's font files (`/_fonts/`), listed in the page for the console to load.
|
|
8
13
|
*/
|
|
9
14
|
export function adminConsole(options: { name: string }): { name: string };
|
package/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// `@buffcore/admin-shell/vite`: what the admin console needs from its Vite app. Plain JavaScript, so
|
|
2
2
|
// Node loads it in a product's vite.config.ts from node_modules.
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
|
-
import { dirname, join } from 'node:path';
|
|
3
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
7
7
|
// import.meta.url, which Vite keeps when it bundles a config that imports this file.
|
|
@@ -9,6 +9,37 @@ const here = dirname(fileURLToPath(import.meta.url));
|
|
|
9
9
|
|
|
10
10
|
export const SERVICE_WORKER = '/firebase-messaging-sw.js';
|
|
11
11
|
export const MANIFEST = '/manifest.webmanifest';
|
|
12
|
+
/** The element of the console's page that lists the design system's font files. */
|
|
13
|
+
export const FONT_LIST = 'buffcore-fonts';
|
|
14
|
+
|
|
15
|
+
const FONT_TYPES = { woff2: 'font/woff2', woff: 'font/woff', ttf: 'font/ttf', otf: 'font/otf' };
|
|
16
|
+
const fontType = (/** @type {string} */ file) =>
|
|
17
|
+
FONT_TYPES[/** @type {keyof typeof FONT_TYPES} */ (file.split('.').pop()?.toLowerCase() ?? '')];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The design system's font files (`design/fonts/` beside the product's `buffcore.config.ts`, the
|
|
21
|
+
* nearest one up from the console's folder, inside its repository), read each time: none when
|
|
22
|
+
* the folder is missing.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} from The console's folder.
|
|
25
|
+
* @returns {string[]}
|
|
26
|
+
*/
|
|
27
|
+
export function designFontFiles(from) {
|
|
28
|
+
let dir = resolve(from);
|
|
29
|
+
while (!existsSync(join(dir, 'buffcore.config.ts'))) {
|
|
30
|
+
if (dirname(dir) === dir || existsSync(join(dir, '.git'))) return [];
|
|
31
|
+
dir = dirname(dir);
|
|
32
|
+
}
|
|
33
|
+
const fonts = join(dir, 'design', 'fonts');
|
|
34
|
+
try {
|
|
35
|
+
return readdirSync(fonts, { withFileTypes: true })
|
|
36
|
+
.filter((entry) => entry.isFile() && fontType(entry.name))
|
|
37
|
+
.map((entry) => join(fonts, entry.name))
|
|
38
|
+
.sort();
|
|
39
|
+
} catch {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
12
43
|
|
|
13
44
|
/**
|
|
14
45
|
* Serves BuffCore's files at the console's root, in development and in the build, so a product
|
|
@@ -18,6 +49,10 @@ export const MANIFEST = '/manifest.webmanifest';
|
|
|
18
49
|
* @param {{ name: string }} options The name under the icon on the home screen.
|
|
19
50
|
*/
|
|
20
51
|
export function adminConsole({ name }) {
|
|
52
|
+
// Where the console's files are served from, once Vite has read its config.
|
|
53
|
+
let root = process.cwd();
|
|
54
|
+
let base = '/';
|
|
55
|
+
const fontPath = (/** @type {string} */ file) => `_fonts/${encodeURIComponent(basename(file))}`;
|
|
21
56
|
const files = {
|
|
22
57
|
[SERVICE_WORKER]: {
|
|
23
58
|
type: 'text/javascript',
|
|
@@ -39,22 +74,60 @@ export function adminConsole({ name }) {
|
|
|
39
74
|
const address = URL.parse(process.env.APE_ADMIN_URL ?? '');
|
|
40
75
|
return { server: { host: address?.hostname === '[::1]' ? '::1' : '127.0.0.1' } };
|
|
41
76
|
},
|
|
77
|
+
/** @param {{ root: string, base: string }} config */
|
|
78
|
+
configResolved(config) {
|
|
79
|
+
root = config.root;
|
|
80
|
+
base = config.base;
|
|
81
|
+
},
|
|
42
82
|
/** @param {{ middlewares: { use: (handler: (req: { url?: string }, res: import('node:http').ServerResponse, next: () => void) => void) => void } }} server */
|
|
43
83
|
configureServer(server) {
|
|
44
84
|
server.middlewares.use((req, res, next) => {
|
|
45
|
-
const
|
|
85
|
+
const path = new URL(req.url ?? '/', 'http://console').pathname;
|
|
86
|
+
// The design system's fonts, by name: only the files listed, never a path.
|
|
87
|
+
const font = path.startsWith(`${base}_fonts/`)
|
|
88
|
+
? designFontFiles(root).find((file) => `${base}${fontPath(file)}` === path)
|
|
89
|
+
: undefined;
|
|
90
|
+
if (font) {
|
|
91
|
+
res.setHeader('Content-Type', fontType(font) ?? 'application/octet-stream');
|
|
92
|
+
res.end(readFileSync(font));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const file = files[path];
|
|
46
96
|
if (!file) return next();
|
|
47
97
|
res.setHeader('Content-Type', file.type);
|
|
48
98
|
res.end(file.source);
|
|
49
99
|
});
|
|
50
100
|
},
|
|
51
|
-
/** @this {{ emitFile: (file: { type: 'asset'; fileName: string; source: string }) => void }} */
|
|
101
|
+
/** @this {{ emitFile: (file: { type: 'asset'; fileName: string; source: string | Uint8Array }) => void }} */
|
|
52
102
|
generateBundle() {
|
|
53
103
|
for (const [path, file] of Object.entries(files))
|
|
54
104
|
this.emitFile({ type: 'asset', fileName: path.slice(1), source: file.source });
|
|
105
|
+
for (const font of designFontFiles(root))
|
|
106
|
+
this.emitFile({
|
|
107
|
+
type: 'asset',
|
|
108
|
+
fileName: decodeURIComponent(fontPath(font)),
|
|
109
|
+
source: readFileSync(font),
|
|
110
|
+
});
|
|
55
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* The manifest's link, and the design system's font files for the console to match to its
|
|
114
|
+
* theme's families (`designFontCss`): a list the page reads, never runs.
|
|
115
|
+
*/
|
|
56
116
|
transformIndexHtml() {
|
|
57
|
-
|
|
117
|
+
const fonts = designFontFiles(root).map((font) => `${base}${fontPath(font)}`);
|
|
118
|
+
return [
|
|
119
|
+
{ tag: 'link', attrs: { rel: 'manifest', href: MANIFEST }, injectTo: 'head' },
|
|
120
|
+
...(fonts.length
|
|
121
|
+
? [
|
|
122
|
+
{
|
|
123
|
+
tag: 'script',
|
|
124
|
+
attrs: { type: 'application/json', id: FONT_LIST },
|
|
125
|
+
children: JSON.stringify(fonts).replaceAll('<', '\\u003c'),
|
|
126
|
+
injectTo: 'head',
|
|
127
|
+
},
|
|
128
|
+
]
|
|
129
|
+
: []),
|
|
130
|
+
];
|
|
58
131
|
},
|
|
59
132
|
};
|
|
60
133
|
}
|