@marver-design/marver 0.26.1 → 0.27.2
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/CHANGELOG.md +198 -0
- package/README.md +12 -4
- package/dist/{anchor-check-l-ny3UzH.mjs → anchor-check-gkxkPAIv.mjs} +1 -1
- package/dist/{board-tree-DRioF94d.mjs → board-tree-BXR8dw4b.mjs} +3 -1
- package/dist/{boards-CGg6piKF.mjs → boards-BHKP5yhI.mjs} +1 -1
- package/dist/{boards-DYG22tOe.mjs → boards-BqUqKNW8.mjs} +4 -4
- package/dist/{build-BDRiO_mP.mjs → build-VgNg4rr8.mjs} +8 -23
- package/dist/cli.mjs +45 -19
- package/dist/{collab-Dxg2trOK.mjs → collab-BEAcXrBb.mjs} +1 -1
- package/dist/{comments-BqXua-XL.mjs → comments-YEU1Zhv9.mjs} +4 -4
- package/dist/{context-HQ4Giw58.mjs → context-Ccjrhr1J.mjs} +3 -3
- package/dist/{daemon-DL6Fwq6D.mjs → daemon-Dc9AH0M3.mjs} +9 -7
- package/dist/detect-C0wpaePX.mjs +125 -0
- package/dist/dev-lock-C_FC70Mu.mjs +65 -0
- package/dist/dev-ri6nAlRp.mjs +1273 -0
- package/dist/exclusive-B1RtpeeP.mjs +150 -0
- package/dist/{init-D8DtrK_F.mjs → init-W0nxR1OY.mjs} +8 -6
- package/dist/{link-BNzLvdhI.mjs → link-CdTgn94Y.mjs} +23 -11
- package/dist/ls-BZ5TAtd5.mjs +38 -0
- package/dist/{manifest-Nl3KSVOk.mjs → manifest-aFyDmL8C.mjs} +2 -2
- package/dist/{marks-DyWMv_Z1.mjs → marks-BF9pNEgH.mjs} +3 -3
- package/dist/{marks-CKgzucHZ.mjs → marks-CnCCfAbD.mjs} +3 -3
- package/dist/{marver-id-gate-BjF6v4bT.mjs → marver-id-gate-D-R0hSt_.mjs} +1 -1
- package/dist/perf-DkAUFT6W.mjs +1319 -0
- package/dist/perf-jam-BaH3Lg0m.mjs +635 -0
- package/dist/plugin-B8UghYuF.mjs +5242 -0
- package/dist/{poster-BdtSKMDm.mjs → poster-BNgafWMK.mjs} +1 -1
- package/dist/{profile-WU9qcbIo.mjs → profile-jIS6BcAs.mjs} +1 -1
- package/dist/{publish-bakes-9RzRToXV.mjs → publish-bakes-38Nja78p.mjs} +3 -3
- package/dist/{queue-29ok5_eZ.mjs → queue-CAM_vNmX.mjs} +1 -1
- package/dist/recover-B8AiI29B.mjs +66 -0
- package/dist/{serve-C8rVheYk.mjs → serve-Dp3nHstu.mjs} +3 -3
- package/dist/{share--oFJ1bCI.mjs → share-Ce4tP7ji.mjs} +1 -1
- package/dist/{shot-XQV7HC9A.mjs → shot-CMQgMVZm.mjs} +1 -1
- package/dist/{shot-DQeR_Pfn.mjs → shot-Ch24tiMO.mjs} +36 -5
- package/dist/slots-CFNnegCc.mjs +478 -0
- package/dist/{sync-DKk-yT1V.mjs → sync-CQdGARJ9.mjs} +4 -3
- package/dist/{work-VvX_JIgl.mjs → work-Bxz-ObF3.mjs} +4 -2
- package/dist/{work-F5u-twpJ.mjs → work-CNhFF9pU.mjs} +5 -3
- package/docs/boards-and-folders.md +3 -1
- package/docs/jam-session.md +57 -2
- package/docs/performance.md +424 -0
- package/package.json +2 -2
- package/src/client/content/index.tsx +3 -0
- package/src/client/content/video.tsx +16 -4
- package/src/client/frame-host/bridge.js +22 -6
- package/src/client/frame-host/main.tsx +17 -5
- package/src/client/shell/App.tsx +188 -26
- package/src/client/shell/BoardList.tsx +5 -5
- package/src/client/shell/Comments.tsx +8 -5
- package/src/client/shell/ContextMenu.tsx +5 -3
- package/src/client/shell/JamSurface.tsx +4 -2
- package/src/client/shell/LockedApp.tsx +8 -5
- package/src/client/shell/Play.tsx +20 -10
- package/src/client/shell/Tip.tsx +3 -1
- package/src/client/shell/Toolbar.tsx +12 -1
- package/src/client/shell/api.ts +233 -0
- package/src/client/shell/app-bridge.ts +254 -0
- package/src/client/shell/app-perf.ts +92 -0
- package/src/client/shell/canvas/Canvas.tsx +141 -21
- package/src/client/shell/canvas/FrameNode.tsx +22 -9
- package/src/client/shell/canvas/admission.ts +31 -9
- package/src/client/shell/canvas/camera-broadcast.ts +15 -5
- package/src/client/shell/canvas/ctl.ts +8 -0
- package/src/client/shell/canvas/frame-registry.ts +28 -2
- package/src/client/shell/canvas/sleep.ts +60 -17
- package/src/client/shell/canvas/updates.ts +2 -1
- package/src/client/shell/comments-store.ts +12 -4
- package/src/client/shell/goto.ts +22 -10
- package/src/client/shell/inset.ts +44 -0
- package/src/client/shell/jam-capture.ts +41 -22
- package/src/client/shell/jam-keys.ts +12 -3
- package/src/client/shell/jam-panel.tsx +9 -3
- package/src/client/shell/jam-queue.ts +3 -3
- package/src/client/shell/jam-session.tsx +14 -8
- package/src/client/shell/jam-voice.ts +55 -15
- package/src/client/shell/legacy-links.ts +2 -2
- package/src/client/shell/main.tsx +18 -1
- package/src/client/shell/marks-ui.tsx +5 -3
- package/src/client/shell/marver-app.ts +21 -0
- package/src/client/shell/notes.ts +8 -1
- package/src/client/shell/perf-run-probe.ts +34 -0
- package/src/client/shell/perf-run.ts +70 -0
- package/src/client/shell/perf.ts +80 -58
- package/src/client/shell/recorder-core.ts +183 -0
- package/src/client/shell/recorder.ts +607 -0
- package/src/client/shell/store.ts +294 -110
- package/src/client/shell/styles.css +72 -15
- package/src/client/shell/unsaved.ts +81 -0
- package/src/client/shell/whiteout-probes.ts +141 -0
- package/src/shared/app-api.ts +205 -0
- package/src/shared/app-perf.ts +308 -0
- package/src/shared/logo-sniff.ts +86 -0
- package/src/shared/machine.ts +132 -0
- package/src/shared/perf-run.ts +177 -0
- package/templates/AGENTS-embedded.md +25 -4
- package/templates/AGENTS-studio.md +25 -4
- package/templates/demo/dark.tsx +1 -1
- package/templates/demo/welcome.tsx +1 -1
- package/templates/instructions/boards.md +3 -1
- package/templates/instructions/welcome.md +6 -3
- package/dist/bake-C-awKgLA.mjs +0 -786
- package/dist/config-Cf7EjAMf.mjs +0 -292
- package/dist/dev-Bw_qYWWq.mjs +0 -755
- package/dist/dev-lock-DWSpa6nj.mjs +0 -179
- package/dist/perf-C75MZ73h.mjs +0 -167
- package/dist/perf-DPbLGhhO.mjs +0 -49
- package/dist/perf-jam-BU3TVrZu.mjs +0 -239
- package/dist/plugin-DkGmZs_r.mjs +0 -2423
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Light board -> light glass chrome over a paper canvas; dark board -> dark glass
|
|
3
3
|
chrome over a dark canvas. Frames are cards; chrome is glass. */
|
|
4
4
|
|
|
5
|
+
/* @tokens */
|
|
6
|
+
/* The token block (spec 28 A2.2, A2.9): the Mac app copies everything between these two markers into its own pages
|
|
7
|
+
at build time (app/scripts/tokens.mjs, rewritten onto :root), so its strip and pages wear exactly this glass. */
|
|
5
8
|
.sh-app {
|
|
6
9
|
--ground: #e7e9ef; --dot: #c9cbd5;
|
|
7
10
|
--accent: #0088ff; --accent-ring: rgba(0, 136, 255, .2); --beam: rgba(0, 136, 255, .42); --beam-blur: 6px; --beam-bottom: -13px; --beam-h: 12px; --beam-inset: 12%; --edge-accent: rgba(0, 136, 255, .8); --inner-tint: rgba(0, 136, 255, .13); --tip-bg: #18181b; --tip-ink: #fafafa; --accent-wash: rgba(0, 136, 255, .07);
|
|
@@ -102,6 +105,17 @@
|
|
|
102
105
|
@property --glass-accent { syntax: '<color>'; inherits: true; initial-value: #0077e6; }
|
|
103
106
|
@property --glass-accent-bg { syntax: '<color>'; inherits: true; initial-value: rgba(0, 136, 255, .13); }
|
|
104
107
|
|
|
108
|
+
/* Reduce Transparency and Increase Contrast (spec 28 A2.9, A2.13): every glass surface opaque - its fill the solid
|
|
109
|
+
one, its border the node's, no blur - in both themes (the dark rule's own specificity, later in the file); and
|
|
110
|
+
with more contrast the dimmer inks take the full one. macOS's settings reach Chrome too. */
|
|
111
|
+
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
|
|
112
|
+
.sh-app, .sh-app.dark { --glass: var(--solid); --glass-brd: var(--node-brd); --blur: none; }
|
|
113
|
+
}
|
|
114
|
+
@media (prefers-contrast: more) {
|
|
115
|
+
.sh-app, .sh-app.dark { --glass-ink-2: var(--glass-ink); --glass-ink-3: var(--glass-ink); }
|
|
116
|
+
}
|
|
117
|
+
/* @end-tokens */
|
|
118
|
+
|
|
105
119
|
/* interact mode: the whole shell shifts to the interactive purple - one token override,
|
|
106
120
|
and every accent-derived surface (mark, sidebar actives, selection bar, beams, rings,
|
|
107
121
|
handles, device chips) follows without knowing the mode exists */
|
|
@@ -150,6 +164,21 @@ button svg { pointer-events: none } /* event targets stay on the button - pan
|
|
|
150
164
|
background-size: var(--grid-size, 20px 20px);
|
|
151
165
|
background-position: var(--grid-pos, 0 0);
|
|
152
166
|
opacity: var(--grid-alpha, 1) }
|
|
167
|
+
/* the scroll edge (0.27.2, spec 28 A2.9 v1.8 #8, A3.8 #31): under the Mac app's transparent strip only (App.tsx renders
|
|
168
|
+
it when inset.ts's TOP is 44). One band over the world and under the chrome (z 9; the panels are 10): opaque ground
|
|
169
|
+
through --mv-top, fading out over 16 px more, the dots drawn from the same three grid variables paintGrid writes on
|
|
170
|
+
.sh-app - so nothing of a frame shows under the tabs, and a frame panned up fades out below them while the dots run
|
|
171
|
+
on. The grid's alpha reaches the dots only. The world itself carries no mask (one would add a render surface to every
|
|
172
|
+
frame). */
|
|
173
|
+
.sh-edge { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--mv-top, 0px) + 16px); z-index: 9; pointer-events: none;
|
|
174
|
+
background: var(--ground);
|
|
175
|
+
-webkit-mask-image: linear-gradient(#000 0 var(--mv-top, 0px), transparent calc(var(--mv-top, 0px) + 16px));
|
|
176
|
+
mask-image: linear-gradient(#000 0 var(--mv-top, 0px), transparent calc(var(--mv-top, 0px) + 16px)) }
|
|
177
|
+
.sh-edge::before { content: ''; position: absolute; inset: 0;
|
|
178
|
+
background-image: radial-gradient(var(--dot) 1px, transparent 1px);
|
|
179
|
+
background-size: var(--grid-size, 20px 20px);
|
|
180
|
+
background-position: var(--grid-pos, 0 0);
|
|
181
|
+
opacity: var(--grid-alpha, 1) }
|
|
153
182
|
.sh-content { will-change: auto }
|
|
154
183
|
#sh-world { position: relative; width: 1px; height: 1px }
|
|
155
184
|
#sh-world.sh-gesturing .sh-live { pointer-events: none } /* law G-4 */
|
|
@@ -434,8 +463,8 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
434
463
|
.sh-ibtn:hover { background: var(--glass-hover); color: var(--glass-ink) }
|
|
435
464
|
|
|
436
465
|
/* floating glass panel; collapses into the fab with a scale-fade morph */
|
|
437
|
-
.sh-panel { position: absolute; left: var(--edge); top: var(--edge); width: 236px;
|
|
438
|
-
max-height: calc(100% - 2 * var(--edge)); z-index: 10;
|
|
466
|
+
.sh-panel { position: absolute; left: var(--edge); top: calc(var(--mv-top, 0px) + var(--edge)); width: 236px;
|
|
467
|
+
max-height: calc(100% - 2 * var(--edge) - var(--mv-top, 0px)); z-index: 10;
|
|
439
468
|
border-radius: var(--r-panel); padding: 10px; display: flex; flex-direction: column;
|
|
440
469
|
font-size: 13px; color: var(--glass-ink);
|
|
441
470
|
transform-origin: 22px 22px; transition: transform var(--morph), opacity .2s ease }
|
|
@@ -559,7 +588,7 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
559
588
|
.sh-panel .sub.dim:hover { background: none; color: var(--glass-ink-3) }
|
|
560
589
|
|
|
561
590
|
/* collapsed panel: a round glass button; morphs against the panel */
|
|
562
|
-
.sh-fab { position: absolute; left: var(--edge); top: var(--edge); z-index: 11; width: 44px; height: 44px;
|
|
591
|
+
.sh-fab { position: absolute; left: var(--edge); top: calc(var(--mv-top, 0px) + var(--edge)); z-index: 11; width: 44px; height: 44px;
|
|
563
592
|
display: grid; place-items: center; border-radius: 999px;
|
|
564
593
|
color: var(--glass-ink-2); cursor: pointer;
|
|
565
594
|
transition: transform var(--morph), opacity .2s ease }
|
|
@@ -568,13 +597,13 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
568
597
|
|
|
569
598
|
/* pill nav */
|
|
570
599
|
/* uniform 5px inset on every side: 34px buttons + 2*5px = 44px, same as the fab */
|
|
571
|
-
.sh-pill { position: absolute; right: var(--edge); top: var(--edge); z-index: 10; display: flex; align-items: center; gap: 1px;
|
|
600
|
+
.sh-pill { position: absolute; right: var(--edge); top: calc(var(--mv-top, 0px) + var(--edge)); z-index: 10; display: flex; align-items: center; gap: 1px;
|
|
572
601
|
border-radius: 999px; padding: 5px;
|
|
573
602
|
transform-origin: calc(100% - 22px) 22px; transition: transform var(--morph), opacity .2s ease }
|
|
574
603
|
.sh-pill.closed { transform: scale(.16); opacity: 0; pointer-events: none }
|
|
575
604
|
/* the pill's expand chip - the sidebar fab, mirrored top-right: same glass (shared
|
|
576
605
|
surface rule above), same morph, the bar shrinking into the chip's spot */
|
|
577
|
-
.sh-pill-fab { position: absolute; right: var(--edge); top: var(--edge); z-index: 11; width: 44px; height: 44px;
|
|
606
|
+
.sh-pill-fab { position: absolute; right: var(--edge); top: calc(var(--mv-top, 0px) + var(--edge)); z-index: 11; width: 44px; height: 44px;
|
|
578
607
|
display: grid; place-items: center; border-radius: 999px;
|
|
579
608
|
color: var(--glass-ink-2); cursor: pointer;
|
|
580
609
|
transition: transform var(--morph), opacity .2s ease }
|
|
@@ -606,7 +635,7 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
606
635
|
.sh-menu button span { flex: 1; text-transform: capitalize }
|
|
607
636
|
/* the sidebar right-click menu keeps its labels verbatim (they match the toolbar exactly);
|
|
608
637
|
it scrolls rather than overflowing the window when the folder list grows long */
|
|
609
|
-
.sh-ctxmenu { max-height: calc(100vh - 16px); max-width: 240px; overflow-y: auto; scrollbar-width: thin }
|
|
638
|
+
.sh-ctxmenu { max-height: calc(100vh - 16px - var(--mv-top, 0px)); max-width: 240px; overflow-y: auto; scrollbar-width: thin }
|
|
610
639
|
.sh-ctxmenu button { flex: none; max-width: 100% }
|
|
611
640
|
.sh-ctxmenu button span { text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0 }
|
|
612
641
|
.sh-menu .chk { color: var(--glass-accent) }
|
|
@@ -649,7 +678,7 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
649
678
|
/* a lane tile's whole title: wraps past one line, never wider than a short paragraph */
|
|
650
679
|
.sh-tip .jm-tip-title { display: block; max-width: 320px; white-space: normal; line-height: 16px }
|
|
651
680
|
/* a status's tooltip: the status, then where it came from - each piece of evidence on its own line */
|
|
652
|
-
.sh-tip .sh-tip-lines { display: flex; flex-direction: column; gap: 2px; max-width: 420px; max-height: calc(100vh - 32px); overflow: hidden; white-space: normal }
|
|
681
|
+
.sh-tip .sh-tip-lines { display: flex; flex-direction: column; gap: 2px; max-width: 420px; max-height: calc(100vh - 32px - var(--mv-top, 0px)); overflow: hidden; white-space: normal }
|
|
653
682
|
/* read by a screen reader, never seen: what a glyph says to the eye */
|
|
654
683
|
.sh-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0 }
|
|
655
684
|
.sh-tip .sh-tip-lines small { opacity: .62; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere }
|
|
@@ -742,7 +771,7 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
742
771
|
|
|
743
772
|
/* ---- Play mode: near-black stage, one centered device, auto-hiding bar.
|
|
744
773
|
Fixed dark palette - the backdrop never follows the board theme, so no tokens here. */
|
|
745
|
-
.sh-play { position: absolute; inset: 0; z-index: 30; background: #0a0a0b; display: flex;
|
|
774
|
+
.sh-play { position: absolute; inset: 0; z-index: 30; background: #0a0a0b; display: flex; padding-top: var(--mv-top, 0px);
|
|
746
775
|
align-items: center; justify-content: center; animation: sh-play-in .28s ease-out; cursor: auto }
|
|
747
776
|
@keyframes sh-play-in { from { opacity: 0 } }
|
|
748
777
|
/* the device wears the frame-node card language: same theme border tokens, the same
|
|
@@ -773,7 +802,10 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
|
|
|
773
802
|
.sh-play.fill .dev { border-radius: 0; box-shadow: none; transition: none }
|
|
774
803
|
.sh-play.fill .dev::after { display: none }
|
|
775
804
|
|
|
776
|
-
/* the two floating chrome pieces share one glass language and one idle behavior
|
|
805
|
+
/* the two floating chrome pieces share one glass language and one idle behavior. Of them only .sh-play-nav is still
|
|
806
|
+
rendered: play's top chrome is the shared pill (Play.tsx: nav.sh-pill.sh-play-pill, .sh-pill-fab), which takes the
|
|
807
|
+
Mac app's inset through .sh-pill's own rule - .sh-play-bar, its menu and .sh-play-chip below are unused, left as
|
|
808
|
+
they were */
|
|
777
809
|
.sh-play-bar, .sh-play-nav { position: absolute; display: flex; align-items: center; gap: 1px;
|
|
778
810
|
padding: 4px; border-radius: 999px;
|
|
779
811
|
background: rgba(18, 18, 24, .82); border: 1px solid rgba(255, 255, 255, .12);
|
|
@@ -905,7 +937,7 @@ body.sh-hide-ui .sh-fab,
|
|
|
905
937
|
body.sh-hide-ui .sh-ctx,
|
|
906
938
|
body.sh-hide-ui .sh-update,
|
|
907
939
|
body.sh-hide-ui .sh-toasts,
|
|
908
|
-
body.sh-hide-ui .sh-banner,
|
|
940
|
+
body.sh-hide-ui .sh-banner:not(.sh-stopped), /* a stopped canvas stays said: the page holds what only it has */
|
|
909
941
|
body.sh-hide-ui .sh-play-nav { display: none !important }
|
|
910
942
|
|
|
911
943
|
/* the prototype pill reuses the shared pill LAYOUT but wears the discreet DARK skin of the
|
|
@@ -1254,7 +1286,7 @@ body.sh-hide-ui .sh-play-nav { display: none !important }
|
|
|
1254
1286
|
.sh-tip .cm-meta-row b { font-weight: 600; opacity: 1; margin: 0; color: var(--tip-ink) } /* value: bold, full-bright */
|
|
1255
1287
|
.sh-tip .cm-meta-row .k { margin: 0; opacity: .5; font-weight: 500; color: var(--tip-ink) } /* label: muted qualifier */
|
|
1256
1288
|
/* identity modal - same glass family */
|
|
1257
|
-
.cm-modal-wrap { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
|
|
1289
|
+
.cm-modal-wrap { position: fixed; inset: var(--mv-top, 0px) 0 0 0; z-index: 300; display: flex; align-items: center; justify-content: center;
|
|
1258
1290
|
background: rgba(24,24,27,.45); backdrop-filter: blur(5px) }
|
|
1259
1291
|
/* the auth modal is a focused surface, not a floating glass panel - near-solid so
|
|
1260
1292
|
the canvas behind never bleeds through the fields */
|
|
@@ -1586,7 +1618,7 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
|
|
|
1586
1618
|
.jm-rename input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring) }
|
|
1587
1619
|
|
|
1588
1620
|
/* ---- the capture: an edge ring round the window, the chip, the caption, points ---- */
|
|
1589
|
-
.jm-edge { position: absolute; inset: 0; pointer-events: none; z-index: 40;
|
|
1621
|
+
.jm-edge { position: absolute; inset: var(--mv-top, 0px) 0 0 0; pointer-events: none; z-index: 40;
|
|
1590
1622
|
box-shadow: inset 0 0 0 2px var(--jm-rec), inset 0 0 0 6px var(--jm-rec-ring) }
|
|
1591
1623
|
/* the capture recording NOW (round 3): the last tile of the lane, two lines like the others - a pulsing
|
|
1592
1624
|
teal dot, "Capturing" and the timer over what it holds so far - then Stop. A little wider, never cut. */
|
|
@@ -1810,7 +1842,7 @@ body.sh-commenting .sh-sticky-body { cursor: crosshair }
|
|
|
1810
1842
|
.jm-notefield .caret { display: inline-block; width: 1px; height: 15px; background: var(--accent); vertical-align: -3px; margin-left: 1px }
|
|
1811
1843
|
.jm-notes .foot { display: flex; gap: 12px; justify-content: flex-end; font: 500 11px -apple-system, system-ui, sans-serif; color: var(--glass-ink-3) }
|
|
1812
1844
|
/* the focus panel: top edge to just above the lane; the panel inside fills it and its middle scrolls */
|
|
1813
|
-
.jm-focus { position: absolute; top: var(--edge); bottom: calc(var(--edge) + var(--jm-lane) + 2px); z-index: 31; display: flex }
|
|
1845
|
+
.jm-focus { position: absolute; top: calc(var(--mv-top, 0px) + var(--edge)); bottom: calc(var(--edge) + var(--jm-lane) + 2px); z-index: 31; display: flex }
|
|
1814
1846
|
.jm-focus > .jm-panel { width: 100%; height: 100%; min-height: 0 }
|
|
1815
1847
|
/* one big picture at a time: the frame tabs and a Before | After switch above it (B flips) */
|
|
1816
1848
|
.jm-fbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap } /* a narrow window wraps the switch under the tabs */
|
|
@@ -1884,10 +1916,35 @@ button.jm-link { padding: 0; border: 0; background: none; text-align: left; widt
|
|
|
1884
1916
|
|
|
1885
1917
|
/* Jam V2: while the lane shows, the sidebar stops above it and the bottom edge rises one lane - the
|
|
1886
1918
|
Update pill, toasts and notices (LANE_H, jam-lane.tsx) */
|
|
1887
|
-
.sh-app.jm-lane-on .sh-panel { max-height: calc(100% - 2 * var(--edge) - 56px); bottom: auto }
|
|
1919
|
+
.sh-app.jm-lane-on .sh-panel { max-height: calc(100% - 2 * var(--edge) - 56px - var(--mv-top, 0px)); bottom: auto }
|
|
1888
1920
|
.sh-app.jm-lane-on .sh-update { bottom: calc(var(--edge) + 56px) }
|
|
1889
1921
|
.sh-app.jm-lane-on .sh-toasts { bottom: calc(var(--edge) + 56px) }
|
|
1890
1922
|
.sh-app.jm-lane-on .sh-banner { bottom: calc(var(--edge) + 56px) }
|
|
1923
|
+
/* the canvas stopped (spec 28 A1.11): on the toolbar's centre line in the gap between the sidebar and the
|
|
1924
|
+
toolbar, or just below the toolbar row - placed by the shell (App.tsx placeBanner), which measures both; above
|
|
1925
|
+
play and focus. The fallback before it measures: top centre, on the line (34px tall, the row 46px) */
|
|
1926
|
+
.sh-app .sh-banner.sh-stopped { top: calc(var(--mv-top, 0px) + var(--edge) + 6px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
|
|
1927
|
+
z-index: 40; width: max-content; max-width: none; white-space: nowrap; text-align: center; text-wrap: balance; pointer-events: auto }
|
|
1928
|
+
.sh-banner.sh-stopped code { font: 500 11.5px/14px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border-radius: 5px;
|
|
1929
|
+
background: color-mix(in srgb, currentColor 11%, transparent); white-space: nowrap }
|
|
1930
|
+
.sh-banner.sh-stopped .kept { color: var(--glass-ink-2) }
|
|
1931
|
+
.sh-banner.sh-stopped:is([data-at="stack"], [data-at="below"]) .dot { display: none }
|
|
1932
|
+
.sh-banner.sh-stopped:is([data-at="stack"], [data-at="below"]) .kept { display: block }
|
|
1933
|
+
/* over play and focus: the play chrome's dark skin (its pills, the navigator), warm light text - 13:1 */
|
|
1934
|
+
.sh-banner.sh-stopped.dark { background: rgba(18, 18, 24, .86); border-color: rgba(255, 255, 255, .1); color: #ffd9a0;
|
|
1935
|
+
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 2px 10px rgba(0, 0, 0, .35) } /* tight: never a smudge on the stage under it */
|
|
1936
|
+
.sh-banner.sh-stopped.dark::after { display: none }
|
|
1937
|
+
.sh-banner.sh-stopped.dark .kept { color: rgba(245, 245, 247, .78) }
|
|
1938
|
+
/* a frame (or the stage) whose canvas is away shows another project's "another canvas" page: one calm line over
|
|
1939
|
+
it, in the frame's own theme - the banner says what happened, once. Screen-size text, never wider than its frame */
|
|
1940
|
+
.sh-stranded { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 8%; container-type: size;
|
|
1941
|
+
background: var(--node-bg, var(--pdev-bg, #fff)); color: color-mix(in srgb, var(--head-ink, #18181b) 64%, var(--node-bg, #fff));
|
|
1942
|
+
pointer-events: none; text-align: center }
|
|
1943
|
+
.sh-stranded span { font-family: -apple-system, system-ui, sans-serif; font-weight: 500; font-size: min(calc(12px * var(--sh-inv, 1)), 7cqi); line-height: 1.35 }
|
|
1944
|
+
.sh-play .dev .sh-stranded { --node-bg: #fff; --head-ink: #18181b }
|
|
1945
|
+
.sh-play .dev[data-theme="dark"] .sh-stranded { --node-bg: #0f1015; --head-ink: #ececf1 }
|
|
1946
|
+
/* the tools that need the server, while the canvas is stopped: quiet, their tooltip says why */
|
|
1947
|
+
.sh-pill-btn[data-stopped], .sh-pill-btn[data-stopped]:hover { opacity: .38; background: none; cursor: default }
|
|
1891
1948
|
|
|
1892
1949
|
|
|
1893
1950
|
/* ---- words on this Mac (spec 27 Part 4): the live caption over the capture tile, the one question ---- */
|
|
@@ -1976,7 +2033,7 @@ button.jm-link { padding: 0; border: 0; background: none; text-align: left; widt
|
|
|
1976
2033
|
.jm-panel button.row:hover { background: var(--glass-hover) }
|
|
1977
2034
|
textarea.jm-field { width: 100%; resize: none; outline: none; overflow: hidden; display: block }
|
|
1978
2035
|
textarea.jm-field:focus { border-color: transparent; box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-ring) }
|
|
1979
|
-
.jm-sheet-at { position: absolute; right: var(--edge); top: 64px; z-index: 42 }
|
|
2036
|
+
.jm-sheet-at { position: absolute; right: var(--edge); top: calc(var(--mv-top, 0px) + 64px); z-index: 42 }
|
|
1980
2037
|
.jm-sheet .rows, .jm-wrapup .rows { margin: 0 -8px }
|
|
1981
2038
|
.jm-sc-row { position: relative; cursor: default; outline: none }
|
|
1982
2039
|
.jm-record-panel .jm-body { overflow: auto }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What this page holds that is not on the server yet, and what it is busy with (spec 28 A2.9, A2.14 #18): one
|
|
3
|
+
* registry of reasons, read by one `beforeunload` - so Chrome asks before a reload or a close loses any of them, not
|
|
4
|
+
* only a capture being recorded - and, in the Mac app, by the shell's `mv:busy` (app-bridge.ts), which the app's guard
|
|
5
|
+
* trusts before it closes, reloads or replaces the page.
|
|
6
|
+
*
|
|
7
|
+
* Beside A1's `holdsReload` (api.ts), which keeps meaning "this page may not reload itself now" and drives the
|
|
8
|
+
* stopped banner: the two ask much the same questions, and each keeps its own job.
|
|
9
|
+
*
|
|
10
|
+
* The reasons are the contract's (`src/shared/app-api.ts`): unsaved - `capture-recording`, `capture-unsent` (sealed,
|
|
11
|
+
* not taken by the server yet, memory-only ones included), `board-unsaved` (a dirty board: a save in flight or
|
|
12
|
+
* failed keeps it dirty), `heights`, `typing` (words typed and not sent); busy but not unsaved - `jam-session`,
|
|
13
|
+
* `microphone`, `agent`. A drag is not work: it becomes `board-unsaved` on drop.
|
|
14
|
+
*
|
|
15
|
+
* No imports but the contract's types: a unit test drives it without a page.
|
|
16
|
+
*/
|
|
17
|
+
import { UNSAVED_WHY, WHY, type Why } from '../../shared/app-api.ts'
|
|
18
|
+
|
|
19
|
+
export type UnsavedWhy = (typeof UNSAVED_WHY)[number]
|
|
20
|
+
export type BusyWhy = Exclude<Why, UnsavedWhy>
|
|
21
|
+
|
|
22
|
+
const reasons = new Map<Why, Set<() => boolean>>()
|
|
23
|
+
/** A check that throws holds: what it guards is not known to be safe. */
|
|
24
|
+
const holds = (fn: () => boolean): boolean => { try { return !!fn() } catch { return true } }
|
|
25
|
+
const on = (why: Why): boolean => [...(reasons.get(why) ?? [])].some(holds)
|
|
26
|
+
export const isUnsaved = (why: Why): why is UnsavedWhy => (UNSAVED_WHY as readonly Why[]).includes(why)
|
|
27
|
+
|
|
28
|
+
function register(why: Why, fn: () => boolean): () => void {
|
|
29
|
+
let set = reasons.get(why)
|
|
30
|
+
if (!set) reasons.set(why, set = new Set())
|
|
31
|
+
set.add(fn)
|
|
32
|
+
workChanged()
|
|
33
|
+
return () => { set!.delete(fn); workChanged() }
|
|
34
|
+
}
|
|
35
|
+
/** Unsaved work of this kind while `fn` answers true. Returns the unregister. */
|
|
36
|
+
export const unsavedWhen = (why: UnsavedWhy, fn: () => boolean) => register(why, fn)
|
|
37
|
+
/** Busy (not unsaved) while `fn` answers true: a Jam session, the microphone, an agent at work. */
|
|
38
|
+
export const busyWhen = (why: BusyWhy, fn: () => boolean) => register(why, fn)
|
|
39
|
+
|
|
40
|
+
/** Every reason that holds now, in the contract's order. */
|
|
41
|
+
export const busyWhy = (): Why[] => WHY.filter(on)
|
|
42
|
+
/** The unsaved reasons that hold now. */
|
|
43
|
+
export const unsavedWhy = (): UnsavedWhy[] => UNSAVED_WHY.filter(on)
|
|
44
|
+
/** Does this page hold anything not on the server yet? */
|
|
45
|
+
export const hasUnsavedWork = (): boolean => UNSAVED_WHY.some(on)
|
|
46
|
+
|
|
47
|
+
const listeners = new Set<() => void>()
|
|
48
|
+
let queued = false
|
|
49
|
+
/** A reason may have changed: every listener hears it once, a microtask later (a burst of changes is one). */
|
|
50
|
+
export function workChanged(): void {
|
|
51
|
+
if (queued || !listeners.size) return
|
|
52
|
+
queued = true
|
|
53
|
+
queueMicrotask(() => { queued = false; for (const fn of [...listeners]) { try { fn() } catch { /* the rest still hear */ } } })
|
|
54
|
+
}
|
|
55
|
+
export const onWorkChange = (fn: () => void): (() => void) => { listeners.add(fn); return () => { listeners.delete(fn) } }
|
|
56
|
+
|
|
57
|
+
// ---- leaving --------------------------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
let leaving = false
|
|
60
|
+
let rearm: ReturnType<typeof setTimeout> | undefined
|
|
61
|
+
/** The page's own reload - A1's resume, once its canvas is back and what it held is saved - goes without asking
|
|
62
|
+
* itself. Should the reload not happen after all (a frame refused it), the guard is back a second later. */
|
|
63
|
+
export function leaveNow(go: () => void): void {
|
|
64
|
+
leaving = true
|
|
65
|
+
clearTimeout(rearm)
|
|
66
|
+
rearm = setTimeout(() => { leaving = false }, 1000)
|
|
67
|
+
go()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Would the guard ask before this page goes? */
|
|
71
|
+
export const asksBeforeLeaving = (): boolean => !leaving && hasUnsavedWork()
|
|
72
|
+
|
|
73
|
+
/** The one `beforeunload` (it replaces the store's stopped-and-dirty one and the capture's recording one). Chrome shows
|
|
74
|
+
* its question only on a page that had a gesture since it loaded; the Mac app does not rely on it (A2.14 #16). */
|
|
75
|
+
export function guardLeaving(target: EventTarget): void {
|
|
76
|
+
target.addEventListener('beforeunload', (e) => {
|
|
77
|
+
if (!asksBeforeLeaving()) return
|
|
78
|
+
e.preventDefault()
|
|
79
|
+
try { (e as BeforeUnloadEvent).returnValue = '' } catch { /* not every engine has it */ }
|
|
80
|
+
})
|
|
81
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The white-out detector's probes, the shell's half (spec 28 A3.3, A3.8 #16): up to 16 points of empty canvas
|
|
3
|
+
* background, picked geometrically before main captures and checked again after. Owner: the flash stream.
|
|
4
|
+
*
|
|
5
|
+
* During a gesture frames take no pointer events (styles.css ~169), so hit-testing alone would take a white frame
|
|
6
|
+
* for ground: `pick(tick)` takes grid points inside `usable()` below `VISIBLE_TOP` (inset.ts), each at least 48 px
|
|
7
|
+
* from every `.sh-node`'s screen rect, with the canvas surface under it; `verify(tick)` says which are still valid -
|
|
8
|
+
* moved on screen by less than their clearance between the two answers. A frame white on purpose is excluded by its
|
|
9
|
+
* rect. Main treats fewer than 4 valid probes, a changed document, bounds or active tab, or an answer later than
|
|
10
|
+
* 150 ms as inconclusive, never white.
|
|
11
|
+
*
|
|
12
|
+
* FROZEN signatures (A3.8 #53). The geometry: a 12 x 8 grid of cell centres over the usable rectangle, below the
|
|
13
|
+
* scroll edge; a point's clearance is its distance to the nearest node's rect (`getBoundingClientRect`: transforms and
|
|
14
|
+
* animation included); the 16 with the most clearance that have the canvas surface under them are kept, with the
|
|
15
|
+
* camera (`canvasCtl.transform()`) for the bracket. **The camera at every animation frame of the bracket**: from
|
|
16
|
+
* `pick` to `verify` the shell records the camera once a frame (the frames a capture can have read), since a pan
|
|
17
|
+
* that turns back - the recorder's own pan is 60 wheel events one way and 60 the other, and main's bracket can last
|
|
18
|
+
* some 800 ms (150 + 500 + 150) - can sweep a node over a probe and back with the two ends the same (review of
|
|
19
|
+
* a3-native, minor #16). `verify` maps each point through the pick's camera and each recorded one, both ways: the
|
|
20
|
+
* world point under it at pick, drawn at that frame, and the world point under it at that frame, drawn as the camera
|
|
21
|
+
* was at pick. The second is the one that matters under a zoom - if the world point under the probe at a frame was,
|
|
22
|
+
* at the pick's camera, closer than the clearance, no node (each at least the clearance away then) covered it at that
|
|
23
|
+
* frame; under a zoom out a node's edge moves further than the probe's own world point, so the first alone does not
|
|
24
|
+
* say that. A point is valid when every frame's moves are under its clearance, it is still `VERIFY_MARGIN` (8 px)
|
|
25
|
+
* clear of every node now, and the surface is still under it. With no camera (no canvas) every point is invalid: the
|
|
26
|
+
* sample is inconclusive. A main thread stalled for the whole bracket records no frame between, and draws none
|
|
27
|
+
* either: the camera is the shell's. Nodes that move on the board themselves (a drag, a layout animation) are not the
|
|
28
|
+
* camera's and not covered by this.
|
|
29
|
+
*/
|
|
30
|
+
import { PERF_BOUNDS, type PerfCam, type PerfMsg } from '../../shared/app-api.ts'
|
|
31
|
+
import { canvasCtl } from './canvas/ctl.ts'
|
|
32
|
+
import { VISIBLE_TOP } from './inset.ts'
|
|
33
|
+
|
|
34
|
+
/** At most this many probes a tick (the bridge refuses more than PERF_BOUNDS.points). */
|
|
35
|
+
export const MAX_PROBES = Math.min(16, PERF_BOUNDS.points)
|
|
36
|
+
/** Each probe's clearance from every node's screen rect, px. */
|
|
37
|
+
export const PROBE_CLEARANCE = 48
|
|
38
|
+
/** The candidate grid over the usable rectangle. */
|
|
39
|
+
export const PROBE_GRID: readonly [number, number] = [12, 8]
|
|
40
|
+
/** At `verify`, each kept point still this far from every node's rect, px (the design's margin). */
|
|
41
|
+
export const VERIFY_MARGIN = 8
|
|
42
|
+
|
|
43
|
+
const view = () => ({ w: innerWidth, h: innerHeight })
|
|
44
|
+
type Rect = { left: number; top: number; right: number; bottom: number }
|
|
45
|
+
|
|
46
|
+
/** The canvas surface itself: the zoom wrapper, its content or the world - never a frame, a caption, the chrome. */
|
|
47
|
+
export function isSurface(el: Element | null): boolean {
|
|
48
|
+
if (!el) return false
|
|
49
|
+
return el.id === 'sh-world' || el.classList.contains('sh-canvas') || el.classList.contains('sh-content')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A point's distance to the nearest rect (0 inside one); Infinity with none. */
|
|
53
|
+
export function clearance(x: number, y: number, rects: readonly Rect[]): number {
|
|
54
|
+
let d = Infinity
|
|
55
|
+
for (const r of rects) {
|
|
56
|
+
const dx = Math.max(r.left - x, 0, x - r.right)
|
|
57
|
+
const dy = Math.max(r.top - y, 0, y - r.bottom)
|
|
58
|
+
d = Math.min(d, Math.hypot(dx, dy))
|
|
59
|
+
if (d === 0) return 0
|
|
60
|
+
}
|
|
61
|
+
return d
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Where the world point under (x, y) at camera a is drawn at camera b, `o` the canvas wrapper's client origin. */
|
|
65
|
+
export function moved(x: number, y: number, a: PerfCam, b: PerfCam, o: { x: number; y: number }): number {
|
|
66
|
+
const wx = (x - o.x - a.x) / a.s
|
|
67
|
+
const wy = (y - o.y - a.y) / a.s
|
|
68
|
+
return Math.hypot(o.x + b.x + wx * b.s - x, o.y + b.y + wy * b.s - y)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const nodeRects = (): Rect[] => [...document.querySelectorAll('.sh-node')].map((e) => e.getBoundingClientRect())
|
|
72
|
+
const origin = () => { const r = document.querySelector('.sh-canvas')?.getBoundingClientRect(); return { x: r?.left ?? 0, y: r?.top ?? 0 } }
|
|
73
|
+
|
|
74
|
+
/** The points a tick picked, its clearances, its camera and the camera at each frame since, for its `verify` (the last four ticks kept). */
|
|
75
|
+
const kept = new Map<number, { pts: [number, number][]; clear: number[]; cam: PerfCam | null; path: PerfCam[]; stop(): void }>()
|
|
76
|
+
/** The longest bracket recorded, in frames (5 s at 120 Hz): past it a verify finds the path cut, and says invalid. */
|
|
77
|
+
export const PATH_FRAMES = 600
|
|
78
|
+
|
|
79
|
+
/** The camera at each animation frame from now until `stop()`, or until it holds PATH_FRAMES (then the path is cut). */
|
|
80
|
+
function cameraPath(): { path: PerfCam[]; stop(): void } {
|
|
81
|
+
const path: PerfCam[] = []
|
|
82
|
+
let on = true
|
|
83
|
+
const step = () => {
|
|
84
|
+
if (!on) return
|
|
85
|
+
const c = canvasCtl.transform()
|
|
86
|
+
if (c) path.push({ ...c })
|
|
87
|
+
if (path.length >= PATH_FRAMES) { on = false; return }
|
|
88
|
+
requestAnimationFrame(step)
|
|
89
|
+
}
|
|
90
|
+
requestAnimationFrame(step)
|
|
91
|
+
return { path, stop: () => { on = false } }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The `before` answer for `tick`: the points chosen now, the camera and the viewport. */
|
|
95
|
+
export function pick(tick: number): Extract<PerfMsg, { kind: 'probes'; at: 'before' }> {
|
|
96
|
+
const top = VISIBLE_TOP
|
|
97
|
+
const w = innerWidth, h = Math.max(0, innerHeight - top)
|
|
98
|
+
const rects = nodeRects()
|
|
99
|
+
const [cols, rows] = PROBE_GRID
|
|
100
|
+
const cands: { p: [number, number]; c: number }[] = []
|
|
101
|
+
for (let j = 0; j < rows; j++) {
|
|
102
|
+
for (let i = 0; i < cols; i++) {
|
|
103
|
+
const x = Math.round((i + 0.5) * w / cols)
|
|
104
|
+
const y = Math.round(top + (j + 0.5) * h / rows)
|
|
105
|
+
const c = clearance(x, y, rects)
|
|
106
|
+
if (c < PROBE_CLEARANCE) continue
|
|
107
|
+
if (!isSurface(document.elementFromPoint(x, y))) continue
|
|
108
|
+
cands.push({ p: [x, y], c })
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
cands.sort((a, b) => b.c - a.c)
|
|
112
|
+
const chosen = cands.slice(0, MAX_PROBES)
|
|
113
|
+
const cam = canvasCtl.transform()
|
|
114
|
+
const run = cameraPath()
|
|
115
|
+
kept.get(tick)?.stop()
|
|
116
|
+
kept.set(tick, { pts: chosen.map((x) => x.p), clear: chosen.map((x) => Math.min(x.c, 1e6)), cam, path: run.path, stop: run.stop })
|
|
117
|
+
for (const k of [...kept.keys()]) if (kept.size > 4 && k !== tick) { kept.get(k)!.stop(); kept.delete(k) }
|
|
118
|
+
return { kind: 'probes', tick, at: 'before', points: chosen.map((x) => x.p), cam, view: view() }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** The `after` answer for `tick`: one flag per point `pick(tick)` gave. */
|
|
122
|
+
export function verify(tick: number): Extract<PerfMsg, { kind: 'probes'; at: 'after' }> {
|
|
123
|
+
const k = kept.get(tick)
|
|
124
|
+
const cam = canvasCtl.transform()
|
|
125
|
+
if (!k) return { kind: 'probes', tick, at: 'after', valid: [], cam, view: view() }
|
|
126
|
+
kept.delete(tick)
|
|
127
|
+
const cut = k.path.length >= PATH_FRAMES
|
|
128
|
+
k.stop()
|
|
129
|
+
const rects = nodeRects()
|
|
130
|
+
const o = origin()
|
|
131
|
+
// every camera the bracket's frames showed, and the one now
|
|
132
|
+
const cams = cam ? [...k.path, cam] : []
|
|
133
|
+
const valid = k.pts.map(([x, y], i) => {
|
|
134
|
+
if (!k.cam || !cam || cut) return false
|
|
135
|
+
const c = k.clear[i]!
|
|
136
|
+
for (const at of cams) if (moved(x, y, k.cam, at, o) >= c || moved(x, y, at, k.cam, o) >= c) return false
|
|
137
|
+
if (clearance(x, y, rects) < VERIFY_MARGIN) return false
|
|
138
|
+
return isSurface(document.elementFromPoint(x, y))
|
|
139
|
+
})
|
|
140
|
+
return { kind: 'probes', tick, at: 'after', valid, cam, view: view() }
|
|
141
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract between a canvas's shell and the Mac app (spec 28 A2.9, A2.14 #9, #18, #19, v1.12 r1 #1):
|
|
3
|
+
* the one place both sides read. The shell feature-detects `window.marverApp`; the app's canvas preload
|
|
4
|
+
* exposes it and its `bridge.ts` checks every payload against these bounds. Types and constants only - no
|
|
5
|
+
* imports - so the app's main bundle and the shell both take it as it is.
|
|
6
|
+
*
|
|
7
|
+
* Frozen before the streams split (A2.14 #32; A3's additions by A3.8 #53). The admission (v1.12 r1 #1) is the
|
|
8
|
+
* preload's and the bridge's alone: the shell never sees `doc` - `window.marverApp` is the same before and after
|
|
9
|
+
* admission, and A2.9's order (hello first, then theme, busy and menu) is all the shell owes.
|
|
10
|
+
*
|
|
11
|
+
* A3 (app 0.2, marver 0.27.2) adds, all feature-detected and `v` still 1 (A3.8 #10, #26, #27): `mv:doc` answers
|
|
12
|
+
* the document's `inset`; `mv:hello` says the inset the shell applied; `mv:present` / `mv:presented`, the
|
|
13
|
+
* presentation epochs of the one ground; `mv:perf` / `mv:perf-ask`, the recorder's traffic. Every new method of
|
|
14
|
+
* `MarverAppV1` is optional: a 0.27.2 shell inside app 0.1 still sees `marverApp` (marver-app.ts requires only the
|
|
15
|
+
* six 0.1 methods), and a shell trusts the inset only with the whole presentation contract (inset.ts).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const APP_API_VERSION = 1
|
|
19
|
+
|
|
20
|
+
/** Reasons a page is busy (A2.14 #18). The first five are unsaved work; the last three are busy, not unsaved. */
|
|
21
|
+
export const UNSAVED_WHY = ['capture-recording', 'capture-unsent', 'board-unsaved', 'heights', 'typing'] as const
|
|
22
|
+
export const BUSY_ONLY_WHY = ['jam-session', 'microphone', 'agent'] as const
|
|
23
|
+
export type Why = (typeof UNSAVED_WHY)[number] | (typeof BUSY_ONLY_WHY)[number]
|
|
24
|
+
export const WHY: readonly Why[] = [...UNSAVED_WHY, ...BUSY_ONLY_WHY]
|
|
25
|
+
|
|
26
|
+
/** The strip's height: the top inset a shell applies under the Mac app's transparent strip (A2.9, A3.8 #31). */
|
|
27
|
+
export const TOP_INSET = 44
|
|
28
|
+
/** The scroll edge fades out over this many px below the inset (A2.9 v1.8 #8): `VISIBLE_TOP = TOP + EDGE_FADE`. */
|
|
29
|
+
export const EDGE_FADE = 16
|
|
30
|
+
/** What a document may apply: 44 only when main placed it full height (A3.8 #26). */
|
|
31
|
+
export type Inset = 0 | 44
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* `mv:hello` - sent first. `page` the shell's PAGE_ID, `version` from sh-config. `inset` (0.27.2): what the shell
|
|
35
|
+
* applied, 0 or 44; any other value refuses the message; absent (a 0.27.1 shell) reads 0 (A3.8 #26).
|
|
36
|
+
*/
|
|
37
|
+
export interface Hello { version: string; board: string | null; page: string; inset?: Inset }
|
|
38
|
+
/** `mv:busy` - `busy` is any reason, `unsaved` any of UNSAVED_WHY; main refuses a message where they disagree. */
|
|
39
|
+
export interface Busy { busy: boolean; unsaved: boolean; why: Why[] }
|
|
40
|
+
/** `mv:theme` - the shell's `play || slides || viewTheme === 'dark'` (A2.14 #26). */
|
|
41
|
+
export interface Theme { dark: boolean }
|
|
42
|
+
/** `mv:menu` - at most 40, no separators in 0.1 (A2.7). */
|
|
43
|
+
export interface MenuItem { id: string; group: 'view' | 'jam'; label: string; hint?: string; checked?: boolean }
|
|
44
|
+
/** `mv:app-state` (main to canvas). `untrusted`: stop every microphone track (A2.14 #13). `open-next` is A4's. */
|
|
45
|
+
export type AppState = 'shown' | 'hidden' | 'untrusted'
|
|
46
|
+
/**
|
|
47
|
+
* `mv:doc` - the preload's one synchronous call at document start, answered at once on every path while untrusted,
|
|
48
|
+
* granting and moving nothing (A2.14 #9). `reopen`: the crash reload's, and an unloaded tab's reopen (A3.8 #43).
|
|
49
|
+
* `inset` (app 0.2, A3.8 #26): 44 when the document now committing is placed `full` (its pending layout, else the
|
|
50
|
+
* committed one), else 0; app 0.1 answers none, read as 0. There is no `mv:inset`.
|
|
51
|
+
*/
|
|
52
|
+
export interface DocAnswer { reopen: boolean; inset?: Inset }
|
|
53
|
+
/** `mv:admit` (main to canvas) - the document admitted at its trusted commit (v1.12 r1 #1). */
|
|
54
|
+
export interface Admit { doc: string }
|
|
55
|
+
/** `mv:menu-click` (main to canvas). */
|
|
56
|
+
export interface MenuClick { id: string }
|
|
57
|
+
/**
|
|
58
|
+
* The ids main sends of its own, never in the page's `mv:menu`: the tab's right-click Mark All as Seen (A2.4's
|
|
59
|
+
* channels table: "Mark all as seen sends `mv:menu-click mark-all-seen` to the canvas"). A shell that does not know
|
|
60
|
+
* one does nothing with it.
|
|
61
|
+
*/
|
|
62
|
+
export const APP_MENU_IDS = ['mark-all-seen'] as const
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* `mv:present` (main to canvas; on the wire `{ doc, ...Present }`, stamped by main like `mv:app-state`): show the
|
|
66
|
+
* latest state, then say so (A3.8 #27). `w`, `h`: the view's size in CSS px this request is about; `frames`: the
|
|
67
|
+
* animation frames to wait once the viewport has that size (main's tunable, 1-8, 2 to start). The shell waits until
|
|
68
|
+
* its viewport is `w x h` (500 ms at most), then `frames` animation frames, and answers; a newer request cancels an
|
|
69
|
+
* older wait, which is never answered.
|
|
70
|
+
*/
|
|
71
|
+
export interface Present { epoch: number; w: number; h: number; frames: number }
|
|
72
|
+
/** `mv:presented` (canvas to main, stamped by the preload, never held): the request answered, at this viewport. */
|
|
73
|
+
export interface Presented { epoch: number; w: number; h: number }
|
|
74
|
+
|
|
75
|
+
/** A camera as the shell's probes read it: world offset and scale (canvasCtl.transform()). */
|
|
76
|
+
export interface PerfCam { x: number; y: number; s: number }
|
|
77
|
+
/** A viewport in CSS px. */
|
|
78
|
+
export interface PerfSize { w: number; h: number }
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* `mv:perf` (canvas to main; on the wire `{ doc, p }`, stamped by the preload with the admitted `doc`, never held
|
|
82
|
+
* or replayed: they are about now - A3.8 #10). `mem` and `shown` come from the preload by itself, so 0.27.0 and
|
|
83
|
+
* 0.27.1 canvases answer too; `gesture`, `probes` and `board` from a 0.27.2 shell.
|
|
84
|
+
* - `gesture`: perf.ts's begin and end (`on`), numbered (`seq`) - the white-out detector's window (A3.8 #15);
|
|
85
|
+
* - `probes`: the shell's answer to a probes ask (A3.8 #16): `before` lists up to 32 points in client px, `after`
|
|
86
|
+
* says which of them are still valid (moved by less than their clearance between the two answers);
|
|
87
|
+
* - `mem`: `process.getProcessMemoryInfo().private` and `getHeapStatistics()`, all in KB (A3.8 #5);
|
|
88
|
+
* - `shown`: the second animation-frame callback after a `shown` ask (A3.8 #9: a frame produced, not presented);
|
|
89
|
+
* - `board`: the board's frame count and how many sleep, at each commit (Copy Details, A3.8 #9).
|
|
90
|
+
*/
|
|
91
|
+
export type PerfMsg =
|
|
92
|
+
| { kind: 'gesture'; on: boolean; seq: number; type?: 'pan' | 'zoom' | 'layout' }
|
|
93
|
+
| { kind: 'probes'; tick: number; at: 'before'; points: [number, number][]; cam: PerfCam | null; view: PerfSize }
|
|
94
|
+
| { kind: 'probes'; tick: number; at: 'after'; valid: boolean[]; cam: PerfCam | null; view: PerfSize }
|
|
95
|
+
| { kind: 'mem'; tick: number; privateKB: number; heapUsedKB: number; heapTotalKB: number }
|
|
96
|
+
| { kind: 'shown'; tick: number }
|
|
97
|
+
| { kind: 'board'; frames: number; asleep: number }
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* `mv:perf-ask` (main to canvas; on the wire `{ doc, ...PerfAsk }`). The preload answers `mem` and `shown` itself,
|
|
101
|
+
* keeps `display`'s rate for `perfInfo()`, and hands `probes` to the shell's `onPerfAsk` listeners (only the shell
|
|
102
|
+
* can answer them). An ask for another document is dropped.
|
|
103
|
+
*/
|
|
104
|
+
export type PerfAsk =
|
|
105
|
+
| { kind: 'mem'; tick: number }
|
|
106
|
+
| { kind: 'shown'; tick: number }
|
|
107
|
+
| { kind: 'probes'; tick: number; at: 'before' | 'after' }
|
|
108
|
+
| { kind: 'display'; hz: number }
|
|
109
|
+
/** What reaches the shell's `onPerfAsk`. */
|
|
110
|
+
export type PerfProbeAsk = Extract<PerfAsk, { kind: 'probes' }>
|
|
111
|
+
|
|
112
|
+
/** The canvas channels. `mv:inset` is gone (A3.8 #26: `mv:doc` answers it); needs-you and capture are A4's. */
|
|
113
|
+
export const CANVAS_CHANNELS = {
|
|
114
|
+
doc: 'mv:doc',
|
|
115
|
+
admit: 'mv:admit',
|
|
116
|
+
hello: 'mv:hello',
|
|
117
|
+
theme: 'mv:theme',
|
|
118
|
+
busy: 'mv:busy',
|
|
119
|
+
menu: 'mv:menu',
|
|
120
|
+
appState: 'mv:app-state',
|
|
121
|
+
menuClick: 'mv:menu-click',
|
|
122
|
+
/** A3: the one ground's presentation epochs (A3.8 #27) */
|
|
123
|
+
present: 'mv:present',
|
|
124
|
+
presented: 'mv:presented',
|
|
125
|
+
/** A3: the recorder (A3.8 #10) */
|
|
126
|
+
perf: 'mv:perf',
|
|
127
|
+
perfAsk: 'mv:perf-ask',
|
|
128
|
+
} as const
|
|
129
|
+
|
|
130
|
+
/** Bounds main checks again (A2.14 #19): unknown fields are stripped, a known one of the wrong type or past its bound refuses the message. */
|
|
131
|
+
export const BOUNDS = {
|
|
132
|
+
version: 32,
|
|
133
|
+
versionChars: /^[0-9A-Za-z.+-]+$/,
|
|
134
|
+
board: 128,
|
|
135
|
+
page: /^[A-Za-z0-9_-]{8,64}$/,
|
|
136
|
+
doc: /^[A-Za-z0-9_-]{16,64}$/,
|
|
137
|
+
menuItems: 40,
|
|
138
|
+
menuId: /^[a-z][a-z0-9-]{0,31}$/,
|
|
139
|
+
label: 48,
|
|
140
|
+
hint: 8,
|
|
141
|
+
/** A3.8 #27: an epoch is an integer 0..epoch; a presentation viewport's sides are 0..viewport CSS px; `frames` 1..frames */
|
|
142
|
+
epoch: 2 ** 31 - 1,
|
|
143
|
+
viewport: 20_000,
|
|
144
|
+
frames: 8,
|
|
145
|
+
} as const
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* `mv:perf`'s bounds, checked by the bridge (A3.8 #10): unknown fields are stripped and a value past its bound
|
|
149
|
+
* refuses the message; past `perSecond` a second per webContents (a token bucket holding `burst`) a message is
|
|
150
|
+
* dropped and counted. Main's asks keep the same bounds.
|
|
151
|
+
*/
|
|
152
|
+
export const PERF_BOUNDS = {
|
|
153
|
+
/** tick and seq: integers 0..counter */
|
|
154
|
+
counter: 2 ** 31 - 1,
|
|
155
|
+
points: 32,
|
|
156
|
+
coord: 20_000,
|
|
157
|
+
kb: 1e9,
|
|
158
|
+
frames: 1_000_000,
|
|
159
|
+
hz: { min: 1, max: 1000 },
|
|
160
|
+
perSecond: 30,
|
|
161
|
+
burst: 64,
|
|
162
|
+
} as const
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* `window.marverApp`, exposed by the canvas preload to verified local canvases. Typed methods only: a page never
|
|
166
|
+
* names a channel. The six methods of 0.1 are required (marver-app.ts checks them); every A3 one is optional.
|
|
167
|
+
*/
|
|
168
|
+
export interface MarverAppV1 {
|
|
169
|
+
readonly v: 1
|
|
170
|
+
/**
|
|
171
|
+
* 0 in app 0.1; 0 or 44 from app 0.2: the inset this document must apply, for its whole life (`mv:doc`'s
|
|
172
|
+
* answer). A shell applies 44 only when `onPresent` and `presented` exist too (inset.ts, A3.8 #31).
|
|
173
|
+
*/
|
|
174
|
+
readonly topInset: Inset
|
|
175
|
+
/** the app reloaded this tab after a crash, or reopens it after an unload: restore the saved camera even when the link names a selection (A2.9, A3.8 #43) */
|
|
176
|
+
readonly reopen: boolean
|
|
177
|
+
hello(p: Hello): void
|
|
178
|
+
theme(p: Theme): void
|
|
179
|
+
busy(p: Busy): void
|
|
180
|
+
menu(items: MenuItem[]): void
|
|
181
|
+
onAppState(fn: (s: AppState) => void): () => void
|
|
182
|
+
onMenuClick(fn: (p: MenuClick) => void): () => void
|
|
183
|
+
/** A3 (app 0.2): main's presentation requests for this document */
|
|
184
|
+
onPresent?(fn: (r: Present) => void): () => void
|
|
185
|
+
/** A3 (app 0.2): the answer to a presentation request, sent at once */
|
|
186
|
+
presented?(p: Presented): void
|
|
187
|
+
/** A3 (app 0.2): a recorder message (gesture, probes, board); the preload sends mem and shown itself */
|
|
188
|
+
perf?(p: PerfMsg): void
|
|
189
|
+
/** A3 (app 0.2): main's probe asks (the white-out detector, A3.8 #16) */
|
|
190
|
+
onPerfAsk?(fn: (a: PerfProbeAsk) => void): () => void
|
|
191
|
+
/** A3 (app 0.2): the display's refresh rate from main's `display` ask, null until one came; the shell puts it on its gesture records */
|
|
192
|
+
perfInfo?(): { hz: number | null }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Main's words for a reason (the hang sheet, the unsaved pill); `heights` is never named (A2.14 #18). */
|
|
196
|
+
export const WHY_WORDS: Record<Why, string | null> = {
|
|
197
|
+
'capture-recording': 'a capture being recorded',
|
|
198
|
+
'capture-unsent': 'a capture not yet sent',
|
|
199
|
+
'board-unsaved': 'edits not yet saved',
|
|
200
|
+
heights: null,
|
|
201
|
+
typing: 'words not yet sent',
|
|
202
|
+
'jam-session': 'a Jam session',
|
|
203
|
+
microphone: 'the microphone',
|
|
204
|
+
agent: 'an agent at work',
|
|
205
|
+
}
|