elements-kit 0.20.0 → 0.22.0

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/README.md +20 -19
  2. package/dist/attributes.d.mts +1 -1
  3. package/dist/await.d.mts +6 -5
  4. package/dist/await.mjs +0 -36
  5. package/dist/{types-ncUK9rki.d.mts → children-s3nFjpLA.d.mts} +125 -227
  6. package/dist/custom-elements-CdpilMDu.d.mts +87 -0
  7. package/dist/custom-elements.d.mts +2 -2
  8. package/dist/{element-D3om9yA6.mjs → element-Di0PYFX1.mjs} +15 -38
  9. package/dist/for.d.mts +9 -4
  10. package/dist/for.mjs +1 -1
  11. package/dist/{fragment-ROPRBJQd.mjs → fragment-Bvs1sGu1.mjs} +3 -3
  12. package/dist/hydrate/index.mjs +1 -1
  13. package/dist/{hydrate-6Qx4n4Su.mjs → hydrate-CHomBRY9.mjs} +4 -4
  14. package/dist/integrations/astro-client.mjs +2 -2
  15. package/dist/integrations/astro-server.mjs +2 -2
  16. package/dist/integrations/astro-slots.d.mts +6 -5
  17. package/dist/integrations/astro-slots.mjs +9 -8
  18. package/dist/integrations/react.d.mts +1 -1
  19. package/dist/integrations/react.mjs +1 -1
  20. package/dist/jsx-runtime/index.d.mts +2 -2
  21. package/dist/jsx-runtime/index.mjs +2 -2
  22. package/dist/polyfill-BVNd6ogU.d.mts +9 -0
  23. package/dist/render.mjs +1 -1
  24. package/dist/server/index.mjs +1 -1
  25. package/dist/{server-iFSng50i.mjs → server-CTkyXTV6.mjs} +2 -2
  26. package/dist/signals/index.d.mts +1 -1
  27. package/dist/slot.d.mts +83 -2
  28. package/dist/slot.mjs +179 -2
  29. package/dist/ui/badge/badge.css +5 -5
  30. package/dist/ui/button/button.css +15 -15
  31. package/dist/ui/card/card.css +2 -2
  32. package/dist/ui/group/group.css +61 -0
  33. package/dist/ui/marketing/marketing.css +5 -3
  34. package/dist/ui/otp-input/index.d.mts +132 -0
  35. package/dist/ui/otp-input/index.mjs +328 -0
  36. package/dist/ui/otp-input/otp-input.css +157 -0
  37. package/dist/ui/overlay/index.css +52 -4
  38. package/dist/ui/overlay/index.d.mts +237 -63
  39. package/dist/ui/overlay/index.mjs +658 -66
  40. package/dist/ui/overlay/overlay.css +58 -2
  41. package/dist/ui/styles/index.css +664 -0
  42. package/dist/ui/styles/radius.css +7 -7
  43. package/dist/ui/styles/unset.css +212 -210
  44. package/dist/utilities/active-element.d.mts +1 -1
  45. package/dist/utilities/async.d.mts +1 -1
  46. package/dist/utilities/debounced.d.mts +1 -1
  47. package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
  48. package/dist/utilities/element-rect.d.mts +1 -1
  49. package/dist/utilities/element-scroll.d.mts +1 -1
  50. package/dist/utilities/event-driven.d.mts +1 -1
  51. package/dist/utilities/event-listener.d.mts +1 -1
  52. package/dist/utilities/focus-within.d.mts +1 -1
  53. package/dist/utilities/hover.d.mts +1 -1
  54. package/dist/utilities/interval.d.mts +1 -1
  55. package/dist/utilities/location.d.mts +1 -1
  56. package/dist/utilities/media-devices.d.mts +1 -1
  57. package/dist/utilities/media-player.d.mts +1 -1
  58. package/dist/utilities/media-query.d.mts +1 -1
  59. package/dist/utilities/network.d.mts +1 -1
  60. package/dist/utilities/orientation.d.mts +1 -1
  61. package/dist/utilities/previous.d.mts +1 -1
  62. package/dist/utilities/promise.d.mts +1 -1
  63. package/dist/utilities/routing.d.mts +1 -1
  64. package/dist/utilities/search-params.d.mts +1 -1
  65. package/dist/utilities/storage.d.mts +1 -1
  66. package/dist/utilities/throttled.d.mts +1 -1
  67. package/dist/utilities/timeout.d.mts +1 -1
  68. package/dist/utilities/window-focus.d.mts +1 -1
  69. package/dist/utilities/window-size.d.mts +1 -1
  70. package/package.json +10 -1
  71. package/dist/custom-elements-DK5VUcWA.d.mts +0 -55
  72. package/dist/slot-BFWXeFRl.d.mts +0 -77
  73. package/dist/slot-Dvf30O0B.mjs +0 -138
  74. /package/dist/{attributes-3r7Diua4.d.mts → attributes-DILeh3-s.d.mts} +0 -0
  75. /package/dist/{scope-zbEG299F.mjs → scope-C1vELXqP.mjs} +0 -0
@@ -0,0 +1,87 @@
1
+ import { t as ATTRIBUTES } from "./attributes-DILeh3-s.mjs";
2
+
3
+ //#region src/custom-elements.d.ts
4
+ type RegisteredElementInstances = { [K in keyof ElementsKit.CustomElementRegistry]: ElementsKit.CustomElementRegistry[K] extends (abstract new (...args: any[]) => infer I) ? I : never };
5
+ declare global {
6
+ namespace ElementsKit {
7
+ interface CustomElementRegistry {}
8
+ }
9
+ interface HTMLElementTagNameMap extends RegisteredElementInstances {}
10
+ }
11
+ type CustomElementRegistry = ElementsKit.CustomElementRegistry;
12
+ type AnyCtor = CustomElementConstructor;
13
+ /**
14
+ * @internal Public instance keys of `I`: for `HTMLElement` subclasses the
15
+ * inherited DOM surface is dropped; for plain classes `render` is dropped.
16
+ * Shared by the raw extractors here and the JSX helpers in jsx-runtime.
17
+ */
18
+ type PublicPropKeys<I> = I extends HTMLElement ? Exclude<keyof I, keyof HTMLElement | symbol> : Exclude<keyof I, symbol | "render">;
19
+ type InstanceOfCtor<C> = C extends (abstract new (...args: any[]) => infer I) ? I : C;
20
+ /**
21
+ * Settable property surface of a custom-element class (or instance) — the
22
+ * user's public fields, all optional, without the inherited `HTMLElement`
23
+ * surface. Slot-backed props (`@slot()` accessors) appear here as their
24
+ * `Node | null` read type — assignment fills the slot.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * class XCounter extends HTMLElement { count = 0; }
29
+ * type P = PropertiesOf<typeof XCounter>; // { count?: number }
30
+ * ```
31
+ */
32
+ type PropertiesOf<C> = InstanceOfCtor<C> extends infer I ? { [K in PublicPropKeys<I> & string]?: I[K] } : never;
33
+ /**
34
+ * Observed attributes of a custom-element class — every key of
35
+ * `static [ATTRIBUTES]`, valued `string | null` (the raw HTML surface).
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * type A = AttributesOf<typeof XRange>; // { min?: string | null; ... }
40
+ * ```
41
+ */
42
+ type AttributesOf<C> = C extends {
43
+ [ATTRIBUTES]: infer M;
44
+ } ? M extends Record<string, unknown> ? string extends keyof M ? {} : { [K in keyof M & string]?: string | null } : {} : {};
45
+ /**
46
+ * Raw event map of a custom-element class — `static events` verbatim.
47
+ * Shape it however your host needs: `addEventListener` typing, framework
48
+ * event bindings, or an `HTMLElementEventMap` augmentation.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * type E = EventsOf<typeof XRange>; // { commit: CustomEvent<number> }
53
+ * declare global {
54
+ * interface HTMLElementEventMap extends EventsOf<typeof XRange> {}
55
+ * }
56
+ * ```
57
+ */
58
+ type EventsOf<C> = C extends {
59
+ events: infer E;
60
+ } ? E extends Record<string, Event> ? E : {} : {};
61
+ /**
62
+ * Register a custom element with the browser and return its class.
63
+ * Pair with an augmentation of `ElementsKit.CustomElementRegistry` to get typed JSX.
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * import { defineElement } from "elements-kit/custom-elements";
68
+ *
69
+ * class XCounter extends HTMLElement {}
70
+ *
71
+ * defineElement("x-counter", XCounter);
72
+ *
73
+ * declare global {
74
+ * namespace ElementsKit {
75
+ * interface CustomElementRegistry {
76
+ * "x-counter": typeof XCounter;
77
+ * }
78
+ * }
79
+ * }
80
+ *
81
+ * // JSX now gets typed props + typed ref
82
+ * // <x-counter />
83
+ * ```
84
+ */
85
+ declare function defineElement<Tag extends `${string}-${string}`, C extends AnyCtor>(tag: Tag, cls: C, options?: ElementDefinitionOptions): C;
86
+ //#endregion
87
+ export { PublicPropKeys as a, PropertiesOf as i, CustomElementRegistry as n, defineElement as o, EventsOf as r, AttributesOf as t };
@@ -1,2 +1,2 @@
1
- import { n as defineElement, t as CustomElementRegistry } from "./custom-elements-DK5VUcWA.mjs";
2
- export { CustomElementRegistry, defineElement };
1
+ import { a as PublicPropKeys, i as PropertiesOf, n as CustomElementRegistry, o as defineElement, r as EventsOf, t as AttributesOf } from "./custom-elements-CdpilMDu.mjs";
2
+ export { AttributesOf, CustomElementRegistry, EventsOf, PropertiesOf, PublicPropKeys, defineElement };
@@ -2,7 +2,7 @@ import { C as untracked, _ as onCleanup, d as effectScope, u 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 { n as Slot, r as resolveNode$1, t as SLOTS } from "./slot-Dvf30O0B.mjs";
5
+ import { Slot } from "./slot.mjs";
6
6
  //#region src/jsx-runtime/constants.ts
7
7
  /**
8
8
  * IDL properties that take precedence over the default `setAttribute` path.
@@ -267,46 +267,23 @@ const ReservedNameSpaces = new Set([
267
267
  ]);
268
268
  //#endregion
269
269
  //#region src/jsx-runtime/children.ts
270
- function hasSlots(node) {
271
- return SLOTS in node;
270
+ var UnsupportedChildError = class extends Error {
271
+ constructor(value) {
272
+ super(`Unsupported child type: ${typeof value}`);
273
+ this.name = "UnsupportedChildError";
274
+ }
275
+ };
276
+ function resolveNode$1(c) {
277
+ if (c instanceof Node) return c;
278
+ if (c === null || c === void 0 || typeof c === "boolean") return document.createComment("");
279
+ if (typeof c === "string" || typeof c === "number" || typeof c === "bigint" || typeof c === "symbol" || c instanceof Date || c instanceof RegExp) return document.createTextNode(String(c));
280
+ throw new UnsupportedChildError(c);
272
281
  }
273
282
  function isChildrenProperty(node, key) {
274
- if (key === "children" && (node instanceof Element || node instanceof DocumentFragment)) return true;
275
- if (hasSlots(node)) {
276
- if (key.replace(/^slot:/, "") in node[SLOTS]) return true;
277
- }
278
- return key in node && node[key] instanceof Slot;
283
+ return key === "children" && (node instanceof Element || node instanceof DocumentFragment);
279
284
  }
280
285
  function applyChildren(node, key, value) {
281
- if (hasSlots(node)) {
282
- const slotName = key.replace(/^slot:/, "");
283
- if (slotName in node[SLOTS]) {
284
- applySlot(node[SLOTS][slotName], value);
285
- return;
286
- }
287
- }
288
- if (key === "children" && (node instanceof Element || node instanceof DocumentFragment)) {
289
- mountChildren(node, value);
290
- return;
291
- }
292
- if (key in node) {
293
- const slot = node[key];
294
- if (!(slot instanceof Slot)) return;
295
- applySlot(slot, value);
296
- }
297
- }
298
- function applySlot(slot, value) {
299
- let dispose;
300
- if (typeof value === "function") effect(() => slot.set(resolveChild(value())));
301
- else {
302
- const node = resolveChild(value);
303
- dispose = node[Symbol.dispose];
304
- slot.set(node);
305
- }
306
- onCleanup(() => {
307
- dispose?.();
308
- slot.clear();
309
- });
286
+ if (key === "children" && (node instanceof Element || node instanceof DocumentFragment)) mountChildren(node, value);
310
287
  }
311
288
  const FRAGMENT_POOL_MAX = 4;
312
289
  const fragmentPool = [];
@@ -388,7 +365,7 @@ function mountStatic(el, list, kind) {
388
365
  function mountChild(el, child) {
389
366
  if (typeof child === "function") {
390
367
  const slot = new Slot();
391
- el.appendChild(slot.render());
368
+ el.appendChild(slot.get());
392
369
  effect(() => slot.set(resolveChild(child())));
393
370
  onCleanup(() => slot.clear());
394
371
  return;
package/dist/for.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as Require, m as Props } from "./types-ncUK9rki.mjs";
1
+ import { s as MaybeReactiveProps } from "./children-s3nFjpLA.mjs";
2
2
 
3
3
  //#region src/for.d.ts
4
4
  type KeyFn<T> = (item: T, index: number) => string | number;
@@ -13,8 +13,9 @@ interface Entry {
13
13
  }
14
14
  /**
15
15
  * Props for `<For>`, derived from its public instance fields.
16
- * All props are optional the class initializes sane defaults at runtime.
17
- * Non-function props also accept a reactive getter.
16
+ * `each` and `children` are required; `by` is optional (identity keying by
17
+ * default). Non-function props also accept a reactive getter — `each` takes a
18
+ * signal of arrays.
18
19
  *
19
20
  * @example
20
21
  * ```tsx
@@ -30,7 +31,11 @@ interface Entry {
30
31
  * };
31
32
  * ```
32
33
  */
33
- type ForProps<T> = Require<Props<For<T>>, "each" | "children">;
34
+ type ForProps<T> = MaybeReactiveProps<{
35
+ each: T[];
36
+ by?: KeyFn<T>;
37
+ children: RenderFn<T>;
38
+ }>;
34
39
  /**
35
40
  * Keyed list renderer. See {@link ForProps} for prop details.
36
41
  *
package/dist/for.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as untracked, S as trigger, _ as onCleanup, d as effectScope, u as effect, x as signal } from "./lib-DYypKhxk.mjs";
2
2
  import "./signals/index.mjs";
3
- import { n as disposeElement } from "./element-D3om9yA6.mjs";
3
+ import { n as disposeElement } from "./element-Di0PYFX1.mjs";
4
4
  //#region src/for.ts
5
5
  /**
6
6
  * Keyed list renderer. See {@link ForProps} for prop details.
@@ -1,7 +1,7 @@
1
1
  import { _ as onCleanup, u as effect } from "./lib-DYypKhxk.mjs";
2
2
  import "./signals/index.mjs";
3
- import { a as mountChild } from "./element-D3om9yA6.mjs";
4
- import { n as Slot } from "./slot-Dvf30O0B.mjs";
3
+ import { a as mountChild } from "./element-Di0PYFX1.mjs";
4
+ import { Slot } from "./slot.mjs";
5
5
  //#region src/jsx-runtime/fragment.ts
6
6
  /**
7
7
  * Parse an HTML string script-inertly: markup renders, `<script>` tags are
@@ -33,7 +33,7 @@ function Fragment(props) {
33
33
  const fragment = document.createDocumentFragment();
34
34
  if ("html" in props && props.html) {
35
35
  const slot = new Slot();
36
- fragment.appendChild(slot.render());
36
+ fragment.appendChild(slot.get());
37
37
  const source = props.children;
38
38
  if (typeof source === "function") {
39
39
  effect(() => {
@@ -1,2 +1,2 @@
1
- import { t as hydrate } from "../hydrate-6Qx4n4Su.mjs";
1
+ import { t as hydrate } from "../hydrate-CHomBRY9.mjs";
2
2
  export { hydrate };
@@ -2,10 +2,10 @@ import { C as untracked, _ as onCleanup, d as effectScope, n as CLAIM, t as ASYN
2
2
  import { isReactive, resolveProps } from "./signals/index.mjs";
3
3
  import { isReactivePromiseLike } from "./utilities/promise.mjs";
4
4
  import { flushDeferredAsyncRuns, isAsyncLike } from "./utilities/async.mjs";
5
- import { i as applyProps, o as resolveChild, r as setRenderer, t as createElement } from "./element-D3om9yA6.mjs";
6
- import { n as Slot } from "./slot-Dvf30O0B.mjs";
5
+ import { i as applyProps, o as resolveChild, r as setRenderer, t as createElement } from "./element-Di0PYFX1.mjs";
6
+ import { Slot } from "./slot.mjs";
7
7
  import { For, isForComponent } from "./for.mjs";
8
- import { n as isFragmentComponent, r as parseHtml, t as Fragment } from "./fragment-ROPRBJQd.mjs";
8
+ import { n as isFragmentComponent, r as parseHtml, t as Fragment } from "./fragment-Bvs1sGu1.mjs";
9
9
  //#region src/hydrate/claim.ts
10
10
  let hydrationContext = null;
11
11
  function setHydrationContext(ctx) {
@@ -171,7 +171,7 @@ function claimSlot(cur, om) {
171
171
  found: cur.node
172
172
  });
173
173
  const slot = new Slot();
174
- cur.parent.insertBefore(slot.render(), cur.node);
174
+ cur.parent.insertBefore(slot.get(), cur.node);
175
175
  return slot;
176
176
  }
177
177
  function claimMarkerRange(cur, open, close) {
@@ -1,6 +1,6 @@
1
- import { t as createElement } from "../element-D3om9yA6.mjs";
1
+ import { t as createElement } from "../element-Di0PYFX1.mjs";
2
2
  import { render } from "../render.mjs";
3
- import { t as hydrate } from "../hydrate-6Qx4n4Su.mjs";
3
+ import { t as hydrate } from "../hydrate-CHomBRY9.mjs";
4
4
  import { withSlotProps } from "./astro-slots.mjs";
5
5
  //#region src/integrations/astro-client.ts
6
6
  /**
@@ -1,8 +1,8 @@
1
1
  import { y as setInertEffects } from "../lib-DYypKhxk.mjs";
2
2
  import { resolveProps } from "../signals/index.mjs";
3
- import { r as setRenderer, t as createElement } from "../element-D3om9yA6.mjs";
3
+ import { r as setRenderer, t as createElement } from "../element-Di0PYFX1.mjs";
4
4
  import { withSlotProps } from "./astro-slots.mjs";
5
- import { i as serverJsx, n as renderToString, r as SNode } from "../server-iFSng50i.mjs";
5
+ import { i as serverJsx, n as renderToString, r as SNode } from "../server-CTkyXTV6.mjs";
6
6
  //#region src/integrations/astro-server.ts
7
7
  /**
8
8
  * Decide whether `Component` is an elements-kit component. Invoked by Astro
@@ -1,11 +1,12 @@
1
1
  //#region src/integrations/astro-slots.d.ts
2
2
  /**
3
3
  * @internal Map Astro's pre-rendered slot HTML (`Record<name, html>`) into
4
- * elements-kit props: the `default` slot becomes `children`, named slots
5
- * become `slot:<name>` props. Each value is a thunk building Astro's slot
6
- * wrapper element around a `<Fragment html>` region deferred so the jsx
7
- * dispatches to whichever renderer is active when the component reads the
8
- * prop (string emission on the server, DOM on the client).
4
+ * elements-kit props: the `default` slot becomes `children`, each named slot
5
+ * becomes a plain `<name>` prop (named slots are plain properties now the
6
+ * same shape `<Card header={…}>` passes). Each value is a thunk building
7
+ * Astro's slot wrapper element around a `<Fragment html>` region deferred so
8
+ * the jsx dispatches to whichever renderer is active when the component reads
9
+ * the prop (string emission on the server, DOM on the client).
9
10
  */
10
11
  declare function withSlotProps(props: Record<string, unknown> | null | undefined, slots: Record<string, string> | null | undefined, staticSlot?: boolean): Record<string, unknown>;
11
12
  //#endregion
@@ -1,13 +1,14 @@
1
- import { t as createElement } from "../element-D3om9yA6.mjs";
2
- import { t as Fragment } from "../fragment-ROPRBJQd.mjs";
1
+ import { t as createElement } from "../element-Di0PYFX1.mjs";
2
+ import { t as Fragment } from "../fragment-Bvs1sGu1.mjs";
3
3
  //#region src/integrations/astro-slots.ts
4
4
  /**
5
5
  * @internal Map Astro's pre-rendered slot HTML (`Record<name, html>`) into
6
- * elements-kit props: the `default` slot becomes `children`, named slots
7
- * become `slot:<name>` props. Each value is a thunk building Astro's slot
8
- * wrapper element around a `<Fragment html>` region deferred so the jsx
9
- * dispatches to whichever renderer is active when the component reads the
10
- * prop (string emission on the server, DOM on the client).
6
+ * elements-kit props: the `default` slot becomes `children`, each named slot
7
+ * becomes a plain `<name>` prop (named slots are plain properties now the
8
+ * same shape `<Card header={…}>` passes). Each value is a thunk building
9
+ * Astro's slot wrapper element around a `<Fragment html>` region deferred so
10
+ * the jsx dispatches to whichever renderer is active when the component reads
11
+ * the prop (string emission on the server, DOM on the client).
11
12
  */
12
13
  function withSlotProps(props, slots, staticSlot = false) {
13
14
  const base = { ...props ?? {} };
@@ -22,7 +23,7 @@ function withSlotProps(props, slots, staticSlot = false) {
22
23
  })
23
24
  });
24
25
  if (name === "default") base.children = slot;
25
- else base[`slot:${name}`] = slot;
26
+ else base[name] = slot;
26
27
  }
27
28
  return base;
28
29
  }
@@ -1,4 +1,4 @@
1
- import { y as Computed } from "../types-ncUK9rki.mjs";
1
+ import { f as Computed } from "../children-s3nFjpLA.mjs";
2
2
 
3
3
  //#region src/integrations/react.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { u as effect, x as signal } from "../lib-DYypKhxk.mjs";
2
2
  import "../signals/index.mjs";
3
- import { t as scope } from "../scope-zbEG299F.mjs";
3
+ import { t as scope } from "../scope-C1vELXqP.mjs";
4
4
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
5
5
  //#region src/integrations/react.ts
6
6
  /**
@@ -1,2 +1,2 @@
1
- import { G as createElement, _ as Require, a as ComponentInstance, b as MaybeReactive, c as JSX, d as ComponentProps, f as ElementProps, g as ReactiveProps, h as RawProps, i as ComponentFn, l as SlotProps, m as Props, n as Component, o as PropsTarget, p as MaybeReactiveProps, r as ComponentClass, s as Attrs, t as Child, u as Fragment, v as ResolveProps } from "../types-ncUK9rki.mjs";
2
- export { Attrs, type Child, type Component, type ComponentClass, type ComponentFn, type ComponentInstance, type ComponentProps, type ElementProps, Fragment, JSX, type MaybeReactive, type MaybeReactiveProps, type Props, type PropsTarget, type RawProps, type ReactiveProps, type Require, type ResolveProps, SlotProps, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
1
+ import { a as Fragment, c as Props, d as Require, i as JSX, l as PropsOf, n as ComponentClass, o as createElement, p as MaybeReactive, r as ComponentFn, s as MaybeReactiveProps, t as Children, u as RawProps } from "../children-s3nFjpLA.mjs";
2
+ export { type Children, ComponentClass, ComponentFn, Fragment, JSX, type MaybeReactive, type MaybeReactiveProps, type Props, type PropsOf, type RawProps, type Require, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
@@ -1,3 +1,3 @@
1
- import { t as createElement } from "../element-D3om9yA6.mjs";
2
- import { t as Fragment } from "../fragment-ROPRBJQd.mjs";
1
+ import { t as createElement } from "../element-Di0PYFX1.mjs";
2
+ import { t as Fragment } from "../fragment-Bvs1sGu1.mjs";
3
3
  export { Fragment, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
@@ -0,0 +1,9 @@
1
+ //#region src/polyfill.d.ts
2
+ declare global {
3
+ interface SymbolConstructor {
4
+ readonly dispose: symbol;
5
+ }
6
+ interface Disposable {
7
+ [Symbol.dispose](): void;
8
+ }
9
+ }
package/dist/render.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as scope } from "./scope-zbEG299F.mjs";
1
+ import { t as scope } from "./scope-C1vELXqP.mjs";
2
2
  //#region src/render.ts
3
3
  /**
4
4
  * Mount a node into `target` with a scoped lifetime.
@@ -1,2 +1,2 @@
1
- import { n as renderToString, t as renderToStream } from "../server-iFSng50i.mjs";
1
+ import { n as renderToString, t as renderToStream } from "../server-CTkyXTV6.mjs";
2
2
  export { renderToStream, renderToString };
@@ -2,9 +2,9 @@ import { C as untracked, y as setInertEffects } from "./lib-DYypKhxk.mjs";
2
2
  import { isReactive, resolveProps } from "./signals/index.mjs";
3
3
  import { isReactivePromiseLike } from "./utilities/promise.mjs";
4
4
  import { isAsyncLike } from "./utilities/async.mjs";
5
- import { c as BooleanAttributes, l as ChildProperties, r as setRenderer, s as AttrAliases, u as Properties } from "./element-D3om9yA6.mjs";
5
+ import { c as BooleanAttributes, l as ChildProperties, r as setRenderer, s as AttrAliases, u as Properties } from "./element-Di0PYFX1.mjs";
6
6
  import { isForComponent } from "./for.mjs";
7
- import { n as isFragmentComponent } from "./fragment-ROPRBJQd.mjs";
7
+ import { n as isFragmentComponent } from "./fragment-Bvs1sGu1.mjs";
8
8
  //#region src/server/escape.ts
9
9
  function escapeDelim(s, delim, escDelim) {
10
10
  let iDelim = s.indexOf(delim);
@@ -1,2 +1,2 @@
1
- import { A as EFFECT_SCOPE, B as isSignal, C as isReactive, D as CLAIM, E as resolveProps, F as effect, H as signal, I as effectScope, L as isComputed, M as SIGNAL, N as batch, O as COMPUTED, P as computed, R as isEffect, S as Updater, T as resolve, U as trigger, V as onCleanup, W as untracked, b as MaybeReactive, j as SEED, k as EFFECT, w as reactive, x as Signal, y as Computed, z as isEffectScope } from "../types-ncUK9rki.mjs";
1
+ import { A as isComputed, C as EFFECT_SCOPE, D as computed, E as batch, F as signal, I as trigger, L as untracked, M as isEffectScope, N as isSignal, O as effect, P as onCleanup, S as EFFECT, T as SIGNAL, _ as reactive, b as CLAIM, f as Computed, g as isReactive, h as Updater, j as isEffect, k as effectScope, m as Signal, p as MaybeReactive, v as resolve, w as SEED, x as COMPUTED, y as resolveProps } from "../children-s3nFjpLA.mjs";
2
2
  export { CLAIM, COMPUTED, Computed, EFFECT, EFFECT_SCOPE, MaybeReactive, SEED, SIGNAL, Signal, Updater, batch, computed, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, resolveProps, signal, trigger, untracked };
package/dist/slot.d.mts CHANGED
@@ -1,2 +1,83 @@
1
- import { n as Slot, t as SLOTS } from "./slot-BFWXeFRl.mjs";
2
- export { SLOTS, Slot };
1
+ //#region src/slot.d.ts
2
+ /**
3
+ * A lightweight slot that reserves a region in the DOM using comment markers.
4
+ * Content between the markers can be replaced dynamically without wrapper elements.
5
+ */
6
+ declare class Slot {
7
+ #private;
8
+ /**
9
+ * Bind a slot to an existing marker pair (server-rendered comments) instead
10
+ * of creating new ones. Used by the hydrate claim pass: content between the
11
+ * markers is adopted as the slot's current content.
12
+ */
13
+ static claim(start: Comment, end: Comment): Slot;
14
+ /**
15
+ * Render the slot as a DocumentFragment.
16
+ * If not yet mounted, inserts the comment markers and any default content
17
+ * (`Node`s or strings — native `append()` semantics; strings become text
18
+ * nodes). If already mounted, extracts and returns the current content
19
+ * WITHOUT disposing it — the caller takes ownership of the returned nodes
20
+ * and is responsible for their disposal.
21
+ */
22
+ get(...nodes: (string | Node)[]): DocumentFragment;
23
+ /** Dispose reactive children and remove all content between the markers. */
24
+ clear(): void;
25
+ /**
26
+ * Replace the slot's content with the given nodes/strings (native
27
+ * `append()` semantics; strings become text nodes). No args clears the
28
+ * slot. Buffers until mounted; no-op if the content is identical.
29
+ */
30
+ set(...nodes: (string | Node)[]): void;
31
+ /**
32
+ * Extract and return the current slot content as a DocumentFragment.
33
+ * Returns `null` if the slot is not mounted.
34
+ * Content is NOT disposed — the caller takes ownership and is responsible
35
+ * for disposal.
36
+ */
37
+ current(): DocumentFragment | null;
38
+ /** Returns the parent node if the slot is mounted, otherwise `null`. */
39
+ parent(): ParentNode | null;
40
+ /** Whether the slot's comment markers are attached to the DOM. */
41
+ isMounted(): boolean;
42
+ }
43
+ /**
44
+ * What a `@slot()` property assignment accepts — the same content the
45
+ * platform's `ParentNode.append()` takes (`Node` or string, strings become
46
+ * text nodes), plus arrays of it (JSX passes multiple children as an array).
47
+ */
48
+ type SlotContent = Node | string | readonly (Node | string)[];
49
+ /**
50
+ * Field decorator declaring a slot as a plain property backed by a
51
+ * {@link Slot}. Reading returns the slot's region (`slot.get()` — a fragment
52
+ * to append into any template, elements-kit JSX or not); assigning fills it
53
+ * (`null` clears). Values follow native `append()` semantics — a `Node`, a
54
+ * string, or an array of them. Assignment buffers before mount, so consumers
55
+ * can set content before the element renders.
56
+ *
57
+ * The getter is EFFECTFUL: it mounts the markers on first read and extracts
58
+ * current content on later reads (the re-render semantic of
59
+ * {@link Slot.get}). Read it to PLACE the region, not to inspect it.
60
+ *
61
+ * Declare the field as {@link SlotContent} to accept the full native
62
+ * `append()` surface (`Node` | string | array); narrow it to `Node` when the
63
+ * slot only ever holds an element.
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * class Card extends HTMLElement {
68
+ * \@slot() header!: SlotContent;
69
+ *
70
+ * render() {
71
+ * return <header>{this.header}</header>; // or root.append(card.header)
72
+ * }
73
+ * }
74
+ *
75
+ * // consumers — any framework, or none:
76
+ * card.header = document.createElement("h1"); // Node
77
+ * card.header = "plain text"; // native append() content
78
+ * card.header = null; // clear
79
+ * ```
80
+ */
81
+ declare function slot(): <This extends object, V extends SlotContent | null>(_target: unknown, context: ClassFieldDecoratorContext<This, V>) => (this: This, initialValue: V) => V;
82
+ //#endregion
83
+ export { Slot, SlotContent, slot };