@wave3d/core 0.6.0 → 0.8.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.
- package/dist/config/model.d.ts +100 -8
- package/dist/config/model.js +47 -1
- package/dist/config/model.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/presets.d.ts +8 -2
- package/dist/presets.js +472 -1
- package/dist/presets.js.map +1 -1
- package/dist/renderer/WaveGeometry.d.ts +22 -3
- package/dist/renderer/WaveGeometry.js +22 -3
- package/dist/renderer/WaveGeometry.js.map +1 -1
- package/dist/renderer/WaveRenderer.d.ts +22 -0
- package/dist/renderer/WaveRenderer.js +107 -1
- package/dist/renderer/WaveRenderer.js.map +1 -1
- package/dist/renderer/palette.d.ts +1 -1
- package/dist/renderer/palette.js +7 -5
- package/dist/renderer/palette.js.map +1 -1
- package/dist/renderer/particleField.d.ts +81 -0
- package/dist/renderer/particleField.js +357 -0
- package/dist/renderer/particleField.js.map +1 -0
- package/dist/renderer/shaders.js +377 -127
- package/dist/renderer/shaders.js.map +1 -1
- package/dist/standalone/wave3d.standalone.js +2621 -1787
- package/dist/standalone.d.ts +2 -2
- package/dist/standalone.js +2 -2
- package/dist/studio/thumbnail.d.ts +2 -2
- package/dist/studio/thumbnail.js +16 -7
- package/dist/studio/thumbnail.js.map +1 -1
- package/package.json +6 -4
- package/skills/wave3d/SKILL.md +1 -1
package/dist/standalone.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, CAMERA_FITS, CameraFit, ColorStop, DEFAULT_LIGHT_POSITION, GradientType, InteractionSource, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PaletteSource, SceneConfig, SceneInteractionBinding, SceneInteractionConfig, SceneInteractionTarget, StudioConfig, Vec2, Vec3, WaveConfig, WaveHoverConfig, WaveInteractionBinding, WaveInteractionConfig, WaveInteractionTarget, WavePressConfig, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, normalizeBackground, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves } from "./config/model.js";
|
|
1
|
+
import { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, CAMERA_FITS, CameraFit, ColorStop, DEFAULT_LIGHT_POSITION, GradientType, InteractionSource, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PARTICLE_SHAPES, PaletteSource, ParticleShape, ParticlesConfig, SceneConfig, SceneInteractionBinding, SceneInteractionConfig, SceneInteractionTarget, StudioConfig, Vec2, Vec3, WaveConfig, WaveHoverConfig, WaveInteractionBinding, WaveInteractionConfig, WaveInteractionTarget, WavePressConfig, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, normalizeBackground, normalizeParticles, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves } from "./config/model.js";
|
|
2
2
|
import { WaveRenderer } from "./renderer/WaveRenderer.js";
|
|
3
3
|
import { FallbackReason, SnapshotOptions, WaveHandle, WaveOptions, WaveState } from "./shell/createWave.js";
|
|
4
4
|
import { PRESETS } from "./presets.js";
|
|
@@ -8,5 +8,5 @@ declare function createWave(container: HTMLElement, config?: Partial<StudioConfi
|
|
|
8
8
|
/** The drop-in embed contract: an alias of {@link createWave}. */
|
|
9
9
|
declare const mountWave: typeof createWave;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, CAMERA_FITS, CameraFit, ColorStop, DEFAULT_LIGHT_POSITION, type FallbackReason, GradientType, InteractionSource, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PRESETS, PaletteSource, SceneConfig, SceneInteractionBinding, SceneInteractionConfig, SceneInteractionTarget, type SnapshotOptions, StudioConfig, Vec2, Vec3, WaveConfig, type WaveHandle, WaveHoverConfig, WaveInteractionBinding, WaveInteractionConfig, WaveInteractionTarget, type WaveOptions, WavePressConfig, WaveRenderer, type WaveState, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, createWave, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, mountWave, normalizeBackground, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves };
|
|
11
|
+
export { BackgroundImageFit, BackgroundMode, BasicGradientType, BlendMode, CAMERA_FITS, CameraFit, ColorStop, DEFAULT_LIGHT_POSITION, type FallbackReason, GradientType, InteractionSource, LightConfig, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, MeshGradientPoint, NoiseBand, PARTICLE_SHAPES, PRESETS, PaletteSource, ParticleShape, ParticlesConfig, SceneConfig, SceneInteractionBinding, SceneInteractionConfig, SceneInteractionTarget, type SnapshotOptions, StudioConfig, Vec2, Vec3, WaveConfig, type WaveHandle, WaveHoverConfig, WaveInteractionBinding, WaveInteractionConfig, WaveInteractionTarget, type WaveOptions, WavePressConfig, WaveRenderer, type WaveState, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, createWave, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, mountWave, normalizeBackground, normalizeParticles, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves };
|
|
12
12
|
//# sourceMappingURL=standalone.d.ts.map
|
package/dist/standalone.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CAMERA_FITS, DEFAULT_LIGHT_POSITION, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, normalizeBackground, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves } from "./config/model.js";
|
|
1
|
+
import { CAMERA_FITS, DEFAULT_LIGHT_POSITION, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, PARTICLE_SHAPES, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, normalizeBackground, normalizeParticles, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves } from "./config/model.js";
|
|
2
2
|
import { createWaveImpl } from "./shell/createWave.js";
|
|
3
3
|
import { WaveRenderer } from "./renderer/WaveRenderer.js";
|
|
4
4
|
import { PRESETS } from "./presets.js";
|
|
@@ -12,6 +12,6 @@ function createWave(container, config = {}, options = {}) {
|
|
|
12
12
|
/** The drop-in embed contract: an alias of {@link createWave}. */
|
|
13
13
|
const mountWave = createWave;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { CAMERA_FITS, DEFAULT_LIGHT_POSITION, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, PRESETS, WaveRenderer, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, createWave, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, mountWave, normalizeBackground, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves };
|
|
15
|
+
export { CAMERA_FITS, DEFAULT_LIGHT_POSITION, MAX_COLORS, MAX_LIGHTS, MAX_MESH_POINTS, MAX_NOISE_BANDS, MAX_WAVES, PARTICLE_SHAPES, PRESETS, WaveRenderer, createDefaultConfig, createDefaultMeshPoints, createLight, createNoiseBand, createWave, ensureCamera, ensureSceneDefaults, ensureStudioConfig, makeStops, makeWave, makeWaveSpread, mountWave, normalizeBackground, normalizeParticles, normalizeSceneInteraction, normalizeWave, normalizeWaveInteraction, resizeWaves };
|
|
16
16
|
|
|
17
17
|
//# sourceMappingURL=standalone.js.map
|
|
@@ -3,8 +3,8 @@ import { WaveRenderer } from "../renderer/WaveRenderer.js";
|
|
|
3
3
|
//#region src/studio/thumbnail.d.ts
|
|
4
4
|
/** A hidden host div that is in layout (so clientWidth/Height are real) but off-screen. */
|
|
5
5
|
declare function createThumbHost(width: number, height: number): HTMLDivElement;
|
|
6
|
-
/** Mutate `cfg` for a thumbnail still: static frame, opaque,
|
|
7
|
-
*
|
|
6
|
+
/** Mutate `cfg` for a thumbnail still: static frame, opaque, and a background chosen to show the
|
|
7
|
+
* wave off. */
|
|
8
8
|
declare function prepThumbConfig(cfg: StudioConfig): void;
|
|
9
9
|
/** Render the current config to a fresh 2D canvas (null if the WebGL canvas is missing). */
|
|
10
10
|
declare function renderThumbFrame(renderer: WaveRenderer, host: HTMLElement): HTMLCanvasElement | null;
|
package/dist/studio/thumbnail.js
CHANGED
|
@@ -6,16 +6,25 @@ function createThumbHost(width, height) {
|
|
|
6
6
|
document.body.appendChild(host);
|
|
7
7
|
return host;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* (
|
|
9
|
+
/** Luminance (0..1) of a solid `#rrggbb` background, or null if the background isn't a plain colour
|
|
10
|
+
* (gradient / image — no single swatch to judge). */
|
|
11
|
+
function solidBgLuminance(cfg) {
|
|
12
|
+
if (cfg.backgroundMode !== "color") return null;
|
|
13
|
+
const m = /^#?([\da-f]{6})$/i.exec(cfg.background ?? "");
|
|
14
|
+
if (!m) return null;
|
|
15
|
+
const n = Number.parseInt(m[1], 16);
|
|
16
|
+
return (.2126 * (n >> 16 & 255) + .7152 * (n >> 8 & 255) + .0722 * (n & 255)) / 255;
|
|
17
|
+
}
|
|
18
|
+
/** Mutate `cfg` for a thumbnail still: static frame, opaque, and a background chosen to show the
|
|
19
|
+
* wave off. */
|
|
11
20
|
function prepThumbConfig(cfg) {
|
|
12
21
|
cfg.paused = true;
|
|
13
22
|
cfg.transparentBackground = false;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
const lum = solidBgLuminance(cfg);
|
|
24
|
+
if (cfg.waves[0]?.theme === "wireframe" || lum !== null && lum < .22) return;
|
|
25
|
+
cfg.background = "#ffffff";
|
|
26
|
+
cfg.bloomStrength = 0;
|
|
27
|
+
cfg.innerLight = 0;
|
|
19
28
|
}
|
|
20
29
|
/** Render the current config to a fresh 2D canvas (null if the WebGL canvas is missing). */
|
|
21
30
|
function renderThumbFrame(renderer, host) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thumbnail.js","names":[],"sources":["../../src/studio/thumbnail.ts"],"sourcesContent":["/**\n * Offscreen thumbnail rendering: turn a config into a still frame with one hidden, reused\n * WaveRenderer. Used by the studio's preset + history thumbnails and by the wave gallery grid.\n */\nimport type { WaveRenderer } from \"../renderer/WaveRenderer\";\nimport type { StudioConfig } from \"../config/model\";\n\n/** A hidden host div that is in layout (so clientWidth/Height are real) but off-screen. */\nexport function createThumbHost(width: number, height: number): HTMLDivElement {\n const host = document.createElement(\"div\");\n host.style.cssText = `position:fixed;left:-10000px;top:0;width:${width}px;height:${height}px;opacity:0;pointer-events:none;`;\n document.body.appendChild(host);\n return host;\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"thumbnail.js","names":[],"sources":["../../src/studio/thumbnail.ts"],"sourcesContent":["/**\n * Offscreen thumbnail rendering: turn a config into a still frame with one hidden, reused\n * WaveRenderer. Used by the studio's preset + history thumbnails and by the wave gallery grid.\n */\nimport type { WaveRenderer } from \"../renderer/WaveRenderer\";\nimport type { StudioConfig } from \"../config/model\";\n\n/** A hidden host div that is in layout (so clientWidth/Height are real) but off-screen. */\nexport function createThumbHost(width: number, height: number): HTMLDivElement {\n const host = document.createElement(\"div\");\n host.style.cssText = `position:fixed;left:-10000px;top:0;width:${width}px;height:${height}px;opacity:0;pointer-events:none;`;\n document.body.appendChild(host);\n return host;\n}\n\n/** Luminance (0..1) of a solid `#rrggbb` background, or null if the background isn't a plain colour\n * (gradient / image — no single swatch to judge). */\nfunction solidBgLuminance(cfg: StudioConfig): number | null {\n if (cfg.backgroundMode !== \"color\") return null;\n const m = /^#?([\\da-f]{6})$/i.exec(cfg.background ?? \"\");\n if (!m) return null;\n const n = Number.parseInt(m[1], 16);\n return (0.2126 * ((n >> 16) & 255) + 0.7152 * ((n >> 8) & 255) + 0.0722 * (n & 255)) / 255;\n}\n\n/** Mutate `cfg` for a thumbnail still: static frame, opaque, and a background chosen to show the\n * wave off. */\nexport function prepThumbConfig(cfg: StudioConfig): void {\n cfg.paused = true;\n cfg.transparentBackground = false;\n // Keep the authored background when the preset was designed on a dark ground: wireframe (its\n // between-line colour keys off the dark page), or any solid theme on its own dark, opaque colour\n // (e.g. Latte Ring — a warm ring that a white card just washes out). A bright wave reads fine\n // against dark and bloom behaves there.\n const lum = solidBgLuminance(cfg);\n if (cfg.waves[0]?.theme === \"wireframe\" || (lum !== null && lum < 0.22)) return;\n // Otherwise swap in a white card so the SHAPE stands out, and zero the light-scatter passes: they\n // were tuned against the dark original, and white sits far above any sane threshold, so they'd\n // bloom the card itself and wash the frame out (a bloomed preset rendered a blank white thumbnail\n // — 0.3% non-white pixels — until this zeroed them).\n cfg.background = \"#ffffff\";\n cfg.bloomStrength = 0;\n cfg.innerLight = 0;\n}\n\n/** Render the current config to a fresh 2D canvas (null if the WebGL canvas is missing). */\nexport function renderThumbFrame(\n renderer: WaveRenderer,\n host: HTMLElement,\n): HTMLCanvasElement | null {\n renderer.resize();\n renderer.renderOnce();\n renderer.renderOnce(); // 2nd pass so any shader recompile (theme/blend variant) is applied\n const gl = host.querySelector(\"canvas\");\n if (!gl) return null;\n // Copy to a 2D canvas before encoding (reliable read of the WebGL drawing buffer).\n const out = document.createElement(\"canvas\");\n out.width = gl.width;\n out.height = gl.height;\n out.getContext(\"2d\")?.drawImage(gl, 0, 0);\n return out;\n}\n"],"mappings":";;AAQA,SAAgB,gBAAgB,OAAe,QAAgC;CAC7E,MAAM,OAAO,SAAS,cAAc,KAAK;CACzC,KAAK,MAAM,UAAU,4CAA4C,MAAM,YAAY,OAAO;CAC1F,SAAS,KAAK,YAAY,IAAI;CAC9B,OAAO;AACT;;;AAIA,SAAS,iBAAiB,KAAkC;CAC1D,IAAI,IAAI,mBAAmB,SAAS,OAAO;CAC3C,MAAM,IAAI,oBAAoB,KAAK,IAAI,cAAc,EAAE;CACvD,IAAI,CAAC,GAAG,OAAO;CACf,MAAM,IAAI,OAAO,SAAS,EAAE,IAAI,EAAE;CAClC,QAAQ,SAAW,KAAK,KAAM,OAAO,SAAW,KAAK,IAAK,OAAO,SAAU,IAAI,QAAQ;AACzF;;;AAIA,SAAgB,gBAAgB,KAAyB;CACvD,IAAI,SAAS;CACb,IAAI,wBAAwB;CAK5B,MAAM,MAAM,iBAAiB,GAAG;CAChC,IAAI,IAAI,MAAM,EAAE,EAAE,UAAU,eAAgB,QAAQ,QAAQ,MAAM,KAAO;CAKzE,IAAI,aAAa;CACjB,IAAI,gBAAgB;CACpB,IAAI,aAAa;AACnB;;AAGA,SAAgB,iBACd,UACA,MAC0B;CAC1B,SAAS,OAAO;CAChB,SAAS,WAAW;CACpB,SAAS,WAAW;CACpB,MAAM,KAAK,KAAK,cAAc,QAAQ;CACtC,IAAI,CAAC,IAAI,OAAO;CAEhB,MAAM,MAAM,SAAS,cAAc,QAAQ;CAC3C,IAAI,QAAQ,GAAG;CACf,IAAI,SAAS,GAAG;CAChB,IAAI,WAAW,IAAI,CAAC,EAAE,UAAU,IAAI,GAAG,CAAC;CACxC,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wave3d/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Framework-agnostic 3D gradient-wave renderer + config model (the engine behind Wave Studio)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animation",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@tanstack/intent": "^0.3.
|
|
57
|
+
"@tanstack/intent": "^0.3.6",
|
|
58
58
|
"@types/three": "^0.185.0",
|
|
59
59
|
"three": "^0.185.0",
|
|
60
60
|
"vite": "^8.1.0",
|
|
@@ -70,9 +70,11 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
|
-
"typecheck": "tsc --noEmit",
|
|
74
73
|
"build": "tsdown && pnpm build:standalone",
|
|
75
74
|
"build:standalone": "vite build --config vite.standalone.config.ts",
|
|
76
|
-
"
|
|
75
|
+
"skill:stale": "intent stale skills",
|
|
76
|
+
"skill:validate": "intent validate skills",
|
|
77
|
+
"test": "vitest run",
|
|
78
|
+
"typecheck": "tsc --noEmit"
|
|
77
79
|
}
|
|
78
80
|
}
|
package/skills/wave3d/SKILL.md
CHANGED