elements-kit 0.0.11 → 0.0.13

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.
Files changed (75) hide show
  1. package/dist/{element-MXzFk4G2.mjs → element-C_4VbkvQ.mjs} +1 -1
  2. package/dist/{index-Cvdhuy6Y.d.mts → index-DUshSQ_6.d.mts} +11 -7
  3. package/dist/index.mjs +2 -2
  4. package/dist/integrations/react.d.mts +1 -1
  5. package/dist/integrations/react.mjs +1 -1
  6. package/dist/jsx-runtime/index.d.mts +1 -1
  7. package/dist/jsx-runtime/index.mjs +2 -2
  8. package/dist/signals/index.d.mts +2 -2
  9. package/dist/signals/index.mjs +2 -2
  10. package/dist/{signals-DcgXhkU2.mjs → signals-BHmWX6ox.mjs} +86 -76
  11. package/dist/slot.d.mts +2 -1
  12. package/dist/utilities/active-element.d.mts +1 -1
  13. package/dist/utilities/debounced.d.mts +1 -1
  14. package/dist/utilities/debounced.mjs +1 -1
  15. package/dist/utilities/debounced.test.mjs +1 -1
  16. package/dist/utilities/element-rect.d.mts +1 -1
  17. package/dist/utilities/element-rect.mjs +1 -1
  18. package/dist/utilities/element-rect.test.mjs +1 -1
  19. package/dist/utilities/element-scroll.d.mts +1 -1
  20. package/dist/utilities/element-scroll.mjs +1 -1
  21. package/dist/utilities/element-scroll.test.mjs +1 -1
  22. package/dist/utilities/event-driven.d.mts +1 -1
  23. package/dist/utilities/event-driven.mjs +10 -8
  24. package/dist/utilities/event-listener.d.mts +1 -1
  25. package/dist/utilities/event-listener.mjs +1 -1
  26. package/dist/utilities/event-listener.test.mjs +1 -1
  27. package/dist/utilities/focus-within.d.mts +1 -1
  28. package/dist/utilities/focus-within.mjs +1 -1
  29. package/dist/utilities/focus-within.test.mjs +1 -1
  30. package/dist/utilities/hover.d.mts +1 -1
  31. package/dist/utilities/hover.mjs +1 -1
  32. package/dist/utilities/hover.test.mjs +1 -1
  33. package/dist/utilities/intersection-observer.mjs +1 -1
  34. package/dist/utilities/intersection-observer.test.mjs +1 -1
  35. package/dist/utilities/interval.d.mts +1 -1
  36. package/dist/utilities/interval.mjs +1 -1
  37. package/dist/utilities/interval.test.mjs +1 -1
  38. package/dist/utilities/location.d.mts +1 -1
  39. package/dist/utilities/location.mjs +1 -1
  40. package/dist/utilities/long-press.test.mjs +1 -1
  41. package/dist/utilities/media-devices.d.mts +1 -1
  42. package/dist/utilities/media-devices.mjs +1 -1
  43. package/dist/utilities/media-devices.test.mjs +1 -1
  44. package/dist/utilities/media-player.d.mts +1 -1
  45. package/dist/utilities/media-player.test.mjs +1 -1
  46. package/dist/utilities/media-query.d.mts +1 -1
  47. package/dist/utilities/media-query.mjs +1 -1
  48. package/dist/utilities/mutation-observer.mjs +1 -1
  49. package/dist/utilities/mutation-observer.test.mjs +1 -1
  50. package/dist/utilities/on-click-outside.test.mjs +1 -1
  51. package/dist/utilities/orientation.d.mts +1 -1
  52. package/dist/utilities/previous.d.mts +1 -1
  53. package/dist/utilities/previous.mjs +1 -1
  54. package/dist/utilities/previous.test.mjs +1 -1
  55. package/dist/utilities/resize-observer.mjs +1 -1
  56. package/dist/utilities/routing.d.mts +1 -1
  57. package/dist/utilities/routing.mjs +1 -1
  58. package/dist/utilities/search-params.d.mts +1 -1
  59. package/dist/utilities/search-params.test.mjs +1 -1
  60. package/dist/utilities/storage.d.mts +1 -1
  61. package/dist/utilities/storage.test.mjs +1 -1
  62. package/dist/utilities/throttled.d.mts +1 -1
  63. package/dist/utilities/throttled.mjs +1 -1
  64. package/dist/utilities/throttled.test.mjs +1 -1
  65. package/dist/utilities/timeout.d.mts +1 -1
  66. package/dist/utilities/timeout.mjs +1 -1
  67. package/dist/utilities/timeout.test.mjs +1 -1
  68. package/dist/utilities/window-size.d.mts +1 -1
  69. package/dist/utilities/window-size.mjs +1 -1
  70. package/package.json +3 -13
  71. package/dist/builder/dom.d.mts +0 -212
  72. package/dist/builder/dom.mjs +0 -205
  73. package/dist/builder/index.d.mts +0 -88
  74. package/dist/builder/index.mjs +0 -114
  75. /package/dist/{lib-BYJ5jPTG.d.mts → lib-JA05lzCN.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { f as onCleanup, h as untracked, o as effect, s as effectScope, t as isReactive } from "./signals-DcgXhkU2.mjs";
1
+ import { d as effectScope, g as onCleanup, t as isReactive, u as effect, y as untracked } from "./signals-BHmWX6ox.mjs";
2
2
  import "./polyfill-B1lNNcum.mjs";
3
3
  import { i as resolveNode$1, n as Slot, r as Slots, t as $slots } from "./slot-Cydy7-0L.mjs";
4
4
  //#region \0rolldown/runtime.js
@@ -1,22 +1,26 @@
1
1
  //#region src/signals/lib.d.ts
2
+ declare const $signal: unique symbol;
3
+ declare const $computed: unique symbol;
4
+ declare const $effect: unique symbol;
5
+ declare const $effectScope: unique symbol;
2
6
  /**
3
7
  * Returns `true` if `fn` is a signal handle created by {@link signal}.
4
8
  *
5
- * Relies on `Function.name` matching the internal `signalOper` function name.
9
+ * Relies on `$signal` matching the internal `signalOper` function name.
6
10
  */
7
- declare function isSignal(fn: () => void): boolean;
11
+ declare function isSignal(fn: unknown): boolean;
8
12
  /**
9
13
  * Returns `true` if `fn` is a computed handle created by {@link computed}.
10
14
  *
11
- * Relies on `Function.name` matching the internal `computedOper` function name.
15
+ * Relies on `$computed` matching the internal `computedOper` function name.
12
16
  */
13
- declare function isComputed(fn: () => void): boolean;
17
+ declare function isComputed(fn: unknown): boolean;
14
18
  /**
15
19
  * Returns `true` if `fn` is an effect cleanup handle created by {@link effect}.
16
20
  *
17
- * Relies on `Function.name` matching the internal `effectOper` function name.
21
+ * Relies on the $effect symbol branding.
18
22
  */
19
- declare function isEffect(fn: () => void): boolean;
23
+ declare function isEffect(fn: unknown): boolean;
20
24
  /**
21
25
  * Returns `true` if `fn` is an effectScope cleanup handle created by
22
26
  * {@link effectScope}.
@@ -258,4 +262,4 @@ type MaybeReactive<T> = T | Computed<T>;
258
262
  */
259
263
  declare function resolve<T>(value: MaybeReactive<T>): T;
260
264
  //#endregion
261
- export { signal as _, isReactive as a, batch as c, effectScope as d, isComputed as f, onCleanup as g, isSignal as h, Updater as i, computed as l, isEffectScope as m, MaybeReactive as n, reactive as o, isEffect as p, Signal as r, resolve as s, Computed as t, effect as u, trigger as v, untracked as y };
265
+ export { untracked as C, trigger as S, isEffect as _, isReactive as a, onCleanup as b, $computed as c, $signal as d, batch as f, isComputed as g, effectScope as h, Updater as i, $effect as l, effect as m, MaybeReactive as n, reactive as o, computed as p, Signal as r, resolve as s, Computed as t, $effectScope as u, isEffectScope as v, signal as x, isSignal as y };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as disposeElement } from "./element-MXzFk4G2.mjs";
2
- import { f as onCleanup, h as untracked, m as trigger, o as effect, p as signal } from "./signals-DcgXhkU2.mjs";
1
+ import { n as disposeElement } from "./element-C_4VbkvQ.mjs";
2
+ import { _ as signal, g as onCleanup, u as effect, v as trigger, y as untracked } from "./signals-BHmWX6ox.mjs";
3
3
  //#region src/jsx-runtime/for.ts
4
4
  /**
5
5
  * Keyed list renderer. Reconciles a reactive array into the DOM using a key
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-Cvdhuy6Y.mjs";
1
+ import { t as Computed } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/integrations/react.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { o as effect, p as signal, s as effectScope } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal, d as effectScope, u as effect } from "../signals-BHmWX6ox.mjs";
2
2
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
3
3
  //#region src/integrations/react.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as PrimitiveNodeType } from "../lib-BYJ5jPTG.mjs";
1
+ import { t as PrimitiveNodeType } from "../lib-JA05lzCN.mjs";
2
2
  import { JSX as JSX$1 } from "dom-expressions/src/jsx-h";
3
3
 
4
4
  //#region src/jsx-runtime/types.d.ts
@@ -1,5 +1,5 @@
1
- import { t as createElement } from "../element-MXzFk4G2.mjs";
2
- import { f as onCleanup } from "../signals-DcgXhkU2.mjs";
1
+ import { t as createElement } from "../element-C_4VbkvQ.mjs";
2
+ import { g as onCleanup } from "../signals-BHmWX6ox.mjs";
3
3
  //#region src/jsx-runtime/fragment.ts
4
4
  /**
5
5
  * Used by the JSX transform for `<>...</>` fragments.
@@ -1,2 +1,2 @@
1
- import { _ as signal, a as isReactive, c as batch, d as effectScope, f as isComputed, g as onCleanup, h as isSignal, i as Updater, l as computed, m as isEffectScope, n as MaybeReactive, o as reactive, p as isEffect, r as Signal, s as resolve, t as Computed, u as effect, v as trigger, y as untracked } from "../index-Cvdhuy6Y.mjs";
2
- export { Computed, MaybeReactive, Signal, Updater, batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, signal, trigger, untracked };
1
+ import { C as untracked, S as trigger, _ as isEffect, a as isReactive, b as onCleanup, c as $computed, d as $signal, f as batch, g as isComputed, h as effectScope, i as Updater, l as $effect, m as effect, n as MaybeReactive, o as reactive, p as computed, r as Signal, s as resolve, t as Computed, u as $effectScope, v as isEffectScope, x as signal, y as isSignal } from "../index-DUshSQ_6.mjs";
2
+ export { $computed, $effect, $effectScope, $signal, Computed, MaybeReactive, Signal, Updater, batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, signal, trigger, untracked };
@@ -1,2 +1,2 @@
1
- import { a as computed, c as isComputed, d as isSignal, f as onCleanup, h as untracked, i as batch, l as isEffect, m as trigger, n as reactive, o as effect, p as signal, r as resolve, s as effectScope, t as isReactive, u as isEffectScope } from "../signals-DcgXhkU2.mjs";
2
- export { batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, signal, trigger, untracked };
1
+ import { _ as signal, a as $effect, c as batch, d as effectScope, f as isComputed, g as onCleanup, h as isSignal, i as $computed, l as computed, m as isEffectScope, n as reactive, o as $effectScope, p as isEffect, r as resolve, s as $signal, t as isReactive, u as effect, v as trigger, y as untracked } from "../signals-BHmWX6ox.mjs";
2
+ export { $computed, $effect, $effectScope, $signal, batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, signal, trigger, untracked };
@@ -1,29 +1,6 @@
1
1
  import "./polyfill-B1lNNcum.mjs";
2
2
  //#region src/signals/system.ts
3
3
  /**
4
- * Bitmask flags that encode the current state of a {@link ReactiveNode}.
5
- *
6
- * | Flag | Meaning |
7
- * |-----------------|---------|
8
- * | `None` | Clean, not tracking. |
9
- * | `Mutable` | Node can propagate value changes downstream (signal / computed). |
10
- * | `Watching` | Node is actively watching for changes and should be notified (effect). |
11
- * | `RecursedCheck` | Node is mid-execution; used to detect self-referential cycles. |
12
- * | `Recursed` | Node was found to be recursed during propagation. |
13
- * | `Dirty` | Node's value is known to be stale; must recompute before reading. |
14
- * | `Pending` | A dep *might* be dirty; check before deciding whether to recompute. |
15
- */
16
- let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags) {
17
- ReactiveFlags[ReactiveFlags["None"] = 0] = "None";
18
- ReactiveFlags[ReactiveFlags["Mutable"] = 1] = "Mutable";
19
- ReactiveFlags[ReactiveFlags["Watching"] = 2] = "Watching";
20
- ReactiveFlags[ReactiveFlags["RecursedCheck"] = 4] = "RecursedCheck";
21
- ReactiveFlags[ReactiveFlags["Recursed"] = 8] = "Recursed";
22
- ReactiveFlags[ReactiveFlags["Dirty"] = 16] = "Dirty";
23
- ReactiveFlags[ReactiveFlags["Pending"] = 32] = "Pending";
24
- return ReactiveFlags;
25
- }({});
26
- /**
27
4
  * Creates and returns the five core graph-manipulation functions that together
28
5
  * implement push-pull reactive dependency tracking.
29
6
  *
@@ -132,15 +109,15 @@ function createReactiveSystem({ update, notify, unwatched }) {
132
109
  top: do {
133
110
  const sub = link.sub;
134
111
  let flags = sub.flags;
135
- if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed | ReactiveFlags.Dirty | ReactiveFlags.Pending))) sub.flags = flags | ReactiveFlags.Pending;
136
- else if (!(flags & (ReactiveFlags.RecursedCheck | ReactiveFlags.Recursed))) flags = ReactiveFlags.None;
137
- else if (!(flags & ReactiveFlags.RecursedCheck)) sub.flags = flags & ~ReactiveFlags.Recursed | ReactiveFlags.Pending;
138
- else if (!(flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && isValidLink(link, sub)) {
139
- sub.flags = flags | (ReactiveFlags.Recursed | ReactiveFlags.Pending);
140
- flags &= ReactiveFlags.Mutable;
141
- } else flags = ReactiveFlags.None;
142
- if (flags & ReactiveFlags.Watching) notify(sub);
143
- if (flags & ReactiveFlags.Mutable) {
112
+ if (!(flags & 60)) sub.flags = flags | 32;
113
+ else if (!(flags & 12)) flags = 0;
114
+ else if (!(flags & 4)) sub.flags = flags & -9 | 32;
115
+ else if (!(flags & 48) && isValidLink(link, sub)) {
116
+ sub.flags = flags | 40;
117
+ flags &= 1;
118
+ } else flags = 0;
119
+ if (flags & 2) notify(sub);
120
+ if (flags & 1) {
144
121
  const subSubs = sub.subs;
145
122
  if (subSubs !== void 0) {
146
123
  const nextSub = (link = subSubs).nextSub;
@@ -189,14 +166,14 @@ function createReactiveSystem({ update, notify, unwatched }) {
189
166
  top: do {
190
167
  const dep = link.dep;
191
168
  const flags = dep.flags;
192
- if (sub.flags & ReactiveFlags.Dirty) dirty = true;
193
- else if ((flags & (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) === (ReactiveFlags.Mutable | ReactiveFlags.Dirty)) {
169
+ if (sub.flags & 16) dirty = true;
170
+ else if ((flags & 17) === 17) {
194
171
  if (update(dep)) {
195
172
  const subs = dep.subs;
196
173
  if (subs.nextSub !== void 0) shallowPropagate(subs);
197
174
  dirty = true;
198
175
  }
199
- } else if ((flags & (ReactiveFlags.Mutable | ReactiveFlags.Pending)) === (ReactiveFlags.Mutable | ReactiveFlags.Pending)) {
176
+ } else if ((flags & 33) === 33) {
200
177
  if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
201
178
  value: link,
202
179
  prev: stack
@@ -227,7 +204,7 @@ function createReactiveSystem({ update, notify, unwatched }) {
227
204
  continue;
228
205
  }
229
206
  dirty = false;
230
- } else sub.flags &= ~ReactiveFlags.Pending;
207
+ } else sub.flags &= -33;
231
208
  sub = link.sub;
232
209
  const nextDep = link.nextDep;
233
210
  if (nextDep !== void 0) {
@@ -251,9 +228,9 @@ function createReactiveSystem({ update, notify, unwatched }) {
251
228
  do {
252
229
  const sub = link.sub;
253
230
  const flags = sub.flags;
254
- if ((flags & (ReactiveFlags.Pending | ReactiveFlags.Dirty)) === ReactiveFlags.Pending) {
255
- sub.flags = flags | ReactiveFlags.Dirty;
256
- if ((flags & (ReactiveFlags.Watching | ReactiveFlags.RecursedCheck)) === ReactiveFlags.Watching) notify(sub);
231
+ if ((flags & 48) === 32) {
232
+ sub.flags = flags | 16;
233
+ if ((flags & 6) === 2) notify(sub);
257
234
  }
258
235
  } while ((link = link.nextSub) !== void 0);
259
236
  }
@@ -298,6 +275,10 @@ let activeSub;
298
275
  let activeOwner;
299
276
  /** Ring-buffer of effects waiting to be flushed. */
300
277
  const queued = [];
278
+ const $signal = Symbol("signal");
279
+ const $computed = Symbol("computed");
280
+ const $effect = Symbol("effect");
281
+ const $effectScope = Symbol("effectScope");
301
282
  const { link, unlink, propagate, checkDirty, shallowPropagate } = createReactiveSystem({
302
283
  update(node) {
303
284
  if (node.depsTail !== void 0) return updateComputed(node);
@@ -308,9 +289,9 @@ const { link, unlink, propagate, checkDirty, shallowPropagate } = createReactive
308
289
  let firstInsertedIndex = insertIndex;
309
290
  do {
310
291
  queued[insertIndex++] = effect;
311
- effect.flags &= ~ReactiveFlags.Watching;
292
+ effect.flags &= -3;
312
293
  effect = effect.subs?.sub;
313
- if (effect === void 0 || !(effect.flags & ReactiveFlags.Watching)) break;
294
+ if (effect === void 0 || !(effect.flags & 2)) break;
314
295
  } while (true);
315
296
  queuedLength = insertIndex;
316
297
  while (firstInsertedIndex < --insertIndex) {
@@ -320,10 +301,18 @@ const { link, unlink, propagate, checkDirty, shallowPropagate } = createReactive
320
301
  }
321
302
  },
322
303
  unwatched(node) {
323
- if (!(node.flags & ReactiveFlags.Mutable)) effectScopeOper.call(node);
304
+ if (!(node.flags & 1)) effectScopeOper.call(node);
324
305
  else if (node.depsTail !== void 0) {
306
+ const c = node;
307
+ if (c.onCleanup !== void 0) {
308
+ const fns = c.onCleanup;
309
+ c.onCleanup = void 0;
310
+ untracked(() => {
311
+ for (const fn of fns) fn();
312
+ });
313
+ }
325
314
  node.depsTail = void 0;
326
- node.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
315
+ node.flags = 17;
327
316
  purgeDeps(node);
328
317
  }
329
318
  }
@@ -364,26 +353,26 @@ function endBatch() {
364
353
  /**
365
354
  * Returns `true` if `fn` is a signal handle created by {@link signal}.
366
355
  *
367
- * Relies on `Function.name` matching the internal `signalOper` function name.
356
+ * Relies on `$signal` matching the internal `signalOper` function name.
368
357
  */
369
358
  function isSignal(fn) {
370
- return fn.name === "bound " + signalOper.name;
359
+ return fn != null && fn[$signal] === true;
371
360
  }
372
361
  /**
373
362
  * Returns `true` if `fn` is a computed handle created by {@link computed}.
374
363
  *
375
- * Relies on `Function.name` matching the internal `computedOper` function name.
364
+ * Relies on `$computed` matching the internal `computedOper` function name.
376
365
  */
377
366
  function isComputed(fn) {
378
- return fn.name === "bound " + computedOper.name;
367
+ return fn != null && fn[$computed] === true;
379
368
  }
380
369
  /**
381
370
  * Returns `true` if `fn` is an effect cleanup handle created by {@link effect}.
382
371
  *
383
- * Relies on `Function.name` matching the internal `effectOper` function name.
372
+ * Relies on the $effect symbol branding.
384
373
  */
385
374
  function isEffect(fn) {
386
- return fn.name === "bound " + effectOper.name;
375
+ return fn != null && fn[$effect] === true;
387
376
  }
388
377
  /**
389
378
  * Returns `true` if `fn` is an effectScope cleanup handle created by
@@ -395,13 +384,15 @@ function isEffectScope(fn) {
395
384
  return fn.name === "bound " + effectScopeOper.name;
396
385
  }
397
386
  function signal(initialValue) {
398
- return signalOper.bind({
387
+ const handle = signalOper.bind({
399
388
  currentValue: initialValue,
400
389
  pendingValue: initialValue,
401
390
  subs: void 0,
402
391
  subsTail: void 0,
403
- flags: ReactiveFlags.Mutable
392
+ flags: 1
404
393
  });
394
+ Object.defineProperty(handle, $signal, { value: true });
395
+ return handle;
405
396
  }
406
397
  /**
407
398
  * Creates a lazily-evaluated computed value.
@@ -427,15 +418,17 @@ function signal(initialValue) {
427
418
  * ```
428
419
  */
429
420
  function computed(getter) {
430
- return computedOper.bind({
421
+ const handle = computedOper.bind({
431
422
  value: void 0,
432
423
  subs: void 0,
433
424
  subsTail: void 0,
434
425
  deps: void 0,
435
426
  depsTail: void 0,
436
- flags: ReactiveFlags.None,
427
+ flags: 0,
437
428
  getter
438
429
  });
430
+ Object.defineProperty(handle, $computed, { value: true });
431
+ return handle;
439
432
  }
440
433
  /**
441
434
  * Creates a reactive side-effect that runs immediately and re-runs whenever
@@ -474,7 +467,7 @@ function effect(fn) {
474
467
  subsTail: void 0,
475
468
  deps: void 0,
476
469
  depsTail: void 0,
477
- flags: ReactiveFlags.Watching | ReactiveFlags.RecursedCheck
470
+ flags: 6
478
471
  };
479
472
  const prevSub = setActiveSub(e);
480
473
  const prevOwner = activeOwner;
@@ -485,9 +478,11 @@ function effect(fn) {
485
478
  } finally {
486
479
  activeSub = prevSub;
487
480
  activeOwner = prevOwner;
488
- e.flags &= ~ReactiveFlags.RecursedCheck;
481
+ e.flags &= -5;
489
482
  }
490
- return effectOper.bind(e);
483
+ const handle = effectOper.bind(e);
484
+ Object.defineProperty(handle, $effect, { value: true });
485
+ return handle;
491
486
  }
492
487
  /**
493
488
  * Creates an ownership scope that groups reactive effects so they can all be
@@ -519,7 +514,7 @@ function effectScope(fn) {
519
514
  depsTail: void 0,
520
515
  subs: void 0,
521
516
  subsTail: void 0,
522
- flags: ReactiveFlags.None
517
+ flags: 0
523
518
  };
524
519
  const prevSub = setActiveSub(e);
525
520
  const prevOwner = activeOwner;
@@ -531,7 +526,9 @@ function effectScope(fn) {
531
526
  activeSub = prevSub;
532
527
  activeOwner = prevOwner;
533
528
  }
534
- return effectScopeOper.bind(e);
529
+ const handle = effectScopeOper.bind(e);
530
+ Object.defineProperty(handle, $effectScope, { value: true });
531
+ return handle;
535
532
  }
536
533
  /**
537
534
  * Registers a cleanup callback for the currently executing effect or scope.
@@ -651,7 +648,7 @@ function trigger(fn) {
651
648
  const sub = {
652
649
  deps: void 0,
653
650
  depsTail: void 0,
654
- flags: ReactiveFlags.Watching
651
+ flags: 2
655
652
  };
656
653
  const prevSub = setActiveSub(sub);
657
654
  try {
@@ -664,7 +661,7 @@ function trigger(fn) {
664
661
  link = unlink(link, sub);
665
662
  const subs = dep.subs;
666
663
  if (subs !== void 0) {
667
- sub.flags = ReactiveFlags.None;
664
+ sub.flags = 0;
668
665
  propagate(subs);
669
666
  shallowPropagate(subs);
670
667
  }
@@ -680,15 +677,25 @@ function trigger(fn) {
680
677
  */
681
678
  function updateComputed(c) {
682
679
  ++cycle;
680
+ if (c.onCleanup !== void 0) {
681
+ const cleanups = c.onCleanup;
682
+ c.onCleanup = void 0;
683
+ untracked(() => {
684
+ for (const fn of cleanups) fn();
685
+ });
686
+ }
683
687
  c.depsTail = void 0;
684
- c.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
688
+ c.flags = 5;
685
689
  const prevSub = setActiveSub(c);
690
+ const prevOwner = activeOwner;
691
+ activeOwner = c;
686
692
  try {
687
693
  const oldValue = c.value;
688
694
  return oldValue !== (c.value = c.getter(oldValue));
689
695
  } finally {
690
696
  activeSub = prevSub;
691
- c.flags &= ~ReactiveFlags.RecursedCheck;
697
+ activeOwner = prevOwner;
698
+ c.flags &= -5;
692
699
  purgeDeps(c);
693
700
  }
694
701
  }
@@ -698,7 +705,7 @@ function updateComputed(c) {
698
705
  * @internal
699
706
  */
700
707
  function updateSignal(s) {
701
- s.flags = ReactiveFlags.Mutable;
708
+ s.flags = 1;
702
709
  return s.currentValue !== (s.currentValue = s.pendingValue);
703
710
  }
704
711
  /**
@@ -711,7 +718,7 @@ function updateSignal(s) {
711
718
  */
712
719
  function run(e) {
713
720
  const flags = e.flags;
714
- if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(e.deps, e)) {
721
+ if (flags & 16 || flags & 32 && checkDirty(e.deps, e)) {
715
722
  ++cycle;
716
723
  if (e.onCleanup !== void 0) {
717
724
  const cleanups = e.onCleanup;
@@ -721,7 +728,7 @@ function run(e) {
721
728
  });
722
729
  }
723
730
  e.depsTail = void 0;
724
- e.flags = ReactiveFlags.Watching | ReactiveFlags.RecursedCheck;
731
+ e.flags = 6;
725
732
  const prevSub = setActiveSub(e);
726
733
  const prevOwner = activeOwner;
727
734
  activeOwner = e;
@@ -730,10 +737,10 @@ function run(e) {
730
737
  } finally {
731
738
  activeSub = prevSub;
732
739
  activeOwner = prevOwner;
733
- e.flags &= ~ReactiveFlags.RecursedCheck;
740
+ e.flags &= -5;
734
741
  purgeDeps(e);
735
742
  }
736
- } else e.flags = ReactiveFlags.Watching;
743
+ } else e.flags = 2;
737
744
  }
738
745
  /**
739
746
  * Drains the queued-effects array, running each effect in order.
@@ -754,7 +761,7 @@ function flush() {
754
761
  while (notifyIndex < queuedLength) {
755
762
  const effect = queued[notifyIndex];
756
763
  queued[notifyIndex++] = void 0;
757
- effect.flags |= ReactiveFlags.Watching | ReactiveFlags.Recursed;
764
+ effect.flags |= 10;
758
765
  }
759
766
  notifyIndex = 0;
760
767
  queuedLength = 0;
@@ -773,19 +780,22 @@ function flush() {
773
780
  */
774
781
  function computedOper() {
775
782
  const flags = this.flags;
776
- if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && (checkDirty(this.deps, this) || (this.flags = flags & ~ReactiveFlags.Pending, false))) {
783
+ if (flags & 16 || flags & 32 && (checkDirty(this.deps, this) || (this.flags = flags & -33, false))) {
777
784
  if (updateComputed(this)) {
778
785
  const subs = this.subs;
779
786
  if (subs !== void 0) shallowPropagate(subs);
780
787
  }
781
788
  } else if (!flags) {
782
- this.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
789
+ this.flags = 5;
783
790
  const prevSub = setActiveSub(this);
791
+ const prevOwner = activeOwner;
792
+ activeOwner = this;
784
793
  try {
785
794
  this.value = this.getter();
786
795
  } finally {
787
796
  activeSub = prevSub;
788
- this.flags &= ~ReactiveFlags.RecursedCheck;
797
+ activeOwner = prevOwner;
798
+ this.flags &= -5;
789
799
  }
790
800
  }
791
801
  const sub = activeSub;
@@ -807,7 +817,7 @@ function computedOper() {
807
817
  function signalOper(...value) {
808
818
  if (value.length) {
809
819
  if (this.pendingValue !== (this.pendingValue = value[0])) {
810
- this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
820
+ this.flags = 17;
811
821
  const subs = this.subs;
812
822
  if (subs !== void 0) {
813
823
  propagate(subs);
@@ -815,7 +825,7 @@ function signalOper(...value) {
815
825
  }
816
826
  }
817
827
  } else {
818
- if (this.flags & ReactiveFlags.Dirty) {
828
+ if (this.flags & 16) {
819
829
  if (updateSignal(this)) {
820
830
  const subs = this.subs;
821
831
  if (subs !== void 0) shallowPropagate(subs);
@@ -823,7 +833,7 @@ function signalOper(...value) {
823
833
  }
824
834
  let sub = activeSub;
825
835
  while (sub !== void 0) {
826
- if (sub.flags & (ReactiveFlags.Mutable | ReactiveFlags.Watching)) {
836
+ if (sub.flags & 3) {
827
837
  link(this, sub, cycle);
828
838
  break;
829
839
  }
@@ -878,7 +888,7 @@ function effectScopeOper() {
878
888
  });
879
889
  }
880
890
  this.depsTail = void 0;
881
- this.flags = ReactiveFlags.None;
891
+ this.flags = 0;
882
892
  purgeDeps(this);
883
893
  const sub = this.subs;
884
894
  if (sub !== void 0) unlink(sub);
@@ -961,4 +971,4 @@ function resolve(value) {
961
971
  return isReactive(value) ? value() : value;
962
972
  }
963
973
  //#endregion
964
- export { computed as a, isComputed as c, isSignal as d, onCleanup as f, untracked as h, batch as i, isEffect as l, trigger as m, reactive as n, effect as o, signal as p, resolve as r, effectScope as s, isReactive as t, isEffectScope as u };
974
+ export { signal as _, $effect as a, batch as c, effectScope as d, isComputed as f, onCleanup as g, isSignal as h, $computed as i, computed as l, isEffectScope as m, reactive as n, $effectScope as o, isEffect as p, resolve as r, $signal as s, isReactive as t, effect as u, trigger as v, untracked as y };
package/dist/slot.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { t as PrimitiveNodeType } from "./lib-BYJ5jPTG.mjs";
1
+ import { t as PrimitiveNodeType } from "./lib-JA05lzCN.mjs";
2
+
2
3
  //#region src/slot.d.ts
3
4
  /**
4
5
  * A lightweight slot that reserves a region in the DOM using comment markers.
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-Cvdhuy6Y.mjs";
1
+ import { t as Computed } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/utilities/active-element.d.ts
4
4
  declare const activeElement: Computed<Element | null>;
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-Cvdhuy6Y.mjs";
1
+ import { t as Computed } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/utilities/debounced.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { o as effect, p as signal } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal, u as effect } from "../signals-BHmWX6ox.mjs";
2
2
  import { createTimeout } from "./timeout.mjs";
3
3
  //#region src/utilities/debounced.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { p as signal, s as effectScope } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal, d as effectScope } from "../signals-BHmWX6ox.mjs";
2
2
  import { a as beforeEach, n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createDebounced } from "./debounced.mjs";
4
4
  //#region src/utilities/debounced.test.ts
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-Cvdhuy6Y.mjs";
1
+ import { t as Computed } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/utilities/element-rect.d.ts
4
4
  type RectResult = {
@@ -1,4 +1,4 @@
1
- import { p as signal } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal } from "../signals-BHmWX6ox.mjs";
2
2
  import { createResizeObserver } from "./resize-observer.mjs";
3
3
  //#region src/utilities/element-rect.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { s as effectScope } from "../signals-DcgXhkU2.mjs";
1
+ import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
2
  import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createElementRect } from "./element-rect.mjs";
4
4
  //#region src/utilities/element-rect.test.ts
@@ -1,4 +1,4 @@
1
- import { r as Signal } from "../index-Cvdhuy6Y.mjs";
1
+ import { r as Signal } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/utilities/element-scroll.d.ts
4
4
  type ElementScrollResult = {
@@ -1,4 +1,4 @@
1
- import { f as onCleanup, o as effect, p as signal } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal, g as onCleanup, u as effect } from "../signals-BHmWX6ox.mjs";
2
2
  import { on } from "./event-listener.mjs";
3
3
  //#region src/utilities/element-scroll.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { s as effectScope } from "../signals-DcgXhkU2.mjs";
1
+ import { d as effectScope } from "../signals-BHmWX6ox.mjs";
2
2
  import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { createElementScroll } from "./element-scroll.mjs";
4
4
  //#region src/utilities/element-scroll.test.ts
@@ -1,4 +1,4 @@
1
- import { r as Signal, t as Computed } from "../index-Cvdhuy6Y.mjs";
1
+ import { r as Signal, t as Computed } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/utilities/event-driven.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as computed, f as onCleanup, m as trigger, p as signal } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal, g as onCleanup, l as computed, s as $signal, v as trigger } from "../signals-BHmWX6ox.mjs";
2
2
  //#region src/utilities/event-driven.ts
3
3
  /**
4
4
  * Returns a `Subscribe` for one or more DOM events on a target.
@@ -24,15 +24,17 @@ function sync(subscribe, getter, setter) {
24
24
  value();
25
25
  const cleanup = subscribe(() => trigger(tick));
26
26
  onCleanup(cleanup);
27
- if (setter) {
28
- const proxy = (v) => {
29
- if (v === void 0) return value();
27
+ const factory = () => {
28
+ if (!setter) return value;
29
+ function proxy(v) {
30
+ if (arguments.length === 0 || !setter) return value();
30
31
  setter(v);
31
32
  return v;
32
- };
33
- return [proxy, cleanup];
34
- }
35
- return [value, cleanup];
33
+ }
34
+ Object.defineProperty(proxy, $signal, { value: true });
35
+ return proxy;
36
+ };
37
+ return [factory(), cleanup];
36
38
  }
37
39
  //#endregion
38
40
  export { fromEvent, sync };
@@ -1,4 +1,4 @@
1
- import { t as Computed } from "../index-Cvdhuy6Y.mjs";
1
+ import { t as Computed } from "../index-DUshSQ_6.mjs";
2
2
 
3
3
  //#region src/utilities/event-listener.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { f as onCleanup, o as effect } from "../signals-DcgXhkU2.mjs";
1
+ import { g as onCleanup, u as effect } from "../signals-BHmWX6ox.mjs";
2
2
  //#region src/utilities/event-listener.ts
3
3
  function on(target, type, handler, options) {
4
4
  const add = (t) => options !== void 0 ? t.addEventListener(type, handler, options) : t.addEventListener(type, handler);
@@ -1,4 +1,4 @@
1
- import { o as effect, p as signal, s as effectScope } from "../signals-DcgXhkU2.mjs";
1
+ import { _ as signal, d as effectScope, u as effect } from "../signals-BHmWX6ox.mjs";
2
2
  import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-ANkhHvbr.mjs";
3
3
  import { on } from "./event-listener.mjs";
4
4
  //#region src/utilities/event-listener.test.ts