@blackbelt-technology/pi-dashboard-deck3d 0.9.0 → 0.10.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 (105) hide show
  1. package/.pi/skills/deck3d/SKILL.agent.md +78 -0
  2. package/.pi/skills/deck3d/SKILL.md +68 -0
  3. package/.pi/skills/deck3d/reference/effects.md +185 -2
  4. package/.pi/skills/deck3d/reference/ir-fields.md +26 -3
  5. package/.pi/skills/deck3d-from-pptx/SKILL.md +134 -0
  6. package/.pi/skills/deck3d-from-pptx/reference/steps.md +72 -0
  7. package/README.md +30 -2
  8. package/assets/preview/stub-chrome.png +0 -0
  9. package/assets/preview/stub-icon.json +59 -0
  10. package/assets/preview/stub-layout.json +195 -0
  11. package/assets/preview/stub-outline.json +48 -0
  12. package/dist/cli.js +11780 -5934
  13. package/dist/runtime.js +5916 -4007
  14. package/fixtures/business-2031/assets/stub-chrome.png +0 -0
  15. package/fixtures/business-2031/assets/stub-icon.json +59 -0
  16. package/fixtures/business-2031/assets/stub-layout.json +195 -0
  17. package/fixtures/business-2031/assets/stub-outline.json +48 -0
  18. package/fixtures/business-2031/build-overrides.mjs +58 -13
  19. package/fixtures/business-2031/deck.agent.md +60 -0
  20. package/fixtures/business-2031/deck.json +133 -8
  21. package/fixtures/business-2031/overrides.json +133 -8
  22. package/package.json +8 -4
  23. package/scripts/gen-stub-assets.ts +31 -0
  24. package/src/art/cutout.ts +97 -0
  25. package/src/art/decode.ts +169 -0
  26. package/src/art/icon.ts +380 -0
  27. package/src/art/png.ts +232 -0
  28. package/src/art/trace.ts +288 -0
  29. package/src/check/rules.ts +13 -8
  30. package/src/cli.ts +313 -51
  31. package/src/compare/index.ts +131 -0
  32. package/src/compare/ssim.ts +91 -0
  33. package/src/fx/art-geometry.ts +137 -0
  34. package/src/fx/art3d.meta.json +30 -0
  35. package/src/fx/art3d.ts +131 -0
  36. package/src/fx/bank.meta.json +26 -0
  37. package/src/fx/bank.ts +8 -0
  38. package/src/fx/compose.ts +5 -4
  39. package/src/fx/crane.meta.json +26 -0
  40. package/src/fx/crane.ts +8 -0
  41. package/src/fx/dolly.ts +5 -1
  42. package/src/fx/fade.ts +5 -1
  43. package/src/fx/flythrough.ts +5 -1
  44. package/src/fx/frame-chrome.meta.json +17 -0
  45. package/src/fx/frame-chrome.ts +134 -0
  46. package/src/fx/haze.meta.json +19 -0
  47. package/src/fx/haze.ts +91 -0
  48. package/src/fx/icon3d.meta.json +21 -0
  49. package/src/fx/icon3d.ts +167 -0
  50. package/src/fx/index.ts +96 -66
  51. package/src/fx/iris.ts +5 -1
  52. package/src/fx/meta.schema.json +10 -2
  53. package/src/fx/path.meta.json +25 -0
  54. package/src/fx/path.ts +8 -0
  55. package/src/fx/persistent.ts +11 -0
  56. package/src/fx/revolve.meta.json +26 -0
  57. package/src/fx/revolve.ts +8 -0
  58. package/src/fx/slide-layer.meta.json +26 -0
  59. package/src/fx/slide-layer.ts +557 -0
  60. package/src/fx/slide-space.ts +142 -0
  61. package/src/fx/stub-assets.ts +117 -0
  62. package/src/fx/swing.meta.json +26 -0
  63. package/src/fx/swing.ts +8 -0
  64. package/src/fx/types.ts +63 -2
  65. package/src/ir/merge.ts +5 -2
  66. package/src/ir/schema.json +140 -3
  67. package/src/ir/types.ts +54 -0
  68. package/src/ir/validate.ts +91 -3
  69. package/src/parse/harvest/index.ts +4 -1
  70. package/src/parse/markdown.ts +38 -7
  71. package/src/pptx/baseline.ts +183 -0
  72. package/src/pptx/extract.ts +161 -0
  73. package/src/pptx/fallback.ts +70 -0
  74. package/src/pptx/import.ts +256 -0
  75. package/src/pptx/master.ts +135 -0
  76. package/src/pptx/media.ts +81 -0
  77. package/src/pptx/package.ts +109 -0
  78. package/src/pptx/ref.ts +100 -0
  79. package/src/pptx/shapes.ts +276 -0
  80. package/src/pptx/stage.ts +82 -0
  81. package/src/pptx/text.ts +202 -0
  82. package/src/pptx/theme.ts +194 -0
  83. package/src/pptx/types.ts +159 -0
  84. package/src/pptx/xfrm.ts +93 -0
  85. package/src/pptx/xml.ts +106 -0
  86. package/src/pptx/zip.ts +239 -0
  87. package/src/render/assets.ts +57 -0
  88. package/src/render/build.ts +75 -0
  89. package/src/render/index.ts +7 -2
  90. package/src/render/template.html +1 -1
  91. package/src/runtime/assets.ts +75 -0
  92. package/src/runtime/fade.ts +110 -0
  93. package/src/runtime/hud.ts +37 -9
  94. package/src/runtime/index.ts +431 -67
  95. package/src/runtime/post.ts +11 -5
  96. package/src/runtime/scene.ts +25 -2
  97. package/src/runtime/transition.ts +222 -0
  98. package/src/runtime/types.ts +13 -2
  99. package/src/serve/index.ts +199 -16
  100. package/src/util/cleanup.ts +13 -0
  101. package/src/util/confine.ts +15 -0
  102. package/src/variants/pick.ts +282 -0
  103. package/src/variants/render.ts +179 -0
  104. package/src/variants/schema.json +48 -0
  105. package/src/variants/style.ts +318 -0
@@ -6,7 +6,9 @@
6
6
  * embedded IR stays the record of what was rendered, and the panel's state
7
7
  * lives in memory plus `localStorage["deck3d:" + derivedHash]`.
8
8
  */
9
+
9
10
  import type { BuiltDiagramKind, CardOffset, Defaults, EffectRef, Layout, Material, Mode, Palette, Quality, Rail, TitleEdge } from "../ir/types.js";
11
+ import { TRANSITION_IDS } from "./transition.js";
10
12
 
11
13
  export interface HudSlide {
12
14
  id: string;
@@ -17,9 +19,11 @@ export interface HudSlide {
17
19
  export interface HudHost {
18
20
  slides: HudSlide[];
19
21
  /** Every effect the deck can instantiate (corpus + embedded `local:` cards). */
20
- catalogue: Array<{ id: string; kind: string }>;
22
+ catalogue: Array<{ id: string; kind: string; persistent?: boolean }>;
21
23
  /** Deck-level effect ids, PREPENDED to every slide — shown as inherited slots. */
22
24
  deckEffects: string[];
25
+ /** Live deck-scope persistent effect ids (deck-wide singletons). */
26
+ persistentEffects?: () => string[];
23
27
  /** Deck defaults as embedded (read-only). */
24
28
  defaults: Defaults;
25
29
  /** Keys already overridden, for the `●` markers. */
@@ -32,7 +36,8 @@ export interface HudHost {
32
36
  /** Same, for EVERY slide — a deck-scope value is not a property of one slide. */
33
37
  applyDeck: (patchFor: (slideId: string) => SlidePatch) => void;
34
38
  /** Recompose the current slide's effects from this list. */
35
- applyEffects: (ids: string[]) => void;
39
+ /** `scope` decides persistent cards: only a deck-scope list may carry them. */
40
+ applyEffects: (ids: string[], scope: "deck" | "slide") => void;
36
41
  /** Declared knobs of the current slide's effects, with values in force. */
37
42
  effectParams: () => Array<{ id: string; schema: Record<string, unknown>; values: Record<string, unknown> }>;
38
43
  /** Rebuild one effect of the current slide under edited params. */
@@ -93,7 +98,8 @@ const MATERIALS: Material[] = ["glass", "metal", "matte"];
93
98
  const LAYOUTS: Layout[] = ["split", "split-reverse"];
94
99
  const RAILS: Rail[] = ["line", "orbit", "tunnel", "helix", "grid"];
95
100
  const DIAGRAM_KINDS: BuiltDiagramKind[] = ["none", "brain", "loop", "swarm", "bars", "funnel", "timeline-rail", "globe", "orbit-cluster", "stack"];
96
- const TRANSITIONS = ["dolly", "fade", "iris", "flythrough", "cut"];
101
+ /** Every camera move the runtime plays (corpus `transition` cards + `cut`). */
102
+ const TRANSITIONS: string[] = [...TRANSITION_IDS];
97
103
 
98
104
  /** How one control is rendered. `enum` carries its own option list. */
99
105
  type ControlSpec =
@@ -432,14 +438,19 @@ export function createHud(host: HudHost): Hud {
432
438
  state.slides[slideId].effects = next;
433
439
  }
434
440
  persist();
435
- host.applyEffects(next);
441
+ host.applyEffects(next, scope);
436
442
  // The list itself changed shape — rows and the picker's options with it.
437
443
  render();
438
444
  }
439
445
 
440
446
  /** Effect ids of one kind, sorted — the stepper's ring. */
447
+ /** What the active scope may add: persistent cards are deck-scope only. */
448
+ function offered(): Array<{ id: string; kind: string; persistent?: boolean }> {
449
+ return scope === "slide" ? host.catalogue.filter((c) => !c.persistent) : host.catalogue;
450
+ }
451
+
441
452
  function idsOfKind(kind: string): string[] {
442
- return host.catalogue
453
+ return offered()
443
454
  .filter((c) => c.kind === kind)
444
455
  .map((c) => c.id)
445
456
  .sort();
@@ -447,7 +458,7 @@ export function createHud(host: HudHost): Hud {
447
458
 
448
459
  /** Kinds the catalogue actually carries (background, post, light, …). */
449
460
  function kinds(): string[] {
450
- return [...new Set(host.catalogue.map((c) => c.kind))].sort();
461
+ return [...new Set(offered().map((c) => c.kind))].sort();
451
462
  }
452
463
 
453
464
  function kindOf(id: string): string {
@@ -522,7 +533,10 @@ export function createHud(host: HudHost): Hud {
522
533
  const list = el("div", { class: "deck3d-hud-effects" });
523
534
  const composed = host.slides[host.current() - 1]?.effects ?? [];
524
535
  const staged = (scope === "deck" ? state.deck.effects : state.slides[slideId]?.effects) as string[] | undefined;
525
- const active = staged ?? composed.map((e) => e.id);
536
+ const composedIds = composed.map((e) => e.id);
537
+ // Persistent cards never sit in a slide's list; deck scope shows them.
538
+ const persistentIds = scope === "deck" ? (host.persistentEffects?.() ?? []).filter((id) => !composedIds.includes(id)) : [];
539
+ const active = staged ?? [...composedIds, ...persistentIds];
526
540
  const fromDeck = new Set(host.deckEffects);
527
541
  for (let i = 0; i < active.length; i++) {
528
542
  list.appendChild(slotRow(slideId, active, i, scope === "slide" && fromDeck.has(active[i])));
@@ -537,7 +551,7 @@ export function createHud(host: HudHost): Hud {
537
551
  button.textContent = "+ add slot";
538
552
  button.addEventListener("click", () => {
539
553
  const taken = new Set(active);
540
- const seed = idsOfKind("background").find((id) => !taken.has(id)) ?? host.catalogue.map((c) => c.id).find((id) => !taken.has(id));
554
+ const seed = idsOfKind("background").find((id) => !taken.has(id)) ?? offered().map((c) => c.id).find((id) => !taken.has(id));
541
555
  if (seed) commitEffects(slideId, [...active, seed]);
542
556
  });
543
557
  return button;
@@ -554,6 +568,9 @@ export function createHud(host: HudHost): Hud {
554
568
  const box = el("div", { class: "deck3d-hud-fxparams" });
555
569
  for (const [key, rawSpec] of Object.entries(decl.schema)) {
556
570
  const spec = rawSpec as { type?: string; minimum?: number; maximum?: number; default?: unknown; enum?: string[] };
571
+ // Structured params (layer lists, id maps) have no scalar control; they
572
+ // are edited in deck.json or picked as a variant.
573
+ if (spec.type === "array" || spec.type === "object" || (spec.type === "string" && !spec.enum)) continue;
557
574
  const current = decl.values[key] ?? spec.default;
558
575
  const line = el("label", { class: "deck3d-hud-fxparam" });
559
576
  const tag = el("span");
@@ -800,8 +817,15 @@ export function createHud(host: HudHost): Hud {
800
817
  body.appendChild(box);
801
818
  }
802
819
 
820
+ // `serve ?variant=` renders a candidate in memory: it must never reach disk
821
+ // through this panel, so Save/Apply are disabled and the notice says how
822
+ // to choose it properly.
823
+ const variantPreview = (window as { __DECK3D_VARIANT?: { step: string; name: string } }).__DECK3D_VARIANT;
824
+
803
825
  const notice = el("div", { class: "deck3d-hud-note" });
804
- notice.textContent = served
826
+ notice.textContent = variantPreview
827
+ ? `Previewing variant ${variantPreview.step}:${variantPreview.name}. Save and Apply are disabled; choose a variant with \`deck3d variants pick ${variantPreview.step} ${variantPreview.name}\`.`
828
+ : served
805
829
  ? "Save writes overrides.json beside the deck. Apply merges into deck.json and rebuilds. Markdown inline overrides win over the file, and a saved effects list pins that scope's effects."
806
830
  : "Tuning here is remembered in this browser only. Export writes overrides.json; make it permanent with `deck3d overrides apply deck.json overrides.json`, then rebuild. Markdown inline overrides win over this file, and an exported effects list pins that scope's effects.";
807
831
  body.appendChild(notice);
@@ -816,6 +840,10 @@ export function createHud(host: HudHost): Hud {
816
840
  apply.textContent = "Apply to deck.json";
817
841
  apply.addEventListener("click", () => void postPayload("/__apply", apply));
818
842
  body.appendChild(apply);
843
+ if (variantPreview) {
844
+ save.disabled = true;
845
+ apply.disabled = true;
846
+ }
819
847
  }
820
848
 
821
849
  const exportButton = el("button", { type: "button", id: "deck3d-hud-export" });