@luna-park/plugin-gradient 1.0.1 → 1.1.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.
@@ -193,8 +193,111 @@ function E(e, t) {
193
193
  return e === "custom" && t && t.length >= 2 ? t.slice(0, 6) : e === "custom" && t?.length === 1 ? [t[0], t[0]] : (C[e] ?? C.ember).colors;
194
194
  }
195
195
  //#endregion
196
+ //#region src/engine/shaders/fragment.glsl?raw
197
+ var D = "// Prepended by renderer.ts: `#version 300 es`, precision, MAX_COLORS and noise.glsl.\r\n\r\nuniform vec3 uColors[MAX_COLORS];\r\nuniform int uColorCount;\r\nuniform int uType;\r\nuniform vec2 uResolution;\r\nuniform float uTime;\r\nuniform vec2 uOffset;\r\nuniform float uSeed;\r\nuniform float uAngle;\r\nuniform float uWarp;\r\nuniform float uScale;\r\nuniform float uSpread;\r\nuniform float uSharpness;\r\nuniform float uBands;\r\nuniform float uGrain;\r\nuniform float uGrainSeed;\r\nuniform vec2 uPointer;\r\nuniform float uPointerStrength;\r\nuniform vec2 uPointerVelocity;\r\nuniform int uCursorEffect;\r\nuniform float uCursorRadius;\r\nuniform float uCursorStrength;\r\n\r\nout vec4 fragColor;\r\n\r\nconst int CURSOR_LENS = 0;\r\nconst int CURSOR_PINCH = 1;\r\nconst int CURSOR_SMEAR = 2;\r\n\r\nconst int TYPE_FLOW = 0;\r\nconst int TYPE_IRREGULAR = 1;\r\nconst int TYPE_EDGY = 2;\r\nconst int TYPE_MULTICOLOR = 3;\r\nconst int TYPE_RADIAL = 4;\r\nconst int TYPE_BANDING = 5;\r\nconst int TYPE_DUOTONE = 6;\r\n\r\nvec2 rotate(vec2 v, float a) {\r\n float s = sin(a);\r\n float c = cos(a);\r\n return mat2(c, s, -s, c) * v;\r\n}\r\n\r\n// Samples the colours as an evenly spaced ramp, t in [0, 1].\r\nvec3 ramp(float t) {\r\n float f = clamp(t, 0.0, 1.0) * float(uColorCount - 1);\r\n int i = min(int(floor(f)), uColorCount - 2);\r\n return mix(uColors[i], uColors[i + 1], smoothstep(0.0, 1.0, f - float(i)));\r\n}\r\n\r\n// Domain warping: pushes the position along a slowly evolving noise field.\r\nvec2 warp(vec2 p, float amount, float scale, float z) {\r\n vec3 q = vec3(p * scale, uTime + uSeed * 7.31 + z);\r\n return p + vec2(snoise(q), snoise(q + vec3(17.3, 5.1, 3.7))) * amount;\r\n}\r\n\r\n// Position of the i-th moving blob.\r\nvec2 blob(int i) {\r\n float k = float(i) * 1.618 + uSeed * 3.1;\r\n float t = uTime * 0.35;\r\n return vec2(snoise(vec3(k, t, 0.0)), snoise(vec3(t, k, 11.0))) * 0.55;\r\n}\r\n\r\n// Blobs blended by inverse distance. Higher sharpness gives harder edges.\r\nvec3 blobs(vec2 p) {\r\n vec3 sum = vec3(0.0);\r\n float total = 0.0;\r\n for (int i = 0; i < MAX_COLORS; i++) {\r\n if (i >= uColorCount) break;\r\n float d = distance(p, blob(i));\r\n float w = 1.0 / pow(d * d + 0.0005, uSharpness);\r\n sum += uColors[i] * w;\r\n total += w;\r\n }\r\n return sum / total;\r\n}\r\n\r\n// Signed position along the gradient axis, remapped to [0, 1] by uSpread.\r\nfloat linear(vec2 p) {\r\n return dot(p, vec2(cos(uAngle), sin(uAngle))) / uSpread + 0.5;\r\n}\r\n\r\nvec3 flow(vec2 p) {\r\n vec2 q = warp(p, uWarp, uScale, 0.0);\r\n q = rotate(q, -uAngle);\r\n q.x /= uSpread;\r\n\r\n // The first colour is the background. The others are soft, stretched bands stacked on y.\r\n float radius = 0.6 / uSharpness;\r\n float spacing = 0.32;\r\n float first = -0.5 * float(uColorCount - 2) * spacing;\r\n vec3 color = uColors[0];\r\n for (int i = 1; i < MAX_COLORS; i++) {\r\n if (i >= uColorCount) break;\r\n vec2 center = vec2(0.0, first + float(i - 1) * spacing);\r\n color = mix(uColors[i], color, smoothstep(0.0, radius, distance(q, center)));\r\n }\r\n return color;\r\n}\r\n\r\n// Local distortion around the cursor. Fades out with distance (Gaussian of radius uCursorRadius).\r\nvec2 cursor(vec2 p) {\r\n float strength = uPointerStrength * uCursorStrength;\r\n if (strength < 0.001) return p;\r\n\r\n vec2 d = p - uPointer;\r\n float falloff = exp(-dot(d, d) / (uCursorRadius * uCursorRadius));\r\n float amount = falloff * strength;\r\n\r\n if (uCursorEffect == CURSOR_LENS) {\r\n // Sampling closer to the cursor magnifies the colours under it.\r\n return uPointer + d * (1.0 - min(amount * 0.6, 0.95));\r\n }\r\n if (uCursorEffect == CURSOR_PINCH) {\r\n // Sampling further away shrinks the colours towards the cursor.\r\n return uPointer + d * (1.0 + amount * 0.8);\r\n }\r\n // Smear: colours trail behind the cursor like a brush stroke.\r\n return p - uPointerVelocity * amount * 0.35;\r\n}\r\n\r\nvoid main() {\r\n vec2 p = (gl_FragCoord.xy - 0.5 * uResolution) / min(uResolution.x, uResolution.y);\r\n p = cursor(p) + uOffset;\r\n\r\n vec3 color;\r\n if (uType == TYPE_FLOW) {\r\n color = flow(p);\r\n } else if (uType == TYPE_IRREGULAR) {\r\n color = blobs(warp(p, uWarp, uScale, 0.0));\r\n } else if (uType == TYPE_EDGY) {\r\n // Two warp passes fold the field. Sharp weights turn the folds into creases.\r\n vec2 q = warp(p, uWarp, uScale, 0.0);\r\n q = warp(q, uWarp * 0.6, uScale * 2.0, 31.0);\r\n color = blobs(q);\r\n } else if (uType == TYPE_MULTICOLOR) {\r\n color = ramp(linear(warp(p, uWarp, uScale, 0.0)));\r\n } else if (uType == TYPE_RADIAL) {\r\n vec2 center = vec2(snoise(vec3(uTime * 0.3, uSeed, 3.0)), snoise(vec3(uSeed, uTime * 0.3, 9.0))) * 0.2;\r\n color = ramp(length(warp(p, uWarp, uScale, 0.0) - center) / uSpread);\r\n } else if (uType == TYPE_BANDING) {\r\n float t = clamp(linear(warp(p, uWarp, uScale, 0.0)), 0.0, 0.9999);\r\n color = ramp(floor(t * uBands) / max(uBands - 1.0, 1.0));\r\n } else {\r\n float t = smoothstep(0.0, 1.0, linear(warp(p, uWarp, uScale, 0.0)));\r\n color = mix(uColors[0], uColors[uColorCount - 1], t);\r\n }\r\n\r\n // Film grain in screen pixels (static unless uGrainSeed changes). It also hides banding.\r\n color += (hash12(gl_FragCoord.xy + uGrainSeed) - 0.5) * uGrain;\r\n\r\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\r\n}\r\n", O = "// 3D simplex noise.\n// Ian McEwan, Stefan Gustavson (Ashima Arts), MIT License: https://github.com/ashima/webgl-noise\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n\n i = mod289(i);\n vec4 p = permute(permute(permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n\n// Hash without sine. David Hoskins, MIT License: https://www.shadertoy.com/view/4djSRW\nfloat hash12(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n", k = "#version 300 es\n\n// Full-screen triangle generated from gl_VertexID: no vertex buffer needed.\nvoid main() {\n vec2 position = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n}\n", A = `#version 300 es
198
+ precision highp float;
199
+ #define MAX_COLORS 6
200
+ ${O}
201
+ ${D}`, j = [
202
+ "uColors",
203
+ "uColorCount",
204
+ "uType",
205
+ "uResolution",
206
+ "uTime",
207
+ "uOffset",
208
+ "uSeed",
209
+ "uAngle",
210
+ "uWarp",
211
+ "uScale",
212
+ "uSpread",
213
+ "uSharpness",
214
+ "uBands",
215
+ "uGrain",
216
+ "uGrainSeed",
217
+ "uPointer",
218
+ "uPointerStrength",
219
+ "uPointerVelocity",
220
+ "uCursorEffect",
221
+ "uCursorRadius",
222
+ "uCursorStrength"
223
+ ], M = 2, N = class {
224
+ canvas;
225
+ ready;
226
+ onRestore;
227
+ gl;
228
+ program = null;
229
+ vao = null;
230
+ locations = null;
231
+ uniforms;
232
+ colors;
233
+ lost = !1;
234
+ disposed = !1;
235
+ constructor(e, t) {
236
+ this.canvas = e, this.uniforms = t, this.colors = S(t.colors), this.gl = e.getContext("webgl2", {
237
+ alpha: !1,
238
+ antialias: !1,
239
+ depth: !1,
240
+ premultipliedAlpha: !1
241
+ }), this.ready = this.init(), e.addEventListener("webglcontextlost", this.handleLost), e.addEventListener("webglcontextrestored", this.handleRestored);
242
+ }
243
+ get isLost() {
244
+ return this.lost;
245
+ }
246
+ setUniforms(e) {
247
+ e.colors && e.colors !== this.uniforms.colors && (this.colors = S(e.colors)), Object.assign(this.uniforms, e);
248
+ }
249
+ resize(e, t, n) {
250
+ this.canvas.width = Math.max(1, Math.round(e * n)), this.canvas.height = Math.max(1, Math.round(t * n));
251
+ }
252
+ render() {
253
+ let { gl: e, locations: t, uniforms: n } = this;
254
+ e && t && this.program && !this.lost && (e.viewport(0, 0, e.drawingBufferWidth, e.drawingBufferHeight), e.useProgram(this.program), e.uniform3fv(t.uColors, this.colors), e.uniform1i(t.uColorCount, Math.max(2, Math.min(n.colors.length, 6))), e.uniform1i(t.uType, n.type), e.uniform2f(t.uResolution, e.drawingBufferWidth, e.drawingBufferHeight), e.uniform1f(t.uTime, n.time), e.uniform2f(t.uOffset, n.offset[0], n.offset[1]), e.uniform1f(t.uSeed, n.seed), e.uniform1f(t.uAngle, n.angle * Math.PI / 180), e.uniform1f(t.uWarp, n.warp), e.uniform1f(t.uScale, n.scale), e.uniform1f(t.uSpread, n.spread), e.uniform1f(t.uSharpness, n.sharpness), e.uniform1f(t.uBands, n.bands), e.uniform1f(t.uGrain, n.grain), e.uniform1f(t.uGrainSeed, n.grainSeed), e.uniform2f(t.uPointer, n.pointer[0], n.pointer[1]), e.uniform1f(t.uPointerStrength, n.pointerStrength), e.uniform2f(t.uPointerVelocity, n.pointerVelocity[0], n.pointerVelocity[1]), e.uniform1i(t.uCursorEffect, n.cursorEffect), e.uniform1f(t.uCursorRadius, n.cursorRadius), e.uniform1f(t.uCursorStrength, n.cursorStrength), e.bindVertexArray(this.vao), e.drawArrays(e.TRIANGLES, 0, 3));
255
+ }
256
+ dispose() {
257
+ this.disposed = !0, this.canvas.removeEventListener("webglcontextlost", this.handleLost), this.canvas.removeEventListener("webglcontextrestored", this.handleRestored), this.gl?.deleteProgram(this.program), this.gl?.deleteVertexArray(this.vao), this.gl?.getExtension("WEBGL_lose_context")?.loseContext();
258
+ }
259
+ async init() {
260
+ let e = this.gl;
261
+ if (!e) return !1;
262
+ let t = P(e, e.VERTEX_SHADER, k), n = P(e, e.FRAGMENT_SHADER, A), r = e.createProgram();
263
+ return !t || !n || (e.attachShader(r, t), e.attachShader(r, n), e.linkProgram(r), await F(e, r), this.disposed || this.lost) ? !1 : e.getProgramParameter(r, e.LINK_STATUS) ? (e.deleteShader(t), e.deleteShader(n), this.program = r, this.vao = e.createVertexArray(), this.locations = Object.fromEntries(j.map((t) => [t, e.getUniformLocation(r, t)])), !0) : (console.error("[gradient] program link failed:", e.getProgramInfoLog(r), e.getShaderInfoLog(t), e.getShaderInfoLog(n)), e.deleteShader(t), e.deleteShader(n), e.deleteProgram(r), !1);
264
+ }
265
+ handleLost = (e) => {
266
+ e.preventDefault(), this.lost = !0;
267
+ };
268
+ handleRestored = () => {
269
+ this.lost = !1, this.ready = this.init(), this.ready.then((e) => {
270
+ e && this.onRestore?.();
271
+ });
272
+ };
273
+ };
274
+ function P(e, t, n) {
275
+ let r = e.createShader(t);
276
+ return r ? (e.shaderSource(r, n), e.compileShader(r), r) : null;
277
+ }
278
+ function F(e, t) {
279
+ let n = e.getExtension("KHR_parallel_shader_compile"), r = 0;
280
+ return new Promise((i) => {
281
+ function a() {
282
+ r++, (n ? e.getProgramParameter(t, n.COMPLETION_STATUS_KHR) : r > M) ? i() : requestAnimationFrame(a);
283
+ }
284
+ requestAnimationFrame(a);
285
+ });
286
+ }
287
+ //#endregion
288
+ //#region src/engine/pool.ts
289
+ var I = 4, L = [];
290
+ function R(e) {
291
+ let t = L.pop();
292
+ for (; t?.isLost;) t.dispose(), t = L.pop();
293
+ return t ? (t.setUniforms(e), t) : new N(document.createElement("canvas"), e);
294
+ }
295
+ function z(e) {
296
+ e.canvas.remove(), e.onRestore = void 0, e.isLost || L.length >= I ? e.dispose() : L.push(e);
297
+ }
298
+ //#endregion
196
299
  //#region src/engine/presets.ts
197
- var D = {
300
+ var B = {
198
301
  banding: {
199
302
  angle: -90,
200
303
  index: 5,
@@ -265,90 +368,13 @@ var D = {
265
368
  spread: .75,
266
369
  warp: .25
267
370
  }
268
- }, O = "flow", k = Object.fromEntries(Object.entries(D).map(([e, { label: t }]) => [e, t]));
269
- function A(e) {
270
- return D[e] ?? D.flow;
271
- }
272
- //#endregion
273
- //#region src/engine/shaders/fragment.glsl?raw
274
- var j = "// Prepended by renderer.ts: `#version 300 es`, precision, MAX_COLORS and noise.glsl.\r\n\r\nuniform vec3 uColors[MAX_COLORS];\r\nuniform int uColorCount;\r\nuniform int uType;\r\nuniform vec2 uResolution;\r\nuniform float uTime;\r\nuniform vec2 uOffset;\r\nuniform float uSeed;\r\nuniform float uAngle;\r\nuniform float uWarp;\r\nuniform float uScale;\r\nuniform float uSpread;\r\nuniform float uSharpness;\r\nuniform float uBands;\r\nuniform float uGrain;\r\nuniform float uGrainSeed;\r\nuniform vec2 uPointer;\r\nuniform float uPointerStrength;\r\nuniform vec2 uPointerVelocity;\r\nuniform int uCursorEffect;\r\nuniform float uCursorRadius;\r\nuniform float uCursorStrength;\r\n\r\nout vec4 fragColor;\r\n\r\nconst int CURSOR_LENS = 0;\r\nconst int CURSOR_PINCH = 1;\r\nconst int CURSOR_SMEAR = 2;\r\n\r\nconst int TYPE_FLOW = 0;\r\nconst int TYPE_IRREGULAR = 1;\r\nconst int TYPE_EDGY = 2;\r\nconst int TYPE_MULTICOLOR = 3;\r\nconst int TYPE_RADIAL = 4;\r\nconst int TYPE_BANDING = 5;\r\nconst int TYPE_DUOTONE = 6;\r\n\r\nvec2 rotate(vec2 v, float a) {\r\n float s = sin(a);\r\n float c = cos(a);\r\n return mat2(c, s, -s, c) * v;\r\n}\r\n\r\n// Samples the colours as an evenly spaced ramp, t in [0, 1].\r\nvec3 ramp(float t) {\r\n float f = clamp(t, 0.0, 1.0) * float(uColorCount - 1);\r\n int i = min(int(floor(f)), uColorCount - 2);\r\n return mix(uColors[i], uColors[i + 1], smoothstep(0.0, 1.0, f - float(i)));\r\n}\r\n\r\n// Domain warping: pushes the position along a slowly evolving noise field.\r\nvec2 warp(vec2 p, float amount, float scale, float z) {\r\n vec3 q = vec3(p * scale, uTime + uSeed * 7.31 + z);\r\n return p + vec2(snoise(q), snoise(q + vec3(17.3, 5.1, 3.7))) * amount;\r\n}\r\n\r\n// Position of the i-th moving blob.\r\nvec2 blob(int i) {\r\n float k = float(i) * 1.618 + uSeed * 3.1;\r\n float t = uTime * 0.35;\r\n return vec2(snoise(vec3(k, t, 0.0)), snoise(vec3(t, k, 11.0))) * 0.55;\r\n}\r\n\r\n// Blobs blended by inverse distance. Higher sharpness gives harder edges.\r\nvec3 blobs(vec2 p) {\r\n vec3 sum = vec3(0.0);\r\n float total = 0.0;\r\n for (int i = 0; i < MAX_COLORS; i++) {\r\n if (i >= uColorCount) break;\r\n float d = distance(p, blob(i));\r\n float w = 1.0 / pow(d * d + 0.0005, uSharpness);\r\n sum += uColors[i] * w;\r\n total += w;\r\n }\r\n return sum / total;\r\n}\r\n\r\n// Signed position along the gradient axis, remapped to [0, 1] by uSpread.\r\nfloat linear(vec2 p) {\r\n return dot(p, vec2(cos(uAngle), sin(uAngle))) / uSpread + 0.5;\r\n}\r\n\r\nvec3 flow(vec2 p) {\r\n vec2 q = warp(p, uWarp, uScale, 0.0);\r\n q = rotate(q, -uAngle);\r\n q.x /= uSpread;\r\n\r\n // The first colour is the background. The others are soft, stretched bands stacked on y.\r\n float radius = 0.6 / uSharpness;\r\n float spacing = 0.32;\r\n float first = -0.5 * float(uColorCount - 2) * spacing;\r\n vec3 color = uColors[0];\r\n for (int i = 1; i < MAX_COLORS; i++) {\r\n if (i >= uColorCount) break;\r\n vec2 center = vec2(0.0, first + float(i - 1) * spacing);\r\n color = mix(uColors[i], color, smoothstep(0.0, radius, distance(q, center)));\r\n }\r\n return color;\r\n}\r\n\r\n// Local distortion around the cursor. Fades out with distance (Gaussian of radius uCursorRadius).\r\nvec2 cursor(vec2 p) {\r\n float strength = uPointerStrength * uCursorStrength;\r\n if (strength < 0.001) return p;\r\n\r\n vec2 d = p - uPointer;\r\n float falloff = exp(-dot(d, d) / (uCursorRadius * uCursorRadius));\r\n float amount = falloff * strength;\r\n\r\n if (uCursorEffect == CURSOR_LENS) {\r\n // Sampling closer to the cursor magnifies the colours under it.\r\n return uPointer + d * (1.0 - min(amount * 0.6, 0.95));\r\n }\r\n if (uCursorEffect == CURSOR_PINCH) {\r\n // Sampling further away shrinks the colours towards the cursor.\r\n return uPointer + d * (1.0 + amount * 0.8);\r\n }\r\n // Smear: colours trail behind the cursor like a brush stroke.\r\n return p - uPointerVelocity * amount * 0.35;\r\n}\r\n\r\nvoid main() {\r\n vec2 p = (gl_FragCoord.xy - 0.5 * uResolution) / min(uResolution.x, uResolution.y);\r\n p = cursor(p) + uOffset;\r\n\r\n vec3 color;\r\n if (uType == TYPE_FLOW) {\r\n color = flow(p);\r\n } else if (uType == TYPE_IRREGULAR) {\r\n color = blobs(warp(p, uWarp, uScale, 0.0));\r\n } else if (uType == TYPE_EDGY) {\r\n // Two warp passes fold the field. Sharp weights turn the folds into creases.\r\n vec2 q = warp(p, uWarp, uScale, 0.0);\r\n q = warp(q, uWarp * 0.6, uScale * 2.0, 31.0);\r\n color = blobs(q);\r\n } else if (uType == TYPE_MULTICOLOR) {\r\n color = ramp(linear(warp(p, uWarp, uScale, 0.0)));\r\n } else if (uType == TYPE_RADIAL) {\r\n vec2 center = vec2(snoise(vec3(uTime * 0.3, uSeed, 3.0)), snoise(vec3(uSeed, uTime * 0.3, 9.0))) * 0.2;\r\n color = ramp(length(warp(p, uWarp, uScale, 0.0) - center) / uSpread);\r\n } else if (uType == TYPE_BANDING) {\r\n float t = clamp(linear(warp(p, uWarp, uScale, 0.0)), 0.0, 0.9999);\r\n color = ramp(floor(t * uBands) / max(uBands - 1.0, 1.0));\r\n } else {\r\n float t = smoothstep(0.0, 1.0, linear(warp(p, uWarp, uScale, 0.0)));\r\n color = mix(uColors[0], uColors[uColorCount - 1], t);\r\n }\r\n\r\n // Film grain in screen pixels (static unless uGrainSeed changes). It also hides banding.\r\n color += (hash12(gl_FragCoord.xy + uGrainSeed) - 0.5) * uGrain;\r\n\r\n fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\r\n}\r\n", M = "// 3D simplex noise.\n// Ian McEwan, Stefan Gustavson (Ashima Arts), MIT License: https://github.com/ashima/webgl-noise\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n vec3 x3 = x0 - D.yyy;\n\n i = mod289(i);\n vec4 p = permute(permute(permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\n float n_ = 0.142857142857;\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);\n\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n\n// Hash without sine. David Hoskins, MIT License: https://www.shadertoy.com/view/4djSRW\nfloat hash12(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n", N = "#version 300 es\n\n// Full-screen triangle generated from gl_VertexID: no vertex buffer needed.\nvoid main() {\n vec2 position = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n}\n", P = `#version 300 es
275
- precision highp float;
276
- #define MAX_COLORS 6
277
- ${M}
278
- ${j}`, F = [
279
- "uColors",
280
- "uColorCount",
281
- "uType",
282
- "uResolution",
283
- "uTime",
284
- "uOffset",
285
- "uSeed",
286
- "uAngle",
287
- "uWarp",
288
- "uScale",
289
- "uSpread",
290
- "uSharpness",
291
- "uBands",
292
- "uGrain",
293
- "uGrainSeed",
294
- "uPointer",
295
- "uPointerStrength",
296
- "uPointerVelocity",
297
- "uCursorEffect",
298
- "uCursorRadius",
299
- "uCursorStrength"
300
- ], I = class {
301
- supported;
302
- canvas;
303
- gl;
304
- program = null;
305
- vao = null;
306
- locations = null;
307
- uniforms;
308
- colors;
309
- lost = !1;
310
- onRestore;
311
- constructor(e, t, n) {
312
- this.canvas = e, this.onRestore = n, this.uniforms = t, this.colors = S(t.colors), this.gl = e.getContext("webgl2", {
313
- alpha: !1,
314
- antialias: !1,
315
- depth: !1,
316
- premultipliedAlpha: !1
317
- }), this.supported = !!this.gl && this.init(), e.addEventListener("webglcontextlost", this.handleLost), e.addEventListener("webglcontextrestored", this.handleRestored);
318
- }
319
- setUniforms(e) {
320
- e.colors && e.colors !== this.uniforms.colors && (this.colors = S(e.colors)), Object.assign(this.uniforms, e);
321
- }
322
- resize(e, t, n) {
323
- this.canvas.width = Math.max(1, Math.round(e * n)), this.canvas.height = Math.max(1, Math.round(t * n));
324
- }
325
- render() {
326
- let { gl: e, locations: t, uniforms: n } = this;
327
- e && t && this.program && !this.lost && (e.viewport(0, 0, e.drawingBufferWidth, e.drawingBufferHeight), e.useProgram(this.program), e.uniform3fv(t.uColors, this.colors), e.uniform1i(t.uColorCount, Math.max(2, Math.min(n.colors.length, 6))), e.uniform1i(t.uType, n.type), e.uniform2f(t.uResolution, e.drawingBufferWidth, e.drawingBufferHeight), e.uniform1f(t.uTime, n.time), e.uniform2f(t.uOffset, n.offset[0], n.offset[1]), e.uniform1f(t.uSeed, n.seed), e.uniform1f(t.uAngle, n.angle * Math.PI / 180), e.uniform1f(t.uWarp, n.warp), e.uniform1f(t.uScale, n.scale), e.uniform1f(t.uSpread, n.spread), e.uniform1f(t.uSharpness, n.sharpness), e.uniform1f(t.uBands, n.bands), e.uniform1f(t.uGrain, n.grain), e.uniform1f(t.uGrainSeed, n.grainSeed), e.uniform2f(t.uPointer, n.pointer[0], n.pointer[1]), e.uniform1f(t.uPointerStrength, n.pointerStrength), e.uniform2f(t.uPointerVelocity, n.pointerVelocity[0], n.pointerVelocity[1]), e.uniform1i(t.uCursorEffect, n.cursorEffect), e.uniform1f(t.uCursorRadius, n.cursorRadius), e.uniform1f(t.uCursorStrength, n.cursorStrength), e.bindVertexArray(this.vao), e.drawArrays(e.TRIANGLES, 0, 3));
328
- }
329
- dispose() {
330
- this.canvas.removeEventListener("webglcontextlost", this.handleLost), this.canvas.removeEventListener("webglcontextrestored", this.handleRestored), this.gl?.deleteProgram(this.program), this.gl?.deleteVertexArray(this.vao), this.gl?.getExtension("WEBGL_lose_context")?.loseContext();
331
- }
332
- init() {
333
- let e = this.gl;
334
- if (!e) return !1;
335
- let t = L(e, e.VERTEX_SHADER, N), n = L(e, e.FRAGMENT_SHADER, P), r = e.createProgram();
336
- return !t || !n ? !1 : (e.attachShader(r, t), e.attachShader(r, n), e.linkProgram(r), e.deleteShader(t), e.deleteShader(n), e.getProgramParameter(r, e.LINK_STATUS) ? (this.program = r, this.vao = e.createVertexArray(), this.locations = Object.fromEntries(F.map((t) => [t, e.getUniformLocation(r, t)])), !0) : (console.error("[gradient] program link failed:", e.getProgramInfoLog(r)), !1));
337
- }
338
- handleLost = (e) => {
339
- e.preventDefault(), this.lost = !0;
340
- };
341
- handleRestored = () => {
342
- this.lost = !1, this.init(), this.onRestore?.();
343
- };
344
- };
345
- function L(e, t, n) {
346
- let r = e.createShader(t);
347
- return r ? (e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[gradient] shader compile failed:", e.getShaderInfoLog(r)), e.deleteShader(r), null)) : null;
371
+ }, V = "flow", H = Object.fromEntries(Object.entries(B).map(([e, { label: t }]) => [e, t]));
372
+ function U(e) {
373
+ return B[e] ?? B.flow;
348
374
  }
349
375
  //#endregion
350
376
  //#region src/components/LpgGradient.vue?vue&type=script&setup=true&lang.ts
351
- var R = { class: "lpg-content" }, z = 1.5, B = 24, V = /*#__PURE__*/ ((e, t) => {
377
+ var W = { class: "lpg-content" }, G = 1.5, K = 24, q = /*#__PURE__*/ ((e, t) => {
352
378
  let n = e.__vccOpts || e;
353
379
  for (let [e, r] of t) n[e] = r;
354
380
  return n;
@@ -377,90 +403,94 @@ var R = { class: "lpg-content" }, z = 1.5, B = 24, V = /*#__PURE__*/ ((e, t) =>
377
403
  type: { default: "flow" }
378
404
  },
379
405
  setup(r) {
380
- let m = r, g = u("root"), _ = u("canvas"), v = c(!1), b = e(() => m.forceFallback || v.value), x = e(() => E(m.palette, m.colors)), S = e(() => A(m.type)), C = e(() => m.angle ?? S.value.angle), w = e(() => `linear-gradient(${90 - C.value}deg, ${x.value.join(", ")})`), T = e(() => ({
381
- angle: C.value,
406
+ let m = r, g = u("root"), _ = u("canvasHost"), v = c(!1), b = c(!1), x = e(() => m.forceFallback || b.value), S = e(() => E(m.palette, m.colors)), C = e(() => U(m.type)), w = e(() => m.angle ?? C.value.angle), T = e(() => `linear-gradient(${90 - w.value}deg, ${S.value.join(", ")})`), D = e(() => ({
407
+ angle: w.value,
382
408
  bands: Math.max(2, Math.round(m.bands)),
383
- colors: x.value,
409
+ colors: S.value,
384
410
  cursorEffect: (h[m.cursorEffect] ?? h.lens).index,
385
411
  cursorRadius: Math.max(1, m.cursorRadius) / 100,
386
412
  cursorStrength: Math.max(0, m.cursorStrength) / 100,
387
413
  grain: m.grain,
388
- scale: S.value.scale,
414
+ scale: C.value.scale,
389
415
  seed: m.seed,
390
- sharpness: S.value.sharpness,
391
- spread: S.value.spread,
392
- type: S.value.index,
393
- warp: S.value.warp
394
- })), D, O, k = 0, j = 0, M = 0, N = !0, P, F, L = typeof window > "u" ? void 0 : window.matchMedia("(prefers-reduced-motion: reduce)");
395
- function V(e) {
396
- if (!D || !O) return;
416
+ sharpness: C.value.sharpness,
417
+ spread: C.value.spread,
418
+ type: C.value.index,
419
+ warp: C.value.warp
420
+ })), O, k, A = 0, j = 0, M = 0, N = !0, P, F, I = typeof window > "u" ? void 0 : window.matchMedia("(prefers-reduced-motion: reduce)");
421
+ function L(e) {
422
+ if (!O || !k) return;
397
423
  M += e;
398
- let { offset: t, pointer: n, pointerStrength: r, pointerVelocity: i, time: a } = O.update(e), o = m.animateGrain && !L?.matches ? Math.floor(M * B) % 1e3 * 7.13 : 0;
399
- D.setUniforms({
424
+ let { offset: t, pointer: n, pointerStrength: r, pointerVelocity: i, time: a } = k.update(e), o = m.animateGrain && !I?.matches ? Math.floor(M * K) % 1e3 * 7.13 : 0;
425
+ O.setUniforms({
400
426
  grainSeed: o,
401
427
  offset: t,
402
428
  pointer: n,
403
429
  pointerStrength: r,
404
430
  pointerVelocity: i,
405
431
  time: a
406
- }), D.render();
432
+ }), O.render();
407
433
  }
408
- function H() {
409
- return !!O?.animated || m.animateGrain && !L?.matches;
434
+ function B() {
435
+ return !!k?.animated || m.animateGrain && !I?.matches;
410
436
  }
411
- function U(e) {
412
- k = 0;
437
+ function V(e) {
438
+ A = 0;
413
439
  let t = Math.min((e - j) / 1e3, .1);
414
- j = e, V(t), W();
415
- }
416
- function W() {
417
- !k && N && !document.hidden && H() && (j ||= performance.now(), k = requestAnimationFrame(U));
440
+ j = e, L(t), H();
418
441
  }
419
- function G() {
420
- cancelAnimationFrame(k), k = 0, j = 0;
421
- }
422
- function K() {
423
- k || V(0);
442
+ function H() {
443
+ !A && N && !document.hidden && B() && (j ||= performance.now(), A = requestAnimationFrame(V));
424
444
  }
425
445
  function q() {
426
- let e = O?.state;
427
- O?.dispose(), G(), g.value && (O = y(L?.matches ? "none" : m.motion, g.value, () => Math.max(0, Math.min(100, m.speed)) / 100, e), K(), W());
446
+ cancelAnimationFrame(A), A = 0, j = 0;
428
447
  }
429
448
  function J() {
430
- document.hidden ? G() : W();
449
+ A || L(0);
450
+ }
451
+ function Y() {
452
+ let e = k?.state;
453
+ k?.dispose(), q(), g.value && (k = y(I?.matches ? "none" : m.motion, g.value, () => Math.max(0, Math.min(100, m.speed)) / 100, e), J(), H());
454
+ }
455
+ function X() {
456
+ document.hidden ? q() : H();
431
457
  }
432
458
  return o(() => {
433
- g.value && _.value && !m.forceFallback && (D = new I(_.value, {
434
- ...T.value,
459
+ if (!g.value || !_.value || m.forceFallback) return;
460
+ let e = R({
461
+ ...D.value,
435
462
  grainSeed: 0,
436
463
  offset: [0, 0],
437
464
  pointer: [0, 0],
438
465
  pointerStrength: 0,
439
466
  pointerVelocity: [0, 0],
440
467
  time: 0
441
- }, K), D.supported ? (P = new ResizeObserver(([e]) => {
442
- D?.resize(e.contentRect.width, e.contentRect.height, Math.min(window.devicePixelRatio || 1, z)), K();
468
+ });
469
+ O = e, e.onRestore = J, _.value.append(e.canvas), e.ready.then((t) => {
470
+ O === e && (t ? (v.value = !0, J()) : (b.value = !0, e.canvas.remove(), e.dispose(), O = void 0));
471
+ }), P = new ResizeObserver(([e]) => {
472
+ O?.resize(e.contentRect.width, e.contentRect.height, Math.min(window.devicePixelRatio || 1, G)), J();
443
473
  }), P.observe(g.value), F = new IntersectionObserver(([e]) => {
444
- N = e.isIntersecting, N ? W() : G();
445
- }), F.observe(g.value), document.addEventListener("visibilitychange", J), L?.addEventListener("change", q), q()) : (v.value = !0, D.dispose(), D = void 0));
474
+ N = e.isIntersecting, N ? H() : q();
475
+ }), F.observe(g.value), document.addEventListener("visibilitychange", X), I?.addEventListener("change", Y), Y();
446
476
  }), a(() => {
447
- G(), O?.dispose(), P?.disconnect(), F?.disconnect(), document.removeEventListener("visibilitychange", J), L?.removeEventListener("change", q), D?.dispose();
448
- }), f(T, (e) => {
449
- D?.setUniforms(e), K();
450
- }), f(() => m.motion, q), f(() => m.animateGrain, () => {
451
- H() ? W() : (G(), K());
477
+ q(), k?.dispose(), P?.disconnect(), F?.disconnect(), document.removeEventListener("visibilitychange", X), I?.removeEventListener("change", Y), O &&= (z(O), void 0);
478
+ }), f(D, (e) => {
479
+ O?.setUniforms(e), J();
480
+ }), f(() => m.motion, Y), f(() => m.animateGrain, () => {
481
+ B() ? H() : (q(), J());
452
482
  }), (e, r) => (s(), t("div", {
453
483
  ref_key: "root",
454
484
  ref: g,
455
485
  class: "lpg-gradient",
456
- style: i({ background: w.value })
457
- }, [p(n("canvas", {
458
- ref_key: "canvas",
486
+ style: i({ background: T.value })
487
+ }, [p(n("div", {
488
+ ref_key: "canvasHost",
459
489
  ref: _,
460
490
  "aria-hidden": "true",
461
491
  class: "lpg-canvas"
462
- }, null, 512), [[d, !b.value]]), n("div", R, [l(e.$slots, "default", {}, void 0, !0)])], 4));
492
+ }, null, 512), [[d, v.value && !x.value]]), n("div", W, [l(e.$slots, "default", {}, void 0, !0)])], 4));
463
493
  }
464
- }), [["__scopeId", "data-v-d6eac249"]]);
494
+ }), [["__scopeId", "data-v-765003dc"]]);
465
495
  //#endregion
466
- export { k as a, C as c, g as d, m as f, D as i, E as l, I as n, w as o, O as r, T as s, V as t, y as u };
496
+ export { N as a, C as c, g as d, m as f, H as i, E as l, V as n, w as o, B as r, T as s, q as t, y as u };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.lpg-gradient[data-v-d6eac249]{isolation:isolate;position:relative;overflow:hidden}.lpg-gradient .lpg-canvas[data-v-d6eac249]{z-index:-1;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.lpg-gradient .lpg-content[data-v-d6eac249]{height:100%;position:relative}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
- import { a as e, d as t, f as n, o as r, r as i, s as a, t as o } from "./LpgGradient-DhYG5BbV.js";
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.lpg-gradient[data-v-765003dc]{isolation:isolate;position:relative;overflow:hidden}.lpg-gradient .lpg-canvas[data-v-765003dc]{z-index:-1;pointer-events:none;position:absolute;inset:0}.lpg-gradient .lpg-canvas [data-v-765003dc] canvas{width:100%;height:100%;display:block}.lpg-gradient .lpg-content[data-v-765003dc]{height:100%;position:relative}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
+ import { d as e, f as t, i as n, n as r, o as i, s as a, t as o } from "./LpgGradient-DIXiIpOX.js";
3
3
  import "vue";
4
4
  //#region \0rolldown/runtime.js
5
5
  var ee = Object.defineProperty, te = (e, t) => {
@@ -3243,7 +3243,7 @@ var pd = {
3243
3243
  ]
3244
3244
  }, md = "# Gradient/Gradient\r\n\r\nAn animated, grainy WebGL gradient used as a background. Put content (headings, buttons…) in the default slot; it renders on top. Give the component a size (e.g. full width, `100vh` height for a hero).\r\n\r\n## Properties\r\n- `type`: `flow` (soft stretched bands, monopo-like), `irregular` (round blobs), `edgy` (blobs with sharp folds), `multicolor` (warped linear gradient), `radial`, `banding` (stepped stripes), `duotone` (two colours).\r\n- `palette`: `ember`, `aurora`, `sunset`, `dusk`, `citrus`, `coral`, `ocean`, `mono`, or `custom`.\r\n- `colors`: 2–6 colours, only used when `palette` is `custom`. For `flow`, the first colour is the background.\r\n- `motion`: `random` (slow endless drift), `cursor` (applies `cursorEffect` around the pointer while the rest drifts slowly), `scroll` (moves with scroll position), `none` (static).\r\n- `speed`: 0–100 (%), default 20.\r\n- `cursorEffect` (cursor motion only): `lens` (magnifies under the pointer, default), `pinch` (shrinks towards the pointer), `smear` (colours trail behind the pointer like a brush).\r\n- `cursorRadius`: 5–100 (% of the component's short side), default 30.\r\n- `cursorStrength`: 0–200 (%), default 100.\r\n- `grain`: 0–0.3, default 0.04.\r\n- `animateGrain`: `true` re-rolls the grain at 24 fps (film look). Default `false` (static grain).\r\n- `seed`: any number; changes the shapes.\r\n- `angle`: degrees; overrides the type's direction.\r\n- `bands`: 2–24, `banding` only.\r\n\r\n## Good pairings\r\n`flow` + `ember`, `irregular` + `aurora`, `edgy` + `sunset`, `multicolor` + `dusk`, `radial` + `ocean`, `banding` + `coral`, `duotone` + `citrus`.\r\n\r\nMotion is disabled automatically for users who prefer reduced motion.\r\n", hd = {
3245
3245
  name: "@luna-park/plugin-gradient",
3246
- version: "1.0.1",
3246
+ version: "1.1.0",
3247
3247
  private: !1,
3248
3248
  description: "Animated WebGL gradient backgrounds for Luna Park",
3249
3249
  keywords: [
@@ -3270,6 +3270,7 @@ var pd = {
3270
3270
  files: ["dist/**", "src/logo.svg"],
3271
3271
  scripts: {
3272
3272
  build: "vite build",
3273
+ prepublishOnly: "pnpm run build",
3273
3274
  dev: "vite build --watch",
3274
3275
  "dev:story": "histoire dev",
3275
3276
  preview: "luna-preview",
@@ -3283,7 +3284,7 @@ var pd = {
3283
3284
  },
3284
3285
  devDependencies: {
3285
3286
  "@histoire/plugin-vue": "1.0.0-beta.1",
3286
- "@luna-park/design": "^1.4.0",
3287
+ "@luna-park/design": "^1.6.0",
3287
3288
  "@luna-park/eslint-config": "^1.4.3",
3288
3289
  "@luna-park/plugin": "^1.7.0",
3289
3290
  "@types/node": "^26.6.4",
@@ -3299,7 +3300,7 @@ var pd = {
3299
3300
  "vue-tsc": "^3.3.12"
3300
3301
  },
3301
3302
  peerDependencies: {
3302
- "@luna-park/design": "^1.3.0",
3303
+ "@luna-park/design": "^1.4.0",
3303
3304
  vue: "^3.5.43"
3304
3305
  }
3305
3306
  }, gd = "gradient", _d = hd.name, vd = hd.version, yd = fd({
@@ -3363,7 +3364,7 @@ var pd = {
3363
3364
  cursorEffect: c.string({
3364
3365
  default: "lens",
3365
3366
  description: "Effect around the pointer (Cursor motion only).",
3366
- enum: t,
3367
+ enum: e,
3367
3368
  optional: !0
3368
3369
  }),
3369
3370
  cursorRadius: c.number({
@@ -3401,10 +3402,10 @@ var pd = {
3401
3402
  motion: c.string({
3402
3403
  default: "random",
3403
3404
  description: "What moves the gradient.",
3404
- enum: n
3405
+ enum: t
3405
3406
  }),
3406
3407
  palette: c.string({
3407
- default: r,
3408
+ default: i,
3408
3409
  description: "Colour preset. Choose Custom to use your own colours.",
3409
3410
  enum: a
3410
3411
  }),
@@ -3425,9 +3426,9 @@ var pd = {
3425
3426
  }
3426
3427
  }),
3427
3428
  type: c.string({
3428
- default: i,
3429
+ default: r,
3429
3430
  description: "Gradient style.",
3430
- enum: e
3431
+ enum: n
3431
3432
  })
3432
3433
  },
3433
3434
  slots: { default: c.void() }
package/dist/runtime.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.lpg-gradient[data-v-d6eac249]{isolation:isolate;position:relative;overflow:hidden}.lpg-gradient .lpg-canvas[data-v-d6eac249]{z-index:-1;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.lpg-gradient .lpg-content[data-v-d6eac249]{height:100%;position:relative}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
- export { n as GradientRenderer, t as LpgGradient, u as createMotion, i as gradientTypes, c as palettes, l as resolveColors } from "./LpgGradient-DhYG5BbV.js";
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.lpg-gradient[data-v-765003dc]{isolation:isolate;position:relative;overflow:hidden}.lpg-gradient .lpg-canvas[data-v-765003dc]{z-index:-1;pointer-events:none;position:absolute;inset:0}.lpg-gradient .lpg-canvas [data-v-765003dc] canvas{width:100%;height:100%;display:block}.lpg-gradient .lpg-content[data-v-765003dc]{height:100%;position:relative}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
+ export { a as GradientRenderer, t as LpgGradient, u as createMotion, r as gradientTypes, c as palettes, l as resolveColors } from "./LpgGradient-DIXiIpOX.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luna-park/plugin-gradient",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "description": "Animated WebGL gradient backgrounds for Luna Park",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@histoire/plugin-vue": "1.0.0-beta.1",
41
- "@luna-park/design": "^1.4.0",
41
+ "@luna-park/design": "^1.6.0",
42
42
  "@luna-park/eslint-config": "^1.4.3",
43
43
  "@luna-park/plugin": "^1.7.0",
44
44
  "@types/node": "^26.6.4",
@@ -54,7 +54,7 @@
54
54
  "vue-tsc": "^3.3.12"
55
55
  },
56
56
  "peerDependencies": {
57
- "@luna-park/design": "^1.3.0",
57
+ "@luna-park/design": "^1.4.0",
58
58
  "vue": "^3.5.43"
59
59
  },
60
60
  "scripts": {