@vib3code/sdk 2.0.1 → 2.0.3-canary.0a63e71
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/CHANGELOG.md +36 -0
- package/DOCS/AGENT_HARNESS_ARCHITECTURE.md +245 -0
- package/DOCS/ANDROID_DEPLOYMENT.md +59 -0
- package/DOCS/ARCHITECTURE.md +1 -0
- package/DOCS/CI_TESTING.md +2 -0
- package/DOCS/CLI_ONBOARDING.md +3 -1
- package/DOCS/CONTROL_REFERENCE.md +2 -0
- package/DOCS/CROSS_SITE_DESIGN_PATTERNS.md +119 -0
- package/DOCS/ENV_SETUP.md +2 -0
- package/DOCS/EPIC_SCROLL_EVENTS.md +775 -0
- package/DOCS/EXPANSION_DESIGN.md +979 -0
- package/DOCS/EXPANSION_DESIGN_ULTRA.md +389 -0
- package/DOCS/EXPORT_FORMATS.md +2 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +2 -0
- package/DOCS/HANDOFF_LANDING_PAGE.md +156 -0
- package/DOCS/HANDOFF_SDK_DEVELOPMENT.md +495 -0
- package/DOCS/LICENSING_TIERS.md +2 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +4 -2
- package/DOCS/MULTIVIZ_CHOREOGRAPHY_PATTERNS.md +939 -0
- package/DOCS/OBS_SETUP_GUIDE.md +2 -0
- package/DOCS/OPTIMIZATION_PLAN_MATH.md +119 -0
- package/DOCS/PRODUCT_STRATEGY.md +65 -0
- package/DOCS/PROJECT_SETUP.md +2 -0
- package/DOCS/README.md +105 -0
- package/DOCS/REFERENCE_SCROLL_ANALYSIS.md +99 -0
- package/DOCS/RENDERER_LIFECYCLE.md +2 -0
- package/DOCS/REPO_MANIFEST.md +2 -0
- package/DOCS/ROADMAP.md +113 -0
- package/DOCS/SCROLL_TIMELINE_v3.md +271 -0
- package/DOCS/SITE_REFACTOR_PLAN.md +102 -0
- package/DOCS/STATUS.md +26 -0
- package/DOCS/SYSTEM_INVENTORY.md +37 -32
- package/DOCS/TELEMETRY_EXPORTS.md +2 -0
- package/DOCS/VISUAL_ANALYSIS_CLICKERSS.md +87 -0
- package/DOCS/VISUAL_ANALYSIS_FACETAD.md +135 -0
- package/DOCS/VISUAL_ANALYSIS_SIMONE.md +97 -0
- package/DOCS/VISUAL_ANALYSIS_TABLESIDE.md +88 -0
- package/DOCS/WEBGPU_STATUS.md +121 -38
- package/DOCS/XR_BENCHMARKS.md +2 -0
- package/DOCS/archive/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +1 -0
- package/DOCS/archive/DEV_TRACK_ANALYSIS.md +1 -0
- package/DOCS/archive/DEV_TRACK_PLAN_2026-01-07.md +1 -0
- package/DOCS/archive/SESSION_014_PLAN.md +1 -0
- package/DOCS/archive/SESSION_LOG_2026-01-07.md +1 -0
- package/DOCS/archive/STRATEGIC_BLUEPRINT_2026-01-07.md +1 -0
- package/DOCS/archive/SYSTEM_AUDIT_2026-01-30.md +1 -0
- package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +1 -0
- package/DOCS/{DEV_TRACK_SESSION_2026-01-31.md → dev-tracks/DEV_TRACK_SESSION_2026-01-31.md} +3 -1
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-06.md +233 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-13.md +129 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-15.md +144 -0
- package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-16.md +110 -0
- package/DOCS/dev-tracks/PERF_UPGRADE_2026-02-16.md +310 -0
- package/DOCS/dev-tracks/README.md +12 -0
- package/README.md +26 -13
- package/cpp/CMakeLists.txt +236 -0
- package/cpp/bindings/embind.cpp +269 -0
- package/cpp/build.sh +129 -0
- package/cpp/geometry/Crystal.cpp +103 -0
- package/cpp/geometry/Fractal.cpp +136 -0
- package/cpp/geometry/GeometryGenerator.cpp +262 -0
- package/cpp/geometry/KleinBottle.cpp +71 -0
- package/cpp/geometry/Sphere.cpp +134 -0
- package/cpp/geometry/Tesseract.cpp +94 -0
- package/cpp/geometry/Tetrahedron.cpp +83 -0
- package/cpp/geometry/Torus.cpp +65 -0
- package/cpp/geometry/WarpFunctions.cpp +238 -0
- package/cpp/geometry/Wave.cpp +85 -0
- package/cpp/include/vib3_ffi.h +238 -0
- package/cpp/math/Mat4x4.cpp +409 -0
- package/cpp/math/Mat4x4.hpp +209 -0
- package/cpp/math/Projection.cpp +142 -0
- package/cpp/math/Projection.hpp +148 -0
- package/cpp/math/Rotor4D.cpp +322 -0
- package/cpp/math/Rotor4D.hpp +204 -0
- package/cpp/math/Vec4.cpp +303 -0
- package/cpp/math/Vec4.hpp +225 -0
- package/cpp/src/vib3_ffi.cpp +607 -0
- package/cpp/tests/Geometry_test.cpp +213 -0
- package/cpp/tests/Mat4x4_test.cpp +494 -0
- package/cpp/tests/Projection_test.cpp +298 -0
- package/cpp/tests/Rotor4D_test.cpp +423 -0
- package/cpp/tests/Vec4_test.cpp +489 -0
- package/docs/webgpu-live.html +1 -1
- package/package.json +41 -30
- package/src/agent/index.js +1 -3
- package/src/agent/mcp/MCPServer.js +1220 -144
- package/src/agent/mcp/index.js +1 -1
- package/src/agent/mcp/stdio-server.js +264 -0
- package/src/agent/mcp/tools.js +498 -31
- package/src/cli/index.js +431 -47
- package/src/core/CanvasManager.js +97 -204
- package/src/core/ErrorReporter.js +1 -1
- package/src/core/Parameters.js +1 -1
- package/src/core/VIB3Engine.js +93 -4
- package/src/core/VitalitySystem.js +53 -0
- package/src/core/index.js +18 -0
- package/src/core/renderers/FacetedRendererAdapter.js +10 -9
- package/src/core/renderers/HolographicRendererAdapter.js +13 -9
- package/src/core/renderers/QuantumRendererAdapter.js +11 -7
- package/src/creative/AestheticMapper.js +628 -0
- package/src/creative/ChoreographyPlayer.js +481 -0
- package/src/creative/index.js +11 -0
- package/src/experimental/GameLoop.js +72 -0
- package/src/experimental/LatticePhysics.js +100 -0
- package/src/experimental/LiveDirector.js +143 -0
- package/src/experimental/PlayerController4D.js +154 -0
- package/src/experimental/VIB3Actor.js +138 -0
- package/src/experimental/VIB3Compositor.js +117 -0
- package/src/experimental/VIB3Link.js +122 -0
- package/src/experimental/VIB3Orchestrator.js +146 -0
- package/src/experimental/VIB3Universe.js +109 -0
- package/src/experimental/demos/CrystalLabyrinth.js +202 -0
- package/src/export/TradingCardManager.js +3 -4
- package/src/export/index.js +11 -1
- package/src/faceted/FacetedSystem.js +260 -394
- package/src/games/glyph-war/GlyphWarVisualizer.js +641 -0
- package/src/geometry/generators/Crystal.js +2 -2
- package/src/geometry/warp/HypersphereCore.js +53 -24
- package/src/holograms/HolographicVisualizer.js +84 -98
- package/src/holograms/RealHolographicSystem.js +194 -43
- package/src/math/Mat4x4.js +308 -105
- package/src/math/Rotor4D.js +124 -40
- package/src/math/Vec4.js +200 -103
- package/src/math/index.js +7 -7
- package/src/polychora/PolychoraSystem.js +77 -0
- package/src/quantum/QuantumEngine.js +103 -66
- package/src/quantum/QuantumVisualizer.js +31 -22
- package/src/reactivity/index.js +3 -5
- package/src/render/LayerPresetManager.js +372 -0
- package/src/render/LayerReactivityBridge.js +344 -0
- package/src/render/LayerRelationshipGraph.js +610 -0
- package/src/render/MultiCanvasBridge.js +148 -25
- package/src/render/ShaderLoader.js +38 -0
- package/src/render/ShaderProgram.js +4 -4
- package/src/render/UnifiedRenderBridge.js +4 -1
- package/src/render/backends/WebGPUBackend.js +8 -4
- package/src/render/index.js +27 -2
- package/src/scene/Node4D.js +74 -24
- package/src/scene/index.js +4 -4
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +4 -4
- package/src/shaders/common/rotation4d.wgsl +2 -2
- package/src/shaders/common/uniforms.wgsl +15 -8
- package/src/shaders/faceted/faceted.frag.glsl +220 -80
- package/src/shaders/faceted/faceted.frag.wgsl +144 -90
- package/src/shaders/holographic/holographic.frag.glsl +28 -9
- package/src/shaders/holographic/holographic.frag.wgsl +112 -41
- package/src/shaders/quantum/quantum.frag.glsl +1 -0
- package/src/shaders/quantum/quantum.frag.wgsl +6 -4
- package/src/testing/ParallelTestFramework.js +2 -2
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +2 -2
- package/src/viewer/GalleryUI.js +17 -0
- package/src/viewer/ViewerPortal.js +2 -2
- package/src/viewer/index.js +1 -1
- package/tools/headless-renderer.js +258 -0
- package/tools/shader-sync-verify.js +14 -8
- package/tools/site-analysis/all-reports.json +32 -0
- package/tools/site-analysis/combined-analysis.md +50 -0
- package/tools/site-analyzer.mjs +779 -0
- package/tools/visual-catalog/capture.js +276 -0
- package/tools/visual-catalog/composite.js +138 -0
- package/types/adaptive-sdk.d.ts +204 -5
- package/types/agent/cli.d.ts +78 -0
- package/types/agent/index.d.ts +18 -0
- package/types/agent/mcp.d.ts +87 -0
- package/types/agent/telemetry.d.ts +190 -0
- package/types/core/VIB3Engine.d.ts +26 -0
- package/types/core/index.d.ts +261 -0
- package/types/creative/AestheticMapper.d.ts +72 -0
- package/types/creative/ChoreographyPlayer.d.ts +96 -0
- package/types/creative/index.d.ts +17 -0
- package/types/export/index.d.ts +243 -0
- package/types/geometry/index.d.ts +164 -0
- package/types/math/index.d.ts +214 -0
- package/types/render/LayerPresetManager.d.ts +78 -0
- package/types/render/LayerReactivityBridge.d.ts +85 -0
- package/types/render/LayerRelationshipGraph.d.ts +174 -0
- package/types/render/index.d.ts +3 -0
- package/types/scene/index.d.ts +204 -0
- package/types/systems/index.d.ts +244 -0
- package/types/variations/index.d.ts +62 -0
- package/types/viewer/index.d.ts +225 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +0 -34
- package/DOCS/DEV_TRACK_ANALYSIS.md +0 -77
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +0 -42
- package/DOCS/SESSION_014_PLAN.md +0 -195
- package/DOCS/SESSION_LOG_2026-01-07.md +0 -56
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +0 -72
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +0 -738
- /package/src/viewer/{ReactivityManager.js → ViewerInputHandler.js} +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math Module TypeScript Definitions
|
|
3
|
+
* Constants, projections, rotations, Vec4
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Constants
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export declare const PI: number;
|
|
11
|
+
export declare const TAU: number;
|
|
12
|
+
export declare const HALF_PI: number;
|
|
13
|
+
export declare const QUARTER_PI: number;
|
|
14
|
+
|
|
15
|
+
export declare const DEG_TO_RAD: number;
|
|
16
|
+
export declare const RAD_TO_DEG: number;
|
|
17
|
+
|
|
18
|
+
export declare const EPSILON: number;
|
|
19
|
+
export declare const EPSILON_NORMAL: number;
|
|
20
|
+
export declare const EPSILON_EQUAL: number;
|
|
21
|
+
|
|
22
|
+
export declare const PHI: number;
|
|
23
|
+
export declare const PHI_INV: number;
|
|
24
|
+
|
|
25
|
+
// 4D Polytope topology constants
|
|
26
|
+
export declare const TESSERACT_VERTICES: 16;
|
|
27
|
+
export declare const TESSERACT_EDGES: 32;
|
|
28
|
+
export declare const TESSERACT_FACES: 24;
|
|
29
|
+
export declare const TESSERACT_CELLS: 8;
|
|
30
|
+
|
|
31
|
+
export declare const CELL24_VERTICES: 24;
|
|
32
|
+
export declare const CELL24_EDGES: 96;
|
|
33
|
+
export declare const CELL24_FACES: 96;
|
|
34
|
+
export declare const CELL24_CELLS: 24;
|
|
35
|
+
|
|
36
|
+
export declare const CELL120_VERTICES: 600;
|
|
37
|
+
export declare const CELL120_EDGES: 1200;
|
|
38
|
+
export declare const CELL120_FACES: 720;
|
|
39
|
+
export declare const CELL120_CELLS: 120;
|
|
40
|
+
|
|
41
|
+
export declare const CELL600_VERTICES: 120;
|
|
42
|
+
export declare const CELL600_EDGES: 720;
|
|
43
|
+
export declare const CELL600_FACES: 1200;
|
|
44
|
+
export declare const CELL600_CELLS: 600;
|
|
45
|
+
|
|
46
|
+
// Rotation plane indices
|
|
47
|
+
export declare const PLANE_XY: 0;
|
|
48
|
+
export declare const PLANE_XZ: 1;
|
|
49
|
+
export declare const PLANE_YZ: 2;
|
|
50
|
+
export declare const PLANE_XW: 3;
|
|
51
|
+
export declare const PLANE_YW: 4;
|
|
52
|
+
export declare const PLANE_ZW: 5;
|
|
53
|
+
|
|
54
|
+
export declare const PLANE_NAMES: ['XY', 'XZ', 'YZ', 'XW', 'YW', 'ZW'];
|
|
55
|
+
|
|
56
|
+
// Base geometry indices
|
|
57
|
+
export declare const GEOMETRY_TETRAHEDRON: 0;
|
|
58
|
+
export declare const GEOMETRY_HYPERCUBE: 1;
|
|
59
|
+
export declare const GEOMETRY_SPHERE: 2;
|
|
60
|
+
export declare const GEOMETRY_TORUS: 3;
|
|
61
|
+
export declare const GEOMETRY_KLEIN: 4;
|
|
62
|
+
export declare const GEOMETRY_FRACTAL: 5;
|
|
63
|
+
export declare const GEOMETRY_WAVE: 6;
|
|
64
|
+
export declare const GEOMETRY_CRYSTAL: 7;
|
|
65
|
+
|
|
66
|
+
// Core type indices
|
|
67
|
+
export declare const CORE_BASE: 0;
|
|
68
|
+
export declare const CORE_HYPERSPHERE: 1;
|
|
69
|
+
export declare const CORE_HYPERTETRAHEDRON: 2;
|
|
70
|
+
|
|
71
|
+
/** Encode base + core type into geometry index (0-23). */
|
|
72
|
+
export declare function encodeGeometry(baseIndex: number, coreIndex: number): number;
|
|
73
|
+
|
|
74
|
+
/** Decode geometry index into base and core type. */
|
|
75
|
+
export declare function decodeGeometry(geometryIndex: number): { baseIndex: number; coreIndex: number };
|
|
76
|
+
|
|
77
|
+
/** Convert degrees to radians. */
|
|
78
|
+
export declare function toRadians(degrees: number): number;
|
|
79
|
+
|
|
80
|
+
/** Convert radians to degrees. */
|
|
81
|
+
export declare function toDegrees(radians: number): number;
|
|
82
|
+
|
|
83
|
+
/** Clamp value to [min, max]. */
|
|
84
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
85
|
+
|
|
86
|
+
/** Linear interpolation: a + (b - a) * t. */
|
|
87
|
+
export declare function lerp(a: number, b: number, t: number): number;
|
|
88
|
+
|
|
89
|
+
/** Smooth Hermite interpolation (cubic). */
|
|
90
|
+
export declare function smoothstep(t: number): number;
|
|
91
|
+
|
|
92
|
+
/** Smoother step interpolation (quintic). */
|
|
93
|
+
export declare function smootherstep(t: number): number;
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// Projections
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
/** Result of a 4D→3D projection */
|
|
100
|
+
export interface ProjectionResult {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
z: number;
|
|
104
|
+
denom: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Options for perspective projection */
|
|
108
|
+
export interface PerspectiveOptions {
|
|
109
|
+
/** Projection distance (default: 2) */
|
|
110
|
+
distance?: number;
|
|
111
|
+
/** Minimum absolute denominator (default: 1e-5) */
|
|
112
|
+
epsilon?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Options for stereographic projection */
|
|
116
|
+
export interface StereographicOptions {
|
|
117
|
+
/** Minimum absolute denominator (default: 1e-5) */
|
|
118
|
+
epsilon?: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Perspective projection: P.xyz = v.xyz / (distance - v.w)
|
|
123
|
+
* Most intuitive projection — closer objects appear larger.
|
|
124
|
+
*/
|
|
125
|
+
export declare function perspectiveProject4D(v: number[], options?: PerspectiveOptions): ProjectionResult;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Stereographic projection: P.xyz = v.xyz / (1 - v.w)
|
|
129
|
+
* Conformal — preserves angles locally.
|
|
130
|
+
*/
|
|
131
|
+
export declare function stereographicProject4D(v: number[], options?: StereographicOptions): ProjectionResult;
|
|
132
|
+
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Rotations
|
|
135
|
+
// ============================================================================
|
|
136
|
+
|
|
137
|
+
/** Canonical rotation plane name */
|
|
138
|
+
export type RotationPlane = 'XY' | 'XZ' | 'YZ' | 'XW' | 'YW' | 'ZW';
|
|
139
|
+
|
|
140
|
+
/** 16-element column-major 4×4 matrix */
|
|
141
|
+
export type Matrix4x4 = number[];
|
|
142
|
+
|
|
143
|
+
/** 4-element vector [x, y, z, w] */
|
|
144
|
+
export type Vector4D = number[];
|
|
145
|
+
|
|
146
|
+
/** Sparse angle map (plane name → angle in radians) */
|
|
147
|
+
export type AngleMap = Partial<Record<RotationPlane, number>>;
|
|
148
|
+
|
|
149
|
+
export declare const ROTATION_PLANES: RotationPlane[];
|
|
150
|
+
|
|
151
|
+
/** Create a 4D rotation matrix for a given plane and angle. */
|
|
152
|
+
export declare function createRotationMatrix4D(plane: RotationPlane | string, angle: number): Matrix4x4;
|
|
153
|
+
|
|
154
|
+
/** Return a 16-element identity matrix. */
|
|
155
|
+
export declare function identityMatrix4x4(): Matrix4x4;
|
|
156
|
+
|
|
157
|
+
/** Multiply two 16-element column-major matrices. */
|
|
158
|
+
export declare function multiplyMatrix4x4(a: Matrix4x4, b: Matrix4x4): Matrix4x4;
|
|
159
|
+
|
|
160
|
+
/** Transpose a 16-element column-major matrix. */
|
|
161
|
+
export declare function transposeMatrix4x4(m: Matrix4x4): Matrix4x4;
|
|
162
|
+
|
|
163
|
+
/** Apply a 4×4 matrix to a 4-element vector. */
|
|
164
|
+
export declare function applyMatrix4x4(m: Matrix4x4, v: Vector4D): Vector4D;
|
|
165
|
+
|
|
166
|
+
/** Compute Euclidean length of a 4D vector. */
|
|
167
|
+
export declare function vectorLength4D(v: Vector4D): number;
|
|
168
|
+
|
|
169
|
+
/** Normalize a 4D vector to unit length. */
|
|
170
|
+
export declare function normalizeVector4D(v: Vector4D): Vector4D;
|
|
171
|
+
|
|
172
|
+
/** Normalize angle keys to uppercase, filling missing planes with 0. */
|
|
173
|
+
export declare function normalizeRotationAngles(angles: Record<string, number>): Record<RotationPlane, number>;
|
|
174
|
+
|
|
175
|
+
/** Create rotation matrices for all 6 planes from an angle map. */
|
|
176
|
+
export declare function createRotationMatricesFromAngles(angles: Record<string, number>): Record<RotationPlane, Matrix4x4>;
|
|
177
|
+
|
|
178
|
+
/** Compose a single rotation matrix from angles (XY*XZ*YZ*XW*YW*ZW order). */
|
|
179
|
+
export declare function composeRotationMatrixFromAngles(angles: Record<string, number>): Matrix4x4;
|
|
180
|
+
|
|
181
|
+
// ============================================================================
|
|
182
|
+
// Vec4
|
|
183
|
+
// ============================================================================
|
|
184
|
+
|
|
185
|
+
/** 4D vector class */
|
|
186
|
+
export declare class Vec4 {
|
|
187
|
+
x: number;
|
|
188
|
+
y: number;
|
|
189
|
+
z: number;
|
|
190
|
+
w: number;
|
|
191
|
+
|
|
192
|
+
constructor(x?: number, y?: number, z?: number, w?: number);
|
|
193
|
+
|
|
194
|
+
/** Linear interpolation to another Vec4. */
|
|
195
|
+
lerp(other: Vec4, t: number): Vec4;
|
|
196
|
+
|
|
197
|
+
/** Euclidean distance to another Vec4. */
|
|
198
|
+
distanceTo(other: Vec4): number;
|
|
199
|
+
|
|
200
|
+
/** Vector length. */
|
|
201
|
+
length(): number;
|
|
202
|
+
|
|
203
|
+
/** Normalize to unit length. */
|
|
204
|
+
normalize(): Vec4;
|
|
205
|
+
|
|
206
|
+
/** Dot product. */
|
|
207
|
+
dot(other: Vec4): number;
|
|
208
|
+
|
|
209
|
+
/** Clone this vector. */
|
|
210
|
+
clone(): Vec4;
|
|
211
|
+
|
|
212
|
+
/** Convert to array [x, y, z, w]. */
|
|
213
|
+
toArray(): number[];
|
|
214
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LayerPresetManager TypeScript Definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { LayerRelationshipGraph } from './LayerRelationshipGraph';
|
|
6
|
+
|
|
7
|
+
export interface PresetMetadata {
|
|
8
|
+
description?: string;
|
|
9
|
+
author?: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
createdAt?: string;
|
|
12
|
+
updatedAt?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface LayerPreset {
|
|
17
|
+
name: string;
|
|
18
|
+
config: ReturnType<LayerRelationshipGraph['exportConfig']>;
|
|
19
|
+
metadata: PresetMetadata;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface PresetLibrary {
|
|
23
|
+
version: string;
|
|
24
|
+
type: 'vib3_layer_presets';
|
|
25
|
+
exportedAt: string;
|
|
26
|
+
count: number;
|
|
27
|
+
presets: Record<string, LayerPreset>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PresetManagerOptions {
|
|
31
|
+
storage?: Storage | null;
|
|
32
|
+
storageKey?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare class LayerPresetManager {
|
|
36
|
+
constructor(graph: LayerRelationshipGraph, options?: PresetManagerOptions);
|
|
37
|
+
|
|
38
|
+
/** Save the current graph state as a named preset. */
|
|
39
|
+
save(name: string, metadata?: Partial<PresetMetadata>): LayerPreset;
|
|
40
|
+
|
|
41
|
+
/** Load a preset by name into the live graph. */
|
|
42
|
+
load(name: string): boolean;
|
|
43
|
+
|
|
44
|
+
/** Delete a user preset. */
|
|
45
|
+
delete(name: string): boolean;
|
|
46
|
+
|
|
47
|
+
/** Check if a preset exists (user or built-in). */
|
|
48
|
+
has(name: string): boolean;
|
|
49
|
+
|
|
50
|
+
/** Get a preset's data without loading it. */
|
|
51
|
+
get(name: string): LayerPreset | null;
|
|
52
|
+
|
|
53
|
+
/** List all available presets. */
|
|
54
|
+
list(): { user: string[]; builtIn: string[] };
|
|
55
|
+
|
|
56
|
+
/** List all preset names as a flat array. */
|
|
57
|
+
listAll(): string[];
|
|
58
|
+
|
|
59
|
+
/** Number of user presets. */
|
|
60
|
+
readonly count: number;
|
|
61
|
+
|
|
62
|
+
/** Tune a layer's relationship config at runtime. */
|
|
63
|
+
tune(layerName: string, configOverrides: Record<string, unknown>): boolean;
|
|
64
|
+
|
|
65
|
+
/** Get the current config for a layer. */
|
|
66
|
+
getLayerConfig(layerName: string): { preset: string; config: Record<string, unknown> } | null;
|
|
67
|
+
|
|
68
|
+
/** Export all user presets as a library. */
|
|
69
|
+
exportLibrary(): PresetLibrary;
|
|
70
|
+
|
|
71
|
+
/** Import presets from a library. */
|
|
72
|
+
importLibrary(library: PresetLibrary, options?: { overwrite?: boolean }): { imported: number; skipped: number };
|
|
73
|
+
|
|
74
|
+
/** Clear all user presets. */
|
|
75
|
+
clear(): void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default LayerPresetManager;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LayerReactivityBridge TypeScript Definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { LayerRelationshipGraph } from './LayerRelationshipGraph';
|
|
6
|
+
import { LayerPresetManager } from './LayerPresetManager';
|
|
7
|
+
|
|
8
|
+
export interface ModulationMapping {
|
|
9
|
+
source: 'audio' | 'tilt' | 'mouse' | 'click' | 'custom';
|
|
10
|
+
channel: string;
|
|
11
|
+
layerName: string;
|
|
12
|
+
configKey: string;
|
|
13
|
+
scale: number;
|
|
14
|
+
baseline: number;
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
mode?: 'add' | 'multiply';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface InputState {
|
|
21
|
+
audio?: { bass?: number; mid?: number; high?: number; energy?: number };
|
|
22
|
+
tilt?: { alpha?: number; beta?: number; gamma?: number };
|
|
23
|
+
mouse?: { x?: number; y?: number; velocityX?: number; velocityY?: number };
|
|
24
|
+
click?: { intensity?: number };
|
|
25
|
+
custom?: Record<string, number>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ReactivityBridgeConfig {
|
|
29
|
+
profile: string | null;
|
|
30
|
+
mappings: ModulationMapping[];
|
|
31
|
+
active: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare const MODULATION_PROFILES: Record<string, ModulationMapping[]>;
|
|
35
|
+
|
|
36
|
+
export declare class LayerReactivityBridge {
|
|
37
|
+
constructor(graph: LayerRelationshipGraph, presetManager?: LayerPresetManager | null);
|
|
38
|
+
|
|
39
|
+
/** Add a single modulation mapping. */
|
|
40
|
+
addModulation(
|
|
41
|
+
source: string,
|
|
42
|
+
channel: string,
|
|
43
|
+
layerName: string,
|
|
44
|
+
configKey: string,
|
|
45
|
+
options?: Partial<Pick<ModulationMapping, 'scale' | 'baseline' | 'min' | 'max' | 'mode'>>
|
|
46
|
+
): void;
|
|
47
|
+
|
|
48
|
+
/** Remove all modulation mappings for a specific layer. */
|
|
49
|
+
removeModulationsForLayer(layerName: string): number;
|
|
50
|
+
|
|
51
|
+
/** Remove all modulation mappings. */
|
|
52
|
+
clearModulations(): void;
|
|
53
|
+
|
|
54
|
+
/** Load a pre-built modulation profile. */
|
|
55
|
+
loadModulationProfile(profileName: string): boolean;
|
|
56
|
+
|
|
57
|
+
/** Available modulation profile names. */
|
|
58
|
+
static readonly profileNames: string[];
|
|
59
|
+
|
|
60
|
+
/** Active modulation profile name. */
|
|
61
|
+
readonly activeProfile: string | null;
|
|
62
|
+
|
|
63
|
+
/** All current modulation mappings. */
|
|
64
|
+
readonly mappings: ModulationMapping[];
|
|
65
|
+
|
|
66
|
+
/** Enable modulation processing. */
|
|
67
|
+
activate(): void;
|
|
68
|
+
|
|
69
|
+
/** Disable modulation processing. */
|
|
70
|
+
deactivate(): void;
|
|
71
|
+
|
|
72
|
+
/** Whether modulation is active. */
|
|
73
|
+
readonly isActive: boolean;
|
|
74
|
+
|
|
75
|
+
/** Process input state and apply modulations. */
|
|
76
|
+
update(inputState: InputState): Record<string, Record<string, number>>;
|
|
77
|
+
|
|
78
|
+
/** Export modulation configuration. */
|
|
79
|
+
exportConfig(): ReactivityBridgeConfig;
|
|
80
|
+
|
|
81
|
+
/** Import modulation configuration. */
|
|
82
|
+
importConfig(config: ReactivityBridgeConfig): void;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default LayerReactivityBridge;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LayerRelationshipGraph — TypeScript definitions
|
|
3
|
+
*
|
|
4
|
+
* Keystone-driven inter-layer parameter system for the VIB3+ 5-layer canvas architecture.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Standard layer names, back to front */
|
|
8
|
+
export type LayerName = 'background' | 'shadow' | 'content' | 'highlight' | 'accent';
|
|
9
|
+
|
|
10
|
+
/** Layer order array */
|
|
11
|
+
export declare const LAYER_ORDER: readonly LayerName[];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A relationship function takes keystone parameters and time,
|
|
15
|
+
* and returns derived parameters for a dependent layer.
|
|
16
|
+
*/
|
|
17
|
+
export type RelationshipFn = (keystoneParams: Record<string, unknown>, time: number) => Record<string, unknown>;
|
|
18
|
+
|
|
19
|
+
/** Available preset relationship names */
|
|
20
|
+
export type RelationshipPreset = 'echo' | 'mirror' | 'complement' | 'harmonic' | 'reactive' | 'chase';
|
|
21
|
+
|
|
22
|
+
/** Available profile names */
|
|
23
|
+
export type RelationshipProfileName = 'holographic' | 'symmetry' | 'chord' | 'storm' | 'legacy';
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Preset Configs
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
export interface EchoConfig {
|
|
30
|
+
opacity?: number;
|
|
31
|
+
densityScale?: number;
|
|
32
|
+
speedScale?: number;
|
|
33
|
+
intensityScale?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface MirrorConfig {
|
|
37
|
+
opacity?: number;
|
|
38
|
+
invertRotation?: boolean;
|
|
39
|
+
hueShift?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ComplementConfig {
|
|
43
|
+
opacity?: number;
|
|
44
|
+
densityPivot?: number;
|
|
45
|
+
chaosInvert?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface HarmonicConfig {
|
|
49
|
+
opacity?: number;
|
|
50
|
+
densityHarmonic?: number;
|
|
51
|
+
speedRatio?: number;
|
|
52
|
+
hueAngle?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ReactiveConfig {
|
|
56
|
+
opacity?: number;
|
|
57
|
+
gain?: number;
|
|
58
|
+
decay?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ChaseConfig {
|
|
62
|
+
opacity?: number;
|
|
63
|
+
lerpRate?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Union of all preset config types */
|
|
67
|
+
export type PresetConfig = EchoConfig | MirrorConfig | ComplementConfig | HarmonicConfig | ReactiveConfig | ChaseConfig;
|
|
68
|
+
|
|
69
|
+
/** Serializable relationship specification */
|
|
70
|
+
export interface RelationshipConfig {
|
|
71
|
+
preset: RelationshipPreset;
|
|
72
|
+
config?: PresetConfig;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Profiles
|
|
77
|
+
// ============================================================================
|
|
78
|
+
|
|
79
|
+
export interface LayerRelationshipProfile {
|
|
80
|
+
keystone: LayerName;
|
|
81
|
+
relationships: Partial<Record<LayerName, RelationshipConfig>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// Export/Import
|
|
86
|
+
// ============================================================================
|
|
87
|
+
|
|
88
|
+
export interface LayerRelationshipExport {
|
|
89
|
+
keystone: LayerName;
|
|
90
|
+
profile: RelationshipProfileName | null;
|
|
91
|
+
relationships: Partial<Record<LayerName, RelationshipConfig | null>>;
|
|
92
|
+
shaders: Partial<Record<LayerName, string>>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// Preset Factories
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
export declare function echo(config?: EchoConfig): RelationshipFn;
|
|
100
|
+
export declare function mirror(config?: MirrorConfig): RelationshipFn;
|
|
101
|
+
export declare function complement(config?: ComplementConfig): RelationshipFn;
|
|
102
|
+
export declare function harmonic(config?: HarmonicConfig): RelationshipFn;
|
|
103
|
+
export declare function reactive(config?: ReactiveConfig): RelationshipFn;
|
|
104
|
+
export declare function chase(config?: ChaseConfig): RelationshipFn;
|
|
105
|
+
|
|
106
|
+
export declare const PRESET_REGISTRY: Record<RelationshipPreset, (...args: any[]) => RelationshipFn>;
|
|
107
|
+
export declare const PROFILES: Record<RelationshipProfileName, LayerRelationshipProfile>;
|
|
108
|
+
|
|
109
|
+
// ============================================================================
|
|
110
|
+
// LayerRelationshipGraph
|
|
111
|
+
// ============================================================================
|
|
112
|
+
|
|
113
|
+
export interface LayerRelationshipGraphOptions {
|
|
114
|
+
keystone?: LayerName;
|
|
115
|
+
profile?: RelationshipProfileName;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export declare class LayerRelationshipGraph {
|
|
119
|
+
constructor(config?: LayerRelationshipGraphOptions);
|
|
120
|
+
|
|
121
|
+
/** The current keystone (driver) layer */
|
|
122
|
+
readonly keystone: LayerName;
|
|
123
|
+
|
|
124
|
+
/** Currently active profile name, or null if custom */
|
|
125
|
+
readonly activeProfile: RelationshipProfileName | null;
|
|
126
|
+
|
|
127
|
+
/** Available profile names */
|
|
128
|
+
static readonly profileNames: RelationshipProfileName[];
|
|
129
|
+
|
|
130
|
+
/** Available preset relationship names */
|
|
131
|
+
static readonly presetNames: RelationshipPreset[];
|
|
132
|
+
|
|
133
|
+
/** Set the keystone (driver) layer */
|
|
134
|
+
setKeystone(layerName: LayerName): void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Set the relationship for a dependent layer.
|
|
138
|
+
* Accepts a preset name, a custom function, or a { preset, config } object.
|
|
139
|
+
*/
|
|
140
|
+
setRelationship(
|
|
141
|
+
layerName: LayerName,
|
|
142
|
+
relationship: RelationshipPreset | RelationshipFn | RelationshipConfig
|
|
143
|
+
): void;
|
|
144
|
+
|
|
145
|
+
/** Set the shader program for a specific layer */
|
|
146
|
+
setLayerShader(layerName: LayerName, shaderName: string): void;
|
|
147
|
+
|
|
148
|
+
/** Get the shader name for a layer (null = use default) */
|
|
149
|
+
getLayerShader(layerName: LayerName): string | null;
|
|
150
|
+
|
|
151
|
+
/** Load a named profile, configuring the full graph at once */
|
|
152
|
+
loadProfile(profileName: RelationshipProfileName): void;
|
|
153
|
+
|
|
154
|
+
/** Resolve parameters for a single dependent layer */
|
|
155
|
+
resolve(
|
|
156
|
+
keystoneParams: Record<string, unknown>,
|
|
157
|
+
layerName: LayerName,
|
|
158
|
+
time: number
|
|
159
|
+
): Record<string, unknown>;
|
|
160
|
+
|
|
161
|
+
/** Resolve parameters for all layers at once */
|
|
162
|
+
resolveAll(
|
|
163
|
+
keystoneParams: Record<string, unknown>,
|
|
164
|
+
time: number
|
|
165
|
+
): Record<LayerName, Record<string, unknown>>;
|
|
166
|
+
|
|
167
|
+
/** Export the graph configuration for saving */
|
|
168
|
+
exportConfig(): LayerRelationshipExport;
|
|
169
|
+
|
|
170
|
+
/** Import a graph configuration */
|
|
171
|
+
importConfig(config: LayerRelationshipExport): void;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export default LayerRelationshipGraph;
|
package/types/render/index.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export * from './ShaderProgram';
|
|
|
12
12
|
export * from './WebGLBackend';
|
|
13
13
|
export * from './WebGPUBackend';
|
|
14
14
|
export * from './UnifiedRenderBridge';
|
|
15
|
+
export * from './LayerRelationshipGraph';
|
|
16
|
+
export * from './LayerPresetManager';
|
|
17
|
+
export * from './LayerReactivityBridge';
|
|
15
18
|
|
|
16
19
|
import { RenderState, BlendMode, CullFace } from './RenderState';
|
|
17
20
|
import { CommandBuffer, CommandBufferOptions } from './CommandBuffer';
|