@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.
- package/CHANGELOG.md +118 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
- package/DOCS/CI_TESTING.md +38 -0
- package/DOCS/CLI_ONBOARDING.md +75 -0
- package/DOCS/CONTROL_REFERENCE.md +64 -0
- package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
- package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
- package/DOCS/ENV_SETUP.md +189 -0
- package/DOCS/EXPORT_FORMATS.md +417 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
- package/DOCS/LICENSING_TIERS.md +275 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
- package/DOCS/OBS_SETUP_GUIDE.md +98 -0
- package/DOCS/PROJECT_SETUP.md +66 -0
- package/DOCS/RENDERER_LIFECYCLE.md +40 -0
- package/DOCS/REPO_MANIFEST.md +121 -0
- package/DOCS/SESSION_014_PLAN.md +195 -0
- package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
- package/DOCS/SYSTEM_INVENTORY.md +520 -0
- package/DOCS/TELEMETRY_EXPORTS.md +34 -0
- package/DOCS/WEBGPU_STATUS.md +38 -0
- package/DOCS/XR_BENCHMARKS.md +608 -0
- package/LICENSE +21 -0
- package/README.md +426 -0
- package/docs/.nojekyll +0 -0
- package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/02-hyperspatial_ego_death.html +346 -0
- package/docs/03-post_cartesian_sublime.html +346 -0
- package/docs/04-crystalline_void_meditation.html +346 -0
- package/docs/05-quantum_decoherence_ballet.html +346 -0
- package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/07-hyperspatial_ego_death.html +346 -0
- package/docs/08-post_cartesian_sublime.html +346 -0
- package/docs/09-crystalline_void_meditation.html +346 -0
- package/docs/10-quantum_decoherence_ballet.html +346 -0
- package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/12-hyperspatial_ego_death.html +346 -0
- package/docs/13-post_cartesian_sublime.html +346 -0
- package/docs/index.html +794 -0
- package/docs/test-hub.html +441 -0
- package/docs/url-state.js +102 -0
- package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
- package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
- package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
- package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
- package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
- package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
- package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
- package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
- package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
- package/docs/vib3-exports/index.html +238 -0
- package/docs/webgpu-live.html +702 -0
- package/package.json +367 -0
- package/src/advanced/AIPresetGenerator.js +777 -0
- package/src/advanced/MIDIController.js +703 -0
- package/src/advanced/OffscreenWorker.js +1051 -0
- package/src/advanced/WebGPUCompute.js +1051 -0
- package/src/advanced/WebXRRenderer.js +680 -0
- package/src/agent/cli/AgentCLI.js +615 -0
- package/src/agent/cli/index.js +14 -0
- package/src/agent/index.js +73 -0
- package/src/agent/mcp/MCPServer.js +950 -0
- package/src/agent/mcp/index.js +9 -0
- package/src/agent/mcp/tools.js +548 -0
- package/src/agent/telemetry/EventStream.js +669 -0
- package/src/agent/telemetry/Instrumentation.js +618 -0
- package/src/agent/telemetry/TelemetryExporters.js +427 -0
- package/src/agent/telemetry/TelemetryService.js +464 -0
- package/src/agent/telemetry/index.js +52 -0
- package/src/benchmarks/BenchmarkRunner.js +381 -0
- package/src/benchmarks/MetricsCollector.js +299 -0
- package/src/benchmarks/index.js +9 -0
- package/src/benchmarks/scenes.js +259 -0
- package/src/cli/index.js +675 -0
- package/src/config/ApiConfig.js +88 -0
- package/src/core/CanvasManager.js +217 -0
- package/src/core/ErrorReporter.js +117 -0
- package/src/core/ParameterMapper.js +333 -0
- package/src/core/Parameters.js +396 -0
- package/src/core/RendererContracts.js +200 -0
- package/src/core/UnifiedResourceManager.js +370 -0
- package/src/core/VIB3Engine.js +636 -0
- package/src/core/renderers/FacetedRendererAdapter.js +32 -0
- package/src/core/renderers/HolographicRendererAdapter.js +29 -0
- package/src/core/renderers/QuantumRendererAdapter.js +29 -0
- package/src/core/renderers/RendererLifecycleManager.js +63 -0
- package/src/creative/ColorPresetsSystem.js +980 -0
- package/src/creative/ParameterTimeline.js +1061 -0
- package/src/creative/PostProcessingPipeline.js +1113 -0
- package/src/creative/TransitionAnimator.js +683 -0
- package/src/export/CSSExporter.js +226 -0
- package/src/export/CardGeneratorBase.js +279 -0
- package/src/export/ExportManager.js +580 -0
- package/src/export/FacetedCardGenerator.js +279 -0
- package/src/export/HolographicCardGenerator.js +543 -0
- package/src/export/LottieExporter.js +552 -0
- package/src/export/QuantumCardGenerator.js +315 -0
- package/src/export/SVGExporter.js +519 -0
- package/src/export/ShaderExporter.js +903 -0
- package/src/export/TradingCardGenerator.js +3055 -0
- package/src/export/TradingCardManager.js +181 -0
- package/src/export/VIB3PackageExporter.js +559 -0
- package/src/export/index.js +14 -0
- package/src/export/systems/TradingCardSystemFaceted.js +494 -0
- package/src/export/systems/TradingCardSystemHolographic.js +452 -0
- package/src/export/systems/TradingCardSystemQuantum.js +411 -0
- package/src/faceted/FacetedSystem.js +963 -0
- package/src/features/CollectionManager.js +433 -0
- package/src/gallery/CollectionManager.js +240 -0
- package/src/gallery/GallerySystem.js +485 -0
- package/src/geometry/GeometryFactory.js +314 -0
- package/src/geometry/GeometryLibrary.js +72 -0
- package/src/geometry/buffers/BufferBuilder.js +338 -0
- package/src/geometry/buffers/index.js +18 -0
- package/src/geometry/generators/Crystal.js +420 -0
- package/src/geometry/generators/Fractal.js +298 -0
- package/src/geometry/generators/KleinBottle.js +197 -0
- package/src/geometry/generators/Sphere.js +192 -0
- package/src/geometry/generators/Tesseract.js +160 -0
- package/src/geometry/generators/Tetrahedron.js +225 -0
- package/src/geometry/generators/Torus.js +304 -0
- package/src/geometry/generators/Wave.js +341 -0
- package/src/geometry/index.js +142 -0
- package/src/geometry/warp/HypersphereCore.js +211 -0
- package/src/geometry/warp/HypertetraCore.js +386 -0
- package/src/geometry/warp/index.js +57 -0
- package/src/holograms/HolographicVisualizer.js +1073 -0
- package/src/holograms/RealHolographicSystem.js +966 -0
- package/src/holograms/variantRegistry.js +69 -0
- package/src/integrations/FigmaPlugin.js +854 -0
- package/src/integrations/OBSMode.js +754 -0
- package/src/integrations/ThreeJsPackage.js +660 -0
- package/src/integrations/TouchDesignerExport.js +552 -0
- package/src/integrations/frameworks/Vib3React.js +591 -0
- package/src/integrations/frameworks/Vib3Svelte.js +654 -0
- package/src/integrations/frameworks/Vib3Vue.js +628 -0
- package/src/llm/LLMParameterInterface.js +240 -0
- package/src/llm/LLMParameterUI.js +577 -0
- package/src/math/Mat4x4.js +708 -0
- package/src/math/Projection.js +341 -0
- package/src/math/Rotor4D.js +637 -0
- package/src/math/Vec4.js +476 -0
- package/src/math/constants.js +164 -0
- package/src/math/index.js +68 -0
- package/src/math/projections.js +54 -0
- package/src/math/rotations.js +196 -0
- package/src/quantum/QuantumEngine.js +906 -0
- package/src/quantum/QuantumVisualizer.js +1103 -0
- package/src/reactivity/ReactivityConfig.js +499 -0
- package/src/reactivity/ReactivityManager.js +586 -0
- package/src/reactivity/SpatialInputSystem.js +1783 -0
- package/src/reactivity/index.js +93 -0
- package/src/render/CommandBuffer.js +465 -0
- package/src/render/MultiCanvasBridge.js +340 -0
- package/src/render/RenderCommand.js +514 -0
- package/src/render/RenderResourceRegistry.js +523 -0
- package/src/render/RenderState.js +552 -0
- package/src/render/RenderTarget.js +512 -0
- package/src/render/ShaderLoader.js +253 -0
- package/src/render/ShaderProgram.js +599 -0
- package/src/render/UnifiedRenderBridge.js +496 -0
- package/src/render/backends/WebGLBackend.js +1108 -0
- package/src/render/backends/WebGPUBackend.js +1409 -0
- package/src/render/commands/CommandBufferExecutor.js +607 -0
- package/src/render/commands/RenderCommandBuffer.js +661 -0
- package/src/render/commands/index.js +17 -0
- package/src/render/index.js +367 -0
- package/src/scene/Disposable.js +498 -0
- package/src/scene/MemoryPool.js +618 -0
- package/src/scene/Node4D.js +697 -0
- package/src/scene/ResourceManager.js +599 -0
- package/src/scene/Scene4D.js +540 -0
- package/src/scene/index.js +98 -0
- package/src/schemas/error.schema.json +84 -0
- package/src/schemas/extension.schema.json +88 -0
- package/src/schemas/index.js +214 -0
- package/src/schemas/parameters.schema.json +142 -0
- package/src/schemas/tool-pack.schema.json +44 -0
- package/src/schemas/tool-response.schema.json +127 -0
- package/src/shaders/common/fullscreen.vert.glsl +5 -0
- package/src/shaders/common/fullscreen.vert.wgsl +17 -0
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +85 -0
- package/src/shaders/common/rotation4d.wgsl +86 -0
- package/src/shaders/common/uniforms.glsl +44 -0
- package/src/shaders/common/uniforms.wgsl +48 -0
- package/src/shaders/faceted/faceted.frag.glsl +129 -0
- package/src/shaders/faceted/faceted.frag.wgsl +164 -0
- package/src/shaders/holographic/holographic.frag.glsl +406 -0
- package/src/shaders/holographic/holographic.frag.wgsl +185 -0
- package/src/shaders/quantum/quantum.frag.glsl +513 -0
- package/src/shaders/quantum/quantum.frag.wgsl +361 -0
- package/src/testing/ParallelTestFramework.js +519 -0
- package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
- package/src/testing/exportFormats.test.js +8 -0
- package/src/testing/projections.test.js +14 -0
- package/src/testing/rotations.test.js +37 -0
- package/src/ui/InteractivityMenu.js +516 -0
- package/src/ui/StatusManager.js +96 -0
- package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
- package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
- package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
- package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
- package/src/variations/VariationManager.js +431 -0
- package/src/viewer/AudioReactivity.js +505 -0
- package/src/viewer/CardBending.js +481 -0
- package/src/viewer/GalleryUI.js +832 -0
- package/src/viewer/ReactivityManager.js +590 -0
- package/src/viewer/TradingCardExporter.js +600 -0
- package/src/viewer/ViewerPortal.js +374 -0
- package/src/viewer/index.js +12 -0
- package/src/wasm/WasmLoader.js +296 -0
- package/src/wasm/index.js +132 -0
- package/tools/agentic/mcpTools.js +88 -0
- package/tools/cli/agent-cli.js +92 -0
- package/tools/export/formats.js +24 -0
- package/tools/math/rotation-baseline.mjs +64 -0
- package/tools/shader-sync-verify.js +937 -0
- package/tools/telemetry/manifestPipeline.js +141 -0
- package/tools/telemetry/telemetryEvents.js +35 -0
- package/types/adaptive-sdk.d.ts +185 -0
- package/types/advanced/AIPresetGenerator.d.ts +81 -0
- package/types/advanced/MIDIController.d.ts +100 -0
- package/types/advanced/OffscreenWorker.d.ts +82 -0
- package/types/advanced/WebGPUCompute.d.ts +52 -0
- package/types/advanced/WebXRRenderer.d.ts +77 -0
- package/types/advanced/index.d.ts +46 -0
- package/types/core/ErrorReporter.d.ts +50 -0
- package/types/core/VIB3Engine.d.ts +204 -0
- package/types/creative/ColorPresetsSystem.d.ts +91 -0
- package/types/creative/ParameterTimeline.d.ts +74 -0
- package/types/creative/PostProcessingPipeline.d.ts +109 -0
- package/types/creative/TransitionAnimator.d.ts +71 -0
- package/types/creative/index.d.ts +35 -0
- package/types/integrations/FigmaPlugin.d.ts +46 -0
- package/types/integrations/OBSMode.d.ts +74 -0
- package/types/integrations/ThreeJsPackage.d.ts +62 -0
- package/types/integrations/TouchDesignerExport.d.ts +36 -0
- package/types/integrations/Vib3React.d.ts +74 -0
- package/types/integrations/Vib3Svelte.d.ts +63 -0
- package/types/integrations/Vib3Vue.d.ts +55 -0
- package/types/integrations/index.d.ts +52 -0
- package/types/reactivity/SpatialInputSystem.d.ts +173 -0
- package/types/reactivity/index.d.ts +394 -0
- package/types/render/CommandBuffer.d.ts +169 -0
- package/types/render/RenderCommand.d.ts +312 -0
- package/types/render/RenderState.d.ts +279 -0
- package/types/render/RenderTarget.d.ts +254 -0
- package/types/render/ShaderProgram.d.ts +277 -0
- package/types/render/UnifiedRenderBridge.d.ts +143 -0
- package/types/render/WebGLBackend.d.ts +168 -0
- package/types/render/WebGPUBackend.d.ts +186 -0
- package/types/render/index.d.ts +141 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIB3Package Exporter
|
|
3
|
+
*
|
|
4
|
+
* Creates comprehensive, portable visualization packages that include:
|
|
5
|
+
* - Visual parameters
|
|
6
|
+
* - Reactivity configuration (audio/tilt/interaction)
|
|
7
|
+
* - Self-contained embed code
|
|
8
|
+
* - Integration helpers for various platforms
|
|
9
|
+
*
|
|
10
|
+
* Export targets: Web, Video, OBS, React, Vue, Web Components
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { ReactivityConfig } from '../reactivity/ReactivityConfig.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* VIB3Package format version
|
|
17
|
+
*/
|
|
18
|
+
export const VIB3_PACKAGE_VERSION = '2.0';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generate a unique package ID
|
|
22
|
+
*/
|
|
23
|
+
function generatePackageId() {
|
|
24
|
+
return `vib3_${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* VIB3PackageExporter - Creates portable visualization packages
|
|
29
|
+
*/
|
|
30
|
+
export class VIB3PackageExporter {
|
|
31
|
+
constructor(options = {}) {
|
|
32
|
+
this.options = {
|
|
33
|
+
author: options.author || 'VIB3+ User',
|
|
34
|
+
email: options.email || '',
|
|
35
|
+
license: options.license || 'All Rights Reserved',
|
|
36
|
+
...options
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Create a full VIB3Package from current state
|
|
42
|
+
*
|
|
43
|
+
* @param {object} visualParams - Current visual parameters
|
|
44
|
+
* @param {object} reactivityConfig - Current ReactivityConfig
|
|
45
|
+
* @param {object} metadata - Additional metadata
|
|
46
|
+
* @returns {object} VIB3Package
|
|
47
|
+
*/
|
|
48
|
+
createPackage(visualParams, reactivityConfig, metadata = {}) {
|
|
49
|
+
const packageId = generatePackageId();
|
|
50
|
+
const timestamp = new Date().toISOString();
|
|
51
|
+
|
|
52
|
+
// Determine system and geometry info
|
|
53
|
+
const system = visualParams.system || 'quantum';
|
|
54
|
+
const geometryIndex = visualParams.geometry || 0;
|
|
55
|
+
const coreIndex = Math.floor(geometryIndex / 8);
|
|
56
|
+
const baseIndex = geometryIndex % 8;
|
|
57
|
+
|
|
58
|
+
const baseNames = ['Tetrahedron', 'Hypercube', 'Sphere', 'Torus', 'Klein Bottle', 'Fractal', 'Wave', 'Crystal'];
|
|
59
|
+
const coreNames = ['Base', 'Hypersphere', 'Hypertetrahedron'];
|
|
60
|
+
|
|
61
|
+
const package_ = {
|
|
62
|
+
// Package metadata
|
|
63
|
+
id: packageId,
|
|
64
|
+
version: VIB3_PACKAGE_VERSION,
|
|
65
|
+
type: 'vib3-package',
|
|
66
|
+
name: metadata.name || `VIB3 ${system} Visualization`,
|
|
67
|
+
description: metadata.description || `${baseNames[baseIndex]} with ${coreNames[coreIndex]} core`,
|
|
68
|
+
created: timestamp,
|
|
69
|
+
modified: timestamp,
|
|
70
|
+
|
|
71
|
+
// Author info
|
|
72
|
+
author: {
|
|
73
|
+
name: this.options.author,
|
|
74
|
+
email: this.options.email
|
|
75
|
+
},
|
|
76
|
+
license: this.options.license,
|
|
77
|
+
|
|
78
|
+
// Visual state
|
|
79
|
+
visual: {
|
|
80
|
+
system,
|
|
81
|
+
geometry: {
|
|
82
|
+
index: geometryIndex,
|
|
83
|
+
baseIndex,
|
|
84
|
+
coreIndex,
|
|
85
|
+
baseName: baseNames[baseIndex],
|
|
86
|
+
coreName: coreNames[coreIndex],
|
|
87
|
+
formula: `${coreIndex} × 8 + ${baseIndex} = ${geometryIndex}`
|
|
88
|
+
},
|
|
89
|
+
parameters: { ...visualParams },
|
|
90
|
+
rotation6D: {
|
|
91
|
+
'3D': {
|
|
92
|
+
XY: visualParams.rot4dXY || 0,
|
|
93
|
+
XZ: visualParams.rot4dXZ || 0,
|
|
94
|
+
YZ: visualParams.rot4dYZ || 0
|
|
95
|
+
},
|
|
96
|
+
'4D': {
|
|
97
|
+
XW: visualParams.rot4dXW || 0,
|
|
98
|
+
YW: visualParams.rot4dYW || 0,
|
|
99
|
+
ZW: visualParams.rot4dZW || 0
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// Reactivity behavior
|
|
105
|
+
reactivity: reactivityConfig instanceof ReactivityConfig
|
|
106
|
+
? reactivityConfig.getConfig()
|
|
107
|
+
: (reactivityConfig || null),
|
|
108
|
+
|
|
109
|
+
// Embed code (generated)
|
|
110
|
+
embed: this.generateEmbedCode(visualParams, reactivityConfig, packageId),
|
|
111
|
+
|
|
112
|
+
// Integration helpers
|
|
113
|
+
integrations: this.generateIntegrations(packageId, visualParams),
|
|
114
|
+
|
|
115
|
+
// Agentic control info
|
|
116
|
+
agent: {
|
|
117
|
+
mcpToolHint: 'Use set_rotation, set_visual_parameters, or load_from_gallery',
|
|
118
|
+
cliCommand: `vib3 load --package ${packageId}`,
|
|
119
|
+
apiEndpoint: `/api/v1/packages/${packageId}`,
|
|
120
|
+
eventTypes: [
|
|
121
|
+
'vib3.package.loaded',
|
|
122
|
+
'vib3.parameter.change',
|
|
123
|
+
'vib3.reactivity.update'
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
// Compatibility info
|
|
128
|
+
compatibility: {
|
|
129
|
+
browsers: ['Chrome 90+', 'Firefox 88+', 'Safari 14+', 'Edge 90+'],
|
|
130
|
+
features: ['WebGL2', 'WebAudio', 'DeviceOrientation'],
|
|
131
|
+
fallbacks: ['WebGL1', 'Canvas2D'],
|
|
132
|
+
mobileSupported: true
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return package_;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Generate embed code for different formats
|
|
141
|
+
*/
|
|
142
|
+
generateEmbedCode(visualParams, reactivityConfig, packageId) {
|
|
143
|
+
const configJson = JSON.stringify({
|
|
144
|
+
visual: visualParams,
|
|
145
|
+
reactivity: reactivityConfig instanceof ReactivityConfig
|
|
146
|
+
? reactivityConfig.getConfig()
|
|
147
|
+
: reactivityConfig
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// HTML embed (self-contained)
|
|
151
|
+
const htmlEmbed = this.generateHTMLEmbed(visualParams, reactivityConfig, packageId);
|
|
152
|
+
|
|
153
|
+
// CSS for styling
|
|
154
|
+
const cssEmbed = this.generateCSSEmbed(visualParams);
|
|
155
|
+
|
|
156
|
+
// JavaScript for initialization
|
|
157
|
+
const jsEmbed = this.generateJSEmbed(visualParams, reactivityConfig, packageId);
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
// Full self-contained HTML
|
|
161
|
+
html: htmlEmbed,
|
|
162
|
+
|
|
163
|
+
// Modular pieces
|
|
164
|
+
css: cssEmbed,
|
|
165
|
+
js: jsEmbed,
|
|
166
|
+
|
|
167
|
+
// Config as JSON string
|
|
168
|
+
configJson,
|
|
169
|
+
|
|
170
|
+
// CDN URLs (placeholder - would be actual CDN in production)
|
|
171
|
+
cdn: {
|
|
172
|
+
script: `https://cdn.vib3.dev/embed/${VIB3_PACKAGE_VERSION}/vib3-embed.min.js`,
|
|
173
|
+
style: `https://cdn.vib3.dev/embed/${VIB3_PACKAGE_VERSION}/vib3-embed.min.css`,
|
|
174
|
+
wasm: `https://cdn.vib3.dev/wasm/${VIB3_PACKAGE_VERSION}/vib3_core.wasm`
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
// Iframe embed
|
|
178
|
+
iframe: `<iframe src="https://vib3.dev/embed/${packageId}" width="100%" height="400" frameborder="0" allowfullscreen></iframe>`,
|
|
179
|
+
|
|
180
|
+
// Script tag embed
|
|
181
|
+
scriptTag: `<script src="https://cdn.vib3.dev/embed.js" data-vib3-config='${configJson}'></script>`
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Generate self-contained HTML embed
|
|
187
|
+
*/
|
|
188
|
+
generateHTMLEmbed(visualParams, reactivityConfig, packageId) {
|
|
189
|
+
const system = visualParams.system || 'quantum';
|
|
190
|
+
const hue = visualParams.hue || 200;
|
|
191
|
+
|
|
192
|
+
return `<!DOCTYPE html>
|
|
193
|
+
<html lang="en">
|
|
194
|
+
<head>
|
|
195
|
+
<meta charset="UTF-8">
|
|
196
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
197
|
+
<title>VIB3+ Visualization - ${packageId}</title>
|
|
198
|
+
<style>
|
|
199
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
200
|
+
body { background: #000; overflow: hidden; }
|
|
201
|
+
#vib3-container {
|
|
202
|
+
width: 100vw;
|
|
203
|
+
height: 100vh;
|
|
204
|
+
position: relative;
|
|
205
|
+
}
|
|
206
|
+
canvas {
|
|
207
|
+
width: 100%;
|
|
208
|
+
height: 100%;
|
|
209
|
+
display: block;
|
|
210
|
+
}
|
|
211
|
+
.vib3-watermark {
|
|
212
|
+
position: fixed;
|
|
213
|
+
bottom: 10px;
|
|
214
|
+
right: 10px;
|
|
215
|
+
font-family: 'Orbitron', sans-serif;
|
|
216
|
+
font-size: 10px;
|
|
217
|
+
color: rgba(255, 255, 255, 0.3);
|
|
218
|
+
pointer-events: none;
|
|
219
|
+
}
|
|
220
|
+
</style>
|
|
221
|
+
</head>
|
|
222
|
+
<body>
|
|
223
|
+
<div id="vib3-container">
|
|
224
|
+
<canvas id="vib3-canvas"></canvas>
|
|
225
|
+
<div class="vib3-watermark">VIB3+ Engine</div>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<script>
|
|
229
|
+
// VIB3+ Embedded Visualization
|
|
230
|
+
// Package: ${packageId}
|
|
231
|
+
// System: ${system}
|
|
232
|
+
|
|
233
|
+
const VIB3_CONFIG = ${JSON.stringify(visualParams, null, 2)};
|
|
234
|
+
const VIB3_REACTIVITY = ${JSON.stringify(
|
|
235
|
+
reactivityConfig instanceof ReactivityConfig ? reactivityConfig.getConfig() : reactivityConfig,
|
|
236
|
+
null, 2
|
|
237
|
+
)};
|
|
238
|
+
|
|
239
|
+
class Vib3EmbeddedRenderer {
|
|
240
|
+
constructor(canvas) {
|
|
241
|
+
this.canvas = canvas;
|
|
242
|
+
this.ctx = canvas.getContext('2d');
|
|
243
|
+
this.config = VIB3_CONFIG;
|
|
244
|
+
this.time = 0;
|
|
245
|
+
this.mouse = { x: 0.5, y: 0.5 };
|
|
246
|
+
this.resize();
|
|
247
|
+
this.setupEvents();
|
|
248
|
+
this.render();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
resize() {
|
|
252
|
+
this.canvas.width = window.innerWidth;
|
|
253
|
+
this.canvas.height = window.innerHeight;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
setupEvents() {
|
|
257
|
+
window.addEventListener('resize', () => this.resize());
|
|
258
|
+
this.canvas.addEventListener('mousemove', (e) => {
|
|
259
|
+
this.mouse.x = e.clientX / this.canvas.width;
|
|
260
|
+
this.mouse.y = e.clientY / this.canvas.height;
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
render() {
|
|
265
|
+
const ctx = this.ctx;
|
|
266
|
+
const w = this.canvas.width;
|
|
267
|
+
const h = this.canvas.height;
|
|
268
|
+
const t = this.time * 0.001 * (this.config.speed || 1);
|
|
269
|
+
|
|
270
|
+
// Clear
|
|
271
|
+
ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
|
|
272
|
+
ctx.fillRect(0, 0, w, h);
|
|
273
|
+
|
|
274
|
+
// Generate visualization based on config
|
|
275
|
+
const hue = this.config.hue || ${hue};
|
|
276
|
+
const density = this.config.gridDensity || 15;
|
|
277
|
+
const morph = this.config.morphFactor || 1;
|
|
278
|
+
const chaos = this.config.chaos || 0.2;
|
|
279
|
+
|
|
280
|
+
const centerX = w / 2 + (this.mouse.x - 0.5) * w * 0.2;
|
|
281
|
+
const centerY = h / 2 + (this.mouse.y - 0.5) * h * 0.2;
|
|
282
|
+
|
|
283
|
+
// Draw geometry
|
|
284
|
+
for (let i = 0; i < density * 10; i++) {
|
|
285
|
+
const angle = (i / (density * 10)) * Math.PI * 2;
|
|
286
|
+
const radius = 100 + Math.sin(t + angle * morph) * 50 + Math.random() * chaos * 30;
|
|
287
|
+
|
|
288
|
+
const x = centerX + Math.cos(angle + t * 0.5) * radius;
|
|
289
|
+
const y = centerY + Math.sin(angle + t * 0.5) * radius;
|
|
290
|
+
|
|
291
|
+
const particleHue = (hue + angle * 30 + t * 20) % 360;
|
|
292
|
+
ctx.fillStyle = \`hsla(\${particleHue}, 70%, 50%, 0.6)\`;
|
|
293
|
+
ctx.beginPath();
|
|
294
|
+
ctx.arc(x, y, 2 + chaos * 3, 0, Math.PI * 2);
|
|
295
|
+
ctx.fill();
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
this.time += 16;
|
|
299
|
+
requestAnimationFrame(() => this.render());
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
window.addEventListener('load', () => {
|
|
304
|
+
new Vib3EmbeddedRenderer(document.getElementById('vib3-canvas'));
|
|
305
|
+
});
|
|
306
|
+
</script>
|
|
307
|
+
</body>
|
|
308
|
+
</html>`;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Generate CSS embed
|
|
313
|
+
*/
|
|
314
|
+
generateCSSEmbed(visualParams) {
|
|
315
|
+
const hue = visualParams.hue || 200;
|
|
316
|
+
|
|
317
|
+
return `/* VIB3+ Visualization Styles */
|
|
318
|
+
:root {
|
|
319
|
+
--vib3-hue: ${hue};
|
|
320
|
+
--vib3-primary: hsl(${hue}, 70%, 50%);
|
|
321
|
+
--vib3-secondary: hsl(${(hue + 60) % 360}, 70%, 50%);
|
|
322
|
+
--vib3-accent: hsl(${(hue + 180) % 360}, 70%, 50%);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.vib3-container {
|
|
326
|
+
position: relative;
|
|
327
|
+
width: 100%;
|
|
328
|
+
height: 100%;
|
|
329
|
+
background: #000;
|
|
330
|
+
overflow: hidden;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.vib3-canvas {
|
|
334
|
+
width: 100%;
|
|
335
|
+
height: 100%;
|
|
336
|
+
display: block;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.vib3-overlay {
|
|
340
|
+
position: absolute;
|
|
341
|
+
top: 0;
|
|
342
|
+
left: 0;
|
|
343
|
+
right: 0;
|
|
344
|
+
bottom: 0;
|
|
345
|
+
pointer-events: none;
|
|
346
|
+
background: radial-gradient(
|
|
347
|
+
ellipse at center,
|
|
348
|
+
transparent 0%,
|
|
349
|
+
rgba(0, 0, 0, 0.3) 100%
|
|
350
|
+
);
|
|
351
|
+
}`;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Generate JavaScript embed
|
|
356
|
+
*/
|
|
357
|
+
generateJSEmbed(visualParams, reactivityConfig, packageId) {
|
|
358
|
+
return `// VIB3+ Embed Script
|
|
359
|
+
// Package: ${packageId}
|
|
360
|
+
|
|
361
|
+
(function() {
|
|
362
|
+
const config = ${JSON.stringify(visualParams)};
|
|
363
|
+
|
|
364
|
+
window.Vib3Embed = {
|
|
365
|
+
packageId: '${packageId}',
|
|
366
|
+
config: config,
|
|
367
|
+
|
|
368
|
+
init: function(containerId) {
|
|
369
|
+
const container = document.getElementById(containerId);
|
|
370
|
+
if (!container) {
|
|
371
|
+
console.error('VIB3: Container not found:', containerId);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Create canvas
|
|
376
|
+
const canvas = document.createElement('canvas');
|
|
377
|
+
canvas.className = 'vib3-canvas';
|
|
378
|
+
container.appendChild(canvas);
|
|
379
|
+
|
|
380
|
+
// Initialize renderer
|
|
381
|
+
this.renderer = new Vib3Renderer(canvas, config);
|
|
382
|
+
console.log('VIB3: Initialized package ${packageId}');
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
setParameter: function(name, value) {
|
|
386
|
+
if (this.renderer) {
|
|
387
|
+
this.renderer.setParameter(name, value);
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
destroy: function() {
|
|
392
|
+
if (this.renderer) {
|
|
393
|
+
this.renderer.destroy();
|
|
394
|
+
this.renderer = null;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
// Auto-init if data attribute present
|
|
400
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
401
|
+
const autoInit = document.querySelector('[data-vib3-auto]');
|
|
402
|
+
if (autoInit) {
|
|
403
|
+
window.Vib3Embed.init(autoInit.id);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
})();`;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Generate integration helpers for various platforms
|
|
411
|
+
*/
|
|
412
|
+
generateIntegrations(packageId, visualParams) {
|
|
413
|
+
const configStr = JSON.stringify(visualParams);
|
|
414
|
+
|
|
415
|
+
return {
|
|
416
|
+
// React component
|
|
417
|
+
react: `import React, { useEffect, useRef } from 'react';
|
|
418
|
+
|
|
419
|
+
export function Vib3Visualization({ config = ${configStr} }) {
|
|
420
|
+
const canvasRef = useRef(null);
|
|
421
|
+
|
|
422
|
+
useEffect(() => {
|
|
423
|
+
if (canvasRef.current) {
|
|
424
|
+
// Initialize VIB3 renderer
|
|
425
|
+
const renderer = new window.Vib3Renderer(canvasRef.current, config);
|
|
426
|
+
return () => renderer.destroy();
|
|
427
|
+
}
|
|
428
|
+
}, [config]);
|
|
429
|
+
|
|
430
|
+
return <canvas ref={canvasRef} style={{ width: '100%', height: '100%' }} />;
|
|
431
|
+
}`,
|
|
432
|
+
|
|
433
|
+
// Vue component
|
|
434
|
+
vue: `<template>
|
|
435
|
+
<canvas ref="canvas" class="vib3-canvas"></canvas>
|
|
436
|
+
</template>
|
|
437
|
+
|
|
438
|
+
<script>
|
|
439
|
+
export default {
|
|
440
|
+
name: 'Vib3Visualization',
|
|
441
|
+
props: {
|
|
442
|
+
config: {
|
|
443
|
+
type: Object,
|
|
444
|
+
default: () => (${configStr})
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
mounted() {
|
|
448
|
+
this.renderer = new window.Vib3Renderer(this.$refs.canvas, this.config);
|
|
449
|
+
},
|
|
450
|
+
beforeDestroy() {
|
|
451
|
+
if (this.renderer) this.renderer.destroy();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
</script>`,
|
|
455
|
+
|
|
456
|
+
// Web Component
|
|
457
|
+
webComponent: `<vib3-visualization
|
|
458
|
+
geometry="${visualParams.geometry || 0}"
|
|
459
|
+
system="${visualParams.system || 'quantum'}"
|
|
460
|
+
hue="${visualParams.hue || 200}"
|
|
461
|
+
speed="${visualParams.speed || 1}"
|
|
462
|
+
></vib3-visualization>
|
|
463
|
+
|
|
464
|
+
<script src="https://cdn.vib3.dev/web-component.js"></script>`,
|
|
465
|
+
|
|
466
|
+
// OBS Browser Source
|
|
467
|
+
obs: {
|
|
468
|
+
url: `https://vib3.dev/embed/${packageId}?obs=true`,
|
|
469
|
+
width: 1920,
|
|
470
|
+
height: 1080,
|
|
471
|
+
fps: 60,
|
|
472
|
+
notes: 'Add as Browser Source in OBS. Enable "Control audio via OBS" for audio reactivity.'
|
|
473
|
+
},
|
|
474
|
+
|
|
475
|
+
// Video export settings
|
|
476
|
+
video: {
|
|
477
|
+
recommendedCodec: 'H.264',
|
|
478
|
+
recommendedContainer: 'MP4',
|
|
479
|
+
recommendedResolution: { width: 1920, height: 1080 },
|
|
480
|
+
recommendedFps: 60,
|
|
481
|
+
recommendedBitrate: '20Mbps',
|
|
482
|
+
transparencySupported: true,
|
|
483
|
+
transparentFormat: 'WebM with VP9'
|
|
484
|
+
},
|
|
485
|
+
|
|
486
|
+
// After Effects
|
|
487
|
+
afterEffects: {
|
|
488
|
+
scriptPath: 'https://cdn.vib3.dev/ae/vib3-ae-script.jsx',
|
|
489
|
+
usage: 'File > Scripts > Run Script File... then import package JSON'
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Export package to JSON string
|
|
496
|
+
*/
|
|
497
|
+
exportToJSON(package_, pretty = true) {
|
|
498
|
+
return JSON.stringify(package_, null, pretty ? 2 : 0);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Export package to downloadable file
|
|
503
|
+
*/
|
|
504
|
+
downloadPackage(package_, filename = null) {
|
|
505
|
+
const json = this.exportToJSON(package_);
|
|
506
|
+
const blob = new Blob([json], { type: 'application/json' });
|
|
507
|
+
const url = URL.createObjectURL(blob);
|
|
508
|
+
|
|
509
|
+
const link = document.createElement('a');
|
|
510
|
+
link.href = url;
|
|
511
|
+
link.download = filename || `${package_.id}.vib3.json`;
|
|
512
|
+
link.click();
|
|
513
|
+
|
|
514
|
+
URL.revokeObjectURL(url);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Export HTML embed to downloadable file
|
|
519
|
+
*/
|
|
520
|
+
downloadHTMLEmbed(package_, filename = null) {
|
|
521
|
+
const html = package_.embed.html;
|
|
522
|
+
const blob = new Blob([html], { type: 'text/html' });
|
|
523
|
+
const url = URL.createObjectURL(blob);
|
|
524
|
+
|
|
525
|
+
const link = document.createElement('a');
|
|
526
|
+
link.href = url;
|
|
527
|
+
link.download = filename || `${package_.id}.html`;
|
|
528
|
+
link.click();
|
|
529
|
+
|
|
530
|
+
URL.revokeObjectURL(url);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Load package from JSON
|
|
535
|
+
*/
|
|
536
|
+
static loadFromJSON(json) {
|
|
537
|
+
const data = typeof json === 'string' ? JSON.parse(json) : json;
|
|
538
|
+
|
|
539
|
+
if (data.type !== 'vib3-package') {
|
|
540
|
+
throw new Error('Invalid VIB3 package: missing type');
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return data;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Global export function
|
|
548
|
+
export function createVIB3Package(visualParams, reactivityConfig, metadata = {}) {
|
|
549
|
+
const exporter = new VIB3PackageExporter(metadata);
|
|
550
|
+
return exporter.createPackage(visualParams, reactivityConfig, metadata);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Make available globally
|
|
554
|
+
if (typeof window !== 'undefined') {
|
|
555
|
+
window.VIB3PackageExporter = VIB3PackageExporter;
|
|
556
|
+
window.createVIB3Package = createVIB3Package;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export default VIB3PackageExporter;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIB3+ Export Module
|
|
3
|
+
*
|
|
4
|
+
* Unified exports for all format exporters.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { exportSVG, downloadSVG } from './SVGExporter.js';
|
|
8
|
+
export { exportCSS, downloadCSS, toStyleObject } from './CSSExporter.js';
|
|
9
|
+
export { exportLottie, downloadLottie } from './LottieExporter.js';
|
|
10
|
+
|
|
11
|
+
// Re-export existing managers
|
|
12
|
+
export { ExportManager } from './ExportManager.js';
|
|
13
|
+
export { CardGeneratorBase } from './CardGeneratorBase.js';
|
|
14
|
+
export { TradingCardManager } from './TradingCardManager.js';
|