elements-kit 0.19.0 → 0.21.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.
- package/README.md +14 -0
- package/dist/await.d.mts +53 -0
- package/dist/await.mjs +70 -0
- package/dist/{custom-elements-D5CgfNKc.d.mts → custom-elements-BGcU6ldL.d.mts} +2 -0
- package/dist/custom-elements.d.mts +1 -1
- package/dist/{element-xQwq4ulc.mjs → element-D3om9yA6.mjs} +71 -4
- package/dist/for.d.mts +20 -26
- package/dist/for.mjs +29 -4
- package/dist/fragment-ROPRBJQd.mjs +61 -0
- package/dist/hydrate/index.d.mts +41 -0
- package/dist/hydrate/index.mjs +2 -0
- package/dist/hydrate-6Qx4n4Su.mjs +380 -0
- package/dist/integrations/astro-client.d.mts +17 -0
- package/dist/integrations/astro-client.mjs +23 -0
- package/dist/integrations/astro-server.d.mts +15 -0
- package/dist/integrations/astro-server.mjs +39 -0
- package/dist/integrations/astro-slots.d.mts +12 -0
- package/dist/integrations/astro-slots.mjs +30 -0
- package/dist/integrations/astro.d.mts +46 -0
- package/dist/integrations/astro.mjs +64 -0
- package/dist/integrations/react.d.mts +1 -1
- package/dist/integrations/react.mjs +2 -2
- package/dist/jsx-runtime/index.d.mts +1 -1
- package/dist/jsx-runtime/index.mjs +2 -20
- package/dist/{lib-Dkc7cV5F.mjs → lib-DYypKhxk.mjs} +63 -5
- package/dist/render.mjs +1 -1
- package/dist/{scope-CnEvL9Nd.mjs → scope-zbEG299F.mjs} +1 -1
- package/dist/server/index.d.mts +43 -0
- package/dist/server/index.mjs +2 -0
- package/dist/server-iFSng50i.mjs +385 -0
- package/dist/signals/index.d.mts +2 -2
- package/dist/signals/index.mjs +5 -3
- package/dist/{slot-B8y0aEoz.d.mts → slot-BFWXeFRl.d.mts} +6 -0
- package/dist/{slot-Cne__au7.mjs → slot-Dvf30O0B.mjs} +12 -1
- package/dist/slot.d.mts +1 -1
- package/dist/slot.mjs +1 -1
- package/dist/{infer-B7T5hi_D.d.mts → types-CUvFIgPa.d.mts} +140 -141
- package/dist/ui/badge/badge.css +5 -5
- package/dist/ui/button/button.css +15 -15
- package/dist/ui/card/card.css +2 -2
- package/dist/ui/group/group.css +61 -0
- package/dist/ui/otp-input/index.d.mts +132 -0
- package/dist/ui/otp-input/index.mjs +328 -0
- package/dist/ui/otp-input/otp-input.css +157 -0
- package/dist/ui/overlay/index.css +52 -4
- package/dist/ui/overlay/index.d.mts +237 -63
- package/dist/ui/overlay/index.mjs +659 -67
- package/dist/ui/overlay/overlay.css +58 -2
- package/dist/ui/styles/index.css +662 -0
- package/dist/ui/styles/radius.css +7 -7
- package/dist/utilities/_observe.mjs +1 -1
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/active-element.mjs +1 -1
- package/dist/utilities/async.d.mts +19 -2
- package/dist/utilities/async.mjs +49 -2
- package/dist/utilities/context.mjs +1 -1
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/debounced.mjs +1 -1
- package/dist/utilities/dom-lifecycle.bench.mjs +3255 -1
- package/dist/utilities/dom-lifecycle.mjs +1 -1
- package/dist/utilities/element-rect.d.mts +1 -1
- package/dist/utilities/element-rect.mjs +1 -1
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-driven.mjs +1 -1
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/event-listener.mjs +1 -1
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/focus-within.mjs +1 -1
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/hover.mjs +1 -1
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/interval.mjs +1 -1
- package/dist/utilities/location.d.mts +1 -1
- package/dist/utilities/location.mjs +1 -1
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-devices.mjs +1 -1
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-query.d.mts +1 -1
- package/dist/utilities/media-query.mjs +1 -1
- package/dist/utilities/network.d.mts +1 -1
- package/dist/utilities/network.mjs +1 -1
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/orientation.mjs +1 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/previous.mjs +1 -1
- package/dist/utilities/promise.d.mts +19 -2
- package/dist/utilities/promise.mjs +33 -3
- package/dist/utilities/retry.mjs +1 -1
- package/dist/utilities/routing.d.mts +1 -1
- package/dist/utilities/routing.mjs +1 -1
- package/dist/utilities/search-params.d.mts +1 -1
- package/dist/utilities/storage.d.mts +1 -1
- package/dist/utilities/throttled.d.mts +1 -1
- package/dist/utilities/throttled.mjs +1 -1
- package/dist/utilities/timeout.d.mts +1 -1
- package/dist/utilities/timeout.mjs +1 -1
- package/dist/utilities/window-focus.d.mts +1 -1
- package/dist/utilities/window-focus.mjs +1 -1
- package/dist/utilities/window-size.d.mts +1 -1
- package/dist/utilities/window-size.mjs +1 -1
- package/package.json +23 -1
- package/dist/benchmark.CX_oY03V-CSLAXL5f.mjs +0 -5145
- package/dist/magic-string.es-CXefOmkB.mjs +0 -1011
- package/dist/test.BmQO5GaM-Ddz9cDxc.mjs +0 -8266
- package/dist/utilities/active-element.test.d.mts +0 -1
- package/dist/utilities/active-element.test.mjs +0 -25
- package/dist/utilities/async.test.d.mts +0 -1
- package/dist/utilities/async.test.mjs +0 -275
- package/dist/utilities/context.test.d.mts +0 -1
- package/dist/utilities/context.test.mjs +0 -171
- package/dist/utilities/debounced.test.d.mts +0 -1
- package/dist/utilities/debounced.test.mjs +0 -68
- package/dist/utilities/dom-lifecycle.test.d.mts +0 -1
- package/dist/utilities/dom-lifecycle.test.mjs +0 -228
- package/dist/utilities/element-rect.test.d.mts +0 -1
- package/dist/utilities/element-rect.test.mjs +0 -101
- package/dist/utilities/element-scroll.test.d.mts +0 -1
- package/dist/utilities/element-scroll.test.mjs +0 -27
- package/dist/utilities/event-listener.test.d.mts +0 -1
- package/dist/utilities/event-listener.test.mjs +0 -60
- package/dist/utilities/focus-within.test.d.mts +0 -1
- package/dist/utilities/focus-within.test.mjs +0 -51
- package/dist/utilities/form-object.test.d.mts +0 -1
- package/dist/utilities/form-object.test.mjs +0 -408
- package/dist/utilities/hover.test.d.mts +0 -1
- package/dist/utilities/hover.test.mjs +0 -54
- package/dist/utilities/intersection-observer.test.d.mts +0 -1
- package/dist/utilities/intersection-observer.test.mjs +0 -46
- package/dist/utilities/interval.test.d.mts +0 -1
- package/dist/utilities/interval.test.mjs +0 -115
- package/dist/utilities/location.test.d.mts +0 -1
- package/dist/utilities/location.test.mjs +0 -61
- package/dist/utilities/long-press.test.d.mts +0 -1
- package/dist/utilities/long-press.test.mjs +0 -54
- package/dist/utilities/media-devices.test.d.mts +0 -1
- package/dist/utilities/media-devices.test.mjs +0 -44
- package/dist/utilities/media-player.test.d.mts +0 -1
- package/dist/utilities/media-player.test.mjs +0 -102
- package/dist/utilities/mutation-observer.test.d.mts +0 -1
- package/dist/utilities/mutation-observer.test.mjs +0 -48
- package/dist/utilities/network.test.d.mts +0 -1
- package/dist/utilities/network.test.mjs +0 -30
- package/dist/utilities/on-click-outside.test.d.mts +0 -1
- package/dist/utilities/on-click-outside.test.mjs +0 -45
- package/dist/utilities/previous.test.d.mts +0 -1
- package/dist/utilities/previous.test.mjs +0 -90
- package/dist/utilities/promise.test.d.mts +0 -1
- package/dist/utilities/promise.test.mjs +0 -158
- package/dist/utilities/retry.test.d.mts +0 -1
- package/dist/utilities/retry.test.mjs +0 -85
- package/dist/utilities/routing.test.d.mts +0 -1
- package/dist/utilities/routing.test.mjs +0 -129
- package/dist/utilities/search-params.test.d.mts +0 -1
- package/dist/utilities/search-params.test.mjs +0 -37
- package/dist/utilities/ssr.test.d.mts +0 -1
- package/dist/utilities/ssr.test.mjs +0 -65
- package/dist/utilities/storage.test.d.mts +0 -1
- package/dist/utilities/storage.test.mjs +0 -139
- package/dist/utilities/throttled.test.d.mts +0 -1
- package/dist/utilities/throttled.test.mjs +0 -58
- package/dist/utilities/timeout.test.d.mts +0 -1
- package/dist/utilities/timeout.test.mjs +0 -121
- package/dist/utilities/window-size.test.d.mts +0 -1
- package/dist/utilities/window-size.test.mjs +0 -43
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-3r7Diua4.mjs";
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
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
4
|
import { JSX } from "dom-expressions/src/jsx-h";
|
|
5
5
|
|
|
6
6
|
//#region src/jsx-runtime/element.d.ts
|
|
7
|
-
declare function createElement(type: string | Component,
|
|
8
|
-
ref,
|
|
9
|
-
...props
|
|
10
|
-
}?: JSX$1.IntrinsicAttributes & Record<string, unknown>): JSX$1.Element;
|
|
7
|
+
declare function createElement(type: string | Component, allProps?: JSX$1.IntrinsicAttributes & Record<string, unknown>): JSX$1.Element | null;
|
|
11
8
|
//#endregion
|
|
12
9
|
//#region src/signals/lib.d.ts
|
|
13
10
|
declare const SIGNAL: unique symbol;
|
|
@@ -111,6 +108,19 @@ declare function computed<T>(getter: (previousValue?: T) => T): () => T;
|
|
|
111
108
|
* stop(); // final cleanup: abort the last fetch
|
|
112
109
|
* ```
|
|
113
110
|
*/
|
|
111
|
+
/**
|
|
112
|
+
* @internal Method key for settling a reactive async wrapper from a
|
|
113
|
+
* serialized server snapshot (hydration seeding). Lives here so
|
|
114
|
+
* `utilities/promise`, `utilities/async` and `hydrate` can share it without
|
|
115
|
+
* a utility-to-utility dependency.
|
|
116
|
+
*/
|
|
117
|
+
declare const SEED: unique symbol;
|
|
118
|
+
/**
|
|
119
|
+
* @internal Method key for the hydrate claim protocol: the claim walk hands
|
|
120
|
+
* each async wrapper its ek-data record (or undefined). The wrapper decides —
|
|
121
|
+
* seed and discard any deferred run, or execute the deferred run now.
|
|
122
|
+
*/
|
|
123
|
+
declare const CLAIM: unique symbol;
|
|
114
124
|
declare function effect(fn: () => void): () => void;
|
|
115
125
|
/**
|
|
116
126
|
* Creates an ownership scope that groups reactive effects so they can all be
|
|
@@ -333,142 +343,8 @@ type MaybeReactive<T> = T | Computed<T>;
|
|
|
333
343
|
* ```
|
|
334
344
|
*/
|
|
335
345
|
declare function resolve<T>(value: MaybeReactive<T>): T;
|
|
336
|
-
/**
|
|
337
|
-
* Turn a reactive-props object into a bag of per-key getters. Callers may
|
|
338
|
-
* pass values or reactive sources (`signal`, `computed`); reading
|
|
339
|
-
* `props.name()` inside an effect or JSX getter subscribes to whatever
|
|
340
|
-
* drives it. Static values become stable thunks, signals and computed pass
|
|
341
|
-
* through unchanged — so identity is preserved (`props.name === props.name`).
|
|
342
|
-
*
|
|
343
|
-
* The JSX runtime auto-applies this to function-component props — call
|
|
344
|
-
* directly only for non-JSX call sites or nested prop bags.
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ```ts
|
|
348
|
-
* import { resolveProps } from "elements-kit/signals";
|
|
349
|
-
* import { signal } from "elements-kit/signals";
|
|
350
|
-
*
|
|
351
|
-
* const count = signal(0);
|
|
352
|
-
* const props = resolveProps({ count, label: "n" });
|
|
353
|
-
* props.count(); // 0 — subscribes to count
|
|
354
|
-
* props.label(); // "n"
|
|
355
|
-
* ```
|
|
356
|
-
*/
|
|
357
346
|
declare function resolveProps<P extends object>(raw: { [K in keyof P]: MaybeReactive<P[K]> }): ReactiveProps<P>;
|
|
358
347
|
//#endregion
|
|
359
|
-
//#region src/jsx-runtime/fragment.d.ts
|
|
360
|
-
/**
|
|
361
|
-
* Used by the JSX transform for `<>...</>` fragments.
|
|
362
|
-
*
|
|
363
|
-
* Each child is routed through `mountChild`, which handles Nodes, strings,
|
|
364
|
-
* numbers, arrays, and reactive getters — matching the behavior of any other
|
|
365
|
-
* JSX container. `mountChild` also wires each child's cleanup via its own
|
|
366
|
-
* `effectScope`, which links to the enclosing `effectScope` created by
|
|
367
|
-
* `createElement(Fragment, ...)` for disposal propagation.
|
|
368
|
-
*/
|
|
369
|
-
declare function Fragment(props: {
|
|
370
|
-
children?: () => Child;
|
|
371
|
-
}): DocumentFragment;
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region src/jsx-runtime/index.d.ts
|
|
374
|
-
/**
|
|
375
|
-
* Maps slot names to `Child` content.
|
|
376
|
-
* Use this to type `slot:name` JSX props on a custom component.
|
|
377
|
-
*
|
|
378
|
-
* @example
|
|
379
|
-
* ```tsx
|
|
380
|
-
* function Card(props: { title: string } & SlotProps<"header" | "footer">) { … }
|
|
381
|
-
* // caller: <Card title="…" slot:header={<h1>…</h1>} slot:footer={<p>…</p>} />
|
|
382
|
-
* ```
|
|
383
|
-
*/
|
|
384
|
-
type SlotProps<K extends string> = { [P in K as `slot:${P}`]?: Child };
|
|
385
|
-
/**
|
|
386
|
-
* Get the full JSX prop types for a given tag name, including reactive
|
|
387
|
-
* attributes, events, and all our namespace extensions.
|
|
388
|
-
*
|
|
389
|
-
* @example
|
|
390
|
-
* ```ts
|
|
391
|
-
* type InputProps = Attrs<"input">; // typed props for <input>
|
|
392
|
-
* type DivProps = Attrs<"div">; // typed props for <div>
|
|
393
|
-
* ```
|
|
394
|
-
*/
|
|
395
|
-
type Attrs<K extends keyof JSX$1.IntrinsicElements> = JSX$1.IntrinsicElements[K];
|
|
396
|
-
/**
|
|
397
|
-
* Namespaced JSX props added by elements-kit on top of dom-expressions.
|
|
398
|
-
* All four are tag-aware via the element type `E`.
|
|
399
|
-
*
|
|
400
|
-
* - `ref` — callback invoked with the mounted element, typed as the concrete
|
|
401
|
-
* element class for intrinsics and registered custom elements.
|
|
402
|
-
* - `class:foo` — open string + `MaybeReactive<boolean>`. Class names are
|
|
403
|
-
* user-defined CSS so the key stays open (no autocomplete possible).
|
|
404
|
-
* - `style:cssProp` — keys mapped from `DomJSX.CSSProperties` (csstype's
|
|
405
|
-
* hyphenated property names) for autocomplete; value typed per-property.
|
|
406
|
-
* - `prop:K` — inferred from `keyof E`. On `<div>` exposes
|
|
407
|
-
* `prop:className`, `prop:id`, etc. (from `HTMLDivElement`); on a
|
|
408
|
-
* registered custom element exposes its public fields too.
|
|
409
|
-
*
|
|
410
|
-
* `slot:foo` is NOT here — it's emitted per-element via `SlotsOf<C>` only
|
|
411
|
-
* for elements that declare `[SLOTS]`. Plain HTML intrinsics don't accept
|
|
412
|
-
* slot props (the runtime ignores them).
|
|
413
|
-
*/
|
|
414
|
-
type CssStyleKey = Extract<keyof JSX.CSSProperties, string> extends infer K ? K extends `-${string}` ? never : K : never;
|
|
415
|
-
type StyleNamespace = { [K in CssStyleKey as `style:${K}`]?: MaybeReactive<JSX.CSSProperties[K] | null> };
|
|
416
|
-
type PropNamespace<E> = { [K in keyof E as K extends string ? `prop:${K}` : never]?: MaybeReactive<E[K]> };
|
|
417
|
-
type JsxNamespaces<E extends Element = Element> = {
|
|
418
|
-
ref?: (el: E) => void;
|
|
419
|
-
[cls: `class:${string}`]: MaybeReactive<boolean>;
|
|
420
|
-
} & StyleNamespace & PropNamespace<E>;
|
|
421
|
-
type XlinkAttrs = {
|
|
422
|
-
"xlink:href"?: MaybeReactive<string | undefined>;
|
|
423
|
-
"xlink:title"?: MaybeReactive<string | undefined>;
|
|
424
|
-
"xlink:show"?: MaybeReactive<"new" | "replace" | "embed" | "other" | "none" | undefined>;
|
|
425
|
-
"xlink:role"?: MaybeReactive<string | undefined>;
|
|
426
|
-
"xlink:type"?: MaybeReactive<"simple" | "extended" | "locator" | "arc" | "resource" | "title" | undefined>;
|
|
427
|
-
"xlink:arcrole"?: MaybeReactive<string | undefined>;
|
|
428
|
-
"xlink:actuate"?: MaybeReactive<"onLoad" | "onRequest" | "other" | "none" | undefined>;
|
|
429
|
-
};
|
|
430
|
-
type XmlAttrs = {
|
|
431
|
-
"xml:lang"?: MaybeReactive<string | undefined>;
|
|
432
|
-
"xml:space"?: MaybeReactive<"default" | "preserve" | undefined>;
|
|
433
|
-
"xml:base"?: MaybeReactive<string | undefined>;
|
|
434
|
-
};
|
|
435
|
-
type SvgNamespaceAttrs = XlinkAttrs & XmlAttrs;
|
|
436
|
-
type JsxNamespaceKeys = "ref" | `class:${string}` | `style:${string}` | `prop:${string}`;
|
|
437
|
-
type WithJsxNamespaces<T, E extends Element = Element> = Omit<T, JsxNamespaceKeys> & JsxNamespaces<E>;
|
|
438
|
-
type IntrinsicElementOf<T> = T extends {
|
|
439
|
-
ref?: infer R | undefined;
|
|
440
|
-
} ? Extract<R, (el: any) => any> extends ((el: infer E) => any) ? E : Element : Element;
|
|
441
|
-
declare namespace JSX$1 {
|
|
442
|
-
export type Element = globalThis.Element | globalThis.DocumentFragment | null;
|
|
443
|
-
export type ElementType = Child | Component;
|
|
444
|
-
export interface ElementChildrenAttribute {
|
|
445
|
-
children: {};
|
|
446
|
-
}
|
|
447
|
-
export interface IntrinsicAttributes {
|
|
448
|
-
ref?: (el: Element) => void;
|
|
449
|
-
}
|
|
450
|
-
export type LibraryManagedAttributes<C, P> = ResolveProps<C, P>;
|
|
451
|
-
type RegisteredElements = { [K in keyof CustomElementRegistry]: CustomElementRegistry[K] extends infer C extends AnyElementCtor ? WithJsxNamespaces<MaybeReactiveProps<ElementProps<C>>, InstanceType<C>> : never };
|
|
452
|
-
export type IntrinsicElements = { [K in keyof JSX.IntrinsicElements]: WithJsxNamespaces<JSX.IntrinsicElements[K], IntrinsicElementOf<JSX.IntrinsicElements[K]>> & (IntrinsicElementOf<JSX.IntrinsicElements[K]> extends SVGElement ? SvgNamespaceAttrs : {}) } & RegisteredElements;
|
|
453
|
-
export {};
|
|
454
|
-
}
|
|
455
|
-
//#endregion
|
|
456
|
-
//#region src/jsx-runtime/types.d.ts
|
|
457
|
-
/** An instance created by a component class — must expose `render()`. */
|
|
458
|
-
interface ComponentInstance {
|
|
459
|
-
render(): JSX$1.Element;
|
|
460
|
-
}
|
|
461
|
-
/** A class whose constructor returns a ComponentInstance. */
|
|
462
|
-
type ComponentClass<P extends Record<PropertyKey, unknown> = any> = new (props: P) => ComponentInstance;
|
|
463
|
-
type ComponentFn<P extends Record<PropertyKey, unknown> = any> = (props: ReactiveProps<P>) => JSX$1.Element;
|
|
464
|
-
/** Anything valid as the first arg to `createElement` / a JSX tag target. */
|
|
465
|
-
type Component = NonNullable<JSX$1.Element> | ComponentClass | ComponentFn;
|
|
466
|
-
/** A resolved runtime node — what `applyProps` / `applyChildren` operate on. */
|
|
467
|
-
type PropsTarget = NonNullable<JSX$1.Element> | ComponentInstance;
|
|
468
|
-
/** Anything that can appear as a JSX child. */
|
|
469
|
-
type Child = PrimitiveNodeType | JSX$1.Element | AnyFn | Child[];
|
|
470
|
-
type AnyFn = (...args: any[]) => Child;
|
|
471
|
-
//#endregion
|
|
472
348
|
//#region src/jsx-runtime/infer.d.ts
|
|
473
349
|
type AnyElementCtor = abstract new (...args: any[]) => HTMLElement;
|
|
474
350
|
type Inst<C> = C extends (abstract new (...args: any[]) => infer I) ? I : never;
|
|
@@ -681,4 +557,127 @@ type ComponentProps<C extends ComponentClass<any>> = C extends ComponentClass<in
|
|
|
681
557
|
*/
|
|
682
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>;
|
|
683
559
|
//#endregion
|
|
684
|
-
|
|
560
|
+
//#region src/jsx-runtime/fragment.d.ts
|
|
561
|
+
/**
|
|
562
|
+
* Used by the JSX transform for `<>...</>` fragments.
|
|
563
|
+
*
|
|
564
|
+
* Each child is routed through `mountChild`, which handles Nodes, strings,
|
|
565
|
+
* numbers, arrays, and reactive getters — matching the behavior of any other
|
|
566
|
+
* JSX container. `mountChild` also wires each child's cleanup via its own
|
|
567
|
+
* `effectScope`, which links to the enclosing `effectScope` created by
|
|
568
|
+
* `createElement(Fragment, ...)` for disposal propagation.
|
|
569
|
+
*
|
|
570
|
+
* **Raw HTML mode** — `<Fragment html>{markup}</Fragment>`: the child is a
|
|
571
|
+
* `MaybeReactive<string>` rendered as markup inside a Slot region (comment
|
|
572
|
+
* markers), so the server renderer and the hydration claim pass share the
|
|
573
|
+
* region boundary. Reactive sources re-render the region on change. This is
|
|
574
|
+
* the library's only raw-HTML sink: the string is NOT escaped — sanitize
|
|
575
|
+
* untrusted input at the call site. `<script>` tags never execute.
|
|
576
|
+
*/
|
|
577
|
+
declare function Fragment(props: Props<{
|
|
578
|
+
children: Child;
|
|
579
|
+
}> | {
|
|
580
|
+
html: true;
|
|
581
|
+
children: MaybeReactive<string>;
|
|
582
|
+
}): DocumentFragment;
|
|
583
|
+
//#endregion
|
|
584
|
+
//#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
|
+
declare namespace JSX$1 {
|
|
653
|
+
export type Element = globalThis.Element | globalThis.DocumentFragment;
|
|
654
|
+
export type ElementType = Child | Component;
|
|
655
|
+
export interface ElementChildrenAttribute {
|
|
656
|
+
children: {};
|
|
657
|
+
}
|
|
658
|
+
export interface IntrinsicAttributes {
|
|
659
|
+
ref?: (el: Element) => void;
|
|
660
|
+
}
|
|
661
|
+
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;
|
|
664
|
+
export {};
|
|
665
|
+
}
|
|
666
|
+
//#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;
|
|
671
|
+
}
|
|
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;
|
|
682
|
+
//#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 };
|
package/dist/ui/badge/badge.css
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
border-radius: max(var(--radius-1), var(--radius-pill));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.x-badge:where([data-size="2"]) {
|
|
22
|
+
.x-badge:where([data-size="2"], :not([data-size])) {
|
|
23
23
|
font-size: var(--font-size-1);
|
|
24
24
|
line-height: var(--line-height-1);
|
|
25
25
|
letter-spacing: var(--letter-spacing-1);
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
border-radius: max(var(--radius-2), var(--radius-pill));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.x-badge:where([data-variant="solid"]) {
|
|
40
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"]) {
|
|
41
41
|
background-color: var(--accent-9);
|
|
42
42
|
color: var(--accent-contrast);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.x-badge:where([data-variant="solid"])::selection {
|
|
45
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"])::selection {
|
|
46
46
|
background-color: var(--accent-7);
|
|
47
47
|
color: var(--accent-12);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.x-badge:where([data-variant="solid"]):where([data-high-contrast]) {
|
|
50
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]) {
|
|
51
51
|
background-color: var(--accent-12);
|
|
52
52
|
color: var(--accent-1);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.x-badge:where([data-variant="solid"]):where([data-high-contrast])::selection {
|
|
55
|
+
.x-badge:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast])::selection {
|
|
56
56
|
background-color: var(--accent-a11);
|
|
57
57
|
color: var(--accent-1);
|
|
58
58
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
border-radius: max(var(--radius-1), var(--radius-pill));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.x-button:where([data-size="2"]) {
|
|
36
|
+
.x-button:where([data-size="2"], :not([data-size])) {
|
|
37
37
|
--base-button-height: var(--space-6);
|
|
38
38
|
border-radius: max(var(--radius-2), var(--radius-pill));
|
|
39
39
|
}
|
|
@@ -64,61 +64,61 @@
|
|
|
64
64
|
saturate(1.2);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.x-button:where([data-variant="solid"]) {
|
|
67
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]) {
|
|
68
68
|
background-color: var(--accent-9);
|
|
69
69
|
color: var(--accent-contrast);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
@media (hover: hover) {
|
|
73
|
-
.x-button:where([data-variant="solid"]):where(:hover) {
|
|
73
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:hover) {
|
|
74
74
|
background-color: var(--accent-10);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.x-button:where([data-variant="solid"]):where([data-state="open"]) {
|
|
78
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-state="open"]) {
|
|
79
79
|
background-color: var(--accent-10);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.x-button:where([data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
82
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
83
83
|
background-color: var(--accent-10);
|
|
84
84
|
filter: var(--base-button-solid-active-filter);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@media (pointer: coarse) {
|
|
88
|
-
.x-button:where([data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
88
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:active:not([data-state="open"])) {
|
|
89
89
|
outline: .5em solid var(--accent-a4);
|
|
90
90
|
outline-offset: 0;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.x-button:where([data-variant="solid"]):where(:focus-visible) {
|
|
94
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where(:focus-visible) {
|
|
95
95
|
outline: 2px solid var(--focus-8);
|
|
96
96
|
outline-offset: 2px;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]) {
|
|
99
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]) {
|
|
100
100
|
background-color: var(--accent-12);
|
|
101
101
|
color: var(--neutral-1);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
@media (hover: hover) {
|
|
105
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]):where(:hover) {
|
|
105
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]):where(:hover) {
|
|
106
106
|
background-color: var(--accent-12);
|
|
107
107
|
filter: var(--base-button-solid-high-contrast-hover-filter);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]):where([data-state="open"]) {
|
|
111
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]):where([data-state="open"]) {
|
|
112
112
|
background-color: var(--accent-12);
|
|
113
113
|
filter: var(--base-button-solid-high-contrast-hover-filter);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.x-button:where([data-variant="solid"]):where([data-high-contrast]):where(:active:not([data-state="open"])) {
|
|
116
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-high-contrast]):where(:active:not([data-state="open"])) {
|
|
117
117
|
background-color: var(--accent-12);
|
|
118
118
|
filter: var(--base-button-solid-high-contrast-active-filter);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.x-button:where([data-variant="solid"]):where([data-disabled], :disabled) {
|
|
121
|
+
.x-button:where(:not([data-variant]), [data-variant="solid"]):where([data-disabled], :disabled) {
|
|
122
122
|
color: var(--neutral-a8);
|
|
123
123
|
background-color: var(--neutral-a3);
|
|
124
124
|
filter: none;
|
|
@@ -308,19 +308,19 @@
|
|
|
308
308
|
--button-text-padding-y: var(--space-1);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
.x-button:where([data-size="2"]) {
|
|
311
|
+
.x-button:where([data-size="2"], :not([data-size])) {
|
|
312
312
|
gap: var(--space-2);
|
|
313
313
|
font-size: var(--font-size-2);
|
|
314
314
|
line-height: var(--line-height-2);
|
|
315
315
|
letter-spacing: var(--letter-spacing-2);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
.x-button:where([data-size="2"]):where(:not([data-variant="text"])) {
|
|
318
|
+
.x-button:where([data-size="2"], :not([data-size])):where(:not([data-variant="text"])) {
|
|
319
319
|
padding-left: var(--space-3);
|
|
320
320
|
padding-right: var(--space-3);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
.x-button:where([data-size="2"]):where([data-variant="text"]) {
|
|
323
|
+
.x-button:where([data-size="2"], :not([data-size])):where([data-variant="text"]) {
|
|
324
324
|
gap: var(--space-1);
|
|
325
325
|
--button-text-padding-x: var(--space-2);
|
|
326
326
|
--button-text-padding-y: var(--space-1);
|
package/dist/ui/card/card.css
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
--card-border-radius: var(--radius-6);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
:where([data-neutral]) {
|
|
59
|
+
:where(:root), :where([data-neutral]) {
|
|
60
60
|
--card-surface-box-shadow: 0 0 0 1px var(--neutral-a5);
|
|
61
61
|
--card-surface-hover-box-shadow: 0 0 0 1px var(--neutral-a7);
|
|
62
62
|
--card-surface-active-box-shadow: 0 0 0 1px var(--neutral-a6);
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
@supports (color: color-mix(in oklab, white, black)) {
|
|
84
|
-
:where([data-neutral]) {
|
|
84
|
+
:where(:root), :where([data-neutral]) {
|
|
85
85
|
--card-surface-box-shadow: 0 0 0 1px
|
|
86
86
|
color-mix(in oklab, var(--neutral-a5), var(--neutral-5) 25%);
|
|
87
87
|
--card-surface-hover-box-shadow: 0 0 0 1px
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.x-group {
|
|
2
|
+
vertical-align: top;
|
|
3
|
+
isolation: isolate;
|
|
4
|
+
align-items: stretch;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.x-group > :is(.x-text-input, .x-select) {
|
|
9
|
+
flex: auto;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle) {
|
|
14
|
+
z-index: 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):where(:hover, :focus-within) {
|
|
19
|
+
z-index: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:first-child) {
|
|
23
|
+
margin-inline-start: -1px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:last-child) {
|
|
27
|
+
border-start-end-radius: 0;
|
|
28
|
+
border-end-end-radius: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:first-child) {
|
|
32
|
+
border-start-start-radius: 0;
|
|
33
|
+
border-end-start-radius: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.x-group > .x-text-input:not(:last-child) > input {
|
|
37
|
+
border-start-end-radius: 0;
|
|
38
|
+
border-end-end-radius: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.x-group > .x-text-input:not(:first-child) > input {
|
|
42
|
+
border-start-start-radius: 0;
|
|
43
|
+
border-end-start-radius: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.x-group > .x-button[data-variant="solid"] + .x-button[data-variant="solid"] {
|
|
47
|
+
box-shadow: inset 1px 0 0 0
|
|
48
|
+
color-mix(in srgb, var(--accent-contrast) 20%, transparent);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[dir="rtl"] .x-group > .x-button[data-variant="solid"] + .x-button[data-variant="solid"] {
|
|
52
|
+
box-shadow: inset -1px 0 0 0
|
|
53
|
+
color-mix(in srgb, var(--accent-contrast) 20%, transparent);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (forced-colors: active) {
|
|
57
|
+
.x-group > :is(.x-button, .x-text-input, .x-select, .x-toggle):not(:first-child) {
|
|
58
|
+
border-inline-start: 1px solid buttontext;
|
|
59
|
+
margin-inline-start: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-3r7Diua4.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/otp-input/otp-input.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `<x-otp-input>` — segmented one-time-passcode / pin input.
|
|
6
|
+
*
|
|
7
|
+
* A single transparent `<input>` (rendered into the shadow root) overlays the
|
|
8
|
+
* author-composed cells and owns all keyboard / pointer / paste / mobile
|
|
9
|
+
* autofill behavior. The cells (`<x-otp-slot>`, projected through a `<slot>`)
|
|
10
|
+
* are a purely visual layer whose active cell + fake caret are mirrored from
|
|
11
|
+
* the input's selection. Because it is one field there is no roving tabindex
|
|
12
|
+
* and a screen reader perceives a single textbox.
|
|
13
|
+
*
|
|
14
|
+
* Form-associated: submits under the host `name`, participates in
|
|
15
|
+
* reset / restore / disabled, and reports `valueMissing` / `tooShort`.
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <x-otp-input name="code" maxlength="6" pattern="[0-9]" aria-label="Code">
|
|
19
|
+
* <x-otp-group>
|
|
20
|
+
* <x-otp-slot index="0"></x-otp-slot>
|
|
21
|
+
* <x-otp-slot index="1"></x-otp-slot>
|
|
22
|
+
* <x-otp-slot index="2"></x-otp-slot>
|
|
23
|
+
* </x-otp-group>
|
|
24
|
+
* <x-otp-separator></x-otp-separator>
|
|
25
|
+
* <x-otp-group>
|
|
26
|
+
* <x-otp-slot index="3"></x-otp-slot>
|
|
27
|
+
* <x-otp-slot index="4"></x-otp-slot>
|
|
28
|
+
* <x-otp-slot index="5"></x-otp-slot>
|
|
29
|
+
* </x-otp-group>
|
|
30
|
+
* </x-otp-input>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare class XOtpInput extends HTMLElement {
|
|
34
|
+
#private;
|
|
35
|
+
static formAssociated: boolean;
|
|
36
|
+
static [ATTRIBUTES]: {
|
|
37
|
+
value(this: XOtpInput, value: string | null): void;
|
|
38
|
+
maxlength(this: XOtpInput, value: string | null): void;
|
|
39
|
+
disabled(this: XOtpInput, value: string | null): void;
|
|
40
|
+
required(this: XOtpInput, value: string | null): void;
|
|
41
|
+
pattern(this: XOtpInput, value: string | null): void;
|
|
42
|
+
inputmode(this: XOtpInput, value: string | null): void;
|
|
43
|
+
};
|
|
44
|
+
static observedAttributes: string[];
|
|
45
|
+
static events: {
|
|
46
|
+
complete: CustomEvent<string>;
|
|
47
|
+
};
|
|
48
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
49
|
+
get value(): string;
|
|
50
|
+
set value(v: string);
|
|
51
|
+
get maxLength(): number;
|
|
52
|
+
set maxLength(v: number);
|
|
53
|
+
get disabled(): boolean;
|
|
54
|
+
set disabled(v: boolean);
|
|
55
|
+
get required(): boolean;
|
|
56
|
+
set required(v: boolean);
|
|
57
|
+
get pattern(): string | null;
|
|
58
|
+
set pattern(v: string | null);
|
|
59
|
+
get name(): string;
|
|
60
|
+
set name(v: string);
|
|
61
|
+
/** Optional transform applied to pasted text before validation. */
|
|
62
|
+
pasteTransformer: ((text: string) => string) | null;
|
|
63
|
+
connectedCallback(): void;
|
|
64
|
+
disconnectedCallback(): void;
|
|
65
|
+
formResetCallback(): void;
|
|
66
|
+
formStateRestoreCallback(state: unknown): void;
|
|
67
|
+
formDisabledCallback(disabled: boolean): void;
|
|
68
|
+
get validity(): ValidityState | null;
|
|
69
|
+
}
|
|
70
|
+
declare global {
|
|
71
|
+
namespace ElementsKit {
|
|
72
|
+
interface CustomElementRegistry {
|
|
73
|
+
"x-otp-input": typeof XOtpInput;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/ui/otp-input/otp-slot.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* `<x-otp-slot index="N">` — one visual cell of an `<x-otp-input>`. Purely
|
|
81
|
+
* presentational: `aria-hidden`, no focus, no value of its own. The parent
|
|
82
|
+
* `<x-otp-input>` paints its character and active / caret / disabled state by
|
|
83
|
+
* index; all styling lives in the companion CSS.
|
|
84
|
+
*/
|
|
85
|
+
declare class XOtpSlot extends HTMLElement {
|
|
86
|
+
static [ATTRIBUTES]: {
|
|
87
|
+
index: AttrChangeHandler<XOtpSlot>;
|
|
88
|
+
};
|
|
89
|
+
connectedCallback(): void;
|
|
90
|
+
}
|
|
91
|
+
declare global {
|
|
92
|
+
namespace ElementsKit {
|
|
93
|
+
interface CustomElementRegistry {
|
|
94
|
+
"x-otp-slot": typeof XOtpSlot;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/ui/otp-input/otp-group.d.ts
|
|
100
|
+
/**
|
|
101
|
+
* `<x-otp-group>` — presentational container that joins a run of
|
|
102
|
+
* `<x-otp-slot>`s into one attached group. All layout lives in CSS; this only
|
|
103
|
+
* applies a `group` role so the visual grouping is exposed to assistive tech.
|
|
104
|
+
*/
|
|
105
|
+
declare class XOtpGroup extends HTMLElement {
|
|
106
|
+
connectedCallback(): void;
|
|
107
|
+
}
|
|
108
|
+
declare global {
|
|
109
|
+
namespace ElementsKit {
|
|
110
|
+
interface CustomElementRegistry {
|
|
111
|
+
"x-otp-group": typeof XOtpGroup;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/ui/otp-input/otp-separator.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* `<x-otp-separator>` — decorative divider authored between OTP groups (e.g. a
|
|
119
|
+
* dash between a 3-3 split). Purely visual: `aria-hidden`, glyph drawn in CSS.
|
|
120
|
+
*/
|
|
121
|
+
declare class XOtpSeparator extends HTMLElement {
|
|
122
|
+
connectedCallback(): void;
|
|
123
|
+
}
|
|
124
|
+
declare global {
|
|
125
|
+
namespace ElementsKit {
|
|
126
|
+
interface CustomElementRegistry {
|
|
127
|
+
"x-otp-separator": typeof XOtpSeparator;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { XOtpGroup, XOtpInput, XOtpSeparator, XOtpSlot };
|