@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
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
// Output: `diff.json` (every measurement) and `review.json` (the four SCHEMA_FIX lines) beside the
|
|
17
17
|
// stage record.
|
|
18
18
|
|
|
19
|
-
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
19
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
20
20
|
import { tmpdir } from 'node:os';
|
|
21
21
|
import { basename, dirname, join } from 'node:path';
|
|
22
22
|
import type { Subprocess } from 'bun';
|
|
23
23
|
import { exportShimPath, spawnShim } from '../exporters/_runtime.ts';
|
|
24
|
-
import { DEV_SERVER_ROOT } from '../paths.ts';
|
|
24
|
+
import { DEV_SERVER_ROOT, IS_COMPILED_BINARY } from '../paths.ts';
|
|
25
25
|
import { checkCanvas } from './canvas-check.ts';
|
|
26
26
|
import { canvasContext, listCanvases } from './canvas-cli.ts';
|
|
27
27
|
import { systemConfigsFrom } from './system.ts';
|
|
@@ -46,11 +46,15 @@ export const DIFF_FORMAT = 'maude.ds-upgrade-diff';
|
|
|
46
46
|
export const REVIEW_FORMAT = 'maude.ds-upgrade-review';
|
|
47
47
|
export const DELTA_E = 2;
|
|
48
48
|
export const FAIL_RATIO = 0.005;
|
|
49
|
+
/** one canvas's hard deadline in the visual gate */
|
|
50
|
+
export const CANVAS_TIMEOUT = 180_000;
|
|
49
51
|
|
|
50
52
|
export interface RenderCanvas {
|
|
51
53
|
path: string;
|
|
52
54
|
tokens: string | null;
|
|
53
55
|
components: string | null;
|
|
56
|
+
/** the system's themes: an artboard that carries none of its own is measured in each */
|
|
57
|
+
themes?: string[];
|
|
54
58
|
}
|
|
55
59
|
export interface RenderJob {
|
|
56
60
|
before: string;
|
|
@@ -59,6 +63,8 @@ export interface RenderJob {
|
|
|
59
63
|
deltaE: number;
|
|
60
64
|
ratio: number;
|
|
61
65
|
timeout: number;
|
|
66
|
+
/** the hard deadline of one canvas (ms): past it the canvas is `timeout` and the run goes on */
|
|
67
|
+
canvasTimeout?: number;
|
|
62
68
|
}
|
|
63
69
|
export interface ArtboardDiff {
|
|
64
70
|
id: string;
|
|
@@ -69,9 +75,23 @@ export interface ArtboardDiff {
|
|
|
69
75
|
area?: number;
|
|
70
76
|
fail: boolean;
|
|
71
77
|
reason?: string;
|
|
78
|
+
/** failed before x after, but before x before failed alike: the gate's own noise, not a change */
|
|
79
|
+
noise?: boolean;
|
|
80
|
+
/** nothing rendered on either side */
|
|
81
|
+
empty?: boolean;
|
|
82
|
+
/** before x before (the noise control), when it ran */
|
|
83
|
+
control?: { changed: number; area: number; sized: boolean };
|
|
72
84
|
}
|
|
73
85
|
export interface RenderResult {
|
|
74
|
-
canvases: {
|
|
86
|
+
canvases: {
|
|
87
|
+
path: string;
|
|
88
|
+
/** before / after: that side showed an error; render: the gate threw; timeout: no answer */
|
|
89
|
+
error?: string;
|
|
90
|
+
detail?: string;
|
|
91
|
+
/** no artboard: the canvas's whole mount was measured */
|
|
92
|
+
specimen?: boolean;
|
|
93
|
+
artboards: ArtboardDiff[];
|
|
94
|
+
}[];
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
export interface Studio {
|
|
@@ -114,18 +134,117 @@ export interface Review {
|
|
|
114
134
|
keepsOwn: { native: string; as: string }[];
|
|
115
135
|
updatesCanvases: { path: string; edits: number; diff: 'pass' | 'fail' }[];
|
|
116
136
|
refused: { path: string; reason: string }[];
|
|
137
|
+
/** canvases the gate could not measure (a timeout, a broken before): they block nothing, and a
|
|
138
|
+
* codemod on one is not applied (it is in `refused` too) */
|
|
139
|
+
unmeasured?: { path: string; reason: string }[];
|
|
117
140
|
needsPick: string[];
|
|
118
141
|
}
|
|
119
142
|
|
|
120
143
|
/* ------------------------------------------------------------- studios */
|
|
121
144
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
/** A compiled studio by its shape: the desktop sidecar `maude-server`, or npm's `maude-<slug>/maude`. */
|
|
146
|
+
export function isCompiledStudioBinary(p: string | undefined | null): boolean {
|
|
147
|
+
if (!p) return false;
|
|
148
|
+
const b = basename(p);
|
|
149
|
+
if (b === 'maude-server' || b === 'maude-server.exe') return true;
|
|
150
|
+
return (b === 'maude' || b === 'maude.exe') && /^maude-[a-z0-9-]+$/.test(basename(dirname(p)));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ServerResolveInput {
|
|
154
|
+
env: Record<string, string | undefined>;
|
|
155
|
+
/** this process's executable (the compiled studio, a compiled binary run as bun, or bun) */
|
|
156
|
+
execPath: string;
|
|
157
|
+
/** apps/studio as paths.ts resolved it */
|
|
158
|
+
devServerRoot: string;
|
|
159
|
+
/** true inside the compiled studio itself (paths.ts IS_COMPILED_BINARY) */
|
|
160
|
+
compiled: boolean;
|
|
161
|
+
exists: (p: string) => boolean;
|
|
162
|
+
readText?: (p: string) => string | null;
|
|
163
|
+
/** npm platform-package slugs to look for (`darwin-arm64`, `linux-x64`, `linux-x64-musl`…) */
|
|
164
|
+
platformSlugs?: string[];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface ServerCommand {
|
|
168
|
+
cmd: string[];
|
|
169
|
+
/** env the compiled studio needs to find its served tree (the desktop sidecar sets the same) */
|
|
170
|
+
env: Record<string, string>;
|
|
171
|
+
kind: 'compiled' | 'source';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* How a staged studio is started — the same resolution the desktop sidecar and `maude design serve`
|
|
176
|
+
* use (DDR-084, DDR-177): the COMPILED studio whenever one exists, because it embeds every dependency
|
|
177
|
+
* the source server imports (the hub's transaction core, jszip, yjs…), none of which a packaged app or
|
|
178
|
+
* an npm install has on disk. Source (`bun run server.ts`) only in a dev tree, or when nothing
|
|
179
|
+
* compiled is there.
|
|
180
|
+
*
|
|
181
|
+
* 1. this process IS the compiled studio (a prove started from the studio's own route)
|
|
182
|
+
* 2. MAUDE_DEV_SERVER_BIN (the desktop sidecar hands it to every child; `maude design` to boot verbs)
|
|
183
|
+
* 3. not a dev tree: this process's executable when it is a compiled studio run as bun (the
|
|
184
|
+
* desktop's bun shim), the .app's Contents/MacOS/maude-server, npm's maude-<slug>/maude
|
|
185
|
+
* 4. server.ts from source
|
|
186
|
+
*/
|
|
187
|
+
export function resolveStudioServer(o: ServerResolveInput): ServerCommand {
|
|
188
|
+
const pkgRoot = join(o.devServerRoot, '..', '..');
|
|
189
|
+
const compiledEnv = (): Record<string, string> => ({
|
|
190
|
+
MAUDE_DEV_SERVER_ROOT: o.devServerRoot,
|
|
191
|
+
...(o.exists(join(pkgRoot, 'cli', 'commands', 'design.mjs'))
|
|
192
|
+
? { MAUDE_PKG_ROOT: pkgRoot }
|
|
193
|
+
: {}),
|
|
194
|
+
});
|
|
195
|
+
const compiled = (bin: string): ServerCommand => ({
|
|
196
|
+
cmd: [bin],
|
|
197
|
+
env: compiledEnv(),
|
|
198
|
+
kind: 'compiled',
|
|
199
|
+
});
|
|
200
|
+
if (o.compiled && !o.env.BUN_BE_BUN) return compiled(o.execPath);
|
|
201
|
+
const fromEnv = o.env.MAUDE_DEV_SERVER_BIN;
|
|
202
|
+
if (fromEnv && isCompiledStudioBinary(fromEnv) && o.exists(fromEnv)) return compiled(fromEnv);
|
|
203
|
+
const serverTs = join(o.devServerRoot, 'server.ts');
|
|
204
|
+
const devTree =
|
|
205
|
+
o.env.MAUDE_FORCE_SOURCE === '1' ||
|
|
206
|
+
o.exists(join(pkgRoot, 'packages', 'maude-darwin-arm64', 'package.json'));
|
|
207
|
+
if (!devTree) {
|
|
208
|
+
const exe = process.platform === 'win32' ? 'maude-server.exe' : 'maude-server';
|
|
209
|
+
const candidates = [
|
|
210
|
+
o.execPath,
|
|
211
|
+
join(o.devServerRoot, '..', '..', '..', 'MacOS', exe),
|
|
212
|
+
...(o.platformSlugs ?? []).map((slug) =>
|
|
213
|
+
join(pkgRoot, '..', `maude-${slug}`, process.platform === 'win32' ? 'maude.exe' : 'maude')
|
|
214
|
+
),
|
|
215
|
+
];
|
|
216
|
+
const side = o.readText?.(join(pkgRoot, 'cli', '.platform-binary-path'))?.trim();
|
|
217
|
+
if (side) candidates.push(side);
|
|
218
|
+
for (const c of candidates) if (isCompiledStudioBinary(c) && o.exists(c)) return compiled(c);
|
|
219
|
+
}
|
|
220
|
+
if (!o.exists(serverTs)) return compiled(o.execPath); // nothing else to run
|
|
221
|
+
const bun = basename(o.execPath).startsWith('bun')
|
|
222
|
+
? o.execPath
|
|
223
|
+
: (Bun.which('bun') ?? o.execPath);
|
|
224
|
+
return { cmd: [bun, 'run', serverTs], env: {}, kind: 'source' };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function platformSlugs(): string[] {
|
|
228
|
+
const base = `${process.platform}-${process.platform === 'win32' ? 'x64' : process.arch}`;
|
|
229
|
+
return process.platform === 'linux' ? [base, `${base}-musl`] : [base];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function serverCommand(): ServerCommand {
|
|
233
|
+
return resolveStudioServer({
|
|
234
|
+
env: process.env,
|
|
235
|
+
execPath: process.execPath,
|
|
236
|
+
devServerRoot: DEV_SERVER_ROOT,
|
|
237
|
+
compiled: IS_COMPILED_BINARY,
|
|
238
|
+
exists: existsSync,
|
|
239
|
+
readText: (p) => {
|
|
240
|
+
try {
|
|
241
|
+
return readFileSync(p, 'utf8');
|
|
242
|
+
} catch {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
platformSlugs: platformSlugs(),
|
|
247
|
+
});
|
|
129
248
|
}
|
|
130
249
|
|
|
131
250
|
/**
|
|
@@ -139,15 +258,33 @@ const STAGED_DROP =
|
|
|
139
258
|
export function studioEnv(
|
|
140
259
|
projectRoot: string,
|
|
141
260
|
machineFile: string,
|
|
142
|
-
from: Record<string, string | undefined> = process.env
|
|
261
|
+
from: Record<string, string | undefined> = process.env,
|
|
262
|
+
/** a throwaway home: the staged studio writes prefs (fold state…) under HOME/XDG_CONFIG_HOME,
|
|
263
|
+
* and a staged copy must never write the person's real ~/.config/maude */
|
|
264
|
+
home?: string
|
|
143
265
|
): Record<string, string> {
|
|
144
266
|
// the staged studio picks its own port, and runs as the studio (never as a bare bun)
|
|
145
267
|
const drop = new Set(['BUN_BE_BUN', 'PORT', 'MDCC_DEV_PORT']);
|
|
268
|
+
// with a throwaway home, nothing may point back at the person's own config stores
|
|
269
|
+
const homeDrop = new Set([
|
|
270
|
+
'XDG_CONFIG_HOME',
|
|
271
|
+
'HUBS_CONFIG_PATH',
|
|
272
|
+
'MAUDE_CLOUD_CONFIG',
|
|
273
|
+
'MAUDE_INDEX_DIR',
|
|
274
|
+
]);
|
|
146
275
|
const env: Record<string, string> = {};
|
|
147
276
|
for (const [k, v] of Object.entries(from))
|
|
148
|
-
if (v !== undefined && !drop.has(k) && !STAGED_DROP.test(k)
|
|
277
|
+
if (v !== undefined && !drop.has(k) && !STAGED_DROP.test(k) && !(home && homeDrop.has(k)))
|
|
278
|
+
env[k] = v;
|
|
149
279
|
return {
|
|
150
280
|
...env,
|
|
281
|
+
...(home
|
|
282
|
+
? {
|
|
283
|
+
HOME: home,
|
|
284
|
+
XDG_CONFIG_HOME: join(home, '.config'),
|
|
285
|
+
MAUDE_INDEX_DIR: join(home, 'index'),
|
|
286
|
+
}
|
|
287
|
+
: {}),
|
|
151
288
|
NO_OPEN: '1',
|
|
152
289
|
MAUDE_NO_AUTOBUILD: '1',
|
|
153
290
|
MAUDE_MACHINE_FILE: machineFile,
|
|
@@ -159,12 +296,35 @@ export function studioEnv(
|
|
|
159
296
|
export async function bootHeadlessStudio(projectRoot: string): Promise<Studio> {
|
|
160
297
|
const designRoot = join(projectRoot, '.design');
|
|
161
298
|
const scratch = mkdtempSync(join(tmpdir(), 'maude-ds-prove-machine-'));
|
|
162
|
-
|
|
299
|
+
mkdirSync(join(scratch, 'home', '.config'), { recursive: true });
|
|
300
|
+
const server = serverCommand();
|
|
301
|
+
const proc: Subprocess = Bun.spawn([...server.cmd, '--root', projectRoot, '--port', '0'], {
|
|
163
302
|
cwd: DEV_SERVER_ROOT,
|
|
164
|
-
env:
|
|
303
|
+
env: {
|
|
304
|
+
...studioEnv(projectRoot, join(scratch, 'machine.json'), process.env, join(scratch, 'home')),
|
|
305
|
+
...server.env,
|
|
306
|
+
},
|
|
165
307
|
stdout: 'ignore',
|
|
166
308
|
stderr: 'pipe',
|
|
167
309
|
});
|
|
310
|
+
// drain stderr (an unread pipe can stall a chatty child) and keep its tail for the error
|
|
311
|
+
let errTail = '';
|
|
312
|
+
void (async () => {
|
|
313
|
+
try {
|
|
314
|
+
const dec = new TextDecoder();
|
|
315
|
+
for await (const chunk of proc.stderr as ReadableStream<Uint8Array>)
|
|
316
|
+
errTail = (errTail + dec.decode(chunk)).slice(-2000);
|
|
317
|
+
} catch {
|
|
318
|
+
/* gone */
|
|
319
|
+
}
|
|
320
|
+
})();
|
|
321
|
+
const lastLine = () =>
|
|
322
|
+
errTail
|
|
323
|
+
.trim()
|
|
324
|
+
.split('\n')
|
|
325
|
+
.filter((l) => l.trim())
|
|
326
|
+
.at(-1)
|
|
327
|
+
?.slice(0, 240) ?? '';
|
|
168
328
|
const stop = async () => {
|
|
169
329
|
const exited = proc.exited.then(
|
|
170
330
|
() => true,
|
|
@@ -189,7 +349,13 @@ export async function bootHeadlessStudio(projectRoot: string): Promise<Studio> {
|
|
|
189
349
|
try {
|
|
190
350
|
const started = Date.now();
|
|
191
351
|
while (Date.now() - started < 60000) {
|
|
192
|
-
if (proc.exitCode !== null)
|
|
352
|
+
if (proc.exitCode !== null) {
|
|
353
|
+
await Bun.sleep(50); // the last stderr chunk
|
|
354
|
+
const why = lastLine();
|
|
355
|
+
throw new Error(
|
|
356
|
+
`the staged ${server.kind} studio exited ${proc.exitCode}${why ? `: ${why}` : ''}`
|
|
357
|
+
);
|
|
358
|
+
}
|
|
193
359
|
try {
|
|
194
360
|
const s = JSON.parse(readFileSync(join(designRoot, '_server.json'), 'utf8')) as {
|
|
195
361
|
pid?: number;
|
|
@@ -252,6 +418,7 @@ function affectedCanvases(stageDir: string, ds: string): RenderCanvas[] {
|
|
|
252
418
|
out.push({
|
|
253
419
|
path: rel,
|
|
254
420
|
tokens: sys?.tokensCssRel ?? null,
|
|
421
|
+
themes: sys?.themes ?? [],
|
|
255
422
|
components: sys ? `${sys.path}/preview/_components.css` : null,
|
|
256
423
|
});
|
|
257
424
|
}
|
|
@@ -271,7 +438,21 @@ function reviewOf(
|
|
|
271
438
|
path: r.path,
|
|
272
439
|
reason: r.invariant,
|
|
273
440
|
}));
|
|
441
|
+
const unmeasured: { path: string; reason: string }[] = [];
|
|
274
442
|
for (const c of result.canvases) {
|
|
443
|
+
// A canvas that could not be measured (no answer in time, an error before the upgrade touched
|
|
444
|
+
// anything, the gate itself threw) proves nothing either way: it never blocks the system files,
|
|
445
|
+
// and its own codemod is not applied unproved. `after` alone is a finding: the upgrade broke it.
|
|
446
|
+
// Noise the control explained away is not a failure (`noise`, the shim's judge).
|
|
447
|
+
if (c.error && c.error !== 'after') {
|
|
448
|
+
const reason = c.error === 'timeout' ? 'timeout' : 'unmeasured';
|
|
449
|
+
unmeasured.push({ path: c.path, reason });
|
|
450
|
+
if (codemodded.has(c.path)) {
|
|
451
|
+
failedCanvases.add(c.path);
|
|
452
|
+
refused.push({ path: c.path, reason });
|
|
453
|
+
}
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
275
456
|
const failed = c.error === 'after' || c.artboards.some((a) => a.fail);
|
|
276
457
|
if (!failed) continue;
|
|
277
458
|
if (codemodded.has(c.path)) {
|
|
@@ -317,6 +498,7 @@ function reviewOf(
|
|
|
317
498
|
diff: failedCanvases.has(c.path) ? 'fail' : 'pass',
|
|
318
499
|
})),
|
|
319
500
|
refused,
|
|
501
|
+
...(unmeasured.length ? { unmeasured } : {}),
|
|
320
502
|
needsPick: items.filter((i) => i.status === 'needs-pick' && i.picked == null).map((i) => i.id),
|
|
321
503
|
};
|
|
322
504
|
return { review, failedCanvases };
|
|
@@ -390,6 +572,7 @@ export async function proveStage(
|
|
|
390
572
|
deltaE: DELTA_E,
|
|
391
573
|
ratio: FAIL_RATIO,
|
|
392
574
|
timeout: 20000,
|
|
575
|
+
canvasTimeout: CANVAS_TIMEOUT,
|
|
393
576
|
},
|
|
394
577
|
{
|
|
395
578
|
signal: ctl.signal,
|
|
@@ -33,6 +33,7 @@ import { isRuntimeStateRel } from '../sync/file-membership.ts';
|
|
|
33
33
|
import { canvasContext } from './canvas-cli.ts';
|
|
34
34
|
import { checkSystem } from './check.ts';
|
|
35
35
|
import { emitTokensJson } from './emit.ts';
|
|
36
|
+
import { adoptFolderSystem } from './folder-systems.ts';
|
|
36
37
|
import { indexRegistry, loadRegistry } from './registry.ts';
|
|
37
38
|
import { diskFs, loadSystem, type SystemConfig, systemConfigsFrom } from './system.ts';
|
|
38
39
|
import {
|
|
@@ -189,7 +190,10 @@ export function systemOf(designRoot: string, ds: string): SystemConfig {
|
|
|
189
190
|
/** `<designRoot>/_state/ds-upgrade/<ds>/<stamp>` — the stamp is digits only (never a path). */
|
|
190
191
|
export function stateDirOf(designRoot: string, ds: string, stamp: string): string {
|
|
191
192
|
if (!/^[0-9]{1,20}(?:-[0-9]{1,4})?$/.test(stamp))
|
|
192
|
-
throw new DsUpgradeError(
|
|
193
|
+
throw new DsUpgradeError(
|
|
194
|
+
'ds-upgrade-usage',
|
|
195
|
+
'a stage is named by its stamp: the digits `ds-upgrade <ds> --stage` printed as "stamp" (`ds-upgrade <ds> --status` lists them; the record is _state/ds-upgrade/<ds>/<stamp>/)'
|
|
196
|
+
);
|
|
193
197
|
return join(designRoot, STATE_REL, ds, stamp);
|
|
194
198
|
}
|
|
195
199
|
|
|
@@ -283,14 +287,17 @@ export function stageUpgrade(inp: StageInput): StageResult {
|
|
|
283
287
|
const conformantAfter = report.reasons.length === 0;
|
|
284
288
|
if (conformantAfter) {
|
|
285
289
|
const liveConfig = readJson(join(inp.designRoot, 'config.json'));
|
|
286
|
-
|
|
290
|
+
// 2.0.7 — a folder-owned system gets its schema flag on its adopted entry (ds/folder-systems.ts)
|
|
291
|
+
adoptFolderSystem(inp.designRoot, liveConfig, cfg.name);
|
|
292
|
+
const list = (liveConfig.designSystems ?? []) as Record<string, unknown>[];
|
|
287
293
|
const entry = list.find((s) => s && s.name === cfg.name);
|
|
288
294
|
if (entry && entry.schema !== 1) {
|
|
289
295
|
entry.schema = 1;
|
|
290
296
|
const text = jsonText(liveConfig);
|
|
291
297
|
// the staged copy keeps its own linkedHub-free config, with the same schema flag
|
|
292
298
|
const staged = readJson(join(after, 'config.json'));
|
|
293
|
-
|
|
299
|
+
adoptFolderSystem(after, staged, cfg.name);
|
|
300
|
+
const se = ((staged.designSystems ?? []) as Record<string, unknown>[]).find(
|
|
294
301
|
(s) => s && s.name === cfg.name
|
|
295
302
|
);
|
|
296
303
|
if (se) se.schema = 1;
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
// Decorative: aria-hidden, pointer-events none.
|
|
12
12
|
|
|
13
13
|
import { useEffect, useRef, useState } from 'react';
|
|
14
|
-
|
|
15
14
|
import { acceptFromShell } from '../bridge/dgn-protocol.ts';
|
|
15
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
16
16
|
|
|
17
17
|
export interface PointRow {
|
|
18
18
|
artboard: string;
|
|
@@ -125,11 +125,11 @@ export function AiPointRings(): null | React.JSX.Element {
|
|
|
125
125
|
ring.style.height = `${Math.round(r.height + PAD * 2)}px`;
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
raf =
|
|
128
|
+
raf = frameRaf(tick);
|
|
129
129
|
};
|
|
130
|
-
raf =
|
|
130
|
+
raf = frameRaf(tick);
|
|
131
131
|
return () => {
|
|
132
|
-
if (raf != null)
|
|
132
|
+
if (raf != null) frameCaf(raf);
|
|
133
133
|
};
|
|
134
134
|
}, [visible, rows]);
|
|
135
135
|
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// bubble follows pan and zoom; when it goes, it says `null` once.
|
|
11
11
|
|
|
12
12
|
import { useEffect, useRef, useState } from 'react';
|
|
13
|
-
|
|
14
13
|
import { acceptFromShell } from '../bridge/dgn-protocol.ts';
|
|
14
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
15
15
|
import { AiPointRings } from './ai-point-ring.tsx';
|
|
16
16
|
import { unionRect } from './ask-bubble.tsx';
|
|
17
17
|
|
|
@@ -145,11 +145,11 @@ function AiScopeBox(): null | React.JSX.Element {
|
|
|
145
145
|
told.current = key;
|
|
146
146
|
tellShell(box);
|
|
147
147
|
}
|
|
148
|
-
raf =
|
|
148
|
+
raf = frameRaf(tick);
|
|
149
149
|
};
|
|
150
|
-
raf =
|
|
150
|
+
raf = frameRaf(tick);
|
|
151
151
|
return () => {
|
|
152
|
-
if (raf != null)
|
|
152
|
+
if (raf != null) frameCaf(raf);
|
|
153
153
|
};
|
|
154
154
|
}, [rows]);
|
|
155
155
|
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
// `.dc-multi-artboard-tb` on the bar over artboards.
|
|
18
18
|
|
|
19
19
|
import { type ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
|
-
|
|
21
20
|
import { canvasModeStore } from '../bridge/canvas-mode-store.ts';
|
|
22
21
|
import { acceptFromShell } from '../bridge/dgn-protocol.ts';
|
|
23
22
|
import { useArtboardsContext, useDragStateContext } from '../canvas-lib.tsx';
|
|
24
23
|
import { showCanvasToast } from '../canvas-notifications.tsx';
|
|
25
24
|
import { isElementDragActive } from '../drag-state.ts';
|
|
25
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
26
26
|
import { isReadOnlyCanvas } from '../read-only-mode.ts';
|
|
27
27
|
import { useSelectionSet } from '../use-selection-set.tsx';
|
|
28
28
|
import { useUndoStackOptional } from '../use-undo-stack.tsx';
|
|
@@ -433,7 +433,7 @@ export function AlignBar({ readOnly = false }: { readOnly?: boolean }) {
|
|
|
433
433
|
div.setAttribute('data-on', 'false');
|
|
434
434
|
};
|
|
435
435
|
const tick = () => {
|
|
436
|
-
raf =
|
|
436
|
+
raf = frameRaf(tick);
|
|
437
437
|
const { selected: sel } = live.current;
|
|
438
438
|
const els: Element[] =
|
|
439
439
|
kind === 'artboards'
|
|
@@ -457,8 +457,8 @@ export function AlignBar({ readOnly = false }: { readOnly?: boolean }) {
|
|
|
457
457
|
div.style.top = `${at.top}px`;
|
|
458
458
|
div.setAttribute('data-on', 'true');
|
|
459
459
|
};
|
|
460
|
-
raf =
|
|
461
|
-
return () =>
|
|
460
|
+
raf = frameRaf(tick);
|
|
461
|
+
return () => frameCaf(raf);
|
|
462
462
|
}, [kind]);
|
|
463
463
|
|
|
464
464
|
if (!model) return null;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// Pure like empty-report.ts (the document, the clock and the post are injected): the throttle and the "once
|
|
11
11
|
// per change" rule are unit tests. One post per animation frame at most.
|
|
12
12
|
|
|
13
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
13
14
|
import { articleOf, bodyOf, type EmptyRect, labelOf } from './empty-report.ts';
|
|
14
15
|
|
|
15
16
|
// unlike the empty hint's rect, an artboard panned half off the left or top edge really is at a negative x / y
|
|
@@ -70,12 +71,12 @@ export function createAnchorReporter(deps: AnchorReporterDeps): AnchorReporter {
|
|
|
70
71
|
deps.raf ??
|
|
71
72
|
((fn: () => void) =>
|
|
72
73
|
typeof requestAnimationFrame === 'function'
|
|
73
|
-
?
|
|
74
|
+
? frameRaf(fn)
|
|
74
75
|
: (setTimeout(fn, 16) as unknown as number));
|
|
75
76
|
const caf =
|
|
76
77
|
deps.caf ??
|
|
77
78
|
((id: number) =>
|
|
78
|
-
typeof cancelAnimationFrame === 'function' ?
|
|
79
|
+
typeof cancelAnimationFrame === 'function' ? frameCaf(id) : clearTimeout(id));
|
|
79
80
|
let pending: number | null = null;
|
|
80
81
|
let lastKey = NONE; // what the shell was last told
|
|
81
82
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
// (use-element-resize.tsx) stand down for an artboard — one set of handles, not two.
|
|
16
16
|
|
|
17
17
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
18
|
-
|
|
19
18
|
import { useDragStateContext } from '../canvas-lib.tsx';
|
|
19
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
20
20
|
import { physicalSizeWords } from '../kinds/physical.ts';
|
|
21
21
|
import { isReadOnlyCanvas } from '../read-only-mode.ts';
|
|
22
22
|
import { useSelectionSet } from '../use-selection-set.tsx';
|
|
@@ -317,7 +317,7 @@ export function ArtboardHandles(): React.ReactNode {
|
|
|
317
317
|
for (const el of handleEls.current.values()) el.style.display = 'none';
|
|
318
318
|
};
|
|
319
319
|
const tick = () => {
|
|
320
|
-
raf =
|
|
320
|
+
raf = frameRaf(tick);
|
|
321
321
|
const m = measureArtboard(document, id);
|
|
322
322
|
if (!m) return hide();
|
|
323
323
|
if (marked !== m.article) {
|
|
@@ -371,9 +371,9 @@ export function ArtboardHandles(): React.ReactNode {
|
|
|
371
371
|
el.style.top = `${Math.round(at[h][1])}px`;
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
|
-
raf =
|
|
374
|
+
raf = frameRaf(tick);
|
|
375
375
|
return () => {
|
|
376
|
-
|
|
376
|
+
frameCaf(raf);
|
|
377
377
|
marked?.removeAttribute('data-ed-selected');
|
|
378
378
|
const label = marked?.querySelector(':scope > .dc-artboard-label');
|
|
379
379
|
label?.removeAttribute('data-ed-size');
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
// transform, like the selection chrome, so a dot is 10 px at any zoom.
|
|
16
16
|
|
|
17
17
|
import { useEffect, useRef, useState } from 'react';
|
|
18
|
-
|
|
19
18
|
import { showCanvasToast } from '../canvas-notifications.tsx';
|
|
20
19
|
import { resolveSelectionEl } from '../dom-selection.ts';
|
|
20
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
21
21
|
import { useSelectionSet } from '../use-selection-set.tsx';
|
|
22
22
|
import { useToolModeOptional } from '../use-tool-mode.tsx';
|
|
23
23
|
import { useUndoStackOptional } from '../use-undo-stack.tsx';
|
|
@@ -243,11 +243,11 @@ export function CornerDots({ readOnly = false }: { readOnly?: boolean }) {
|
|
|
243
243
|
last = key;
|
|
244
244
|
force((n) => n + 1);
|
|
245
245
|
}
|
|
246
|
-
raf =
|
|
246
|
+
raf = frameRaf(tick);
|
|
247
247
|
};
|
|
248
|
-
raf =
|
|
248
|
+
raf = frameRaf(tick);
|
|
249
249
|
return () => {
|
|
250
|
-
if (raf != null)
|
|
250
|
+
if (raf != null) frameCaf(raf);
|
|
251
251
|
};
|
|
252
252
|
}, [ok, el]);
|
|
253
253
|
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
// Nothing is written while the pointer is down. A read-only canvas never enters; a locked picture says so.
|
|
14
14
|
|
|
15
15
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
-
|
|
17
16
|
import { acceptFromShell } from '../bridge/dgn-protocol.ts';
|
|
18
17
|
import { showCanvasToast } from '../canvas-notifications.tsx';
|
|
19
18
|
import type { EditOpResult, ElementRef } from '../edit-ops/types.ts';
|
|
19
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
20
20
|
import { isReadOnlyCanvas } from '../read-only-mode.ts';
|
|
21
21
|
import { useSelectionSet } from '../use-selection-set.tsx';
|
|
22
22
|
import { useToolModeOptional } from '../use-tool-mode.tsx';
|
|
@@ -399,12 +399,12 @@ export function CropMode({ readOnly }: { readOnly?: boolean }) {
|
|
|
399
399
|
const n = measureBox(active.el);
|
|
400
400
|
return b && b.left === n.left && b.top === n.top && b.w === n.w && b.h === n.h ? b : n;
|
|
401
401
|
});
|
|
402
|
-
raf =
|
|
402
|
+
raf = frameRaf(tick);
|
|
403
403
|
};
|
|
404
|
-
raf =
|
|
404
|
+
raf = frameRaf(tick);
|
|
405
405
|
return () => {
|
|
406
406
|
document.removeEventListener('keydown', key, true);
|
|
407
|
-
|
|
407
|
+
frameCaf(raf);
|
|
408
408
|
};
|
|
409
409
|
}, [active, commit, leave]);
|
|
410
410
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// The chip follows pan and zoom while it is up (a drag takes a few seconds, the camera can move under it).
|
|
7
7
|
|
|
8
8
|
import { type ReactElement, useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
9
|
import { acceptFromShell } from '../bridge/dgn-protocol.ts';
|
|
10
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
11
11
|
|
|
12
12
|
/** The chip's words (07 · ve-drop). */
|
|
13
13
|
export const DROP_CHIP_TEXT = 'Or drop here — adds at the end';
|
|
@@ -80,10 +80,10 @@ export function DropChip(): ReactElement | null {
|
|
|
80
80
|
key = k;
|
|
81
81
|
tick((n) => n + 1);
|
|
82
82
|
}
|
|
83
|
-
raf =
|
|
83
|
+
raf = frameRaf(loop);
|
|
84
84
|
};
|
|
85
|
-
raf =
|
|
86
|
-
return () =>
|
|
85
|
+
raf = frameRaf(loop);
|
|
86
|
+
return () => frameCaf(raf);
|
|
87
87
|
}, [artboardId]);
|
|
88
88
|
|
|
89
89
|
if (!artboardId || typeof document === 'undefined') return null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
1
2
|
// apps/studio/editing/empty-report.ts — S11.2: the canvas tells its shell what is empty.
|
|
2
3
|
//
|
|
3
4
|
// Two facts the shell cannot know for itself (it never reads the canvas DOM):
|
|
@@ -127,12 +128,12 @@ export function createEmptyReporter(deps: EmptyReporterDeps): EmptyReporter {
|
|
|
127
128
|
deps.raf ??
|
|
128
129
|
((fn: () => void) =>
|
|
129
130
|
typeof requestAnimationFrame === 'function'
|
|
130
|
-
?
|
|
131
|
+
? frameRaf(fn)
|
|
131
132
|
: (setTimeout(fn, 16) as unknown as number));
|
|
132
133
|
const caf =
|
|
133
134
|
deps.caf ??
|
|
134
135
|
((id: number) =>
|
|
135
|
-
typeof cancelAnimationFrame === 'function' ?
|
|
136
|
+
typeof cancelAnimationFrame === 'function' ? frameCaf(id) : clearTimeout(id));
|
|
136
137
|
let pending: number | null = null;
|
|
137
138
|
let lastCount = -1;
|
|
138
139
|
let lastKey: string | null = null;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
// never wonder whether an object is focused or selected.
|
|
14
14
|
|
|
15
15
|
import { useEffect, useRef, useSyncExternalStore } from 'react';
|
|
16
|
-
|
|
17
16
|
import { canvasKeyIndex } from '../actions/canvas-keys.ts';
|
|
18
17
|
import { canvasKeyCtx } from '../actions/ctx.ts';
|
|
19
18
|
import { chordFromEvent } from '../actions/keys.ts';
|
|
@@ -28,6 +27,7 @@ import {
|
|
|
28
27
|
openCommentComposer,
|
|
29
28
|
resolveSelectionEl,
|
|
30
29
|
} from '../dom-selection.ts';
|
|
30
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
31
31
|
import { isEditableTarget, TOOLBAR_INSERT_EVENT, type Tool } from '../input-router.tsx';
|
|
32
32
|
import { isReadOnlyCanvas } from '../read-only-mode.ts';
|
|
33
33
|
import { type Selection, useSelectionSet } from '../use-selection-set.tsx';
|
|
@@ -182,11 +182,11 @@ export function FocusRing() {
|
|
|
182
182
|
div.style.height = `${Math.round(r.height)}px`;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
raf =
|
|
185
|
+
raf = frameRaf(tick);
|
|
186
186
|
};
|
|
187
|
-
raf =
|
|
187
|
+
raf = frameRaf(tick);
|
|
188
188
|
return () => {
|
|
189
|
-
if (raf != null)
|
|
189
|
+
if (raf != null) frameCaf(raf);
|
|
190
190
|
};
|
|
191
191
|
}, [kb, one]);
|
|
192
192
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
// Pure where it can be (`computeBands` takes rects and numbers), so it runs without layout.
|
|
13
13
|
|
|
14
14
|
import { useEffect, useRef, useState } from 'react';
|
|
15
|
-
|
|
16
15
|
import { resolveSelectionEl } from '../dom-selection.ts';
|
|
16
|
+
import { frameCaf, frameRaf } from '../frame-clock.ts';
|
|
17
17
|
import { useSelectionSet } from '../use-selection-set.tsx';
|
|
18
18
|
import { useToolModeOptional } from '../use-tool-mode.tsx';
|
|
19
19
|
import { type RectLike, worldScaleOf } from './arrange.ts';
|
|
@@ -212,7 +212,7 @@ export function GapBands({ readOnly }: { readOnly?: boolean }) {
|
|
|
212
212
|
}
|
|
213
213
|
let last = '';
|
|
214
214
|
const tick = () => {
|
|
215
|
-
raf.current =
|
|
215
|
+
raf.current = frameRaf(tick);
|
|
216
216
|
const el = resolveSelectionEl(document, one) as HTMLElement | null;
|
|
217
217
|
const next = el ? bandsFor(el) : [];
|
|
218
218
|
const dragged = tokenRuler.get()?.gapIndex ?? null;
|
|
@@ -224,7 +224,7 @@ export function GapBands({ readOnly }: { readOnly?: boolean }) {
|
|
|
224
224
|
};
|
|
225
225
|
tick();
|
|
226
226
|
return () => {
|
|
227
|
-
if (raf.current != null)
|
|
227
|
+
if (raf.current != null) frameCaf(raf.current);
|
|
228
228
|
setBands([]);
|
|
229
229
|
};
|
|
230
230
|
}, [active, one]);
|