@1agh/maude 2.0.6 → 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/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +27 -0
- package/apps/studio/actions/agents.ts +54 -0
- package/apps/studio/actions/ctx.ts +3 -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 +136 -1
- package/apps/studio/actions.parity.json +25 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -3
- package/apps/studio/api.ts +383 -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 +414 -45
- package/apps/studio/artboard-live.ts +526 -31
- 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 +2 -1
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- package/apps/studio/bin/_perf-probe-open.mjs +364 -0
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- package/apps/studio/bin/perf.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 +160 -34
- 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 +23 -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 +11 -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/shell/viewport.jsx +32 -16
- package/apps/studio/client/tree/tree.jsx +17 -0
- 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 +7 -3
- package/apps/studio/client/v2/code/canvas-imports-words.js +16 -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-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/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/shell/canvas-crash-guard.js +40 -5
- 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/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-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +3 -1
- package/apps/studio/client/v2/shell/shell-parity.json +8 -0
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
- package/apps/studio/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +4 -1
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +720 -720
- 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 +6 -3
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/cli.ts +7 -1
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- 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/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- package/apps/studio/ds/upgrade-stage.ts +6 -2
- 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/http.ts +66 -32
- 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/sync.ts +176 -0
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/code-module-consent.ts +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-plane.ts +458 -53
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +99 -15
- package/apps/studio/sync/seed-progress.ts +92 -2
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +15 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- 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 +55 -42
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +27 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +14 -0
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -4,10 +4,59 @@
|
|
|
4
4
|
// Both are plain buttons that call what the tree already had: the design-system view (`onOpenSystem`)
|
|
5
5
|
// and the Trash list (TrashView below the list's owner).
|
|
6
6
|
|
|
7
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
7
8
|
import { StIcon } from '../../shell/icons.jsx';
|
|
9
|
+
import { pathTestIdSlug } from '../../shell/util.js';
|
|
10
|
+
import { DigitalIcon, PrintIcon, VideoIcon, WebIcon } from '../canvases/canvas-icons.jsx';
|
|
11
|
+
import { JumpToggle } from '../canvases/jump-list.jsx';
|
|
12
|
+
import { KIND_LABEL } from '../canvases/jump-model.js';
|
|
13
|
+
import { dispatchArtboardJump } from './left-panel-bus.js';
|
|
8
14
|
import { trashRowCount } from './left-panel-model.js';
|
|
9
15
|
import { SystemRenameField } from '../ds/system-rename.jsx';
|
|
10
16
|
|
|
17
|
+
const KIND_GLYPH = { web: WebIcon, digital: DigitalIcon, print: PrintIcon, video: VideoIcon };
|
|
18
|
+
|
|
19
|
+
/** 2.0.7 (B3) — the artboards of a system's Design system canvas, under its row (the canvas row's 11 · pn-jump
|
|
20
|
+
* list). A click takes the camera there: the canvas opens if it is not the one on screen. */
|
|
21
|
+
function DsBoardList({ dsName, list, activePath, activeArtboard, onJump }) {
|
|
22
|
+
const slug = pathTestIdSlug(list.path);
|
|
23
|
+
const onCanvas = activePath === list.path;
|
|
24
|
+
// 2.0.7 polish — the artboard in view moved (Pages' ‹ › turn it): its row scrolls into view, once per artboard
|
|
25
|
+
const curRef = useRef(null);
|
|
26
|
+
const inView = onCanvas ? activeArtboard : null;
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (inView) curRef.current?.scrollIntoView?.({ block: 'nearest' });
|
|
29
|
+
}, [inView]);
|
|
30
|
+
return (
|
|
31
|
+
<div className="lp-ds-boards" data-testid="canvases-ds-boards" data-ds={dsName}>
|
|
32
|
+
{list.boards.map((b) => {
|
|
33
|
+
const Glyph = KIND_GLYPH[b.kind] || WebIcon;
|
|
34
|
+
const word = KIND_LABEL[b.kind] || b.kind;
|
|
35
|
+
const current = onCanvas && activeArtboard === b.id;
|
|
36
|
+
return (
|
|
37
|
+
<div key={b.id} className={`cv-row cv-row--board lp-ds-board${current ? ' is-sel' : ''}`}>
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
className="cv-main"
|
|
41
|
+
ref={current ? curRef : undefined}
|
|
42
|
+
data-testid={`jump-artboard-${slug}-${b.id}`}
|
|
43
|
+
data-kind={b.kind}
|
|
44
|
+
aria-current={current ? 'true' : undefined}
|
|
45
|
+
title={`${b.label} — ${word}`}
|
|
46
|
+
onClick={() => (onJump || dispatchArtboardJump)(list.path, b.id)}
|
|
47
|
+
>
|
|
48
|
+
<span className="cv-bk" role="img" aria-label={word}>
|
|
49
|
+
<Glyph size={12} />
|
|
50
|
+
</span>
|
|
51
|
+
<span className="cv-name">{b.label}</span>
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
11
60
|
/** A trash can on the shell's 16-box icon grid (the icon set has none). */
|
|
12
61
|
export function TrashIcon({ size = 14 }) {
|
|
13
62
|
return (
|
|
@@ -40,7 +89,10 @@ export function TrashIcon({ size = 14 }) {
|
|
|
40
89
|
* empty { label } | null onMake() the empty row's door
|
|
41
90
|
* onBringUp(ds) S10.15b: a click on the amber dot (omit = the dot is only a mark)
|
|
42
91
|
* renaming dsName | null onRename(row, name) P8 round 7: that row's name is a field (Rename…, 13 · ds-multi-menu)
|
|
43
|
-
* onRenameDone() the field closed (↵ or esc)
|
|
92
|
+
* onRenameDone() the field closed (↵ or esc)
|
|
93
|
+
* boards Map dsName → { path, boards } (ds-boards.js) 2.0.7 (B3): a row with artboards opens into them
|
|
94
|
+
* activePath, activeArtboard the canvas on screen and the artboard in view (the list marks it)
|
|
95
|
+
* onJump(path, id) a click on an artboard (omit = the left-panel bus) */
|
|
44
96
|
export function DsPinnedRows({
|
|
45
97
|
rows,
|
|
46
98
|
activeDsName,
|
|
@@ -53,7 +105,13 @@ export function DsPinnedRows({
|
|
|
53
105
|
renaming = null,
|
|
54
106
|
onRename,
|
|
55
107
|
onRenameDone,
|
|
108
|
+
boards = null,
|
|
109
|
+
activePath = null,
|
|
110
|
+
activeArtboard = null,
|
|
111
|
+
onJump,
|
|
56
112
|
}) {
|
|
113
|
+
// which rows show their artboards: the person's own choice, this session (a canvas row's list is the same)
|
|
114
|
+
const [openLists, setOpenLists] = useState(() => new Set());
|
|
57
115
|
if (!rows?.length && !empty) return null;
|
|
58
116
|
return (
|
|
59
117
|
<div className="lp-pinned" data-testid="canvases-pinned">
|
|
@@ -89,8 +147,26 @@ export function DsPinnedRows({
|
|
|
89
147
|
</div>
|
|
90
148
|
</div>
|
|
91
149
|
);
|
|
92
|
-
|
|
93
|
-
|
|
150
|
+
const list = boards?.get?.(r.dsName) ?? null;
|
|
151
|
+
const listOpen = !!list && openLists.has(r.dsName);
|
|
152
|
+
const row = (
|
|
153
|
+
<div className={`lp-ds-wrap${list ? ' lp-ds-wrap--jump' : ''}`}>
|
|
154
|
+
{list ? (
|
|
155
|
+
<JumpToggle
|
|
156
|
+
open={listOpen}
|
|
157
|
+
slug={pathTestIdSlug(list.path)}
|
|
158
|
+
name={r.label}
|
|
159
|
+
left={0}
|
|
160
|
+
onToggle={() =>
|
|
161
|
+
setOpenLists((s) => {
|
|
162
|
+
const n = new Set(s);
|
|
163
|
+
if (n.has(r.dsName)) n.delete(r.dsName);
|
|
164
|
+
else n.add(r.dsName);
|
|
165
|
+
return n;
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
/>
|
|
169
|
+
) : null}
|
|
94
170
|
<button
|
|
95
171
|
type="button"
|
|
96
172
|
className={`lp-row lp-ds${on ? ' is-sel' : ''}${r.sub ? ' lp-ds--two' : ''}`}
|
|
@@ -151,6 +227,20 @@ export function DsPinnedRows({
|
|
|
151
227
|
) : null}
|
|
152
228
|
</div>
|
|
153
229
|
);
|
|
230
|
+
return (
|
|
231
|
+
<Fragment key={r.dsName}>
|
|
232
|
+
{row}
|
|
233
|
+
{listOpen ? (
|
|
234
|
+
<DsBoardList
|
|
235
|
+
dsName={r.dsName}
|
|
236
|
+
list={list}
|
|
237
|
+
activePath={activePath}
|
|
238
|
+
activeArtboard={activeArtboard}
|
|
239
|
+
onJump={onJump}
|
|
240
|
+
/>
|
|
241
|
+
) : null}
|
|
242
|
+
</Fragment>
|
|
243
|
+
);
|
|
154
244
|
})}
|
|
155
245
|
{empty ? (
|
|
156
246
|
<button
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// client/v2/left-panel/ds-boards.js — 2.0.7 (B3): a pinned Design system row opens into the artboards of its
|
|
2
|
+
// Design system canvas, the way a canvas row opens into its own (11 · pn-jump). PURE: which canvas a system's
|
|
3
|
+
// row lists, and its artboards in the canvas's own order, read from the index snapshot the Canvases panel
|
|
4
|
+
// already holds (no second read of the index).
|
|
5
|
+
|
|
6
|
+
import { indexMeta } from '../canvases/tree-model.js';
|
|
7
|
+
|
|
8
|
+
/** The repo path of a system's Design system canvas: `<designRel>/<system path>/design-system.tsx`. */
|
|
9
|
+
export function dsCanvasPath(systemPath, designRel) {
|
|
10
|
+
if (typeof systemPath !== 'string' || !systemPath.trim()) return null;
|
|
11
|
+
const rel = `${systemPath.replace(/^\/+|\/+$/g, '')}/design-system.tsx`;
|
|
12
|
+
return designRel ? `${designRel}/${rel}` : rel;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Each pinned row's Design system canvas and its artboards: Map dsName → { path, boards: [{ id, label, kind }] }.
|
|
17
|
+
* A system that has no Design system canvas yet (not converted), or whose canvas lists no artboards, is left
|
|
18
|
+
* out — its row has nothing to open.
|
|
19
|
+
* systems [{ name, path }] — the shell config's designSystems; a row the config does not list falls back
|
|
20
|
+
* to the group's `dsFolders` (a folder that brings its own design-system.tsx, 2.0.7 #1)
|
|
21
|
+
*/
|
|
22
|
+
export function dsBoardLists(rows, { snapshot, designRel = '', systems = [], groups = [] } = {}) {
|
|
23
|
+
const out = new Map();
|
|
24
|
+
if (!snapshot || !Array.isArray(rows) || !rows.length) return out;
|
|
25
|
+
const root = (snapshot?.project?.designRel || designRel || '').replace(/^\/+|\/+$/g, '');
|
|
26
|
+
const meta = indexMeta(snapshot, root);
|
|
27
|
+
const folders = (groups || []).flatMap((g) => g?.dsFolders || []);
|
|
28
|
+
for (const r of rows) {
|
|
29
|
+
const name = r?.dsName;
|
|
30
|
+
if (!name) continue;
|
|
31
|
+
const sys =
|
|
32
|
+
(systems || []).find((d) => d?.name === name) || folders.find((f) => f?.name === name);
|
|
33
|
+
const path = dsCanvasPath(sys?.path, root);
|
|
34
|
+
const m = path ? meta.get(path) : null;
|
|
35
|
+
if (!m || !m.boards?.length) continue;
|
|
36
|
+
out.set(name, { path, boards: m.boards });
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
@@ -182,3 +182,16 @@ export const CAPABILITY_HOMES = [
|
|
|
182
182
|
actionId: 'view.trash',
|
|
183
183
|
},
|
|
184
184
|
];
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 2.0.7 polish (decision `v2-207-pages-left-panel-follows`) — the artboard in view on the open canvas, which the
|
|
188
|
+
* artboard lists under a canvas row and a Design system row mark: in Pages the artboard on the page (it turns with
|
|
189
|
+
* ‹ › and the keys, which never touch the selection), else the selected artboard of the open canvas.
|
|
190
|
+
* selected the shell's selection (one object or a list; its first counts)
|
|
191
|
+
* pagesAt the active canvas's page while it shows Pages (use-canvas-mode-lane `usePagesArtboard`), else null
|
|
192
|
+
*/
|
|
193
|
+
export function artboardInView({ selected, activePath, pagesAt = null }) {
|
|
194
|
+
if (typeof pagesAt === 'string' && pagesAt) return pagesAt;
|
|
195
|
+
const sel = Array.isArray(selected) ? selected[0] : selected;
|
|
196
|
+
return sel && activePath && sel.file === activePath ? (sel.artboardId ?? null) : null;
|
|
197
|
+
}
|
|
@@ -352,6 +352,30 @@
|
|
|
352
352
|
display: flex;
|
|
353
353
|
align-items: center;
|
|
354
354
|
}
|
|
355
|
+
/* 2.0.7 (B3) — a system row with a Design system canvas opens into its artboards (the canvas row's 11 · pn-jump
|
|
356
|
+
twisty in the row's left gutter, and its 22 px artboard rows underneath) */
|
|
357
|
+
.lp-ds-wrap--jump > .lp-ds {
|
|
358
|
+
padding-left: calc(var(--space-3) + 6px);
|
|
359
|
+
}
|
|
360
|
+
.lp-ds-wrap--jump > .cv-jt[aria-expanded="false"] {
|
|
361
|
+
opacity: 0;
|
|
362
|
+
}
|
|
363
|
+
.lp-ds-wrap--jump:hover > .cv-jt,
|
|
364
|
+
.lp-ds-wrap--jump:focus-within > .cv-jt,
|
|
365
|
+
.lp-ds-wrap--jump > .cv-jt:focus-visible {
|
|
366
|
+
opacity: 1;
|
|
367
|
+
}
|
|
368
|
+
.lp-ds-boards {
|
|
369
|
+
display: flex;
|
|
370
|
+
flex-direction: column;
|
|
371
|
+
padding-bottom: var(--space-1);
|
|
372
|
+
}
|
|
373
|
+
.lp-ds-board {
|
|
374
|
+
height: 22px;
|
|
375
|
+
}
|
|
376
|
+
.lp-ds-board > .cv-main {
|
|
377
|
+
padding-left: calc(var(--space-3) + 18px);
|
|
378
|
+
}
|
|
355
379
|
.lp-ds--two {
|
|
356
380
|
align-items: center;
|
|
357
381
|
padding-block: var(--space-1);
|
|
@@ -8,12 +8,45 @@
|
|
|
8
8
|
// within `CRASH_WINDOW_MS` and the viewport stops opening it: the tab shows "This canvas is too heavy to
|
|
9
9
|
// show all at once" with the lighter way in (only the artboards near the viewport mounted,
|
|
10
10
|
// `?artboard-live=light`). Pure over a Storage-like object so it is testable without a browser.
|
|
11
|
+
//
|
|
12
|
+
// 2.0.7: a leftover mark alone is not a crash. WKWebView fires no `pagehide` when the app quits, so every
|
|
13
|
+
// normal quit left the mark behind and two quits with a canvas open made it "too heavy". The shell's crash
|
|
14
|
+
// recovery (`web_process.rs` `recovery_target`) now navigates with `?maude-recovered=1`; only a boot that
|
|
15
|
+
// carries it counts the mark. Any other boot (launch, relaunch, manual reload, after a quit) drops the mark.
|
|
16
|
+
// The marker is read once, as the bundle loads, and stripped from the address so it is never copied,
|
|
17
|
+
// shared or counted twice.
|
|
11
18
|
|
|
12
19
|
export const CRASH_LIMIT = 2;
|
|
13
20
|
export const CRASH_WINDOW_MS = 10 * 60 * 1000;
|
|
14
21
|
/** A chosen lighter mode is kept this long for that canvas (it survives the next crash reload). */
|
|
15
22
|
export const LIGHT_KEEP_MS = 24 * 60 * 60 * 1000;
|
|
16
23
|
export const CRASH_KEY = 'maude.canvas-crash.v1';
|
|
24
|
+
/** Query param the desktop shell adds when it re-navigates after a WebContent crash (web_process.rs). */
|
|
25
|
+
export const RECOVERED_PARAM = 'maude-recovered';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Was this page brought back by the shell's crash recovery? Strips the marker from the address.
|
|
29
|
+
* @param {{ location: { href: string }, history: { state: unknown, replaceState(s: unknown, t: string, u: string): void } } | null} win
|
|
30
|
+
*/
|
|
31
|
+
export function takeRecoveredMarker(win) {
|
|
32
|
+
try {
|
|
33
|
+
if (!win?.location) return false;
|
|
34
|
+
const url = new URL(win.location.href);
|
|
35
|
+
if (!url.searchParams.has(RECOVERED_PARAM)) return false;
|
|
36
|
+
url.searchParams.delete(RECOVERED_PARAM);
|
|
37
|
+
try {
|
|
38
|
+
win.history?.replaceState(win.history.state, '', `${url.pathname}${url.search}${url.hash}`);
|
|
39
|
+
} catch {
|
|
40
|
+
/* the guard still knows; the address just keeps the marker */
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Read as the bundle loads, before the address hook rewrites the URL (`withOpenParam` keeps only `open`).
|
|
49
|
+
const RECOVERED_AT_BOOT = typeof window === 'undefined' ? false : takeRecoveredMarker(window);
|
|
17
50
|
|
|
18
51
|
function empty() {
|
|
19
52
|
return { live: null, crashes: {}, light: {} };
|
|
@@ -38,8 +71,9 @@ function read(storage) {
|
|
|
38
71
|
/**
|
|
39
72
|
* @param {{ getItem(k: string): string | null, setItem(k: string, v: string): void } | null} storage
|
|
40
73
|
* @param {() => number} [now]
|
|
74
|
+
* @param {{ recovered?: boolean }} [boot] `recovered`: the shell's crash recovery brought this page back.
|
|
41
75
|
*/
|
|
42
|
-
export function createCrashGuard(storage, now = Date.now) {
|
|
76
|
+
export function createCrashGuard(storage, now = Date.now, { recovered = false } = {}) {
|
|
43
77
|
const s = read(storage);
|
|
44
78
|
const save = () => {
|
|
45
79
|
try {
|
|
@@ -61,13 +95,14 @@ export function createCrashGuard(storage, now = Date.now) {
|
|
|
61
95
|
if (typeof at !== 'number' || t - at >= LIGHT_KEEP_MS) delete s.light[p];
|
|
62
96
|
}
|
|
63
97
|
};
|
|
64
|
-
// Boot: a mark left behind is a page that died with that canvas open
|
|
65
|
-
|
|
98
|
+
// Boot: a mark left behind is a page that died with that canvas open — a crash only when the shell's
|
|
99
|
+
// crash recovery brought the page back; otherwise (a quit, a relaunch, a reload) it is just dropped.
|
|
100
|
+
if (s.live && recovered) {
|
|
66
101
|
const list = s.crashes[s.live] || [];
|
|
67
102
|
list.push(now());
|
|
68
103
|
s.crashes[s.live] = list;
|
|
69
|
-
s.live = null;
|
|
70
104
|
}
|
|
105
|
+
s.live = null;
|
|
71
106
|
prune();
|
|
72
107
|
save();
|
|
73
108
|
|
|
@@ -120,7 +155,7 @@ const subs = new Set();
|
|
|
120
155
|
export function crashGuard() {
|
|
121
156
|
if (shared) return shared;
|
|
122
157
|
const storage = typeof localStorage === 'undefined' ? null : localStorage;
|
|
123
|
-
const g = createCrashGuard(storage);
|
|
158
|
+
const g = createCrashGuard(storage, Date.now, { recovered: RECOVERED_AT_BOOT });
|
|
124
159
|
const wrap = (fn) => (path) => {
|
|
125
160
|
fn(path);
|
|
126
161
|
for (const cb of subs) cb();
|
|
@@ -61,6 +61,10 @@ export function createShellMode(caps = ALL_CAPS) {
|
|
|
61
61
|
position: null,
|
|
62
62
|
media: null,
|
|
63
63
|
viewing: null,
|
|
64
|
+
// 2.0.7 B2 — the active canvas shows Pages (canvas-pages.ts, told over `pages-view`): Preview and Present are
|
|
65
|
+
// off meanwhile, like the Viewing hold refuses them. The canvas owns the view; this is only its echo.
|
|
66
|
+
pages: false,
|
|
67
|
+
pagesAt: null,
|
|
64
68
|
});
|
|
65
69
|
const subs = new Set();
|
|
66
70
|
const emit = (next) => {
|
|
@@ -78,6 +82,7 @@ export function createShellMode(caps = ALL_CAPS) {
|
|
|
78
82
|
* presenting leaves Present for it. Present itself goes through `present(spec)`. */
|
|
79
83
|
select(mode, { tool = null } = {}) {
|
|
80
84
|
if (mode === 'present' || snap.viewing) return; // S1.14: a past version holds the mode
|
|
85
|
+
if (mode === 'preview' && snap.pages) return; // 2.0.7 B2: Pages holds Preview off
|
|
81
86
|
emit({ mode, tool, nonce: snap.nonce + 1, ...notPresenting });
|
|
82
87
|
},
|
|
83
88
|
/**
|
|
@@ -102,6 +107,17 @@ export function createShellMode(caps = ALL_CAPS) {
|
|
|
102
107
|
});
|
|
103
108
|
return true;
|
|
104
109
|
},
|
|
110
|
+
/**
|
|
111
|
+
* 2.0.7 B2 — the active canvas says whether it shows Pages (a new active canvas starts at false); 2.0.7 polish —
|
|
112
|
+
* and which artboard is on the page (`at`, the left panel marks it; null when off or not said).
|
|
113
|
+
*/
|
|
114
|
+
pages(on, at = null) {
|
|
115
|
+
const next = on === true;
|
|
116
|
+
const nextAt = next && typeof at === 'string' && at ? at : null;
|
|
117
|
+
if (snap.pages === next && (snap.pagesAt ?? null) === nextAt) return false;
|
|
118
|
+
emit({ pages: next, pagesAt: nextAt });
|
|
119
|
+
return true;
|
|
120
|
+
},
|
|
105
121
|
/** esc / "back to now" / a restore: leave the hold. */
|
|
106
122
|
leaveViewing() {
|
|
107
123
|
if (!snap.viewing) return false;
|
|
@@ -110,7 +126,7 @@ export function createShellMode(caps = ALL_CAPS) {
|
|
|
110
126
|
},
|
|
111
127
|
/** Enter Present (Artboards or the Canvas). Already presenting: nothing (esc leaves first). */
|
|
112
128
|
present(spec) {
|
|
113
|
-
if (snap.mode === 'present' || snap.viewing) return false;
|
|
129
|
+
if (snap.mode === 'present' || snap.viewing || snap.pages) return false;
|
|
114
130
|
emit({
|
|
115
131
|
mode: 'present',
|
|
116
132
|
tool: null,
|
|
@@ -1928,11 +1928,47 @@
|
|
|
1928
1928
|
|
|
1929
1929
|
/* 180ms appearance delay on the CARD — warm canvases mount in <150ms and never
|
|
1930
1930
|
* flash it; the backdrop above is immediate so nothing white shows through. */
|
|
1931
|
-
.sh-canvas-loading
|
|
1931
|
+
.sh-canvas-loading .sh-skel-card {
|
|
1932
1932
|
opacity: 0;
|
|
1933
1933
|
animation: sh-loading-in var(--dur-soft) var(--ease-out) 180ms forwards;
|
|
1934
1934
|
}
|
|
1935
1935
|
|
|
1936
|
+
/* 2.0.7 (B1) — the opening canvas's artboards as skeletons at their final place and size (05 es-skab), on the
|
|
1937
|
+
same 180 ms beat as the card so a warm canvas never flashes them; the card centres while they are not known */
|
|
1938
|
+
.sh-opening-skel {
|
|
1939
|
+
position: absolute;
|
|
1940
|
+
inset: 0;
|
|
1941
|
+
display: grid;
|
|
1942
|
+
place-items: center;
|
|
1943
|
+
overflow: hidden;
|
|
1944
|
+
}
|
|
1945
|
+
.sh-opening-skel[data-ready="true"] {
|
|
1946
|
+
display: block;
|
|
1947
|
+
opacity: 0;
|
|
1948
|
+
animation: sh-loading-in var(--dur-soft) var(--ease-out) 180ms forwards;
|
|
1949
|
+
}
|
|
1950
|
+
.sh-opening-note {
|
|
1951
|
+
position: absolute;
|
|
1952
|
+
left: 50%;
|
|
1953
|
+
bottom: var(--space-5);
|
|
1954
|
+
translate: -50% 0;
|
|
1955
|
+
z-index: 3;
|
|
1956
|
+
margin: 0;
|
|
1957
|
+
max-width: min(420px, calc(100% - 2 * var(--space-4)));
|
|
1958
|
+
padding: var(--space-2) var(--space-3);
|
|
1959
|
+
border-radius: var(--radius-md);
|
|
1960
|
+
background: var(--island-bg, var(--bg-1));
|
|
1961
|
+
box-shadow: var(--island-shadow, var(--shadow-md));
|
|
1962
|
+
font-size: var(--type-xs);
|
|
1963
|
+
line-height: 1.45;
|
|
1964
|
+
color: var(--fg-1);
|
|
1965
|
+
}
|
|
1966
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1967
|
+
.sh-opening-skel[data-ready="true"] {
|
|
1968
|
+
animation-duration: 1ms;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1936
1972
|
@keyframes sh-loading-in {
|
|
1937
1973
|
to {
|
|
1938
1974
|
opacity: 1;
|
|
@@ -120,6 +120,9 @@ const LABEL = {
|
|
|
120
120
|
present: 'Present',
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
+
/** 2.0.7 B2 — why Preview and Present are off while the canvas shows Pages (one artboard at a time). */
|
|
124
|
+
export const PAGES_REASON = 'Switch to Canvas to preview or present.';
|
|
125
|
+
|
|
123
126
|
/** Present ⌄'s rows (04 md-present-menu; words CONTRACT §2–§3). */
|
|
124
127
|
const PRESENT_ROWS = [
|
|
125
128
|
{ group: 'Artboards, one by one' },
|
|
@@ -193,6 +196,7 @@ function presentRows(caps, presenterView, copyLink) {
|
|
|
193
196
|
* @param presenterView S3.6b — `{ name, on }` when the desktop app has another display (the row is a check
|
|
194
197
|
* with that display's name); null = the row greyed, "Needs a second display" (04 md-present-menu)
|
|
195
198
|
* @param onPresenterView () => void — the row toggles presenter view
|
|
199
|
+
* @param pages 2.0.7 B2 — the canvas shows Pages: Preview and Present are greyed with the reason (`PAGES_REASON`)
|
|
196
200
|
* @param copyLink S3.14 — `{ enabled, note }` (copy-link.js `copyRowState`): Copy presentation link, an editor's
|
|
197
201
|
* row; greyed with the reason when not enabled. null = no row (the host decides)
|
|
198
202
|
*/
|
|
@@ -207,7 +211,11 @@ export function ModeSwitch({
|
|
|
207
211
|
presenterView = null,
|
|
208
212
|
onPresenterView,
|
|
209
213
|
copyLink = null,
|
|
214
|
+
pages = false,
|
|
210
215
|
}) {
|
|
216
|
+
// 2.0.7 B2 — Pages holds Preview and Present off (canvas-mode.js `pages`); a click would do nothing, so say why
|
|
217
|
+
const presentOff = !canPresent || pages;
|
|
218
|
+
const presentWhy = pages ? PAGES_REASON : 'noCanvas';
|
|
211
219
|
const run = (kind) => {
|
|
212
220
|
if (onPresent) onPresent(kind);
|
|
213
221
|
else if (kind === 'canvas') onPresentCanvas?.();
|
|
@@ -283,7 +291,8 @@ export function ModeSwitch({
|
|
|
283
291
|
aria-pressed={mode === 'present'}
|
|
284
292
|
aria-keyshortcuts={ariaModeKeys('present')}
|
|
285
293
|
title={modeTitle('present')}
|
|
286
|
-
disabled={
|
|
294
|
+
disabled={presentOff}
|
|
295
|
+
{...reasonProps(pages, PAGES_REASON)}
|
|
287
296
|
onClick={() => onSelect?.('present')}
|
|
288
297
|
>
|
|
289
298
|
<ModeGlyph m="present" />
|
|
@@ -295,8 +304,8 @@ export function ModeSwitch({
|
|
|
295
304
|
aria-label="Present options"
|
|
296
305
|
aria-haspopup="menu"
|
|
297
306
|
aria-expanded={menu}
|
|
298
|
-
disabled={
|
|
299
|
-
{...reasonProps(
|
|
307
|
+
disabled={presentOff}
|
|
308
|
+
{...reasonProps(presentOff, presentWhy)}
|
|
300
309
|
onClick={() => setMenu((v) => !v)}
|
|
301
310
|
>
|
|
302
311
|
<svg width="10" height="10" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
@@ -320,6 +329,8 @@ export function ModeSwitch({
|
|
|
320
329
|
aria-pressed={mode === id}
|
|
321
330
|
aria-keyshortcuts={ariaModeKeys(id)}
|
|
322
331
|
title={modeTitle(id)}
|
|
332
|
+
disabled={id === 'preview' && pages}
|
|
333
|
+
{...reasonProps(id === 'preview' && pages, PAGES_REASON)}
|
|
323
334
|
onClick={() => onSelect?.(id)}
|
|
324
335
|
>
|
|
325
336
|
<ModeGlyph m={id} />
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// client/v2/shell/opening-skeleton.js — 2.0.7 (B1): while a canvas opens, every artboard shows at once as a
|
|
2
|
+
// skeleton at its final place and size, and the real canvas replaces them all when it reports `canvas-rendered`.
|
|
3
|
+
//
|
|
4
|
+
// PURE. The studio draws the skeletons itself, over the frame, from what it already knows before the canvas
|
|
5
|
+
// module builds: the index row (artboard ids in the canvas's order, their JSX width/height, labels, kinds) and
|
|
6
|
+
// the canvas meta (`layout.artboards[]` positions, the per-person `viewport`). The frame never draws them, so a
|
|
7
|
+
// capture or an export — a frame with no studio around it — can never show one, and the frame's live/sleep
|
|
8
|
+
// rules (artboard-live.ts) and WebGL budget are untouched.
|
|
9
|
+
//
|
|
10
|
+
// Lining up with the frame's camera: the layout and the camera here are canvas-lib's own rules, restated —
|
|
11
|
+
// `initialArtboards()` (JSX size, meta position, meta w/h when present, the default grid for a board the meta
|
|
12
|
+
// does not place) and `getInitial()` (the stored viewport, else `computeFit` with a 24 px pad inside the
|
|
13
|
+
// occluded insets). test/v2-opening-skeleton.test.tsx holds both against canvas-lib's exported functions.
|
|
14
|
+
//
|
|
15
|
+
// When the rules cannot be followed exactly the answer is `null` and the studio keeps its "Opening …" card:
|
|
16
|
+
// an artboard whose size is not a literal, a dynamic canvas (its artboards are made when it runs), no index.
|
|
17
|
+
|
|
18
|
+
import { visibleRect } from '../../../bridge/occlusion.ts';
|
|
19
|
+
|
|
20
|
+
/** canvas-lib's `VP_GRID` (the default grid for artboards the meta does not place) and its fit pad. */
|
|
21
|
+
export const SKELETON_GRID = Object.freeze({ cols: 3, w: 1280, h: 820, gutter: 80 });
|
|
22
|
+
export const FIT_PAD = 24;
|
|
23
|
+
/** Under this many screen px a canvas-lib name collapses to nothing (`.dc-artboard-label` max-width). */
|
|
24
|
+
export const NAME_MIN_PX = 24;
|
|
25
|
+
|
|
26
|
+
const pos = (n) => typeof n === 'number' && Number.isFinite(n) && n > 0;
|
|
27
|
+
const fin = (n) => typeof n === 'number' && Number.isFinite(n);
|
|
28
|
+
|
|
29
|
+
/** The index row of `path` (repo-relative) in an index snapshot, or null. */
|
|
30
|
+
export function indexRowOf(snapshot, path) {
|
|
31
|
+
const rows = Array.isArray(snapshot?.canvases) ? snapshot.canvases : null;
|
|
32
|
+
if (!rows || typeof path !== 'string') return null;
|
|
33
|
+
const root = (snapshot?.project?.designRel || '').replace(/^\/+|\/+$/g, '');
|
|
34
|
+
const rel = root && path.startsWith(`${root}/`) ? path.slice(root.length + 1) : path;
|
|
35
|
+
return rows.find((c) => c && c.rel === rel) || null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The artboards as canvas-lib will place them: [{ id, label, kind, x, y, w, h }] in the canvas's order, or null
|
|
40
|
+
* when that cannot be known before the canvas runs.
|
|
41
|
+
*/
|
|
42
|
+
export function skeletonBoards({ row, meta }) {
|
|
43
|
+
const list = Array.isArray(row?.artboards) ? row.artboards.filter((a) => a && a.id) : [];
|
|
44
|
+
if (!list.length) return null;
|
|
45
|
+
// a dynamic canvas makes artboards when it runs: the parse has only some of them, and the grid would shift
|
|
46
|
+
if (row.dynamic && row.artboardsFrom !== 'runtime') return null;
|
|
47
|
+
const placed = new Map();
|
|
48
|
+
const metaBoards = meta?.layout?.artboards;
|
|
49
|
+
if (Array.isArray(metaBoards)) for (const m of metaBoards) if (m && m.id) placed.set(m.id, m);
|
|
50
|
+
// the default grid's cell is the largest JSX size (synthDefaultGrid) — needed only for a board the meta leaves out
|
|
51
|
+
const needsGrid = list.some((a) => {
|
|
52
|
+
const m = placed.get(a.id);
|
|
53
|
+
return !(m && fin(m.x) && fin(m.y));
|
|
54
|
+
});
|
|
55
|
+
if (needsGrid && list.some((a) => !pos(a.w) || !pos(a.h))) return null;
|
|
56
|
+
const cellW = needsGrid ? Math.max(...list.map((a) => a.w)) : 0;
|
|
57
|
+
const cellH = needsGrid ? Math.max(...list.map((a) => a.h)) : 0;
|
|
58
|
+
const G = SKELETON_GRID;
|
|
59
|
+
const out = [];
|
|
60
|
+
for (let i = 0; i < list.length; i++) {
|
|
61
|
+
const a = list[i];
|
|
62
|
+
const m = placed.get(a.id);
|
|
63
|
+
const w = m && pos(m.w) ? m.w : a.w;
|
|
64
|
+
const h = m && pos(m.h) ? m.h : a.h;
|
|
65
|
+
if (!pos(w) || !pos(h)) return null;
|
|
66
|
+
const x = m && fin(m.x) ? m.x : (i % G.cols) * (cellW + G.gutter);
|
|
67
|
+
const y = m && fin(m.y) ? m.y : Math.floor(i / G.cols) * (cellH + G.gutter);
|
|
68
|
+
out.push({ id: a.id, label: a.label || a.id, kind: a.kind || 'digital', x, y, w, h });
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The camera canvas-lib opens on: the stored viewport when there is one, else the boards fitted (24 px pad) in
|
|
75
|
+
* the part of the canvas the shell's panels leave free. `width`/`height` are the frame's size.
|
|
76
|
+
*/
|
|
77
|
+
export function skeletonCamera({ boards, width, height, insets, viewport }) {
|
|
78
|
+
if (viewport && fin(viewport.x) && fin(viewport.y) && fin(viewport.zoom))
|
|
79
|
+
return { x: viewport.x, y: viewport.y, zoom: viewport.zoom };
|
|
80
|
+
if (!boards?.length) return { x: 0, y: 0, zoom: 1 };
|
|
81
|
+
let xMin = Number.POSITIVE_INFINITY;
|
|
82
|
+
let yMin = Number.POSITIVE_INFINITY;
|
|
83
|
+
let xMax = Number.NEGATIVE_INFINITY;
|
|
84
|
+
let yMax = Number.NEGATIVE_INFINITY;
|
|
85
|
+
for (const r of boards) {
|
|
86
|
+
xMin = Math.min(xMin, r.x);
|
|
87
|
+
yMin = Math.min(yMin, r.y);
|
|
88
|
+
xMax = Math.max(xMax, r.x + r.w);
|
|
89
|
+
yMax = Math.max(yMax, r.y + r.h);
|
|
90
|
+
}
|
|
91
|
+
const bw = xMax - xMin;
|
|
92
|
+
const bh = yMax - yMin;
|
|
93
|
+
if (!width || !height || bw <= 0 || bh <= 0) return { x: 0, y: 0, zoom: 1 };
|
|
94
|
+
const v = visibleRect(width, height, insets || { top: 0, right: 0, bottom: 0, left: 0 });
|
|
95
|
+
const zoom = Math.min((v.w - FIT_PAD * 2) / bw, (v.h - FIT_PAD * 2) / bh, 1.0);
|
|
96
|
+
return {
|
|
97
|
+
x: v.x + (v.w - bw * zoom) / 2 - xMin * zoom,
|
|
98
|
+
y: v.y + (v.h - bh * zoom) / 2 - yMin * zoom,
|
|
99
|
+
zoom,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The boards in screen px under `cam`, only those that show in a `width` x `height` frame (a big canvas
|
|
105
|
+
* zoomed in draws a handful, not hundreds). `named` follows canvas-lib's collapse of a too-narrow name.
|
|
106
|
+
*/
|
|
107
|
+
export function screenBoards(boards, cam, width, height) {
|
|
108
|
+
const out = [];
|
|
109
|
+
for (const b of boards || []) {
|
|
110
|
+
const left = cam.x + b.x * cam.zoom;
|
|
111
|
+
const top = cam.y + b.y * cam.zoom;
|
|
112
|
+
const w = b.w * cam.zoom;
|
|
113
|
+
const h = b.h * cam.zoom;
|
|
114
|
+
if (width && height && (left > width || top > height || left + w < 0 || top + h < 0)) continue;
|
|
115
|
+
out.push({ ...b, left, top, sw: w, sh: h, named: w >= NAME_MIN_PX });
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|