elements-kit 0.21.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 (64) 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-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/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/marketing/marketing.css +5 -3
  30. package/dist/ui/otp-input/index.d.mts +1 -1
  31. package/dist/ui/styles/index.css +174 -172
  32. package/dist/ui/styles/unset.css +212 -210
  33. package/dist/utilities/active-element.d.mts +1 -1
  34. package/dist/utilities/async.d.mts +1 -1
  35. package/dist/utilities/debounced.d.mts +1 -1
  36. package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
  37. package/dist/utilities/element-rect.d.mts +1 -1
  38. package/dist/utilities/element-scroll.d.mts +1 -1
  39. package/dist/utilities/event-driven.d.mts +1 -1
  40. package/dist/utilities/event-listener.d.mts +1 -1
  41. package/dist/utilities/focus-within.d.mts +1 -1
  42. package/dist/utilities/hover.d.mts +1 -1
  43. package/dist/utilities/interval.d.mts +1 -1
  44. package/dist/utilities/location.d.mts +1 -1
  45. package/dist/utilities/media-devices.d.mts +1 -1
  46. package/dist/utilities/media-player.d.mts +1 -1
  47. package/dist/utilities/media-query.d.mts +1 -1
  48. package/dist/utilities/network.d.mts +1 -1
  49. package/dist/utilities/orientation.d.mts +1 -1
  50. package/dist/utilities/previous.d.mts +1 -1
  51. package/dist/utilities/promise.d.mts +1 -1
  52. package/dist/utilities/routing.d.mts +1 -1
  53. package/dist/utilities/search-params.d.mts +1 -1
  54. package/dist/utilities/storage.d.mts +1 -1
  55. package/dist/utilities/throttled.d.mts +1 -1
  56. package/dist/utilities/timeout.d.mts +1 -1
  57. package/dist/utilities/window-focus.d.mts +1 -1
  58. package/dist/utilities/window-size.d.mts +1 -1
  59. package/package.json +3 -1
  60. package/dist/custom-elements-BGcU6ldL.d.mts +0 -57
  61. package/dist/slot-BFWXeFRl.d.mts +0 -77
  62. package/dist/slot-Dvf30O0B.mjs +0 -138
  63. /package/dist/{attributes-3r7Diua4.d.mts → attributes-DILeh3-s.d.mts} +0 -0
  64. /package/dist/{scope-zbEG299F.mjs → scope-C1vELXqP.mjs} +0 -0
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  ```tsx
6
6
  import { signal, computed } from "elements-kit/signals";
7
7
  import { render } from "elements-kit/render";
8
- import type { ReactiveProps } from "elements-kit/jsx-runtime";
8
+ import type { Props } from "elements-kit/jsx-runtime";
9
9
 
10
- function Counter(props: ReactiveProps<{ initial?: number }>) {
10
+ function Counter(props: Props<{ initial?: number }>) {
11
11
  const count = signal(props.initial() ?? 0);
12
12
  const doubled = computed(() => count() * 2);
13
13
 
@@ -63,10 +63,10 @@ Every feature is a separate subpath export — import only what you use.
63
63
  | `elements-kit/signals` | `signal`, `computed`, `effect`, `effectScope`, `batch`, `untracked`, `trigger`, `onCleanup`, `MaybeReactive`, `resolve`, `resolveProps`, `@reactive` |
64
64
  | `elements-kit/render` | `render(target, setup)` — mount a node with a scoped lifetime; returns `unmount` |
65
65
  | `elements-kit/attributes` | `@attributes` decorator + `ATTRIBUTES` symbol |
66
- | `elements-kit/slot` | `Slot`, `Slots`, `SLOTS` symbol — comment-marker DOM regions |
67
- | `elements-kit/custom-elements` | `defineElement`, `CustomElementRegistry` |
66
+ | `elements-kit/slot` | `Slot` class + `@slot()` decorator + `SlotContent` type — comment-marker DOM regions as plain properties |
67
+ | `elements-kit/custom-elements` | `defineElement`, `CustomElementRegistry`, `PropertiesOf`, `AttributesOf`, `EventsOf`, `PublicPropKeys` — raw framework-agnostic extractors for a custom element's properties/attributes/events |
68
68
  | `elements-kit/for` | `For` keyed-list component |
69
- | `elements-kit/jsx-runtime` | JSX factory + type helpers (`ElementProps`, `Props`, `ComponentProps`, `MaybeReactiveProps`, `ReactiveProps`, `Require`) — configure via `jsxImportSource` |
69
+ | `elements-kit/jsx-runtime` | JSX factory + type helpers (`PropsOf`, `MaybeReactiveProps`, `RawProps`, `Props`, `Require`) — configure via `jsxImportSource` |
70
70
  | `elements-kit/server` | `renderToStream`, `renderToString` — streaming HTML rendering in any JS runtime (Node, edge/Workers), no DOM required *(experimental)* |
71
71
  | `elements-kit/hydrate` | `hydrate(container, () => <App/>)` — adopt server-rendered DOM and make it interactive *(experimental)* |
72
72
  | `elements-kit/await` | `Await` — loading boundary (Suspense equivalent); code splitting = `async` + dynamic import *(experimental)* |
@@ -412,24 +412,25 @@ import { For } from "elements-kit/for";
412
412
 
413
413
  ## Prop types
414
414
 
415
- Six type helpers derive JSX prop shapes from your components — no parallel `declare global` block to maintain. Full guide at [docs/src/content/docs/elements/types.mdx](docs/src/content/docs/elements/types.mdx).
415
+ A small set of type helpers derives JSX prop shapes from your components — no parallel `declare global` block to maintain. Full guide at [docs/src/content/docs/elements/types.mdx](docs/src/content/docs/elements/types.mdx).
416
416
 
417
417
  | Helper | For |
418
418
  | ------ | --- |
419
- | `ElementProps<typeof Cls>` | `HTMLElement` subclass — full surface (attrs, events, slots, children) |
420
- | `Props<C>` | Class instance, constructor, or function component unified |
421
- | `ComponentProps<typeof Cls>` | Class components with `constructor(props: P)` |
422
- | `MaybeReactiveProps<P>` | Caller-facing wrap every prop in `MaybeReactive` (what parents pass) |
423
- | `ReactiveProps<P>` | Component-facing — every prop becomes a `Computed<T>` getter (what function components receive) |
419
+ | `PropsOf<C>` | Unifiedfn/class components give raw prop shapes; custom-element ctors give the full JSX surface (attrs, events, slots, children) |
420
+ | `Props<P>` | Component-facing every prop becomes a `Computed<T>` getter (what function components receive) |
421
+ | `MaybeReactiveProps<P>` | Caller-facing wrap every prop in `MaybeReactive` (e.g. a class component's constructor param) |
422
+ | `RawProps<R>` | Recover the raw `P` from a branded `Props<P>` |
424
423
  | `MaybeReactive<T>` | Scalar value-or-getter (from `elements-kit/signals`) |
425
424
  | `Require<P, K>` | Promote optional keys to required |
426
425
 
427
- The JSX runtime auto-wraps function-component propseach key arrives as a callable getter that subscribes on read. Pair the signature with `ReactiveProps<P>` and read `props.x()`:
426
+ Callers never wrap anything by handat every JSX call site the runtime's `LibraryManagedAttributes` automatically lets parents pass each prop as a static value *or* a signal/computed.
427
+
428
+ The JSX runtime auto-wraps function-component props — each key arrives as a callable getter that subscribes on read. Pair the signature with `Props<P>` and read `props.x()`:
428
429
 
429
430
  ```tsx
430
- import type { ReactiveProps } from "elements-kit/jsx-runtime";
431
+ import type { Props } from "elements-kit/jsx-runtime";
431
432
 
432
- function Greeting(props: ReactiveProps<{ name: string }>) {
433
+ function Greeting(props: Props<{ name: string }>) {
433
434
  return <p>Hello, {props.name}</p>;
434
435
  }
435
436
  ```
@@ -472,15 +473,15 @@ class MyElement extends HTMLElement {
472
473
  }
473
474
  ```
474
475
 
475
- For typed slots, attach a `[SLOTS]` instance field pass the key list with `as const` so TS can narrow:
476
+ For named slots, declare `@slot()` propertiesreading places the region in your template, assigning fills it (from any framework, or none):
476
477
 
477
478
  ```ts
478
- import { SLOTS, Slots } from "elements-kit/slot";
479
+ import { slot } from "elements-kit/slot";
479
480
 
480
481
  class Card extends HTMLElement {
481
- [SLOTS] = Slots.new(["header", "footer"] as const);
482
+ @slot() header!: Node
483
+ @slot() footer!: Node
482
484
  }
483
- // ElementProps<typeof Card> now includes `slot:header` / `slot:footer`
484
485
  ```
485
486
 
486
487
  For typed events, declare a `static events` map:
@@ -489,7 +490,7 @@ For typed events, declare a `static events` map:
489
490
  class XPicker extends HTMLElement {
490
491
  declare static events: { commit: CustomEvent<number> };
491
492
  }
492
- // ElementProps<typeof XPicker> now includes `on:commit`
493
+ // PropsOf<typeof XPicker> now includes `on:commit`
493
494
  ```
494
495
 
495
496
  ## Roadmap
@@ -1,2 +1,2 @@
1
- import { a as Attributes, c as observedAttributes, i as AttributeTarget, n as AttrChangeHandler, o as attributes, r as AttributeDecorated, s as dispatchAttrChange, t as ATTRIBUTES } from "./attributes-3r7Diua4.mjs";
1
+ import { a as Attributes, c as observedAttributes, i as AttributeTarget, n as AttrChangeHandler, o as attributes, r as AttributeDecorated, s as dispatchAttrChange, t as ATTRIBUTES } from "./attributes-DILeh3-s.mjs";
2
2
  export { ATTRIBUTES, AttrChangeHandler, AttributeDecorated, AttributeTarget, Attributes, attributes, dispatchAttrChange, observedAttributes };
package/dist/await.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Child } from "./types-CUvFIgPa.mjs";
1
+ import { c as Props, t as Children } from "./children-s3nFjpLA.mjs";
2
2
 
3
3
  //#region src/await.d.ts
4
4
  /** @internal Metadata stamped on an Await region getter (see claim walk). */
@@ -44,10 +44,11 @@ interface AsyncRegionMeta {
44
44
  * </Await>
45
45
  * ```
46
46
  */
47
- declare function Await(props: {
48
- fallback?: Child | (() => Child);
47
+ type AwaitChildren = Children | PromiseLike<Children> | (Children | PromiseLike<Children>)[];
48
+ declare function Await(props: Props<{
49
+ fallback?: Children;
49
50
  when?: unknown;
50
- children?: Child;
51
- }): Element;
51
+ children?: AwaitChildren;
52
+ }>): Element;
52
53
  //#endregion
53
54
  export { AsyncRegionMeta, Await };
package/dist/await.mjs CHANGED
@@ -13,42 +13,6 @@ function toAwaitables(value) {
13
13
  else if (isThenable(item)) out.push(promise(item));
14
14
  return out;
15
15
  }
16
- /**
17
- * Loading boundary for async children — elements-kit's `Suspense` equivalent.
18
- *
19
- * Direct async children (`promise`/`async` values — including the
20
- * code-splitting pattern `async(() => import("./chart"))`) are detected
21
- * automatically; pass `when` to gate on arbitrary awaitables instead. While
22
- * anything is pending the client renders `fallback`; once everything settles
23
- * the children show. The server never renders the fallback — the stream
24
- * awaits and emits the real content. During hydration the server content
25
- * stays visible while the region is pending (no fallback flash).
26
- *
27
- * Prefer a thunk fallback (`fallback={() => <Spinner/>}`) so it renders
28
- * fresh each time the boundary re-enters a pending state.
29
- *
30
- * @example Code splitting with `async` + dynamic import:
31
- * ```tsx
32
- * const chart = async(() => import("./chart").then((m) => m.default));
33
- *
34
- * function Panel() {
35
- * chart.run(); // server: awaited · hydration: deferred · client: import
36
- * return (
37
- * <Await fallback={() => <em>loading…</em>}>{chart}</Await>
38
- * );
39
- * }
40
- * ```
41
- *
42
- * @example Passing props to a code-split component:
43
- * ```tsx
44
- * const chart = async(() => import("./chart").then((m) => m.default));
45
- * chart.run();
46
- *
47
- * <Await fallback={() => <em>loading…</em>}>
48
- * {promise(chart.then((C) => () => <C data={data} />))}
49
- * </Await>
50
- * ```
51
- */
52
16
  function Await(props) {
53
17
  const read = (value) => typeof value === "function" && !isReactive(value) ? value() : value;
54
18
  const children = read(props.children);
@@ -1,11 +1,8 @@
1
- import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-3r7Diua4.mjs";
2
- import { n as Slot, r as PrimitiveNodeType, t as SLOTS } from "./slot-BFWXeFRl.mjs";
3
- import { t as CustomElementRegistry } from "./custom-elements-BGcU6ldL.mjs";
4
- import { JSX } from "dom-expressions/src/jsx-h";
1
+ import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-DILeh3-s.mjs";
2
+ import { i as PropertiesOf, n as CustomElementRegistry, r as EventsOf } from "./custom-elements-CdpilMDu.mjs";
3
+ import * as CSS from "csstype";
4
+ import { JSX } from "dom-expressions/src/jsx";
5
5
 
6
- //#region src/jsx-runtime/element.d.ts
7
- declare function createElement(type: string | Component, allProps?: JSX$1.IntrinsicAttributes & Record<string, unknown>): JSX$1.Element | null;
8
- //#endregion
9
6
  //#region src/signals/lib.d.ts
10
7
  declare const SIGNAL: unique symbol;
11
8
  declare const COMPUTED: unique symbol;
@@ -343,29 +340,9 @@ type MaybeReactive<T> = T | Computed<T>;
343
340
  * ```
344
341
  */
345
342
  declare function resolve<T>(value: MaybeReactive<T>): T;
346
- declare function resolveProps<P extends object>(raw: { [K in keyof P]: MaybeReactive<P[K]> }): ReactiveProps<P>;
343
+ declare function resolveProps<P extends object>(raw: { [K in keyof P]: MaybeReactive<P[K]> }): Props<P>;
347
344
  //#endregion
348
345
  //#region src/jsx-runtime/infer.d.ts
349
- type AnyElementCtor = abstract new (...args: any[]) => HTMLElement;
350
- type Inst<C> = C extends (abstract new (...args: any[]) => infer I) ? I : never;
351
- /**
352
- * When the instance extends `HTMLElement`, drop the DOM surface so only the
353
- * user's own fields remain. Plain class components also drop `render` — it's
354
- * the internal rendering method, not a JSX prop.
355
- */
356
- type PublicPropKeys<I> = I extends HTMLElement ? Exclude<keyof I, keyof HTMLElement | symbol> : Exclude<keyof I, symbol | "render">;
357
- /**
358
- * Instance fields typed as `Slot` are default-slot mounts at runtime — the JSX
359
- * consumer passes DOM content, which `applyChildren` routes via `applySlot`.
360
- * Surface them as `Child` in the JSX prop shape so callers type-check.
361
- */
362
- type PropValueFor<V> = V extends Slot ? Child : V;
363
- /**
364
- * Public instance fields of `I` — all optional. For `HTMLElement` subclasses
365
- * the DOM surface is excluded; for plain classes, all own keys are kept.
366
- * `Slot`-typed fields are mapped to `Child` (see {@link PropValueFor}).
367
- */
368
- type InstanceProps<I> = { [K in PublicPropKeys<I> & string]?: PropValueFor<I[K]> };
369
346
  /**
370
347
  * Promote keys `K` of `P` to required; leave the rest unchanged.
371
348
  *
@@ -380,78 +357,51 @@ type InstanceProps<I> = { [K in PublicPropKeys<I> & string]?: PropValueFor<I[K]>
380
357
  * ```
381
358
  */
382
359
  type Require<P, K extends keyof P> = { [X in K]-?: P[X] } & Omit<P, K>;
383
- /**
384
- * Wrap every non-function prop in {@link MaybeReactive} so callers may pass
385
- * either a plain value or a reactive getter. Function-typed props (event
386
- * handlers, render callbacks) are left as-is so inline arrow callbacks get
387
- * proper contextual typing for their parameters — wrapping them in
388
- * `MaybeReactive<F> = F | (() => F)` produces two callable alternatives and
389
- * TS falls back to implicit-any on the callback's params. Optionality is
390
- * preserved at the key level — the `| undefined` stays at the prop, not
391
- * inside the reactive.
392
- *
393
- * @template P — source prop object type.
394
- *
395
- * @example
396
- * ```ts
397
- * type Raw = { count: number; label?: string; onClick: (e: Event) => void };
398
- * type Wrapped = MaybeReactiveProps<Raw>;
399
- * // {
400
- * // count: MaybeReactive<number>;
401
- * // label?: MaybeReactive<string>;
402
- * // onClick: (e: Event) => void;
403
- * // }
404
- * ```
405
- *
406
- * @see {@link MaybeReactive}
407
- * @see {@link Props}
408
- */
409
- type MaybeReactiveProps<P> = { [K in keyof P]: undefined extends P[K] ? MaybeReactiveOrFn<Exclude<P[K], undefined>> | undefined : MaybeReactiveOrFn<P[K]> };
410
- type MaybeReactiveOrFn<T> = Extract<T, (...args: any[]) => any> extends never ? MaybeReactive<T> : T;
411
360
  declare const RAW_PROPS: unique symbol;
412
- type ReactiveProps<P> = { readonly [K in keyof P]: Computed<P[K]> } & {
361
+ type Props<P> = { readonly [K in keyof P]: Computed<P[K]> } & {
413
362
  readonly [RAW_PROPS]?: P;
414
363
  };
415
- /** Recover the raw prop shape `P` from a `ReactiveProps<P>`. */
364
+ /** Recover the raw prop shape `P` from a `Props<P>`. */
416
365
  type RawProps<R> = R extends {
417
366
  readonly [RAW_PROPS]?: infer P;
418
367
  } ? P : R;
419
368
  /**
420
- * Resolve the JSX call-site prop type for a component (function or class).
421
- * Wired into `JSX.LibraryManagedAttributes` so parents see the right shape:
422
- * - branded `ReactiveProps<P>` (function components) `MaybeReactiveProps<P>`
423
- * - empty constructor param (instance-field classes) `Props<C>`
424
- * - otherwise pass the constructor param shape through (preserves generic
425
- * inference for classes like `For<T>` whose param is already shaped).
426
- *
427
- * Component props only — custom-element attributes go through {@link ElementProps}.
369
+ * Caller-facing wrap: each key accepts a plain value OR a reactive getter.
370
+ * The JSX checker applies it automatically to component props; name it
371
+ * directly when typing a call-site shape by hand (e.g. a class component's
372
+ * constructor param, like `For`'s). Function-typed props are wrapped too
373
+ * (`Computed<F>` is zero-arg, so TS still picks the handler signature by
374
+ * arity for inline arrows). `Signal<F>` must never be added explicitly — its
375
+ * one-arg `Updater` half would collapse inline arrow params to implicit any.
428
376
  */
429
- type ResolveProps<C, P, NN = NonNullable<P>> = NN extends {
377
+ type MaybeReactiveProps<P> = { [K in keyof P]: undefined extends P[K] ? MaybeReactive<Exclude<P[K], undefined>> | undefined : MaybeReactive<P[K]> };
378
+ /**
379
+ * @internal Call-site prop resolution for `JSX.LibraryManagedAttributes`:
380
+ * - empty param (instance-field classes, no ctor) → wrap `PropsOf<C>`
381
+ * - branded `Props<P>` param (function components) → wrap the raw `P`
382
+ * - non-empty constructor param → pass through (preserves `For<T>` inference)
383
+ *
384
+ * Emptiness is checked FIRST: `{}` structurally matches the optional brand
385
+ * (`{} extends { [RAW_PROPS]?: infer Raw }` with `Raw = unknown`), which
386
+ * would silently type every no-ctor class as `MaybeReactiveProps<unknown>`
387
+ * (= `{}`, accepting anything). A real `Props<P>` is never empty — its
388
+ * `keyof` always contains the brand symbol.
389
+ */
390
+ type ResolveProps<C, P, NN = NonNullable<P>> = [keyof NN] extends [never] ? C extends JSX$1.ElementType | JSX$1.ElementClass ? MaybeReactiveProps<PropsOf<C>> : {} : NN extends {
430
391
  readonly [RAW_PROPS]?: infer Raw;
431
- } ? MaybeReactiveProps<Raw> : [keyof NN] extends [never] ? Props<C> : NN;
432
- type InstancePropsOf<C> = Inst<C> extends infer I ? InstanceProps<I> : {};
433
- type PropKeysOf<C> = keyof InstancePropsOf<C> & string;
392
+ } ? MaybeReactiveProps<Raw> : NN;
393
+ type PropKeysOf<C> = keyof PropertiesOf<C> & string;
434
394
  type AttrMap<C> = C extends {
435
395
  [ATTRIBUTES]: infer M;
436
396
  } ? M : {};
437
397
  type HandlerValue<H> = H extends AttrChangeHandler<any> ? string | null : H;
438
398
  type AttrsOf<C> = AttrMap<C> extends infer M ? M extends Record<string, unknown> ? string extends keyof M ? {} : { [K in Exclude<keyof M & string, PropKeysOf<C>>]?: HandlerValue<M[K]> } : {} : {};
439
- type FlatPropsOf<C> = InstancePropsOf<C>;
440
- type PropNamespacedOf<C> = { [K in PropKeysOf<C> as `prop:${K}`]?: NonNullable<InstancePropsOf<C>[K]> };
441
- type EventMapOf<C> = C extends {
442
- events: infer E;
443
- } ? E : {};
444
- type Capitalize1<S extends string> = S extends `${infer H}${infer R}` ? `${Uppercase<H>}${R}` : S;
445
- 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 } : {} : {};
446
- type SlotKeys<I> = I extends {
447
- [SLOTS]: infer S;
448
- } ? Extract<keyof S, string> : never;
449
- type InstanceOf<C> = C extends (abstract new (...args: any[]) => infer I) ? I : C;
450
- type SlotsOf<C> = SlotKeys<InstanceOf<C>> extends infer K ? [K] extends [string] ? { [P in K as `slot:${P}`]?: Child } : {} : {};
399
+ type PropNamespacedOf<C> = { [K in PropKeysOf<C> as `prop:${K}`]?: NonNullable<PropertiesOf<C>[K]> };
400
+ type JsxEventsOf<C> = { [K in keyof EventsOf<C> & string as `on:${K}`]?: (ev: EventsOf<C>[K]) => void };
451
401
  type ChildrenOf<C> = C extends {
452
402
  children: never;
453
403
  } ? {} : {
454
- children?: Child;
404
+ children?: Children;
455
405
  };
456
406
  type BaseDOMAttrs = JSX.DOMAttributes<HTMLElement>;
457
407
  /**
@@ -462,9 +412,8 @@ type BaseDOMAttrs = JSX.DOMAttributes<HTMLElement>;
462
412
  * Keys also present on the instance are dropped here so the flat key carries the property type.
463
413
  * - **Flat properties** — public instance fields, wrapped in `MaybeReactive`.
464
414
  * - **`prop:*`** — explicit property assignment for every field.
465
- * - **Events** — keys from `declare static events: { ... }` produce both
466
- * `on:${K}` and `on${Capitalize<K>}` typed handlers.
467
- * - **Slots** — keys from `[SLOTS] = { ... } as const` produce `slot:${K}`.
415
+ * - **Events** — keys from `declare static events: { ... }` produce
416
+ * `on:${K}` typed handlers (the only event syntax the runtime attaches).
468
417
  * - **Children** — `children?: Child` unless `static children: never`.
469
418
  * - **DOM attrs** — the standard dom-expressions surface (`class`, `style`, `ref`, …).
470
419
  *
@@ -476,7 +425,9 @@ type BaseDOMAttrs = JSX.DOMAttributes<HTMLElement>;
476
425
  * class XRange extends HTMLElement {
477
426
  * static [ATTRIBUTES]: Attributes<XRange> = { min(v) { this.min = +v! } };
478
427
  * declare static events: { commit: CustomEvent<number> };
479
- * [SLOTS] = { label: new Slot() } as const;
428
+ * #slot = new Slot();
429
+ * get label() { return this.#slot.get(); }
430
+ * set label(value: Node) { this.#slot.set(value) }
480
431
  * \@reactive() min = 0;
481
432
  * }
482
433
  *
@@ -485,77 +436,62 @@ type BaseDOMAttrs = JSX.DOMAttributes<HTMLElement>;
485
436
  * // min?: MaybeReactive<number>;
486
437
  * // "prop:min"?: number;
487
438
  * // "on:commit"?: (e: CustomEvent<number>) => void;
488
- * // onCommit?: (e: CustomEvent<number>) => void;
489
- * // "slot:label"?: Child;
490
- * // children?: Child;
439
+ * // label?: Node
440
+ * // children?: Node;
491
441
  * // // …plus ref, class, class:*, style, style:*, standard DOM events
492
442
  * // }
493
443
  * ```
494
444
  *
495
- * @see {@link Props} for class-components / function components (no attr/event/slot synthesis).
496
- */
497
- type ElementProps<C extends AnyElementCtor> = BaseDOMAttrs & AttrsOf<C> & FlatPropsOf<C> & PropNamespacedOf<C> & EventsOf<C> & SlotsOf<C> & ChildrenOf<C>;
498
- /**
499
- * Props of a class component that receives them via its constructor:
500
- * `class Comp { constructor(props: P) }`. Reads `ConstructorParameters[0]`.
501
- *
502
- * Use this when the component's props live on a constructor parameter rather
503
- * than on public instance fields. For instance-field components, use {@link Props}.
504
- *
505
- * @template C — the class constructor type (e.g. `typeof Card`).
506
- *
507
- * @example
508
- * ```ts
509
- * class Card {
510
- * constructor(public props: { title: string; children?: Child }) {}
511
- * render() { return <div>{this.props.title}</div>; }
512
- * }
513
- *
514
- * type P = ComponentProps<typeof Card>;
515
- * // { title: string; children?: Child }
516
- * ```
517
- *
518
- * @see {@link Props}
445
+ * @see {@link PropsOf} for class-components / function components (no attr/event synthesis).
519
446
  */
520
- type ComponentProps<C extends ComponentClass<any>> = C extends ComponentClass<infer P> ? (P extends object ? P : {}) : {};
447
+ type ElementProps<C extends AnyElementCtor> = BaseDOMAttrs & AttrsOf<C> & PropertiesOf<C> & PropNamespacedOf<C> & JsxEventsOf<C> & ChildrenOf<C>;
521
448
  /**
522
- * Props for any component — class or function. Wraps every non-function
523
- * prop in {@link MaybeReactive} so callers may pass values or reactive getters.
524
- *
525
- * Branches by input shape:
526
- * - **Class constructor** (`typeof Cls`) → uses `InstanceProps<InstanceType<Cls>>`.
527
- * - **Function component** (`(props: P) => ...`) → uses the first parameter.
528
- * - **Class instance** (`Cls<T>`) → uses `InstanceProps<Cls<T>>` (useful when
529
- * generics need to flow through — see the `For` example below).
449
+ * Props for any component — class or function.
530
450
  *
531
- * Does **not** synthesize `on:*`, `slot:*`, or attribute surface. For custom
532
- * elements that need those, use {@link ElementProps}.
451
+ * The combination of the two specialised helpers:
452
+ * - **Custom-element constructor** (`typeof Cls`, `Cls extends HTMLElement`)
453
+ * → `ElementProps<Cls>` — the full JSX surface (attrs, `prop:*`, `on:*`,children).
454
+ * - **Everything else** (function component, class component ctor or
455
+ * instance) → `ComponentProps<T>` — the raw prop shape.
533
456
  *
534
- * @template C — constructor, function, or instance.
457
+ * @template T — constructor, function, or instance.
535
458
  *
536
459
  * @example
537
460
  * ```ts
538
461
  * // 1. Class instance (lets a generic flow)
539
462
  * class For<T> { each: T[] = []; render() { return null } }
540
- * type ForProps<T> = Props<For<T>>;
541
- * // ↑ { each?: MaybeReactive<T[]> }
463
+ * type ForProps<T> = PropsOf<For<T>>;
464
+ * // ↑ { each?: T[] }
542
465
  *
543
466
  * // 2. Function component
544
467
  * const Greeting = (_p: { name: string; excited?: boolean }) => null;
545
- * type GreetingProps = Props<typeof Greeting>;
546
- * // ↑ { name: MaybeReactive<string>; excited?: MaybeReactive<boolean> }
468
+ * type GreetingProps = PropsOf<typeof Greeting>;
469
+ * // ↑ { name: string; excited?: boolean }
547
470
  *
548
471
  * // 3. Class constructor
549
472
  * class Counter { count = 0; render() { return null } }
550
- * type CounterProps = Props<typeof Counter>;
551
- * // ↑ { count?: MaybeReactive<number> }
473
+ * type CounterProps = PropsOf<typeof Counter>;
474
+ * // ↑ { count?: number }
552
475
  * ```
553
- *
554
- * @see {@link ElementProps} — custom elements (`HTMLElement` subclasses).
555
- * @see {@link ComponentProps} — constructor-param-based class components.
556
- * @see {@link MaybeReactiveProps}
557
476
  */
558
- 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>;
477
+ type PropsOf<T extends JSX$1.ElementType | JSX$1.ElementClass | AnyElementCtor> = T extends AnyElementCtor ? ElementProps<T> : T extends JSX$1.ElementType | JSX$1.ElementClass ? ComponentProps<T> : never;
478
+ /**
479
+ * Raw props of a function or class COMPONENT (not a custom element):
480
+ * function components use the first parameter (`RawProps` unwraps a branded
481
+ * `Props<P>`); classes use their public instance fields. The custom-element half of `PropsOf` is `ElementProps`.
482
+ */
483
+ type ComponentProps<T extends JSX$1.ElementType | JSX$1.ElementClass> = T extends ((props: infer P, ...rest: any[]) => any) ? P extends object ? RawProps<P> : {} : PropertiesOf<T>;
484
+ type AnyElementCtor = abstract new (...args: any[]) => HTMLElement;
485
+ //#endregion
486
+ //#region src/jsx-runtime/element.d.ts
487
+ type UnsupportedDomKeys = "ref" | "children" | "classList" | "$ServerOnly" | keyof JSX.CustomEventHandlersCamelCase<any> | keyof JSX.CustomEventHandlersLowerCase<any> | keyof JSX.DirectiveAttributes | keyof JSX.DirectiveFunctionAttributes<any> | keyof JSX.AttrAttributes | keyof JSX.BoolAttributes | keyof JSX.OnCaptureAttributes<any>;
488
+ type DOMIntrinsicElements = { [K in keyof JSX.IntrinsicElements]: Omit<JSX.IntrinsicElements[K], UnsupportedDomKeys> };
489
+ type DOMElements = { [K in keyof JSX.IntrinsicElements]: JSX.IntrinsicElements[K] extends {
490
+ ref?: infer R | undefined;
491
+ } ? Extract<R, (el: any) => any> extends ((el: infer E) => any) ? E : Element : Element };
492
+ declare function createElement(type: JSX$1.ElementType, allProps?: {
493
+ ref?: (el: Element) => void;
494
+ } & Record<string, unknown>): JSX$1.Element | null;
559
495
  //#endregion
560
496
  //#region src/jsx-runtime/fragment.d.ts
561
497
  /**
@@ -575,109 +511,71 @@ type Props<C> = (C extends (abstract new (...args: any[]) => infer I) ? MaybeRea
575
511
  * untrusted input at the call site. `<script>` tags never execute.
576
512
  */
577
513
  declare function Fragment(props: Props<{
578
- children: Child;
514
+ children?: Children;
579
515
  }> | {
580
516
  html: true;
581
517
  children: MaybeReactive<string>;
582
518
  }): DocumentFragment;
583
519
  //#endregion
584
520
  //#region src/jsx-runtime/index.d.ts
585
- /**
586
- * Maps slot names to `Child` content.
587
- * Use this to type `slot:name` JSX props on a custom component.
588
- *
589
- * @example
590
- * ```tsx
591
- * function Card(props: { title: string } & SlotProps<"header" | "footer">) { … }
592
- * // caller: <Card title="…" slot:header={<h1>…</h1>} slot:footer={<p>…</p>} />
593
- * ```
594
- */
595
- type SlotProps<K extends string> = { [P in K as `slot:${P}`]?: Child };
596
- /**
597
- * Get the full JSX prop types for a given tag name, including reactive
598
- * attributes, events, and all our namespace extensions.
599
- *
600
- * @example
601
- * ```ts
602
- * type InputProps = Attrs<"input">; // typed props for <input>
603
- * type DivProps = Attrs<"div">; // typed props for <div>
604
- * ```
605
- */
606
- type Attrs<K extends keyof JSX$1.IntrinsicElements> = JSX$1.IntrinsicElements[K];
607
- /**
608
- * Namespaced JSX props added by elements-kit on top of dom-expressions.
609
- * All four are tag-aware via the element type `E`.
610
- *
611
- * - `ref` — callback invoked with the mounted element, typed as the concrete
612
- * element class for intrinsics and registered custom elements.
613
- * - `class:foo` — open string + `MaybeReactive<boolean>`. Class names are
614
- * user-defined CSS so the key stays open (no autocomplete possible).
615
- * - `style:cssProp` — keys mapped from `DomJSX.CSSProperties` (csstype's
616
- * hyphenated property names) for autocomplete; value typed per-property.
617
- * - `prop:K` — inferred from `keyof E`. On `<div>` exposes
618
- * `prop:className`, `prop:id`, etc. (from `HTMLDivElement`); on a
619
- * registered custom element exposes its public fields too.
620
- *
621
- * `slot:foo` is NOT here — it's emitted per-element via `SlotsOf<C>` only
622
- * for elements that declare `[SLOTS]`. Plain HTML intrinsics don't accept
623
- * slot props (the runtime ignores them).
624
- */
625
- type CssStyleKey = Extract<keyof JSX.CSSProperties, string> extends infer K ? K extends `-${string}` ? never : K : never;
626
- type StyleNamespace = { [K in CssStyleKey as `style:${K}`]?: MaybeReactive<JSX.CSSProperties[K] | null> };
627
- type PropNamespace<E> = { [K in keyof E as K extends string ? `prop:${K}` : never]?: MaybeReactive<E[K]> };
628
- type JsxNamespaces<E extends Element = Element> = {
629
- ref?: (el: E) => void;
630
- [cls: `class:${string}`]: MaybeReactive<boolean>;
631
- } & StyleNamespace & PropNamespace<E>;
632
- type XlinkAttrs = {
633
- "xlink:href"?: MaybeReactive<string | undefined>;
634
- "xlink:title"?: MaybeReactive<string | undefined>;
635
- "xlink:show"?: MaybeReactive<"new" | "replace" | "embed" | "other" | "none" | undefined>;
636
- "xlink:role"?: MaybeReactive<string | undefined>;
637
- "xlink:type"?: MaybeReactive<"simple" | "extended" | "locator" | "arc" | "resource" | "title" | undefined>;
638
- "xlink:arcrole"?: MaybeReactive<string | undefined>;
639
- "xlink:actuate"?: MaybeReactive<"onLoad" | "onRequest" | "other" | "none" | undefined>;
640
- };
641
- type XmlAttrs = {
642
- "xml:lang"?: MaybeReactive<string | undefined>;
643
- "xml:space"?: MaybeReactive<"default" | "preserve" | undefined>;
644
- "xml:base"?: MaybeReactive<string | undefined>;
645
- };
646
- type SvgNamespaceAttrs = XlinkAttrs & XmlAttrs;
647
- type JsxNamespaceKeys = "ref" | `class:${string}` | `style:${string}` | `prop:${string}`;
648
- type WithJsxNamespaces<T, E extends Element = Element> = Omit<T, JsxNamespaceKeys> & JsxNamespaces<E>;
649
- type IntrinsicElementOf<T> = T extends {
650
- ref?: infer R | undefined;
651
- } ? Extract<R, (el: any) => any> extends ((el: infer E) => any) ? E : Element : Element;
652
521
  declare namespace JSX$1 {
653
522
  export type Element = globalThis.Element | globalThis.DocumentFragment;
654
- export type ElementType = Child | Component;
523
+ export type ElementClass = {
524
+ render(): JSX$1.Element | null;
525
+ };
526
+ export type ElementType = string | JSX$1.Element | (new (props: any) => JSX$1.ElementClass) | ((props: any) => JSX$1.Element | null);
655
527
  export interface ElementChildrenAttribute {
656
528
  children: {};
657
529
  }
658
- export interface IntrinsicAttributes {
659
- ref?: (el: Element) => void;
660
- }
530
+ export interface IntrinsicAttributes {}
661
531
  export type LibraryManagedAttributes<C, P> = ResolveProps<C, P>;
662
- type RegisteredElements = { [K in keyof CustomElementRegistry]: CustomElementRegistry[K] extends infer C extends AnyElementCtor ? WithJsxNamespaces<MaybeReactiveProps<ElementProps<C>>, InstanceType<C>> : never };
663
- export type IntrinsicElements = { [K in keyof JSX.IntrinsicElements]: WithJsxNamespaces<JSX.IntrinsicElements[K], IntrinsicElementOf<JSX.IntrinsicElements[K]>> & (IntrinsicElementOf<JSX.IntrinsicElements[K]> extends SVGElement ? SvgNamespaceAttrs : {}) } & RegisteredElements;
532
+ type RegisteredElements = { [K in keyof CustomElementRegistry]: CustomElementRegistry[K] extends infer C extends AnyElementCtor ? MaybeReactiveProps<WithJsxNamespaces<Omit<ElementProps<C>, "children" | "ref">, InstanceType<C>>> & {
533
+ ref?: (el: InstanceType<C>) => void;
534
+ children?: Children;
535
+ } : never };
536
+ export type IntrinsicElements = { [K in keyof DOMIntrinsicElements]: MaybeReactiveProps<WithJsxNamespaces<DOMIntrinsicElements[K], DOMElements[K]>> & {
537
+ ref?: (el: DOMElements[K]) => void;
538
+ children?: Children;
539
+ } & (DOMElements[K] extends SVGElement ? SvgNamespaceAttrs : {}) } & RegisteredElements;
664
540
  export {};
665
541
  }
542
+ /** A class whose constructor returns a ComponentInstance. */
543
+ type ComponentClass<P extends Record<PropertyKey, unknown> = any> = new (props: P) => JSX$1.ElementClass;
544
+ type ComponentFn<P extends Record<PropertyKey, unknown> = any> = (props: Props<P>) => JSX$1.Element | null;
666
545
  //#endregion
667
- //#region src/jsx-runtime/types.d.ts
668
- /** An instance created by a component class — must expose `render()`. */
669
- interface ComponentInstance {
670
- render(): JSX$1.Element | null;
546
+ //#region src/jsx-runtime/properties.d.ts
547
+ interface CSSProperties extends CSS.PropertiesHyphen {
548
+ [key: `-${string}`]: string | number | undefined;
671
549
  }
672
- /** A class whose constructor returns a ComponentInstance. */
673
- type ComponentClass<P extends Record<PropertyKey, unknown> = any> = new (props: P) => ComponentInstance;
674
- type ComponentFn<P extends Record<PropertyKey, unknown> = any> = (props: ReactiveProps<P>) => JSX$1.Element | null;
675
- /** Anything valid as the first arg to `createElement` / a JSX tag target. */
676
- type Component = JSX$1.Element | ComponentClass | ComponentFn;
677
- /** A resolved runtime node — what `applyProps` / `applyChildren` operate on. */
678
- type PropsTarget = JSX$1.Element | ComponentInstance;
679
- /** Anything that can appear as a JSX child. */
680
- type Child = PrimitiveNodeType | JSX$1.Element | AnyFn | Child[];
681
- type AnyFn = (...args: any[]) => Child;
550
+ type CssStyleKey = Extract<keyof CSSProperties, string> extends infer K ? K extends `-${string}` ? never : K : never;
551
+ type StyleNamespace = { [K in CssStyleKey as `style:${K}`]?: CSSProperties[K] | null };
552
+ type PropNamespace<E> = { [K in keyof E as K extends string ? `prop:${K}` : never]?: E[K] };
553
+ type XlinkAttrs = {
554
+ "xlink:href"?: string | undefined;
555
+ "xlink:title"?: string | undefined;
556
+ "xlink:show"?: "new" | "replace" | "embed" | "other" | "none" | undefined;
557
+ "xlink:role"?: string | undefined;
558
+ "xlink:type"?: "simple" | "extended" | "locator" | "arc" | "resource" | "title" | undefined;
559
+ "xlink:arcrole"?: string | undefined;
560
+ "xlink:actuate"?: "onLoad" | "onRequest" | "other" | "none" | undefined;
561
+ };
562
+ type ClassNamespace = { [K in `class:${string}`]?: boolean };
563
+ type XmlAttrs = {
564
+ "xml:lang"?: string | undefined;
565
+ "xml:space"?: "default" | "preserve" | undefined;
566
+ "xml:base"?: string | undefined;
567
+ };
568
+ type SvgNamespaceAttrs = XlinkAttrs & XmlAttrs;
569
+ interface StyleAttrObject extends CSS.Properties {}
570
+ type JsxNamespaces<E extends Element = Element> = (E extends ElementCSSInlineStyle ? {
571
+ style?: string | StyleAttrObject;
572
+ } & StyleNamespace : {}) & PropNamespace<Omit<E, "children">> & ClassNamespace;
573
+ type JsxNamespaceKeys = "style" | `class:${string}` | `style:${string}` | `prop:${string}`;
574
+ type WithJsxNamespaces<T, E extends Element = Element> = Omit<T, JsxNamespaceKeys> & JsxNamespaces<E>;
575
+ //#endregion
576
+ //#region src/jsx-runtime/children.d.ts
577
+ type PrimitiveNodeType = Node | string | boolean | number | bigint | symbol | Date | RegExp | null | undefined;
578
+ type AnyFn = (...args: any[]) => Children;
579
+ type Children = PrimitiveNodeType | AnyFn | Element | DocumentFragment | Children[];
682
580
  //#endregion
683
- export { EFFECT_SCOPE as A, isSignal as B, isReactive as C, CLAIM as D, resolveProps as E, effect as F, createElement as G, signal as H, effectScope as I, isComputed as L, SIGNAL as M, batch as N, COMPUTED as O, computed as P, isEffect as R, Updater as S, resolve as T, trigger as U, onCleanup as V, untracked as W, Require as _, ComponentInstance as a, MaybeReactive as b, JSX$1 as c, ComponentProps as d, ElementProps as f, ReactiveProps as g, RawProps as h, ComponentFn as i, SEED as j, EFFECT as k, SlotProps as l, Props as m, Component as n, PropsTarget as o, MaybeReactiveProps as p, ComponentClass as r, Attrs as s, Child as t, Fragment as u, ResolveProps as v, reactive as w, Signal as x, Computed as y, isEffectScope as z };
581
+ export { isComputed as A, EFFECT_SCOPE as C, computed as D, batch as E, signal as F, trigger as I, untracked as L, isEffectScope as M, isSignal as N, effect as O, onCleanup as P, EFFECT as S, SIGNAL as T, reactive as _, Fragment as a, CLAIM as b, Props as c, Require as d, Computed as f, isReactive as g, Updater as h, JSX$1 as i, isEffect as j, effectScope as k, PropsOf as l, Signal as m, ComponentClass as n, createElement as o, MaybeReactive as p, ComponentFn as r, MaybeReactiveProps as s, Children as t, RawProps as u, resolve as v, SEED as w, COMPUTED as x, resolveProps as y };