praxis-kit 0.1.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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -0
  3. package/dist/_shared/diagnostics.d.ts +312 -0
  4. package/dist/_shared/diagnostics.js +360 -0
  5. package/dist/build-runtime-CJ_nQEaZ.js +5065 -0
  6. package/dist/codemod/index.d.ts +2 -0
  7. package/dist/codemod/index.js +176520 -0
  8. package/dist/contract/index.d.ts +677 -0
  9. package/dist/contract/index.js +341 -0
  10. package/dist/eslint/index.d.ts +90 -0
  11. package/dist/eslint/index.js +1047 -0
  12. package/dist/guards/index.d.ts +78 -0
  13. package/dist/guards/index.js +118 -0
  14. package/dist/html/index.d.ts +151 -0
  15. package/dist/html/index.js +1244 -0
  16. package/dist/index-BIBd_iPD.d.ts +951 -0
  17. package/dist/lit/index.d.ts +862 -0
  18. package/dist/lit/index.js +4893 -0
  19. package/dist/preact/index.d.ts +796 -0
  20. package/dist/preact/index.js +5043 -0
  21. package/dist/react/index.d.ts +28 -0
  22. package/dist/react/index.js +205 -0
  23. package/dist/react/legacy.d.ts +29 -0
  24. package/dist/react/legacy.js +80 -0
  25. package/dist/solid/index.d.ts +728 -0
  26. package/dist/solid/index.js +4821 -0
  27. package/dist/svelte/Polymorphic.svelte +190 -0
  28. package/dist/svelte/_polymorphic-runtime.d.ts +102 -0
  29. package/dist/svelte/_polymorphic-runtime.js +371 -0
  30. package/dist/svelte/index.d.ts +994 -0
  31. package/dist/svelte/index.js +4482 -0
  32. package/dist/tailwind/index.d.ts +197 -0
  33. package/dist/tailwind/index.js +767 -0
  34. package/dist/tailwind/safelist.css +20 -0
  35. package/dist/ts-plugin/index.cjs +166 -0
  36. package/dist/ts-plugin/index.d.cts +9 -0
  37. package/dist/utils/index.d.ts +19 -0
  38. package/dist/utils/index.js +21 -0
  39. package/dist/vite-plugin/index.d.ts +200 -0
  40. package/dist/vite-plugin/index.js +2106 -0
  41. package/dist/vue/index.d.ts +729 -0
  42. package/dist/vue/index.js +4945 -0
  43. package/dist/web/index.d.ts +832 -0
  44. package/dist/web/index.js +4868 -0
  45. package/package.json +258 -0
@@ -0,0 +1,862 @@
1
+ import "clsx";
2
+ import { DiagnosticCode, DiagnosticInput, Diagnostics, DiagnosticsMode } from "../_shared/diagnostics.js";
3
+ import { LitElement } from "lit";
4
+ import { OmitIndexSignature, ReadonlyDeep, RequireAtLeastOne, Simplify } from "type-fest";
5
+ //#region ../../lib/foundation/src/string-map.d.ts
6
+ /**
7
+ * A string-keyed object whose values are of type `T`.
8
+ */
9
+ type StringMap<T = unknown> = Record<string, T>;
10
+ /**
11
+ * A string-keyed object with values of unknown type.
12
+ */
13
+ type AnyRecord = StringMap<unknown>;
14
+ //#endregion
15
+ //#region ../../lib/primitive/src/types/any-record.d.ts
16
+ /**
17
+ * An object type with no named properties.
18
+ *
19
+ * Unlike `{}`, this excludes arbitrary properties during type operations while
20
+ * still satisfying `extends object`.
21
+ */
22
+ type EmptyRecord = Record<never, never>;
23
+ /**
24
+ * A compound component's named sub-components, for example
25
+ * `{ Header, Content, Footer }`.
26
+ */
27
+ type SubComponentMap = Readonly<AnyRecord>;
28
+ /**
29
+ * Default `Variants` type for components that declare no variants.
30
+ *
31
+ * Structurally identical to `Readonly<EmptyRecord>`, but named separately so
32
+ * editor hovers remain self-descriptive.
33
+ */
34
+ type NoVariants = Readonly<EmptyRecord>;
35
+ /**
36
+ * Default `TPreset` type for components that declare no named presets.
37
+ *
38
+ * Structurally identical to `Readonly<EmptyRecord>`, but named separately so
39
+ * editor hovers remain self-descriptive.
40
+ */
41
+ type NoPreset = Readonly<EmptyRecord>;
42
+ /**
43
+ * Fallback for `ExtractPluginProps<TPlugin>` when a plugin contributes no
44
+ * props, including the no-plugin case.
45
+ *
46
+ * Structurally identical to `EmptyRecord`, but named separately so editor
47
+ * hovers remain self-descriptive.
48
+ */
49
+ type NoPluginProps = EmptyRecord;
50
+ /**
51
+ * Determines whether an object type should be treated as empty.
52
+ *
53
+ * `keyof T` ignores call and construct signatures...
54
+ */
55
+ type IsEmptyRecord<T extends object> = T extends ((...args: never[]) => unknown) ? false : T extends (new (...args: never[]) => unknown) ? false : keyof T extends never ? true : false;
56
+ /**
57
+ * Merges two object types while eliding empty operands.
58
+ *
59
+ * If either operand is {@link EmptyRecord}, the other operand is returned
60
+ * directly instead of producing intersections such as
61
+ * `Component & EmptyRecord` in editor hovers.
62
+ *
63
+ * Unlike a homomorphic mapped type (for example `Simplify<T>`), this preserves
64
+ * call and construct signatures. Many component types are callable objects,
65
+ * and mapped types silently discard those signatures.
66
+ *
67
+ * @remarks
68
+ * Instantiate `MergeRecords` directly. Introducing an intermediate alias for
69
+ * one operand (for example `type C = PolymorphicComponent<G>`) can prevent
70
+ * `IsEmptyRecord` from evaluating eagerly, which breaks assignability under
71
+ * `exactOptionalPropertyTypes`.
72
+ */
73
+ type MergeRecords<A extends object, B extends object> = IsEmptyRecord<A> extends true ? B : IsEmptyRecord<B> extends true ? A : A & B;
74
+ //#endregion
75
+ //#region ../../lib/primitive/src/types/intrinsic-tag.d.ts
76
+ type IntrinsicTag = keyof HTMLElementTagNameMap;
77
+ //#endregion
78
+ //#region ../../lib/primitive/src/types/element-type.d.ts
79
+ type ElementType = IntrinsicTag | (string & {});
80
+ /**
81
+ * Resolves a component's default tag to its real DOM interface — `HTMLDialogElement` for
82
+ * `'dialog'`, `HTMLDetailsElement` for `'details'`, and so on — falling back to `HTMLElement`
83
+ * for custom-element tags or anything not in `HTMLElementTagNameMap`. Used to type
84
+ * `FactoryOptions.onElement`'s `element` param so component authors get direct, correctly-typed
85
+ * access to tag-specific native members (`dialogEl.showModal()`) without an unsafe cast.
86
+ *
87
+ * The fallback is `HTMLElement`, not the more generic `Element` — every tag reachable through
88
+ * `IntrinsicTag` extends it, and so does every custom element per spec, so members `HTMLElement`
89
+ * itself declares (`showPopover()`/`hidePopover()`/`togglePopover()`, the `popover` attribute)
90
+ * stay directly accessible even for tags with no dedicated entry in `HTMLElementTagNameMap`.
91
+ */
92
+ type ElementForTag<TDefault extends ElementType> = TDefault extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TDefault] : HTMLElement;
93
+ //#endregion
94
+ //#region ../../lib/primitive/src/constants/aria/known-aria-roles.d.ts
95
+ declare const KNOWN_ARIA_ROLES: readonly ["alert", "alertdialog", "application", "article", "banner", "blockquote", "button", "caption", "cell", "checkbox", "code", "columnheader", "combobox", "complementary", "contentinfo", "definition", "deletion", "dialog", "document", "emphasis", "feed", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "insertion", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "strong", "subscript", "superscript", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "time", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem"];
96
+ type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
97
+ //#endregion
98
+ //#region ../../lib/primitive/src/types/primitives/index.d.ts
99
+ type Booleanish = boolean | 'true' | 'false';
100
+ type ClassName = string | string[];
101
+ type NonEmptyArray<T> = [T, ...T[]];
102
+ type Numberish = number | `${number}`;
103
+ type Primitive = string | number | boolean;
104
+ type AriaRole = KnownAriaRole | (string & {});
105
+ type IntrinsicProps = AnyRecord & {
106
+ role?: AriaRole;
107
+ };
108
+ type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
109
+ //#endregion
110
+ //#region ../../lib/primitive/src/types/contracts/cardinality.d.ts
111
+ type MinMax = {
112
+ min: number;
113
+ max: number;
114
+ };
115
+ type CardinalityInput = Partial<MinMax>;
116
+ //#endregion
117
+ //#region ../../lib/primitive/src/types/contracts/child-rule-context.d.ts
118
+ /**
119
+ * Resolved per-instance state available to a dynamic (`dynamic(...)`) child
120
+ * rule field — the same tag/props every adapter already computes before
121
+ * evaluating children, exposed so a rule can vary by them (e.g. cardinality
122
+ * that depends on the resolved `as` tag).
123
+ */
124
+ type ChildRuleContext = {
125
+ readonly tag: unknown;
126
+ readonly props: Readonly<AnyRecord>;
127
+ };
128
+ //#endregion
129
+ //#region ../../lib/primitive/src/rule/rule-brand.d.ts
130
+ declare const RULE_BRAND: unique symbol;
131
+ //#endregion
132
+ //#region ../../lib/primitive/src/types/rule/dynamic-rule.d.ts
133
+ type DynamicRule<T, C = unknown> = {
134
+ readonly [RULE_BRAND]: true;
135
+ resolve(context: C): T;
136
+ };
137
+ //#endregion
138
+ //#region ../../lib/primitive/src/types/rule/rule.d.ts
139
+ type Rule<T, C = unknown> = T | DynamicRule<T, C>;
140
+ //#endregion
141
+ //#region ../../lib/primitive/src/types/contracts/child-rule-match.d.ts
142
+ type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
143
+ //#endregion
144
+ //#region ../../lib/primitive/src/types/contracts/child-rule-position.d.ts
145
+ type ChildRulePosition = 'first' | 'last' | 'any';
146
+ //#endregion
147
+ //#region ../../lib/primitive/src/types/contracts/child-rule-input.d.ts
148
+ type ChildRuleInput<T = unknown, U extends T = T> = {
149
+ name: string;
150
+ match: ChildRuleMatch<T, U>;
151
+ /**
152
+ * Either a static cardinality, or `dynamic((ctx) => ...)` to derive it from
153
+ * the resolved tag/props (e.g. a different max depending on `as`). `match`
154
+ * stays static-only — it's already a function, so a dynamic wrapper would
155
+ * be indistinguishable from the predicate itself without one.
156
+ */
157
+ cardinality?: Rule<CardinalityInput, ChildRuleContext>;
158
+ position?: ChildRulePosition;
159
+ /**
160
+ * Optional component-type reference for O(1) dispatch index.
161
+ * When provided for every rule, the matcher reads child.type instead of
162
+ * calling every match function on every child (O(n×m) → O(n+m)).
163
+ */
164
+ type?: unknown;
165
+ };
166
+ //#endregion
167
+ //#region ../../lib/primitive/src/types/validation/valid-result.d.ts
168
+ type ValidResult = {
169
+ valid: true;
170
+ };
171
+ //#endregion
172
+ //#region ../../lib/primitive/src/types/variants/string-to-boolean.d.ts
173
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
174
+ //#endregion
175
+ //#region ../../lib/primitive/src/types/variants/variant-value.d.ts
176
+ type VariantValue = string | string[];
177
+ //#endregion
178
+ //#region ../../lib/primitive/src/types/variants/variant-states.d.ts
179
+ type VariantStates<K extends string = string> = Record<K, VariantValue>;
180
+ //#endregion
181
+ //#region ../../lib/primitive/src/types/variants/variant-map.d.ts
182
+ type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
183
+ //#endregion
184
+ //#region ../../lib/primitive/src/types/variants/variant-key.d.ts
185
+ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
186
+ //#endregion
187
+ //#region ../../lib/primitive/src/types/variants/variant-selection.d.ts
188
+ /**
189
+ * A partial selection of variant states authored at factory definition time.
190
+ *
191
+ * Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
192
+ * resolve the union at constraint-check time without deferred conditional types.
193
+ */
194
+ type VariantSelection<V extends VariantMap> = { [K in keyof V]?: keyof V[K]; };
195
+ //#endregion
196
+ //#region ../../lib/primitive/src/types/variants/variant-props.d.ts
197
+ /** The full optional prop surface exposed to callers for a given variant map. */
198
+ type VariantProps<V extends VariantMap> = { [K in keyof V]?: VariantKey<V, K>; };
199
+ //#endregion
200
+ //#region ../../lib/primitive/src/types/variants/default-variants.d.ts
201
+ type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
202
+ type DefaultVariants<V extends VariantMap> = { [K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>; };
203
+ //#endregion
204
+ //#region ../../lib/primitive/src/types/variants/recipe-map.d.ts
205
+ /**
206
+ * A static, immutable map of named presets to partial variant selections.
207
+ *
208
+ * Presets are named bundles of variant props that callers activate by key,
209
+ * avoiding the need to repeat variant combinations at each call site.
210
+ */
211
+ type RecipeMap<V extends VariantMap = VariantMap> = Readonly<StringMap<VariantSelection<V>>>;
212
+ //#endregion
213
+ //#region ../../lib/primitive/src/types/variants/recipe-target.d.ts
214
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
215
+ //#endregion
216
+ //#region ../../lib/primitive/src/types/variants/polymorphic-generics.d.ts
217
+ /**
218
+ * The framework-neutral descriptor for a single praxis-kit component's contract — every render
219
+ * mechanism (tag resolution, prop merging, classes, ARIA) and every framework adapter's
220
+ * component type is built from this one shape. Deliberately just data: five type parameters and
221
+ * their corresponding properties, with no notion of JSX, call signatures, refs, or any
222
+ * framework-specific rendering concern. Each adapter (React, Vue, Svelte, Solid, Lit, Web) builds
223
+ * its own idiomatic component type on top of a `PolymorphicGenerics<...>` instantiation — see
224
+ * `PolymorphicComponent<G>` (`adapters/react/src/shared/types/polymorphic-props.ts`) for the
225
+ * React example — rather than this interface knowing anything about any of them.
226
+ *
227
+ * Use the `*Of<T>` accessor aliases below (`DefaultOf<G>`, `PropsOf<G>`, etc.) to read a single
228
+ * field back out of an already-resolved `G`, instead of indexing `G['default']` etc. directly at
229
+ * call sites — same rationale as any accessor: the property name stays an implementation detail,
230
+ * and every reader benefits together if it ever needs to change.
231
+ */
232
+ interface PolymorphicGenerics<
233
+ /**
234
+ * The element/tag this component renders as when the consumer doesn't override it via `as`
235
+ * (`AllowedOf<G>` permitting) — e.g. `'button'`, `'div'`. Defaults to the widest `ElementType`
236
+ * so a generic `PolymorphicGenerics` reference (with nothing else specified) still compiles.
237
+ */
238
+ TDefault extends ElementType = ElementType,
239
+ /**
240
+ * The props this specific component declares — its own contract, before variants are mixed
241
+ * in. Defaults to `AnyRecord` for the same "still compiles unspecified" reason as `TDefault`.
242
+ */
243
+ Props extends AnyRecord = AnyRecord,
244
+ /**
245
+ * This component's variant definitions (e.g. `{ intent: { primary: ..., ghost: ... } }`).
246
+ * Constrained to `Readonly<VariantMap>` — not the wider `AnyRecord` — specifically so `TPreset`
247
+ * below can be expressed as `RecipeMap<Variants>` and get real per-variant-key checking,
248
+ * instead of falling back to an unconstrained `RecipeMap<VariantMap>`.
249
+ */
250
+ Variants extends Readonly<VariantMap> = Readonly<VariantMap>,
251
+ /**
252
+ * Named presets (`RecipeMap<Variants>`) — bundles of variant selections a consumer activates
253
+ * by key instead of repeating the same variant combination at every call site. Tied to
254
+ * `Variants`, not `AnyRecord`, precisely so a preset can only ever select keys/values that
255
+ * `Variants` actually defines — an invalid preset is a type error, not a silent no-op.
256
+ * Defaults to `Readonly<EmptyRecord>` (no presets), which is the common case: a component can
257
+ * have variants without necessarily defining any named presets over them, and most don't.
258
+ */
259
+ TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>,
260
+ /**
261
+ * The set of elements/tags a consumer is allowed to switch to via `as`. Defaults to the widest
262
+ * `ElementType`, under which `AllowedOf<G>` imposes no restriction at all (see
263
+ * `PolymorphicControlProps.as`'s own comment in the React adapter for the concrete effect this
264
+ * has at a component's actual call site).
265
+ */
266
+ TAllowed extends ElementType = ElementType> {
267
+ default: TDefault;
268
+ props: Props;
269
+ variants: Variants;
270
+ preset: TPreset;
271
+ allowed: TAllowed;
272
+ }
273
+ /** This component's variant definitions. See `PolymorphicGenerics`'s `Variants` parameter. */
274
+ type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
275
+ /** This component's named presets. See `PolymorphicGenerics`'s `TPreset` parameter. */
276
+ type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
277
+ /** This component's own declared props, before variants are mixed in. See `PolymorphicGenerics`'s
278
+ * `Props` parameter. */
279
+ type PropsOf<T extends PolymorphicGenerics> = T['props'];
280
+ //#endregion
281
+ //#region ../../lib/primitive/src/types/variants/compound/compound-variant.d.ts
282
+ type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
283
+ type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
284
+ type CompoundVariantConditions<V extends VariantMap> = Simplify<{ [K in keyof V]: CompoundVariantConditionValue<V, K>; }>;
285
+ type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
286
+ type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
287
+ type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
288
+ class: VariantValue;
289
+ };
290
+ //#endregion
291
+ //#region ../../lib/primitive/src/types/variants/compound/cva-compounds.d.ts
292
+ interface CVACompounds<V extends VariantMap> {
293
+ compoundVariants?: readonly CompoundVariant<V>[];
294
+ }
295
+ //#endregion
296
+ //#region ../../lib/primitive/src/types/variants/compound/cva-defaults.d.ts
297
+ interface CVADefaults<V extends VariantMap> {
298
+ defaultVariants?: DefaultVariants<V>;
299
+ }
300
+ //#endregion
301
+ //#region ../../lib/primitive/src/types/variants/compound/cva-variants.d.ts
302
+ interface CVAVariants<V extends VariantMap> {
303
+ variants?: V;
304
+ }
305
+ //#endregion
306
+ //#region ../../lib/primitive/src/types/pipeline/base-class-options.d.ts
307
+ interface BaseClassOptions {
308
+ baseClassName?: ClassName;
309
+ }
310
+ //#endregion
311
+ //#region ../../lib/primitive/src/types/pipeline/class-pipeline-fn.d.ts
312
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
313
+ //#endregion
314
+ //#region ../../lib/primitive/src/types/pipeline/recipe-options.d.ts
315
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
316
+ recipeMap?: StringMap<RecipeTarget<TVariants>>;
317
+ }
318
+ //#endregion
319
+ //#region ../../lib/primitive/src/types/pipeline/tag-map-options.d.ts
320
+ interface TagMapOptions {
321
+ tagMap?: TagMap;
322
+ }
323
+ //#endregion
324
+ //#region ../../lib/primitive/src/types/pipeline/composition-options.d.ts
325
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
326
+ //#endregion
327
+ //#region ../../lib/primitive/src/types/pipeline/cva-system-options.d.ts
328
+ type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
329
+ //#endregion
330
+ //#region ../../lib/primitive/src/types/pipeline/style-options.d.ts
331
+ type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
332
+ //#endregion
333
+ //#region ../../lib/primitive/src/types/pipeline/class-pipeline-options.d.ts
334
+ type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
335
+ //#endregion
336
+ //#region ../../lib/primitive/src/types/class/owned-prop-keys.d.ts
337
+ type OwnedPropKeys = ReadonlySet<string>;
338
+ //#endregion
339
+ //#region ../../lib/primitive/src/types/class/class-plugin.d.ts
340
+ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
341
+ pipeline: ClassPipelineFn;
342
+ ownedKeys?: OwnedPropKeys;
343
+ readonly _pluginProps?: TProps;
344
+ }>;
345
+ //#endregion
346
+ //#region ../../lib/primitive/src/types/class/class-plugin-factory.d.ts
347
+ type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics) => ClassPlugin<TProps>;
348
+ /** `ClassPluginFactory` with its plugin-owned-props generic erased — the common form used
349
+ * wherever a factory's concrete plugin-props shape isn't tracked (factory generics,
350
+ * capability wiring). */
351
+ type AnyClassPluginFactory = ClassPluginFactory<AnyRecord> | undefined;
352
+ type ExtractPluginProps<TPlugin extends AnyClassPluginFactory> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? NoPluginProps : T : NoPluginProps;
353
+ //#endregion
354
+ //#region ../../lib/primitive/src/types/aria-rule/aria-context.d.ts
355
+ type AriaContext = {
356
+ /**
357
+ * The intrinsic HTML tag being evaluated.
358
+ */
359
+ readonly tag: IntrinsicTag;
360
+ /**
361
+ * The implicit ARIA role associated with the intrinsic tag.
362
+ */
363
+ readonly implicitRole: AriaRole | undefined;
364
+ /**
365
+ * The effective ARIA role after considering the element's explicit
366
+ * `role` attribute or component-provided role.
367
+ */
368
+ readonly effectiveRole: string | undefined;
369
+ /**
370
+ * The component's props available to the ARIA policy engine.
371
+ */
372
+ readonly props: ReadonlyDeep<IntrinsicProps>;
373
+ /**
374
+ * Variant prop names declared by the component.
375
+ *
376
+ * The adapter uses these names to determine which props are intercepted
377
+ * before reaching the DOM. A rule asserting a fact about a real HTML
378
+ * attribute should therefore treat a key present here as a component
379
+ * variant rather than a DOM attribute.
380
+ *
381
+ * An empty set indicates no variant props are declared — the case for
382
+ * evaluations with no factory context, such as `AriaPolicyEngine.evaluate`.
383
+ */
384
+ readonly variantKeys: ReadonlySet<string>;
385
+ };
386
+ //#endregion
387
+ //#region ../../lib/primitive/src/types/aria-rule/fix-kind.d.ts
388
+ type RemoveAttributeFixKind = 'removeAttribute';
389
+ type InjectLiveFixKind = 'injectLive';
390
+ type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
391
+ //#endregion
392
+ //#region ../../lib/primitive/src/types/aria-rule/aria-fix.d.ts
393
+ type AriaFixResult = {
394
+ applied: false;
395
+ next: ReadonlyDeep<IntrinsicProps>;
396
+ } | {
397
+ applied: true;
398
+ next: ReadonlyDeep<IntrinsicProps>;
399
+ previous: ReadonlyDeep<IntrinsicProps>;
400
+ };
401
+ type AriaFix = {
402
+ readonly kind: FixKind;
403
+ /** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
404
+ * kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
405
+ readonly attribute?: string;
406
+ readonly priority?: number;
407
+ readonly source?: string;
408
+ readonly apply: (context: AriaContext) => AriaFixResult;
409
+ };
410
+ //#endregion
411
+ //#region ../../lib/primitive/src/types/aria-rule/severity.d.ts
412
+ type Severity = 'error' | 'warning' | (string & {});
413
+ //#endregion
414
+ //#region ../../lib/primitive/src/types/aria-rule/aria-result.d.ts
415
+ type AriaInvalidBase<M extends string = string> = {
416
+ valid: false;
417
+ severity: Severity;
418
+ message?: M;
419
+ attribute?: string;
420
+ diagnostic?: DiagnosticInput;
421
+ };
422
+ type AriaInvalidWithFix<M extends string = string> = AriaInvalidBase<M> & {
423
+ fixable: true;
424
+ fix: AriaFix;
425
+ };
426
+ type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
427
+ fixable: false;
428
+ };
429
+ type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
430
+ type AriaResult = ValidResult | AriaInvalidResult;
431
+ //#endregion
432
+ //#region ../../lib/primitive/src/types/aria-rule/aria-rule.d.ts
433
+ type AriaRule<C extends AriaContext = AriaContext> = ((context: C) => readonly AriaResult[]) & {
434
+ readonly readsProps?: readonly string[];
435
+ readonly tags?: readonly string[];
436
+ };
437
+ //#endregion
438
+ //#region ../../lib/primitive/src/types/factory/prop-normalizer.d.ts
439
+ type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
440
+ //#endregion
441
+ //#region ../../lib/primitive/src/types/factory/enforcement-options.d.ts
442
+ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
443
+ /**
444
+ * Accepts a preset name (`'warn'`, `'throw'`, `'silent'`) or a full `Diagnostics`
445
+ * instance for custom reporting/policy. The string form needs no import from
446
+ * `@praxis-kit/diagnostics`.
447
+ */
448
+ readonly diagnostics?: Diagnostics | DiagnosticsMode;
449
+ /**
450
+ * ARIA/accessibility rules evaluated against the resolved tag and props on every render.
451
+ * Each rule is a function receiving the current context and returning zero or more
452
+ * violations, some of which can carry an auto-applicable fix (see `createRemoveAttributeRule`
453
+ * and friends in `praxis-kit/contract`).
454
+ */
455
+ readonly aria?: readonly AriaRule[];
456
+ /**
457
+ * Rules that need `AriaPolicyEngine`'s fix-application/caching machinery
458
+ * (`AriaRule`'s `readsProps`, fixable `AriaFix` results) but have no
459
+ * relationship to ARIA semantics — an HTML fact or a security check like a
460
+ * dangerous-URL-scheme guard, for example. Evaluated together with `aria`
461
+ * (both run through the same engine, merged into one rule set) — this is a
462
+ * separate bucket purely so a non-ARIA rule doesn't have to sit under the
463
+ * misleading `aria` name to get the machinery it needs.
464
+ */
465
+ readonly rules?: readonly AriaRule[];
466
+ /**
467
+ * Declares which children are valid, by name, match predicate, and cardinality (e.g. "at
468
+ * least 1, at most 4 `Button` children"). Open by default — children matching no rule are
469
+ * still allowed unless `exclusiveChildren` is set.
470
+ */
471
+ readonly children?: readonly ChildRuleInput[];
472
+ /**
473
+ * When true, only children matching a `children` rule (or text, per `allowText`)
474
+ * are valid — anything else is rejected. Default: false (open — children not
475
+ * matching any rule are allowed).
476
+ */
477
+ readonly exclusiveChildren?: boolean;
478
+ /**
479
+ * When false, text/number child nodes are rejected regardless of exclusiveChildren
480
+ * or any listed rule. Default: true.
481
+ */
482
+ readonly allowText?: boolean;
483
+ /**
484
+ * Prop transforms composed with the component's own `normalize` (from `FactoryOptions`) and
485
+ * run before it. Unlike `normalize`, these live in the enforcement bucket because they
486
+ * typically encode a built-in HTML/ARIA fact rather than component-specific behavior.
487
+ */
488
+ readonly props?: readonly PropNormalizer[];
489
+ /** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
490
+ readonly allowedAs?: readonly TAllowed[];
491
+ };
492
+ //#endregion
493
+ //#region ../../lib/primitive/src/types/factory/styling-options.d.ts
494
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory> = {
495
+ /** Class applied to every instance regardless of variant selection. */
496
+ readonly base?: ClassName;
497
+ /**
498
+ * Named variant groups (e.g. `intent`, `size`), each mapping its possible values to a
499
+ * class string. A consumer selects a value per group as a prop (`<Button intent="primary">`).
500
+ */
501
+ readonly variants?: V;
502
+ /** Value used for a variant group when the consumer doesn't pass one explicitly. */
503
+ readonly defaults?: Partial<DefaultVariants<V>>;
504
+ /**
505
+ * Applies an extra class only when a specific *combination* of variant selections matches —
506
+ * for cases `variants` alone can't express (e.g. `intent: 'primary'` + `size: 'lg'` together
507
+ * need a class neither variant would add on its own).
508
+ */
509
+ readonly compounds?: readonly CompoundVariant<V>[];
510
+ /**
511
+ * Named bundles of variant values a component defines up front. A caller activates one by name
512
+ * through the `recipe` prop (e.g. `<Button recipe="cta">` instead of setting `intent`/`size`
513
+ * individually) — `presets` is the store, `recipe` is the selector, which is why the field and
514
+ * the prop read differently. Explicit props always win over the activated bundle. The value type
515
+ * is `RecipeMap` (see `lib/primitive/src/types/variants/recipe-map.ts`).
516
+ */
517
+ readonly presets?: TPreset;
518
+ /** Maps a resolved tag directly to a raw class string, independent of the variant system. */
519
+ readonly tags?: Readonly<TagMap>;
520
+ /**
521
+ * A `ClassPluginFactory` (e.g. the Tailwind layout pipeline) that extends class resolution
522
+ * with its own owned props, layered on top of `variants`/`presets`/`tags`.
523
+ */
524
+ readonly plugin?: TPlugin;
525
+ /**
526
+ * A cache-key → resolved-class-string lookup for every statically-known variant
527
+ * combination, skipping runtime class computation entirely when a match is found. Normally
528
+ * generated by a build-time class-extraction plugin rather than hand-authored.
529
+ */
530
+ readonly precomputedClasses?: Readonly<StringMap<string>>;
531
+ };
532
+ //#endregion
533
+ //#region ../../lib/primitive/src/types/factory/factory-options.d.ts
534
+ type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
535
+ normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
536
+ }['normalize'];
537
+ /**
538
+ * The type-erased shape of {@link FactoryOptions} — every generic parameter widened to its bound.
539
+ *
540
+ * Use it for a value that must hold *any* factory config (a registry, a generic wrapper). It
541
+ * cannot check `styling.compounds` conditions against the real variant keys/values, because it
542
+ * has forgotten what they are — for that, annotate against `FactoryOptions<...>` with the concrete
543
+ * generics (or `satisfies FactoryOptions<'button', Props, typeof variants>`), which keeps an
544
+ * invalid compound condition a type error rather than a silent no-op.
545
+ */
546
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyClassPluginFactory>;
547
+ /**
548
+ * The framework-neutral component-authoring config passed to `createContractComponent` in every
549
+ * adapter: default tag + name, own-prop defaults, a `normalize` transform, `styling` (variants,
550
+ * base classes, presets, class plugin), `enforcement` (ARIA + children contracts), `subComponents`,
551
+ * and `onElement`.
552
+ *
553
+ * `satisfies FactoryOptions<TDefault, Props, typeof variants, ...>` on a config object narrows
554
+ * `styling.compounds` conditions to the real per-variant-key shape — including resolving a
555
+ * boolean-shaped axis (`{ true, false }`) to a real `boolean` — so a condition naming a variant or
556
+ * value that does not exist is a compile error. `AnyFactoryOptions` cannot do this.
557
+ */
558
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory, TAllowed extends ElementType = ElementType> = {
559
+ /** The intrinsic tag the component renders by default. Overridable per instance via `as`. */
560
+ readonly tag?: TDefault;
561
+ /** Display name used in diagnostics, dev tools, and generated component naming. */
562
+ readonly name?: string;
563
+ /** Values used for the component's own (non-variant) props when the consumer omits them. */
564
+ readonly defaults?: Partial<NoInfer<Props>>;
565
+ /**
566
+ * A pure `(props) => props` transform run on every render, after `enforcement.props`'s
567
+ * normalizers see the same input. Use this for component-specific prop shaping — anything
568
+ * that depends on live instance state or the real DOM element belongs in `onElement` instead.
569
+ *
570
+ * Accepts either a single transform or an array of them, mirroring the `enforcement.props`
571
+ * array convention. An array is composed left to right — each entry receives the previous
572
+ * entry's *complete* output, not a merged patch — so unlike an `enforcement.props` normalizer
573
+ * (which returns a partial patch), a later `normalize` entry can also remove a key an earlier
574
+ * one added. An empty array is treated as no transform.
575
+ */
576
+ readonly normalize?: NormalizeFn<NoInfer<Props>> | ReadonlyArray<NormalizeFn<NoInfer<Props>>>;
577
+ /** Variant groups, base classes, presets, and the optional class-resolution plugin. */
578
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
579
+ /** ARIA rules, child-content contracts, and other runtime validation for this component. */
580
+ readonly enforcement?: EnforcementOptions<TAllowed>;
581
+ /**
582
+ * Adapter-resolved diagnostics default, spread in by `resolveAdapterCommonOptions`. Not meant to
583
+ * be set directly by component authors — use `enforcement.diagnostics` to override per component.
584
+ */
585
+ readonly diagnostics?: Diagnostics;
586
+ /**
587
+ * Sub-components to attach to the generated root component, producing a
588
+ * compound component API (for example, `Card.Header`, `Card.Content`,
589
+ * and `Card.Footer`). Purely additive — has no effect on
590
+ * `enforcement.children`; author child rules explicitly if the component
591
+ * needs to validate its children.
592
+ */
593
+ readonly subComponents?: SubComponentMap;
594
+ /**
595
+ * Called once per instance, when the real underlying DOM element first
596
+ * exists, in every adapter — via that adapter's own native mount
597
+ * lifecycle, never through the props/attribute pipeline. Use this for
598
+ * wiring that needs the actual element (native imperative methods like
599
+ * `dialogEl.showModal()`, native events like `close`/`cancel` that have
600
+ * no prop-based equivalent), not for anything expressible as a plain
601
+ * prop.
602
+ *
603
+ * `element` is typed to the real DOM interface of every tag the rendered
604
+ * element could actually be — `TDefault` plus whatever `enforcement.allowed`
605
+ * permits via `as` (`HTMLDialogElement` for `tag: 'dialog'`,
606
+ * `HTMLDetailsElement` for `tag: 'details'`, and so on) — no cast needed to
607
+ * reach tag-specific members. A component that leaves `allowed`
608
+ * unconstrained (any tag reachable via `as`) falls back to `HTMLElement`,
609
+ * which still covers members every element shares (`showPopover()` and
610
+ * friends); restrict `enforcement.allowed` to the tags `onElement`
611
+ * actually knows how to handle to get real narrowing.
612
+ *
613
+ * `getProps` returns the instance's *current* resolved props at call
614
+ * time — read it from inside a listener registered once at mount, rather
615
+ * than re-subscribing on every prop change.
616
+ *
617
+ * Return a cleanup function to run when the instance unmounts.
618
+ */
619
+ readonly onElement?: (element: ElementForTag<TDefault | TAllowed>, getProps: () => Readonly<Props>) => void | (() => void);
620
+ };
621
+ //#endregion
622
+ //#region ../../lib/adapter-utils/src/types/filter-predicate.d.ts
623
+ /**
624
+ * Determines whether a prop should be stripped before forwarding to the
625
+ * rendered element.
626
+ *
627
+ * Returning `true` excludes the prop from the output; returning `false`
628
+ * keeps it. This is the inverse polarity of `shouldForwardProp`-style
629
+ * predicates (Emotion/styled-components), where `true` means include.
630
+ *
631
+ * @param key - The prop name being evaluated.
632
+ * @param variantKeys - The set of configured variant prop names.
633
+ * @returns `true` to strip the prop; `false` to forward it.
634
+ */
635
+ type FilterPredicate = (key: string, variantKeys: ReadonlySet<string>) => boolean;
636
+ //#endregion
637
+ //#region ../../lib/adapter-utils/src/runtime/define-component.d.ts
638
+ export declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
639
+ //#endregion
640
+ //#region ../../adapters/lit/src/types/lit-options.d.ts
641
+ /**
642
+ * Options accepted by createContractComponent in the Lit adapter.
643
+ *
644
+ * Extends FactoryOptions with one Lit-specific field:
645
+ * - filterProps: determines whether a prop should be omitted before it is
646
+ * reflected as a DOM attribute. Variant keys and plugin-owned keys are
647
+ * always omitted; this predicate extends that set.
648
+ *
649
+ * Note: this adapter targets Light DOM composition only. Shadow DOM slot
650
+ * protocol is intentionally out of scope.
651
+ */
652
+ type LitFactoryOptions<TDefault extends ElementType = ElementType, TProps extends AnyRecord = EmptyRecord, TVariants extends Readonly<VariantMap> = NoVariants, TPreset extends RecipeMap<TVariants> = NoPreset, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory> = FactoryOptions<TDefault, TProps, TVariants, TPreset, TPlugin> & {
653
+ readonly filterProps?: FilterPredicate;
654
+ };
655
+ //#endregion
656
+ //#region ../../adapters/lit/src/types/generics.d.ts
657
+ type RuntimeG<TDefault extends ElementType, Props extends AnyRecord, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants>> = PolymorphicGenerics<TDefault, Props, Variants, TPreset>;
658
+ //#endregion
659
+ //#region ../../adapters/lit/src/types/primitives.d.ts
660
+ type UnknownProps = AnyRecord;
661
+ /**
662
+ * Constructor type returned by createContractComponent.
663
+ *
664
+ * Describes the class contract without exposing LitElement's private members
665
+ * (which would trigger TS4094 in declaration emit). Variant key instance
666
+ * properties are typed via the TVariants parameter.
667
+ *
668
+ * `G` is a phantom marker only — see `__generics` below — and defaults to the
669
+ * widest `PolymorphicGenerics` so existing two-argument usages of this type
670
+ * (every call site inside this adapter) keep resolving exactly as before.
671
+ */
672
+ type LitContractComponent<TVariants extends Readonly<VariantMap> = NoVariants, TPluginProps extends AnyRecord = EmptyRecord, G extends PolymorphicGenerics = PolymorphicGenerics> = {
673
+ new (): MergeRecords<LitElement & {
674
+ recipe: string | undefined;
675
+ praxisClass: string | undefined;
676
+ } & { [K in Extract<keyof TVariants, string>]?: string | null; }, TPluginProps>;
677
+ /**
678
+ * Type-only; never assigned at runtime. `createContractComponent` erases
679
+ * `TDefault`/`Props`/`TPreset` entirely from its return type — only
680
+ * `TVariants` and `TPluginProps` survive as real instance-shape information,
681
+ * since those are the two that show up as actual constructor properties.
682
+ * This field is the Lit adapter's `HasGenerics<G>` counterpart: it carries
683
+ * the full `PolymorphicGenerics` the component was built from so
684
+ * `GenericsOf`/`ContractProps` (./contract-props) can recover
685
+ * it from outside the file that built it, the same recovery React/Preact do
686
+ * for their own erased overload-based component types. Inline rather than
687
+ * intersected for the same reason those adapters keep it inline — untested
688
+ * here since Lit's type has a single construct signature, not an overload
689
+ * set, but kept consistent with the established shape regardless.
690
+ */
691
+ readonly __generics?: G;
692
+ };
693
+ //#endregion
694
+ //#region ../../lib/contract-props/src/has-generics.d.ts
695
+ /**
696
+ * The phantom-marker shape read back via `T extends HasGenerics<infer G> ? G : never`. See the
697
+ * README for why this exists.
698
+ *
699
+ * Type-only: never assigned at runtime. In React's `PolymorphicComponent<G>`, declaring `readonly
700
+ * __generics?: G` inline (structurally matching this shape) rather than writing `HasGenerics<G> &
701
+ * { ...call signatures... }` was necessary to keep `PolymorphicComponent<any>`-typed test helpers
702
+ * assignable — confirmed directly against that adapter's own real component type (see
703
+ * `adapters/react/src/shared/types/polymorphic-props.test.ts`), not reproducible in an isolated
704
+ * minimal mock (see this file's own `has-generics.test.ts`), so treat "inline, not intersected"
705
+ * as an adapter-level implementation detail this package's marker shape must stay compatible
706
+ * with, not a property `HasGenerics<G>` itself enforces.
707
+ *
708
+ * Do **not** "harden" this with a `unique symbol` or other nominal brand: the whole point is that
709
+ * an adapter's real callable component type structurally satisfies this shape by declaring the
710
+ * same optional string-keyed field inline. Nominal purity here would break that compatibility.
711
+ */
712
+ interface HasGenerics<G> {
713
+ readonly __generics?: G;
714
+ }
715
+ //#endregion
716
+ //#region ../../adapters/lit/src/types/contract-props.d.ts
717
+ /**
718
+ * Recovers a `LitContractComponent`'s `PolymorphicGenerics` descriptor from its own value type —
719
+ * the Lit analog of React's/Preact's `__generics` marker recovery.
720
+ * Needs the marker (unlike Svelte's `GenericsOf<T>`,
721
+ * `adapters/svelte/src/types/resolved-slot-props.ts`) because `createContractComponent` here
722
+ * returns `LitContractComponent<TVariants, TPluginProps, G>`, not `BuiltRuntime<G, TOptions>`
723
+ * directly — `TDefault`/`Props`/`TPreset` are genuinely erased from the return type, not merely
724
+ * hidden, so there is no ordinary type parameter left to `infer` them back out of.
725
+ * `LitContractComponent`'s own `__generics` field (`./primitives`) exists purely to make this
726
+ * recovery possible. Falls back to the widest `PolymorphicGenerics` for any non-praxis-kit value,
727
+ * the same "no marker, nothing to recover" case `HasGenerics<G>`'s own `never` branch covers for
728
+ * React/Preact.
729
+ */
730
+ type GenericsOf<T extends HasGenerics<PolymorphicGenerics>> = T extends HasGenerics<infer G extends PolymorphicGenerics> ? G : PolymorphicGenerics;
731
+ /**
732
+ * A component's full prop contract — the attributes a caller can set on the custom element,
733
+ * recovered from outside the file that built it. Lit has exactly one render mode (no
734
+ * `asChild`/`render` — see the "known limitations" note atop `conformance.test.ts`), so unlike
735
+ * React's/Preact's `ContractProps<T, Mode>` this takes no `Mode` parameter: there is only ever one
736
+ * prop shape to pick.
737
+ *
738
+ * `as?: never` — deliberately absent, not merely undocumented. Every other adapter's `as` is real
739
+ * tag polymorphism (it changes the rendered host element); Lit's custom-element tag is fixed at
740
+ * `customElements.define()` time, so there is nothing for `as` to do here. `createContractComponent`
741
+ * strips it from the prop pipeline entirely (see that function's own doc comment) — this `never`
742
+ * makes that a type-level fact too, so `{ as: 'a' }` written against `ContractProps<T>` is a compile
743
+ * error, not a silently-ignored no-op a caller could believe was doing something.
744
+ *
745
+ * ```ts
746
+ * const Button = createContractComponent({ tag: 'button', name: 'Button', /* ... *\/ })
747
+ *
748
+ * type ButtonProps = ContractProps<typeof Button>
749
+ * ```
750
+ */
751
+ type ContractProps<T extends HasGenerics<PolymorphicGenerics>> = Simplify<OmitIndexSignature<PropsOf<GenericsOf<T>>> & OmitIndexSignature<VariantProps<VariantsOf<GenericsOf<T>>>> & {
752
+ as?: never;
753
+ recipe?: keyof RecipeOf<GenericsOf<T>>;
754
+ }>;
755
+ //#endregion
756
+ //#region ../../adapters/lit/src/create-contract-component.d.ts
757
+ /**
758
+ * Creates a Lit custom element class with praxis-kit contracts applied.
759
+ *
760
+ * Returns a LitElement subclass. Register it with customElements.define():
761
+ *
762
+ * ```ts
763
+ * const Button = createContractComponent({
764
+ * tag: 'button',
765
+ * name: 'Button',
766
+ * styling: {
767
+ * base: 'btn',
768
+ * variants: { intent: { primary: 'btn--primary', ghost: 'btn--ghost' } },
769
+ * defaults: { intent: 'primary' },
770
+ * },
771
+ * enforcement: { strict: 'warn' },
772
+ * })
773
+ *
774
+ * customElements.define('praxis-button', Button)
775
+ * ```
776
+ *
777
+ * **This adapter is a Custom Element host carrying a Praxis semantic contract — not a
778
+ * reimplementation of native HTML element behavior.** `options.tag` (`'button'` above) names the
779
+ * _intrinsic model_ Praxis resolves ARIA roles, content-model rules, and built-in prop
780
+ * normalizers (`disabledProps`, etc.) against — it is not, and was never meant to be, the tag
781
+ * actually written to the DOM. The DOM tag is whatever name a caller later passes to
782
+ * `customElements.define(name, Button)`, entirely separate from `options.tag` and not knowable by
783
+ * this function at all (registration happens externally, after this returns, possibly under
784
+ * multiple names or never). So for the example above:
785
+ *
786
+ * ```text
787
+ * Praxis intrinsic model: button (options.tag — drives ARIA/content-model/normalizers)
788
+ * DOM host: praxis-button (customElements.define()'s name — the actual element)
789
+ * ```
790
+ *
791
+ * A concrete consequence worth internalizing: `<praxis-button disabled>` gets `aria-disabled` from
792
+ * the `disabledProps` normalizer (correctly, since `disabled`'s HTML-boolean-attribute semantics
793
+ * are honored in `_buildProps()` below), but the browser does **not** make the custom element
794
+ * keyboard-inert, form-participating, or otherwise behave like a real `HTMLButtonElement` — that
795
+ * gap isn't a bug, it's the direct consequence of `class X extends HTMLElement`, and no ARIA
796
+ * attribute on any element, custom or not, ever supplies real interactive behavior. The contract
797
+ * layer (styling, variants, ARIA policy, child enforcement, attribute management, lifecycle hooks,
798
+ * diagnostics) and the host's actual interactive behavior are — and have to stay — conceptually
799
+ * separate; a caller who needs real button/link/input behavior supplies it themselves (`onElement`
800
+ * is the wiring point), the same way any `role="button"` `<div>` would require it. (Customized
801
+ * built-ins — `class X extends HTMLButtonElement` + `{ extends: 'button' }` — were considered and
802
+ * rejected for solving this: a real platform mechanism, but a different consumer-facing API
803
+ * (`<button is="…">` instead of `<praxis-button>`) with its own platform constraints, not worth the
804
+ * complexity it would add here.)
805
+ *
806
+ * **No `as` prop, unlike every VDOM adapter.** React/Vue/Preact/Solid/Svelte's `as` genuinely
807
+ * changes the rendered host element — real tag polymorphism. Once the model/host distinction above
808
+ * is explicit, this becomes easy: a custom element's DOM tag is fixed at `customElements.define()`
809
+ * time, so there is no tag for `as` to switch — this adapter never accepted `as` as a semantic-only
810
+ * override either (an earlier design did — resolving ARIA/content-model rules as if the element
811
+ * were a different tag while the real DOM node stayed put). That was worse than not having it: it
812
+ * let a caller produce `role="link"`-shaped output with none of an anchor's actual
813
+ * keyboard/click/middle-click behavior — a real accessibility footgun regardless of what the
814
+ * option was named — and it made `renderContractToString`'s output disagree with the live client
815
+ * (SSR had no live DOM to constrain it to `options.tag`, so it rendered the *chosen* tag as a
816
+ * literal wrapper, e.g. `<a>…</a>`, while the browser could only ever produce
817
+ * `<praxis-button>…</praxis-button>`). `as` is filtered out unconditionally in `_buildProps()`
818
+ * below (including as a raw, undeclared HTML attribute — not just the removed Lit property)
819
+ * precisely so `resolveTag`/`renderBundleToString` — shared, unmodified, cross-adapter code —
820
+ * always resolve to `options.tag` for this adapter, on both the client and SSR paths alike.
821
+ * Matches `capabilities.tagPolymorphism: false` already declared in the conformance suite
822
+ * (`conformance.test.ts`), which this closes a real gap against: that flag already said Lit has no
823
+ * tag polymorphism, but SSR quietly provided a fake, DOM-inconsistent form of it until now. Need
824
+ * different semantics for one instance? Register a second component with a different `tag`, or
825
+ * set `role` directly — both already work today, unaffected by this.
826
+ */
827
+ export declare function createContractComponent<TDefault extends ElementType, TProps extends UnknownProps = EmptyRecord, TVariants extends Readonly<VariantMap> = NoVariants, TPreset extends RecipeMap<TVariants> = NoPreset, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory, TSubComponents extends Readonly<AnyRecord> = EmptyRecord>(options: LitFactoryOptions<TDefault, TProps, TVariants, TPreset, TPlugin> & {
828
+ readonly subComponents?: TSubComponents;
829
+ }): MergeRecords<LitContractComponent<TVariants, ExtractPluginProps<TPlugin>, RuntimeG<TDefault, TProps, TVariants, TPreset>>, TSubComponents>;
830
+ //#endregion
831
+ //#region ../../adapters/lit/src/render-to-string.d.ts
832
+ /**
833
+ * Serializes a praxis-kit Lit component's **resolved contract** to an HTML string, without
834
+ * requiring a DOM — not Custom Element SSR, and not a hydration mechanism.
835
+ *
836
+ * This distinction matters and is easy to get wrong: the output element is `options.tag`
837
+ * (`<button>…</button>`, say), never the registered custom-element tag (`<praxis-button>`) —
838
+ * `createContractComponent`'s own doc comment covers why the two are different concepts ("the
839
+ * element Praxis models" vs. "the element actually in the DOM"). `customElements.define()` happens
840
+ * externally, after `createContractComponent()` returns, and this function has no way to know what
841
+ * name (if any) a caller eventually registers the class under, so there is no tag it could emit
842
+ * that's guaranteed to match. Even if it could, the browser's Custom Element upgrade mechanism only
843
+ * upgrades an exact tag-name match — a server-sent `<button>` can never become the live
844
+ * `<praxis-button>` no matter what the client bundle does, so this was never a viable
845
+ * SSR-then-upgrade path regardless of naming.
846
+ *
847
+ * Use this for what it actually is: previewing/testing the resolved styling + ARIA + attribute
848
+ * pipeline as plain HTML (static generation, snapshot tests, non-interactive contexts) — not for
849
+ * server-rendering markup you intend the live custom element to take over.
850
+ *
851
+ * `innerHTML` is treated as a pre-sanitized HTML string and inserted verbatim.
852
+ * Callers are responsible for escaping any untrusted content before passing it.
853
+ *
854
+ * ```ts
855
+ * // @vitest-environment node
856
+ * const html = renderContractToString(Button, { intent: 'primary', size: 'lg' })
857
+ * // => '<button class="btn btn-primary btn-lg"></button>'
858
+ * ```
859
+ */
860
+ export declare function renderContractToString(component: LitContractComponent, props?: UnknownProps, innerHTML?: string): string;
861
+ //#endregion
862
+ export type { AnyFactoryOptions, ContractProps, ElementType, EmptyRecord, FactoryOptions, GenericsOf, LitContractComponent, LitFactoryOptions, PolymorphicGenerics };