@juspay/svelte-ui-components 4.33.0 → 4.33.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.
@@ -61,20 +61,19 @@
61
61
  /*
62
62
  * `reducedMotion`/`onScreen`/`tabVisible` feed `shouldRun` below (a
63
63
  * `$derived`), so they must be real `$state` for it to react when they
64
- * change. `dark` is `$state` for the same reason `draw` below reads it
65
- * synchronously inside the main `$effect` -- writing it must retrigger
66
- * that effect, otherwise a theme flip while the loop is stopped (paused,
67
- * or reduced motion, which paints exactly once) would leave the ink ramp
68
- * on the wrong theme for as long as the orb stays still. `pointer` is a
69
- * plain `let`, not `$state`: a still orb repaints explicitly on pointer
70
- * events (see `repaintIfStill`), and a running orb's loop already reads
71
- * the latest pointer every tick, so retriggering the whole effect on every
72
- * pointer move would only tear down and restart the loop for nothing.
64
+ * change. `pointer` is a plain `let`, not `$state`: a still orb repaints
65
+ * explicitly on pointer events (see `repaintIfStill`), and a running orb's
66
+ * loop already reads the latest pointer every tick, so retriggering the
67
+ * whole effect on every pointer move would only tear down and restart the
68
+ * loop for nothing. A theme change works the same way: a still orb
69
+ * repaints explicitly (see `repaintIfColorChanged`) once its *resolved*
70
+ * colour actually moves, rather than through a theme-flavoured state write
71
+ * -- the paint never needs to know the theme itself, only the colour it
72
+ * comes out to.
73
73
  */
74
74
  let reducedMotion = $state(prefersReducedMotion());
75
75
  let onScreen = $state(true);
76
76
  let tabVisible = $state(true);
77
- let dark = $state(false);
78
77
  let announcedFirstFrame = false;
79
78
  let resolvedColorInput = '';
80
79
  let resolvedTint: Rgb = FALLBACK_TINT;
@@ -150,6 +149,22 @@
150
149
  draw(heldInstant());
151
150
  };
152
151
 
152
+ /** A still orb repaints only when its resolved colour actually changed --
153
+ * whatever mechanism the host used to flip theme (an attribute on `<html>`
154
+ * or `<body>`, or a CSS transition landing). An explicit `color` prop
155
+ * never depends on the theme, and a running orb already re-reads the
156
+ * colour every frame via `draw`, so both bail out here. `readColorInput`'s
157
+ * cached key is what `resolveTint` itself compares against, so this check
158
+ * and the eventual repaint can never disagree about whether anything moved. */
159
+ const repaintIfColorChanged = (): void => {
160
+ if (shouldRun || color || canvas === null) {
161
+ return;
162
+ }
163
+ if (readColorInput(canvas).key !== resolvedColorInput) {
164
+ draw(heldInstant());
165
+ }
166
+ };
167
+
153
168
  const trackPointer = (event: PointerEvent): void => {
154
169
  if (canvas === null || !gravity) {
155
170
  return;
@@ -196,7 +211,7 @@
196
211
  const frame = MODES[safeState](instant, { size: safeSize, density, dotScale });
197
212
  const gOpts = gravityOptions;
198
213
  const painted = gOpts === null ? frame : attract(frame, pointer, gOpts);
199
- paintFrame(context, painted, { dark, tint: resolveTint(context) });
214
+ paintFrame(context, painted, { tint: resolveTint(context) });
200
215
 
201
216
  if (!announcedFirstFrame) {
202
217
  announcedFirstFrame = true;
@@ -206,7 +221,7 @@
206
221
 
207
222
  /*
208
223
  * Re-runs whenever `shouldRun` or anything the leading `draw` reads changes
209
- * (`safeState`, `safeSize`, `density`, `dotScale`, `gravityOptions`, `dark`,
224
+ * (`safeState`, `safeSize`, `density`, `dotScale`, `gravityOptions`,
210
225
  * `color`, `reducedMotion`, ...) -- Svelte tracks every reactive read inside
211
226
  * this body, including transitively through that synchronous `draw` call,
212
227
  * so a prop change tears down the previous rAF (the cleanup below) and
@@ -266,23 +281,18 @@
266
281
  document.addEventListener('visibilitychange', onVisibilityChange);
267
282
 
268
283
  /*
269
- * This repo's `ThemeSwitcher` stamps `data-theme="dark"` on
270
- * `document.documentElement` -- one attribute on one element -- so a
271
- * `MutationObserver` there alone catches every theme change. It exists
272
- * only to keep `paintFrame`'s `dark` argument current: the tint colour
273
- * itself comes from CSS, resolved in `resolveTint` above.
284
+ * The orb never asks how a host marks its theme -- `theme`, `data-theme`,
285
+ * a class, an inline `style`, `color-scheme`, on `<html>` or `<body>`, or
286
+ * anything else -- it only cares whether the colour it actually resolves
287
+ * to (see `resolveTint`) moved. So this observes every attribute change
288
+ * on both elements, unfiltered, and lets `repaintIfColorChanged` decide
289
+ * whether anything worth a repaint happened.
274
290
  */
275
- const readTheme = (): void => {
276
- dark = document.documentElement.getAttribute('data-theme') === 'dark';
277
- };
278
- readTheme();
279
291
  let themeObserver: MutationObserver | null = null;
280
292
  if (typeof MutationObserver !== 'undefined') {
281
- themeObserver = new MutationObserver(readTheme);
282
- themeObserver.observe(document.documentElement, {
283
- attributes: true,
284
- attributeFilter: ['data-theme']
285
- });
293
+ themeObserver = new MutationObserver(repaintIfColorChanged);
294
+ themeObserver.observe(document.documentElement, { attributes: true });
295
+ themeObserver.observe(document.body, { attributes: true });
286
296
  }
287
297
 
288
298
  const onMotionChange = (event: MediaQueryListEvent): void => {
@@ -294,24 +304,26 @@
294
304
  motionQuery.addEventListener('change', onMotionChange);
295
305
  }
296
306
 
307
+ // A host that themes only through `@media (prefers-color-scheme)` changes
308
+ // the inherited colour when the OS flips theme, with no attribute change
309
+ // and no transition for the checks around it to catch.
310
+ let colorSchemeQuery: MediaQueryList | null = null;
311
+ if (typeof window.matchMedia === 'function') {
312
+ colorSchemeQuery = window.matchMedia('(prefers-color-scheme: dark)');
313
+ colorSchemeQuery.addEventListener('change', repaintIfColorChanged);
314
+ }
315
+
297
316
  /*
298
- * A still orb only repaints on its own when `dark` flips. A host that
299
- * transitions its `color` (this repo's own layout fades `body` across a
300
- * theme switch) leaves a just-frozen frame at the outgoing colour, with
301
- * nothing else to redraw it. Re-read once the transition lands and
302
- * repaint the same frozen instant if the resolved colour actually moved.
303
- * A running orb re-reads every frame already and needs none of this.
317
+ * A host that transitions its `color` (this repo's own layout fades
318
+ * `body` across a theme switch) leaves a just-frozen frame at the
319
+ * outgoing colour, with nothing else to redraw it: no attribute changed,
320
+ * so the observer above never fires. Re-check once the transition lands.
304
321
  */
305
322
  const onColorTransitionEnd = (event: TransitionEvent): void => {
306
- if (shouldRun || color || canvas === null) {
307
- return;
308
- }
309
323
  if (event.propertyName !== 'color' && event.propertyName !== '--sui-thinking-orb-color') {
310
324
  return;
311
325
  }
312
- if (readColorInput(canvas).key !== resolvedColorInput) {
313
- draw(heldInstant());
314
- }
326
+ repaintIfColorChanged();
315
327
  };
316
328
  document.addEventListener('transitionend', onColorTransitionEnd);
317
329
 
@@ -321,6 +333,7 @@
321
333
  document.removeEventListener('transitionend', onColorTransitionEnd);
322
334
  themeObserver?.disconnect();
323
335
  motionQuery?.removeEventListener('change', onMotionChange);
336
+ colorSchemeQuery?.removeEventListener('change', repaintIfColorChanged);
324
337
  };
325
338
  });
326
339
  </script>
@@ -1,22 +1,27 @@
1
1
  /**
2
- * Turns one `Frame` into canvas calls. The only place that knows about theme
3
- * and colour -- a mode never sees `dark` or `tint`, only the 0..1 `ink` it
4
- * assigns each mark.
2
+ * Turns one `Frame` into canvas calls. The only place that knows about
3
+ * colour -- a mode never sees `tint`, only the 0..1 `ink` it assigns each
4
+ * mark.
5
5
  */
6
6
  import type { Rgb } from '../../types';
7
7
  import type { Frame } from './types';
8
- /** What `paintFrame` needs beyond the frame itself: the theme and the base colour. */
8
+ /** What `paintFrame` needs beyond the frame itself: the base colour. */
9
9
  export type PaintOptions = {
10
- dark: boolean;
11
10
  tint: Rgb;
12
11
  };
13
12
  /**
14
- * Maps `ink` (0 = full `tint`) to an exact, testable colour string: fading
15
- * toward white in light theme and toward black in dark theme, so a mark
16
- * further away can fade into either background without ever reading as the
17
- * wrong theme's ink.
13
+ * Every mark draws in the tint colour itself -- an exact, testable colour
14
+ * string that never changes with depth. Depth is expressed as transparency
15
+ * instead (see `inkAlpha`), so a mark reads correctly against any
16
+ * background rather than only a solid white or black one.
18
17
  */
19
- export declare const inkColor: (tint: Rgb, ink: number, dark: boolean) => string;
18
+ export declare const inkColor: (tint: Rgb) => string;
19
+ /**
20
+ * Maps `ink` (0 = fully opaque) to the opacity a mark paints at: it fades
21
+ * toward fully transparent as `ink` rises, multiplied with the mark's own
22
+ * `alpha` so the two fades compound rather than override each other.
23
+ */
24
+ export declare const inkAlpha: (ink: number, alpha: number) => number;
20
25
  /**
21
26
  * Clears the canvas and draws a `Frame`: every stroke, then every dot, each
22
27
  * group sorted far-to-near by `depth` so nearer marks are painted last and
@@ -1,23 +1,22 @@
1
1
  /**
2
- * Turns one `Frame` into canvas calls. The only place that knows about theme
3
- * and colour -- a mode never sees `dark` or `tint`, only the 0..1 `ink` it
4
- * assigns each mark.
2
+ * Turns one `Frame` into canvas calls. The only place that knows about
3
+ * colour -- a mode never sees `tint`, only the 0..1 `ink` it assigns each
4
+ * mark.
5
5
  */
6
6
  const clamp01 = (value) => Math.max(0, Math.min(1, value));
7
7
  /**
8
- * Maps `ink` (0 = full `tint`) to an exact, testable colour string: fading
9
- * toward white in light theme and toward black in dark theme, so a mark
10
- * further away can fade into either background without ever reading as the
11
- * wrong theme's ink.
8
+ * Every mark draws in the tint colour itself -- an exact, testable colour
9
+ * string that never changes with depth. Depth is expressed as transparency
10
+ * instead (see `inkAlpha`), so a mark reads correctly against any
11
+ * background rather than only a solid white or black one.
12
12
  */
13
- export const inkColor = (tint, ink, dark) => {
14
- const amount = clamp01(ink);
15
- const fadeTo = dark ? 0 : 255;
16
- const r = Math.round(tint.r + (fadeTo - tint.r) * amount);
17
- const g = Math.round(tint.g + (fadeTo - tint.g) * amount);
18
- const b = Math.round(tint.b + (fadeTo - tint.b) * amount);
19
- return `rgb(${r} ${g} ${b})`;
20
- };
13
+ export const inkColor = (tint) => `rgb(${tint.r} ${tint.g} ${tint.b})`;
14
+ /**
15
+ * Maps `ink` (0 = fully opaque) to the opacity a mark paints at: it fades
16
+ * toward fully transparent as `ink` rises, multiplied with the mark's own
17
+ * `alpha` so the two fades compound rather than override each other.
18
+ */
19
+ export const inkAlpha = (ink, alpha) => clamp01(1 - clamp01(ink)) * clamp01(alpha);
21
20
  /**
22
21
  * Clears the canvas and draws a `Frame`: every stroke, then every dot, each
23
22
  * group sorted far-to-near by `depth` so nearer marks are painted last and
@@ -25,10 +24,11 @@ export const inkColor = (tint, ink, dark) => {
25
24
  */
26
25
  export const paintFrame = (ctx, frame, options) => {
27
26
  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
27
+ const color = inkColor(options.tint);
28
28
  const strokes = [...frame.strokes].sort((a, b) => a.depth - b.depth);
29
29
  for (const stroke of strokes) {
30
- ctx.strokeStyle = inkColor(options.tint, stroke.ink, options.dark);
31
- ctx.globalAlpha = clamp01(stroke.alpha);
30
+ ctx.strokeStyle = color;
31
+ ctx.globalAlpha = inkAlpha(stroke.ink, stroke.alpha);
32
32
  ctx.lineWidth = stroke.width;
33
33
  ctx.beginPath();
34
34
  ctx.moveTo(stroke.x1, stroke.y1);
@@ -37,8 +37,8 @@ export const paintFrame = (ctx, frame, options) => {
37
37
  }
38
38
  const dots = [...frame.dots].sort((a, b) => a.depth - b.depth);
39
39
  for (const dot of dots) {
40
- ctx.fillStyle = inkColor(options.tint, dot.ink, options.dark);
41
- ctx.globalAlpha = clamp01(dot.alpha);
40
+ ctx.fillStyle = color;
41
+ ctx.globalAlpha = inkAlpha(dot.ink, dot.alpha);
42
42
  ctx.beginPath();
43
43
  ctx.arc(dot.x, dot.y, dot.radius, 0, Math.PI * 2);
44
44
  ctx.fill();
package/dist-wc/index.js CHANGED
@@ -24055,15 +24055,12 @@ var clamp01$5 = (e) => Math.max(0, Math.min(1, e)), rotateX = (e, t) => {
24055
24055
  }, attract = (e, t, n) => t === null ? e : {
24056
24056
  dots: e.dots.map((e) => attractDot(e, t, n)),
24057
24057
  strokes: e.strokes.map((e) => attractStroke(e, t, n))
24058
- }, clamp01$3 = (e) => Math.max(0, Math.min(1, e)), inkColor = (e, t, n) => {
24059
- let i = clamp01$3(t), a = n ? 0 : 255;
24060
- return `rgb(${Math.round(e.r + (a - e.r) * i)} ${Math.round(e.g + (a - e.g) * i)} ${Math.round(e.b + (a - e.b) * i)})`;
24061
- }, paintFrame = (e, t, n) => {
24058
+ }, clamp01$3 = (e) => Math.max(0, Math.min(1, e)), inkColor = (e) => `rgb(${e.r} ${e.g} ${e.b})`, inkAlpha = (e, t) => clamp01$3(1 - clamp01$3(e)) * clamp01$3(t), paintFrame = (e, t, n) => {
24062
24059
  e.clearRect(0, 0, e.canvas.width, e.canvas.height);
24063
- let i = [...t.strokes].sort((e, t) => e.depth - t.depth);
24064
- for (let t of i) e.strokeStyle = inkColor(n.tint, t.ink, n.dark), e.globalAlpha = clamp01$3(t.alpha), e.lineWidth = t.width, e.beginPath(), e.moveTo(t.x1, t.y1), e.lineTo(t.x2, t.y2), e.stroke();
24065
- let a = [...t.dots].sort((e, t) => e.depth - t.depth);
24066
- for (let t of a) e.fillStyle = inkColor(n.tint, t.ink, n.dark), e.globalAlpha = clamp01$3(t.alpha), e.beginPath(), e.arc(t.x, t.y, t.radius, 0, Math.PI * 2), e.fill();
24060
+ let i = inkColor(n.tint), a = [...t.strokes].sort((e, t) => e.depth - t.depth);
24061
+ for (let t of a) e.strokeStyle = i, e.globalAlpha = inkAlpha(t.ink, t.alpha), e.lineWidth = t.width, e.beginPath(), e.moveTo(t.x1, t.y1), e.lineTo(t.x2, t.y2), e.stroke();
24062
+ let o = [...t.dots].sort((e, t) => e.depth - t.depth);
24063
+ for (let t of o) e.fillStyle = i, e.globalAlpha = inkAlpha(t.ink, t.alpha), e.beginPath(), e.arc(t.x, t.y, t.radius, 0, Math.PI * 2), e.fill();
24067
24064
  e.globalAlpha = 1;
24068
24065
  }, TWO_PI$1 = Math.PI * 2, WORLD_RADIUS_RATIO = .38, clamp01$2 = (e) => Math.max(0, Math.min(1, e)), clamp$1 = (e, t, n) => Math.max(t, Math.min(n, e)), originOf = (e) => e.size / 2, worldRadiusOf = (e) => e.size * WORLD_RADIUS_RATIO, INK_NEAR = .05, INK_FAR = .72, shadeByDepth = (e) => INK_FAR - (INK_FAR - INK_NEAR) * clamp01$2(e), toDot = (e, t, n, i) => ({
24069
24066
  x: e.x,
@@ -24347,7 +24344,7 @@ function ThinkingOrb(e, t) {
24347
24344
  r: 128,
24348
24345
  g: 128,
24349
24346
  b: 128
24350
- }, R = 2.4, te = 2, ne = /* @__PURE__ */ user_derived(() => Object.hasOwn(MODES, n()) ? n() : "working"), re = /* @__PURE__ */ user_derived(() => C.includes(i()) ? i() : 64), G = /* @__PURE__ */ user_derived(() => Math.max(.1, c())), be = /* @__PURE__ */ user_derived(() => Math.max(.1, l())), Me = /* @__PURE__ */ user_derived(() => !u() || get(Ue) ? null : u() === !0 ? GRAVITY_DEFAULTS : u()), Re = /* @__PURE__ */ state(null), Ue = /* @__PURE__ */ state(proxy(prefersReducedMotion())), it = /* @__PURE__ */ state(!0), at = /* @__PURE__ */ state(!0), ot = /* @__PURE__ */ state(!1), ct = !1, lt = "", ut = k, dt = null, ft = 0, pt = 0, mt = /* @__PURE__ */ user_derived(() => !o() && !get(Ue) && get(it) && get(at)), ht = () => get(Ue) ? 2.4 : pt, gt = (e, t) => {
24347
+ }, R = 2.4, te = 2, ne = /* @__PURE__ */ user_derived(() => Object.hasOwn(MODES, n()) ? n() : "working"), re = /* @__PURE__ */ user_derived(() => C.includes(i()) ? i() : 64), G = /* @__PURE__ */ user_derived(() => Math.max(.1, c())), be = /* @__PURE__ */ user_derived(() => Math.max(.1, l())), Me = /* @__PURE__ */ user_derived(() => !u() || get(Ue) ? null : u() === !0 ? GRAVITY_DEFAULTS : u()), Re = /* @__PURE__ */ state(null), Ue = /* @__PURE__ */ state(proxy(prefersReducedMotion())), it = /* @__PURE__ */ state(!0), at = /* @__PURE__ */ state(!0), ot = !1, ct = "", lt = k, ut = null, dt = 0, ft = 0, pt = /* @__PURE__ */ user_derived(() => !o() && !get(Ue) && get(it) && get(at)), mt = () => get(Ue) ? 2.4 : ft, ht = (e, t) => {
24351
24348
  if (t.length === 0) return null;
24352
24349
  let n = e.fillStyle;
24353
24350
  e.fillStyle = "#000000", e.fillStyle = t;
@@ -24355,32 +24352,34 @@ function ThinkingOrb(e, t) {
24355
24352
  e.fillStyle = "#ffffff", e.fillStyle = t;
24356
24353
  let a = e.fillStyle;
24357
24354
  return e.fillStyle = n, typeof i == "string" && i === a ? i : null;
24358
- }, _t = (e) => {
24355
+ }, gt = (e) => {
24359
24356
  let t = getComputedStyle(e), n = t.getPropertyValue("--sui-thinking-orb-color").trim(), i = t.color.trim();
24360
24357
  return {
24361
24358
  declared: n,
24362
24359
  inherited: i,
24363
24360
  key: `${n}|${i}`
24364
24361
  };
24365
- }, vt = (e) => {
24362
+ }, _t = (e) => {
24366
24363
  if (s()) return s();
24367
- if (get(Re) === null) return ut;
24368
- let { declared: t, inherited: n, key: i } = _t(get(Re));
24369
- if (i === lt) return ut;
24370
- lt = i;
24371
- let a = gt(e, t) ?? gt(e, n);
24372
- return ut = (a === null ? null : parseCssColor(a)) ?? k, ut;
24364
+ if (get(Re) === null) return lt;
24365
+ let { declared: t, inherited: n, key: i } = gt(get(Re));
24366
+ if (i === ct) return lt;
24367
+ ct = i;
24368
+ let a = ht(e, t) ?? ht(e, n);
24369
+ return lt = (a === null ? null : parseCssColor(a)) ?? k, lt;
24370
+ }, vt = () => {
24371
+ get(pt) || get(Me) === null || Ct(mt());
24373
24372
  }, yt = () => {
24374
- get(mt) || get(Me) === null || Ct(ht());
24373
+ get(pt) || s() || get(Re) === null || gt(get(Re)).key !== ct && Ct(mt());
24375
24374
  }, bt = (e) => {
24376
24375
  if (get(Re) === null || !u()) return;
24377
24376
  let t = get(Re).getBoundingClientRect();
24378
- dt = {
24377
+ ut = {
24379
24378
  x: e.clientX - t.left,
24380
24379
  y: e.clientY - t.top
24381
- }, yt();
24380
+ }, vt();
24382
24381
  }, xt = () => {
24383
- dt = null, yt();
24382
+ ut = null, vt();
24384
24383
  }, St = () => typeof window > "u" ? 1 : Math.min(2, window.devicePixelRatio ?? 1), Ct = (e) => {
24385
24384
  if (get(Re) === null) return;
24386
24385
  let t = get(Re).getContext("2d");
@@ -24392,18 +24391,15 @@ function ThinkingOrb(e, t) {
24392
24391
  density: get(G),
24393
24392
  dotScale: get(be)
24394
24393
  }), o = get(Me);
24395
- paintFrame(t, o === null ? a : attract(a, dt, o), {
24396
- dark: get(ot),
24397
- tint: vt(t)
24398
- }), ct || (ct = !0, S()?.());
24394
+ paintFrame(t, o === null ? a : attract(a, ut, o), { tint: _t(t) }), ot || (ot = !0, S()?.());
24399
24395
  };
24400
24396
  user_effect(() => {
24401
- if (Ct(ht()), !get(mt)) return;
24397
+ if (Ct(mt()), !get(pt)) return;
24402
24398
  let e = null, t = (n) => {
24403
24399
  let i = e === null ? 0 : (n - e) / 1e3;
24404
- e = n, pt += i * a(), Ct(pt), ft = requestAnimationFrame(t);
24400
+ e = n, ft += i * a(), Ct(ft), dt = requestAnimationFrame(t);
24405
24401
  };
24406
- return ft = requestAnimationFrame(t), () => cancelAnimationFrame(ft);
24402
+ return dt = requestAnimationFrame(t), () => cancelAnimationFrame(dt);
24407
24403
  }), onMount(() => {
24408
24404
  if (get(Re) === null) return;
24409
24405
  let e = null;
@@ -24414,24 +24410,19 @@ function ThinkingOrb(e, t) {
24414
24410
  set(at, document.visibilityState !== "hidden");
24415
24411
  };
24416
24412
  document.addEventListener("visibilitychange", t);
24417
- let n = () => {
24418
- set(ot, document.documentElement.getAttribute("data-theme") === "dark");
24419
- };
24420
- n();
24421
- let i = null;
24422
- typeof MutationObserver < "u" && (i = new MutationObserver(n), i.observe(document.documentElement, {
24423
- attributes: !0,
24424
- attributeFilter: ["data-theme"]
24425
- }));
24426
- let a = (e) => {
24413
+ let n = null;
24414
+ typeof MutationObserver < "u" && (n = new MutationObserver(yt), n.observe(document.documentElement, { attributes: !0 }), n.observe(document.body, { attributes: !0 }));
24415
+ let i = (e) => {
24427
24416
  set(Ue, e.matches, !0);
24428
- }, o = null;
24429
- typeof window.matchMedia == "function" && (o = window.matchMedia("(prefers-reduced-motion: reduce)"), o.addEventListener("change", a));
24430
- let c = (e) => {
24431
- get(mt) || s() || get(Re) === null || e.propertyName !== "color" && e.propertyName !== "--sui-thinking-orb-color" || _t(get(Re)).key !== lt && Ct(ht());
24432
- };
24433
- return document.addEventListener("transitionend", c), () => {
24434
- e?.disconnect(), document.removeEventListener("visibilitychange", t), document.removeEventListener("transitionend", c), i?.disconnect(), o?.removeEventListener("change", a);
24417
+ }, a = null;
24418
+ typeof window.matchMedia == "function" && (a = window.matchMedia("(prefers-reduced-motion: reduce)"), a.addEventListener("change", i));
24419
+ let o = null;
24420
+ typeof window.matchMedia == "function" && (o = window.matchMedia("(prefers-color-scheme: dark)"), o.addEventListener("change", yt));
24421
+ let s = (e) => {
24422
+ e.propertyName !== "color" && e.propertyName !== "--sui-thinking-orb-color" || yt();
24423
+ };
24424
+ return document.addEventListener("transitionend", s), () => {
24425
+ e?.disconnect(), document.removeEventListener("visibilitychange", t), document.removeEventListener("transitionend", s), n?.disconnect(), a?.removeEventListener("change", i), o?.removeEventListener("change", yt);
24435
24426
  };
24436
24427
  });
24437
24428
  var wt = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "4.33.0",
3
+ "version": "4.33.1",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",