@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.
- package/.pi/skills/deck3d/SKILL.md +227 -0
- package/.pi/skills/deck3d/examples/deck.json +388 -0
- package/.pi/skills/deck3d/examples/fixture.md +18 -0
- package/.pi/skills/deck3d/examples/snapshot-after.png +0 -0
- package/.pi/skills/deck3d/examples/snapshot-before.png +0 -0
- package/.pi/skills/deck3d/reference/effects.agent.md +78 -0
- package/.pi/skills/deck3d/reference/effects.md +1217 -0
- package/.pi/skills/deck3d/reference/ir-fields.agent.md +30 -0
- package/.pi/skills/deck3d/reference/ir-fields.md +246 -0
- package/README.md +177 -2
- package/assets/LICENSE-Poppins.txt +99 -0
- package/assets/Poppins-Bold.ttf +0 -0
- package/assets/props/LICENSES.txt +4 -0
- package/assets/props/brain.glb +0 -0
- package/assets/props/cloud.glb +0 -0
- package/assets/props/cube.glb +0 -0
- package/assets/props/database.glb +0 -0
- package/assets/props/laptop.glb +0 -0
- package/assets/props/manifest.json +119 -0
- package/assets/props/robot.glb +0 -0
- package/assets/props/server.glb +0 -0
- package/assets/props/shield.glb +0 -0
- package/bin/deck3d +49 -0
- package/dist/cli.js +10228 -0
- package/dist/harvest/harness.js +185718 -0
- package/dist/runtime.js +64597 -0
- package/fixtures/business-2031/build-deck.mjs +60 -0
- package/fixtures/business-2031/build-overrides.mjs +154 -0
- package/fixtures/business-2031/deck.json +4220 -0
- package/fixtures/business-2031/deck.md +470 -0
- package/fixtures/business-2031/fx/closing-mark.js +43 -0
- package/fixtures/business-2031/fx/closing-mark.meta.json +26 -0
- package/fixtures/business-2031/overrides.json +903 -0
- package/fixtures/harvest.md +23 -0
- package/fixtures/strategy-lab.json +891 -0
- package/fixtures/strategy-lab.md +85 -0
- package/package.json +80 -4
- package/scripts/build-cli.mjs +29 -0
- package/scripts/build-harvest.ts +8 -0
- package/scripts/build-runtime.mjs +22 -0
- package/scripts/gen-effects.ts +14 -0
- package/scripts/gen-ir-fields.ts +34 -0
- package/src/check/index.ts +315 -0
- package/src/check/rules.ts +393 -0
- package/src/cli-io.ts +23 -0
- package/src/cli.ts +823 -0
- package/src/fx/accent-cycle.meta.json +26 -0
- package/src/fx/accent-cycle.ts +8 -0
- package/src/fx/agent-depth.meta.json +42 -0
- package/src/fx/agent-depth.ts +62 -0
- package/src/fx/ascii.meta.json +35 -0
- package/src/fx/ascii.ts +4 -0
- package/src/fx/aurora.meta.json +26 -0
- package/src/fx/aurora.ts +18 -0
- package/src/fx/billboards.meta.json +34 -0
- package/src/fx/billboards.ts +67 -0
- package/src/fx/bloom.meta.json +26 -0
- package/src/fx/bloom.ts +4 -0
- package/src/fx/camera-drift.meta.json +26 -0
- package/src/fx/camera-drift.ts +8 -0
- package/src/fx/capital-flows.meta.json +30 -0
- package/src/fx/capital-flows.ts +64 -0
- package/src/fx/catalogue.ts +89 -0
- package/src/fx/chromatic-aberration.meta.json +32 -0
- package/src/fx/chromatic-aberration.ts +4 -0
- package/src/fx/city-grid.meta.json +37 -0
- package/src/fx/city-grid.ts +51 -0
- package/src/fx/clipped-solids.meta.json +49 -0
- package/src/fx/clipped-solids.ts +171 -0
- package/src/fx/cohort-grid.meta.json +48 -0
- package/src/fx/cohort-grid.ts +63 -0
- package/src/fx/compose.ts +114 -0
- package/src/fx/constellation.meta.json +51 -0
- package/src/fx/constellation.ts +103 -0
- package/src/fx/curve-flow.meta.json +40 -0
- package/src/fx/curve-flow.ts +63 -0
- package/src/fx/dashed-flow.meta.json +27 -0
- package/src/fx/dashed-flow.ts +8 -0
- package/src/fx/data-columns.meta.json +30 -0
- package/src/fx/data-columns.ts +18 -0
- package/src/fx/defaults.ts +92 -0
- package/src/fx/depth-of-field.meta.json +40 -0
- package/src/fx/depth-of-field.ts +4 -0
- package/src/fx/dolly.meta.json +26 -0
- package/src/fx/dolly.ts +4 -0
- package/src/fx/dot-screen.meta.json +35 -0
- package/src/fx/dot-screen.ts +4 -0
- package/src/fx/dynamic-instances.meta.json +40 -0
- package/src/fx/dynamic-instances.ts +57 -0
- package/src/fx/emissive.meta.json +26 -0
- package/src/fx/emissive.ts +8 -0
- package/src/fx/extruded-shapes.meta.json +62 -0
- package/src/fx/extruded-shapes.ts +133 -0
- package/src/fx/fab-wafer.meta.json +42 -0
- package/src/fx/fab-wafer.ts +72 -0
- package/src/fx/fade.meta.json +26 -0
- package/src/fx/fade.ts +4 -0
- package/src/fx/film.meta.json +26 -0
- package/src/fx/film.ts +4 -0
- package/src/fx/float.meta.json +26 -0
- package/src/fx/float.ts +8 -0
- package/src/fx/flythrough.meta.json +26 -0
- package/src/fx/flythrough.ts +4 -0
- package/src/fx/fog.meta.json +26 -0
- package/src/fx/fog.ts +8 -0
- package/src/fx/geo-fragments.meta.json +48 -0
- package/src/fx/geo-fragments.ts +59 -0
- package/src/fx/glass.meta.json +26 -0
- package/src/fx/glass.ts +8 -0
- package/src/fx/globe-arcs.meta.json +36 -0
- package/src/fx/globe-arcs.ts +67 -0
- package/src/fx/glow-tube.meta.json +26 -0
- package/src/fx/glow-tube.ts +8 -0
- package/src/fx/glyph-rain.meta.json +30 -0
- package/src/fx/glyph-rain.ts +18 -0
- package/src/fx/god-rays.meta.json +40 -0
- package/src/fx/god-rays.ts +4 -0
- package/src/fx/grid-horizon.meta.json +30 -0
- package/src/fx/grid-horizon.ts +18 -0
- package/src/fx/hex-grid.meta.json +29 -0
- package/src/fx/hex-grid.ts +18 -0
- package/src/fx/holo-fresnel.meta.json +26 -0
- package/src/fx/holo-fresnel.ts +8 -0
- package/src/fx/horizon-gates.meta.json +36 -0
- package/src/fx/horizon-gates.ts +60 -0
- package/src/fx/index.ts +258 -0
- package/src/fx/iridescent.meta.json +26 -0
- package/src/fx/iridescent.ts +8 -0
- package/src/fx/iris.meta.json +26 -0
- package/src/fx/iris.ts +4 -0
- package/src/fx/lightformers.meta.json +26 -0
- package/src/fx/lightformers.ts +8 -0
- package/src/fx/local.ts +200 -0
- package/src/fx/market-tape.meta.json +53 -0
- package/src/fx/market-tape.ts +97 -0
- package/src/fx/matcap.meta.json +26 -0
- package/src/fx/matcap.ts +8 -0
- package/src/fx/meta.schema.json +49 -0
- package/src/fx/metal.meta.json +26 -0
- package/src/fx/metal.ts +8 -0
- package/src/fx/mirror-floor.meta.json +26 -0
- package/src/fx/mirror-floor.ts +8 -0
- package/src/fx/neural-mesh.meta.json +54 -0
- package/src/fx/neural-mesh.ts +110 -0
- package/src/fx/orbit-agents.meta.json +36 -0
- package/src/fx/orbit-agents.ts +63 -0
- package/src/fx/orbit.meta.json +27 -0
- package/src/fx/orbit.ts +8 -0
- package/src/fx/outline.meta.json +43 -0
- package/src/fx/outline.ts +4 -0
- package/src/fx/paper-stack.meta.json +36 -0
- package/src/fx/paper-stack.ts +61 -0
- package/src/fx/particle-stream.meta.json +27 -0
- package/src/fx/particle-stream.ts +8 -0
- package/src/fx/particles.meta.json +26 -0
- package/src/fx/particles.ts +8 -0
- package/src/fx/pixelate.meta.json +28 -0
- package/src/fx/pixelate.ts +4 -0
- package/src/fx/points-on-geometry.meta.json +61 -0
- package/src/fx/points-on-geometry.ts +71 -0
- package/src/fx/proof-gate.meta.json +30 -0
- package/src/fx/proof-gate.ts +67 -0
- package/src/fx/rings.meta.json +27 -0
- package/src/fx/rings.ts +8 -0
- package/src/fx/room-ibl.meta.json +26 -0
- package/src/fx/room-ibl.ts +8 -0
- package/src/fx/sao.meta.json +32 -0
- package/src/fx/sao.ts +4 -0
- package/src/fx/scaffold.ts +172 -0
- package/src/fx/scatter.meta.json +49 -0
- package/src/fx/scatter.ts +74 -0
- package/src/fx/selective-bloom.meta.json +36 -0
- package/src/fx/selective-bloom.ts +4 -0
- package/src/fx/server-racks.meta.json +36 -0
- package/src/fx/server-racks.ts +54 -0
- package/src/fx/shader-particles.meta.json +46 -0
- package/src/fx/shader-particles.ts +75 -0
- package/src/fx/signal-pulse.meta.json +27 -0
- package/src/fx/signal-pulse.ts +8 -0
- package/src/fx/smaa.meta.json +19 -0
- package/src/fx/smaa.ts +4 -0
- package/src/fx/sobel.meta.json +24 -0
- package/src/fx/sobel.ts +4 -0
- package/src/fx/soft-shadows.meta.json +26 -0
- package/src/fx/soft-shadows.ts +8 -0
- package/src/fx/sprites.meta.json +40 -0
- package/src/fx/sprites.ts +57 -0
- package/src/fx/stagger-reveal.meta.json +26 -0
- package/src/fx/stagger-reveal.ts +8 -0
- package/src/fx/starfield.meta.json +32 -0
- package/src/fx/starfield.ts +18 -0
- package/src/fx/swarm.meta.json +27 -0
- package/src/fx/swarm.ts +8 -0
- package/src/fx/tessellate.meta.json +39 -0
- package/src/fx/tessellate.ts +79 -0
- package/src/fx/tokens.meta.json +27 -0
- package/src/fx/tokens.ts +8 -0
- package/src/fx/trail.meta.json +27 -0
- package/src/fx/trail.ts +8 -0
- package/src/fx/trust-ledger.meta.json +30 -0
- package/src/fx/trust-ledger.ts +47 -0
- package/src/fx/types.ts +83 -0
- package/src/fx/util.ts +108 -0
- package/src/fx/vault-glyphs.meta.json +37 -0
- package/src/fx/vault-glyphs.ts +55 -0
- package/src/fx/video-screen.meta.json +57 -0
- package/src/fx/video-screen.ts +99 -0
- package/src/fx/vignette.meta.json +32 -0
- package/src/fx/vignette.ts +4 -0
- package/src/fx/volume-cloud.meta.json +58 -0
- package/src/fx/volume-cloud.ts +87 -0
- package/src/fx/volume-perlin.meta.json +46 -0
- package/src/fx/volume-perlin.ts +82 -0
- package/src/fx/volumetric-spot.meta.json +26 -0
- package/src/fx/volumetric-spot.ts +8 -0
- package/src/fx/wireframe-overlay.meta.json +27 -0
- package/src/fx/wireframe-overlay.ts +8 -0
- package/src/ir/defaults.ts +62 -0
- package/src/ir/field-reference.ts +96 -0
- package/src/ir/hash.ts +34 -0
- package/src/ir/ids.ts +65 -0
- package/src/ir/merge.ts +155 -0
- package/src/ir/schema.json +1211 -0
- package/src/ir/types.ts +333 -0
- package/src/ir/validate.ts +196 -0
- package/src/parse/derive.ts +205 -0
- package/src/parse/harvest/bundle.ts +56 -0
- package/src/parse/harvest/harness.html +22 -0
- package/src/parse/harvest/harness.ts +191 -0
- package/src/parse/harvest/index.ts +169 -0
- package/src/parse/harvest/shapes.ts +75 -0
- package/src/parse/markdown.ts +215 -0
- package/src/props/embed.ts +92 -0
- package/src/props/fetch.ts +97 -0
- package/src/props/generate.ts +152 -0
- package/src/props/key.ts +13 -0
- package/src/props/search.ts +180 -0
- package/src/render/embed-video.ts +80 -0
- package/src/render/font.ts +86 -0
- package/src/render/index.ts +149 -0
- package/src/render/template.html +87 -0
- package/src/runtime/backgrounds.ts +146 -0
- package/src/runtime/builders.ts +808 -0
- package/src/runtime/camera.ts +73 -0
- package/src/runtime/hud.ts +887 -0
- package/src/runtime/index.ts +1168 -0
- package/src/runtime/local-fx.ts +151 -0
- package/src/runtime/materials.ts +136 -0
- package/src/runtime/measure.ts +73 -0
- package/src/runtime/node-geometry.ts +26 -0
- package/src/runtime/palette.ts +111 -0
- package/src/runtime/post.ts +649 -0
- package/src/runtime/props.ts +292 -0
- package/src/runtime/quality.ts +20 -0
- package/src/runtime/rng.ts +8 -0
- package/src/runtime/scene.ts +644 -0
- package/src/runtime/text.ts +174 -0
- package/src/runtime/types.ts +118 -0
- package/src/serve/index.ts +376 -0
- package/src/util/paths.ts +35 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "iris",
|
|
3
|
+
"kind": "transition",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"cinematic",
|
|
7
|
+
"dramatic"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"motion"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 2,
|
|
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
|
+
}
|
package/src/fx/iris.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "lightformers",
|
|
3
|
+
"kind": "light",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"premium",
|
|
7
|
+
"cinematic"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"staging"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 2,
|
|
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://github.com/pmndrs/drei",
|
|
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 light = new ctx.THREE.PointLight(ctx.palette.accent, 1, 30);
|
|
6
|
+
void params;
|
|
7
|
+
return { object: light, dispose: () => light.dispose?.() };
|
|
8
|
+
};
|
package/src/fx/local.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local (per-deck) effects — design D1.
|
|
3
|
+
*
|
|
4
|
+
* An agent may author an effect for one deck as `fx/<name>.js` + a sibling
|
|
5
|
+
* `fx/<name>.meta.json` card beside `deck.json`. It reaches the render only
|
|
6
|
+
* through a `sha256` pinned in `overrides`, exactly like a fetched prop: the
|
|
7
|
+
* bytes are the contract, so `render` stays byte-deterministic.
|
|
8
|
+
*
|
|
9
|
+
* Everything here is a resolver + linter. Instantiation (shadowed globals,
|
|
10
|
+
* try/catch) happens in the runtime; `check` measures the result.
|
|
11
|
+
*/
|
|
12
|
+
import { createHash } from "node:crypto";
|
|
13
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import Ajv from "ajv";
|
|
16
|
+
import type { EffectRef } from "../ir/types.js";
|
|
17
|
+
import { pkgRoot } from "../util/paths.js";
|
|
18
|
+
import type { FxCard } from "./types.js";
|
|
19
|
+
|
|
20
|
+
export const LOCAL_PREFIX = "local:";
|
|
21
|
+
export const LOCAL_NAME_RE = /^[a-z][a-z0-9-]{0,63}$/;
|
|
22
|
+
export const LOCAL_MAX_BYTES = 64 * 1024;
|
|
23
|
+
/** `post`/`material`/`light`/`edge`/`transition` need hooks the handle grammar lacks. */
|
|
24
|
+
export const LOCAL_KINDS = ["background", "motion"] as const;
|
|
25
|
+
|
|
26
|
+
/** Identifiers a local module may not name, even unreachable (case-sensitive). */
|
|
27
|
+
const BANNED = ["import", "require", "eval", "Function"] as const;
|
|
28
|
+
|
|
29
|
+
export function isLocalId(id: string): boolean {
|
|
30
|
+
return id.startsWith(LOCAL_PREFIX);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function localName(id: string): string {
|
|
34
|
+
return id.slice(LOCAL_PREFIX.length);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface LocalIssue {
|
|
38
|
+
/** Appended to the caller's override path, e.g. `.sha256`. */
|
|
39
|
+
suffix: string;
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface LocalEffect {
|
|
44
|
+
name: string;
|
|
45
|
+
card: FxCard;
|
|
46
|
+
src: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let compiledCard: ReturnType<Ajv["compile"]> | undefined;
|
|
50
|
+
let cardAjv: Ajv | undefined;
|
|
51
|
+
|
|
52
|
+
function validateCard(card: unknown): { ok: boolean; detail: string } {
|
|
53
|
+
if (!compiledCard) {
|
|
54
|
+
const schema = JSON.parse(readFileSync(join(pkgRoot(), "src", "fx", "meta.schema.json"), "utf8"));
|
|
55
|
+
cardAjv = new Ajv({ allErrors: true });
|
|
56
|
+
compiledCard = cardAjv.compile(schema);
|
|
57
|
+
}
|
|
58
|
+
const ok = compiledCard(card) as boolean;
|
|
59
|
+
return { ok, detail: ok ? "" : (cardAjv?.errorsText(compiledCard.errors) ?? "") };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Source with string literals and comments blanked, for identifier linting. */
|
|
63
|
+
export function stripStringsAndComments(src: string): string {
|
|
64
|
+
let out = "";
|
|
65
|
+
let i = 0;
|
|
66
|
+
while (i < src.length) {
|
|
67
|
+
const c = src[i];
|
|
68
|
+
const next = src[i + 1];
|
|
69
|
+
if (c === "/" && next === "/") {
|
|
70
|
+
while (i < src.length && src[i] !== "\n") i++;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (c === "/" && next === "*") {
|
|
74
|
+
i += 2;
|
|
75
|
+
while (i < src.length && !(src[i] === "*" && src[i + 1] === "/")) i++;
|
|
76
|
+
i += 2;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
80
|
+
const quote = c;
|
|
81
|
+
i++;
|
|
82
|
+
while (i < src.length && src[i] !== quote) i += src[i] === "\\" ? 2 : 1;
|
|
83
|
+
i++;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
out += c;
|
|
87
|
+
i++;
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Module shape (D1): after leading comments/whitespace the first statement is
|
|
94
|
+
* `export default function (ctx, params)`, and there is no other `export`.
|
|
95
|
+
* Anchoring on the prefix is what lets `render` replace it without searching.
|
|
96
|
+
*/
|
|
97
|
+
export function lintModule(src: string): string | undefined {
|
|
98
|
+
const stripped = stripStringsAndComments(src);
|
|
99
|
+
const body = stripped.replace(/^\s+/, "");
|
|
100
|
+
if (!/^export\s+default\s+function\b/.test(body)) {
|
|
101
|
+
return "module must start with `export default function (ctx, params)` (after optional comments)";
|
|
102
|
+
}
|
|
103
|
+
const exports = stripped.match(/\bexport\b/g) ?? [];
|
|
104
|
+
if (exports.length > 1) return "module must have a single default export";
|
|
105
|
+
for (const ident of BANNED) {
|
|
106
|
+
if (new RegExp(`\\b${ident}\\b`).test(body.replace(/^export\s+default\s+/, ""))) {
|
|
107
|
+
return `module must not use \`${ident}\``;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** `export default function` → `return function`, so the source can be `new Function`-ed. */
|
|
114
|
+
export function toFactorySource(src: string): string {
|
|
115
|
+
return src.replace(/export\s+default\s+function/, "return function");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function sha256(bytes: Buffer | string): string {
|
|
119
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface ResolveResult {
|
|
123
|
+
effect?: LocalEffect;
|
|
124
|
+
issues: LocalIssue[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Resolve one `local:` reference against `fx/` in `deckDir`. Every failure is
|
|
129
|
+
* reported against the reference, never thrown, so `validate` can list them all.
|
|
130
|
+
*/
|
|
131
|
+
export function resolveLocalEffect(ref: EffectRef, deckDir: string): ResolveResult {
|
|
132
|
+
const name = localName(ref.id);
|
|
133
|
+
const issues: LocalIssue[] = [];
|
|
134
|
+
if (!LOCAL_NAME_RE.test(name)) {
|
|
135
|
+
return { issues: [{ suffix: ".id", message: `local effect name must match ${LOCAL_NAME_RE.source}` }] };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const rel = `fx/${name}.js`;
|
|
139
|
+
const modulePath = join(deckDir, "fx", `${name}.js`);
|
|
140
|
+
const cardPath = join(deckDir, "fx", `${name}.meta.json`);
|
|
141
|
+
if (!existsSync(modulePath)) return { issues: [{ suffix: "", message: `missing local effect file ${rel}` }] };
|
|
142
|
+
|
|
143
|
+
const bytes = statSync(modulePath).size;
|
|
144
|
+
if (bytes > LOCAL_MAX_BYTES) {
|
|
145
|
+
issues.push({ suffix: "", message: `${rel} is ${bytes} bytes, over the 64 KiB local effect cap` });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const raw = readFileSync(modulePath);
|
|
149
|
+
const actual = sha256(raw);
|
|
150
|
+
// Case-sensitive: an uppercase digest is a mismatch, not a spelling variant.
|
|
151
|
+
if (ref.sha256 !== actual) {
|
|
152
|
+
issues.push({ suffix: ".sha256", message: `sha256 does not match ${rel} (expected ${actual})` });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const lint = lintModule(raw.toString("utf8"));
|
|
156
|
+
if (lint) issues.push({ suffix: "", message: `${rel}: ${lint}` });
|
|
157
|
+
|
|
158
|
+
if (!existsSync(cardPath)) {
|
|
159
|
+
issues.push({ suffix: "", message: `missing local effect card fx/${name}.meta.json` });
|
|
160
|
+
return { issues };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
let card: FxCard;
|
|
164
|
+
try {
|
|
165
|
+
card = JSON.parse(readFileSync(cardPath, "utf8")) as FxCard;
|
|
166
|
+
} catch (err) {
|
|
167
|
+
issues.push({ suffix: "", message: `fx/${name}.meta.json: invalid JSON (${(err as Error).message})` });
|
|
168
|
+
return { issues };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const verdict = validateCard(card);
|
|
172
|
+
if (!verdict.ok) {
|
|
173
|
+
issues.push({ suffix: "", message: `fx/${name}.meta.json: invalid card (${verdict.detail})` });
|
|
174
|
+
} else if (!(LOCAL_KINDS as readonly string[]).includes(card.kind)) {
|
|
175
|
+
issues.push({
|
|
176
|
+
suffix: "",
|
|
177
|
+
message: `fx/${name}.meta.json: kind '${card.kind}' is not allowed for a local effect (one of ${LOCAL_KINDS.join(", ")})`,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (issues.length) return { issues };
|
|
182
|
+
return { effect: { name, card, src: raw.toString("utf8") }, issues };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Every `local:` reference in the IR, with the override path that named it. */
|
|
186
|
+
export function localRefs(overrides: {
|
|
187
|
+
effects?: EffectRef[];
|
|
188
|
+
slides?: Record<string, { effects?: EffectRef[] }>;
|
|
189
|
+
}): Array<{ ref: EffectRef; path: string }> {
|
|
190
|
+
const out: Array<{ ref: EffectRef; path: string }> = [];
|
|
191
|
+
(overrides.effects ?? []).forEach((ref, i) => {
|
|
192
|
+
if (isLocalId(ref.id)) out.push({ ref, path: `overrides.effects[${i}]` });
|
|
193
|
+
});
|
|
194
|
+
for (const [slideId, slide] of Object.entries(overrides.slides ?? {})) {
|
|
195
|
+
(slide.effects ?? []).forEach((ref, i) => {
|
|
196
|
+
if (isLocalId(ref.id)) out.push({ ref, path: `overrides.slides["${slideId}"].effects[${i}]` });
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return out;
|
|
200
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "market-tape",
|
|
3
|
+
"kind": "background",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"energetic",
|
|
7
|
+
"commercial"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"metrics",
|
|
11
|
+
"finance"
|
|
12
|
+
],
|
|
13
|
+
"topic": [
|
|
14
|
+
"money",
|
|
15
|
+
"data"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"cost": 2,
|
|
19
|
+
"modes": "both",
|
|
20
|
+
"params": {
|
|
21
|
+
"density": {
|
|
22
|
+
"type": "number",
|
|
23
|
+
"default": 1,
|
|
24
|
+
"minimum": 0.2,
|
|
25
|
+
"maximum": 3
|
|
26
|
+
},
|
|
27
|
+
"speed": {
|
|
28
|
+
"type": "number",
|
|
29
|
+
"default": 0.4,
|
|
30
|
+
"minimum": 0,
|
|
31
|
+
"maximum": 3
|
|
32
|
+
},
|
|
33
|
+
"barWidth": {
|
|
34
|
+
"type": "number",
|
|
35
|
+
"default": 0.06,
|
|
36
|
+
"minimum": 0.02,
|
|
37
|
+
"maximum": 0.4
|
|
38
|
+
},
|
|
39
|
+
"volatility": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"default": 0.45,
|
|
42
|
+
"minimum": 0,
|
|
43
|
+
"maximum": 1
|
|
44
|
+
},
|
|
45
|
+
"trace": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"default": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"conflicts": [],
|
|
51
|
+
"source": "https://threejs.org/examples/#webgl_instancing_performance",
|
|
52
|
+
"licence": "MIT"
|
|
53
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
2
|
+
|
|
3
|
+
/** Scrolling ticker bands with a candlestick ridge (topics: money, data). */
|
|
4
|
+
export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
|
|
5
|
+
const { THREE, palette, quality, rng } = ctx;
|
|
6
|
+
const density = typeof params.density === "number" ? params.density : 1;
|
|
7
|
+
// Default speed is 0.4, not 1: as a ticker this scrolled fast enough to pull
|
|
8
|
+
// the eye off the slide text.
|
|
9
|
+
const speed = typeof params.speed === "number" ? params.speed : 0.4;
|
|
10
|
+
const barWidth = typeof params.barWidth === "number" ? params.barWidth : 0.06;
|
|
11
|
+
const volatility = typeof params.volatility === "number" ? params.volatility : 0.45;
|
|
12
|
+
const trace = params.trace !== false;
|
|
13
|
+
const count = Math.max(20, Math.round((quality.particles / 10) * density));
|
|
14
|
+
|
|
15
|
+
// Thin box, not a Line: a real line ignores width on most GPUs, and these
|
|
16
|
+
// still need to catch the key light so the ridge reads as a chart.
|
|
17
|
+
const barGeo = new THREE.BoxGeometry(barWidth, 1, barWidth);
|
|
18
|
+
const barMat = new THREE.MeshStandardMaterial({ color: palette.accent, metalness: 0.4, roughness: 0.5, transparent: true, opacity: 0.8 });
|
|
19
|
+
const bars = new THREE.InstancedMesh(barGeo, barMat, count);
|
|
20
|
+
|
|
21
|
+
const m = new THREE.Matrix4();
|
|
22
|
+
const rows = 3;
|
|
23
|
+
const seeds = Array.from({ length: count }, (_, i) => ({
|
|
24
|
+
h: 0.5 + rng() * 4,
|
|
25
|
+
row: i % rows,
|
|
26
|
+
x0: ((i / count) * 2 - 1) * 26,
|
|
27
|
+
// Per-bar phase and rate, so the series moves like quotes rather than a wave.
|
|
28
|
+
ph: rng() * Math.PI * 2,
|
|
29
|
+
rate: 0.6 + rng() * 1.1,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const group = new THREE.Group();
|
|
33
|
+
group.add(bars);
|
|
34
|
+
|
|
35
|
+
// Polyline joining the bar tops — the "line chart" read.
|
|
36
|
+
const traceGeo = new THREE.BufferGeometry();
|
|
37
|
+
// 6 floats per segment (two endpoints), one segment per bar: an undersized
|
|
38
|
+
// buffer truncates the polyline and the unwritten tail collapses to the
|
|
39
|
+
// origin, drawing spokes across the slide.
|
|
40
|
+
const tracePos = new Float32Array(count * 6);
|
|
41
|
+
traceGeo.setAttribute("position", new THREE.BufferAttribute(tracePos, 3));
|
|
42
|
+
const traceMat = new THREE.LineBasicMaterial({ color: palette.second, transparent: true, opacity: 0.55 });
|
|
43
|
+
const traceLine = new THREE.LineSegments(traceGeo, traceMat);
|
|
44
|
+
if (trace) group.add(traceLine);
|
|
45
|
+
|
|
46
|
+
const holder = new THREE.Group();
|
|
47
|
+
holder.add(group);
|
|
48
|
+
holder.userData.count = count;
|
|
49
|
+
|
|
50
|
+
const baseY = (row: number): number => -4 + row * 4.2;
|
|
51
|
+
const place = (t: number): void => {
|
|
52
|
+
// Sorted per row so the trace connects left-to-right neighbours, not the
|
|
53
|
+
// arbitrary seed order (which would draw a scribble).
|
|
54
|
+
const byRow: Array<Array<{ x: number; y: number }>> = [[], [], []];
|
|
55
|
+
seeds.forEach((s, i) => {
|
|
56
|
+
const x = ((((s.x0 + t * 1.4 * speed + 13) % 26) + 26) % 26) - 13;
|
|
57
|
+
// The value moves: this is what makes the bars grow and shrink in place.
|
|
58
|
+
const h = Math.max(0.15, s.h * (1 + Math.sin(t * s.rate * speed + s.ph) * volatility));
|
|
59
|
+
m.makeScale(1, h, 1);
|
|
60
|
+
m.setPosition(x, baseY(s.row) + h / 2, -s.row * 1.5);
|
|
61
|
+
bars.setMatrixAt(i, m);
|
|
62
|
+
byRow[s.row].push({ x, y: baseY(s.row) + h });
|
|
63
|
+
});
|
|
64
|
+
bars.instanceMatrix.needsUpdate = true;
|
|
65
|
+
|
|
66
|
+
if (trace) {
|
|
67
|
+
let w = 0;
|
|
68
|
+
for (let row = 0; row < rows; row++) {
|
|
69
|
+
const pts = byRow[row].sort((a, b) => a.x - b.x);
|
|
70
|
+
for (let i = 0; i + 1 < pts.length && w + 5 < tracePos.length; i++) {
|
|
71
|
+
// Skip the wrap seam, else a segment shoots back across the deck.
|
|
72
|
+
if (pts[i + 1].x - pts[i].x > 6) continue;
|
|
73
|
+
tracePos[w++] = pts[i].x;
|
|
74
|
+
tracePos[w++] = pts[i].y;
|
|
75
|
+
tracePos[w++] = -row * 1.5;
|
|
76
|
+
tracePos[w++] = pts[i + 1].x;
|
|
77
|
+
tracePos[w++] = pts[i + 1].y;
|
|
78
|
+
tracePos[w++] = -row * 1.5;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
tracePos.fill(0, w);
|
|
82
|
+
traceGeo.attributes.position.needsUpdate = true;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
place(0);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
object: holder,
|
|
89
|
+
tick: place,
|
|
90
|
+
dispose: () => {
|
|
91
|
+
barGeo.dispose();
|
|
92
|
+
barMat.dispose();
|
|
93
|
+
traceGeo.dispose();
|
|
94
|
+
traceMat.dispose();
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "matcap",
|
|
3
|
+
"kind": "material",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"clean",
|
|
7
|
+
"premium"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"surface"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 2,
|
|
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
|
+
}
|
package/src/fx/matcap.ts
ADDED
|
@@ -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,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "deck3d effect card",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["id", "kind", "tags", "cost", "modes", "params", "conflicts", "source", "licence"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
|
|
9
|
+
"kind": { "enum": ["background", "post", "material", "light", "motion", "edge", "transition"] },
|
|
10
|
+
"tags": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"required": ["mood", "content"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"mood": { "type": "array", "items": { "type": "string" } },
|
|
16
|
+
"content": { "type": "array", "items": { "type": "string" } },
|
|
17
|
+
"topic": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"description": "Closed vocabulary parse routes content slides by. Free-form belongs in `content`.",
|
|
20
|
+
"items": {
|
|
21
|
+
"enum": ["ai", "agents", "geo", "trust", "security", "compute", "data", "money", "work", "timeline", "sales", "process"]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"cost": { "type": "integer", "minimum": 1, "maximum": 5 },
|
|
27
|
+
"modes": { "enum": ["dark", "light", "both"] },
|
|
28
|
+
"params": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": ["type"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"type": { "enum": ["number", "string", "boolean"] },
|
|
35
|
+
"default": {},
|
|
36
|
+
"minimum": { "type": "number" },
|
|
37
|
+
"maximum": { "type": "number" },
|
|
38
|
+
"enum": { "type": "array" }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"conflicts": { "type": "array", "items": { "type": "string" } },
|
|
43
|
+
"source": {
|
|
44
|
+
"description": "Upstream URL for a corpus card, or the literal `local` for a per-deck module in `fx/`.",
|
|
45
|
+
"anyOf": [{ "type": "string", "pattern": "^https://" }, { "const": "local" }]
|
|
46
|
+
},
|
|
47
|
+
"licence": { "enum": ["MIT", "Zlib", "BSD-2-Clause", "BSD-3-Clause", "CC0-1.0", "Apache-2.0", "OFL-1.1"] }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "metal",
|
|
3
|
+
"kind": "material",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"technical",
|
|
7
|
+
"premium"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"surface"
|
|
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
|
+
}
|
package/src/fx/metal.ts
ADDED
|
@@ -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,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "mirror-floor",
|
|
3
|
+
"kind": "light",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"premium",
|
|
7
|
+
"dramatic"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"staging"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 2,
|
|
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 light = new ctx.THREE.PointLight(ctx.palette.accent, 1, 30);
|
|
6
|
+
void params;
|
|
7
|
+
return { object: light, dispose: () => light.dispose?.() };
|
|
8
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "neural-mesh",
|
|
3
|
+
"kind": "background",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"technical",
|
|
7
|
+
"intelligent"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"network",
|
|
11
|
+
"model"
|
|
12
|
+
],
|
|
13
|
+
"topic": [
|
|
14
|
+
"ai"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"cost": 3,
|
|
18
|
+
"modes": "both",
|
|
19
|
+
"params": {
|
|
20
|
+
"density": {
|
|
21
|
+
"type": "number",
|
|
22
|
+
"default": 1,
|
|
23
|
+
"minimum": 0.2,
|
|
24
|
+
"maximum": 3
|
|
25
|
+
},
|
|
26
|
+
"speed": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"default": 1,
|
|
29
|
+
"minimum": 0,
|
|
30
|
+
"maximum": 3
|
|
31
|
+
},
|
|
32
|
+
"drift": {
|
|
33
|
+
"type": "number",
|
|
34
|
+
"default": 0.5,
|
|
35
|
+
"minimum": 0,
|
|
36
|
+
"maximum": 2
|
|
37
|
+
},
|
|
38
|
+
"metalness": {
|
|
39
|
+
"type": "number",
|
|
40
|
+
"default": 0.9,
|
|
41
|
+
"minimum": 0,
|
|
42
|
+
"maximum": 1
|
|
43
|
+
},
|
|
44
|
+
"glow": {
|
|
45
|
+
"type": "number",
|
|
46
|
+
"default": 0.8,
|
|
47
|
+
"minimum": 0,
|
|
48
|
+
"maximum": 3
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"conflicts": [],
|
|
52
|
+
"source": "https://threejs.org/examples/#webgl_lines_dashed",
|
|
53
|
+
"licence": "MIT"
|
|
54
|
+
}
|