@blackbelt-technology/pi-dashboard-deck3d 0.0.0-stage → 0.9.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 (260) hide show
  1. package/.pi/skills/deck3d/SKILL.md +227 -0
  2. package/.pi/skills/deck3d/examples/deck.json +388 -0
  3. package/.pi/skills/deck3d/examples/fixture.md +18 -0
  4. package/.pi/skills/deck3d/examples/snapshot-after.png +0 -0
  5. package/.pi/skills/deck3d/examples/snapshot-before.png +0 -0
  6. package/.pi/skills/deck3d/reference/effects.agent.md +78 -0
  7. package/.pi/skills/deck3d/reference/effects.md +1217 -0
  8. package/.pi/skills/deck3d/reference/ir-fields.agent.md +30 -0
  9. package/.pi/skills/deck3d/reference/ir-fields.md +246 -0
  10. package/README.md +177 -2
  11. package/assets/LICENSE-Poppins.txt +99 -0
  12. package/assets/Poppins-Bold.ttf +0 -0
  13. package/assets/props/LICENSES.txt +4 -0
  14. package/assets/props/brain.glb +0 -0
  15. package/assets/props/cloud.glb +0 -0
  16. package/assets/props/cube.glb +0 -0
  17. package/assets/props/database.glb +0 -0
  18. package/assets/props/laptop.glb +0 -0
  19. package/assets/props/manifest.json +119 -0
  20. package/assets/props/robot.glb +0 -0
  21. package/assets/props/server.glb +0 -0
  22. package/assets/props/shield.glb +0 -0
  23. package/bin/deck3d +49 -0
  24. package/dist/cli.js +10228 -0
  25. package/dist/harvest/harness.js +185718 -0
  26. package/dist/runtime.js +64597 -0
  27. package/fixtures/business-2031/build-deck.mjs +60 -0
  28. package/fixtures/business-2031/build-overrides.mjs +154 -0
  29. package/fixtures/business-2031/deck.json +4220 -0
  30. package/fixtures/business-2031/deck.md +470 -0
  31. package/fixtures/business-2031/fx/closing-mark.js +43 -0
  32. package/fixtures/business-2031/fx/closing-mark.meta.json +26 -0
  33. package/fixtures/business-2031/overrides.json +903 -0
  34. package/fixtures/harvest.md +23 -0
  35. package/fixtures/strategy-lab.json +891 -0
  36. package/fixtures/strategy-lab.md +85 -0
  37. package/package.json +80 -4
  38. package/scripts/build-cli.mjs +29 -0
  39. package/scripts/build-harvest.ts +8 -0
  40. package/scripts/build-runtime.mjs +22 -0
  41. package/scripts/gen-effects.ts +14 -0
  42. package/scripts/gen-ir-fields.ts +34 -0
  43. package/src/check/index.ts +315 -0
  44. package/src/check/rules.ts +393 -0
  45. package/src/cli-io.ts +23 -0
  46. package/src/cli.ts +823 -0
  47. package/src/fx/accent-cycle.meta.json +26 -0
  48. package/src/fx/accent-cycle.ts +8 -0
  49. package/src/fx/agent-depth.meta.json +42 -0
  50. package/src/fx/agent-depth.ts +62 -0
  51. package/src/fx/ascii.meta.json +35 -0
  52. package/src/fx/ascii.ts +4 -0
  53. package/src/fx/aurora.meta.json +26 -0
  54. package/src/fx/aurora.ts +18 -0
  55. package/src/fx/billboards.meta.json +34 -0
  56. package/src/fx/billboards.ts +67 -0
  57. package/src/fx/bloom.meta.json +26 -0
  58. package/src/fx/bloom.ts +4 -0
  59. package/src/fx/camera-drift.meta.json +26 -0
  60. package/src/fx/camera-drift.ts +8 -0
  61. package/src/fx/capital-flows.meta.json +30 -0
  62. package/src/fx/capital-flows.ts +64 -0
  63. package/src/fx/catalogue.ts +89 -0
  64. package/src/fx/chromatic-aberration.meta.json +32 -0
  65. package/src/fx/chromatic-aberration.ts +4 -0
  66. package/src/fx/city-grid.meta.json +37 -0
  67. package/src/fx/city-grid.ts +51 -0
  68. package/src/fx/clipped-solids.meta.json +49 -0
  69. package/src/fx/clipped-solids.ts +171 -0
  70. package/src/fx/cohort-grid.meta.json +48 -0
  71. package/src/fx/cohort-grid.ts +63 -0
  72. package/src/fx/compose.ts +114 -0
  73. package/src/fx/constellation.meta.json +51 -0
  74. package/src/fx/constellation.ts +103 -0
  75. package/src/fx/curve-flow.meta.json +40 -0
  76. package/src/fx/curve-flow.ts +63 -0
  77. package/src/fx/dashed-flow.meta.json +27 -0
  78. package/src/fx/dashed-flow.ts +8 -0
  79. package/src/fx/data-columns.meta.json +30 -0
  80. package/src/fx/data-columns.ts +18 -0
  81. package/src/fx/defaults.ts +92 -0
  82. package/src/fx/depth-of-field.meta.json +40 -0
  83. package/src/fx/depth-of-field.ts +4 -0
  84. package/src/fx/dolly.meta.json +26 -0
  85. package/src/fx/dolly.ts +4 -0
  86. package/src/fx/dot-screen.meta.json +35 -0
  87. package/src/fx/dot-screen.ts +4 -0
  88. package/src/fx/dynamic-instances.meta.json +40 -0
  89. package/src/fx/dynamic-instances.ts +57 -0
  90. package/src/fx/emissive.meta.json +26 -0
  91. package/src/fx/emissive.ts +8 -0
  92. package/src/fx/extruded-shapes.meta.json +62 -0
  93. package/src/fx/extruded-shapes.ts +133 -0
  94. package/src/fx/fab-wafer.meta.json +42 -0
  95. package/src/fx/fab-wafer.ts +72 -0
  96. package/src/fx/fade.meta.json +26 -0
  97. package/src/fx/fade.ts +4 -0
  98. package/src/fx/film.meta.json +26 -0
  99. package/src/fx/film.ts +4 -0
  100. package/src/fx/float.meta.json +26 -0
  101. package/src/fx/float.ts +8 -0
  102. package/src/fx/flythrough.meta.json +26 -0
  103. package/src/fx/flythrough.ts +4 -0
  104. package/src/fx/fog.meta.json +26 -0
  105. package/src/fx/fog.ts +8 -0
  106. package/src/fx/geo-fragments.meta.json +48 -0
  107. package/src/fx/geo-fragments.ts +59 -0
  108. package/src/fx/glass.meta.json +26 -0
  109. package/src/fx/glass.ts +8 -0
  110. package/src/fx/globe-arcs.meta.json +36 -0
  111. package/src/fx/globe-arcs.ts +67 -0
  112. package/src/fx/glow-tube.meta.json +26 -0
  113. package/src/fx/glow-tube.ts +8 -0
  114. package/src/fx/glyph-rain.meta.json +30 -0
  115. package/src/fx/glyph-rain.ts +18 -0
  116. package/src/fx/god-rays.meta.json +40 -0
  117. package/src/fx/god-rays.ts +4 -0
  118. package/src/fx/grid-horizon.meta.json +30 -0
  119. package/src/fx/grid-horizon.ts +18 -0
  120. package/src/fx/hex-grid.meta.json +29 -0
  121. package/src/fx/hex-grid.ts +18 -0
  122. package/src/fx/holo-fresnel.meta.json +26 -0
  123. package/src/fx/holo-fresnel.ts +8 -0
  124. package/src/fx/horizon-gates.meta.json +36 -0
  125. package/src/fx/horizon-gates.ts +60 -0
  126. package/src/fx/index.ts +258 -0
  127. package/src/fx/iridescent.meta.json +26 -0
  128. package/src/fx/iridescent.ts +8 -0
  129. package/src/fx/iris.meta.json +26 -0
  130. package/src/fx/iris.ts +4 -0
  131. package/src/fx/lightformers.meta.json +26 -0
  132. package/src/fx/lightformers.ts +8 -0
  133. package/src/fx/local.ts +200 -0
  134. package/src/fx/market-tape.meta.json +53 -0
  135. package/src/fx/market-tape.ts +97 -0
  136. package/src/fx/matcap.meta.json +26 -0
  137. package/src/fx/matcap.ts +8 -0
  138. package/src/fx/meta.schema.json +49 -0
  139. package/src/fx/metal.meta.json +26 -0
  140. package/src/fx/metal.ts +8 -0
  141. package/src/fx/mirror-floor.meta.json +26 -0
  142. package/src/fx/mirror-floor.ts +8 -0
  143. package/src/fx/neural-mesh.meta.json +54 -0
  144. package/src/fx/neural-mesh.ts +110 -0
  145. package/src/fx/orbit-agents.meta.json +36 -0
  146. package/src/fx/orbit-agents.ts +63 -0
  147. package/src/fx/orbit.meta.json +27 -0
  148. package/src/fx/orbit.ts +8 -0
  149. package/src/fx/outline.meta.json +43 -0
  150. package/src/fx/outline.ts +4 -0
  151. package/src/fx/paper-stack.meta.json +36 -0
  152. package/src/fx/paper-stack.ts +61 -0
  153. package/src/fx/particle-stream.meta.json +27 -0
  154. package/src/fx/particle-stream.ts +8 -0
  155. package/src/fx/particles.meta.json +26 -0
  156. package/src/fx/particles.ts +8 -0
  157. package/src/fx/pixelate.meta.json +28 -0
  158. package/src/fx/pixelate.ts +4 -0
  159. package/src/fx/points-on-geometry.meta.json +61 -0
  160. package/src/fx/points-on-geometry.ts +71 -0
  161. package/src/fx/proof-gate.meta.json +30 -0
  162. package/src/fx/proof-gate.ts +67 -0
  163. package/src/fx/rings.meta.json +27 -0
  164. package/src/fx/rings.ts +8 -0
  165. package/src/fx/room-ibl.meta.json +26 -0
  166. package/src/fx/room-ibl.ts +8 -0
  167. package/src/fx/sao.meta.json +32 -0
  168. package/src/fx/sao.ts +4 -0
  169. package/src/fx/scaffold.ts +172 -0
  170. package/src/fx/scatter.meta.json +49 -0
  171. package/src/fx/scatter.ts +74 -0
  172. package/src/fx/selective-bloom.meta.json +36 -0
  173. package/src/fx/selective-bloom.ts +4 -0
  174. package/src/fx/server-racks.meta.json +36 -0
  175. package/src/fx/server-racks.ts +54 -0
  176. package/src/fx/shader-particles.meta.json +46 -0
  177. package/src/fx/shader-particles.ts +75 -0
  178. package/src/fx/signal-pulse.meta.json +27 -0
  179. package/src/fx/signal-pulse.ts +8 -0
  180. package/src/fx/smaa.meta.json +19 -0
  181. package/src/fx/smaa.ts +4 -0
  182. package/src/fx/sobel.meta.json +24 -0
  183. package/src/fx/sobel.ts +4 -0
  184. package/src/fx/soft-shadows.meta.json +26 -0
  185. package/src/fx/soft-shadows.ts +8 -0
  186. package/src/fx/sprites.meta.json +40 -0
  187. package/src/fx/sprites.ts +57 -0
  188. package/src/fx/stagger-reveal.meta.json +26 -0
  189. package/src/fx/stagger-reveal.ts +8 -0
  190. package/src/fx/starfield.meta.json +32 -0
  191. package/src/fx/starfield.ts +18 -0
  192. package/src/fx/swarm.meta.json +27 -0
  193. package/src/fx/swarm.ts +8 -0
  194. package/src/fx/tessellate.meta.json +39 -0
  195. package/src/fx/tessellate.ts +79 -0
  196. package/src/fx/tokens.meta.json +27 -0
  197. package/src/fx/tokens.ts +8 -0
  198. package/src/fx/trail.meta.json +27 -0
  199. package/src/fx/trail.ts +8 -0
  200. package/src/fx/trust-ledger.meta.json +30 -0
  201. package/src/fx/trust-ledger.ts +47 -0
  202. package/src/fx/types.ts +83 -0
  203. package/src/fx/util.ts +108 -0
  204. package/src/fx/vault-glyphs.meta.json +37 -0
  205. package/src/fx/vault-glyphs.ts +55 -0
  206. package/src/fx/video-screen.meta.json +57 -0
  207. package/src/fx/video-screen.ts +99 -0
  208. package/src/fx/vignette.meta.json +32 -0
  209. package/src/fx/vignette.ts +4 -0
  210. package/src/fx/volume-cloud.meta.json +58 -0
  211. package/src/fx/volume-cloud.ts +87 -0
  212. package/src/fx/volume-perlin.meta.json +46 -0
  213. package/src/fx/volume-perlin.ts +82 -0
  214. package/src/fx/volumetric-spot.meta.json +26 -0
  215. package/src/fx/volumetric-spot.ts +8 -0
  216. package/src/fx/wireframe-overlay.meta.json +27 -0
  217. package/src/fx/wireframe-overlay.ts +8 -0
  218. package/src/ir/defaults.ts +62 -0
  219. package/src/ir/field-reference.ts +96 -0
  220. package/src/ir/hash.ts +34 -0
  221. package/src/ir/ids.ts +65 -0
  222. package/src/ir/merge.ts +155 -0
  223. package/src/ir/schema.json +1211 -0
  224. package/src/ir/types.ts +333 -0
  225. package/src/ir/validate.ts +196 -0
  226. package/src/parse/derive.ts +205 -0
  227. package/src/parse/harvest/bundle.ts +56 -0
  228. package/src/parse/harvest/harness.html +22 -0
  229. package/src/parse/harvest/harness.ts +191 -0
  230. package/src/parse/harvest/index.ts +169 -0
  231. package/src/parse/harvest/shapes.ts +75 -0
  232. package/src/parse/markdown.ts +215 -0
  233. package/src/props/embed.ts +92 -0
  234. package/src/props/fetch.ts +97 -0
  235. package/src/props/generate.ts +152 -0
  236. package/src/props/key.ts +13 -0
  237. package/src/props/search.ts +180 -0
  238. package/src/render/embed-video.ts +80 -0
  239. package/src/render/font.ts +86 -0
  240. package/src/render/index.ts +149 -0
  241. package/src/render/template.html +87 -0
  242. package/src/runtime/backgrounds.ts +146 -0
  243. package/src/runtime/builders.ts +808 -0
  244. package/src/runtime/camera.ts +73 -0
  245. package/src/runtime/hud.ts +887 -0
  246. package/src/runtime/index.ts +1168 -0
  247. package/src/runtime/local-fx.ts +151 -0
  248. package/src/runtime/materials.ts +136 -0
  249. package/src/runtime/measure.ts +73 -0
  250. package/src/runtime/node-geometry.ts +26 -0
  251. package/src/runtime/palette.ts +111 -0
  252. package/src/runtime/post.ts +649 -0
  253. package/src/runtime/props.ts +292 -0
  254. package/src/runtime/quality.ts +20 -0
  255. package/src/runtime/rng.ts +8 -0
  256. package/src/runtime/scene.ts +644 -0
  257. package/src/runtime/text.ts +174 -0
  258. package/src/runtime/types.ts +118 -0
  259. package/src/serve/index.ts +376 -0
  260. package/src/util/paths.ts +35 -0
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "curve-flow",
3
+ "kind": "background",
4
+ "tags": {
5
+ "mood": [
6
+ "kinetic",
7
+ "elegant"
8
+ ],
9
+ "content": [
10
+ "flow",
11
+ "orbit",
12
+ "stream"
13
+ ]
14
+ },
15
+ "cost": 2,
16
+ "modes": "both",
17
+ "params": {
18
+ "density": {
19
+ "type": "number",
20
+ "default": 1,
21
+ "minimum": 0.2,
22
+ "maximum": 3
23
+ },
24
+ "lanes": {
25
+ "type": "number",
26
+ "default": 3,
27
+ "minimum": 1,
28
+ "maximum": 6
29
+ },
30
+ "speed": {
31
+ "type": "number",
32
+ "default": 1,
33
+ "minimum": 0,
34
+ "maximum": 3
35
+ }
36
+ },
37
+ "conflicts": [],
38
+ "source": "https://threejs.org/examples/#webgl_modifier_curve_instanced",
39
+ "licence": "MIT"
40
+ }
@@ -0,0 +1,63 @@
1
+ import { InstancedFlow } from "three/examples/jsm/modifiers/CurveModifier.js";
2
+ import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
3
+ import { countFor, num } from "./util.js";
4
+
5
+ /**
6
+ * Glyph-sized capsules bending along seeded loops (three
7
+ * `webgl_modifier_curve_instanced`). `InstancedFlow` accumulates offsets by
8
+ * design; here each offset is SET from `t` every tick, so the frame is a pure
9
+ * function of time.
10
+ */
11
+ export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
12
+ const { THREE, palette, rng } = ctx;
13
+ const lanes = Math.max(1, Math.min(6, Math.round(num(params, "lanes", 3))));
14
+ const count = countFor(ctx, 12, num(params, "density", 1), 12);
15
+ const speed = num(params, "speed", 1);
16
+
17
+ const curves: THREE.CatmullRomCurve3[] = [];
18
+ for (let l = 0; l < lanes; l++) {
19
+ const pts: THREE.Vector3[] = [];
20
+ const cx = (rng() - 0.5) * 10;
21
+ const cy = (rng() - 0.5) * 4;
22
+ const r = 3 + rng() * 4;
23
+ for (let i = 0; i < 6; i++) {
24
+ const a = (i / 6) * Math.PI * 2;
25
+ pts.push(new THREE.Vector3(cx + Math.cos(a) * r * (0.8 + rng() * 0.4), cy + Math.sin(a) * r * 0.4 * (0.8 + rng() * 0.4), -4 + (rng() - 0.5) * 3));
26
+ }
27
+ curves.push(new THREE.CatmullRomCurve3(pts, true));
28
+ }
29
+
30
+ const geo = new THREE.CapsuleGeometry(0.09, 0.9, 4, 8);
31
+ geo.rotateZ(Math.PI / 2);
32
+ const mat = new THREE.MeshStandardMaterial({ color: palette.accent, metalness: 0.4, roughness: 0.4 });
33
+ // `writeChanges` exists at runtime (r160) but is missing from @types/three.
34
+ const flow = new InstancedFlow(count, lanes, geo, mat) as InstancedFlow & { writeChanges: (i: number) => void };
35
+ curves.forEach((c, i) => flow.updateCurve(i, c));
36
+ const offsets = new Float32Array(count);
37
+ const lane = new Uint8Array(count);
38
+ for (let i = 0; i < count; i++) {
39
+ lane[i] = i % lanes;
40
+ offsets[i] = rng();
41
+ flow.setCurve(i, lane[i]);
42
+ flow.object3D.setColorAt(i, new THREE.Color(i % 3 === 0 ? palette.second : palette.accent));
43
+ }
44
+
45
+ const group = new THREE.Group();
46
+ group.add(flow.object3D);
47
+ const holder = new THREE.Group();
48
+ holder.add(group);
49
+ holder.userData.count = count;
50
+ return {
51
+ object: holder,
52
+ tick: (t) => {
53
+ for (let i = 0; i < count; i++) {
54
+ flow.offsets[i] = (offsets[i] + t * 0.04 * speed * (1 + (lane[i] % 2) * 0.5)) % 1;
55
+ flow.writeChanges(i);
56
+ }
57
+ },
58
+ dispose: () => {
59
+ geo.dispose();
60
+ mat.dispose();
61
+ },
62
+ };
63
+ };
@@ -0,0 +1,27 @@
1
+ {
2
+ "id": "dashed-flow",
3
+ "kind": "edge",
4
+ "tags": {
5
+ "mood": [
6
+ "technical",
7
+ "active"
8
+ ],
9
+ "content": [
10
+ "flow",
11
+ "sequence"
12
+ ]
13
+ },
14
+ "cost": 1,
15
+ "modes": "both",
16
+ "params": {
17
+ "dash": {
18
+ "type": "number",
19
+ "default": 0.5,
20
+ "minimum": 0,
21
+ "maximum": 2
22
+ }
23
+ },
24
+ "conflicts": [],
25
+ "source": "https://threejs.org/examples/",
26
+ "licence": "MIT"
27
+ }
@@ -0,0 +1,8 @@
1
+ import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
2
+
3
+ /** Edge style decorator; the flowchart builder applies it to edge tubes. */
4
+ export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
5
+ const group = new ctx.THREE.Group();
6
+ void params;
7
+ return { object: group, tick: () => {}, dispose: () => {} };
8
+ };
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "data-columns",
3
+ "kind": "background",
4
+ "tags": {
5
+ "mood": [
6
+ "technical",
7
+ "data"
8
+ ],
9
+ "content": [
10
+ "data",
11
+ "observability"
12
+ ],
13
+ "topic": [
14
+ "data"
15
+ ]
16
+ },
17
+ "cost": 3,
18
+ "modes": "both",
19
+ "params": {
20
+ "columns": {
21
+ "type": "number",
22
+ "default": 24,
23
+ "minimum": 4,
24
+ "maximum": 64
25
+ }
26
+ },
27
+ "conflicts": [],
28
+ "source": "https://threejs.org/examples/",
29
+ "licence": "MIT"
30
+ }
@@ -0,0 +1,18 @@
1
+ import { makeRng } from "../runtime/rng.js";
2
+ import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
3
+
4
+ /** Permissive port of a three.js example (see the card's source). */
5
+ export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
6
+ const { THREE, palette } = ctx;
7
+ const n = Math.max(32, Math.round(ctx.quality.particles / 3));
8
+ const rnd = makeRng(84);
9
+ const positions = new Float32Array(n * 3);
10
+ for (let i = 0; i < n * 3; i++) positions[i] = (rnd() - 0.5) * 30;
11
+ const geo = new THREE.BufferGeometry();
12
+ geo.setAttribute("position", new THREE.BufferAttribute(positions, 3));
13
+ const points = new THREE.Points(geo, new THREE.PointsMaterial({ color: palette.second, size: 0.08, transparent: true, opacity: 0.8 }));
14
+ const group = new THREE.Group();
15
+ group.add(points);
16
+ const speed = typeof params.speed === "number" ? params.speed : 0.2;
17
+ return { object: group, tick: (t) => { group.rotation.y = t * speed * 0.1; }, dispose: () => geo.dispose() };
18
+ };
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Deterministic default effects (design D9 + D3 / spec deck3d-effects).
3
+ *
4
+ * Same markdown ⇒ same list. The v1 precedence is kept as a strict prefix —
5
+ * keyword table, then title-ish, then harvested diagram kind — and a topic step
6
+ * is inserted exactly where v1 fell through to `particles`, so the only slides
7
+ * whose background changes are the ones that were on the generic fallback.
8
+ */
9
+ import type { Diagram, EffectRef } from "../ir/types.js";
10
+ import { REGISTRY } from "./index.js";
11
+ import type { FxTopic } from "./types.js";
12
+
13
+ export interface DefaultEffectInput {
14
+ id: string;
15
+ title: string;
16
+ bullets: string[];
17
+ diagram: Diagram;
18
+ kind?: string;
19
+ }
20
+
21
+ /** Keyword → background override (checked in order, first match wins). */
22
+ const KEYWORDS: Array<{ re: RegExp; background: string }> = [
23
+ { re: /security|biztons|auth|secur/i, background: "glyph-rain" },
24
+ { re: /data|adat|metric|observab|telemetr/i, background: "data-columns" },
25
+ ];
26
+
27
+ /**
28
+ * Harvested diagram kind → background (+ optional edge). Only the two kinds
29
+ * that come from a mermaid block: a BUILT kind (`brain`, `bars`, …) picks its
30
+ * scenery through the topic step instead, so object and background are chosen
31
+ * independently.
32
+ */
33
+ const BY_DIAGRAM: Record<string, { background: string; edge?: string }> = {
34
+ flowchart: { background: "tokens", edge: "signal-pulse" },
35
+ sequence: { background: "rings", edge: "signal-pulse" },
36
+ };
37
+
38
+ /** Ordered topic keyword table (first match wins), evaluated on title + bullets. */
39
+ const TOPIC_KEYWORDS: Array<{ topic: FxTopic; re: RegExp }> = [
40
+ { topic: "security", re: /\b(security|secure|auth\w*|encrypt\w*|threat|vulnerab\w*)\b/i },
41
+ { topic: "trust", re: /\b(trust|compliance|governance|audit\w*|privacy|trans?parenc\w*)\b/i },
42
+ { topic: "agents", re: /\b(agents?|swarm|autonom\w*|copilots?)\b/i },
43
+ { topic: "ai", re: /\b(ai|llm|models?|intelligence|inference|prompt\w*)\b/i },
44
+ { topic: "geo", re: /\b(global|regions?|regional|geo\w*|trade|countr\w*|worldwide)\b/i },
45
+ { topic: "compute", re: /\b(compute|infra\w*|cloud|servers?|gpus?|cluster\w*|layers?)\b/i },
46
+ { topic: "money", re: /\b(revenue|costs?|pricing|price|budget|margin|profit|finance|funding)\b/i },
47
+ { topic: "sales", re: /\b(sales|pipeline|deals?|customers?|churn|renewals?|quota)\b/i },
48
+ { topic: "work", re: /\b(teams?|people|workforce|hiring|talent|employees?|culture)\b/i },
49
+ { topic: "timeline", re: /\b(timeline|road ?map|quarters?|milestones?|phases?)\b/i },
50
+ { topic: "data", re: /\b(dashboards?|analytics?|reporting|insights?)\b/i },
51
+ { topic: "process", re: /\b(process\w*|workflows?|handoffs?|cycles?|loops?|steps?)\b/i },
52
+ ];
53
+
54
+ const FALLBACK: { background: string; edge?: string } = { background: "particles" };
55
+
56
+ /** Cheapest `background` card carrying `topic`; ties resolve by id. */
57
+ export function backgroundForTopic(topic: FxTopic): string | undefined {
58
+ return Object.values(REGISTRY)
59
+ .filter((e) => e.card.kind === "background" && e.card.tags.topic?.includes(topic))
60
+ .sort((a, b) => a.card.cost - b.card.cost || a.card.id.localeCompare(b.card.id))[0]?.card.id;
61
+ }
62
+
63
+ function topicBackground(text: string): string | undefined {
64
+ for (const row of TOPIC_KEYWORDS) {
65
+ if (!row.re.test(text)) continue;
66
+ const id = backgroundForTopic(row.topic);
67
+ if (id) return id;
68
+ }
69
+ return undefined;
70
+ }
71
+
72
+ export function defaultEffectsFor(slide: DefaultEffectInput, autoStyle = true): EffectRef[] {
73
+ const text = `${slide.title} ${slide.bullets.join(" ")}`;
74
+ const byKind = BY_DIAGRAM[slide.diagram.kind] ?? FALLBACK;
75
+ const keyword = KEYWORDS.find((k) => k.re.test(text));
76
+ const isTitleish = slide.diagram.kind === "none" && slide.bullets.length === 0 && !slide.id.includes("-");
77
+
78
+ let background = keyword?.background;
79
+ if (!background && isTitleish) background = "swarm";
80
+ if (!background && BY_DIAGRAM[slide.diagram.kind]) background = byKind.background;
81
+ if (!background && autoStyle) background = topicBackground(text);
82
+ background ??= FALLBACK.background;
83
+
84
+ const out: EffectRef[] = [{ id: background }];
85
+ if (byKind.edge) out.push({ id: byKind.edge });
86
+ return out;
87
+ }
88
+
89
+ /** The background effect id used to seed the runtime scene (fallback path). */
90
+ export function defaultSceneFor(slide: DefaultEffectInput, autoStyle = true): string {
91
+ return defaultEffectsFor(slide, autoStyle)[0]?.id ?? "particles";
92
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "depth-of-field",
3
+ "kind": "post",
4
+ "tags": {
5
+ "mood": [
6
+ "cinematic",
7
+ "premium"
8
+ ],
9
+ "content": [
10
+ "focus"
11
+ ]
12
+ },
13
+ "cost": 3,
14
+ "modes": "both",
15
+ "params": {
16
+ "focus": {
17
+ "type": "number",
18
+ "default": 0,
19
+ "minimum": 0,
20
+ "maximum": 60
21
+ },
22
+ "aperture": {
23
+ "type": "number",
24
+ "default": 1,
25
+ "minimum": 0,
26
+ "maximum": 4
27
+ },
28
+ "blur": {
29
+ "type": "number",
30
+ "default": 1,
31
+ "minimum": 0,
32
+ "maximum": 3
33
+ }
34
+ },
35
+ "conflicts": [
36
+ "god-rays"
37
+ ],
38
+ "source": "https://github.com/pmndrs/postprocessing",
39
+ "licence": "Zlib"
40
+ }
@@ -0,0 +1,4 @@
1
+ import type { FxFactory, FxHandle } from "./types.js";
2
+
3
+ /** Post pass marker; the runtime composer owns the actual pass stack. */
4
+ export const create: FxFactory = (): FxHandle => ({ pass: "depth-of-field", dispose: () => {} });
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "dolly",
3
+ "kind": "transition",
4
+ "tags": {
5
+ "mood": [
6
+ "cinematic",
7
+ "calm"
8
+ ],
9
+ "content": [
10
+ "motion"
11
+ ]
12
+ },
13
+ "cost": 1,
14
+ "modes": "both",
15
+ "params": {
16
+ "intensity": {
17
+ "type": "number",
18
+ "default": 1,
19
+ "minimum": 0,
20
+ "maximum": 2
21
+ }
22
+ },
23
+ "conflicts": [],
24
+ "source": "https://threejs.org/examples/",
25
+ "licence": "MIT"
26
+ }
@@ -0,0 +1,4 @@
1
+ import type { FxFactory, FxHandle } from "./types.js";
2
+
3
+ /** Transition id; the runtime camera picks the matching interpolation. */
4
+ export const create: FxFactory = (): FxHandle => ({ pass: "transition:dolly", dispose: () => {} });
@@ -0,0 +1,35 @@
1
+ {
2
+ "id": "dot-screen",
3
+ "kind": "post",
4
+ "tags": {
5
+ "mood": [
6
+ "retro",
7
+ "print"
8
+ ],
9
+ "content": [
10
+ "stylised",
11
+ "halftone"
12
+ ]
13
+ },
14
+ "cost": 1,
15
+ "modes": "both",
16
+ "params": {
17
+ "scale": {
18
+ "type": "number",
19
+ "default": 1.2,
20
+ "minimum": 0.2,
21
+ "maximum": 4
22
+ },
23
+ "angle": {
24
+ "type": "number",
25
+ "default": 1.57,
26
+ "minimum": 0,
27
+ "maximum": 3.1416
28
+ }
29
+ },
30
+ "conflicts": [
31
+ "sobel"
32
+ ],
33
+ "source": "https://github.com/mrdoob/three.js",
34
+ "licence": "MIT"
35
+ }
@@ -0,0 +1,4 @@
1
+ import type { FxFactory, FxHandle } from "./types.js";
2
+
3
+ /** Post pass marker; the runtime post stack (`runtime/post.ts`) owns the actual pass. */
4
+ export const create: FxFactory = (): FxHandle => ({ pass: "dot-screen", dispose: () => {} });
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "dynamic-instances",
3
+ "kind": "background",
4
+ "tags": {
5
+ "mood": [
6
+ "technical",
7
+ "kinetic"
8
+ ],
9
+ "content": [
10
+ "grid",
11
+ "cubes",
12
+ "matrix"
13
+ ]
14
+ },
15
+ "cost": 2,
16
+ "modes": "both",
17
+ "params": {
18
+ "density": {
19
+ "type": "number",
20
+ "default": 1,
21
+ "minimum": 0.2,
22
+ "maximum": 3
23
+ },
24
+ "spin": {
25
+ "type": "number",
26
+ "default": 1,
27
+ "minimum": 0,
28
+ "maximum": 3
29
+ },
30
+ "gap": {
31
+ "type": "number",
32
+ "default": 1.3,
33
+ "minimum": 0.6,
34
+ "maximum": 2.5
35
+ }
36
+ },
37
+ "conflicts": [],
38
+ "source": "https://threejs.org/examples/#webgl_instancing_dynamic",
39
+ "licence": "MIT"
40
+ }
@@ -0,0 +1,57 @@
1
+ import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
2
+ import { countFor, num } from "./util.js";
3
+
4
+ /**
5
+ * A cube of cubes, each turning on its own phase (three
6
+ * `webgl_instancing_dynamic`). Pure function of `t`: no accumulated state.
7
+ */
8
+ export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
9
+ const { THREE, palette, rng } = ctx;
10
+ const side = Math.max(3, Math.round(Math.cbrt(countFor(ctx, 2, num(params, "density", 1), 27))));
11
+ const count = side ** 3;
12
+ const spin = num(params, "spin", 1);
13
+ const gap = num(params, "gap", 1.3);
14
+
15
+ const geo = new THREE.BoxGeometry(0.42, 0.42, 0.42);
16
+ const mat = new THREE.MeshStandardMaterial({ color: palette.second, metalness: 0.55, roughness: 0.4 });
17
+ const mesh = new THREE.InstancedMesh(geo, mat, count);
18
+ const phases = new Float32Array(count);
19
+ for (let i = 0; i < count; i++) phases[i] = rng() * 6.28;
20
+
21
+ const group = new THREE.Group();
22
+ group.add(mesh);
23
+ group.position.z = -14;
24
+ const holder = new THREE.Group();
25
+ holder.add(group);
26
+ holder.userData.count = count;
27
+
28
+ const m = new THREE.Matrix4();
29
+ const e = new THREE.Euler();
30
+ const q = new THREE.Quaternion();
31
+ const p = new THREE.Vector3();
32
+ const one = new THREE.Vector3(1, 1, 1);
33
+ const off = (side - 1) / 2;
34
+ return {
35
+ object: holder,
36
+ tick: (t) => {
37
+ let i = 0;
38
+ for (let x = 0; x < side; x++) {
39
+ for (let y = 0; y < side; y++) {
40
+ for (let z = 0; z < side; z++) {
41
+ const ph = phases[i];
42
+ e.set(Math.sin(x / 4 + t * spin + ph), Math.sin(y / 4 + t * spin), Math.sin(z / 4 + t * spin));
43
+ q.setFromEuler(e);
44
+ p.set((x - off) * gap, (y - off) * gap, (z - off) * gap);
45
+ mesh.setMatrixAt(i++, m.compose(p, q, one));
46
+ }
47
+ }
48
+ }
49
+ mesh.instanceMatrix.needsUpdate = true;
50
+ group.rotation.y = t * 0.05 * spin;
51
+ },
52
+ dispose: () => {
53
+ geo.dispose();
54
+ mat.dispose();
55
+ },
56
+ };
57
+ };
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "emissive",
3
+ "kind": "material",
4
+ "tags": {
5
+ "mood": [
6
+ "dramatic",
7
+ "neon"
8
+ ],
9
+ "content": [
10
+ "highlight"
11
+ ]
12
+ },
13
+ "cost": 1,
14
+ "modes": "both",
15
+ "params": {
16
+ "intensity": {
17
+ "type": "number",
18
+ "default": 1,
19
+ "minimum": 0,
20
+ "maximum": 2
21
+ }
22
+ },
23
+ "conflicts": [],
24
+ "source": "https://threejs.org/examples/",
25
+ "licence": "MIT"
26
+ }
@@ -0,0 +1,8 @@
1
+ import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
2
+
3
+ /** Permissive port of a three.js example. */
4
+ export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
5
+ const mat = new ctx.THREE.MeshStandardMaterial({ color: ctx.palette.accent, metalness: 0.8, roughness: 0.3 });
6
+ void params;
7
+ return { material: mat, dispose: () => mat.dispose() };
8
+ };
@@ -0,0 +1,62 @@
1
+ {
2
+ "id": "extruded-shapes",
3
+ "kind": "background",
4
+ "tags": {
5
+ "mood": [
6
+ "playful",
7
+ "bold"
8
+ ],
9
+ "content": [
10
+ "shapes",
11
+ "brand",
12
+ "icons"
13
+ ]
14
+ },
15
+ "cost": 2,
16
+ "modes": "both",
17
+ "params": {
18
+ "density": {
19
+ "type": "number",
20
+ "default": 1,
21
+ "minimum": 0.2,
22
+ "maximum": 3
23
+ },
24
+ "shape": {
25
+ "type": "string",
26
+ "default": "star",
27
+ "enum": [
28
+ "star",
29
+ "gear",
30
+ "rose",
31
+ "heart",
32
+ "superformula",
33
+ "arrow"
34
+ ]
35
+ },
36
+ "lobes": {
37
+ "type": "number",
38
+ "default": 5,
39
+ "minimum": 3,
40
+ "maximum": 12
41
+ },
42
+ "svgPath": {
43
+ "type": "string",
44
+ "default": ""
45
+ },
46
+ "depth": {
47
+ "type": "number",
48
+ "default": 0.35,
49
+ "minimum": 0.05,
50
+ "maximum": 1.5
51
+ },
52
+ "spin": {
53
+ "type": "number",
54
+ "default": 1,
55
+ "minimum": 0,
56
+ "maximum": 3
57
+ }
58
+ },
59
+ "conflicts": [],
60
+ "source": "https://threejs.org/examples/#webgl_geometry_extrude_shapes",
61
+ "licence": "MIT"
62
+ }