shaders 2.0.651 → 2.0.654

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.
@@ -17340,19 +17340,13 @@ function xQ() {
17340
17340
  try {
17341
17341
  if (e = oe, i = new Tg(), i.background = null, s = new wg(-1, 1, 1, -1, 0.1, 10), s.position.z = 1, s.lookAt(0, 0, 0), Q || (window.addEventListener("mousemove", us), window.addEventListener("touchmove", zi), window.addEventListener("mouseup", Sp), window.addEventListener("touchend", _p), oe.addEventListener("mousedown", Mp), oe.addEventListener("touchstart", Np), Q = !0, console.log(`[${t}] Added event listeners`)), de.signal.aborted) return;
17342
17342
  try {
17343
- if (r = new r_({ canvas: oe, antialias: !0, alpha: !0, depth: !1, powerPreference: "high-performance" }), await r.init(), de.signal.aborted) {
17344
- r && typeof r.dispose == "function" && r.dispose();
17345
- return;
17346
- }
17343
+ if (r = new r_({ canvas: oe, antialias: !0, alpha: !0, depth: !1, powerPreference: "high-performance" }), await r.init(), de.signal.aborted) return;
17347
17344
  } catch (hr) {
17348
17345
  if (de.signal.aborted) return;
17349
17346
  console.error("[Shaders] WebGPU initialization error:", hr);
17350
17347
  return;
17351
17348
  }
17352
- if (de.signal.aborted) {
17353
- r && typeof r.dispose == "function" && r.dispose();
17354
- return;
17355
- }
17349
+ if (de.signal.aborted) return;
17356
17350
  r.setPixelRatio(Math.min(window.devicePixelRatio, 2)), r.outputColorSpace = Ms, a = new UR({ transparent: !0 }), a.fragmentNode = Gr(0, 0, 0, 0);
17357
17351
  let xe = new _2(2, 2);
17358
17352
  n = new Rn(xe, a), i.add(n), h = new ResizeObserver(fe), h.observe(oe), u = new IntersectionObserver(Te, { threshold: 0 }), u.observe(oe), g = !ne();
@@ -17364,7 +17358,20 @@ function xQ() {
17364
17358
  d = !1, m === de && (m = null);
17365
17359
  }
17366
17360
  }, cleanup: () => {
17367
- if (console.log(`[${t}] Cleanup called`), m && m.abort(), h && (h.disconnect(), h = null), u && (u.disconnect(), u = null), Q && (console.log(`[${t}] Removing event listeners`), e && (e.removeEventListener("mousedown", Mp), e.removeEventListener("touchstart", Np)), window && (window.removeEventListener("mousemove", us), window.removeEventListener("touchmove", zi), window.removeEventListener("mouseup", Sp), window.removeEventListener("touchend", _p)), Q = !1), Ii(), o.nodes.clear(), o.rootId = null, o.idToNodeId.clear(), Z = [], te = !1, ee = [], ae = !1, n && (i && i.remove(n), n.geometry && typeof n.geometry.dispose == "function" && n.geometry.dispose(), n.material instanceof ws && typeof n.material.dispose == "function" && n.material.dispose()), r && typeof r.dispose == "function") try {
17361
+ if (console.log(`[${t}] Cleanup called`), m && m.abort(), h && (h.disconnect(), h = null), u && (u.disconnect(), u = null), Q && (console.log(`[${t}] Removing event listeners`), e && (e.removeEventListener("mousedown", Mp), e.removeEventListener("touchstart", Np)), window && (window.removeEventListener("mousemove", us), window.removeEventListener("touchmove", zi), window.removeEventListener("mouseup", Sp), window.removeEventListener("touchend", _p)), Q = !1), Ii(), o.nodes.clear(), o.rootId = null, o.idToNodeId.clear(), Z = [], te = !1, ee = [], ae = !1, n) {
17362
+ i && i.remove(n);
17363
+ try {
17364
+ n.geometry && typeof n.geometry.dispose == "function" && n.geometry.dispose();
17365
+ } catch (oe) {
17366
+ console.warn("Error disposing geometry:", oe);
17367
+ }
17368
+ try {
17369
+ n.material instanceof ws && typeof n.material.dispose == "function" && n.material.dispose();
17370
+ } catch (oe) {
17371
+ console.warn("Error disposing material:", oe);
17372
+ }
17373
+ }
17374
+ if (r && typeof r.dispose == "function") try {
17368
17375
  r.dispose();
17369
17376
  } catch (oe) {
17370
17377
  console.warn("Error disposing renderer:", oe);
@@ -45285,7 +45292,7 @@ const ufe = (t) => {
45285
45292
  }
45286
45293
  return /* @__PURE__ */ Nt(Pe.Provider, { value: h, children: t.children });
45287
45294
  }, Eh = { name: "Spiral", props: { colorBack: { default: "#000000", transform: Ts, description: "Background color", ui: { type: "color", label: "Background Color" } }, colorFront: { default: "#ffffff", transform: Ts, description: "Spiral stroke color", ui: { type: "color", label: "Spiral Color" } }, strokeWidth: { default: 0.5, description: "Thickness of spiral stroke", ui: { type: "range", min: 0, max: 2, step: 0.01, label: "Stroke Width" } }, strokeFalloff: { default: 0, description: "Stroke losing width further from center", ui: { type: "range", min: 0, max: 1, step: 0.01, label: "Stroke Falloff" } }, softness: { default: 0, description: "Color transition sharpness (0 = hard edge, 1 = smooth fade)", ui: { type: "range", min: 0, max: 1, step: 0.01, label: "Softness" } }, speed: { default: 1, description: "Animation speed (negative values reverse direction)", ui: { type: "range", min: -3, max: 3, step: 0.1, label: "Speed" } }, center: { default: { x: 0.5, y: 0.5 }, transform: bp, description: "The center point of the spiral" }, scale: { default: 1, description: "Scale factor for spiral bands (higher = more bands, lower = fewer bands)", ui: { type: "range", min: 0.1, max: 5, step: 0.1, label: "Scale" } } }, fragmentNode: ({ uniforms: t }) => {
45288
- let { vec2: e, vec4: r, float: s, atan2: i, length: n, clamp: a, fract: o, abs: l, mix: h, smoothstep: u, screenUV: c, time: d, fwidth: p, viewportSize: m } = At, f = m.x.div(m.y), g = e(c.x.mul(f), c.y), b = e(t.center.uniform.x.mul(f), t.center.uniform.y.oneMinus()), v = g.sub(b), w = d.mul(t.speed.uniform), T = n(v), N = T, S = i(v.y, v.x).sub(w), M = s(6.283185307), A = S.div(M), U = N.mul(t.scale.uniform).add(A), Q = o(U), Z = l(Q.sub(0.5)).mul(2), te = a(t.strokeWidth.uniform, t.strokeFalloff.uniform.mul(5e-3), 1), ee = a(t.strokeFalloff.uniform, 0, 1).mul(T).oneMinus(), ae = te.mul(ee), ne = p(U), ye = s(4).sub(u(0.05, 0.4, t.strokeWidth.uniform.mul(2)).mul(u(0.05, 0.4, t.strokeWidth.uniform.oneMinus().mul(2))).mul(3)), fe = h(ye.mul(ne), p(Z), a(ne, 0, 1)), Te = u(ae.sub(fe).sub(t.softness.uniform), ae.add(fe).add(t.softness.uniform), Z), me = t.colorFront.uniform.rgb.mul(t.colorFront.uniform.a), ue = t.colorFront.uniform.a, we = t.colorBack.uniform.rgb.mul(t.colorBack.uniform.a), je = t.colorBack.uniform.a, qe = me.mul(Te), yt = ue.mul(Te), ct = qe.add(we.mul(yt.oneMinus())), It = yt.add(je.mul(yt.oneMinus()));
45295
+ let { vec2: e, vec4: r, float: s, atan: i, length: n, clamp: a, fract: o, abs: l, mix: h, smoothstep: u, screenUV: c, time: d, fwidth: p, viewportSize: m } = At, f = m.x.div(m.y), g = e(c.x.mul(f), c.y), b = e(t.center.uniform.x.mul(f), t.center.uniform.y.oneMinus()), v = g.sub(b), w = d.mul(t.speed.uniform), T = n(v), N = T, S = i(v.y, v.x).sub(w), M = s(6.283185307), A = S.div(M), U = N.mul(t.scale.uniform).add(A), Q = o(U), Z = l(Q.sub(0.5)).mul(2), te = a(t.strokeWidth.uniform, t.strokeFalloff.uniform.mul(5e-3), 1), ee = a(t.strokeFalloff.uniform, 0, 1).mul(T).oneMinus(), ae = te.mul(ee), ne = p(U), ye = s(4).sub(u(0.05, 0.4, t.strokeWidth.uniform.mul(2)).mul(u(0.05, 0.4, t.strokeWidth.uniform.oneMinus().mul(2))).mul(3)), fe = h(ye.mul(ne), p(Z), a(ne, 0, 1)), Te = u(ae.sub(fe).sub(t.softness.uniform), ae.add(fe).add(t.softness.uniform), Z), me = t.colorFront.uniform.rgb.mul(t.colorFront.uniform.a), ue = t.colorFront.uniform.a, we = t.colorBack.uniform.rgb.mul(t.colorBack.uniform.a), je = t.colorBack.uniform.a, qe = me.mul(Te), yt = ue.mul(Te), ct = qe.add(we.mul(yt.oneMinus())), It = yt.add(je.mul(yt.oneMinus()));
45289
45296
  return r(ct, It);
45290
45297
  } };
45291
45298
  function ume(t, e) {