elements-kit 0.3.1 → 0.3.3

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 (82) hide show
  1. package/dist/{benchmark.CX_oY03V-COK1VBpH.mjs → benchmark.CX_oY03V-CsUg-gW0.mjs} +2 -2
  2. package/dist/custom-elements-D5CgfNKc.d.mts +55 -0
  3. package/dist/custom-elements.d.mts +1 -1
  4. package/dist/custom-elements.mjs +6 -4
  5. package/dist/{element-BjpyY6qv.mjs → element-DvqBlRly.mjs} +195 -47
  6. package/dist/for.d.mts +1 -1
  7. package/dist/for.mjs +1 -1
  8. package/dist/{infer-BUUWMoG9.d.mts → infer-K2Te9gn1.d.mts} +50 -38
  9. package/dist/integrations/react.d.mts +1 -1
  10. package/dist/jsx-runtime/index.d.mts +1 -1
  11. package/dist/jsx-runtime/index.mjs +1 -1
  12. package/dist/signals/index.d.mts +1 -1
  13. package/dist/signals/index.mjs +5 -3
  14. package/dist/slot-B8y0aEoz.d.mts +71 -0
  15. package/dist/slot-DLjSL6t1.mjs +124 -0
  16. package/dist/slot.d.mts +2 -2
  17. package/dist/slot.mjs +2 -2
  18. package/dist/{test.BmQO5GaM-C8YqghE0.mjs → test.BmQO5GaM-ZC2MPXQb.mjs} +4 -4
  19. package/dist/utilities/active-element.d.mts +1 -1
  20. package/dist/utilities/active-element.test.mjs +2 -2
  21. package/dist/utilities/async.d.mts +7 -1
  22. package/dist/utilities/async.mjs +6 -0
  23. package/dist/utilities/async.test.mjs +2 -2
  24. package/dist/utilities/context.test.mjs +2 -2
  25. package/dist/utilities/debounced.d.mts +1 -1
  26. package/dist/utilities/debounced.test.mjs +2 -2
  27. package/dist/utilities/dom-lifecycle.bench.mjs +1 -1
  28. package/dist/utilities/dom-lifecycle.d.mts +19 -21
  29. package/dist/utilities/dom-lifecycle.mjs +16 -13
  30. package/dist/utilities/dom-lifecycle.test.mjs +3 -2
  31. package/dist/utilities/element-rect.d.mts +1 -1
  32. package/dist/utilities/element-rect.test.mjs +2 -2
  33. package/dist/utilities/element-scroll.d.mts +1 -1
  34. package/dist/utilities/element-scroll.test.mjs +2 -2
  35. package/dist/utilities/event-driven.d.mts +1 -1
  36. package/dist/utilities/event-listener.d.mts +1 -1
  37. package/dist/utilities/event-listener.test.mjs +2 -2
  38. package/dist/utilities/focus-within.d.mts +1 -1
  39. package/dist/utilities/focus-within.test.mjs +2 -2
  40. package/dist/utilities/hover.d.mts +1 -1
  41. package/dist/utilities/hover.test.mjs +2 -2
  42. package/dist/utilities/intersection-observer.d.mts +17 -0
  43. package/dist/utilities/intersection-observer.mjs +17 -0
  44. package/dist/utilities/intersection-observer.test.mjs +2 -2
  45. package/dist/utilities/interval.d.mts +1 -1
  46. package/dist/utilities/interval.test.mjs +2 -2
  47. package/dist/utilities/location.d.mts +1 -1
  48. package/dist/utilities/location.test.mjs +2 -2
  49. package/dist/utilities/long-press.test.mjs +2 -2
  50. package/dist/utilities/media-devices.d.mts +1 -1
  51. package/dist/utilities/media-devices.test.mjs +2 -2
  52. package/dist/utilities/media-player.d.mts +1 -1
  53. package/dist/utilities/media-player.test.mjs +2 -2
  54. package/dist/utilities/media-query.d.mts +1 -1
  55. package/dist/utilities/mutation-observer.test.mjs +2 -2
  56. package/dist/utilities/network.d.mts +1 -1
  57. package/dist/utilities/network.test.mjs +2 -2
  58. package/dist/utilities/on-click-outside.test.mjs +2 -2
  59. package/dist/utilities/orientation.d.mts +1 -1
  60. package/dist/utilities/previous.d.mts +1 -1
  61. package/dist/utilities/previous.test.mjs +2 -2
  62. package/dist/utilities/promise.d.mts +1 -1
  63. package/dist/utilities/promise.test.mjs +2 -2
  64. package/dist/utilities/retry.test.mjs +2 -2
  65. package/dist/utilities/routing.d.mts +1 -1
  66. package/dist/utilities/routing.test.mjs +2 -2
  67. package/dist/utilities/search-params.d.mts +1 -1
  68. package/dist/utilities/search-params.test.mjs +2 -2
  69. package/dist/utilities/ssr.test.mjs +2 -2
  70. package/dist/utilities/storage.d.mts +1 -1
  71. package/dist/utilities/storage.test.mjs +2 -2
  72. package/dist/utilities/throttled.d.mts +1 -1
  73. package/dist/utilities/throttled.test.mjs +2 -2
  74. package/dist/utilities/timeout.d.mts +1 -1
  75. package/dist/utilities/timeout.test.mjs +2 -2
  76. package/dist/utilities/window-focus.d.mts +1 -1
  77. package/dist/utilities/window-size.d.mts +1 -1
  78. package/dist/utilities/window-size.test.mjs +2 -2
  79. package/package.json +1 -1
  80. package/dist/custom-elements-CBuenqVD.d.mts +0 -41
  81. package/dist/slot-BnzxFBfO.mjs +0 -198
  82. package/dist/slot-CfafCBOW.d.mts +0 -121
@@ -1,121 +0,0 @@
1
- //#region src/lib.d.ts
2
- type PrimitiveNodeType = Node | string | boolean | number | bigint | symbol | Date | RegExp | null | undefined;
3
- //#endregion
4
- //#region src/polyfill.d.ts
5
- declare global {
6
- interface SymbolConstructor {
7
- readonly dispose: symbol;
8
- }
9
- interface Disposable {
10
- [Symbol.dispose](): void;
11
- }
12
- }
13
- //#endregion
14
- //#region src/slot.d.ts
15
- /**
16
- * A lightweight slot that reserves a region in the DOM using comment markers.
17
- * Content between the markers can be replaced dynamically without wrapper elements.
18
- */
19
- declare class Slot {
20
- #private;
21
- private readonly start;
22
- private readonly end;
23
- /**
24
- * Render the slot as a DocumentFragment.
25
- * If not yet mounted, inserts the comment markers and optional default content.
26
- * If already mounted, extracts and returns the current content WITHOUT disposing
27
- * it — the caller takes ownership of the returned nodes and is responsible for
28
- * their disposal.
29
- */
30
- slot(defaultContent?: PrimitiveNodeType): DocumentFragment;
31
- /** Dispose reactive children and remove all content between the markers. */
32
- clear(): void;
33
- /**
34
- * Replace the slot's content with the given element.
35
- * No-op if the slot is not mounted or the content is identical.
36
- */
37
- set(element: Node): void;
38
- /**
39
- * Extract and return the current slot content as a DocumentFragment.
40
- * Returns `null` if the slot is not mounted.
41
- * Content is NOT disposed — the caller takes ownership and is responsible
42
- * for disposal.
43
- */
44
- get(): DocumentFragment | null;
45
- /** Returns the parent node if the slot is mounted, otherwise `null`. */
46
- parent(): ParentNode | null;
47
- /** Whether the slot's comment markers are attached to the DOM. */
48
- isMounted(): boolean;
49
- private isSame;
50
- /**
51
- * Create a callable slot instance.
52
- *
53
- * The returned value is both a function and an object:
54
- * - Call it to render the slot with optional default content.
55
- * - Access `.set()`, `.parent()`, `.isMounted()` for slot management.
56
- *
57
- * @example
58
- * ```ts
59
- * const slot = createSlot();
60
- * el.append(slot("default text")); // mount with default
61
- * slot.set(newElement); // replace content
62
- * ```
63
- */
64
- static new(): Slot & ((defaultContent?: PrimitiveNodeType) => DocumentFragment);
65
- }
66
- /**
67
- * A callable slot returned by {@link Slot.new}.
68
- *
69
- * - Invoke it (`slot()`) to render the slot region as a `DocumentFragment`,
70
- * optionally with default content on first mount.
71
- * - Call `.set()` to replace current content, `.clear()` to empty it, and
72
- * `.isMounted()` / `.parent()` to inspect mount state.
73
- */
74
- type SlotInstance = ReturnType<typeof Slot.new>;
75
- /**
76
- * Symbol key for attaching a `Slots` instance to a custom element instance.
77
- * This prevent collisions with Element properties and are not meant to be treated as JSX children.
78
- */
79
- declare const SLOTS: unique symbol;
80
- declare const $map: unique symbol;
81
- declare const $keys: unique symbol;
82
- declare const $has: unique symbol;
83
- /**
84
- * A keyed collection of slot instances.
85
- * Slots are pre-created from the provided keys and lazily created on first access for unknown keys.
86
- */
87
- declare class Slots<K extends string> implements Iterable<[K, SlotInstance]> {
88
- readonly [$map]: Map<K, Slot & ((defaultContent?: PrimitiveNodeType) => DocumentFragment)>;
89
- private constructor();
90
- [Symbol.iterator](): MapIterator<[K, Slot & ((defaultContent?: PrimitiveNodeType) => DocumentFragment)]>;
91
- [Symbol.toStringTag](): string;
92
- [Symbol.hasInstance](instance: unknown): instance is Slots<any>;
93
- [$has](key: K): boolean;
94
- /** Check whether a slot with the given key exists. */
95
- static has<K extends string>(slots: Slots<K>, key: K): boolean;
96
- [$keys](): MapIterator<K>;
97
- /** Iterate over all registered slot keys. */
98
- static keys<K extends string>(slots: Slots<K>): MapIterator<K>;
99
- /**
100
- * Create a typed `Slots` collection from a list of key names.
101
- *
102
- * Pass the keys with `as const` so TS narrows them to a literal union —
103
- * this is what lets `ElementProps<typeof Cls>` synthesize `slot:${K}`
104
- * entries. Without `as const`, the array type widens to `string[]` and
105
- * the slot keys are lost.
106
- *
107
- * @example
108
- * ```ts
109
- * class Card extends HTMLElement {
110
- * // ✅ literal keys flow through — "header" | "footer"
111
- * [SLOTS] = Slots.new(["header", "footer"] as const);
112
- * }
113
- *
114
- * // ❌ widens to string; no typed slot:* props
115
- * // [SLOTS] = Slots.new(["header", "footer"]);
116
- * ```
117
- */
118
- static new<K extends string>(keys: K[]): Slots<K> & { readonly [P in K]: SlotInstance };
119
- }
120
- //#endregion
121
- export { PrimitiveNodeType as a, Slots as i, Slot as n, SlotInstance as r, SLOTS as t };