@vib3code/sdk 2.0.1

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 (258) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
  3. package/DOCS/CI_TESTING.md +38 -0
  4. package/DOCS/CLI_ONBOARDING.md +75 -0
  5. package/DOCS/CONTROL_REFERENCE.md +64 -0
  6. package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
  7. package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
  8. package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
  9. package/DOCS/ENV_SETUP.md +189 -0
  10. package/DOCS/EXPORT_FORMATS.md +417 -0
  11. package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
  12. package/DOCS/LICENSING_TIERS.md +275 -0
  13. package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
  14. package/DOCS/OBS_SETUP_GUIDE.md +98 -0
  15. package/DOCS/PROJECT_SETUP.md +66 -0
  16. package/DOCS/RENDERER_LIFECYCLE.md +40 -0
  17. package/DOCS/REPO_MANIFEST.md +121 -0
  18. package/DOCS/SESSION_014_PLAN.md +195 -0
  19. package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
  20. package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
  21. package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
  22. package/DOCS/SYSTEM_INVENTORY.md +520 -0
  23. package/DOCS/TELEMETRY_EXPORTS.md +34 -0
  24. package/DOCS/WEBGPU_STATUS.md +38 -0
  25. package/DOCS/XR_BENCHMARKS.md +608 -0
  26. package/LICENSE +21 -0
  27. package/README.md +426 -0
  28. package/docs/.nojekyll +0 -0
  29. package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
  30. package/docs/02-hyperspatial_ego_death.html +346 -0
  31. package/docs/03-post_cartesian_sublime.html +346 -0
  32. package/docs/04-crystalline_void_meditation.html +346 -0
  33. package/docs/05-quantum_decoherence_ballet.html +346 -0
  34. package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
  35. package/docs/07-hyperspatial_ego_death.html +346 -0
  36. package/docs/08-post_cartesian_sublime.html +346 -0
  37. package/docs/09-crystalline_void_meditation.html +346 -0
  38. package/docs/10-quantum_decoherence_ballet.html +346 -0
  39. package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
  40. package/docs/12-hyperspatial_ego_death.html +346 -0
  41. package/docs/13-post_cartesian_sublime.html +346 -0
  42. package/docs/index.html +794 -0
  43. package/docs/test-hub.html +441 -0
  44. package/docs/url-state.js +102 -0
  45. package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
  46. package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
  47. package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
  48. package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
  49. package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
  50. package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
  51. package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
  52. package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
  53. package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
  54. package/docs/vib3-exports/index.html +238 -0
  55. package/docs/webgpu-live.html +702 -0
  56. package/package.json +367 -0
  57. package/src/advanced/AIPresetGenerator.js +777 -0
  58. package/src/advanced/MIDIController.js +703 -0
  59. package/src/advanced/OffscreenWorker.js +1051 -0
  60. package/src/advanced/WebGPUCompute.js +1051 -0
  61. package/src/advanced/WebXRRenderer.js +680 -0
  62. package/src/agent/cli/AgentCLI.js +615 -0
  63. package/src/agent/cli/index.js +14 -0
  64. package/src/agent/index.js +73 -0
  65. package/src/agent/mcp/MCPServer.js +950 -0
  66. package/src/agent/mcp/index.js +9 -0
  67. package/src/agent/mcp/tools.js +548 -0
  68. package/src/agent/telemetry/EventStream.js +669 -0
  69. package/src/agent/telemetry/Instrumentation.js +618 -0
  70. package/src/agent/telemetry/TelemetryExporters.js +427 -0
  71. package/src/agent/telemetry/TelemetryService.js +464 -0
  72. package/src/agent/telemetry/index.js +52 -0
  73. package/src/benchmarks/BenchmarkRunner.js +381 -0
  74. package/src/benchmarks/MetricsCollector.js +299 -0
  75. package/src/benchmarks/index.js +9 -0
  76. package/src/benchmarks/scenes.js +259 -0
  77. package/src/cli/index.js +675 -0
  78. package/src/config/ApiConfig.js +88 -0
  79. package/src/core/CanvasManager.js +217 -0
  80. package/src/core/ErrorReporter.js +117 -0
  81. package/src/core/ParameterMapper.js +333 -0
  82. package/src/core/Parameters.js +396 -0
  83. package/src/core/RendererContracts.js +200 -0
  84. package/src/core/UnifiedResourceManager.js +370 -0
  85. package/src/core/VIB3Engine.js +636 -0
  86. package/src/core/renderers/FacetedRendererAdapter.js +32 -0
  87. package/src/core/renderers/HolographicRendererAdapter.js +29 -0
  88. package/src/core/renderers/QuantumRendererAdapter.js +29 -0
  89. package/src/core/renderers/RendererLifecycleManager.js +63 -0
  90. package/src/creative/ColorPresetsSystem.js +980 -0
  91. package/src/creative/ParameterTimeline.js +1061 -0
  92. package/src/creative/PostProcessingPipeline.js +1113 -0
  93. package/src/creative/TransitionAnimator.js +683 -0
  94. package/src/export/CSSExporter.js +226 -0
  95. package/src/export/CardGeneratorBase.js +279 -0
  96. package/src/export/ExportManager.js +580 -0
  97. package/src/export/FacetedCardGenerator.js +279 -0
  98. package/src/export/HolographicCardGenerator.js +543 -0
  99. package/src/export/LottieExporter.js +552 -0
  100. package/src/export/QuantumCardGenerator.js +315 -0
  101. package/src/export/SVGExporter.js +519 -0
  102. package/src/export/ShaderExporter.js +903 -0
  103. package/src/export/TradingCardGenerator.js +3055 -0
  104. package/src/export/TradingCardManager.js +181 -0
  105. package/src/export/VIB3PackageExporter.js +559 -0
  106. package/src/export/index.js +14 -0
  107. package/src/export/systems/TradingCardSystemFaceted.js +494 -0
  108. package/src/export/systems/TradingCardSystemHolographic.js +452 -0
  109. package/src/export/systems/TradingCardSystemQuantum.js +411 -0
  110. package/src/faceted/FacetedSystem.js +963 -0
  111. package/src/features/CollectionManager.js +433 -0
  112. package/src/gallery/CollectionManager.js +240 -0
  113. package/src/gallery/GallerySystem.js +485 -0
  114. package/src/geometry/GeometryFactory.js +314 -0
  115. package/src/geometry/GeometryLibrary.js +72 -0
  116. package/src/geometry/buffers/BufferBuilder.js +338 -0
  117. package/src/geometry/buffers/index.js +18 -0
  118. package/src/geometry/generators/Crystal.js +420 -0
  119. package/src/geometry/generators/Fractal.js +298 -0
  120. package/src/geometry/generators/KleinBottle.js +197 -0
  121. package/src/geometry/generators/Sphere.js +192 -0
  122. package/src/geometry/generators/Tesseract.js +160 -0
  123. package/src/geometry/generators/Tetrahedron.js +225 -0
  124. package/src/geometry/generators/Torus.js +304 -0
  125. package/src/geometry/generators/Wave.js +341 -0
  126. package/src/geometry/index.js +142 -0
  127. package/src/geometry/warp/HypersphereCore.js +211 -0
  128. package/src/geometry/warp/HypertetraCore.js +386 -0
  129. package/src/geometry/warp/index.js +57 -0
  130. package/src/holograms/HolographicVisualizer.js +1073 -0
  131. package/src/holograms/RealHolographicSystem.js +966 -0
  132. package/src/holograms/variantRegistry.js +69 -0
  133. package/src/integrations/FigmaPlugin.js +854 -0
  134. package/src/integrations/OBSMode.js +754 -0
  135. package/src/integrations/ThreeJsPackage.js +660 -0
  136. package/src/integrations/TouchDesignerExport.js +552 -0
  137. package/src/integrations/frameworks/Vib3React.js +591 -0
  138. package/src/integrations/frameworks/Vib3Svelte.js +654 -0
  139. package/src/integrations/frameworks/Vib3Vue.js +628 -0
  140. package/src/llm/LLMParameterInterface.js +240 -0
  141. package/src/llm/LLMParameterUI.js +577 -0
  142. package/src/math/Mat4x4.js +708 -0
  143. package/src/math/Projection.js +341 -0
  144. package/src/math/Rotor4D.js +637 -0
  145. package/src/math/Vec4.js +476 -0
  146. package/src/math/constants.js +164 -0
  147. package/src/math/index.js +68 -0
  148. package/src/math/projections.js +54 -0
  149. package/src/math/rotations.js +196 -0
  150. package/src/quantum/QuantumEngine.js +906 -0
  151. package/src/quantum/QuantumVisualizer.js +1103 -0
  152. package/src/reactivity/ReactivityConfig.js +499 -0
  153. package/src/reactivity/ReactivityManager.js +586 -0
  154. package/src/reactivity/SpatialInputSystem.js +1783 -0
  155. package/src/reactivity/index.js +93 -0
  156. package/src/render/CommandBuffer.js +465 -0
  157. package/src/render/MultiCanvasBridge.js +340 -0
  158. package/src/render/RenderCommand.js +514 -0
  159. package/src/render/RenderResourceRegistry.js +523 -0
  160. package/src/render/RenderState.js +552 -0
  161. package/src/render/RenderTarget.js +512 -0
  162. package/src/render/ShaderLoader.js +253 -0
  163. package/src/render/ShaderProgram.js +599 -0
  164. package/src/render/UnifiedRenderBridge.js +496 -0
  165. package/src/render/backends/WebGLBackend.js +1108 -0
  166. package/src/render/backends/WebGPUBackend.js +1409 -0
  167. package/src/render/commands/CommandBufferExecutor.js +607 -0
  168. package/src/render/commands/RenderCommandBuffer.js +661 -0
  169. package/src/render/commands/index.js +17 -0
  170. package/src/render/index.js +367 -0
  171. package/src/scene/Disposable.js +498 -0
  172. package/src/scene/MemoryPool.js +618 -0
  173. package/src/scene/Node4D.js +697 -0
  174. package/src/scene/ResourceManager.js +599 -0
  175. package/src/scene/Scene4D.js +540 -0
  176. package/src/scene/index.js +98 -0
  177. package/src/schemas/error.schema.json +84 -0
  178. package/src/schemas/extension.schema.json +88 -0
  179. package/src/schemas/index.js +214 -0
  180. package/src/schemas/parameters.schema.json +142 -0
  181. package/src/schemas/tool-pack.schema.json +44 -0
  182. package/src/schemas/tool-response.schema.json +127 -0
  183. package/src/shaders/common/fullscreen.vert.glsl +5 -0
  184. package/src/shaders/common/fullscreen.vert.wgsl +17 -0
  185. package/src/shaders/common/geometry24.glsl +65 -0
  186. package/src/shaders/common/geometry24.wgsl +54 -0
  187. package/src/shaders/common/rotation4d.glsl +85 -0
  188. package/src/shaders/common/rotation4d.wgsl +86 -0
  189. package/src/shaders/common/uniforms.glsl +44 -0
  190. package/src/shaders/common/uniforms.wgsl +48 -0
  191. package/src/shaders/faceted/faceted.frag.glsl +129 -0
  192. package/src/shaders/faceted/faceted.frag.wgsl +164 -0
  193. package/src/shaders/holographic/holographic.frag.glsl +406 -0
  194. package/src/shaders/holographic/holographic.frag.wgsl +185 -0
  195. package/src/shaders/quantum/quantum.frag.glsl +513 -0
  196. package/src/shaders/quantum/quantum.frag.wgsl +361 -0
  197. package/src/testing/ParallelTestFramework.js +519 -0
  198. package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
  199. package/src/testing/exportFormats.test.js +8 -0
  200. package/src/testing/projections.test.js +14 -0
  201. package/src/testing/rotations.test.js +37 -0
  202. package/src/ui/InteractivityMenu.js +516 -0
  203. package/src/ui/StatusManager.js +96 -0
  204. package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
  205. package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
  206. package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
  207. package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
  208. package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
  209. package/src/variations/VariationManager.js +431 -0
  210. package/src/viewer/AudioReactivity.js +505 -0
  211. package/src/viewer/CardBending.js +481 -0
  212. package/src/viewer/GalleryUI.js +832 -0
  213. package/src/viewer/ReactivityManager.js +590 -0
  214. package/src/viewer/TradingCardExporter.js +600 -0
  215. package/src/viewer/ViewerPortal.js +374 -0
  216. package/src/viewer/index.js +12 -0
  217. package/src/wasm/WasmLoader.js +296 -0
  218. package/src/wasm/index.js +132 -0
  219. package/tools/agentic/mcpTools.js +88 -0
  220. package/tools/cli/agent-cli.js +92 -0
  221. package/tools/export/formats.js +24 -0
  222. package/tools/math/rotation-baseline.mjs +64 -0
  223. package/tools/shader-sync-verify.js +937 -0
  224. package/tools/telemetry/manifestPipeline.js +141 -0
  225. package/tools/telemetry/telemetryEvents.js +35 -0
  226. package/types/adaptive-sdk.d.ts +185 -0
  227. package/types/advanced/AIPresetGenerator.d.ts +81 -0
  228. package/types/advanced/MIDIController.d.ts +100 -0
  229. package/types/advanced/OffscreenWorker.d.ts +82 -0
  230. package/types/advanced/WebGPUCompute.d.ts +52 -0
  231. package/types/advanced/WebXRRenderer.d.ts +77 -0
  232. package/types/advanced/index.d.ts +46 -0
  233. package/types/core/ErrorReporter.d.ts +50 -0
  234. package/types/core/VIB3Engine.d.ts +204 -0
  235. package/types/creative/ColorPresetsSystem.d.ts +91 -0
  236. package/types/creative/ParameterTimeline.d.ts +74 -0
  237. package/types/creative/PostProcessingPipeline.d.ts +109 -0
  238. package/types/creative/TransitionAnimator.d.ts +71 -0
  239. package/types/creative/index.d.ts +35 -0
  240. package/types/integrations/FigmaPlugin.d.ts +46 -0
  241. package/types/integrations/OBSMode.d.ts +74 -0
  242. package/types/integrations/ThreeJsPackage.d.ts +62 -0
  243. package/types/integrations/TouchDesignerExport.d.ts +36 -0
  244. package/types/integrations/Vib3React.d.ts +74 -0
  245. package/types/integrations/Vib3Svelte.d.ts +63 -0
  246. package/types/integrations/Vib3Vue.d.ts +55 -0
  247. package/types/integrations/index.d.ts +52 -0
  248. package/types/reactivity/SpatialInputSystem.d.ts +173 -0
  249. package/types/reactivity/index.d.ts +394 -0
  250. package/types/render/CommandBuffer.d.ts +169 -0
  251. package/types/render/RenderCommand.d.ts +312 -0
  252. package/types/render/RenderState.d.ts +279 -0
  253. package/types/render/RenderTarget.d.ts +254 -0
  254. package/types/render/ShaderProgram.d.ts +277 -0
  255. package/types/render/UnifiedRenderBridge.d.ts +143 -0
  256. package/types/render/WebGLBackend.d.ts +168 -0
  257. package/types/render/WebGPUBackend.d.ts +186 -0
  258. package/types/render/index.d.ts +141 -0
@@ -0,0 +1,628 @@
1
+ /**
2
+ * VIB3+ Vue 3 Component Wrapper
3
+ *
4
+ * Generates Vue 3 Composition API component definitions and composables
5
+ * for embedding VIB3+ 4D visualizations in Vue applications.
6
+ *
7
+ * Usage (generated component):
8
+ * <Vib3Visualizer system="quantum" :hue="200" :saturation="0.8" />
9
+ *
10
+ * Usage (generated composable):
11
+ * const { engine, parameters, setParameter, switchSystem } = useVib3('container-id');
12
+ *
13
+ * NOTE: This module generates Vue 3 source code strings and package structures.
14
+ * The output is intended for use in a Vue 3 project with the Composition API.
15
+ *
16
+ * @module Vib3VueWrapper
17
+ * @version 1.0.0
18
+ * @license All Rights Reserved - Clear Seas Solutions LLC
19
+ */
20
+
21
+ /**
22
+ * VIB3+ parameter prop definitions for Vue component validation.
23
+ * @constant {Object}
24
+ */
25
+ const VIB3_PROP_DEFS = {
26
+ system: { type: 'String', default: "'quantum'", validator: "['quantum', 'faceted', 'holographic'].includes" },
27
+ geometry: { type: 'Number', default: 0, min: 0, max: 23 },
28
+ hue: { type: 'Number', default: 200, min: 0, max: 360 },
29
+ saturation: { type: 'Number', default: 0.8, min: 0, max: 1 },
30
+ intensity: { type: 'Number', default: 0.5, min: 0, max: 1 },
31
+ speed: { type: 'Number', default: 1.0, min: 0.1, max: 3 },
32
+ gridDensity: { type: 'Number', default: 15, min: 4, max: 100 },
33
+ morphFactor: { type: 'Number', default: 1.0, min: 0, max: 2 },
34
+ chaos: { type: 'Number', default: 0.2, min: 0, max: 1 },
35
+ dimension: { type: 'Number', default: 3.5, min: 3.0, max: 4.5 },
36
+ rot4dXY: { type: 'Number', default: 0, min: -6.28, max: 6.28 },
37
+ rot4dXZ: { type: 'Number', default: 0, min: -6.28, max: 6.28 },
38
+ rot4dYZ: { type: 'Number', default: 0, min: -6.28, max: 6.28 },
39
+ rot4dXW: { type: 'Number', default: 0, min: -2, max: 2 },
40
+ rot4dYW: { type: 'Number', default: 0, min: -2, max: 2 },
41
+ rot4dZW: { type: 'Number', default: 0, min: -2, max: 2 }
42
+ };
43
+
44
+ /**
45
+ * Numeric prop names for batch parameter updates.
46
+ * @constant {string[]}
47
+ */
48
+ const NUMERIC_PROPS = Object.keys(VIB3_PROP_DEFS).filter(k => VIB3_PROP_DEFS[k].type === 'Number');
49
+
50
+ /**
51
+ * Vue 3 wrapper for VIB3+ visualization engine.
52
+ *
53
+ * Provides static methods that generate Vue 3 Composition API component
54
+ * source code, composable definitions, and full NPM package structures
55
+ * for the @vib3/vue package.
56
+ *
57
+ * @class
58
+ */
59
+ export class Vib3VueWrapper {
60
+ /**
61
+ * Returns a Vue 3 Single File Component (SFC) source code string.
62
+ *
63
+ * The generated component:
64
+ * - Uses Composition API with setup()
65
+ * - Declares all VIB3 parameters as validated props
66
+ * - Initializes VIB3Engine on mounted lifecycle
67
+ * - Watches all props for reactive parameter updates
68
+ * - Watches the system prop for system switching
69
+ * - Emits 'ready' and 'error' events
70
+ * - Properly destroys the engine on unmount
71
+ *
72
+ * @returns {string} Complete Vue 3 SFC source code (.vue format)
73
+ * @example
74
+ * const componentCode = Vib3VueWrapper.getComponent();
75
+ * // Write to src/Vib3Visualizer.vue in your Vue project
76
+ */
77
+ static getComponent() {
78
+ return `<template>
79
+ <div
80
+ :id="containerId"
81
+ ref="containerRef"
82
+ class="vib3-visualizer"
83
+ :class="className"
84
+ :style="containerStyle"
85
+ />
86
+ </template>
87
+
88
+ <script>
89
+ import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount } from 'vue';
90
+ import { VIB3Engine } from '@vib3/core';
91
+
92
+ /**
93
+ * VIB3+ Visualizer Vue 3 Component
94
+ *
95
+ * Renders a VIB3+ 4D visualization inside a container div.
96
+ * Supports all VIB3 parameters as reactive props.
97
+ *
98
+ * @emits ready - Fired when the VIB3Engine is successfully initialized. Payload: VIB3Engine instance.
99
+ * @emits error - Fired on initialization failure. Payload: Error object.
100
+ */
101
+ export default defineComponent({
102
+ name: 'Vib3Visualizer',
103
+
104
+ props: {
105
+ /** Active visualization system */
106
+ system: {
107
+ type: String,
108
+ default: 'quantum',
109
+ validator: (v) => ['quantum', 'faceted', 'holographic'].includes(v)
110
+ },
111
+ /** Geometry variant index (0-23) */
112
+ geometry: { type: Number, default: 0 },
113
+ /** Color hue (0-360) */
114
+ hue: { type: Number, default: 200 },
115
+ /** Color saturation (0-1) */
116
+ saturation: { type: Number, default: 0.8 },
117
+ /** Visual intensity (0-1) */
118
+ intensity: { type: Number, default: 0.5 },
119
+ /** Animation speed (0.1-3) */
120
+ speed: { type: Number, default: 1.0 },
121
+ /** Pattern density (4-100) */
122
+ gridDensity: { type: Number, default: 15 },
123
+ /** Shape interpolation (0-2) */
124
+ morphFactor: { type: Number, default: 1.0 },
125
+ /** Randomness level (0-1) */
126
+ chaos: { type: Number, default: 0.2 },
127
+ /** 4D projection distance (3.0-4.5) */
128
+ dimension: { type: Number, default: 3.5 },
129
+ /** XY plane rotation (radians) */
130
+ rot4dXY: { type: Number, default: 0 },
131
+ /** XZ plane rotation (radians) */
132
+ rot4dXZ: { type: Number, default: 0 },
133
+ /** YZ plane rotation (radians) */
134
+ rot4dYZ: { type: Number, default: 0 },
135
+ /** XW hyperplane rotation (radians) */
136
+ rot4dXW: { type: Number, default: 0 },
137
+ /** YW hyperplane rotation (radians) */
138
+ rot4dYW: { type: Number, default: 0 },
139
+ /** ZW hyperplane rotation (radians) */
140
+ rot4dZW: { type: Number, default: 0 },
141
+ /** Container CSS width */
142
+ width: { type: String, default: '100%' },
143
+ /** Container CSS height */
144
+ height: { type: String, default: '400px' },
145
+ /** Additional CSS class */
146
+ className: { type: String, default: '' },
147
+ /** Prefer WebGPU backend */
148
+ preferWebGPU: { type: Boolean, default: false },
149
+ /** Enable debug logging */
150
+ debug: { type: Boolean, default: false }
151
+ },
152
+
153
+ emits: ['ready', 'error'],
154
+
155
+ setup(props, { emit, expose }) {
156
+ const containerRef = ref(null);
157
+ let engine = null;
158
+ const initialized = ref(false);
159
+
160
+ // Generate a unique container ID
161
+ const containerId = 'vib3-vue-' + Math.random().toString(36).substring(2, 11);
162
+
163
+ const containerStyle = computed(() => ({
164
+ width: props.width,
165
+ height: props.height,
166
+ position: 'relative',
167
+ overflow: 'hidden',
168
+ background: '#000'
169
+ }));
170
+
171
+ // Collect all numeric parameter props into a params object
172
+ function collectParams() {
173
+ return {
174
+ geometry: props.geometry,
175
+ hue: props.hue,
176
+ saturation: props.saturation,
177
+ intensity: props.intensity,
178
+ speed: props.speed,
179
+ gridDensity: props.gridDensity,
180
+ morphFactor: props.morphFactor,
181
+ chaos: props.chaos,
182
+ dimension: props.dimension,
183
+ rot4dXY: props.rot4dXY,
184
+ rot4dXZ: props.rot4dXZ,
185
+ rot4dYZ: props.rot4dYZ,
186
+ rot4dXW: props.rot4dXW,
187
+ rot4dYW: props.rot4dYW,
188
+ rot4dZW: props.rot4dZW
189
+ };
190
+ }
191
+
192
+ // Initialize on mount
193
+ onMounted(async () => {
194
+ try {
195
+ engine = new VIB3Engine({
196
+ preferWebGPU: props.preferWebGPU,
197
+ debug: props.debug
198
+ });
199
+
200
+ const success = await engine.initialize(containerId);
201
+ if (!success) {
202
+ throw new Error('VIB3Engine initialization failed');
203
+ }
204
+
205
+ // Apply initial system
206
+ await engine.switchSystem(props.system);
207
+ engine.setParameters(collectParams());
208
+
209
+ initialized.value = true;
210
+ emit('ready', engine);
211
+ } catch (err) {
212
+ console.error('[Vib3Visualizer] Initialization error:', err);
213
+ emit('error', err);
214
+ }
215
+ });
216
+
217
+ // Watch system prop for switching
218
+ watch(() => props.system, async (newSystem) => {
219
+ if (engine && initialized.value) {
220
+ await engine.switchSystem(newSystem);
221
+ }
222
+ });
223
+
224
+ // Watch all numeric parameters
225
+ const paramKeys = [
226
+ 'geometry', 'hue', 'saturation', 'intensity', 'speed',
227
+ 'gridDensity', 'morphFactor', 'chaos', 'dimension',
228
+ 'rot4dXY', 'rot4dXZ', 'rot4dYZ', 'rot4dXW', 'rot4dYW', 'rot4dZW'
229
+ ];
230
+
231
+ watch(
232
+ () => paramKeys.map(k => props[k]),
233
+ () => {
234
+ if (engine && initialized.value) {
235
+ engine.setParameters(collectParams());
236
+ }
237
+ }
238
+ );
239
+
240
+ // Cleanup on unmount
241
+ onBeforeUnmount(() => {
242
+ if (engine) {
243
+ engine.destroy();
244
+ engine = null;
245
+ }
246
+ initialized.value = false;
247
+ });
248
+
249
+ // Expose engine methods to parent via template ref
250
+ expose({
251
+ /** @returns {VIB3Engine|null} The underlying engine instance */
252
+ getEngine: () => engine,
253
+ /** @returns {boolean} Whether the engine is initialized */
254
+ isInitialized: () => initialized.value,
255
+ /** Randomize all parameters */
256
+ randomize: () => { if (engine) engine.randomizeAll(); },
257
+ /** Reset parameters to defaults */
258
+ reset: () => { if (engine) engine.resetAll(); },
259
+ /** Export the current engine state */
260
+ exportState: () => engine ? engine.exportState() : null,
261
+ /** Import an engine state object */
262
+ importState: async (state) => { if (engine) await engine.importState(state); }
263
+ });
264
+
265
+ return {
266
+ containerRef,
267
+ containerId,
268
+ containerStyle
269
+ };
270
+ }
271
+ });
272
+ <\/script>
273
+
274
+ <style scoped>
275
+ .vib3-visualizer {
276
+ position: relative;
277
+ overflow: hidden;
278
+ background: #000;
279
+ }
280
+ </style>
281
+ `;
282
+ }
283
+
284
+ /**
285
+ * Returns the useVib3() composable definition as a source code string.
286
+ *
287
+ * The generated composable:
288
+ * - Manages VIB3Engine lifecycle with reactive state
289
+ * - Provides setParameter, setParameters, switchSystem, randomize, reset
290
+ * - Exposes reactive refs for initialized state, current system, and parameters
291
+ * - Handles automatic cleanup on scope disposal
292
+ *
293
+ * @returns {string} Complete Vue 3 composable source code
294
+ * @example
295
+ * const composableCode = Vib3VueWrapper.getComposable();
296
+ * // Write to src/useVib3.js in your Vue project
297
+ */
298
+ static getComposable() {
299
+ return `import { ref, reactive, onMounted, onBeforeUnmount, readonly } from 'vue';
300
+ import { VIB3Engine } from '@vib3/core';
301
+
302
+ /**
303
+ * useVib3 - Vue 3 composable for VIB3+ engine lifecycle management
304
+ *
305
+ * @param {string} containerId - DOM element ID to mount VIB3 into
306
+ * @param {object} [options={}] - Engine constructor options
307
+ * @param {boolean} [options.preferWebGPU=false] - Prefer WebGPU backend
308
+ * @param {boolean} [options.debug=false] - Enable debug logging
309
+ * @param {string} [options.system='quantum'] - Initial system
310
+ * @returns {{
311
+ * engine: Ref<VIB3Engine|null>,
312
+ * initialized: Ref<boolean>,
313
+ * system: Ref<string>,
314
+ * parameters: Reactive<object>,
315
+ * setParameter: (name: string, value: number) => void,
316
+ * setParameters: (params: object) => void,
317
+ * switchSystem: (system: string) => Promise<boolean>,
318
+ * randomize: () => void,
319
+ * reset: () => void,
320
+ * exportState: () => object|null,
321
+ * importState: (state: object) => Promise<void>,
322
+ * startReactivity: () => void,
323
+ * stopReactivity: () => void,
324
+ * setAudioInput: (bass: number, mid: number, high: number) => void
325
+ * }}
326
+ */
327
+ export function useVib3(containerId, options = {}) {
328
+ const engine = ref(null);
329
+ const initialized = ref(false);
330
+ const system = ref(options.system || 'quantum');
331
+ const parameters = reactive({
332
+ geometry: 0,
333
+ hue: 200,
334
+ saturation: 0.8,
335
+ intensity: 0.5,
336
+ speed: 1.0,
337
+ gridDensity: 15,
338
+ morphFactor: 1.0,
339
+ chaos: 0.2,
340
+ dimension: 3.5,
341
+ rot4dXY: 0, rot4dXZ: 0, rot4dYZ: 0,
342
+ rot4dXW: 0, rot4dYW: 0, rot4dZW: 0
343
+ });
344
+
345
+ onMounted(async () => {
346
+ const eng = new VIB3Engine({
347
+ preferWebGPU: options.preferWebGPU || false,
348
+ debug: options.debug || false
349
+ });
350
+
351
+ const success = await eng.initialize(containerId);
352
+ if (success) {
353
+ engine.value = eng;
354
+ initialized.value = true;
355
+
356
+ // Sync initial parameters from engine
357
+ const allParams = eng.getAllParameters();
358
+ Object.assign(parameters, allParams);
359
+ system.value = eng.getCurrentSystem();
360
+ }
361
+ });
362
+
363
+ onBeforeUnmount(() => {
364
+ if (engine.value) {
365
+ engine.value.destroy();
366
+ engine.value = null;
367
+ }
368
+ initialized.value = false;
369
+ });
370
+
371
+ /**
372
+ * Set a single visualization parameter
373
+ * @param {string} name - Parameter name
374
+ * @param {number} value - Parameter value
375
+ */
376
+ function setParameter(name, value) {
377
+ if (engine.value && initialized.value) {
378
+ engine.value.setParameter(name, value);
379
+ parameters[name] = value;
380
+ }
381
+ }
382
+
383
+ /**
384
+ * Set multiple visualization parameters at once
385
+ * @param {object} params - Object of name/value parameter pairs
386
+ */
387
+ function setParameters(params) {
388
+ if (engine.value && initialized.value) {
389
+ engine.value.setParameters(params);
390
+ Object.assign(parameters, params);
391
+ }
392
+ }
393
+
394
+ /**
395
+ * Switch to a different visualization system
396
+ * @param {string} newSystem - 'quantum' | 'faceted' | 'holographic'
397
+ * @returns {Promise<boolean>} Whether the switch succeeded
398
+ */
399
+ async function switchSystem(newSystem) {
400
+ if (engine.value && initialized.value) {
401
+ const success = await engine.value.switchSystem(newSystem);
402
+ if (success) {
403
+ system.value = newSystem;
404
+ Object.assign(parameters, engine.value.getAllParameters());
405
+ }
406
+ return success;
407
+ }
408
+ return false;
409
+ }
410
+
411
+ /** Randomize all parameters */
412
+ function randomize() {
413
+ if (engine.value && initialized.value) {
414
+ engine.value.randomizeAll();
415
+ Object.assign(parameters, engine.value.getAllParameters());
416
+ }
417
+ }
418
+
419
+ /** Reset parameters to defaults */
420
+ function reset() {
421
+ if (engine.value && initialized.value) {
422
+ engine.value.resetAll();
423
+ Object.assign(parameters, engine.value.getAllParameters());
424
+ }
425
+ }
426
+
427
+ /** Export current engine state */
428
+ function exportState() {
429
+ return engine.value ? engine.value.exportState() : null;
430
+ }
431
+
432
+ /** Import an engine state object */
433
+ async function importState(state) {
434
+ if (engine.value) {
435
+ await engine.value.importState(state);
436
+ Object.assign(parameters, engine.value.getAllParameters());
437
+ system.value = engine.value.getCurrentSystem();
438
+ }
439
+ }
440
+
441
+ /** Start reactivity processing (audio/tilt/interaction) */
442
+ function startReactivity() {
443
+ if (engine.value) engine.value.startReactivity();
444
+ }
445
+
446
+ /** Stop reactivity processing */
447
+ function stopReactivity() {
448
+ if (engine.value) engine.value.stopReactivity();
449
+ }
450
+
451
+ /**
452
+ * Feed audio levels into the reactivity system
453
+ * @param {number} bass - Bass level (0-1)
454
+ * @param {number} mid - Mid level (0-1)
455
+ * @param {number} high - High level (0-1)
456
+ */
457
+ function setAudioInput(bass, mid, high) {
458
+ if (engine.value) engine.value.setAudioInput(bass, mid, high);
459
+ }
460
+
461
+ return {
462
+ engine: readonly(engine),
463
+ initialized: readonly(initialized),
464
+ system: readonly(system),
465
+ parameters,
466
+ setParameter,
467
+ setParameters,
468
+ switchSystem,
469
+ randomize,
470
+ reset,
471
+ exportState,
472
+ importState,
473
+ startReactivity,
474
+ stopReactivity,
475
+ setAudioInput
476
+ };
477
+ }
478
+ `;
479
+ }
480
+
481
+ /**
482
+ * Generates a complete NPM package structure for @vib3/vue.
483
+ *
484
+ * @returns {Object.<string, string|object>} Map of file path to file content
485
+ */
486
+ static generatePackage() {
487
+ return {
488
+ 'package.json': {
489
+ name: '@vib3/vue',
490
+ version: '1.0.0',
491
+ description: 'Vue 3 components for VIB3+ 4D Visualization Engine',
492
+ main: 'dist/index.js',
493
+ module: 'src/index.js',
494
+ types: 'dist/index.d.ts',
495
+ files: ['dist/', 'src/'],
496
+ scripts: {
497
+ build: 'vite build',
498
+ dev: 'vite',
499
+ prepublishOnly: 'npm run build'
500
+ },
501
+ peerDependencies: {
502
+ vue: '>=3.3.0',
503
+ '@vib3/core': '>=1.0.0'
504
+ },
505
+ devDependencies: {
506
+ '@vitejs/plugin-vue': '^5.0.0',
507
+ vite: '^5.0.0',
508
+ vue: '^3.4.0'
509
+ },
510
+ keywords: ['vib3', 'vue', 'vue3', '4d', 'visualization', 'webgl', 'webgpu', 'shader'],
511
+ license: 'MIT',
512
+ repository: {
513
+ type: 'git',
514
+ url: 'https://github.com/clear-seas/vib3-vue'
515
+ },
516
+ author: 'Clear Seas Solutions LLC'
517
+ },
518
+
519
+ 'src/index.js': `/**
520
+ * @vib3/vue - Vue 3 bindings for VIB3+ 4D Visualization Engine
521
+ * @module @vib3/vue
522
+ */
523
+ export { default as Vib3Visualizer } from './Vib3Visualizer.vue';
524
+ export { useVib3 } from './useVib3.js';
525
+ `,
526
+
527
+ 'src/Vib3Visualizer.vue': Vib3VueWrapper.getComponent(),
528
+
529
+ 'src/useVib3.js': Vib3VueWrapper.getComposable(),
530
+
531
+ 'README.md': `# @vib3/vue
532
+
533
+ Vue 3 components and composables for the VIB3+ 4D Visualization Engine.
534
+
535
+ ## Installation
536
+
537
+ \`\`\`bash
538
+ npm install @vib3/vue @vib3/core vue
539
+ \`\`\`
540
+
541
+ ## Quick Start
542
+
543
+ ### Component Usage
544
+
545
+ \`\`\`vue
546
+ <template>
547
+ <Vib3Visualizer
548
+ system="quantum"
549
+ :hue="200"
550
+ :saturation="0.8"
551
+ :intensity="0.7"
552
+ :geometry="5"
553
+ width="100%"
554
+ height="600px"
555
+ @ready="onReady"
556
+ />
557
+ </template>
558
+
559
+ <script setup>
560
+ import { Vib3Visualizer } from '@vib3/vue';
561
+
562
+ function onReady(engine) {
563
+ console.log('VIB3 ready:', engine);
564
+ }
565
+ <\/script>
566
+ \`\`\`
567
+
568
+ ### Composable Usage
569
+
570
+ \`\`\`vue
571
+ <template>
572
+ <div>
573
+ <div id="vib3-container" style="width:100%;height:400px" />
574
+ <button @click="switchSystem('quantum')">Quantum</button>
575
+ <button @click="switchSystem('faceted')">Faceted</button>
576
+ <button @click="randomize()">Randomize</button>
577
+ <input type="range" min="0" max="360"
578
+ :value="parameters.hue"
579
+ @input="setParameter('hue', Number($event.target.value))" />
580
+ </div>
581
+ </template>
582
+
583
+ <script setup>
584
+ import { useVib3 } from '@vib3/vue';
585
+
586
+ const {
587
+ initialized,
588
+ parameters,
589
+ setParameter,
590
+ switchSystem,
591
+ randomize
592
+ } = useVib3('vib3-container');
593
+ <\/script>
594
+ \`\`\`
595
+
596
+ ## Props
597
+
598
+ | Prop | Type | Default | Description |
599
+ |------|------|---------|-------------|
600
+ | system | String | 'quantum' | Active system |
601
+ | geometry | Number | 0 | Geometry variant (0-23) |
602
+ | hue | Number | 200 | Color hue (0-360) |
603
+ | saturation | Number | 0.8 | Color saturation (0-1) |
604
+ | intensity | Number | 0.5 | Visual intensity (0-1) |
605
+ | speed | Number | 1.0 | Animation speed (0.1-3) |
606
+ | gridDensity | Number | 15 | Pattern density (4-100) |
607
+ | morphFactor | Number | 1.0 | Shape interpolation (0-2) |
608
+ | chaos | Number | 0.2 | Randomness (0-1) |
609
+ | dimension | Number | 3.5 | Projection distance (3.0-4.5) |
610
+ | rot4dXY-ZW | Number | 0 | 6D rotation angles (radians) |
611
+ | width | String | '100%' | Container width |
612
+ | height | String | '400px' | Container height |
613
+
614
+ ## License
615
+
616
+ MIT - Clear Seas Solutions LLC
617
+ `
618
+ };
619
+ }
620
+
621
+ /**
622
+ * Returns the parameter prop definitions used for validation.
623
+ * @returns {Object} Prop definition map
624
+ */
625
+ static getPropDefs() {
626
+ return { ...VIB3_PROP_DEFS };
627
+ }
628
+ }