@buffcore/admin-shell 0.8.41 → 0.8.43
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/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/screens/assistant/use-ask.d.ts +4 -3
- package/dist/workbench/app/ServedAgents.js +4 -1
- package/dist/workbench/app/ServedComp.d.ts +3 -0
- package/dist/workbench/app/ServedComp.js +33 -0
- package/dist/workbench/app/ServedPrototype.js +28 -1
- package/dist/workbench/app/StudioApp.js +29 -20
- package/dist/workbench/app/actions.d.ts +10 -1
- package/dist/workbench/app/actions.js +9 -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 +34 -0
- package/dist/workbench/app/chat.d.ts +39 -0
- package/dist/workbench/app/frame.js +4 -2
- package/dist/workbench/app/fresh.d.ts +63 -0
- package/dist/workbench/app/fresh.js +66 -0
- 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/mount.d.ts +4 -1
- package/dist/workbench/app/mount.js +2 -2
- package/dist/workbench/app/panel-cards.d.ts +3 -3
- package/dist/workbench/app/panel-cards.js +3 -2
- package/dist/workbench/app/places.d.ts +18 -3
- package/dist/workbench/app/places.js +14 -2
- package/dist/workbench/app/prototype-comp.d.ts +46 -0
- package/dist/workbench/app/prototype-comp.js +77 -0
- package/dist/workbench/app/prototype.d.ts +1 -1
- package/dist/workbench/app/prototype.js +3 -1
- 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 +1 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +35 -8
- package/dist/workbench/app/usePrototypeUi.js +14 -0
- package/dist/workbench/app/useStudio.d.ts +43 -1
- package/dist/workbench/app/useStudio.js +8 -1
- 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/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/LimitCard.d.ts +5 -0
- package/dist/workbench/studio/frame/LimitCard.js +26 -0
- 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 +5 -2
- package/dist/workbench/studio/frame/PanelMessage.js +3 -0
- package/dist/workbench/studio/frame/PanelNotice.js +2 -1
- 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/SettingsSheet.js +6 -1
- package/dist/workbench/studio/frame/StudioRail.js +2 -1
- package/dist/workbench/studio/frame/panelControls.d.ts +17 -0
- package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
- package/dist/workbench/studio/frame/panelLines.js +2 -1
- package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.en.js +26 -0
- package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.es.js +25 -0
- package/dist/workbench/studio/i18n/frame.en.d.ts +39 -0
- package/dist/workbench/studio/i18n/frame.en.js +39 -0
- package/dist/workbench/studio/i18n/frame.es.json +40 -1
- package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
- package/dist/workbench/studio/i18n/fresh.en.js +20 -0
- package/dist/workbench/studio/i18n/fresh.es.json +18 -0
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/i18n/levels.en.d.ts +5 -0
- package/dist/workbench/studio/i18n/levels.en.js +5 -0
- package/dist/workbench/studio/i18n/levels.es.json +6 -1
- package/dist/workbench/studio/i18n/loop.en.d.ts +4 -0
- package/dist/workbench/studio/i18n/loop.en.js +4 -0
- package/dist/workbench/studio/i18n/loop.es.json +4 -0
- 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/AgentsPage.d.ts +4 -1
- package/dist/workbench/studio/loop/AgentsPage.js +5 -4
- package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
- package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
- package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
- package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
- package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
- package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
- package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -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 +15 -7
- package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
- package/dist/workbench/studio/loop/PrototypeSnapshot.js +7 -2
- package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
- package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
- package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
- package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
- package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
- package/dist/workbench/studio/loop/SaveStep.js +3 -1
- package/dist/workbench/studio/loop/ServedBrand.js +3 -3
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StructurePage.d.ts +7 -0
- package/dist/workbench/studio/loop/StructurePage.js +3 -2
- package/dist/workbench/studio/loop/StructurePreview.js +4 -4
- package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
- package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
- package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
- 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 +7 -2
- 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/work/work-test-data.d.ts +9 -4
- package/package.json +6 -6
- package/vite.d.ts +6 -1
- package/vite.js +78 -5
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { Theme } from '@buffcore/tokens';
|
|
1
2
|
import { type StudioAppProps } from './StudioApp.tsx';
|
|
2
3
|
export type StudioMountProps = Omit<StudioAppProps, 'dark' | 'onDark'> & {
|
|
3
4
|
/** The local CLI or host's choice; absent it, the browser chooses. */
|
|
4
5
|
locale?: string;
|
|
6
|
+
/** A host's theme, checked before it gets here (`createUiServer({ theme })`); absent, the studio's own. */
|
|
7
|
+
theme?: Theme;
|
|
5
8
|
};
|
|
6
|
-
export declare function StudioRoot({ locale, ...props }: StudioMountProps): import("react").JSX.Element;
|
|
9
|
+
export declare function StudioRoot({ locale, theme: hostTheme, ...props }: StudioMountProps): import("react").JSX.Element;
|
|
7
10
|
/** Mounts the opt-in studio; polling stops when the caller unmounts it. */
|
|
8
11
|
export declare function mountStudio(element: Element, props: StudioMountProps): () => void;
|
|
@@ -11,13 +11,13 @@ import { pageMode } from '../studio/frame/layout.js';
|
|
|
11
11
|
import { studioCatalog } from '../studio/i18n/index.js';
|
|
12
12
|
import { theme } from '../theme.js';
|
|
13
13
|
import { StudioApp } from './StudioApp.js';
|
|
14
|
-
export function StudioRoot({ locale, ...props }) {
|
|
14
|
+
export function StudioRoot({ locale, theme: hostTheme, ...props }) {
|
|
15
15
|
const translator = useMemo(() => createI18n({
|
|
16
16
|
catalogs: [adminCatalog, workbenchCatalog, studioCatalog],
|
|
17
17
|
locale: matchLocale(locale || globalThis.navigator?.languages, ['en', 'es']),
|
|
18
18
|
}), [locale]);
|
|
19
19
|
const [dark, setDark] = useState(() => resolvePageMode(pageMode()) === 'dark');
|
|
20
|
-
return (_jsxs(I18nProvider, { translator: translator, children: [_jsx(PageLook, { theme: theme, mode: dark ? 'dark' : 'light', locale: translator.instance.language }), _jsx("div", { style: { height: '100dvh' }, children: _jsx(StudioApp, { ...props, dark: dark, onDark: () => setDark((mode) => !mode) }) })] }));
|
|
20
|
+
return (_jsxs(I18nProvider, { translator: translator, children: [_jsx(PageLook, { theme: hostTheme ?? theme, mode: dark ? 'dark' : 'light', locale: translator.instance.language }), _jsx("div", { style: { height: '100dvh' }, children: _jsx(StudioApp, { ...props, dark: dark, onDark: () => setDark((mode) => !mode) }) })] }));
|
|
21
21
|
}
|
|
22
22
|
/** Mounts the opt-in studio; polling stops when the caller unmounts it. */
|
|
23
23
|
export function mountStudio(element, props) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { StudioState } from '@buffcore/contracts/workbench';
|
|
2
|
-
import type { ControlledAgent } from '../studio/frame/panelControls.ts';
|
|
2
|
+
import type { ControlledAgent, TurnControls } from '../studio/frame/panelControls.ts';
|
|
3
3
|
import type { StudioPage } from '../studio/types.ts';
|
|
4
4
|
import type { StudioActions } from './actions.ts';
|
|
5
5
|
/**
|
|
6
6
|
* The chat's two cards: "Allow this folder" for a person with the settings right (the server
|
|
7
7
|
* checks it again and reads the folder from the chat), and the platforms card, which only opens
|
|
8
|
-
* Setup with the chosen switches.
|
|
8
|
+
* Setup with the chosen switches; and the agent's permission card, when the turn waits on one.
|
|
9
9
|
*/
|
|
10
|
-
export declare function withPanelCards(agent: ControlledAgent, state: StudioState, chat: string, actions: StudioActions, onGo: (page: StudioPage) => void, wanted: NonNullable<StudioActions['platformsWanted']
|
|
10
|
+
export declare function withPanelCards(agent: ControlledAgent, state: StudioState, chat: string, actions: StudioActions, onGo: (page: StudioPage) => void, wanted: NonNullable<StudioActions['platformsWanted']>, ask?: TurnControls['ask']): ControlledAgent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The chat's two cards: "Allow this folder" for a person with the settings right (the server
|
|
3
3
|
* checks it again and reads the folder from the chat), and the platforms card, which only opens
|
|
4
|
-
* Setup with the chosen switches.
|
|
4
|
+
* Setup with the chosen switches; and the agent's permission card, when the turn waits on one.
|
|
5
5
|
*/
|
|
6
|
-
export function withPanelCards(agent, state, chat, actions, onGo, wanted) {
|
|
6
|
+
export function withPanelCards(agent, state, chat, actions, onGo, wanted, ask) {
|
|
7
7
|
actions.platformsWanted = wanted;
|
|
8
8
|
const rights = state.viewer?.rights;
|
|
9
9
|
const settings = !rights || rights === 'all' || rights.includes('settings');
|
|
@@ -18,6 +18,7 @@ export function withPanelCards(agent, state, chat, actions, onGo, wanted) {
|
|
|
18
18
|
...agent.turn,
|
|
19
19
|
...(settings && allow && chat ? { onAllowFolder: (at) => allow(chat, at) } : {}),
|
|
20
20
|
...(platforms ? { platforms } : {}),
|
|
21
|
+
...(ask ? { ask } : {}),
|
|
21
22
|
onPlatforms: (choice) => {
|
|
22
23
|
// An absent choice (unknown platforms) opens Setup with nothing chosen.
|
|
23
24
|
wanted.current = choice;
|
|
@@ -5,7 +5,17 @@ export interface HostPart {
|
|
|
5
5
|
id: string;
|
|
6
6
|
/** Host-supplied, already localized badge and navigation label. */
|
|
7
7
|
label?: string;
|
|
8
|
-
|
|
8
|
+
/** `subject` is the plain JSON a place with one passes (beside a prototype, a release approval, a server card). */
|
|
9
|
+
draw(state: StudioState, passed?: unknown, subject?: unknown): ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** A host's rail entries, drawn as rail rows; each opens its `page` part of the same id. */
|
|
12
|
+
export interface HostRail {
|
|
13
|
+
label?: string;
|
|
14
|
+
entries: readonly {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
}[];
|
|
9
19
|
}
|
|
10
20
|
export type HostParts = Partial<Record<DrawPlaceId, readonly HostPart[]>>;
|
|
11
21
|
type Selection = {
|
|
@@ -16,6 +26,7 @@ type Selection = {
|
|
|
16
26
|
interface PlacesValue {
|
|
17
27
|
state: StudioState;
|
|
18
28
|
parts?: HostParts;
|
|
29
|
+
rail?: HostRail;
|
|
19
30
|
page: StudioPage;
|
|
20
31
|
selected?: Selection;
|
|
21
32
|
select: (place?: DrawPlaceId, id?: string) => void;
|
|
@@ -23,7 +34,7 @@ interface PlacesValue {
|
|
|
23
34
|
export declare const usePlaces: () => PlacesValue | null;
|
|
24
35
|
/** Only the two approvals in today's facts can supply a record; the rest stay unknown. */
|
|
25
36
|
export declare function placeApproval(id: PlaceId, state: StudioState): {
|
|
26
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
37
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
27
38
|
signatures: {
|
|
28
39
|
by: string;
|
|
29
40
|
at: string;
|
|
@@ -44,8 +55,12 @@ export declare function placeApproval(id: PlaceId, state: StudioState): {
|
|
|
44
55
|
by: string;
|
|
45
56
|
} | undefined;
|
|
46
57
|
} | undefined;
|
|
58
|
+
/** A subject as plain JSON: no functions, class instances or shared references reach a part. */
|
|
59
|
+
export declare function plainSubject(subject: unknown): unknown;
|
|
47
60
|
/** Only the container supplies facts; the views read this optional rendering input. */
|
|
48
|
-
export declare function StudioPlaces({ state, parts, page, children, }: Pick<PlacesValue, 'state' | 'parts' | 'page'> & {
|
|
61
|
+
export declare function StudioPlaces({ state, parts, rail, page, opened, children, }: Pick<PlacesValue, 'state' | 'parts' | 'rail' | 'page'> & {
|
|
62
|
+
/** A host page or tab open from the start (the review scenes draw one open). */
|
|
63
|
+
opened?: Pick<Selection, 'place' | 'id'>;
|
|
49
64
|
children: ReactNode;
|
|
50
65
|
}): import("react").FunctionComponentElement<import("react").ProviderProps<PlacesValue | null>>;
|
|
51
66
|
export {};
|
|
@@ -11,14 +11,26 @@ export function placeApproval(id, state) {
|
|
|
11
11
|
?.approval;
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
|
+
/** A subject as plain JSON: no functions, class instances or shared references reach a part. */
|
|
15
|
+
export function plainSubject(subject) {
|
|
16
|
+
if (subject === undefined)
|
|
17
|
+
return undefined;
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(JSON.stringify(subject));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
14
25
|
/** Only the container supplies facts; the views read this optional rendering input. */
|
|
15
|
-
export function StudioPlaces({ state, parts, page, children, }) {
|
|
16
|
-
const [selection, setSelection] = useState();
|
|
26
|
+
export function StudioPlaces({ state, parts, rail, page, opened, children, }) {
|
|
27
|
+
const [selection, setSelection] = useState(opened && { ...opened, page });
|
|
17
28
|
const selected = selection?.page === page ? selection : undefined;
|
|
18
29
|
return createElement(PlacesContext.Provider, {
|
|
19
30
|
value: {
|
|
20
31
|
state,
|
|
21
32
|
parts,
|
|
33
|
+
rail,
|
|
22
34
|
page,
|
|
23
35
|
selected,
|
|
24
36
|
select: (place, id) => setSelection(place && id ? { place, id, page } : undefined),
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type PrototypeCompReply } from '@buffcore/contracts/workbench';
|
|
2
|
+
export interface CompReads {
|
|
3
|
+
read: (signal?: AbortSignal) => Promise<PrototypeCompReply | undefined>;
|
|
4
|
+
picture: (name: string, signal?: AbortSignal) => Promise<Blob | undefined>;
|
|
5
|
+
approve: (fingerprint: string) => Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare function compReads(fetch: typeof globalThis.fetch, headers: Record<string, string>, post: (path: string, body: unknown) => Promise<unknown>): CompReads;
|
|
8
|
+
export declare function usePrototypeComp(reads: CompReads | undefined, every?: number): {
|
|
9
|
+
reply: {
|
|
10
|
+
surface: "desktop" | "phone";
|
|
11
|
+
width: number;
|
|
12
|
+
screens: {
|
|
13
|
+
key: string;
|
|
14
|
+
title: string;
|
|
15
|
+
light?: string | undefined;
|
|
16
|
+
dark?: string | undefined;
|
|
17
|
+
}[];
|
|
18
|
+
references: (string | null)[];
|
|
19
|
+
fingerprint?: string | undefined;
|
|
20
|
+
approved: boolean;
|
|
21
|
+
approval: {
|
|
22
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
23
|
+
signatures: {
|
|
24
|
+
by: string;
|
|
25
|
+
at: string;
|
|
26
|
+
commit: string;
|
|
27
|
+
fingerprint: string;
|
|
28
|
+
role?: string | undefined;
|
|
29
|
+
agent?: string | undefined;
|
|
30
|
+
}[];
|
|
31
|
+
rule?: {
|
|
32
|
+
kind: "one";
|
|
33
|
+
of: string[];
|
|
34
|
+
} | {
|
|
35
|
+
kind: "two";
|
|
36
|
+
of: string[];
|
|
37
|
+
} | {
|
|
38
|
+
kind: "majority";
|
|
39
|
+
of: string[];
|
|
40
|
+
by: string;
|
|
41
|
+
} | undefined;
|
|
42
|
+
} | null;
|
|
43
|
+
} | undefined;
|
|
44
|
+
pictures: Record<string, string>;
|
|
45
|
+
reload: () => void | undefined;
|
|
46
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// The comp page's reads: the comp (screens, references, approval) and each picture by name, as
|
|
2
|
+
// object addresses the page draws. Re-read while the page is open, so a redrawn comp shows.
|
|
3
|
+
import { prototypeCompReplySchema, workbenchApi, } from '@buffcore/contracts/workbench';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
export function compReads(fetch, headers, post) {
|
|
6
|
+
return {
|
|
7
|
+
read: async (signal) => {
|
|
8
|
+
try {
|
|
9
|
+
const res = await fetch(workbenchApi.prototypeComp, { headers, signal });
|
|
10
|
+
return res.ok ? prototypeCompReplySchema.parse(await res.json()) : undefined;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
picture: async (name, signal) => {
|
|
17
|
+
const res = await fetch(`${workbenchApi.prototypeComp}/picture/${encodeURIComponent(name)}`, {
|
|
18
|
+
headers,
|
|
19
|
+
signal,
|
|
20
|
+
});
|
|
21
|
+
return res.ok ? res.blob() : undefined;
|
|
22
|
+
},
|
|
23
|
+
approve: (fingerprint) => post('/api/approve', { kind: 'comp', fingerprint }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** The pictures' names a reply asks for, with what makes each one new (the comp's fingerprint). */
|
|
27
|
+
const wanted = (reply) => [
|
|
28
|
+
...reply.screens.flatMap((screen) => [screen.light, screen.dark].filter((n) => n !== undefined)),
|
|
29
|
+
...reply.references.filter((name) => name !== null),
|
|
30
|
+
];
|
|
31
|
+
export function usePrototypeComp(reads, every = 5000) {
|
|
32
|
+
const [reply, setReply] = useState();
|
|
33
|
+
const load = useRef(undefined);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!reads)
|
|
36
|
+
return;
|
|
37
|
+
const request = new AbortController();
|
|
38
|
+
load.current = () => void reads.read(request.signal).then((next) => {
|
|
39
|
+
if (next && !request.signal.aborted)
|
|
40
|
+
setReply(next);
|
|
41
|
+
});
|
|
42
|
+
load.current();
|
|
43
|
+
const timer = setInterval(load.current, every);
|
|
44
|
+
return () => {
|
|
45
|
+
request.abort();
|
|
46
|
+
clearInterval(timer);
|
|
47
|
+
};
|
|
48
|
+
}, [reads, every]);
|
|
49
|
+
// The pictures are read again only when the comp or its references change.
|
|
50
|
+
const key = reply ? JSON.stringify([reply.fingerprint, wanted(reply)]) : '';
|
|
51
|
+
const [pictures, setPictures] = useState();
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!reads || !key)
|
|
54
|
+
return;
|
|
55
|
+
const [, names] = JSON.parse(key);
|
|
56
|
+
const request = new AbortController();
|
|
57
|
+
const urls = {};
|
|
58
|
+
void Promise.all(names.map(async (name) => {
|
|
59
|
+
const blob = await reads.picture(name, request.signal).catch(() => undefined);
|
|
60
|
+
if (blob && !request.signal.aborted)
|
|
61
|
+
urls[name] = URL.createObjectURL(blob);
|
|
62
|
+
})).then(() => {
|
|
63
|
+
if (!request.signal.aborted)
|
|
64
|
+
setPictures({ key, urls });
|
|
65
|
+
});
|
|
66
|
+
return () => {
|
|
67
|
+
request.abort();
|
|
68
|
+
for (const url of Object.values(urls))
|
|
69
|
+
URL.revokeObjectURL(url);
|
|
70
|
+
};
|
|
71
|
+
}, [reads, key]);
|
|
72
|
+
return {
|
|
73
|
+
reply,
|
|
74
|
+
pictures: pictures?.key === key ? pictures.urls : {},
|
|
75
|
+
reload: () => load.current?.(),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -34,4 +34,4 @@ export declare function commentMessage(comment: PrototypeComment, t: T, locale:
|
|
|
34
34
|
export declare function openPrototype(state: StudioState): string;
|
|
35
35
|
export declare function protoView(state: StudioState, change: string, ui: PrototypeUi): ProtoView;
|
|
36
36
|
/** Empty fields stay empty; the served page never borrows the playground's sample product. */
|
|
37
|
-
export declare function protoSample(state: StudioState, change: string, ui?: PrototypeUi,
|
|
37
|
+
export declare function protoSample(state: StudioState, change: string, ui?: PrototypeUi, listed?: readonly PrototypeSceneMetadata[]): PrototypeSample;
|
|
@@ -106,7 +106,9 @@ function comparison(state, change, pair, t = agentT) {
|
|
|
106
106
|
}
|
|
107
107
|
const EMPTY_SCENES = { empty: '', loading: '', error: '', console: '', tablet: '' };
|
|
108
108
|
/** Empty fields stay empty; the served page never borrows the playground's sample product. */
|
|
109
|
-
export function protoSample(state, change, ui = {},
|
|
109
|
+
export function protoSample(state, change, ui = {}, listed = []) {
|
|
110
|
+
// The comp's scenes (`comp/`) are the look's proof, never an app screen to open or list.
|
|
111
|
+
const scenes = listed.filter((scene) => !scene.key.startsWith('comp/'));
|
|
110
112
|
const record = state.versions?.find((entry) => entry.change === change);
|
|
111
113
|
const plan = state.plan?.changes.find((entry) => entry.id === change);
|
|
112
114
|
const saved = state.work?.autopilot?.findLast((choice) => choice.step === 'prototype' && choice.change === change);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reply's scene link: `#/prototype?scene=<key>` opens Prototype with that scene in the preview.
|
|
3
|
+
* The preview takes the scene once and puts the address back to `#/prototype`, so the same link
|
|
4
|
+
* works again after the person moves on.
|
|
5
|
+
*/
|
|
6
|
+
export declare const sceneHref: (key: string) => string;
|
|
7
|
+
/** The scene an address asks the preview for, if any. */
|
|
8
|
+
export declare function addressedScene(hash: string): string | undefined;
|
|
9
|
+
/** The page part of an address: `#/prototype?scene=x` is the Prototype page. */
|
|
10
|
+
export declare const addressPath: (hash: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reply's scene link: `#/prototype?scene=<key>` opens Prototype with that scene in the preview.
|
|
3
|
+
* The preview takes the scene once and puts the address back to `#/prototype`, so the same link
|
|
4
|
+
* works again after the person moves on.
|
|
5
|
+
*/
|
|
6
|
+
export const sceneHref = (key) => `#/prototype?scene=${encodeURIComponent(key)}`;
|
|
7
|
+
/** The scene an address asks the preview for, if any. */
|
|
8
|
+
export function addressedScene(hash) {
|
|
9
|
+
const match = /^#\/prototype\?(.*)$/.exec(hash);
|
|
10
|
+
const scene = match ? new URLSearchParams(match[1]).get('scene') : null;
|
|
11
|
+
return scene || undefined;
|
|
12
|
+
}
|
|
13
|
+
/** The page part of an address: `#/prototype?scene=x` is the Prototype page. */
|
|
14
|
+
export const addressPath = (hash) => hash.split('?')[0] ?? hash;
|
|
@@ -62,6 +62,7 @@ export function studioPost(fetch, headers, read, setDetail, setTrouble, offline)
|
|
|
62
62
|
const id = body?.id;
|
|
63
63
|
if (path === '/api/brand/icon' ||
|
|
64
64
|
path.endsWith('/allow-folder') ||
|
|
65
|
+
path.endsWith('/permission') ||
|
|
65
66
|
(path === '/api/run' && typeof id === 'string' && /^(?:enable|disable):/.test(id)))
|
|
66
67
|
// Only a refusal sentence is shown; any other failed answer is a failure the page words.
|
|
67
68
|
return typeof result?.error === 'string' ? result : undefined;
|
|
@@ -31,6 +31,8 @@ export declare function loopApi(initial?: {
|
|
|
31
31
|
model?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", string>> | undefined;
|
|
32
32
|
effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
|
|
33
33
|
level: "auto" | "guide" | "lead" | "review";
|
|
34
|
+
neverAsk?: boolean | undefined;
|
|
35
|
+
review?: boolean | undefined;
|
|
34
36
|
} | null;
|
|
35
37
|
found: {
|
|
36
38
|
id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
|
|
@@ -85,7 +87,7 @@ export declare function loopApi(initial?: {
|
|
|
85
87
|
approved?: {
|
|
86
88
|
version: number;
|
|
87
89
|
approval: {
|
|
88
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
90
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
89
91
|
signatures: {
|
|
90
92
|
by: string;
|
|
91
93
|
at: string;
|
|
@@ -110,7 +112,7 @@ export declare function loopApi(initial?: {
|
|
|
110
112
|
pending?: {
|
|
111
113
|
version: number;
|
|
112
114
|
approval: {
|
|
113
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
115
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
114
116
|
signatures: {
|
|
115
117
|
by: string;
|
|
116
118
|
at: string;
|
|
@@ -135,7 +137,7 @@ export declare function loopApi(initial?: {
|
|
|
135
137
|
superseded?: {
|
|
136
138
|
version: number;
|
|
137
139
|
approval: {
|
|
138
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
140
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
139
141
|
signatures: {
|
|
140
142
|
by: string;
|
|
141
143
|
at: string;
|
|
@@ -228,14 +230,16 @@ export declare function loopApi(initial?: {
|
|
|
228
230
|
who: string;
|
|
229
231
|
place: string;
|
|
230
232
|
main: boolean;
|
|
233
|
+
planned?: string | undefined;
|
|
231
234
|
}[];
|
|
232
235
|
notes: string[];
|
|
236
|
+
surface?: "desktop" | "phone" | undefined;
|
|
233
237
|
problem?: string | undefined;
|
|
234
238
|
} | null | undefined;
|
|
235
239
|
themeDirection?: string | undefined;
|
|
236
240
|
themeVoice?: string | undefined;
|
|
237
241
|
brand: {
|
|
238
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
242
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
239
243
|
signatures: {
|
|
240
244
|
by: string;
|
|
241
245
|
at: string;
|
|
@@ -337,6 +341,7 @@ export declare function loopApi(initial?: {
|
|
|
337
341
|
} | undefined;
|
|
338
342
|
committedLevel?: "auto" | "guide" | "lead" | "review" | undefined;
|
|
339
343
|
effectiveLevel?: "auto" | "guide" | "lead" | "review" | undefined;
|
|
344
|
+
neverAsk?: boolean | undefined;
|
|
340
345
|
level?: {
|
|
341
346
|
source: "host";
|
|
342
347
|
where: string;
|
|
@@ -388,6 +393,18 @@ export declare function loopApi(initial?: {
|
|
|
388
393
|
at: string;
|
|
389
394
|
turn: string;
|
|
390
395
|
} | undefined;
|
|
396
|
+
asking?: {
|
|
397
|
+
id: string;
|
|
398
|
+
tool: string;
|
|
399
|
+
command: string;
|
|
400
|
+
parts: string[];
|
|
401
|
+
once?: boolean | undefined;
|
|
402
|
+
unsure?: {
|
|
403
|
+
why: "budget" | "expression" | "heredoc" | "mention" | "pattern" | "stdin";
|
|
404
|
+
mention?: string | undefined;
|
|
405
|
+
} | undefined;
|
|
406
|
+
at: string;
|
|
407
|
+
} | undefined;
|
|
391
408
|
messages: {
|
|
392
409
|
from: "agent" | "system" | "you";
|
|
393
410
|
text: string;
|
|
@@ -423,6 +440,7 @@ export declare function loopApi(initial?: {
|
|
|
423
440
|
targets: string[];
|
|
424
441
|
refused?: boolean | undefined;
|
|
425
442
|
reason?: "command" | "monitor" | "permission" | "redirect" | "taskOutput" | undefined;
|
|
443
|
+
limit?: "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
426
444
|
} | undefined;
|
|
427
445
|
permission?: {
|
|
428
446
|
path: string;
|
|
@@ -438,6 +456,10 @@ export declare function loopApi(initial?: {
|
|
|
438
456
|
unsaved?: {
|
|
439
457
|
count?: number | undefined;
|
|
440
458
|
} | undefined;
|
|
459
|
+
scenes?: {
|
|
460
|
+
key: string;
|
|
461
|
+
title: string;
|
|
462
|
+
}[] | undefined;
|
|
441
463
|
} | undefined;
|
|
442
464
|
}[];
|
|
443
465
|
}>;
|
|
@@ -466,6 +488,8 @@ export declare function loopApi(initial?: {
|
|
|
466
488
|
model?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", string>> | undefined;
|
|
467
489
|
effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
|
|
468
490
|
level: "auto" | "guide" | "lead" | "review";
|
|
491
|
+
neverAsk?: boolean | undefined;
|
|
492
|
+
review?: boolean | undefined;
|
|
469
493
|
} | null;
|
|
470
494
|
found: {
|
|
471
495
|
id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
|
|
@@ -520,7 +544,7 @@ export declare function loopApi(initial?: {
|
|
|
520
544
|
approved?: {
|
|
521
545
|
version: number;
|
|
522
546
|
approval: {
|
|
523
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
547
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
524
548
|
signatures: {
|
|
525
549
|
by: string;
|
|
526
550
|
at: string;
|
|
@@ -545,7 +569,7 @@ export declare function loopApi(initial?: {
|
|
|
545
569
|
pending?: {
|
|
546
570
|
version: number;
|
|
547
571
|
approval: {
|
|
548
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
572
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
549
573
|
signatures: {
|
|
550
574
|
by: string;
|
|
551
575
|
at: string;
|
|
@@ -570,7 +594,7 @@ export declare function loopApi(initial?: {
|
|
|
570
594
|
superseded?: {
|
|
571
595
|
version: number;
|
|
572
596
|
approval: {
|
|
573
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
597
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
574
598
|
signatures: {
|
|
575
599
|
by: string;
|
|
576
600
|
at: string;
|
|
@@ -663,14 +687,16 @@ export declare function loopApi(initial?: {
|
|
|
663
687
|
who: string;
|
|
664
688
|
place: string;
|
|
665
689
|
main: boolean;
|
|
690
|
+
planned?: string | undefined;
|
|
666
691
|
}[];
|
|
667
692
|
notes: string[];
|
|
693
|
+
surface?: "desktop" | "phone" | undefined;
|
|
668
694
|
problem?: string | undefined;
|
|
669
695
|
} | null | undefined;
|
|
670
696
|
themeDirection?: string | undefined;
|
|
671
697
|
themeVoice?: string | undefined;
|
|
672
698
|
brand: {
|
|
673
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
699
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
674
700
|
signatures: {
|
|
675
701
|
by: string;
|
|
676
702
|
at: string;
|
|
@@ -772,6 +798,7 @@ export declare function loopApi(initial?: {
|
|
|
772
798
|
} | undefined;
|
|
773
799
|
committedLevel?: "auto" | "guide" | "lead" | "review" | undefined;
|
|
774
800
|
effectiveLevel?: "auto" | "guide" | "lead" | "review" | undefined;
|
|
801
|
+
neverAsk?: boolean | undefined;
|
|
775
802
|
level?: {
|
|
776
803
|
source: "host";
|
|
777
804
|
where: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import { addressedScene } from './scene-address.js';
|
|
2
3
|
/** Playback belongs to the container; any other canvas choice stops it. */
|
|
3
4
|
export function usePrototypeUi(journeys, journey, version) {
|
|
4
5
|
const [ui, setUi] = useState({ journey, version });
|
|
@@ -15,6 +16,19 @@ export function usePrototypeUi(journeys, journey, version) {
|
|
|
15
16
|
}, 1000);
|
|
16
17
|
return () => clearInterval(timer);
|
|
17
18
|
}, [ui.playing, last]);
|
|
19
|
+
// A reply's scene link opens its scene once, then the address is the page again.
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const take = () => {
|
|
22
|
+
const screen = addressedScene(window.location.hash);
|
|
23
|
+
if (!screen)
|
|
24
|
+
return;
|
|
25
|
+
setUi((current) => ({ ...current, screen, playing: false }));
|
|
26
|
+
window.history.replaceState(null, '', '#/prototype');
|
|
27
|
+
};
|
|
28
|
+
take();
|
|
29
|
+
window.addEventListener('hashchange', take);
|
|
30
|
+
return () => window.removeEventListener('hashchange', take);
|
|
31
|
+
}, []);
|
|
18
32
|
const update = (patch) => setUi((current) => ({ ...current, ...patch, playing: false }));
|
|
19
33
|
const player = (action) => {
|
|
20
34
|
setUi((current) => ({
|
|
@@ -12,5 +12,47 @@ export declare function useStudio({ token, fetch, every }: StudioAppProps): {
|
|
|
12
12
|
age: string | number | undefined;
|
|
13
13
|
trouble: Trouble | null;
|
|
14
14
|
detail: Notice | undefined;
|
|
15
|
-
actions:
|
|
15
|
+
actions: {
|
|
16
|
+
prototypeHome?: import('./prototype-home.ts').HomeRead;
|
|
17
|
+
snapshot?: (request: import("./prototype-snapshot.ts").SnapshotRequest, signal?: AbortSignal) => Promise<import("./prototype-snapshot.ts").SnapshotRead | undefined>;
|
|
18
|
+
checkAgents?: (signal?: AbortSignal) => Promise<import("@buffcore/contracts/workbench").FoundAgent[] | undefined>;
|
|
19
|
+
prototypeScenes?: (signal?: AbortSignal) => Promise<import("@buffcore/contracts/workbench").PrototypeScenesReply>;
|
|
20
|
+
go?: (page: import("../index.ts").StudioPage) => void;
|
|
21
|
+
readIcon?: (signal: AbortSignal) => Promise<Blob | undefined>;
|
|
22
|
+
uploadIcon?: (file: File) => Promise<unknown>;
|
|
23
|
+
run: (id: string, server?: import("../types.ts").ServerForm) => unknown;
|
|
24
|
+
stack: (action: 'start' | 'stop') => void;
|
|
25
|
+
level: (level: (typeof import("@buffcore/contracts/workbench").LEVELS)[number], neverAsk?: boolean) => void;
|
|
26
|
+
answerPermission?: (chat: string, card: string, answer: 'once' | 'always' | 'deny') => Promise<true | string>;
|
|
27
|
+
approvePrototype?: (change: string, version: number) => unknown;
|
|
28
|
+
chooseSurface?: (surface: 'desktop' | 'phone') => unknown;
|
|
29
|
+
approvePlaces?: (change: string, revision: string) => unknown;
|
|
30
|
+
approve?: (direction: string, fingerprint: string) => unknown;
|
|
31
|
+
approveRelease?: (id: string, server: import("../types.ts").ServerForm) => Promise<unknown>;
|
|
32
|
+
catchUp?: (change: string) => Promise<unknown>;
|
|
33
|
+
send: (id: string, text: string, waitForRefresh?: false) => Promise<boolean>;
|
|
34
|
+
newChat: (body: import("@buffcore/contracts/workbench").NewChat) => Promise<import("@buffcore/contracts/workbench").Chat | undefined>;
|
|
35
|
+
allowFolder?: (id: string, at: number) => Promise<true | string>;
|
|
36
|
+
platformsWanted?: {
|
|
37
|
+
current?: {
|
|
38
|
+
ios: boolean;
|
|
39
|
+
android: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
stop: (id: string, confirm?: boolean, signal?: AbortSignal) => Promise<import('zod').infer<typeof import("@buffcore/contracts/workbench").stopAnswer> | undefined>;
|
|
43
|
+
answerInChat?: (question: string, key?: string) => void;
|
|
44
|
+
chooseQuestion?: (question: string, number?: number) => void;
|
|
45
|
+
questionChoices?: Record<string, import("./question-transcript.ts").QuestionChoice>;
|
|
46
|
+
questionBusy?: boolean;
|
|
47
|
+
setAgents: (assignment: import("@buffcore/contracts/workbench").AgentAssignment) => void;
|
|
48
|
+
merge: (change: string) => Promise<unknown>;
|
|
49
|
+
markBuilt?: (change: string, version: number, commit: string) => Promise<import("./actions.ts").SaveResult>;
|
|
50
|
+
previewMerge?: (change: string, signal: AbortSignal) => Promise<import("@buffcore/contracts/workbench").MergePreview | undefined>;
|
|
51
|
+
retryTurn?: (chat: string) => Promise<unknown>;
|
|
52
|
+
holdMerges?: (held: boolean) => Promise<unknown>;
|
|
53
|
+
removeWorktree: (change: string) => Promise<unknown>;
|
|
54
|
+
fresh?: import("./fresh.ts").FreshActions;
|
|
55
|
+
save: (step: import("./actions.ts").SaveStep, fingerprint?: string, files?: readonly string[], change?: string) => Promise<import("./actions.ts").SaveResult>;
|
|
56
|
+
comp: import("./prototype-comp.ts").CompReads;
|
|
57
|
+
};
|
|
16
58
|
};
|
|
@@ -2,7 +2,9 @@ import { chatSchema, localTokenRefusalSchema, studioStateSchema, workbenchApi, }
|
|
|
2
2
|
import { useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { studioActions } from './actions.js';
|
|
5
|
+
import { freshActions } from './fresh.js';
|
|
5
6
|
import { mergePreviewRead } from './merge-preview.js';
|
|
7
|
+
import { compReads } from './prototype-comp.js';
|
|
6
8
|
import { prototypeHomeRead } from './prototype-home.js';
|
|
7
9
|
import { prototypeScenesRead } from './prototype-scenes.js';
|
|
8
10
|
import { studioPost, studioReadNotice } from './studio-post.js';
|
|
@@ -114,6 +116,11 @@ export function useStudio({ token, fetch = globalThis.fetch, every }) {
|
|
|
114
116
|
// A check and a poll publish into the same state in the order their answers arrive.
|
|
115
117
|
setLastRead((held) => held && { ...held, agents: { ...held.agents, found } });
|
|
116
118
|
});
|
|
119
|
+
actions.fresh = freshActions(fetch, headers, post);
|
|
120
|
+
// The comp's reads keep one identity; its approval posts through the latest `send`.
|
|
121
|
+
const latestSend = useRef(send);
|
|
122
|
+
latestSend.current = send;
|
|
123
|
+
const comp = useMemo(() => compReads(fetch, headers, (path, body) => latestSend.current(path, body)), [fetch, headers]);
|
|
117
124
|
return {
|
|
118
125
|
state,
|
|
119
126
|
gate,
|
|
@@ -123,7 +130,7 @@ export function useStudio({ token, fetch = globalThis.fetch, every }) {
|
|
|
123
130
|
age,
|
|
124
131
|
trouble,
|
|
125
132
|
detail,
|
|
126
|
-
actions,
|
|
133
|
+
actions: { ...actions, comp },
|
|
127
134
|
};
|
|
128
135
|
}
|
|
129
136
|
function withoutLevels(state) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// A host's theme for the studio: the studio's own theme with the host's tokens over it. `extendTheme`
|
|
2
|
+
// takes starter themes only (one level deep), and the studio's theme is already one level down, so
|
|
3
|
+
// this does the same one step on top of it and keeps the studio's two set-aside checks.
|
|
4
|
+
import { extendTheme } from '@buffcore/tokens';
|
|
5
|
+
import { theme as studioTheme } from './theme.js';
|
|
6
|
+
/** Run `checkTheme` on the result; `createUiServer({ theme })` refuses one with any problem. */
|
|
7
|
+
export function extendStudioTheme(overrides) {
|
|
8
|
+
const { extends: _starter, ...base } = studioTheme;
|
|
9
|
+
return {
|
|
10
|
+
...extendTheme(base, overrides),
|
|
11
|
+
extends: studioTheme.key,
|
|
12
|
+
...(studioTheme.allow ? { allow: studioTheme.allow } : {}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -6,6 +6,7 @@ export { mountStudio, type StudioMountProps, StudioRoot } from './app/mount.tsx'
|
|
|
6
6
|
export type { HostPart, HostParts } from './app/places.ts';
|
|
7
7
|
export { StudioApp, type StudioAppProps } from './app/StudioApp.tsx';
|
|
8
8
|
export { workbenchCatalog } from './catalog.ts';
|
|
9
|
+
export { extendStudioTheme } from './host-theme.ts';
|
|
9
10
|
export * from './studio/index.ts';
|
|
10
11
|
export { theme as studioTheme } from './theme.ts';
|
|
11
12
|
export * from './types.ts';
|
package/dist/workbench/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { frameProps } from './app/frame.js';
|
|
|
4
4
|
export { mountStudio, StudioRoot } from './app/mount.js';
|
|
5
5
|
export { StudioApp } from './app/StudioApp.js';
|
|
6
6
|
export { workbenchCatalog } from './catalog.js';
|
|
7
|
+
export { extendStudioTheme } from './host-theme.js';
|
|
7
8
|
export * from './studio/index.js';
|
|
8
9
|
export { theme as studioTheme } from './theme.js';
|
|
9
10
|
export * from './types.js';
|