@1agh/maude 2.0.4 → 2.0.8
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/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +39 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/actions/agents.ts +59 -0
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +13 -0
- package/apps/studio/actions/defs/view.ts +59 -3
- package/apps/studio/actions/keymap.gen.ts +35 -0
- package/apps/studio/actions/menu.ts +2 -0
- package/apps/studio/actions/types.ts +3 -1
- package/apps/studio/actions.manifest.json +148 -1
- package/apps/studio/actions.parity.json +31 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -15
- package/apps/studio/api.ts +425 -128
- package/apps/studio/artboard-activity-overlay.tsx +4 -4
- package/apps/studio/artboard-ai-copies.tsx +4 -4
- package/apps/studio/artboard-freeze.ts +108 -0
- package/apps/studio/artboard-live-gate.tsx +636 -0
- package/apps/studio/artboard-live.ts +831 -0
- package/apps/studio/artboard-placeholder.ts +197 -0
- package/apps/studio/artboard-still-raster.ts +485 -0
- package/apps/studio/artboard-still-warmup.ts +221 -0
- package/apps/studio/artboard-still.ts +1188 -0
- package/apps/studio/artboard-webgl.ts +669 -0
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
- package/apps/studio/bin/_canvas-reasons.mjs +34 -0
- package/apps/studio/bin/_ds-check-live.mjs +37 -0
- package/apps/studio/bin/_ds-check.mjs +4 -1
- package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
- package/apps/studio/bin/_import-asset.mjs +2 -1
- package/apps/studio/bin/_perf-probe-open.mjs +364 -0
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- package/apps/studio/bin/_studio-verb.mjs +24 -3
- package/apps/studio/bin/_thumb-blank.mjs +70 -0
- package/apps/studio/bin/_thumb-cover.mjs +35 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +30 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/bridge/dgn-protocol.ts +35 -0
- package/apps/studio/canvas-build-sandbox.ts +69 -13
- package/apps/studio/canvas-camera.ts +90 -0
- package/apps/studio/canvas-comment-mount.tsx +9 -9
- package/apps/studio/canvas-lib.tsx +289 -44
- package/apps/studio/canvas-pages-view.tsx +465 -0
- package/apps/studio/canvas-pages.ts +305 -0
- package/apps/studio/canvas-rows.ts +62 -0
- package/apps/studio/canvas-shell.tsx +62 -16
- package/apps/studio/canvas-theme-icons.tsx +41 -0
- package/apps/studio/canvas-theme-pill.tsx +15 -6
- package/apps/studio/canvas-theme.ts +12 -11
- package/apps/studio/client/app.jsx +7 -0
- package/apps/studio/client/canvas-url.js +36 -1
- package/apps/studio/client/home/HomeAccounts.jsx +262 -0
- package/apps/studio/client/home/Shelves.jsx +4 -3
- package/apps/studio/client/home/home-accounts-model.js +121 -0
- package/apps/studio/client/home/home-api.js +6 -0
- package/apps/studio/client/home/home-app.jsx +141 -40
- package/apps/studio/client/home/home-model.js +172 -6
- package/apps/studio/client/home/home.css +169 -5
- package/apps/studio/client/home/shell-mode.js +8 -1
- package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
- package/apps/studio/client/hooks/use-project-data.jsx +13 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
- package/apps/studio/client/index-loader.ts +41 -21
- package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
- package/apps/studio/client/panels/ChatPanel.jsx +27 -20
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/shell/viewport.jsx +66 -22
- package/apps/studio/client/tree/tree.jsx +17 -0
- package/apps/studio/client/v2/access/access-client.js +2 -0
- package/apps/studio/client/v2/access/access-host.jsx +12 -1
- package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
- package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
- package/apps/studio/client/v2/ai/Composer.jsx +27 -10
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
- package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
- package/apps/studio/client/v2/code/code-consent.js +67 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
- package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
- package/apps/studio/client/v2/ds/library-host.jsx +45 -45
- package/apps/studio/client/v2/ds/make-host.jsx +13 -15
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- package/apps/studio/client/v2/history/branch-actions.js +13 -9
- package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
- package/apps/studio/client/v2/history/git-model.js +3 -1
- package/apps/studio/client/v2/history/git-parts.jsx +16 -1
- package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
- package/apps/studio/client/v2/layers/layers-request.js +49 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
- package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
- package/apps/studio/client/v2/shell/floating-panels.css +37 -1
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +11 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
- package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
- package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
- package/apps/studio/client/v2/shell/pages-pick.js +49 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
- package/apps/studio/client/v2/shell/project-account-model.js +182 -0
- package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
- package/apps/studio/client/v2/shell/share-cluster.css +58 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
- package/apps/studio/client/v2/shell/shell-parity.json +8 -0
- package/apps/studio/client/v2/shell/team-switch.js +94 -0
- package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
- package/apps/studio/client/v2/shell/use-account.js +8 -1
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
- package/apps/studio/collab/persistence.ts +9 -1
- package/apps/studio/collab/registry.ts +32 -0
- package/apps/studio/collab/room.ts +8 -0
- package/apps/studio/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +56 -0
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +1198 -1198
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +6 -0
- package/apps/studio/ds/board/ds-bar.tsx +21 -3
- package/apps/studio/ds/board/specimen.tsx +16 -2
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +14 -4
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/engine.ts +3 -1
- package/apps/studio/ds/folder-systems.ts +199 -0
- package/apps/studio/ds/pairing-css.ts +2 -1
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- package/apps/studio/ds/upgrade-apply.ts +27 -5
- package/apps/studio/ds/upgrade-cli.ts +22 -2
- package/apps/studio/ds/upgrade-prove.ts +198 -15
- package/apps/studio/ds/upgrade-stage.ts +10 -3
- package/apps/studio/editing/ai-point-ring.tsx +4 -4
- package/apps/studio/editing/ai-scope-outline.tsx +4 -4
- package/apps/studio/editing/align-bar.tsx +4 -4
- package/apps/studio/editing/anchor-report.ts +3 -2
- package/apps/studio/editing/artboard-handles.tsx +4 -4
- package/apps/studio/editing/corner-dots.tsx +4 -4
- package/apps/studio/editing/crop-mode.tsx +4 -4
- package/apps/studio/editing/drop-chip.tsx +4 -4
- package/apps/studio/editing/empty-report.ts +3 -2
- package/apps/studio/editing/focus-model.tsx +4 -4
- package/apps/studio/editing/gap-bands.tsx +3 -3
- package/apps/studio/editing/hold-rings.tsx +4 -4
- package/apps/studio/editing/lock-badge.tsx +3 -3
- package/apps/studio/editing/long-page.ts +23 -1
- package/apps/studio/editing/nudge.tsx +2 -2
- package/apps/studio/editing/page-activity.ts +4 -3
- package/apps/studio/editing/paste-bar.tsx +4 -4
- package/apps/studio/editing/pen/overlay.tsx +4 -3
- package/apps/studio/editing/place-freely.tsx +3 -3
- package/apps/studio/editing/reorder-slot.tsx +3 -3
- package/apps/studio/editing/selection.tsx +4 -4
- package/apps/studio/editing/size-ghost.tsx +4 -4
- package/apps/studio/editing/tab-order.tsx +4 -4
- package/apps/studio/editing/text-in-place.tsx +4 -4
- package/apps/studio/editing/undo-preview.tsx +3 -3
- package/apps/studio/equal-spacing-handles.tsx +3 -3
- package/apps/studio/frame-clock.ts +89 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +19 -0
- package/apps/studio/http.ts +80 -34
- package/apps/studio/index/ds-usage.ts +4 -1
- package/apps/studio/index-cache.ts +272 -0
- package/apps/studio/inspect-overlay.tsx +4 -3
- package/apps/studio/inspect.ts +7 -2
- package/apps/studio/link-chip-overlay.tsx +4 -3
- package/apps/studio/measure-overlay.tsx +4 -3
- package/apps/studio/present/pointer-dot.tsx +3 -2
- package/apps/studio/present/present-media.ts +6 -2
- package/apps/studio/present/present-stage.tsx +3 -2
- package/apps/studio/preview/preview-camera.tsx +3 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/sync.ts +176 -0
- package/apps/studio/routes/trash.ts +16 -1
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/server.ts +8 -10
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/accepted-cold-start.ts +28 -13
- package/apps/studio/sync/asset-push.ts +146 -23
- package/apps/studio/sync/asset-state.ts +3 -2
- package/apps/studio/sync/code-module-consent.ts +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +497 -61
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +405 -163
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +77 -12
- package/apps/studio/sync/seed-progress.ts +104 -3
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +17 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/use-annotation-resize.tsx +4 -3
- package/apps/studio/use-artboard-drag.tsx +3 -2
- package/apps/studio/use-element-resize.tsx +7 -6
- package/apps/studio/use-grid-track-handles.tsx +5 -4
- package/apps/studio/use-selection-set.tsx +64 -4
- package/apps/studio/use-spacing-handles.tsx +7 -6
- package/apps/studio/video-comp.tsx +75 -39
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +99 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +27 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// client/v2/shell/team-switch.js — 2.0.5 W4b: Switch / Sign in for a team-server project.
|
|
2
|
+
//
|
|
3
|
+
// Option A of the W4 open point: a team server's credential lands in the project's PROFILE
|
|
4
|
+
// (`hubs.json`), so signing in as someone else on a profile other projects share would re-sign them
|
|
5
|
+
// too — V2-3.8 forbids it. So, in the app:
|
|
6
|
+
// 1. `team_sign_in_prepare` (Rust, project tabs only; the caller's label + origin are checked
|
|
7
|
+
// there). `true` = this project shared its profile: it is now bound to a fresh profile of its
|
|
8
|
+
// own and its server restarts onto it — the page reloads signed out, and the person signs in
|
|
9
|
+
// there (the card then offers "Sign in to <host>…"). Stop here.
|
|
10
|
+
// 2. `false` = this project is alone on its profile: run the team server's own sign-in page
|
|
11
|
+
// (`/_api/hub-signin/start` → `open_team_server_signin` → poll). The server's route restarts
|
|
12
|
+
// sync for this project's own server once the new sign-in is stored.
|
|
13
|
+
// No credential crosses this page; it only passes the server address and an attempt id.
|
|
14
|
+
//
|
|
15
|
+
// Pure over its effects (`invoke`, `api`, `openPage`, `wait`) so the test drives it with stubs.
|
|
16
|
+
|
|
17
|
+
const POLL_MS = 1500;
|
|
18
|
+
const POLL_CAP = 400; // 10 min at 1.5 s — the attempt's own lifetime
|
|
19
|
+
|
|
20
|
+
export const TEAM_SWITCH_WORDS = Object.freeze({
|
|
21
|
+
moved:
|
|
22
|
+
'This project now has an account of its own on this Mac. Sign in to the team server again once it reloads.',
|
|
23
|
+
refused: 'Maude won’t open that address. Check the server address in Settings › Connections.',
|
|
24
|
+
failed: 'Maude couldn’t open your browser. Try again.',
|
|
25
|
+
start: 'The sign-in could not start. Try again.',
|
|
26
|
+
unfinished: 'The sign-in did not finish. Try again.',
|
|
27
|
+
needsApp: 'Switching a team-server account needs the Maude desktop app.',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const hostOf = (url) => {
|
|
31
|
+
try {
|
|
32
|
+
return new URL(String(url)).host;
|
|
33
|
+
} catch {
|
|
34
|
+
return String(url || '');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @returns {Promise<{ ok: boolean, moved?: boolean, url?: string, user?: string|null, error?: string }>}
|
|
40
|
+
*/
|
|
41
|
+
export async function runTeamSwitch({ url, native, invoke, api, openPage, wait, cancelled }) {
|
|
42
|
+
if (!native || typeof invoke !== 'function')
|
|
43
|
+
return { ok: false, error: TEAM_SWITCH_WORDS.needsApp };
|
|
44
|
+
if (!url) return { ok: false, error: TEAM_SWITCH_WORDS.start };
|
|
45
|
+
let moved;
|
|
46
|
+
try {
|
|
47
|
+
moved = await invoke('team_sign_in_prepare');
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return { ok: false, error: String(e?.message || e || TEAM_SWITCH_WORDS.start) };
|
|
50
|
+
}
|
|
51
|
+
if (moved === true) return { ok: true, moved: true, message: TEAM_SWITCH_WORDS.moved };
|
|
52
|
+
|
|
53
|
+
const post = (path, body) =>
|
|
54
|
+
api(path, {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
headers: { 'content-type': 'application/json' },
|
|
57
|
+
body: JSON.stringify(body),
|
|
58
|
+
});
|
|
59
|
+
const r = await post('/_api/hub-signin/start', { url });
|
|
60
|
+
if (!r?.ok || !r.json?.ok || !r.json.id)
|
|
61
|
+
return { ok: false, error: r?.json?.error || TEAM_SWITCH_WORDS.start };
|
|
62
|
+
const id = r.json.id;
|
|
63
|
+
const opened = await openPage(r.json.signInUrl);
|
|
64
|
+
if (opened !== 'ok') {
|
|
65
|
+
void post('/_api/hub-signin/cancel', { id });
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
error: opened === 'refused' ? TEAM_SWITCH_WORDS.refused : TEAM_SWITCH_WORDS.failed,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
for (let i = 0; i < POLL_CAP; i++) {
|
|
72
|
+
await wait(POLL_MS);
|
|
73
|
+
if (cancelled?.()) {
|
|
74
|
+
void post('/_api/hub-signin/cancel', { id });
|
|
75
|
+
return { ok: false, cancelled: true };
|
|
76
|
+
}
|
|
77
|
+
const p = await post('/_api/hub-signin/poll', { id });
|
|
78
|
+
if (p?.json?.pending) continue;
|
|
79
|
+
if (p?.ok && p.json?.ok && p.json.url) {
|
|
80
|
+
const user = typeof p.json.user?.email === 'string' ? p.json.user.email : null;
|
|
81
|
+
return {
|
|
82
|
+
ok: true,
|
|
83
|
+
url: p.json.url,
|
|
84
|
+
user,
|
|
85
|
+
message: user
|
|
86
|
+
? `Signed in to ${hostOf(p.json.url)} as ${user}.`
|
|
87
|
+
: `Signed in to ${hostOf(p.json.url)}.`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return { ok: false, error: p?.json?.error || TEAM_SWITCH_WORDS.unfinished };
|
|
91
|
+
}
|
|
92
|
+
void post('/_api/hub-signin/cancel', { id });
|
|
93
|
+
return { ok: false, error: TEAM_SWITCH_WORDS.unfinished };
|
|
94
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// client/v2/shell/too-heavy-card.jsx — 2.0.5: the card a tab shows instead of a canvas that keeps crashing
|
|
2
|
+
// the page (canvas-crash-guard.js). The viewport mounts it INSTEAD of the frame, like the not-local card:
|
|
3
|
+
// no frame, so nothing heavy runs until the person picks a way in.
|
|
4
|
+
|
|
5
|
+
import { Empty } from '../empty/empty.jsx';
|
|
6
|
+
|
|
7
|
+
/** @param {{ name: string, onLight: () => void, onAll: () => void }} props */
|
|
8
|
+
export function TooHeavyCanvas({ name, onLight, onAll }) {
|
|
9
|
+
return (
|
|
10
|
+
<Empty
|
|
11
|
+
size="canvas"
|
|
12
|
+
glyph="offline"
|
|
13
|
+
title="This canvas is too heavy to show all at once."
|
|
14
|
+
next={`Maude had to reload twice while ${name} was drawing. Show the artboards near where you look; the rest draw as you move to them.`}
|
|
15
|
+
testid="canvas-too-heavy"
|
|
16
|
+
actions={
|
|
17
|
+
<>
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
className="btn btn--sm btn--primary"
|
|
21
|
+
data-testid="canvas-too-heavy-light"
|
|
22
|
+
onClick={onLight}
|
|
23
|
+
>
|
|
24
|
+
Show visible artboards only
|
|
25
|
+
</button>
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
className="btn btn--sm"
|
|
29
|
+
data-testid="canvas-too-heavy-all"
|
|
30
|
+
onClick={onAll}
|
|
31
|
+
>
|
|
32
|
+
Show everything
|
|
33
|
+
</button>
|
|
34
|
+
</>
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -24,7 +24,14 @@ export function useAccount(enabled) {
|
|
|
24
24
|
.then((r) => r.json().catch(() => ({})))
|
|
25
25
|
.then((j) => {
|
|
26
26
|
if (!gone)
|
|
27
|
-
setState((s) => ({
|
|
27
|
+
setState((s) => ({
|
|
28
|
+
...s,
|
|
29
|
+
connected: !!j?.connected,
|
|
30
|
+
email: j?.email ?? null,
|
|
31
|
+
// 2.0.5 W4 — the project account card's kind: the cloud address and this folder's link
|
|
32
|
+
cloudUrl: typeof j?.url === 'string' ? j.url : '',
|
|
33
|
+
linkedHub: j?.linkedHub ?? null,
|
|
34
|
+
}));
|
|
28
35
|
})
|
|
29
36
|
.catch(() => {
|
|
30
37
|
if (!gone) setState((s) => ({ ...s, connected: false, email: null }));
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
shellEscDecision,
|
|
41
41
|
} from './canvas-mode.js';
|
|
42
42
|
import { SEED_LADDER_MS } from './occlusion-insets.js';
|
|
43
|
+
import { savePagesPick, saveThemePick } from './pages-pick.js';
|
|
43
44
|
import { appOnlyFor, ROLE_DENIAL, showRoleDenial } from './role-denial.js';
|
|
44
45
|
import { insetsLane } from './use-occluded-insets.js';
|
|
45
46
|
import { panelLayout, usePanelLayout } from './use-panel-layout.js';
|
|
@@ -124,6 +125,21 @@ export function usePresentMode() {
|
|
|
124
125
|
return [presentMode, useCallback(setPresenting, [])];
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
const pagesNow = () => shellMode.get().pages === true;
|
|
129
|
+
|
|
130
|
+
/** 2.0.7 B2 — does the active canvas show Pages? (Preview and Present are off meanwhile.) */
|
|
131
|
+
export function usePagesView() {
|
|
132
|
+
return useSyncExternalStore(shellMode.subscribe, pagesNow, pagesNow);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const pagesAtNow = () =>
|
|
136
|
+
shellMode.get().pages === true ? (shellMode.get().pagesAt ?? null) : null;
|
|
137
|
+
|
|
138
|
+
/** 2.0.7 polish — the artboard on the active canvas's page while it shows Pages, else null. */
|
|
139
|
+
export function usePagesArtboard() {
|
|
140
|
+
return useSyncExternalStore(shellMode.subscribe, pagesAtNow, pagesAtNow);
|
|
141
|
+
}
|
|
142
|
+
|
|
127
143
|
// S3.2b — the shell's own controls (and the keys the shell hears) step the presenting canvas through the
|
|
128
144
|
// lane the mounted hook owns; there is one lane per window, so one registered stepper.
|
|
129
145
|
let presentStepper = null;
|
|
@@ -268,6 +284,8 @@ export function useCanvasModeLane({ activePath, iframesRef, cfg, canEdit, role }
|
|
|
268
284
|
// biome-ignore lint/correctness/useExhaustiveDependencies: activePath is the trigger
|
|
269
285
|
useEffect(() => {
|
|
270
286
|
setPeers([]);
|
|
287
|
+
// 2.0.7 B2 — Pages is the canvas's own: a newly active canvas says again (it answers the seed below)
|
|
288
|
+
shellMode.pages(false);
|
|
271
289
|
const win = activeWin();
|
|
272
290
|
if (win) lane.seed(win, seedOf());
|
|
273
291
|
}, [activePath, lane]);
|
|
@@ -300,6 +318,16 @@ export function useCanvasModeLane({ activePath, iframesRef, cfg, canEdit, role }
|
|
|
300
318
|
if (!m) return;
|
|
301
319
|
if (m.dgn === 'peers') {
|
|
302
320
|
setPeers(m.peers);
|
|
321
|
+
} else if (m.dgn === 'pages-view') {
|
|
322
|
+
// 2.0.7 B2 — the active canvas shows Pages (or stopped): Preview and Present follow (canvas-mode.js);
|
|
323
|
+
// 2.0.7 polish — with the artboard on the page, which the left panel marks
|
|
324
|
+
shellMode.pages(m.on, m.id);
|
|
325
|
+
} else if (m.dgn === 'pages-pick') {
|
|
326
|
+
// 2.0.7 B2 — the person switched Canvas | Pages: remember it for the canvas the shell has open
|
|
327
|
+
void savePagesPick(L.activePath, L.cfg?.designRel, m.view);
|
|
328
|
+
} else if (m.dgn === 'theme-pick') {
|
|
329
|
+
// the Light | Dark pick, the same way (the canvas origin has no lane for it)
|
|
330
|
+
void saveThemePick(L.activePath, L.cfg?.designRel, m.theme);
|
|
303
331
|
} else if (m.dgn === 'present-position') {
|
|
304
332
|
// Present · Artboards moved on (S3.2a's stage echoes every step); the canvas's own hold
|
|
305
333
|
// (_shell.html) lands its held write on the same move. Active canvas only (the table's gate).
|
|
@@ -354,6 +382,8 @@ export function useCanvasModeLane({ activePath, iframesRef, cfg, canEdit, role }
|
|
|
354
382
|
return {
|
|
355
383
|
mode,
|
|
356
384
|
caps,
|
|
385
|
+
/** 2.0.7 B2 — the active canvas shows Pages: the switch greys Preview and Present with the reason. */
|
|
386
|
+
pages: snap.pages === true,
|
|
357
387
|
/** The Present spec while presenting (Artboards · Canvas), else null. */
|
|
358
388
|
presentSpec: snap.present,
|
|
359
389
|
peers,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// snapshots (Phase 6 _comments/<slug>.json) + the annotations board (DDR-242) + the
|
|
3
3
|
// new `.ydoc.bin` cache under _state/<slug>.ydoc.bin.
|
|
4
4
|
|
|
5
|
+
import { rmSync } from 'node:fs';
|
|
5
6
|
import path from 'node:path';
|
|
6
7
|
|
|
7
8
|
import * as Y from 'yjs';
|
|
@@ -378,5 +379,12 @@ export function createPersistence(deps: PersistenceDeps): RoomCallbacks {
|
|
|
378
379
|
await Bun.write(ydocBinPath(slug), state);
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
|
|
382
|
+
// fix/205 — a cache, never content (DDR-051: JSON is canonical): the canvas
|
|
383
|
+
// it cached was deleted, and a room seeded from it would carry the deleted
|
|
384
|
+
// lineage into a canvas re-created at the same slug.
|
|
385
|
+
async function forget(slug: string): Promise<void> {
|
|
386
|
+
rmSync(ydocBinPath(slug), { force: true });
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return { seed, persistJson, persistBinary, forget };
|
|
382
390
|
}
|
|
@@ -145,6 +145,17 @@ export interface Registry {
|
|
|
145
145
|
* under the new slug via `get()`. No-op if no room is live for the slug.
|
|
146
146
|
*/
|
|
147
147
|
forceDrop(slug: string): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* fix/205 — throw away the room of a canvas that LEFT the project (deleted
|
|
150
|
+
* here, deleted in the project, moved away): no flush, and with
|
|
151
|
+
* `forgetCache` its `.ydoc.bin` goes too (`RoomCallbacks.forget`). Its Y.Doc is the deleted canvas's
|
|
152
|
+
* whole lineage; a canvas re-created at the same slug must start from a
|
|
153
|
+
* fresh doc, or the hub's new body merges onto the old one and the body
|
|
154
|
+
* doubles. Only an unpinned room with no browser connection is discarded —
|
|
155
|
+
* a connected browser's room is left to the last-browser-leaves `drop`.
|
|
156
|
+
* Returns whether a room was discarded.
|
|
157
|
+
*/
|
|
158
|
+
discard(slug: string, opts?: { forgetCache?: boolean }): Promise<boolean>;
|
|
148
159
|
/** Test/introspection. */
|
|
149
160
|
size(): number;
|
|
150
161
|
}
|
|
@@ -344,6 +355,26 @@ export function createRegistry(callbacks: RoomCallbacks): Registry {
|
|
|
344
355
|
await room.destroy();
|
|
345
356
|
}
|
|
346
357
|
|
|
358
|
+
async function discard(slug: string, opts: { forgetCache?: boolean } = {}): Promise<boolean> {
|
|
359
|
+
if (pinned.has(slug)) return false;
|
|
360
|
+
const room = rooms.get(slug);
|
|
361
|
+
if (room && room.size() > 0) return false;
|
|
362
|
+
if (opts.forgetCache) {
|
|
363
|
+
try {
|
|
364
|
+
await callbacks.forget?.(slug);
|
|
365
|
+
} catch (err) {
|
|
366
|
+
console.warn(`[collab/${slug}] could not drop the cached document:`, err);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (!room) return false;
|
|
370
|
+
teardownBridge(slug);
|
|
371
|
+
rooms.delete(slug);
|
|
372
|
+
// destroy() marks the room destroyed BEFORE its final flush, so nothing of
|
|
373
|
+
// the deleted canvas is written back (comments, annotations, the cache).
|
|
374
|
+
await room.destroy();
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
|
|
347
378
|
async function destroyAll(): Promise<void> {
|
|
348
379
|
for (const slug of Array.from(bridges.keys())) teardownBridge(slug);
|
|
349
380
|
hubAwareness.clear();
|
|
@@ -375,6 +406,7 @@ export function createRegistry(callbacks: RoomCallbacks): Registry {
|
|
|
375
406
|
destroyAll,
|
|
376
407
|
drop,
|
|
377
408
|
forceDrop,
|
|
409
|
+
discard,
|
|
378
410
|
size: () => rooms.size,
|
|
379
411
|
};
|
|
380
412
|
}
|
|
@@ -130,6 +130,14 @@ export interface RoomCallbacks {
|
|
|
130
130
|
*/
|
|
131
131
|
seed(slug: string, doc: Y.Doc): Promise<void> | void;
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* fix/205 — the canvas left the project: drop whatever persistence caches
|
|
135
|
+
* for its doc (the `.ydoc.bin`), so a room re-created for the same slug can
|
|
136
|
+
* never seed from the deleted canvas's lineage. Optional; absent = nothing
|
|
137
|
+
* cached outside the room.
|
|
138
|
+
*/
|
|
139
|
+
forget?(slug: string): Promise<void> | void;
|
|
140
|
+
|
|
133
141
|
/**
|
|
134
142
|
* Accepted revisions (DDR-241 §7): while true, this room's document is a
|
|
135
143
|
* replica of the project's accepted state — no browser connection may write
|
|
@@ -73,6 +73,7 @@ import { mineIdsOf, restampMine, viewerFor } from './comments/mine-stamp.ts';
|
|
|
73
73
|
import { committerRows, type MentionRow } from './comments/people.ts';
|
|
74
74
|
import { mmAtArtboardPx, trimOfPrint, videoPinVisible, whereOf } from './comments/where.ts';
|
|
75
75
|
import { resolveByDomPath } from './dom-selection.ts';
|
|
76
|
+
import { frameCaf, frameRaf } from './frame-clock.ts';
|
|
76
77
|
import { toneColor } from './presence/tones.ts';
|
|
77
78
|
import {
|
|
78
79
|
COMMENTS_PAUSED_REASON,
|
|
@@ -1195,7 +1196,7 @@ function MentionAwareTextarea({
|
|
|
1195
1196
|
setToken(null);
|
|
1196
1197
|
// Restore caret just past the inserted token + trailing space.
|
|
1197
1198
|
const newCaret = token.start + tag.length + 1;
|
|
1198
|
-
|
|
1199
|
+
frameRaf(() => {
|
|
1199
1200
|
ta.focus();
|
|
1200
1201
|
ta.setSelectionRange(newCaret, newCaret);
|
|
1201
1202
|
});
|
|
@@ -1384,7 +1385,7 @@ function CommentPin({
|
|
|
1384
1385
|
}
|
|
1385
1386
|
if (!pos) {
|
|
1386
1387
|
pin.style.display = 'none';
|
|
1387
|
-
rafRef.current =
|
|
1388
|
+
rafRef.current = frameRaf(tick);
|
|
1388
1389
|
return;
|
|
1389
1390
|
}
|
|
1390
1391
|
pin.style.display = 'grid';
|
|
@@ -1394,11 +1395,11 @@ function CommentPin({
|
|
|
1394
1395
|
const top = Math.round(pos.y - 14);
|
|
1395
1396
|
pin.style.left = `${left}px`;
|
|
1396
1397
|
pin.style.top = `${top}px`;
|
|
1397
|
-
rafRef.current =
|
|
1398
|
+
rafRef.current = frameRaf(tick);
|
|
1398
1399
|
};
|
|
1399
|
-
rafRef.current =
|
|
1400
|
+
rafRef.current = frameRaf(tick);
|
|
1400
1401
|
return () => {
|
|
1401
|
-
if (rafRef.current != null)
|
|
1402
|
+
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
1402
1403
|
};
|
|
1403
1404
|
}, [comment]);
|
|
1404
1405
|
|
|
@@ -1482,11 +1483,11 @@ export function CommentComposer({
|
|
|
1482
1483
|
const placed = placeNearPoint(anchor, { w: node.offsetWidth, h: node.offsetHeight });
|
|
1483
1484
|
node.style.left = `${Math.round(placed.x)}px`;
|
|
1484
1485
|
node.style.top = `${Math.round(placed.y)}px`;
|
|
1485
|
-
rafRef.current =
|
|
1486
|
+
rafRef.current = frameRaf(tick);
|
|
1486
1487
|
};
|
|
1487
|
-
rafRef.current =
|
|
1488
|
+
rafRef.current = frameRaf(tick);
|
|
1488
1489
|
return () => {
|
|
1489
|
-
if (rafRef.current != null)
|
|
1490
|
+
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
1490
1491
|
};
|
|
1491
1492
|
}, [state]);
|
|
1492
1493
|
|
|
@@ -1727,11 +1728,11 @@ export function CommentThread({
|
|
|
1727
1728
|
const placed = placeNearPoint(anchor, { w: node.offsetWidth, h: node.offsetHeight });
|
|
1728
1729
|
node.style.left = `${Math.round(placed.x)}px`;
|
|
1729
1730
|
node.style.top = `${Math.round(placed.y)}px`;
|
|
1730
|
-
rafRef.current =
|
|
1731
|
+
rafRef.current = frameRaf(tick);
|
|
1731
1732
|
};
|
|
1732
|
-
rafRef.current =
|
|
1733
|
+
rafRef.current = frameRaf(tick);
|
|
1733
1734
|
return () => {
|
|
1734
|
-
if (rafRef.current != null)
|
|
1735
|
+
if (rafRef.current != null) frameCaf(rafRef.current);
|
|
1735
1736
|
};
|
|
1736
1737
|
}, [comment]);
|
|
1737
1738
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Config hot-reload wiring — `/design:setup-ds` (or a hand edit) rewrites
|
|
2
|
+
// `.design/config.json` mid-session; without a re-read the server keeps
|
|
3
|
+
// serving the boot snapshot and a newly added canvas group (`system`) never
|
|
4
|
+
// reaches /_index-data. On change: swap ctx.cfg in place (reloadConfig) and
|
|
5
|
+
// let the caller react (canvas-list refresh, `config-updated` to shells).
|
|
6
|
+
// RCA: .ai/logs/rca/issue-ds-scaffold-files-not-in-filetree-stale-config.md
|
|
7
|
+
//
|
|
8
|
+
// 2.0.5 (#205): a cell's studio child has no file watcher, so it never sees
|
|
9
|
+
// `fs:json`; the hub's journal heal announces a peer's write as `fs:any`
|
|
10
|
+
// only (sync/cell-file-events.ts). Listening on `fs:json` alone left a cell
|
|
11
|
+
// judging design-system boards with the config it booted with. Both events
|
|
12
|
+
// share ONE debounce, so a watcher's `fs:json` + `fs:any` pair (or a watcher
|
|
13
|
+
// event plus a heal event) for the same write reloads once.
|
|
14
|
+
|
|
15
|
+
import { type Context, reloadConfig } from './context.ts';
|
|
16
|
+
import { isFolderSystemFile } from './ds/folder-systems.ts';
|
|
17
|
+
|
|
18
|
+
export const CONFIG_RELOAD_DEBOUNCE_MS = 150;
|
|
19
|
+
|
|
20
|
+
export interface ConfigReloadWire {
|
|
21
|
+
/** Drop a pending reload and stop listening. */
|
|
22
|
+
stop(): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isConfigJson(rel: unknown): boolean {
|
|
26
|
+
return typeof rel === 'string' && rel.replace(/\\/g, '/').replace(/^\/+/, '') === 'config.json';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function wireConfigReload(
|
|
30
|
+
ctx: Context,
|
|
31
|
+
opts: { onReloaded?: () => void; debounceMs?: number } = {}
|
|
32
|
+
): ConfigReloadWire {
|
|
33
|
+
const debounceMs = opts.debounceMs ?? CONFIG_RELOAD_DEBOUNCE_MS;
|
|
34
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
35
|
+
const onEvent = (rel: unknown) => {
|
|
36
|
+
// 2.0.7 — a system folder's Design system canvas (or its tokens) arriving, going or changing
|
|
37
|
+
// adds, drops or rethemes a folder-owned system in the merged list (ds/folder-systems.ts)
|
|
38
|
+
if (!isConfigJson(rel) && !isFolderSystemFile(rel)) return;
|
|
39
|
+
if (timer) clearTimeout(timer);
|
|
40
|
+
timer = setTimeout(() => {
|
|
41
|
+
timer = null;
|
|
42
|
+
if (!reloadConfig(ctx)) return;
|
|
43
|
+
opts.onReloaded?.();
|
|
44
|
+
}, debounceMs);
|
|
45
|
+
};
|
|
46
|
+
const offJson = ctx.bus.on('fs:json', onEvent);
|
|
47
|
+
const offAny = ctx.bus.on('fs:any', onEvent);
|
|
48
|
+
return {
|
|
49
|
+
stop() {
|
|
50
|
+
if (timer) clearTimeout(timer);
|
|
51
|
+
timer = null;
|
|
52
|
+
offJson();
|
|
53
|
+
offAny();
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -276,6 +276,12 @@
|
|
|
276
276
|
"default": true,
|
|
277
277
|
"description": "Sync v2 — the journal-driven file plane (Plane B): the downward project-file pull AND the widened upward sweep. Default ON; set false to fall back to the pre-Sync-v2 reach (binary media under assets/ only). Settable from the Sync panel's Settings section."
|
|
278
278
|
},
|
|
279
|
+
"ignoreFolders": {
|
|
280
|
+
"type": "array",
|
|
281
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 1024 },
|
|
282
|
+
"uniqueItems": true,
|
|
283
|
+
"description": "Issue #207 — design-root-relative folders this project does not sync (Sync details › Don't sync this folder). Nothing under them moves in either direction and what the workspace already holds stays there; the file plane reports their files as ignored, never as waiting. Absolute and '..' entries are dropped. Read at the start of every file-plane pass."
|
|
284
|
+
},
|
|
279
285
|
"propagateDeletes": {
|
|
280
286
|
"type": "boolean",
|
|
281
287
|
"default": true,
|
package/apps/studio/context.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { existsSync, readFileSync } from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
|
|
9
|
+
import { folderOwnedSystems } from './ds/folder-systems.ts';
|
|
9
10
|
import { linkConsent } from './sync/link-consent.ts';
|
|
10
11
|
|
|
11
12
|
export type ConfigSource = '.design/config.json' | 'defaults' | 'defaults (config invalid)';
|
|
@@ -27,6 +28,8 @@ export interface DesignSystemEntry {
|
|
|
27
28
|
newComponentDir?: string;
|
|
28
29
|
/** V2-1.13 §5.4 — conforms to design-system schema v1 (written only when ds-check exits 0). */
|
|
29
30
|
schema?: 1;
|
|
31
|
+
/** 2.0.7 — not in config.json: `system/<name>/` holds its own Design system canvas (ds/folder-systems.ts). */
|
|
32
|
+
folderOwned?: true;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
export interface LinkedHub {
|
|
@@ -66,6 +69,12 @@ export interface LinkedHub {
|
|
|
66
69
|
* asset lanes run regardless.
|
|
67
70
|
*/
|
|
68
71
|
syncFiles?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Issue #207 — design-root-relative folders this project does not sync (Sync details › Don't
|
|
74
|
+
* sync this folder). Nothing under them moves in either direction; what the workspace already
|
|
75
|
+
* holds stays there. Absent = sync every folder.
|
|
76
|
+
*/
|
|
77
|
+
ignoreFolders?: string[];
|
|
69
78
|
/**
|
|
70
79
|
* Sync v2 Increment 6 — does a deletion here become a deletion everywhere?
|
|
71
80
|
*
|
|
@@ -572,6 +581,27 @@ function withProjectConfig(cfg: DevServerConfig, repoRoot: string): DevServerCon
|
|
|
572
581
|
};
|
|
573
582
|
}
|
|
574
583
|
|
|
584
|
+
/**
|
|
585
|
+
* 2.0.7 — the folder-owned systems join the list, after every configured (and adopted) one, so the
|
|
586
|
+
* default never moves while the config lists a system. A cell's config.json never syncs, so a system
|
|
587
|
+
* converted on a desktop can be on the cell as files only (ds/folder-systems.ts). The list is for
|
|
588
|
+
* reading: every config.json writer reads the file itself.
|
|
589
|
+
*/
|
|
590
|
+
function withFolderSystems(cfg: DevServerConfig, repoRoot: string): DevServerConfig {
|
|
591
|
+
const designRel = String(cfg.designRoot ?? '.design').replace(/^\/+|\/+$/g, '');
|
|
592
|
+
const configured = (cfg.designSystems ?? []).map((d) => ({
|
|
593
|
+
name: d.name,
|
|
594
|
+
path: String(d.path ?? '').replace(/^\/+|\/+$/g, ''),
|
|
595
|
+
}));
|
|
596
|
+
const folders = folderOwnedSystems(path.join(repoRoot, designRel), configured);
|
|
597
|
+
if (!folders.length) return cfg;
|
|
598
|
+
// DesignSystemEntry types themeDefault as the studio's two app themes (as for an adopted system)
|
|
599
|
+
const entries: DesignSystemEntry[] = folders.map(({ themeDefault, ...d }) =>
|
|
600
|
+
themeDefault === 'dark' || themeDefault === 'light' ? { ...d, themeDefault } : d
|
|
601
|
+
);
|
|
602
|
+
return { ...cfg, designSystems: [...(cfg.designSystems ?? []), ...entries] };
|
|
603
|
+
}
|
|
604
|
+
|
|
575
605
|
export function loadConfig(repoRoot: string): DevServerConfig {
|
|
576
606
|
const configPath = path.join(repoRoot, '.design', 'config.json');
|
|
577
607
|
let raw: string;
|
|
@@ -583,7 +613,13 @@ export function loadConfig(repoRoot: string): DevServerConfig {
|
|
|
583
613
|
try {
|
|
584
614
|
const parsed = JSON.parse(raw);
|
|
585
615
|
return normalizeConfig(
|
|
586
|
-
|
|
616
|
+
withFolderSystems(
|
|
617
|
+
withProjectConfig(
|
|
618
|
+
{ ...DEFAULT_CONFIG, ...parsed, _source: '.design/config.json' },
|
|
619
|
+
repoRoot
|
|
620
|
+
),
|
|
621
|
+
repoRoot
|
|
622
|
+
)
|
|
587
623
|
);
|
|
588
624
|
} catch (e) {
|
|
589
625
|
const msg = e instanceof Error ? e.message : String(e);
|