elements-kit 0.21.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +23 -21
  2. package/dist/attributes.d.mts +1 -1
  3. package/dist/await.d.mts +6 -5
  4. package/dist/await.mjs +1 -37
  5. package/dist/{types-CUvFIgPa.d.mts → children-s3nFjpLA.d.mts} +124 -226
  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/environment-CTAGxqz_.d.mts +19 -0
  10. package/dist/for.d.mts +9 -4
  11. package/dist/for.mjs +1 -1
  12. package/dist/{fragment-ROPRBJQd.mjs → fragment-Bvs1sGu1.mjs} +3 -3
  13. package/dist/hydrate/index.mjs +1 -1
  14. package/dist/{hydrate-6Qx4n4Su.mjs → hydrate-DvWdnV-e.mjs} +5 -5
  15. package/dist/integrations/astro-client.mjs +2 -2
  16. package/dist/integrations/astro-server.mjs +2 -2
  17. package/dist/integrations/astro-slots.d.mts +6 -5
  18. package/dist/integrations/astro-slots.mjs +9 -8
  19. package/dist/integrations/react.d.mts +1 -1
  20. package/dist/integrations/react.mjs +1 -1
  21. package/dist/jsx-runtime/index.d.mts +2 -2
  22. package/dist/jsx-runtime/index.mjs +2 -2
  23. package/dist/polyfill-BVNd6ogU.d.mts +9 -0
  24. package/dist/render.mjs +1 -1
  25. package/dist/server/index.mjs +1 -1
  26. package/dist/{server-iFSng50i.mjs → server-CTkyXTV6.mjs} +2 -2
  27. package/dist/signals/index.d.mts +1 -1
  28. package/dist/slot.d.mts +83 -2
  29. package/dist/slot.mjs +179 -2
  30. package/dist/ui/marketing/marketing.css +5 -3
  31. package/dist/ui/otp-input/index.d.mts +6 -5
  32. package/dist/ui/otp-input/index.mjs +5 -5
  33. package/dist/ui/styles/index.css +174 -172
  34. package/dist/ui/styles/unset.css +212 -210
  35. package/dist/utilities/active-element.d.mts +1 -1
  36. package/dist/utilities/async.d.mts +2 -2
  37. package/dist/utilities/async.mjs +13 -5
  38. package/dist/utilities/debounced.d.mts +1 -1
  39. package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
  40. package/dist/utilities/element-rect.d.mts +1 -1
  41. package/dist/utilities/element-scroll.d.mts +1 -1
  42. package/dist/utilities/environment.d.mts +2 -7
  43. package/dist/utilities/environment.mjs +13 -1
  44. package/dist/utilities/event-driven.d.mts +1 -1
  45. package/dist/utilities/event-listener.d.mts +1 -1
  46. package/dist/utilities/focus-within.d.mts +1 -1
  47. package/dist/utilities/hover.d.mts +1 -1
  48. package/dist/utilities/interval.d.mts +1 -1
  49. package/dist/utilities/location.d.mts +1 -1
  50. package/dist/utilities/media-devices.d.mts +1 -1
  51. package/dist/utilities/media-player.d.mts +1 -1
  52. package/dist/utilities/media-query.d.mts +1 -1
  53. package/dist/utilities/network.d.mts +1 -1
  54. package/dist/utilities/orientation.d.mts +1 -1
  55. package/dist/utilities/previous.d.mts +1 -1
  56. package/dist/utilities/promise.d.mts +1 -1
  57. package/dist/utilities/routing.d.mts +1 -1
  58. package/dist/utilities/search-params.d.mts +1 -1
  59. package/dist/utilities/storage.d.mts +1 -1
  60. package/dist/utilities/throttled.d.mts +1 -1
  61. package/dist/utilities/timeout.d.mts +1 -1
  62. package/dist/utilities/window-focus.d.mts +1 -1
  63. package/dist/utilities/window-size.d.mts +1 -1
  64. package/package.json +3 -1
  65. package/dist/custom-elements-BGcU6ldL.d.mts +0 -57
  66. package/dist/slot-BFWXeFRl.d.mts +0 -77
  67. package/dist/slot-Dvf30O0B.mjs +0 -138
  68. /package/dist/{attributes-3r7Diua4.d.mts → attributes-DILeh3-s.d.mts} +0 -0
  69. /package/dist/{scope-zbEG299F.mjs → scope-C1vELXqP.mjs} +0 -0
package/dist/for.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as Require, m as Props } from "./types-CUvFIgPa.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-DvWdnV-e.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) {
@@ -158,7 +158,7 @@ function claimAsync(cur, p, om) {
158
158
  }
159
159
  const slot = claimSlot(cur, om);
160
160
  effect(() => {
161
- if (p.state === "pending") return;
161
+ if (p.state !== "fulfilled" && p.state !== "rejected") return;
162
162
  slot.set(resolveChild(p.result));
163
163
  });
164
164
  onCleanup(() => slot.clear());
@@ -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-DvWdnV-e.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-CUvFIgPa.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-CUvFIgPa.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-CUvFIgPa.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 };
package/dist/slot.mjs CHANGED
@@ -1,2 +1,179 @@
1
- import { n as Slot, t as SLOTS } from "./slot-Dvf30O0B.mjs";
2
- export { SLOTS, Slot };
1
+ import "./polyfill-CdZVCxdo.mjs";
2
+ //#region src/slot.ts
3
+ /**
4
+ * A lightweight slot that reserves a region in the DOM using comment markers.
5
+ * Content between the markers can be replaced dynamically without wrapper elements.
6
+ */
7
+ var Slot = class Slot {
8
+ #start;
9
+ #end;
10
+ #pending;
11
+ /**
12
+ * Bind a slot to an existing marker pair (server-rendered comments) instead
13
+ * of creating new ones. Used by the hydrate claim pass: content between the
14
+ * markers is adopted as the slot's current content.
15
+ */
16
+ static claim(start, end) {
17
+ const slot = new Slot();
18
+ slot.#start = start;
19
+ slot.#end = end;
20
+ return slot;
21
+ }
22
+ /**
23
+ * Render the slot as a DocumentFragment.
24
+ * If not yet mounted, inserts the comment markers and any default content
25
+ * (`Node`s or strings — native `append()` semantics; strings become text
26
+ * nodes). If already mounted, extracts and returns the current content
27
+ * WITHOUT disposing it — the caller takes ownership of the returned nodes
28
+ * and is responsible for their disposal.
29
+ */
30
+ get(...nodes) {
31
+ const fragment = document.createDocumentFragment();
32
+ if (this.isMounted()) {
33
+ const range = document.createRange();
34
+ range.setStartAfter(this.#start);
35
+ range.setEndBefore(this.#end);
36
+ fragment.appendChild(range.extractContents());
37
+ return fragment;
38
+ }
39
+ const start = this.#start ??= document.createComment("{");
40
+ const end = this.#end ??= document.createComment("}");
41
+ fragment.appendChild(start);
42
+ fragment.appendChild(end);
43
+ const initialContent = this.#pending ?? toContent(nodes);
44
+ if (initialContent) fragment.insertBefore(initialContent, end);
45
+ this.#pending = void 0;
46
+ return fragment;
47
+ }
48
+ /** Dispose reactive children and remove all content between the markers. */
49
+ clear() {
50
+ if (!this.#start || !this.#end) return;
51
+ let node = this.#start.nextSibling;
52
+ while (node && node !== this.#end) {
53
+ const next = node.nextSibling;
54
+ if (node instanceof Element) node[Symbol.dispose]?.();
55
+ node = next;
56
+ }
57
+ const range = document.createRange();
58
+ range.setStartAfter(this.#start);
59
+ range.setEndBefore(this.#end);
60
+ range.deleteContents();
61
+ }
62
+ /**
63
+ * Replace the slot's content with the given nodes/strings (native
64
+ * `append()` semantics; strings become text nodes). No args clears the
65
+ * slot. Buffers until mounted; no-op if the content is identical.
66
+ */
67
+ set(...nodes) {
68
+ const content = toContent(nodes);
69
+ if (content == null) {
70
+ this.clear();
71
+ return;
72
+ }
73
+ const parent = this.parent();
74
+ if (!parent) {
75
+ this.#pending = content;
76
+ return;
77
+ }
78
+ if (this.#isSame(content)) return;
79
+ this.clear();
80
+ parent.insertBefore(content, this.#end);
81
+ this.#pending = void 0;
82
+ }
83
+ /**
84
+ * Extract and return the current slot content as a DocumentFragment.
85
+ * Returns `null` if the slot is not mounted.
86
+ * Content is NOT disposed — the caller takes ownership and is responsible
87
+ * for disposal.
88
+ */
89
+ current() {
90
+ if (!this.isMounted()) return null;
91
+ const range = document.createRange();
92
+ range.setStartAfter(this.#start);
93
+ range.setEndBefore(this.#end);
94
+ return range.extractContents();
95
+ }
96
+ /** Returns the parent node if the slot is mounted, otherwise `null`. */
97
+ parent() {
98
+ return this.isMounted() ? this.#start.parentNode : null;
99
+ }
100
+ /** Whether the slot's comment markers are attached to the DOM. */
101
+ isMounted() {
102
+ return !!this.#start && this.#start.parentNode !== null && this.#start.parentNode === this.#end.parentNode;
103
+ }
104
+ #isSame(element) {
105
+ return this.#start.nextSibling === element && this.#end === element.nextSibling;
106
+ }
107
+ };
108
+ function toContent(nodes) {
109
+ if (nodes.length === 0) return void 0;
110
+ if (nodes.length === 1 && nodes[0] instanceof Node) return nodes[0];
111
+ const frag = document.createDocumentFragment();
112
+ frag.append(...nodes);
113
+ return frag;
114
+ }
115
+ function toArgs(value) {
116
+ return Array.isArray(value) ? value.flat(Infinity) : [value];
117
+ }
118
+ /**
119
+ * Field decorator declaring a slot as a plain property backed by a
120
+ * {@link Slot}. Reading returns the slot's region (`slot.get()` — a fragment
121
+ * to append into any template, elements-kit JSX or not); assigning fills it
122
+ * (`null` clears). Values follow native `append()` semantics — a `Node`, a
123
+ * string, or an array of them. Assignment buffers before mount, so consumers
124
+ * can set content before the element renders.
125
+ *
126
+ * The getter is EFFECTFUL: it mounts the markers on first read and extracts
127
+ * current content on later reads (the re-render semantic of
128
+ * {@link Slot.get}). Read it to PLACE the region, not to inspect it.
129
+ *
130
+ * Declare the field as {@link SlotContent} to accept the full native
131
+ * `append()` surface (`Node` | string | array); narrow it to `Node` when the
132
+ * slot only ever holds an element.
133
+ *
134
+ * @example
135
+ * ```tsx
136
+ * class Card extends HTMLElement {
137
+ * \@slot() header!: SlotContent;
138
+ *
139
+ * render() {
140
+ * return <header>{this.header}</header>; // or root.append(card.header)
141
+ * }
142
+ * }
143
+ *
144
+ * // consumers — any framework, or none:
145
+ * card.header = document.createElement("h1"); // Node
146
+ * card.header = "plain text"; // native append() content
147
+ * card.header = null; // clear
148
+ * ```
149
+ */
150
+ function slot() {
151
+ const store = /* @__PURE__ */ new WeakMap();
152
+ return function(_target, context) {
153
+ context.addInitializer(function() {
154
+ const s = store.get(this);
155
+ Object.defineProperty(this, context.name, {
156
+ get() {
157
+ return s.get();
158
+ },
159
+ set(value) {
160
+ if (value == null) {
161
+ s.clear();
162
+ return;
163
+ }
164
+ s.set(...toArgs(value));
165
+ },
166
+ enumerable: true,
167
+ configurable: true
168
+ });
169
+ });
170
+ return function(initialValue) {
171
+ const s = new Slot();
172
+ store.set(this, s);
173
+ if (initialValue != null) s.set(...toArgs(initialValue));
174
+ return initialValue;
175
+ };
176
+ };
177
+ }
178
+ //#endregion
179
+ export { Slot, slot };
@@ -1,5 +1,7 @@
1
- .hero :is(h1, h2, h3, h4, h5, h6, p), .section-header :is(h1, h2, h3, h4, h5, h6, p), .section-heading, .section-paragraph, .river-content :is(h1, h2, h3, h4, h5, h6, p), .pillar :is(h1, h2, h3, h4, h5, h6, p, [data-heading], [data-paragraph]), .cta-banner :is(h1, h2, h3, h4, h5, h6, p), .testimonial :is(blockquote, figcaption, cite, p), .statistic :is(p, [data-leading], [data-heading], [data-description]) {
2
- margin: 0;
1
+ @layer unset {
2
+ .hero :is(h1, h2, h3, h4, h5, h6, p), .section-header :is(h1, h2, h3, h4, h5, h6, p), .section-heading, .section-paragraph, .river-content :is(h1, h2, h3, h4, h5, h6, p), .pillar :is(h1, h2, h3, h4, h5, h6, p, [data-heading], [data-paragraph]), .cta-banner :is(h1, h2, h3, h4, h5, h6, p), .testimonial :is(blockquote, figcaption, cite, p), .statistic :is(p, [data-leading], [data-heading], [data-description]) {
3
+ margin: 0;
4
+ }
3
5
  }
4
6
 
5
7
  .hero {
@@ -32,7 +34,7 @@
32
34
  @media (min-width: 64rem) {
33
35
  .hero .section-paragraph {
34
36
  font-size: var(--font-size-5);
35
- line-height: var(--line-height-5);
37
+ line-height: var(--line-height-6);
36
38
  }
37
39
  }
38
40
 
@@ -1,4 +1,5 @@
1
- import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-3r7Diua4.mjs";
1
+ import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-DILeh3-s.mjs";
2
+ import { t as HTMLElementBase } from "../../environment-CTAGxqz_.mjs";
2
3
 
3
4
  //#region src/ui/otp-input/otp-input.d.ts
4
5
  /**
@@ -30,7 +31,7 @@ import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-3r7Diu
30
31
  * </x-otp-input>
31
32
  * ```
32
33
  */
33
- declare class XOtpInput extends HTMLElement {
34
+ declare class XOtpInput extends HTMLElementBase {
34
35
  #private;
35
36
  static formAssociated: boolean;
36
37
  static [ATTRIBUTES]: {
@@ -82,7 +83,7 @@ declare global {
82
83
  * `<x-otp-input>` paints its character and active / caret / disabled state by
83
84
  * index; all styling lives in the companion CSS.
84
85
  */
85
- declare class XOtpSlot extends HTMLElement {
86
+ declare class XOtpSlot extends HTMLElementBase {
86
87
  static [ATTRIBUTES]: {
87
88
  index: AttrChangeHandler<XOtpSlot>;
88
89
  };
@@ -102,7 +103,7 @@ declare global {
102
103
  * `<x-otp-slot>`s into one attached group. All layout lives in CSS; this only
103
104
  * applies a `group` role so the visual grouping is exposed to assistive tech.
104
105
  */
105
- declare class XOtpGroup extends HTMLElement {
106
+ declare class XOtpGroup extends HTMLElementBase {
106
107
  connectedCallback(): void;
107
108
  }
108
109
  declare global {
@@ -118,7 +119,7 @@ declare global {
118
119
  * `<x-otp-separator>` — decorative divider authored between OTP groups (e.g. a
119
120
  * dash between a 3-3 split). Purely visual: `aria-hidden`, glyph drawn in CSS.
120
121
  */
121
- declare class XOtpSeparator extends HTMLElement {
122
+ declare class XOtpSeparator extends HTMLElementBase {
122
123
  connectedCallback(): void;
123
124
  }
124
125
  declare global {
@@ -3,7 +3,7 @@ import { l as computed, u as effect, x as signal } from "../../lib-DYypKhxk.mjs"
3
3
  import "../../signals/index.mjs";
4
4
  import { on } from "../../utilities/event-listener.mjs";
5
5
  import { render } from "../../render.mjs";
6
- import { isBrowser } from "../../utilities/environment.mjs";
6
+ import { HTMLElementBase, isBrowser } from "../../utilities/environment.mjs";
7
7
  //#region src/ui/otp-input/otp-input.shadow.css?inline
8
8
  var otp_input_shadow_default = ".x-otp-input__field {\n color: #0000;\n caret-color: #0000;\n width: 100%;\n height: 100%;\n font: inherit;\n letter-spacing: inherit;\n pointer-events: auto;\n background: none;\n border: 0;\n outline: none;\n margin: 0;\n padding: 0;\n position: absolute;\n inset: 0;\n}\n\n.x-otp-input__field::selection {\n color: #0000;\n background-color: #0000;\n}\n";
9
9
  //#endregion
@@ -43,7 +43,7 @@ SHADOW_SHEET?.replaceSync(otp_input_shadow_default);
43
43
  * </x-otp-input>
44
44
  * ```
45
45
  */
46
- var XOtpInput = class XOtpInput extends HTMLElement {
46
+ var XOtpInput = class XOtpInput extends HTMLElementBase {
47
47
  static formAssociated = true;
48
48
  static [ATTRIBUTES] = {
49
49
  value(value) {
@@ -293,7 +293,7 @@ if (isBrowser && !customElements.get("x-otp-input")) customElements.define("x-ot
293
293
  * `<x-otp-input>` paints its character and active / caret / disabled state by
294
294
  * index; all styling lives in the companion CSS.
295
295
  */
296
- var XOtpSlot = class extends HTMLElement {
296
+ var XOtpSlot = class extends HTMLElementBase {
297
297
  connectedCallback() {
298
298
  this.setAttribute("aria-hidden", "true");
299
299
  }
@@ -306,7 +306,7 @@ if (isBrowser && !customElements.get("x-otp-slot")) customElements.define("x-otp
306
306
  * `<x-otp-slot>`s into one attached group. All layout lives in CSS; this only
307
307
  * applies a `group` role so the visual grouping is exposed to assistive tech.
308
308
  */
309
- var XOtpGroup = class extends HTMLElement {
309
+ var XOtpGroup = class extends HTMLElementBase {
310
310
  connectedCallback() {
311
311
  if (!this.hasAttribute("role")) this.setAttribute("role", "group");
312
312
  }
@@ -318,7 +318,7 @@ if (isBrowser && !customElements.get("x-otp-group")) customElements.define("x-ot
318
318
  * `<x-otp-separator>` — decorative divider authored between OTP groups (e.g. a
319
319
  * dash between a 3-3 split). Purely visual: `aria-hidden`, glyph drawn in CSS.
320
320
  */
321
- var XOtpSeparator = class extends HTMLElement {
321
+ var XOtpSeparator = class extends HTMLElementBase {
322
322
  connectedCallback() {
323
323
  this.setAttribute("aria-hidden", "true");
324
324
  }