@marver-design/marver 0.31.0 → 0.33.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -2
  3. package/dist/{anchor-check-B92s9tVv.mjs → anchor-check-KCe6WeRA.mjs} +1 -1
  4. package/dist/{boards-OlAhZ87x.mjs → boards-jHmEPLV7.mjs} +1 -1
  5. package/dist/{build-BNssmbqd.mjs → build-4-k2XhhX.mjs} +3 -3
  6. package/dist/cli.mjs +12 -12
  7. package/dist/{comment-actions-Bxf9Ld4g.mjs → comment-actions-BCBcd-Wq.mjs} +12 -5
  8. package/dist/{comments-BakJQwaf.mjs → comments-C2SN1QdM.mjs} +4 -4
  9. package/dist/{daemon-MxoEQajX.mjs → daemon-CCDgagw2.mjs} +49 -8
  10. package/dist/{dev-BBZe_brH.mjs → dev-CJf5upVK.mjs} +9 -9
  11. package/dist/{link-Cmt9Xy4X.mjs → link-aZq5cExV.mjs} +1 -1
  12. package/dist/{pdf-CZENT6t3.mjs → pdf-GGya_nI6.mjs} +3 -3
  13. package/dist/{pdf-0m721FFn.mjs → pdf-HB0prF75.mjs} +1 -1
  14. package/dist/{perf-CIMijND6.mjs → perf-9ZEF5KLO.mjs} +2 -2
  15. package/dist/{perf-BB0XNt1M.mjs → perf-BA_NDarr.mjs} +1 -0
  16. package/dist/{plugin-CL8_wL7a.mjs → plugin-Cm74UDfp.mjs} +128 -47
  17. package/dist/{poster-B7uSjlEP.mjs → poster-BnuT9UyW.mjs} +1 -1
  18. package/dist/{publish-bakes-BjgDNeyS.mjs → publish-bakes-zHmPEOB5.mjs} +2 -2
  19. package/dist/{recover-ByuFQOF9.mjs → recover-BpRQxBA7.mjs} +1 -1
  20. package/dist/{shot-D2TQGo2V.mjs → shot-BuUCG46-.mjs} +1 -1
  21. package/dist/{shot-BqwkdtKn.mjs → shot-HZtclbOT.mjs} +3 -3
  22. package/dist/{show-B1u3DiJw.mjs → show-DhmiUu01.mjs} +2 -2
  23. package/dist/{work-Nv-n2_Un.mjs → work-B4tydWnf.mjs} +37 -1
  24. package/dist/{work-DRdzXPvg.mjs → work-CzIXp7n1.mjs} +3 -3
  25. package/docs/app.md +120 -21
  26. package/docs/boards-and-folders.md +10 -5
  27. package/docs/slides.md +2 -1
  28. package/package.json +1 -1
  29. package/src/client/shell/App.tsx +5 -1
  30. package/src/client/shell/Play.tsx +80 -5
  31. package/src/client/shell/app-bridge.ts +8 -0
  32. package/src/client/shell/immersive.ts +123 -0
  33. package/src/client/shell/inset.ts +29 -3
  34. package/src/client/shell/marks-ui.tsx +2 -2
  35. package/src/client/shell/recorder-signals.ts +5 -2
  36. package/src/client/shell/styles.css +25 -6
  37. package/src/shared/app-api.ts +41 -0
  38. package/src/shared/immersive.ts +13 -0
  39. package/src/shared/perf-records.ts +1 -1
@@ -10,6 +10,12 @@
10
10
  * FROZEN before the A3 streams split (A3.8 #53): `TOP`, `VISIBLE_TOP`, `usable()`, `onScreen()` and `applyInset()`.
11
11
  * Consumers: the top-anchored layers, the selection bar, tips and menus (`TOP + 8`), insets(), focus, play sizes
12
12
  * and Jam's fill use `usable()`; seen marks, visibleNodes(), A3.3's probes and A4.3's full-view test use `onScreen()`.
13
+ *
14
+ * Amended in writing for spec 32 (C3, F3; Nic, gaps.md 3, 29): `TOP`, `VISIBLE_TOP`, `onScreen()` and `applyInset()`
15
+ * keep their contract, and so does `--mv-top`. Only `usable()` is dynamic, and only in immersive play: once main grants
16
+ * it, `setImmersiveTop(true)` drops the play inset to 0, which `usable()`, `onTopChange` listeners and `--mv-play-top`
17
+ * (read by `.sh-play` alone) follow; every other `var(--mv-top)` consumer keeps 44. Until immersive play is wired
18
+ * (spec 32 W4) nothing calls it, so `usable()` answers `TOP` as before.
13
19
  */
14
20
  import { EDGE_FADE, TOP_INSET, type Inset } from '../../shared/app-api.ts'
15
21
  import { APP } from './marver-app.ts'
@@ -23,12 +29,32 @@ export const VISIBLE_TOP = TOP ? TOP + EDGE_FADE : 0
23
29
  export function applyInset(): void {
24
30
  if (!TOP) return
25
31
  document.documentElement.style.setProperty('--mv-top', `${TOP}px`)
32
+ // spec 32 C3: the play inset, `TOP` until immersive play drops it (`setImmersiveTop`)
33
+ document.documentElement.style.setProperty('--mv-play-top', `${TOP}px`)
26
34
  document.documentElement.classList.add('mv-inset')
27
35
  }
28
36
 
29
- /** The view below the strip, in client px. */
37
+ /** spec 32 C3: the play inset now - `TOP`, or 0 while main has granted immersive play. */
38
+ let topNow: Inset = TOP
39
+ const topListeners = new Set<() => void>()
40
+ /**
41
+ * spec 32 C3: immersive play (granted by main) drops the play inset to 0; only `usable()` and `--mv-play-top` follow it.
42
+ * A no-op without the inset (`TOP` 0: Chrome, a published canvas, app 0.1): both values are then 0.
43
+ */
44
+ export function setImmersiveTop(on: boolean): void {
45
+ const next: Inset = on ? 0 : TOP
46
+ if (next === topNow) return
47
+ topNow = next
48
+ document.documentElement.style.setProperty('--mv-play-top', `${next}px`)
49
+ document.documentElement.classList.toggle('mv-immersive', on)
50
+ for (const f of [...topListeners]) { try { f() } catch (err) { console.error(err) } }
51
+ }
52
+ /** spec 32 C3: told when `setImmersiveTop` changes the play inset; answers what unsubscribes. */
53
+ export const onTopChange = (f: () => void): (() => void) => { topListeners.add(f); return () => { topListeners.delete(f) } }
54
+
55
+ /** The view below the strip, in client px: below `TOP`, or the whole view while immersive (spec 32 C3). */
30
56
  export function usable(): { top: number; left: number; width: number; height: number } {
31
- return { top: TOP, left: 0, width: innerWidth, height: Math.max(0, innerHeight - TOP) }
57
+ return { top: topNow, left: 0, width: innerWidth, height: Math.max(0, innerHeight - topNow) }
32
58
  }
33
59
 
34
60
  /** The part of a client rect on screen below the scroll edge, or null when none is. */
@@ -41,4 +67,4 @@ export function onScreen(r: DOMRectReadOnly): DOMRect | null {
41
67
  }
42
68
 
43
69
  // dev-only inspection hook for tests (never installed in published builds)
44
- if (typeof window !== 'undefined' && (import.meta as { env?: { DEV?: boolean } }).env?.DEV) (window as unknown as { __mvInset: unknown }).__mvInset = { TOP, VISIBLE_TOP, usable, onScreen }
70
+ if (typeof window !== 'undefined' && (import.meta as { env?: { DEV?: boolean } }).env?.DEV) (window as unknown as { __mvInset: unknown }).__mvInset = { TOP, VISIBLE_TOP, usable, onScreen, setImmersiveTop, onTopChange }
@@ -22,8 +22,8 @@ export function markSeenFrom(how: CmdOpts, frames: string[]): void {
22
22
  s.markSeen(frames)
23
23
  }
24
24
 
25
- /** A resolve-all scope (spec 31 B.1): what you see - a board, a folder, a scene, or the whole canvas (the app's tab). */
26
- export type ResolveScope = { board: string } | { folder: string } | { scene: string } | { canvas: true }
25
+ /** A resolve-all scope (spec 31 B.1): what you see - a board, a folder, a scene, one frame (0.33), or the whole canvas (the app's tab). */
26
+ export type ResolveScope = { board: string } | { folder: string } | { scene: string } | { frame: string } | { canvas: true }
27
27
 
28
28
  /** One POST to the dev server's comment actions, tried once more with the same op on no answer (a retry returns the
29
29
  * same receipt). */
@@ -27,6 +27,7 @@ import { hooked, perfSeams, type Answered } from './recorder-seams.ts'
27
27
  import { addRow, createRate, foldRows, nodesIn, normRoute, p50, topWarnings } from './recorder-signals-core.ts'
28
28
  import { useStore } from './store.ts'
29
29
  import { isHideUI, onHideUI } from './Toolbar.tsx'
30
+ import { isGranted, onImmersiveChange } from './immersive.ts'
30
31
 
31
32
  type State = ReturnType<typeof useStore.getState>
32
33
 
@@ -158,7 +159,7 @@ type Shown = 'cohort' | 'first-frame' | 'two-frames'
158
159
  const SHOWN: Record<ModeName, Shown> = {
159
160
  laser: 'cohort', inspect: 'cohort', comments: 'cohort',
160
161
  play: 'first-frame', slides: 'first-frame',
161
- interact: 'two-frames', 'hide-ui': 'two-frames', 'jam-session': 'two-frames', 'jam-capture': 'two-frames', 'jam-review': 'two-frames', 'jam-lane': 'two-frames',
162
+ interact: 'two-frames', 'hide-ui': 'two-frames', immersive: 'two-frames', 'jam-session': 'two-frames', 'jam-capture': 'two-frames', 'jam-review': 'two-frames', 'jam-lane': 'two-frames',
162
163
  }
163
164
  /** The first frame of a stage is a cold boot: the command's own deadline (`play`, `slides`: 30 s), not a toggle's 5 s - a
164
165
  * slow first frame is the answer that record exists for. */
@@ -455,7 +456,7 @@ export function startSignals(): void {
455
456
 
456
457
  // what is on already counts from here, with no enter record of its own
457
458
  const s0 = useStore.getState()
458
- const held = { ...canvasModes(s0), comments: useComments.getState().commentMode, 'hide-ui': isHideUI(), 'jam-session': !!useJamQueue.getState().session, 'jam-capture': !!useJamCapture.getState().current, ...reviewModes() }
459
+ const held = { ...canvasModes(s0), comments: useComments.getState().commentMode, 'hide-ui': isHideUI(), immersive: isGranted(), 'jam-session': !!useJamQueue.getState().session, 'jam-capture': !!useJamCapture.getState().current, ...reviewModes() }
459
460
  for (const k of Object.keys(held) as ModeName[]) if (held[k]) modes.set(k, { since: now(), errors: 0 })
460
461
 
461
462
  // #21, #26: the `t` a message to a document carries
@@ -471,6 +472,8 @@ export function startSignals(): void {
471
472
  useJamCapture.subscribe(hooked('mode', (s: { current: string | null }, p: { current: string | null }) => { if (s.current !== p.current) setModes({ 'jam-capture': !!s.current }) }))
472
473
  useJamUi.subscribe(hooked('mode', () => setModes(reviewModes())))
473
474
  onHideUI(hooked('mode', () => setModes({ 'hide-ui': isHideUI() })))
475
+ // spec 32 C11: immersive play, held while main's grant stands (immersive.ts `granted`)
476
+ onImmersiveChange(hooked('mode', () => setModes({ immersive: isGranted() })))
474
477
 
475
478
  perfSeams.frameMessage.on(hooked(null, onFrameMessage))
476
479
  perfSeams.stageMessage.on(hooked(null, onStageMessage))
@@ -792,8 +792,13 @@ body.sh-space .sh-node { pointer-events: none } /* space-drag
792
792
 
793
793
  /* ---- Play mode: near-black stage, one centered device, auto-hiding bar.
794
794
  Fixed dark palette - the backdrop never follows the board theme, so no tokens here. */
795
- .sh-play { position: absolute; inset: 0; z-index: 30; background: #0a0a0b; display: flex; padding-top: var(--mv-top, 0px);
796
- align-items: center; justify-content: center; animation: sh-play-in .28s ease-out; cursor: auto }
795
+ .sh-play { position: absolute; inset: 0; z-index: 30; background: #0a0a0b; display: flex; padding-top: var(--mv-play-top, var(--mv-top, 0px));
796
+ align-items: center; justify-content: center; animation: sh-play-in .28s ease-out; cursor: auto;
797
+ /* spec 32 C5.1 (MOTION, src/shared/immersive.ts): the play inset goes in 320 ms and comes back in 300 ms */
798
+ transition: padding-top 300ms cubic-bezier(.2, .8, .2, 1) }
799
+ :root.mv-immersive .sh-play { transition: padding-top 320ms cubic-bezier(.2, .8, .2, 1) }
800
+ /* spec 32 C5.2: while the stage FLIPs, the device's own size transition holds off - one animation resizes it */
801
+ .sh-play.flip .dev { transition: none }
797
802
  @keyframes sh-play-in { from { opacity: 0 } }
798
803
  /* the device wears the frame-node card language: same theme border tokens, the same
799
804
  masked 1px edge-light gradient ring (glass catching light), and a real drop shadow
@@ -951,15 +956,29 @@ body.sh-kbd .sh-app :focus-visible { outline: 2px solid var(--accent); outline-o
951
956
  /* Hide-UI: one binary body class (canvas + prototype) drops all operating chrome. Not
952
957
  persisted - a page refresh always restores it. Comment pins/threads (the review
953
958
  annotations) stay; only the marver chrome hides, for a clean point-and-shoot frame. */
954
- body.sh-hide-ui .sh-pill,
955
- body.sh-hide-ui .sh-pill-fab,
959
+ body.sh-hide-ui .sh-pill:not(.sh-play-pill),
960
+ body.sh-hide-ui .sh-pill-fab:not(.sh-play *),
956
961
  body.sh-hide-ui .sh-panel,
957
962
  body.sh-hide-ui .sh-fab,
958
963
  body.sh-hide-ui .sh-ctx,
959
964
  body.sh-hide-ui .sh-update,
960
965
  body.sh-hide-ui .sh-toasts,
961
- body.sh-hide-ui .sh-banner:not(.sh-stopped), /* a stopped canvas stays said: the page holds what only it has */
962
- body.sh-hide-ui .sh-play-nav { display: none !important }
966
+ body.sh-hide-ui .sh-banner:not(.sh-stopped) { display: none !important } /* a stopped canvas stays said: the page holds what only it has */
967
+
968
+ /* spec 32 C5.3 (MOTION.out.pills 160 ms, MOTION.back.pills 200 ms): in play the pills, their fab, the navigator and the
969
+ minimal deck's progress strip fade instead of vanishing - out up (the pills) or down (the nav, the strip), then
970
+ hidden from the pointer and from view; back at once into view, then up to full.
971
+ The pills' 6 px goes on `translate`, so `transform` keeps the pill/fab morph (`.closed`, `.hidden`) and its --morph time
972
+ while the fade's own move takes MOTION's 160 ms out and 200 ms back, ease. */
973
+ .sh-play .sh-play-pill, .sh-play .sh-pill-fab { transition: opacity 200ms ease, translate 200ms ease, transform var(--morph), visibility 0s }
974
+ .sh-play-nav, .sh-slides-strip { transition: opacity 200ms ease, transform 200ms ease, visibility 0s }
975
+ body.sh-hide-ui .sh-play .sh-play-pill, body.sh-hide-ui .sh-play .sh-pill-fab, body.sh-hide-ui .sh-play-nav, body.sh-hide-ui .sh-slides-strip {
976
+ opacity: 0; pointer-events: none; visibility: hidden;
977
+ transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms }
978
+ body.sh-hide-ui .sh-play .sh-play-pill, body.sh-hide-ui .sh-play .sh-pill-fab {
979
+ translate: 0 -6px; transition: opacity 160ms ease, translate 160ms ease, transform var(--morph), visibility 0s linear 160ms }
980
+ body.sh-hide-ui .sh-play-nav { transform: translateY(6px) }
981
+ body.sh-hide-ui .sh-slides-strip { transform: translateX(-50%) translateY(6px) }
963
982
 
964
983
  /* the prototype pill reuses the shared pill LAYOUT but wears the discreet DARK skin of the
965
984
  bottom-left navigator (not the bright canvas glass), so it recedes into the near-black
@@ -24,6 +24,12 @@
24
24
  * three white-out windows a shell asks for (R8 #38), sent only when `perfInfo().watch` is true - app 1.0.0 would refuse
25
25
  * it and spend the tab's bucket; and `mv:menu-click`'s `in`, the menu a relayed item came from (#51), absent from 1.0.0
26
26
  * (the shell then records `in: 'app'`). Owners: app-store (`watch`, `perfInfo().watch`), commands (`in`).
27
+ *
28
+ * Spec 32 (app 1.2, marver 0.32.0) amends it in writing (F2, F3b #1), frozen before its streams split and `v` still 1,
29
+ * no new FEATURE name: `mv:immersive` / `mv:immersive-state`, immersive play's wish and main's answer (C2), with the
30
+ * optional `MarverAppV1.immersive` and `onImmersive` (a shell gates on the method); and two optional `LiveEvent` fields,
31
+ * `work` and `titles` (unknown fields are stripped, so a 0.31 app ignores them), the titles bounded by the new
32
+ * `LIVE_TITLES_MAX`. `LIVE_KINDS`, `LIVE_BOUNDS` and `LIVE_WIRE` are unchanged.
27
33
  */
28
34
 
29
35
  export const APP_API_VERSION = 1
@@ -166,6 +172,10 @@ export const CANVAS_CHANNELS = {
166
172
  front: 'mv:front',
167
173
  /** app 1.1 (spec 31): a finished deck PDF saved where the person says - an invoke carrying only the job id */
168
174
  exportPdf: 'mv:export-pdf',
175
+ /** spec 32 C2: immersive play's wish (canvas to main, a held whole-state report like `theme`: `ImmersiveWish`) */
176
+ immersive: 'mv:immersive',
177
+ /** spec 32 C2: main's answer to the wish (main to canvas, `{ doc, ...ImmersiveAnswer }`) */
178
+ immersiveState: 'mv:immersive-state',
169
179
  } as const
170
180
 
171
181
  /** 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. */
@@ -294,6 +304,15 @@ export interface LiveEvent {
294
304
  working: boolean
295
305
  /** a Jam session runs (`!!view.session`) */
296
306
  session: boolean
307
+ /**
308
+ * spec 32 F2 (0.32.0, optional): since when something has been at work - `marver work`'s CLI leases and the Jam runs
309
+ * the snapshot counts as working - and on which board (the newest working Jam card's, else the first board pinning a
310
+ * `marver work` frame). Absent when nothing works, and from a 0.31 server
311
+ */
312
+ work?: { board?: string; since: number }
313
+ /** spec 32 F2 (0.32.0, optional): the titles of the boards `items` and `work` name, at most `LIVE_TITLES_MAX` keys,
314
+ * each key a ref (at most `LIVE_BOUNDS.ref`) and each value at most `LIVE_BOUNDS.title` */
315
+ titles?: Record<string, string>
297
316
  }
298
317
 
299
318
  /**
@@ -311,6 +330,8 @@ export const LIVE_BOUNDS = {
311
330
  eventBytes: 65_536,
312
331
  id: /^(ask|review|failed|stalled):[0-9a-f]{20}$/,
313
332
  } as const
333
+ /** spec 32 F2: `LiveEvent.titles` has at most this many keys. A constant of its own: `LIVE_BOUNDS` is frozen (A4.6 #11). */
334
+ export const LIVE_TITLES_MAX = 32
314
335
 
315
336
  /**
316
337
  * The live stream's wire (A4.6 #5, #6, #14). `GET <origin><path>` with `x-mv-ws`, a fresh `x-mv-nonce` and
@@ -356,6 +377,19 @@ export type CaptureWhy = (typeof CAPTURE_WHY)[number]
356
377
  * size in device pixels, its long side at most `BOUNDS.captureLong`. */
357
378
  export type CaptureAnswer = { ok: true; png: Uint8Array; width: number; height: number } | { ok: false; why: CaptureWhy }
358
379
 
380
+ /**
381
+ * Spec 32 C2: `mv:immersive` (canvas to main; on the wire `{ doc, p }`) - the shell's wish that immersive play hide the
382
+ * strip, a whole state held and replayed after `menu`. `n` is the preload's, counting from 1 for each document; the
383
+ * shell never sees it. The bridge takes `on` a boolean and `n` an integer 1..2^31, unknown fields stripped.
384
+ */
385
+ export interface ImmersiveWish { on: boolean; n: number }
386
+ /**
387
+ * Spec 32 C2: `mv:immersive-state` (main to canvas; on the wire `{ doc, ...ImmersiveAnswer }`) - main's answer to the
388
+ * wish `n`. `on: true`: the strip is hidden, drop the inset; `on: false`: keep or restore the 44 px inset, Hide UI as it
389
+ * is; `end: true`: main took immersive away for this document (restore the inset, and turn Hide UI off if play is on).
390
+ */
391
+ export interface ImmersiveAnswer { n: number; on: boolean; end?: true }
392
+
359
393
  /** A deck PDF job's id (src/server/pdf.ts JOB_ID): 128 random bits, base64url. */
360
394
  export const PDF_JOB = /^[A-Za-z0-9_-]{22}$/
361
395
  /** The largest PDF main fetches and writes (spec 31: 200 MB). */
@@ -425,6 +459,13 @@ export interface MarverAppV1 {
425
459
  * canvas origin, shows the save panel, checks the document again, and writes the file where the panel says
426
460
  */
427
461
  exportPdf?(a: ExportPdfAsk): Promise<ExportPdfAnswer>
462
+ /**
463
+ * spec 32 C2 (app 1.2): the shell's wish for immersive play, sent on every change (the preload stamps it with `n`,
464
+ * holds it and replays it at an admit). What the shell shows follows `onImmersive`'s answer, never the wish
465
+ */
466
+ immersive?(p: { on: boolean }): void
467
+ /** spec 32 C2 (app 1.2): main's answer to the latest wish, for this document alone; an answer to an older wish is dropped */
468
+ onImmersive?(fn: (s: { on: boolean; end?: boolean }) => void): () => void
428
469
  }
429
470
 
430
471
  import type { ShowTarget } from './deep-link.ts'
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Spec 32 C2, C5, C9, C10: immersive play's motion, one set of numbers for the shell (the stage's padding and FLIP, the
3
+ * pills' fade), main (the strip's hide timer, `MOTION.out.strip`) and the strip's CSS (its transform and opacity, which a
4
+ * unit test checks against these). Copied from the design (tab-strip/_immersive.tsx `MOTION`). Constants only - no
5
+ * imports - so the app's main bundle and the shell both take it as it is.
6
+ */
7
+ export const MOTION = {
8
+ /** shown to hidden: the strip leaves, the pills fade, the stage grows into the room */
9
+ out: { strip: 240, pills: 160, stage: 320, ease: 'cubic-bezier(.4, 0, .9, .6)', stageEase: 'cubic-bezier(.2, .8, .2, 1)' },
10
+ /** hidden to shown */
11
+ back: { strip: 260, pills: 200, stage: 300, ease: 'cubic-bezier(.15, .7, .2, 1)', stageEase: 'cubic-bezier(.2, .8, .2, 1)' },
12
+ } as const
13
+ export type Motion = typeof MOTION
@@ -208,7 +208,7 @@ export interface ThemeBody {
208
208
  }
209
209
 
210
210
  /** #24: a state that changes what input does until left. */
211
- export const MODES = ['laser', 'inspect', 'comments', 'interact', 'play', 'slides', 'hide-ui', 'jam-session', 'jam-capture', 'jam-review', 'jam-lane'] as const
211
+ export const MODES = ['laser', 'inspect', 'comments', 'interact', 'play', 'slides', 'hide-ui', 'immersive', 'jam-session', 'jam-capture', 'jam-review', 'jam-lane'] as const
212
212
  export type ModeName = (typeof MODES)[number]
213
213
  /** #25, #26: `enter` carries the shown fields, `exit` the held ones. */
214
214
  export interface ModeBody {