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
@@ -5106,7 +5106,7 @@ function manageArtifactAttachment(attachment) {
5106
5106
  if (attachment.body != null) attachment.bodyEncoding ??= "base64";
5107
5107
  }
5108
5108
  //#endregion
5109
- //#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_jsdom@29.1.0_vite@8.0.8_@types+node@25.5.2_esbuild@0.27.7_/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
5109
+ //#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_vite@8.0.8_@types+node@25.5.2_esbuild@0.27.7_/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
5110
5110
  const NAME_WORKER_STATE = "__vitest_worker__";
5111
5111
  function getWorkerState() {
5112
5112
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -5146,7 +5146,7 @@ async function waitForImportsToResolve() {
5146
5146
  await waitForImportsToResolve();
5147
5147
  }
5148
5148
  //#endregion
5149
- //#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_jsdom@29.1.0_vite@8.0.8_@types+node@25.5.2_esbuild@0.27.7_/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js
5149
+ //#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_vite@8.0.8_@types+node@25.5.2_esbuild@0.27.7_/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js
5150
5150
  const benchFns = /* @__PURE__ */ new WeakMap();
5151
5151
  const benchOptsMap = /* @__PURE__ */ new WeakMap();
5152
5152
  const bench = createBenchmark(function(name, fn = noop, options = {}) {
@@ -0,0 +1,55 @@
1
+ //#region src/custom-elements.d.ts
2
+ /**
3
+ * Registry of custom-element tags to their constructors.
4
+ * Users augment this interface to add typed JSX support for their elements.
5
+ *
6
+ * The interface lives in the global `ElementsKit` namespace so augmentations
7
+ * propagate cleanly through type-bundle chunk splits — augmenting a module
8
+ * subpath would not always merge with internal references inside the JSX
9
+ * namespace's `IntrinsicElements`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * declare global {
14
+ * namespace ElementsKit {
15
+ * interface CustomElementRegistry {
16
+ * "x-range": typeof XRange;
17
+ * }
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ declare global {
23
+ namespace ElementsKit {
24
+ interface CustomElementRegistry {}
25
+ }
26
+ }
27
+ type CustomElementRegistry = ElementsKit.CustomElementRegistry;
28
+ type AnyCtor = CustomElementConstructor;
29
+ /**
30
+ * Register a custom element with the browser and return its class.
31
+ * Pair with an augmentation of `ElementsKit.CustomElementRegistry` to get typed JSX.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * import { defineElement } from "elements-kit/custom-elements";
36
+ *
37
+ * class XCounter extends HTMLElement {}
38
+ *
39
+ * defineElement("x-counter", XCounter);
40
+ *
41
+ * declare global {
42
+ * namespace ElementsKit {
43
+ * interface CustomElementRegistry {
44
+ * "x-counter": typeof XCounter;
45
+ * }
46
+ * }
47
+ * }
48
+ *
49
+ * // JSX now gets typed props + typed ref
50
+ * // <x-counter />
51
+ * ```
52
+ */
53
+ declare function defineElement<Tag extends `${string}-${string}`, C extends AnyCtor>(tag: Tag, cls: C, options?: ElementDefinitionOptions): C;
54
+ //#endregion
55
+ export { defineElement as n, CustomElementRegistry as t };
@@ -1,2 +1,2 @@
1
- import { n as defineElement, t as CustomElementRegistry } from "./custom-elements-CBuenqVD.mjs";
1
+ import { n as defineElement, t as CustomElementRegistry } from "./custom-elements-D5CgfNKc.mjs";
2
2
  export { CustomElementRegistry, defineElement };
@@ -1,7 +1,7 @@
1
1
  //#region src/custom-elements.ts
2
2
  /**
3
3
  * Register a custom element with the browser and return its class.
4
- * Pair with a module augmentation of `CustomElementRegistry` to get typed JSX.
4
+ * Pair with an augmentation of `ElementsKit.CustomElementRegistry` to get typed JSX.
5
5
  *
6
6
  * @example
7
7
  * ```tsx
@@ -11,9 +11,11 @@
11
11
  *
12
12
  * defineElement("x-counter", XCounter);
13
13
  *
14
- * declare module "elements-kit/custom-elements" {
15
- * interface CustomElementRegistry {
16
- * "x-counter": typeof XCounter;
14
+ * declare global {
15
+ * namespace ElementsKit {
16
+ * interface CustomElementRegistry {
17
+ * "x-counter": typeof XCounter;
18
+ * }
17
19
  * }
18
20
  * }
19
21
  *
@@ -2,19 +2,96 @@ import { c as effectScope, g as untracked, p as onCleanup, s as effect } from ".
2
2
  import "./polyfill-CdZVCxdo.mjs";
3
3
  import { isReactive, resolveProps } from "./signals/index.mjs";
4
4
  import { on } from "./utilities/event-listener.mjs";
5
- import { i as resolveNode$1, n as Slot, r as Slots, t as SLOTS } from "./slot-BnzxFBfO.mjs";
6
- import { ChildProperties, Properties, SVGNamespace } from "dom-expressions/src/constants.js";
5
+ import { n as Slot, r as resolveNode$1, t as SLOTS } from "./slot-DLjSL6t1.mjs";
7
6
  //#region src/jsx-runtime/constants.ts
8
7
  /**
9
8
  * IDL properties that take precedence over the default `setAttribute` path.
10
9
  *
11
- * Extends dom-expressions' base set with `defaultValue` without it, JSX
12
- * `<input defaultValue="x" />` falls through to `setAttribute("defaultValue",
13
- * "x")` and creates a useless `defaultvalue` HTML attribute (native
14
- * `HTMLInputElement` has no such content attribute; its `defaultValue` IDL
15
- * property reflects the `value` content attribute instead).
10
+ * Includes camelCase boolean aliases (`readOnly`, `noValidate`, …) plus
11
+ * lowercase boolean attributes that should be set as properties for correct
12
+ * reflection. `defaultValue` is added on top without it, `<input
13
+ * defaultValue="x" />` falls through to `setAttribute("defaultValue", "x")`
14
+ * which creates a useless `defaultvalue` content attribute (native
15
+ * `HTMLInputElement` has no such attribute; the IDL property reflects `value`).
16
16
  */
17
- const Properties$1 = new Set([...Properties, "defaultValue"]);
17
+ const Properties = new Set([
18
+ "className",
19
+ "value",
20
+ "readOnly",
21
+ "noValidate",
22
+ "formNoValidate",
23
+ "isMap",
24
+ "noModule",
25
+ "playsInline",
26
+ "adAuctionHeaders",
27
+ "allowFullscreen",
28
+ "browsingTopics",
29
+ "defaultChecked",
30
+ "defaultMuted",
31
+ "defaultSelected",
32
+ "disablePictureInPicture",
33
+ "disableRemotePlayback",
34
+ "preservesPitch",
35
+ "shadowRootClonable",
36
+ "shadowRootCustomElementRegistry",
37
+ "shadowRootDelegatesFocus",
38
+ "shadowRootSerializable",
39
+ "sharedStorageWritable",
40
+ "allowfullscreen",
41
+ "async",
42
+ "alpha",
43
+ "autofocus",
44
+ "autoplay",
45
+ "checked",
46
+ "controls",
47
+ "default",
48
+ "disabled",
49
+ "formnovalidate",
50
+ "hidden",
51
+ "indeterminate",
52
+ "inert",
53
+ "ismap",
54
+ "loop",
55
+ "multiple",
56
+ "muted",
57
+ "nomodule",
58
+ "novalidate",
59
+ "open",
60
+ "playsinline",
61
+ "readonly",
62
+ "required",
63
+ "reversed",
64
+ "seamless",
65
+ "selected",
66
+ "adauctionheaders",
67
+ "browsingtopics",
68
+ "credentialless",
69
+ "defaultchecked",
70
+ "defaultmuted",
71
+ "defaultselected",
72
+ "defer",
73
+ "disablepictureinpicture",
74
+ "disableremoteplayback",
75
+ "preservespitch",
76
+ "shadowrootclonable",
77
+ "shadowrootcustomelementregistry",
78
+ "shadowrootdelegatesfocus",
79
+ "shadowrootserializable",
80
+ "sharedstoragewritable",
81
+ "defaultValue"
82
+ ]);
83
+ /** Properties whose assignment replaces the element's children. */
84
+ const ChildProperties = new Set([
85
+ "innerHTML",
86
+ "textContent",
87
+ "innerText",
88
+ "children"
89
+ ]);
90
+ /** XML namespaces for SVG-namespaced attributes (`xlink:href`, `xml:lang`). */
91
+ const SVGNamespace = {
92
+ xlink: "http://www.w3.org/1999/xlink",
93
+ xml: "http://www.w3.org/XML/1998/namespace"
94
+ };
18
95
  const ReservedNameSpaces = new Set([
19
96
  "class",
20
97
  "on",
@@ -29,15 +106,14 @@ function hasSlots(node) {
29
106
  function isChildrenProperty(node, key) {
30
107
  if (key === "children" && (node instanceof Element || node instanceof DocumentFragment)) return true;
31
108
  if (hasSlots(node)) {
32
- const slotName = key.replace(/^slot:/, "");
33
- if (Slots.has(node[SLOTS], slotName)) return true;
109
+ if (key.replace(/^slot:/, "") in node[SLOTS]) return true;
34
110
  }
35
111
  return key in node && node[key] instanceof Slot;
36
112
  }
37
113
  function applyChildren(node, key, value) {
38
114
  if (hasSlots(node)) {
39
115
  const slotName = key.replace(/^slot:/, "");
40
- if (Slots.has(node[SLOTS], slotName)) {
116
+ if (slotName in node[SLOTS]) {
41
117
  applySlot(node[SLOTS][slotName], value);
42
118
  return;
43
119
  }
@@ -67,8 +143,72 @@ function applySlot(slot, value) {
67
143
  });
68
144
  });
69
145
  }
146
+ const FRAGMENT_POOL_MAX = 4;
147
+ const fragmentPool = [];
148
+ function acquireFragment() {
149
+ return fragmentPool.pop() ?? document.createDocumentFragment();
150
+ }
151
+ function releaseFragment(frag) {
152
+ if (fragmentPool.length < FRAGMENT_POOL_MAX) fragmentPool.push(frag);
153
+ }
70
154
  function mountChildren(el, value) {
71
- for (const child of ensureFlatArray(value)) mountChild(el, child);
155
+ const list = ensureFlatArray(value);
156
+ if (list.length === 0) return;
157
+ if (list.length === 1) {
158
+ mountChild(el, list[0]);
159
+ return;
160
+ }
161
+ const kind = classifyStatic(list);
162
+ if (kind !== 0) {
163
+ mountStatic(el, list, kind);
164
+ return;
165
+ }
166
+ const buffer = acquireFragment();
167
+ for (const child of list) mountChild(buffer, child);
168
+ el.appendChild(buffer);
169
+ releaseFragment(buffer);
170
+ }
171
+ function classifyStatic(list) {
172
+ let kind = 3;
173
+ for (const c of list) {
174
+ if (c == null || c === false || c === true) continue;
175
+ if (typeof c === "function") return 0;
176
+ if (c instanceof Node) kind &= 1;
177
+ else if (typeof c === "string" || typeof c === "number") kind &= 2;
178
+ else return 0;
179
+ if (kind === 0) return 3;
180
+ }
181
+ return kind === 3 ? 2 : kind;
182
+ }
183
+ function mountStatic(el, list, kind) {
184
+ const buffer = acquireFragment();
185
+ let disposers = null;
186
+ if (kind === 1) for (const c of list) {
187
+ const node = c;
188
+ const dispose = node[Symbol.dispose];
189
+ if (dispose) (disposers ??= []).push(dispose);
190
+ buffer.appendChild(node);
191
+ }
192
+ else if (kind === 2) for (const c of list) {
193
+ if (c == null || c === false || c === true) continue;
194
+ buffer.appendChild(document.createTextNode(String(c)));
195
+ }
196
+ else for (const c of list) {
197
+ if (c == null || c === false || c === true) continue;
198
+ if (c instanceof Node) {
199
+ const dispose = c[Symbol.dispose];
200
+ if (dispose) (disposers ??= []).push(dispose);
201
+ buffer.appendChild(c);
202
+ } else buffer.appendChild(document.createTextNode(String(c)));
203
+ }
204
+ el.appendChild(buffer);
205
+ releaseFragment(buffer);
206
+ if (disposers && disposers.length > 0) {
207
+ const ds = disposers;
208
+ effectScope(() => {
209
+ onCleanup(() => ds.forEach((d) => d()));
210
+ });
211
+ }
72
212
  }
73
213
  /**
74
214
  * Mounts a single child into `el`. Reactive functions become live slots; other
@@ -82,8 +222,8 @@ function mountChildren(el, value) {
82
222
  */
83
223
  function mountChild(el, child) {
84
224
  if (typeof child === "function") {
85
- const slot = Slot.new();
86
- el.appendChild(slot());
225
+ const slot = new Slot();
226
+ el.appendChild(slot.render());
87
227
  effectScope(() => {
88
228
  effect(() => slot.set(resolveChild(child())));
89
229
  onCleanup(() => slot.clear());
@@ -113,23 +253,24 @@ function ensureFlatArray(raw) {
113
253
  //#endregion
114
254
  //#region src/jsx-runtime/properties.ts
115
255
  function applyProps(node, props) {
116
- for (const [key, value] of Object.entries(props)) {
256
+ const entries = Object.entries(props);
257
+ if (entries.length === 0) return;
258
+ for (const [key, value] of entries) {
117
259
  if (isChildrenProperty(node, key)) {
118
260
  applyChildren(node, key, value);
119
261
  continue;
120
262
  }
121
- if (isReactive(value)) {
122
- if (isEventKey(key)) {
123
- effect(() => {
124
- on(node, eventName(key), value());
125
- });
126
- continue;
127
- }
128
- effect(() => setProp(node, key, value()));
263
+ const colonIdx = key.indexOf(":");
264
+ if ((colonIdx > 0 ? key.slice(0, colonIdx) : "") === "on") {
265
+ const evName = key.slice(colonIdx + 1);
266
+ if (isReactive(value)) effect(() => {
267
+ on(node, evName, value());
268
+ });
269
+ else on(node, evName, value);
129
270
  continue;
130
271
  }
131
- if (isEventKey(key)) {
132
- on(node, eventName(key), value);
272
+ if (isReactive(value)) {
273
+ effect(() => setProp(node, key, value()));
133
274
  continue;
134
275
  }
135
276
  setProp(node, key, value);
@@ -174,7 +315,7 @@ function setProp(node, key, value) {
174
315
  node[key] = value ?? "";
175
316
  return;
176
317
  }
177
- if (!(node instanceof SVGElement) && Properties$1.has(key)) {
318
+ if (!(node instanceof SVGElement) && Properties.has(key)) {
178
319
  node[key] = value;
179
320
  return;
180
321
  }
@@ -199,14 +340,35 @@ function applyStyle(el, value) {
199
340
  else if (value && typeof value === "object") Object.assign(s, value);
200
341
  }
201
342
  function setAttribute(el, key, value) {
202
- if (value == null || value === false) el.removeAttribute(key);
203
- else el.setAttribute(key, value === true ? "" : String(value));
204
- }
205
- function isEventKey(key) {
206
- return key.startsWith("on:");
343
+ if (value == null || value === false) {
344
+ if (el.hasAttribute(key)) el.removeAttribute(key);
345
+ return;
346
+ }
347
+ const next = value === true ? "" : String(value);
348
+ if (el.getAttribute(key) === next) return;
349
+ el.setAttribute(key, next);
207
350
  }
208
- function eventName(key) {
209
- return key.slice(3);
351
+ //#endregion
352
+ //#region src/jsx-runtime/dispose.ts
353
+ const DISPOSABLES = /* @__PURE__ */ new WeakMap();
354
+ const sharedDispose = function() {
355
+ const set = DISPOSABLES.get(this);
356
+ if (!set) return;
357
+ DISPOSABLES.delete(this);
358
+ set.forEach((fn) => fn());
359
+ set.clear();
360
+ };
361
+ function attachDisposables(target, disposers) {
362
+ const existing = DISPOSABLES.get(target);
363
+ if (existing) {
364
+ disposers.forEach((d) => existing.add(d));
365
+ return;
366
+ }
367
+ DISPOSABLES.set(target, disposers);
368
+ Object.defineProperty(target, Symbol.dispose, {
369
+ value: sharedDispose.bind(target),
370
+ configurable: true
371
+ });
210
372
  }
211
373
  //#endregion
212
374
  //#region src/jsx-runtime/element.ts
@@ -259,19 +421,5 @@ function renderNode(node) {
259
421
  if (!node || typeof node.render !== "function") return null;
260
422
  return renderNode(node.render());
261
423
  }
262
- function hasOwnDisposable(el) {
263
- return Object.hasOwn(el, Symbol.dispose);
264
- }
265
- function attachDisposables(el, disposables) {
266
- const existingDispose = hasOwnDisposable(el) ? el[Symbol.dispose].bind(el) : null;
267
- Object.defineProperty(el, Symbol.dispose, {
268
- value() {
269
- existingDispose?.();
270
- disposables.forEach((fn) => fn());
271
- disposables.clear();
272
- },
273
- configurable: true
274
- });
275
- }
276
424
  //#endregion
277
425
  export { disposeElement as n, mountChild as r, createElement as t };
package/dist/for.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as Props, s as Require } from "./infer-BUUWMoG9.mjs";
1
+ import { i as Props, s as Require } from "./infer-K2Te9gn1.mjs";
2
2
 
3
3
  //#region src/for.d.ts
4
4
  type KeyFn<T> = (item: T, index: number) => string | number;
package/dist/for.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { c as effectScope, g as untracked, h as trigger, m as signal, p as onCleanup, s as effect } from "./lib-CVfOddra.mjs";
2
2
  import "./signals/index.mjs";
3
- import { n as disposeElement } from "./element-BjpyY6qv.mjs";
3
+ import { n as disposeElement } from "./element-DvqBlRly.mjs";
4
4
  //#region src/for.ts
5
5
  /**
6
6
  * Keyed list renderer. See {@link ForProps} for prop details.
@@ -1,6 +1,6 @@
1
1
  import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-3r7Diua4.mjs";
2
- import { t as CustomElementRegistry } from "./custom-elements-CBuenqVD.mjs";
3
- import { a as PrimitiveNodeType, i as Slots, n as Slot, t as SLOTS } from "./slot-CfafCBOW.mjs";
2
+ import { t as CustomElementRegistry } from "./custom-elements-D5CgfNKc.mjs";
3
+ import { n as Slot, r as PrimitiveNodeType, t as SLOTS } from "./slot-B8y0aEoz.mjs";
4
4
  import { JSX } from "dom-expressions/src/jsx-h";
5
5
 
6
6
  //#region src/jsx-runtime/element.d.ts
@@ -395,24 +395,34 @@ type SlotProps<K extends string> = { [P in K as `slot:${P}`]?: Child };
395
395
  type Attrs<K extends keyof JSX$1.IntrinsicElements> = JSX$1.IntrinsicElements[K];
396
396
  /**
397
397
  * Namespaced JSX props added by elements-kit on top of dom-expressions.
398
- *
399
- * - `ref` — callback invoked with the mounted element.
400
- * - `slot:foo` — accepts any `Child`. Reactive children come for free because
401
- * `Child` already includes `AnyFn` (so `() => content()` and `signal` both
402
- * typecheck and are wired as reactive slots by `mountChild`).
403
- * - `class:foo` / `style:foo` `MaybeReactive<T>` (value or zero-arg getter),
404
- * because their value types (`boolean` / `string | null`) are primitives
405
- * that don't otherwise allow function form.
406
- * - `prop:foo` — any value, direct property assignment, no reactive coupling.
398
+ * All four are tag-aware via the element type `E`.
399
+ *
400
+ * - `ref` — callback invoked with the mounted element, typed as the concrete
401
+ * element class for intrinsics and registered custom elements.
402
+ * - `class:foo` open string + `MaybeReactive<boolean>`. Class names are
403
+ * user-defined CSS so the key stays open (no autocomplete possible).
404
+ * - `style:cssProp` keys mapped from `DomJSX.CSSProperties` (csstype's
405
+ * hyphenated property names) for autocomplete; value typed per-property.
406
+ * - `prop:K` — inferred from `keyof E`. On `<div>` exposes
407
+ * `prop:className`, `prop:id`, etc. (from `HTMLDivElement`); on a
408
+ * registered custom element exposes its public fields too.
409
+ *
410
+ * `slot:foo` is NOT here — it's emitted per-element via `SlotsOf<C>` only
411
+ * for elements that declare `[SLOTS]`. Plain HTML intrinsics don't accept
412
+ * slot props (the runtime ignores them).
407
413
  */
408
- type JsxNamespaces = {
409
- ref?: (el: Element) => void;
410
- [slot: `slot:${string}`]: Child;
414
+ type CssStyleKey = Extract<keyof JSX.CSSProperties, string> extends infer K ? K extends `-${string}` ? never : K : never;
415
+ type StyleNamespace = { [K in CssStyleKey as `style:${K}`]?: MaybeReactive<JSX.CSSProperties[K] | null> };
416
+ type PropNamespace<E> = { [K in keyof E as K extends string ? `prop:${K}` : never]?: MaybeReactive<E[K]> };
417
+ type JsxNamespaces<E extends Element = Element> = {
418
+ ref?: (el: E) => void;
411
419
  [cls: `class:${string}`]: MaybeReactive<boolean>;
412
- [sty: `style:${string}`]: MaybeReactive<string | null>;
413
- [prop: `prop:${string}`]: unknown;
414
- };
415
- type WithJsxNamespaces<T> = T & JsxNamespaces;
420
+ } & StyleNamespace & PropNamespace<E>;
421
+ type JsxNamespaceKeys = "ref" | `class:${string}` | `style:${string}` | `prop:${string}`;
422
+ type WithJsxNamespaces<T, E extends Element = Element> = Omit<T, JsxNamespaceKeys> & JsxNamespaces<E>;
423
+ type IntrinsicElementOf<T> = T extends {
424
+ ref?: infer R | undefined;
425
+ } ? Extract<R, (el: any) => any> extends ((el: infer E) => any) ? E : Element : Element;
416
426
  declare namespace JSX$1 {
417
427
  export type Element = globalThis.Element | globalThis.DocumentFragment | null;
418
428
  export type ElementType = Child | Component;
@@ -423,10 +433,8 @@ declare namespace JSX$1 {
423
433
  ref?: (el: Element) => void;
424
434
  }
425
435
  export type LibraryManagedAttributes<C, P> = ResolveProps<C, P>;
426
- type RegisteredElements = { [K in keyof CustomElementRegistry]: CustomElementRegistry[K] extends AnyElementCtor ? MaybeReactiveProps<ElementProps<CustomElementRegistry[K]>> : never };
427
- export type IntrinsicElements = { [K in keyof JSX.IntrinsicElements]: WithJsxNamespaces<JSX.IntrinsicElements[K]> } & RegisteredElements & {
428
- /** Unregistered custom elements (`x-foo`, `my-component`, …) — loose fallback. */[customElement: `${string}-${string}`]: WithJsxNamespaces<JSX.DOMAttributes<HTMLElement>> & Record<string, unknown>;
429
- };
436
+ type RegisteredElements = { [K in keyof CustomElementRegistry]: CustomElementRegistry[K] extends AnyElementCtor ? WithJsxNamespaces<MaybeReactiveProps<ElementProps<CustomElementRegistry[K]>>, InstanceType<CustomElementRegistry[K]>> : never };
437
+ export type IntrinsicElements = { [K in keyof JSX.IntrinsicElements]: WithJsxNamespaces<JSX.IntrinsicElements[K], IntrinsicElementOf<JSX.IntrinsicElements[K]>> } & RegisteredElements;
430
438
  export {};
431
439
  }
432
440
  //#endregion
@@ -466,7 +474,7 @@ type PropValueFor<V> = V extends Slot ? Child : V;
466
474
  * the DOM surface is excluded; for plain classes, all own keys are kept.
467
475
  * `Slot`-typed fields are mapped to `Child` (see {@link PropValueFor}).
468
476
  */
469
- type PropsOfInstance<I> = { [K in PublicPropKeys<I> & string]?: PropValueFor<I[K]> };
477
+ type InstanceProps<I> = { [K in PublicPropKeys<I> & string]?: PropValueFor<I[K]> };
470
478
  /**
471
479
  * Promote keys `K` of `P` to required; leave the rest unchanged.
472
480
  *
@@ -482,11 +490,14 @@ type PropsOfInstance<I> = { [K in PublicPropKeys<I> & string]?: PropValueFor<I[K
482
490
  */
483
491
  type Require<P, K extends keyof P> = { [X in K]-?: P[X] } & Omit<P, K>;
484
492
  /**
485
- * Wrap every prop in {@link MaybeReactive} so callers may pass either a
486
- * plain value or a reactive getter. Function-typed props (event handlers,
487
- * render callbacks) are wrapped too the JSX runtime detects branded
488
- * signals/computed and re-binds on change. Optionality is preserved at the
489
- * key level the `| undefined` stays at the prop, not inside the reactive.
493
+ * Wrap every non-function prop in {@link MaybeReactive} so callers may pass
494
+ * either a plain value or a reactive getter. Function-typed props (event
495
+ * handlers, render callbacks) are left as-is so inline arrow callbacks get
496
+ * proper contextual typing for their parameters wrapping them in
497
+ * `MaybeReactive<F> = F | (() => F)` produces two callable alternatives and
498
+ * TS falls back to implicit-any on the callback's params. Optionality is
499
+ * preserved at the key level — the `| undefined` stays at the prop, not
500
+ * inside the reactive.
490
501
  *
491
502
  * @template P — source prop object type.
492
503
  *
@@ -497,14 +508,15 @@ type Require<P, K extends keyof P> = { [X in K]-?: P[X] } & Omit<P, K>;
497
508
  * // {
498
509
  * // count: MaybeReactive<number>;
499
510
  * // label?: MaybeReactive<string>;
500
- * // onClick: MaybeReactive<(e: Event) => void>; // computed handlers OK
511
+ * // onClick: (e: Event) => void;
501
512
  * // }
502
513
  * ```
503
514
  *
504
515
  * @see {@link MaybeReactive}
505
516
  * @see {@link Props}
506
517
  */
507
- type MaybeReactiveProps<P> = { [K in keyof P]: undefined extends P[K] ? MaybeReactive<Exclude<P[K], undefined>> | undefined : MaybeReactive<P[K]> };
518
+ type MaybeReactiveProps<P> = { [K in keyof P]: undefined extends P[K] ? MaybeReactiveOrFn<Exclude<P[K], undefined>> | undefined : MaybeReactiveOrFn<P[K]> };
519
+ type MaybeReactiveOrFn<T> = Extract<T, (...args: any[]) => any> extends never ? MaybeReactive<T> : T;
508
520
  declare const RAW_PROPS: unique symbol;
509
521
  type ReactiveProps<P> = { readonly [K in keyof P]: Computed<P[K]> } & {
510
522
  readonly [RAW_PROPS]?: P;
@@ -526,7 +538,7 @@ type RawProps<R> = R extends {
526
538
  type ResolveProps<C, P, NN = NonNullable<P>> = NN extends {
527
539
  readonly [RAW_PROPS]?: infer Raw;
528
540
  } ? MaybeReactiveProps<Raw> : [keyof NN] extends [never] ? Props<C> : NN;
529
- type InstancePropsOf<C> = Inst<C> extends infer I ? PropsOfInstance<I> : {};
541
+ type InstancePropsOf<C> = Inst<C> extends infer I ? InstanceProps<I> : {};
530
542
  type PropKeysOf<C> = keyof InstancePropsOf<C> & string;
531
543
  type AttrMap<C> = C extends {
532
544
  [ATTRIBUTES]: infer M;
@@ -541,8 +553,8 @@ type EventMapOf<C> = C extends {
541
553
  type Capitalize1<S extends string> = S extends `${infer H}${infer R}` ? `${Uppercase<H>}${R}` : S;
542
554
  type EventsOf<C> = EventMapOf<C> extends infer E ? E extends Record<string, Event> ? { [K in keyof E & string as `on:${K}`]?: (ev: E[K]) => void } & { [K in keyof E & string as `on${Capitalize1<K>}`]?: (ev: E[K]) => void } : {} : {};
543
555
  type SlotKeys<I> = I extends {
544
- [SLOTS]: Slots<infer K>;
545
- } ? K : never;
556
+ [SLOTS]: infer S;
557
+ } ? Extract<keyof S, string> : never;
546
558
  type InstanceOf<C> = C extends (abstract new (...args: any[]) => infer I) ? I : C;
547
559
  type SlotsOf<C> = SlotKeys<InstanceOf<C>> extends infer K ? [K] extends [string] ? { [P in K as `slot:${P}`]?: Child } : {} : {};
548
560
  type ChildrenOf<C> = C extends {
@@ -561,7 +573,7 @@ type BaseDOMAttrs = JSX.DOMAttributes<HTMLElement>;
561
573
  * - **`prop:*`** — explicit property assignment for every field.
562
574
  * - **Events** — keys from `declare static events: { ... }` produce both
563
575
  * `on:${K}` and `on${Capitalize<K>}` typed handlers.
564
- * - **Slots** — keys from `[SLOTS] = Slots.new([...] as const)` produce `slot:${K}`.
576
+ * - **Slots** — keys from `[SLOTS] = { ... } as const` produce `slot:${K}`.
565
577
  * - **Children** — `children?: Child` unless `static children: never`.
566
578
  * - **DOM attrs** — the standard dom-expressions surface (`class`, `style`, `ref`, …).
567
579
  *
@@ -573,7 +585,7 @@ type BaseDOMAttrs = JSX.DOMAttributes<HTMLElement>;
573
585
  * class XRange extends HTMLElement {
574
586
  * static [ATTRIBUTES]: Attributes<XRange> = { min(v) { this.min = +v! } };
575
587
  * declare static events: { commit: CustomEvent<number> };
576
- * [SLOTS] = Slots.new(["label"] as const);
588
+ * [SLOTS] = { label: new Slot() } as const;
577
589
  * \@reactive() min = 0;
578
590
  * }
579
591
  *
@@ -620,9 +632,9 @@ type ComponentProps<C extends ComponentClass<any>> = C extends ComponentClass<in
620
632
  * prop in {@link MaybeReactive} so callers may pass values or reactive getters.
621
633
  *
622
634
  * Branches by input shape:
623
- * - **Class constructor** (`typeof Cls`) → uses `PropsOfInstance<InstanceType<Cls>>`.
635
+ * - **Class constructor** (`typeof Cls`) → uses `InstanceProps<InstanceType<Cls>>`.
624
636
  * - **Function component** (`(props: P) => ...`) → uses the first parameter.
625
- * - **Class instance** (`Cls<T>`) → uses `PropsOfInstance<Cls<T>>` (useful when
637
+ * - **Class instance** (`Cls<T>`) → uses `InstanceProps<Cls<T>>` (useful when
626
638
  * generics need to flow through — see the `For` example below).
627
639
  *
628
640
  * Does **not** synthesize `on:*`, `slot:*`, or attribute surface. For custom
@@ -652,6 +664,6 @@ type ComponentProps<C extends ComponentClass<any>> = C extends ComponentClass<in
652
664
  * @see {@link ComponentProps} — constructor-param-based class components.
653
665
  * @see {@link MaybeReactiveProps}
654
666
  */
655
- type Props<C> = (C extends (abstract new (...args: any[]) => infer I) ? MaybeReactiveProps<PropsOfInstance<I>> : C extends ((props: infer P, ...rest: any[]) => any) ? P extends object ? MaybeReactiveProps<RawProps<P>> : {} : MaybeReactiveProps<PropsOfInstance<C>>) & SlotsOf<C>;
667
+ type Props<C> = (C extends (abstract new (...args: any[]) => infer I) ? MaybeReactiveProps<InstanceProps<I>> : C extends ((props: infer P, ...rest: any[]) => any) ? P extends object ? MaybeReactiveProps<RawProps<P>> : {} : MaybeReactiveProps<InstanceProps<C>>) & SlotsOf<C>;
656
668
  //#endregion
657
669
  export { SIGNAL as A, signal as B, isReactive as C, COMPUTED as D, resolveProps as E, isComputed as F, untracked as H, isEffect as I, isEffectScope as L, computed as M, effect as N, EFFECT as O, effectScope as P, isSignal as R, Updater as S, resolve as T, createElement as U, trigger as V, SlotProps as _, RawProps as a, MaybeReactive as b, ResolveProps as c, ComponentClass as d, ComponentFn as f, JSX$1 as g, Attrs as h, Props as i, batch as j, EFFECT_SCOPE as k, Child as l, PropsTarget as m, ElementProps as n, ReactiveProps as o, ComponentInstance as p, MaybeReactiveProps as r, Require as s, ComponentProps as t, Component as u, Fragment as v, reactive as w, Signal as x, Computed as y, onCleanup as z };
@@ -1,4 +1,4 @@
1
- import { y as Computed } from "../infer-BUUWMoG9.mjs";
1
+ import { y as Computed } from "../infer-K2Te9gn1.mjs";
2
2
 
3
3
  //#region src/integrations/react.d.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { U as createElement, _ as SlotProps, a as RawProps, b as MaybeReactive, c as ResolveProps, d as ComponentClass, f as ComponentFn, g as JSX, h as Attrs, i as Props, l as Child, m as PropsTarget, n as ElementProps, o as ReactiveProps, p as ComponentInstance, r as MaybeReactiveProps, s as Require, t as ComponentProps, u as Component, v as Fragment } from "../infer-BUUWMoG9.mjs";
1
+ import { U as createElement, _ as SlotProps, a as RawProps, b as MaybeReactive, c as ResolveProps, d as ComponentClass, f as ComponentFn, g as JSX, h as Attrs, i as Props, l as Child, m as PropsTarget, n as ElementProps, o as ReactiveProps, p as ComponentInstance, r as MaybeReactiveProps, s as Require, t as ComponentProps, u as Component, v as Fragment } from "../infer-K2Te9gn1.mjs";
2
2
  export { Attrs, Child, Component, ComponentClass, ComponentFn, ComponentInstance, ComponentProps, ElementProps, Fragment, JSX, MaybeReactive, MaybeReactiveProps, Props, PropsTarget, RawProps, ReactiveProps, Require, ResolveProps, SlotProps, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
@@ -1,4 +1,4 @@
1
- import { r as mountChild, t as createElement } from "../element-BjpyY6qv.mjs";
1
+ import { r as mountChild, t as createElement } from "../element-DvqBlRly.mjs";
2
2
  //#region src/jsx-runtime/fragment.ts
3
3
  /**
4
4
  * Used by the JSX transform for `<>...</>` fragments.
@@ -1,2 +1,2 @@
1
- import { A as SIGNAL, B as signal, C as isReactive, D as COMPUTED, E as resolveProps, F as isComputed, H as untracked, I as isEffect, L as isEffectScope, M as computed, N as effect, O as EFFECT, P as effectScope, R as isSignal, S as Updater, T as resolve, V as trigger, b as MaybeReactive, j as batch, k as EFFECT_SCOPE, w as reactive, x as Signal, y as Computed, z as onCleanup } from "../infer-BUUWMoG9.mjs";
1
+ import { A as SIGNAL, B as signal, C as isReactive, D as COMPUTED, E as resolveProps, F as isComputed, H as untracked, I as isEffect, L as isEffectScope, M as computed, N as effect, O as EFFECT, P as effectScope, R as isSignal, S as Updater, T as resolve, V as trigger, b as MaybeReactive, j as batch, k as EFFECT_SCOPE, w as reactive, x as Signal, y as Computed, z as onCleanup } from "../infer-K2Te9gn1.mjs";
2
2
  export { COMPUTED, Computed, EFFECT, EFFECT_SCOPE, MaybeReactive, SIGNAL, Signal, Updater, batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, resolveProps, signal, trigger, untracked };