@neta-art/cohub-cli 10.29.0 → 10.31.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 (87) hide show
  1. package/dist/board-gpu/page.js +3011 -133
  2. package/dist/bootstrap.js +2 -4
  3. package/dist/build.json +1 -1
  4. package/dist/chunks/FilterPipe.js +145 -269
  5. package/dist/chunks/about.js +2 -3
  6. package/dist/chunks/app-realtime.js +113 -115
  7. package/dist/chunks/app-realtime2.js +1 -2
  8. package/dist/chunks/app-ref.js +4 -5
  9. package/dist/chunks/apps.js +8 -14
  10. package/dist/chunks/auth.js +1 -2
  11. package/dist/chunks/avatar.js +2 -4
  12. package/dist/chunks/binary-pins.js +1 -2
  13. package/dist/chunks/board-export-resources.js +55 -12
  14. package/dist/chunks/board-export.js +26 -21
  15. package/dist/chunks/board-export2.js +1 -2
  16. package/dist/chunks/board-kernel.js +2672 -1623
  17. package/dist/chunks/board-kernel2.js +2 -2
  18. package/dist/chunks/board-model.js +970 -0
  19. package/dist/chunks/board-profile.js +4 -5
  20. package/dist/chunks/board-simulate.js +6 -6
  21. package/dist/chunks/board-time.js +1 -2
  22. package/dist/chunks/boards.js +547 -23
  23. package/dist/chunks/browserAll.js +18 -35
  24. package/dist/chunks/channels.js +1 -2
  25. package/dist/chunks/client.js +637 -713
  26. package/dist/chunks/command-input.js +1 -2
  27. package/dist/chunks/commander.js +16 -22
  28. package/dist/chunks/cron-jobs.js +2 -3
  29. package/dist/chunks/daemon.js +18 -4
  30. package/dist/chunks/daemon2.js +1 -2
  31. package/dist/chunks/desktop.js +2 -3
  32. package/dist/chunks/endpoint-options.js +1 -2
  33. package/dist/chunks/env-proxy.js +4 -5
  34. package/dist/chunks/environment.js +2 -4
  35. package/dist/chunks/feedback.js +3 -4
  36. package/dist/chunks/generations.js +3 -4
  37. package/dist/chunks/host.js +1 -2
  38. package/dist/chunks/http-put.js +1 -2
  39. package/dist/chunks/id.js +77 -928
  40. package/dist/chunks/init.js +7 -12
  41. package/dist/chunks/install.js +142 -138
  42. package/dist/chunks/launch.js +4 -6
  43. package/dist/chunks/lexer.js +226 -66
  44. package/dist/chunks/local-media.js +1 -2
  45. package/dist/chunks/me.js +1 -2
  46. package/dist/chunks/media.js +1 -2
  47. package/dist/chunks/{themes.js → model-clips.js} +395 -43
  48. package/dist/chunks/models.js +3 -5
  49. package/dist/chunks/operands.js +1 -2
  50. package/dist/chunks/package-paths.js +1 -2
  51. package/dist/chunks/policy.js +1 -2
  52. package/dist/chunks/preferences.js +1 -2
  53. package/dist/chunks/profile.js +2 -3
  54. package/dist/chunks/prompts.js +1 -2
  55. package/dist/chunks/public.js +1 -2
  56. package/dist/chunks/public2.js +3 -4
  57. package/dist/chunks/references.js +3 -3
  58. package/dist/chunks/referrals.js +1 -2
  59. package/dist/chunks/rolldown-runtime.js +2 -3
  60. package/dist/chunks/rooms-connect.js +1 -2
  61. package/dist/chunks/rooms-connect2.js +1 -2
  62. package/dist/chunks/rooms-rtc.js +4 -6
  63. package/dist/chunks/rooms.js +2 -3
  64. package/dist/chunks/run.js +2 -3
  65. package/dist/chunks/runtime.js +6 -12
  66. package/dist/chunks/runtime2.js +2 -3
  67. package/dist/chunks/runtimes.js +1 -2
  68. package/dist/chunks/safe-remote-image.js +1 -2
  69. package/dist/chunks/schemas.js +58 -43
  70. package/dist/chunks/search.js +3 -3
  71. package/dist/chunks/self-update.js +4 -5
  72. package/dist/chunks/serve.js +11 -25
  73. package/dist/chunks/session-status.js +1 -2
  74. package/dist/chunks/skills.js +1 -2
  75. package/dist/chunks/spaces.js +26 -45
  76. package/dist/chunks/src.js +5 -9
  77. package/dist/chunks/supervisor.js +16 -28
  78. package/dist/chunks/supervisor2.js +1 -2
  79. package/dist/chunks/tasks.js +1 -2
  80. package/dist/chunks/user-lists.js +1 -2
  81. package/dist/chunks/version.js +1 -2
  82. package/dist/chunks/version2.js +1 -2
  83. package/dist/chunks/version3.js +3 -4
  84. package/dist/chunks/web.js +1 -2
  85. package/dist/runtime/native/pi-extension.js +1 -2
  86. package/dist/runtime/worker.js +2 -3
  87. package/package.json +11 -10
@@ -1,14 +1,15 @@
1
1
  import { m as record, p as object, x as toJSONSchema } from "./schemas.js";
2
- import { C as error, D as json, E as handleHttp, O as jsonRequested, b as resolveSpace, j as table, k as ok, r as createRealtimeClient, t as createClient } from "./client.js";
3
- import { $ as BoardAnimationHeaderSchema, G as BOARD_COLOR_TOKENS, K as BOARD_EFFECT_KINDS, W as BOARD_CAMERA_TARGET, X as BOARD_ITEM_TYPES, Y as BOARD_ITEM_SCHEMAS, at as BoardSettingsSchema, f as listBoardProperties, g as resolveBoardProperty, gt as BOARD_DEFAULT_SIZES, it as BoardScriptSchema, lt as isBuiltinItemType, ot as BoardTrackSchema, q as BOARD_EFFECT_KIND_INFO, rt as BoardKeySchema, tt as BoardExtensionItemSchema, xt as BOARD_TEXT_SCALE, yt as BOARD_PAGE_SIZE } from "./id.js";
4
- import { C as createBoardAnimationSampler, F as BOARD_SCRIPT_RAIN_EXAMPLE, I as BOARD_SCRIPT_SENSES_EXAMPLE, L as BOARD_SCRIPT_SPARKS_EXAMPLE, P as BOARD_SCRIPT_DRAWING_EXAMPLE, R as BOARD_SCRIPT_TILT_EXAMPLE, T as buildBoardScene, c as boardPathTrack, d as boardSequencePatch, i as boardFrameRegions, l as boardPlacePatch, n as BOARD_THEME_IDS, s as boardRegionStep } from "./themes.js";
2
+ import { B as BOARD_PAGE_SIZE, H as BOARD_TEXT_SCALE, L as BOARD_DEFAULT_SIZES, T as isBuiltinItemType, _ as BoardScriptSchema, f as BoardDepthSchema, h as BoardKeySchema, i as BOARD_EFFECT_KIND_INFO, n as BOARD_COLOR_TOKENS, o as BOARD_ITEM_SCHEMAS, p as BoardExtensionItemSchema, r as BOARD_EFFECT_KINDS, s as BOARD_ITEM_TYPES, t as BOARD_CAMERA_TARGET, u as BoardAnimationHeaderSchema, v as BoardSettingsSchema, y as BoardTrackSchema } from "./board-model.js";
3
+ import { f as listBoardProperties, g as resolveBoardProperty } from "./id.js";
4
+ import { G as BOARD_SCRIPT_HANKY_EXAMPLE, J as BOARD_SCRIPT_SPARKS_EXAMPLE, K as BOARD_SCRIPT_RAIN_EXAMPLE, M as createBoardAnimationSampler, P as buildBoardScene, U as BOARD_SCRIPT_ARENA_EXAMPLE, W as BOARD_SCRIPT_DRAWING_EXAMPLE, Y as BOARD_SCRIPT_TILT_EXAMPLE, _ as boardPathTrack, b as boardSequencePatch, c as boardFrameRegions, d as boardRegionStep, o as BOARD_THEME_IDS, q as BOARD_SCRIPT_SENSES_EXAMPLE, v as boardPlacePatch } from "./model-clips.js";
5
5
  import { a as settleBoardMediaDurations, i as settleBoardDocument, o as settleBoardPatch, s as loadBoardDocument, t as BOARD_EXPORT_RENDERERS } from "./board-export-resources.js";
6
6
  import { n as parseBoardTime, r as parseBoardTimes, t as formatBoardTime } from "./board-time.js";
7
+ import { C as error, D as json, E as handleHttp, O as jsonRequested, b as resolveSpace, j as table, k as ok, r as createRealtimeClient, t as createClient } from "./client.js";
7
8
  import { constants, existsSync } from "node:fs";
8
9
  import { basename, dirname, join } from "node:path";
9
10
  import { randomUUID } from "node:crypto";
10
11
  import { access, link, mkdir, open, rename, unlink } from "node:fs/promises";
11
- //#region ../protocol/src/board-schema.ts
12
+ // ../protocol/dist/board-schema.js
12
13
  function toJsonSchema(schema) {
13
14
  const { $schema: _schema, ...rest } = toJSONSchema(schema, {
14
15
  io: "input",
@@ -22,9 +23,21 @@ const BOARD_SCHEMA_TARGETS = [
22
23
  "track",
23
24
  "script",
24
25
  "extension",
26
+ "depth",
25
27
  BOARD_CAMERA_TARGET,
26
28
  ...BOARD_ITEM_TYPES
27
29
  ];
30
+ const BOARD_DEPTH_GUIDE = {
31
+ camera: "Like a map: the eye looks at the middle of the view from 1.5 view heights away, so perspective reads the same on every screen and zoom. It looks straight down until camera pitch tips it toward the horizon (up to 60 degrees) and camera bearing turns it; both turn about the middle of the view.",
32
+ order: "Bend, then spin within the item's plane, tilt about its own axes through origin, rotation on the Board, then lift up off the Board.",
33
+ layers: "Flat items lie on the Board; a lifted item draws above them, with a soft shadow on the Board, and lifted items hide each other by distance. Depth inside a lifted frame stays part of its picture.",
34
+ models: "A model object stands on the Board leaning back toward the eye so it shows its cover view (props.model.view) from above; as the camera pitches it stands up, upright once pitch reaches 90 minus view.pitch. rotation and view.yaw turn it about its vertical axis. view.pitch 90 keeps it upright.",
35
+ attach: "attach { item, node } makes an item follow another's origin; on a model object, node rides one of its named nodes (props.snapshot.nodes) in 3D, and depth.lift raises it from there.",
36
+ editing: "Pointers act on what they touch in the lifted picture. Lifted items move but resize and turn once they lie flat again; arrows connect while flat. Editing levels a pitched or turned camera.",
37
+ animate: "Every number and vec2 animates by path (depth.lift, depth.tilt, depth.bend.phase); presets flip, lift, land, toss, sway, wave and curl write them. Scripts present depth with ctx.present.",
38
+ custom: "depth.bend.kind custom runs the bend GLSL the item's own script module exports: export const bend = { glsl }. See schema script.",
39
+ export: "Exports draw depth in local Chrome, like shaders; a whole-board export frames lifted items where they appear, and video frames keep the first frame's area unless --rect or --camera sets it. Camera exports keep its pitch and bearing."
40
+ };
28
41
  function boardJsonSchema(target) {
29
42
  if (target === "board") return { schema: toJsonSchema(BoardSettingsSchema) };
30
43
  if (target === "animation") return {
@@ -34,6 +47,11 @@ function boardJsonSchema(target) {
34
47
  if (target === "track") return { schema: toJsonSchema(BoardTrackSchema) };
35
48
  if (target === "script") return { schema: toJsonSchema(BoardScriptSchema) };
36
49
  if (target === "extension") return { schema: toJsonSchema(BoardExtensionItemSchema) };
50
+ if (target === "depth") return {
51
+ schema: toJsonSchema(BoardDepthSchema),
52
+ guide: BOARD_DEPTH_GUIDE,
53
+ properties: listBoardProperties("frame").filter(({ property }) => property.startsWith("depth."))
54
+ };
37
55
  if (target === "camera") {
38
56
  const properties = listBoardProperties(target);
39
57
  const fields = Object.fromEntries(properties.map(({ property }) => {
@@ -70,6 +88,7 @@ function boardSchemaOverview() {
70
88
  },
71
89
  types: BOARD_ITEM_TYPES,
72
90
  extensionTypes: "Namespaced types like acme.order keep props as written; give them a preview (title, excerpt, cover, src) so every client can show them. See schema extension.",
91
+ depth: "Any item's depth lifts it off the Board into perspective: lift, tilt, spin, bend (wave, cloth, curl or custom GLSL), shade, shadow and a back face. See schema depth.",
73
92
  colors: {
74
93
  tokens: BOARD_COLOR_TOKENS,
75
94
  css: "any CSS color",
@@ -82,8 +101,7 @@ function boardSchemaOverview() {
82
101
  ].map((target) => [target, listBoardProperties(target).map((entry) => entry.property)]))
83
102
  };
84
103
  }
85
- //#endregion
86
- //#region ../sdk/src/board/model/script-api.ts
104
+ // ../sdk/src/board/model/script-api.ts
87
105
  /**
88
106
  * A compact reference for Board script authors, printed by `cohub boards schema script`.
89
107
  * Each group is checked against its type, so a new member fails to compile until it is described.
@@ -101,7 +119,8 @@ const BOARD_SCRIPT_API = {
101
119
  pixelated: "true draws one canvas pixel per board unit and scales without smoothing, for crisp pixel art.",
102
120
  parameters: "Declares params as { name: { type: number | boolean | string | color, label?, default?, min?, max?, step? } }.",
103
121
  default: "Setup function (ctx) for behavior; may return a cleanup function.",
104
- shader: "GPU passes drawn with the owner: { layer?, inputs?, uniforms?, state?, passes: [{ glsl, sprites?, texel?, blend? }] }. See shader."
122
+ shader: "GPU passes drawn with the owner: { layer?, inputs?, uniforms?, state?, passes: [{ glsl, sprites?, texel?, blend? }] }. See shader.",
123
+ bend: "{ glsl } defining vec3 bend(vec2 uv, vec2 size, float amount, float phase): the offset in board units (x right, y down, z toward the viewer) of each point of the owner while depth.bend.kind is custom; uv runs 0–1 across the item, size is its box, amount and phase come from depth.bend. Same rules and includes as shader passes; drawn on the GPU, so hit tests and shadows use the surface before it bends."
105
124
  },
106
125
  frame: {
107
126
  t: "Clock time in milliseconds.",
@@ -127,7 +146,7 @@ const BOARD_SCRIPT_API = {
127
146
  onDispose: "onDispose(handler): cleanup when the instance stops.",
128
147
  invalidate: "invalidate(): redraw a non-animated draw().",
129
148
  get: "get(id): an item in scope, as authored.",
130
- present: "present(id, patch | null): temporarily override position, size, rotation, scale, opacity, style, props or z of an item in scope; never saved. Items that leave the scope drop their override.",
149
+ present: "present(id, patch | null): temporarily override position, size, rotation, scale, opacity, style, props, z or depth of an item in scope; never saved. Items that leave the scope drop their override. present(\"camera\", { focus, zoom, center, shake, pitch, bearing } | null) directs the camera as camera tracks do (focus an item id or rect, zoom in pixels per board unit on a 1600×900 framing, center a world point, shake in pixels, pitch 0–60 degrees toward the horizon, bearing degrees clockwise), over the animation camera: play and read-only views follow it until the viewer pans, and camera exports follow it; editing never does. A model's props.model takes animation, time, loop and fade, so a script can switch clips with a crossfade or drive one frame by frame.",
131
150
  scene: "scene(items, options?): replace this instance's world or screen layer of temporary Board items; never saved. IDs are unique across both layers.",
132
151
  hitRegions: "hitRegions(regions): replace the input declarations.",
133
152
  emit: "emit(id, type, data?): send a custom event to another scripted item in scope, or to any Board script by its key. Exports deliver it within the same moment, in document order. A handler may answer with emits; past 16 in a row the emit rejects, so emit from onFrame() to send on the next step.",
@@ -215,14 +234,13 @@ const BOARD_SCRIPT_API = {
215
234
  senses: "{ motion, gamepad, microphone, camera, location }: on delivers while a script listens; ask waits for a tap (motion on iOS) or the viewer's consent (microphone, camera, location); denied; unavailable on this device and in exports. Listening is what turns a source on and off."
216
235
  },
217
236
  view: {
218
- camera: "x, y and zoom.",
237
+ camera: "x, y and zoom of the level camera with the same middle, plus pitch and bearing in degrees when the camera tips or turns.",
219
238
  width: "Viewport width in screen pixels.",
220
239
  height: "Viewport height in screen pixels.",
221
240
  safeRect: "The viewport area not covered by editor chrome."
222
241
  }
223
242
  };
224
- //#endregion
225
- //#region ../sdk/src/board/model/presets.ts
243
+ // ../sdk/src/board/model/presets.ts
226
244
  const OUT = "cubic-bezier(0.22, 1, 0.36, 1)";
227
245
  const IN_OUT = "ease-in-out";
228
246
  const PRESETS = {
@@ -380,6 +398,175 @@ const PRESETS = {
380
398
  property: "rotation",
381
399
  keyframes: [[0, 0], [1, 360]]
382
400
  }]
401
+ },
402
+ flip: {
403
+ description: "Turn over about the vertical axis, rising as it turns; shows depth.back. Flip again to turn back.",
404
+ duration: 900,
405
+ ease: IN_OUT,
406
+ tracks: [{
407
+ property: "depth.tilt",
408
+ keyframes: [[0, {
409
+ x: 0,
410
+ y: 0
411
+ }], [1, {
412
+ x: 0,
413
+ y: 180
414
+ }]]
415
+ }, {
416
+ property: "depth.lift",
417
+ keyframes: [
418
+ [0, 0],
419
+ [.5, 60],
420
+ [1, 0]
421
+ ]
422
+ }]
423
+ },
424
+ lift: {
425
+ description: "Rise off the Board, leaning slightly, and stay up; land brings it back.",
426
+ duration: 500,
427
+ ease: OUT,
428
+ tracks: [{
429
+ property: "depth.lift",
430
+ keyframes: [[0, 0], [1, 60]]
431
+ }, {
432
+ property: "depth.tilt",
433
+ keyframes: [[0, {
434
+ x: 0,
435
+ y: 0
436
+ }], [1, {
437
+ x: 6,
438
+ y: -4
439
+ }]]
440
+ }]
441
+ },
442
+ land: {
443
+ description: "Settle back onto the Board after lift.",
444
+ duration: 450,
445
+ ease: "cubic-bezier(0.5, 0, 0.75, 0)",
446
+ tracks: [{
447
+ property: "depth.lift",
448
+ keyframes: [[0, 0], [1, -60]]
449
+ }, {
450
+ property: "depth.tilt",
451
+ keyframes: [[0, {
452
+ x: 0,
453
+ y: 0
454
+ }], [1, {
455
+ x: -6,
456
+ y: 4
457
+ }]]
458
+ }]
459
+ },
460
+ toss: {
461
+ description: "Toss up spinning like a handkerchief and drop back; size the height with --duration.",
462
+ duration: 2400,
463
+ ease: IN_OUT,
464
+ tracks: [
465
+ {
466
+ property: "depth.lift",
467
+ keyframes: [
468
+ [0, 0],
469
+ [.5, 280],
470
+ [1, 0]
471
+ ]
472
+ },
473
+ {
474
+ property: "depth.spin",
475
+ keyframes: [[0, 0], [1, 1080]],
476
+ ease: "cubic-bezier(0.2, 0.6, 0.35, 1)"
477
+ },
478
+ {
479
+ property: "depth.tilt",
480
+ keyframes: [
481
+ [0, {
482
+ x: 0,
483
+ y: 0
484
+ }],
485
+ [.5, {
486
+ x: 24,
487
+ y: 10
488
+ }],
489
+ [1, {
490
+ x: 0,
491
+ y: 0
492
+ }]
493
+ ]
494
+ },
495
+ {
496
+ property: "depth.bend.kind",
497
+ keyframes: [[0, "cloth"]]
498
+ },
499
+ {
500
+ property: "depth.bend.amount",
501
+ keyframes: [
502
+ [0, 0],
503
+ [.5, .4],
504
+ [1, 0]
505
+ ]
506
+ },
507
+ {
508
+ property: "depth.bend.phase",
509
+ keyframes: [[0, 0], [1, 30]],
510
+ ease: "linear"
511
+ }
512
+ ]
513
+ },
514
+ sway: {
515
+ description: "Lean back and forth like a card in hand; loop it for an idle sway.",
516
+ duration: 3200,
517
+ ease: IN_OUT,
518
+ tracks: [{
519
+ property: "depth.tilt",
520
+ keyframes: [
521
+ [0, {
522
+ x: 0,
523
+ y: 0
524
+ }],
525
+ [.25, {
526
+ x: 10,
527
+ y: -14
528
+ }],
529
+ [.75, {
530
+ x: -8,
531
+ y: 12
532
+ }],
533
+ [1, {
534
+ x: 0,
535
+ y: 0
536
+ }]
537
+ ]
538
+ }]
539
+ },
540
+ wave: {
541
+ description: "Ripple like a flag held at its left edge; loop it.",
542
+ duration: 1600,
543
+ ease: "linear",
544
+ tracks: [
545
+ {
546
+ property: "depth.bend.kind",
547
+ keyframes: [[0, "wave"]]
548
+ },
549
+ {
550
+ property: "depth.bend.amount",
551
+ keyframes: [[0, .8]]
552
+ },
553
+ {
554
+ property: "depth.bend.phase",
555
+ keyframes: [[0, 0], [1, 2 * Math.PI]]
556
+ }
557
+ ]
558
+ },
559
+ curl: {
560
+ description: "Turn away like a page from its right edge.",
561
+ duration: 1200,
562
+ ease: IN_OUT,
563
+ tracks: [{
564
+ property: "depth.bend.kind",
565
+ keyframes: [[0, "curl"]]
566
+ }, {
567
+ property: "depth.bend.amount",
568
+ keyframes: [[0, 0], [1, 1]]
569
+ }]
383
570
  }
384
571
  };
385
572
  const BOARD_PRESET_NAMES = Object.keys(PRESETS);
@@ -422,8 +609,7 @@ function boardPresetTracks(name, options) {
422
609
  });
423
610
  return tracks;
424
611
  }
425
- //#endregion
426
- //#region src/board-command-support.ts
612
+ // src/board-command-support.ts
427
613
  const BOARD_TRANSACTION_INPUT_MAX_BYTES = 16777216;
428
614
  const BOARD_CREATE_INPUT_MAX_BYTES = 33554432;
429
615
  const BOARD_DOMAIN_INPUT_MAX_BYTES = 1048576;
@@ -494,14 +680,15 @@ async function writeBoardOutput(path, bytes, force = false) {
494
680
  throw cause;
495
681
  }
496
682
  }
497
- //#endregion
498
- //#region src/commands/boards/examples.ts
683
+ // src/commands/boards/examples.ts
499
684
  const MODULES = {
500
685
  custom: BOARD_SCRIPT_DRAWING_EXAMPLE,
501
686
  rain: BOARD_SCRIPT_RAIN_EXAMPLE,
502
687
  tilt: BOARD_SCRIPT_TILT_EXAMPLE,
503
688
  senses: BOARD_SCRIPT_SENSES_EXAMPLE,
504
- sparks: BOARD_SCRIPT_SPARKS_EXAMPLE
689
+ sparks: BOARD_SCRIPT_SPARKS_EXAMPLE,
690
+ depth: BOARD_SCRIPT_HANKY_EXAMPLE,
691
+ arena: BOARD_SCRIPT_ARENA_EXAMPLE
505
692
  };
506
693
  /**
507
694
  * Starter documents for `boards create -i` and patches for `boards apply -i`.
@@ -981,6 +1168,332 @@ const BOARD_EXAMPLES = {
981
1168
  },
982
1169
  script: { src: "scripts/sparks.js" }
983
1170
  } } }
1171
+ },
1172
+ depth: {
1173
+ description: "Depth: a handkerchief that tosses and spins on three taps, and a card that flips to its back; use --module to print scripts/hanky.js.",
1174
+ value: {
1175
+ items: {
1176
+ hanky: {
1177
+ type: "frame",
1178
+ position: {
1179
+ x: 0,
1180
+ y: 0
1181
+ },
1182
+ size: {
1183
+ width: 480,
1184
+ height: 480
1185
+ },
1186
+ props: {
1187
+ label: "Handkerchief",
1188
+ decoration: "none"
1189
+ }
1190
+ },
1191
+ cloth: {
1192
+ type: "custom",
1193
+ parent: "hanky",
1194
+ size: {
1195
+ width: 480,
1196
+ height: 480
1197
+ },
1198
+ script: {
1199
+ src: "scripts/hanky.js",
1200
+ targets: { lift: "hanky" }
1201
+ }
1202
+ },
1203
+ tag: {
1204
+ type: "shape",
1205
+ parent: "hanky",
1206
+ position: {
1207
+ x: 120,
1208
+ y: 196
1209
+ },
1210
+ size: {
1211
+ width: 240,
1212
+ height: 88
1213
+ },
1214
+ style: {
1215
+ fill: "#fff7e6",
1216
+ stroke: "#ffd23f",
1217
+ strokeWidth: 4,
1218
+ radius: 20
1219
+ },
1220
+ props: {
1221
+ geometry: "rounded",
1222
+ text: "Tap me three times",
1223
+ fontSize: 20
1224
+ }
1225
+ },
1226
+ card: {
1227
+ type: "frame",
1228
+ position: {
1229
+ x: 600,
1230
+ y: 86
1231
+ },
1232
+ size: {
1233
+ width: 220,
1234
+ height: 308
1235
+ },
1236
+ props: {
1237
+ label: "Card",
1238
+ decoration: "none"
1239
+ },
1240
+ depth: { back: "back" }
1241
+ },
1242
+ "card-face": {
1243
+ type: "shape",
1244
+ parent: "card",
1245
+ size: {
1246
+ width: 220,
1247
+ height: 308
1248
+ },
1249
+ style: {
1250
+ fill: "#fbf8f1",
1251
+ stroke: "#d9d2c3",
1252
+ radius: 18
1253
+ },
1254
+ props: {
1255
+ geometry: "rounded",
1256
+ text: "A ♥",
1257
+ fontSize: 56
1258
+ }
1259
+ },
1260
+ back: {
1261
+ type: "frame",
1262
+ position: {
1263
+ x: 880,
1264
+ y: 86
1265
+ },
1266
+ size: {
1267
+ width: 220,
1268
+ height: 308
1269
+ },
1270
+ props: {
1271
+ label: "Card back",
1272
+ decoration: "none"
1273
+ }
1274
+ },
1275
+ "back-face": {
1276
+ type: "shape",
1277
+ parent: "back",
1278
+ size: {
1279
+ width: 220,
1280
+ height: 308
1281
+ },
1282
+ style: {
1283
+ fill: "#1f3b8f",
1284
+ stroke: "#f2c14e",
1285
+ strokeWidth: 6,
1286
+ radius: 18
1287
+ },
1288
+ props: {
1289
+ geometry: "rounded",
1290
+ text: "✦",
1291
+ fontSize: 72
1292
+ }
1293
+ }
1294
+ },
1295
+ animations: { flip: {
1296
+ play: "always",
1297
+ loop: true,
1298
+ duration: 3600,
1299
+ tracks: {
1300
+ turn: {
1301
+ target: "card",
1302
+ property: "depth.tilt",
1303
+ keyframes: [
1304
+ {
1305
+ at: 400,
1306
+ value: {
1307
+ x: 0,
1308
+ y: 0
1309
+ }
1310
+ },
1311
+ {
1312
+ at: 1300,
1313
+ value: {
1314
+ x: 0,
1315
+ y: 180
1316
+ },
1317
+ ease: "ease-in-out"
1318
+ },
1319
+ {
1320
+ at: 2300,
1321
+ value: {
1322
+ x: 0,
1323
+ y: 180
1324
+ }
1325
+ },
1326
+ {
1327
+ at: 3200,
1328
+ value: {
1329
+ x: 0,
1330
+ y: 360
1331
+ },
1332
+ ease: "ease-in-out"
1333
+ }
1334
+ ]
1335
+ },
1336
+ rise: {
1337
+ target: "card",
1338
+ property: "depth.lift",
1339
+ keyframes: [
1340
+ {
1341
+ at: 400,
1342
+ value: 0
1343
+ },
1344
+ {
1345
+ at: 850,
1346
+ value: 70,
1347
+ ease: "ease-out"
1348
+ },
1349
+ {
1350
+ at: 1300,
1351
+ value: 0,
1352
+ ease: "ease-in"
1353
+ },
1354
+ {
1355
+ at: 2300,
1356
+ value: 0
1357
+ },
1358
+ {
1359
+ at: 2750,
1360
+ value: 70,
1361
+ ease: "ease-out"
1362
+ },
1363
+ {
1364
+ at: 3200,
1365
+ value: 0,
1366
+ ease: "ease-in"
1367
+ }
1368
+ ]
1369
+ }
1370
+ }
1371
+ } }
1372
+ }
1373
+ },
1374
+ arena: {
1375
+ description: "3D: a fox to steer in Play with WASD or a gamepad; its clips crossfade, a glow rides its head and a low camera follows. Use --module to print scripts/arena.js.",
1376
+ value: {
1377
+ board: {
1378
+ background: { color: "#24331f" },
1379
+ scripts: { arena: {
1380
+ src: "scripts/arena.js",
1381
+ targets: { fox: "fox" }
1382
+ } }
1383
+ },
1384
+ items: {
1385
+ fox: {
1386
+ type: "file",
1387
+ position: {
1388
+ x: 480,
1389
+ y: 260
1390
+ },
1391
+ size: {
1392
+ width: 240,
1393
+ height: 240
1394
+ },
1395
+ autoplay: true,
1396
+ props: {
1397
+ src: "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Fox/glTF-Binary/Fox.glb",
1398
+ model: {
1399
+ display: "object",
1400
+ animation: "Survey",
1401
+ view: {
1402
+ yaw: 0,
1403
+ pitch: 30,
1404
+ zoom: 1
1405
+ }
1406
+ }
1407
+ }
1408
+ },
1409
+ halo: {
1410
+ type: "effect",
1411
+ position: {
1412
+ x: -36,
1413
+ y: -36
1414
+ },
1415
+ size: {
1416
+ width: 72,
1417
+ height: 72
1418
+ },
1419
+ attach: {
1420
+ item: "fox",
1421
+ node: "b_Head_05"
1422
+ },
1423
+ depth: {
1424
+ lift: 40,
1425
+ shadow: 0
1426
+ },
1427
+ style: { fill: "#ffd76a" },
1428
+ props: {
1429
+ kind: "glow",
1430
+ life: 1400
1431
+ }
1432
+ },
1433
+ hint: {
1434
+ type: "text",
1435
+ position: {
1436
+ x: 380,
1437
+ y: 140
1438
+ },
1439
+ props: {
1440
+ text: "Press Play, then WASD or the arrow keys; hold Shift to run",
1441
+ fontSize: 24,
1442
+ align: "center",
1443
+ width: 440
1444
+ },
1445
+ style: { fill: "#f4f1e8" }
1446
+ },
1447
+ stone: {
1448
+ type: "shape",
1449
+ position: {
1450
+ x: 160,
1451
+ y: 520
1452
+ },
1453
+ size: {
1454
+ width: 120,
1455
+ height: 80
1456
+ },
1457
+ style: {
1458
+ fill: "#6d7566",
1459
+ stroke: "#4d5448"
1460
+ },
1461
+ props: { geometry: "ellipse" }
1462
+ },
1463
+ pond: {
1464
+ type: "shape",
1465
+ position: {
1466
+ x: 860,
1467
+ y: 460
1468
+ },
1469
+ size: {
1470
+ width: 260,
1471
+ height: 150
1472
+ },
1473
+ style: {
1474
+ fill: "#3d6f8f",
1475
+ stroke: "#2c5670"
1476
+ },
1477
+ props: { geometry: "ellipse" }
1478
+ },
1479
+ bush: {
1480
+ type: "shape",
1481
+ position: {
1482
+ x: 920,
1483
+ y: 120
1484
+ },
1485
+ size: {
1486
+ width: 140,
1487
+ height: 120
1488
+ },
1489
+ style: {
1490
+ fill: "#3f6b35",
1491
+ stroke: "#2f5428"
1492
+ },
1493
+ props: { geometry: "ellipse" }
1494
+ }
1495
+ }
1496
+ }
984
1497
  }
985
1498
  };
986
1499
  function registerBoardExampleCommands(boards) {
@@ -1003,8 +1516,7 @@ Examples are valid input for create and apply:
1003
1516
  json(example.value);
1004
1517
  });
1005
1518
  }
1006
- //#endregion
1007
- //#region src/commands/boards/authoring.ts
1519
+ // src/commands/boards/authoring.ts
1008
1520
  const DIRECTIONS = [
1009
1521
  "left",
1010
1522
  "right",
@@ -1012,12 +1524,15 @@ const DIRECTIONS = [
1012
1524
  "down"
1013
1525
  ];
1014
1526
  function registerBoardAuthoringCommands(boards) {
1015
- boards.command("inspect <board>").description("Measure items and report visible layout hints without changing the Board").option("--animation <id>", "Animation to sample").option("--at <times>", "Time, comma-separated times, or start:end:step (up to 100 samples)", "0").option("--items <ids>", "Limit measurements to comma-separated item ids").option("--json", "Output as JSON").addHelpText("after", `
1527
+ boards.command("inspect <board>").description("Measure items and report visible layout hints without changing the Board").option("--animation <id>", "Animation to sample").option("--at <times>", "Time, comma-separated times, or start:end:step (up to 100 samples)", "0").option("--items <ids>", "Limit measurements to comma-separated item ids").option("--view <widthxheight>", "Screen lifted items are measured on, looking straight at each (default: 1600x900)").option("--json", "Output as JSON").addHelpText("after", `
1016
1528
  Without --animation, inspects the static document, not playback.
1017
1529
  Bounds use world units with x/y at the top left; worldBounds includes rotation.
1530
+ Items lifted with depth add depth: the root carrying them, the face that shows,
1531
+ how much larger they look, and seenBounds, the area of the Board they cover as seen.
1018
1532
  Checks native layout only, not camera cropping or content drawn inside scripts.
1019
1533
  Example: cohub boards inspect lesson.board --animation lecture --at 0:20s:1s --json`).action(async (target, options) => {
1020
1534
  try {
1535
+ const view = options.view ? parseBoardViewSize(options.view) : void 0;
1021
1536
  const spaceId = await resolveSpace(boards);
1022
1537
  const document = await settleBoardDocument(spaceId, (await loadBoardDocument(spaceId, target)).document);
1023
1538
  const times = parseBoardTimes(options.at, "--at", 100);
@@ -1032,7 +1547,7 @@ Example: cohub boards inspect lesson.board --animation lecture --at 0:20s:1s --j
1032
1547
  coverage: "Native layout in world coordinates; excludes camera cropping and script-drawn content.",
1033
1548
  samples: times.map((time) => ({
1034
1549
  time,
1035
- ...inspectBoardItems(sampler?.at(time).scene ?? buildBoardScene(document), ids ?? void 0)
1550
+ ...inspectBoardItems(sampler?.at(time).scene ?? buildBoardScene(document), ids ?? void 0, { view })
1036
1551
  }))
1037
1552
  });
1038
1553
  } finally {
@@ -1146,8 +1661,17 @@ their time moves forward. Placing a target that is already on the timeline moves
1146
1661
  }
1147
1662
  });
1148
1663
  }
1149
- //#endregion
1150
- //#region src/commands/boards.ts
1664
+ function parseBoardViewSize(value) {
1665
+ const match = /^(\d+)x(\d+)$/.exec(value.trim());
1666
+ const width = Number(match?.[1]);
1667
+ const height = Number(match?.[2]);
1668
+ if (!match || !(width > 0 && height > 0 && width <= 16384 && height <= 16384)) throw new Error("--view takes widthxheight in pixels, e.g. 1600x900.");
1669
+ return {
1670
+ width,
1671
+ height
1672
+ };
1673
+ }
1674
+ // src/commands/boards.ts
1151
1675
  function boardSchemaField(schema, path) {
1152
1676
  let field = schema;
1153
1677
  for (const part of path.split(".")) {
@@ -1582,6 +2106,7 @@ Examples:
1582
2106
  const changed = Object.keys(result.changes.items ?? {}).length;
1583
2107
  ok(`Simulated ${formatBoardTime(result.time)}: ${result.commits} commit${result.commits === 1 ? "" : "s"}, ${changed} item${changed === 1 ? "" : "s"} changed (not saved)`);
1584
2108
  for (const press of result.presses) console.log(` step ${press.step + 1}: ${describePress(press)}`);
2109
+ if (result.camera) console.log(` camera: ${JSON.stringify(result.camera)}`);
1585
2110
  if (result.broadcasts.length) console.log(` ${result.broadcasts.length} broadcast${result.broadcasts.length === 1 ? "" : "s"}: ${[...new Set(result.broadcasts.map(({ owner, type }) => `${owner} "${type}"`))].join(", ")}`);
1586
2111
  for (const [id, message] of Object.entries(result.errors)) console.log(` ! ${id}: ${message.split("\n")[0]}`);
1587
2112
  for (const warning of result.warnings) console.log(` ! ${warning}`);
@@ -2014,5 +2539,4 @@ function registerPlaybackCommands(boards) {
2014
2539
  withJson(boards.command("next <board>").description("Continue past the marker a presentation holds at")).action((target, options) => run(target, options, (board) => board.next()));
2015
2540
  withJson(boards.command("stop <board>").description("Stop playback")).action((target, options) => run(target, options, (board) => board.stop()));
2016
2541
  }
2017
- //#endregion
2018
2542
  export { registerBoards };