stereoframe-runtime 0.1.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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Canonical vocabulary — the single source the CLI linter imports (via the
3
+ * `@stereoframe/runtime/vocab` Node-safe entry; the main bundle top-level
4
+ * awaits and touches `window`, so it can't be imported outside a browser).
5
+ *
6
+ * Keep in sync with: scene.ts tag handling, animate.ts verb dispatch.
7
+ */
8
+ export { EASE_NAMES } from "./ease";
9
+ export declare const ELEMENT_NAMES: readonly ["sf-scene", "sf-camera", "sf-model", "sf-mesh", "sf-light", "sf-particles", "sf-sky", "sf-ocean", "sf-swarm", "sf-animate"];
10
+ export declare const VERB_NAMES: readonly ["turntable", "orbit", "dolly", "move", "follow", "crossfade-clip", "camera-path", "bounce-in", "fade-in", "float"];
11
+ /** sf-* attributes whose value is a local asset path the renderer fetches. */
12
+ export declare const ASSET_ATTRS: readonly ["src", "environment", "normals"];
package/dist/vocab.js ADDED
@@ -0,0 +1,96 @@
1
+ // src/ease.ts
2
+ function powerIn(n) {
3
+ return (p) => Math.pow(p, n);
4
+ }
5
+ function powerOut(n) {
6
+ return (p) => 1 - Math.pow(1 - p, n);
7
+ }
8
+ function powerInOut(n) {
9
+ return (p) => p < 0.5 ? Math.pow(2 * p, n) / 2 : 1 - Math.pow(2 * (1 - p), n) / 2;
10
+ }
11
+ var BACK_OVERSHOOT = 1.70158;
12
+ var EASES = {
13
+ linear: (p) => p,
14
+ none: (p) => p,
15
+ "power1.in": powerIn(2),
16
+ "power1.out": powerOut(2),
17
+ "power1.inOut": powerInOut(2),
18
+ "power2.in": powerIn(3),
19
+ "power2.out": powerOut(3),
20
+ "power2.inOut": powerInOut(3),
21
+ "power3.in": powerIn(4),
22
+ "power3.out": powerOut(4),
23
+ "power3.inOut": powerInOut(4),
24
+ "power4.in": powerIn(5),
25
+ "power4.out": powerOut(5),
26
+ "power4.inOut": powerInOut(5),
27
+ "sine.in": (p) => 1 - Math.cos(p * Math.PI / 2),
28
+ "sine.out": (p) => Math.sin(p * Math.PI / 2),
29
+ "sine.inOut": (p) => -(Math.cos(Math.PI * p) - 1) / 2,
30
+ "expo.in": (p) => p === 0 ? 0 : Math.pow(2, 10 * p - 10),
31
+ "expo.out": (p) => p === 1 ? 1 : 1 - Math.pow(2, -10 * p),
32
+ "expo.inOut": (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? Math.pow(2, 20 * p - 10) / 2 : (2 - Math.pow(2, -20 * p + 10)) / 2,
33
+ "circ.in": (p) => 1 - Math.sqrt(1 - p * p),
34
+ "circ.out": (p) => Math.sqrt(1 - (p - 1) * (p - 1)),
35
+ "circ.inOut": (p) => p < 0.5 ? (1 - Math.sqrt(1 - 4 * p * p)) / 2 : (Math.sqrt(1 - Math.pow(-2 * p + 2, 2)) + 1) / 2,
36
+ "back.in": (p) => p * p * ((BACK_OVERSHOOT + 1) * p - BACK_OVERSHOOT),
37
+ "back.out": (p) => {
38
+ const q = p - 1;
39
+ return q * q * ((BACK_OVERSHOOT + 1) * q + BACK_OVERSHOOT) + 1;
40
+ },
41
+ "back.inOut": (p) => {
42
+ const s = BACK_OVERSHOOT * 1.525;
43
+ return p < 0.5 ? Math.pow(2 * p, 2) * ((s + 1) * 2 * p - s) / 2 : (Math.pow(2 * p - 2, 2) * ((s + 1) * (2 * p - 2) + s) + 2) / 2;
44
+ },
45
+ "elastic.out": (p) => p === 0 ? 0 : p === 1 ? 1 : Math.pow(2, -10 * p) * Math.sin((p * 10 - 0.75) * (2 * Math.PI) / 3) + 1,
46
+ "bounce.out": (p) => {
47
+ const n1 = 7.5625;
48
+ const d1 = 2.75;
49
+ if (p < 1 / d1)
50
+ return n1 * p * p;
51
+ if (p < 2 / d1) {
52
+ const q2 = p - 1.5 / d1;
53
+ return n1 * q2 * q2 + 0.75;
54
+ }
55
+ if (p < 2.5 / d1) {
56
+ const q2 = p - 2.25 / d1;
57
+ return n1 * q2 * q2 + 0.9375;
58
+ }
59
+ const q = p - 2.625 / d1;
60
+ return n1 * q * q + 0.984375;
61
+ }
62
+ };
63
+ var EASE_NAMES = Object.keys(EASES);
64
+
65
+ // src/vocab.ts
66
+ var ELEMENT_NAMES = [
67
+ "sf-scene",
68
+ "sf-camera",
69
+ "sf-model",
70
+ "sf-mesh",
71
+ "sf-light",
72
+ "sf-particles",
73
+ "sf-sky",
74
+ "sf-ocean",
75
+ "sf-swarm",
76
+ "sf-animate"
77
+ ];
78
+ var VERB_NAMES = [
79
+ "turntable",
80
+ "orbit",
81
+ "dolly",
82
+ "move",
83
+ "follow",
84
+ "crossfade-clip",
85
+ "camera-path",
86
+ "bounce-in",
87
+ "fade-in",
88
+ "float"
89
+ ];
90
+ var ASSET_ATTRS = ["src", "environment", "normals"];
91
+ export {
92
+ VERB_NAMES,
93
+ ELEMENT_NAMES,
94
+ EASE_NAMES,
95
+ ASSET_ATTRS
96
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "stereoframe-runtime",
3
+ "version": "0.1.0",
4
+ "description": "Declarative, deterministic 3D scene runtime for stereoframe — three.js driven by seek time.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/kiyeonjeon21/stereoframe",
9
+ "directory": "packages/runtime"
10
+ },
11
+ "type": "module",
12
+ "main": "dist/stereoframe.js",
13
+ "files": ["dist"],
14
+ "exports": {
15
+ ".": "./dist/stereoframe.js",
16
+ "./vocab": "./dist/vocab.js"
17
+ },
18
+ "scripts": {
19
+ "prepublishOnly": "bun run build",
20
+ "build": "bun build src/index.ts --outfile dist/stereoframe.js --format esm --minify --target browser && bun build src/vocab.ts --outfile dist/vocab.js --format esm --target node && bunx tsc src/vocab.ts --declaration --emitDeclarationOnly --outDir dist --module esnext --moduleResolution bundler --target es2022 --skipLibCheck",
21
+ "build:dev": "bun build src/index.ts --outfile dist/stereoframe.js --format esm --target browser",
22
+ "test": "bun test"
23
+ },
24
+ "dependencies": {
25
+ "three": "0.184.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/bun": "^1.3.14",
29
+ "@types/three": "0.180.0",
30
+ "typescript": "^5.6.0"
31
+ }
32
+ }