@wave3d/core 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, ColorStop, DEFAULT_LIGHT_POSITION, GradientType, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PaletteSource, SceneConfig, StudioConfig, Vec2, Vec3, WaveConfig, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, normalizeBackground, normalizeWave, resizeWaves } from "./config/model.js";
2
2
  import { WaveRenderer } from "./renderer/WaveRenderer.js";
3
- import { FallbackReason, WaveHandle, WaveOptions, WaveState } from "./shell/createWave.js";
3
+ import { FallbackReason, SnapshotOptions, WaveHandle, WaveOptions, WaveState } from "./shell/createWave.js";
4
4
  import { PRESETS } from "./presets.js";
5
5
 
6
6
  //#region src/standalone.d.ts
@@ -9,5 +9,5 @@ declare function createWave(container: HTMLElement, config?: Partial<StudioConfi
9
9
  /** The drop-in embed contract: an alias of {@link createWave}. */
10
10
  declare const mountWave: typeof createWave;
11
11
  //#endregion
12
- export { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, ColorStop, DEFAULT_LIGHT_POSITION, type FallbackReason, GradientType, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PRESETS, PaletteSource, SceneConfig, StudioConfig, Vec2, Vec3, WaveConfig, type WaveHandle, type WaveOptions, WaveRenderer, type WaveState, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, createWave, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, mountWave, normalizeBackground, normalizeWave, resizeWaves };
12
+ export { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, ColorStop, DEFAULT_LIGHT_POSITION, type FallbackReason, GradientType, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PRESETS, PaletteSource, SceneConfig, type SnapshotOptions, StudioConfig, Vec2, Vec3, WaveConfig, type WaveHandle, type WaveOptions, WaveRenderer, type WaveState, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, createWave, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, mountWave, normalizeBackground, normalizeWave, resizeWaves };
13
13
  //# sourceMappingURL=standalone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.js","names":["core"],"sources":["../src/standalone.ts"],"sourcesContent":["// The single-file CDN / standalone build entry. Unlike the `.` shell — which fetches the engine on\n// demand — this statically imports the engine (three bundled in) and pre-binds createWave/mountWave\n// with a synchronous loadCore, so a plain <script type=\"module\"> from a CDN upgrades with no extra\n// network round-trip. This is also the runtime the studio inlines into its exported embed HTML.\nimport * as core from \"./core-loader\";\nimport { createWaveImpl } from \"./shell/createWave\";\nimport type { WaveOptions, WaveHandle } from \"./shell/createWave\";\nimport type { StudioConfig } from \"./config/model\";\n\n// Synchronous core — the engine is already bundled into this file, so there is no dynamic import\n// (which is exactly why the standalone stays a single file: createWaveImpl never references the\n// public createWave's `import(\"./core-loader\")` default).\nconst loadCore = (): Promise<typeof core> => Promise.resolve(core);\n\n/** {@link createWaveImpl} with the engine already bundled in (synchronous upgrade). */\nexport function createWave(\n container: HTMLElement,\n config: Partial<StudioConfig> = {},\n options: WaveOptions = {},\n): WaveHandle {\n return createWaveImpl(loadCore, container, config, options);\n}\n\n/** The drop-in embed contract: an alias of {@link createWave}. */\nexport const mountWave = createWave;\n\n// CDN users get the raw engine, presets, and full model directly too.\nexport { WaveRenderer } from \"./renderer/WaveRenderer\";\nexport { PRESETS } from \"./presets\";\nexport * from \"./config/model\";\nexport type { WaveOptions, WaveHandle, WaveState, FallbackReason } from \"./shell/createWave\";\n"],"mappings":";;;;;;AAYA,MAAM,iBAAuC,QAAQ,QAAQA,mBAAI;;AAGjE,SAAgB,WACd,WACA,SAAgC,CAAC,GACjC,UAAuB,CAAC,GACZ;CACZ,OAAO,eAAe,UAAU,WAAW,QAAQ,OAAO;AAC5D;;AAGA,MAAa,YAAY"}
1
+ {"version":3,"file":"standalone.js","names":["core"],"sources":["../src/standalone.ts"],"sourcesContent":["// The single-file CDN / standalone build entry. Unlike the `.` shell — which fetches the engine on\n// demand — this statically imports the engine (three bundled in) and pre-binds createWave/mountWave\n// with a synchronous loadCore, so a plain <script type=\"module\"> from a CDN upgrades with no extra\n// network round-trip. This is also the runtime the studio inlines into its exported embed HTML.\nimport * as core from \"./core-loader\";\nimport { createWaveImpl } from \"./shell/createWave\";\nimport type { WaveOptions, WaveHandle } from \"./shell/createWave\";\nimport type { StudioConfig } from \"./config/model\";\n\n// Synchronous core — the engine is already bundled into this file, so there is no dynamic import\n// (which is exactly why the standalone stays a single file: createWaveImpl never references the\n// public createWave's `import(\"./core-loader\")` default).\nconst loadCore = (): Promise<typeof core> => Promise.resolve(core);\n\n/** {@link createWaveImpl} with the engine already bundled in (synchronous upgrade). */\nexport function createWave(\n container: HTMLElement,\n config: Partial<StudioConfig> = {},\n options: WaveOptions = {},\n): WaveHandle {\n return createWaveImpl(loadCore, container, config, options);\n}\n\n/** The drop-in embed contract: an alias of {@link createWave}. */\nexport const mountWave = createWave;\n\n// CDN users get the raw engine, presets, and full model directly too.\nexport { WaveRenderer } from \"./renderer/WaveRenderer\";\nexport { PRESETS } from \"./presets\";\nexport * from \"./config/model\";\nexport type {\n WaveOptions,\n WaveHandle,\n WaveState,\n FallbackReason,\n SnapshotOptions,\n} from \"./shell/createWave\";\n"],"mappings":";;;;;;AAYA,MAAM,iBAAuC,QAAQ,QAAQA,mBAAI;;AAGjE,SAAgB,WACd,WACA,SAAgC,CAAC,GACjC,UAAuB,CAAC,GACZ;CACZ,OAAO,eAAe,UAAU,WAAW,QAAQ,OAAO;AAC5D;;AAGA,MAAa,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wave3d/core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Framework-agnostic 3D gradient-wave renderer + config model (the engine behind Wave Studio)",
5
5
  "keywords": [
6
6
  "animation",
@@ -33,9 +33,9 @@ load**. Framework-agnostic core, with React and web-component adapters.
33
33
  ## Install
34
34
 
35
35
  ```sh
36
- pnpm add @wave3d/react @wave3d/core three # React
37
- pnpm add @wave3d/element @wave3d/core three # <wave-3d> for Vue / Svelte / plain HTML
38
- pnpm add @wave3d/core three # framework-agnostic createWave
36
+ pnpm add @wave3d/react three # React
37
+ pnpm add @wave3d/element three # <wave-3d> for Vue / Svelte / plain HTML
38
+ pnpm add @wave3d/core three # framework-agnostic createWave
39
39
  ```
40
40
 
41
41
  `three` is a **peer dependency** of `@wave3d/core` (`>=0.180 <1`). For TypeScript, also add
@@ -125,7 +125,10 @@ The shell shows a poster immediately, then crossfades to the live wave.
125
125
 
126
126
  - **Poster source:** the `poster` option/prop (URL or data-URI), or — for SSR — an
127
127
  `<img data-wave3d-poster>` you render inside the container; the shell **adopts** it (no hydration
128
- flash). React: pass it as a child. Generate a poster from the studio's Export code dialog.
128
+ flash). React: pass it as a child.
129
+ - **Make a poster:** the studio's Export dialog, or capture the live frame at runtime — once
130
+ running, `handle.snapshot()` (core/element) or `onReady(renderer)` → `renderer.captureImage()`
131
+ (React) resolves an image Blob you can host and feed back as the `poster`.
129
132
  - **`onFallback(reason)`** fires when the shell keeps the poster instead of upgrading; reasons:
130
133
  `"no-webgl" | "reduced-motion" | "save-data" | "context-lost" | "load-error"`.
131
134
  - **`onStateChange(state)`**: `"poster" → "loading" → "running"`, or `"fallback"`.