praxis-kit 3.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ import {
17
17
  mergeRefs,
18
18
  mergeSlotProps,
19
19
  render
20
- } from "../chunk-PBBPAHMV.js";
20
+ } from "../chunk-6RJN5B6L.js";
21
21
 
22
22
  // ../../adapters/react/src/legacy/create-aria-enforced-component.ts
23
23
  import { forwardRef as forwardRef2 } from "react";
@@ -161,6 +161,7 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
161
161
  }>;
162
162
 
163
163
  type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, strict: StrictMode) => ClassPlugin<TProps>;
164
+ type ExtractPluginProps<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
164
165
 
165
166
  type AriaContext = {
166
167
  readonly tag: IntrinsicTag;
@@ -219,27 +220,27 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
219
220
  readonly allowedAs?: readonly TAllowed[];
220
221
  };
221
222
 
222
- type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
223
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = {
223
224
  readonly base?: ClassName;
224
225
  readonly variants?: V;
225
226
  readonly defaults?: Partial<DefaultVariants<V>>;
226
227
  readonly compounds?: readonly CompoundVariant<V>[];
227
228
  readonly presets?: TPreset;
228
229
  readonly tags?: Readonly<TagMap>;
229
- readonly plugin?: ClassPluginFactory<TPluginProps>;
230
+ readonly plugin?: TPlugin;
230
231
  readonly precomputedClasses?: Readonly<Record<string, string>>;
231
232
  };
232
233
 
233
234
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
234
235
  normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
235
236
  }['normalize'];
236
- type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyRecord>;
237
- type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
237
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, ClassPluginFactory<AnyRecord> | undefined>;
238
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TAllowed extends ElementType = ElementType> = {
238
239
  readonly tag?: TDefault;
239
240
  readonly name?: string;
240
241
  readonly defaults?: Partial<NoInfer<Props>>;
241
242
  readonly normalize?: NormalizeFn<NoInfer<Props>>;
242
- readonly styling?: StylingOptions<V, TPreset, TPluginProps>;
243
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
243
244
  readonly enforcement?: EnforcementOptions<TAllowed>;
244
245
  };
245
246
 
@@ -252,7 +253,7 @@ type UnknownProps = Record<string, unknown>;
252
253
  type SolidElement = JSX.Element;
253
254
  type SlotRenderFn = (props: UnknownProps) => SolidElement;
254
255
 
255
- type SolidFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps> & {
256
+ type SolidFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = FactoryOptions<TDefault, Props, Variants, TPreset, TPlugin> & {
256
257
  /**
257
258
  * Return true for any prop key that should be consumed but not forwarded to the DOM.
258
259
  * Receives `runtime.options.variantKeys` as a convenience if needed.
@@ -286,6 +287,6 @@ type PolymorphicComponent<G extends PolymorphicGenerics> = {
286
287
  displayName?: string;
287
288
  };
288
289
 
289
- declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: SolidFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
290
+ declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined>(options: SolidFactoryOptions<TDefault, Props, Variants, TPreset, TPlugin>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & ExtractPluginProps<TPlugin>, Variants, TPreset>>;
290
291
 
291
292
  export { type AnyFactoryOptions, type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type SolidFactoryOptions, createContractComponent, defineContractComponent };
@@ -1,5 +1,5 @@
1
1
  // ../shared/src/guards/children/component-id.ts
2
- var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
2
+ var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
3
3
 
4
4
  // ../../adapters/solid/src/apply-display-name.ts
5
5
  function applyDisplayName(component, name) {
@@ -593,7 +593,7 @@ function isKnownAriaRole(value) {
593
593
  return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
594
594
  }
595
595
 
596
- // ../core/dist/chunk-BNVYTMYV.js
596
+ // ../core/dist/chunk-2NJ5XLOA.js
597
597
  var IMPLICIT_ROLE_RECORD2 = {
598
598
  article: "article",
599
599
  aside: "complementary",
@@ -622,26 +622,37 @@ function getImplicitRole(tag) {
622
622
  if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
623
623
  return void 0;
624
624
  }
625
- var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
626
- function resolveChildTag(child) {
625
+ var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
626
+ function getAsProp(child) {
627
+ if (!isObject(child) || !("props" in child)) return void 0;
628
+ const props = child.props;
629
+ if (!isObject(props)) return void 0;
630
+ const as = props.as;
631
+ return isString(as) && as !== "" ? as : void 0;
632
+ }
633
+ function getTag(child) {
627
634
  if (!isObject(child) || !("type" in child)) return void 0;
628
635
  const t = child.type;
629
636
  if (isString(t)) return t;
630
- if (isObject(t) && COMPONENT_DEFAULT_TAG2 in t) {
637
+ if (typeof t === "function" || isObject(t)) {
631
638
  const defaultTag = t[COMPONENT_DEFAULT_TAG2];
632
639
  if (!isString(defaultTag)) return void 0;
633
- const props = child.props;
634
- const as = isObject(props) && "as" in props ? props.as : void 0;
635
- return isString(as) ? as : defaultTag;
640
+ return getAsProp(child) ?? defaultTag;
636
641
  }
637
642
  return void 0;
638
643
  }
639
- function isTag(...tags) {
644
+ function isTag(...args) {
645
+ if (isString(args[0])) {
646
+ const set2 = new Set(args);
647
+ return (child2) => {
648
+ const tag2 = getTag(child2);
649
+ return tag2 !== void 0 && set2.has(tag2);
650
+ };
651
+ }
652
+ const [child, ...tags] = args;
640
653
  const set = new Set(tags);
641
- return (child) => {
642
- const tag = resolveChildTag(child);
643
- return tag !== void 0 && set.has(tag);
644
- };
654
+ const tag = getTag(child);
655
+ return tag !== void 0 && set.has(tag);
645
656
  }
646
657
  var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
647
658
  var asyncWarnScheduled2 = false;
@@ -160,6 +160,8 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
160
160
  }>;
161
161
 
162
162
  type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, strict: StrictMode) => ClassPlugin<TProps>;
163
+ type ExtractPluginProps<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
164
+ type PluginInstance<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer TProps> ? ClassPlugin<TProps> : undefined;
163
165
 
164
166
  type AriaContext = {
165
167
  readonly tag: IntrinsicTag;
@@ -218,27 +220,27 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
218
220
  readonly allowedAs?: readonly TAllowed[];
219
221
  };
220
222
 
221
- type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
223
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = {
222
224
  readonly base?: ClassName;
223
225
  readonly variants?: V;
224
226
  readonly defaults?: Partial<DefaultVariants<V>>;
225
227
  readonly compounds?: readonly CompoundVariant<V>[];
226
228
  readonly presets?: TPreset;
227
229
  readonly tags?: Readonly<TagMap>;
228
- readonly plugin?: ClassPluginFactory<TPluginProps>;
230
+ readonly plugin?: TPlugin;
229
231
  readonly precomputedClasses?: Readonly<Record<string, string>>;
230
232
  };
231
233
 
232
234
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
233
235
  normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
234
236
  }['normalize'];
235
- type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyRecord>;
236
- type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
237
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, ClassPluginFactory<AnyRecord> | undefined>;
238
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TAllowed extends ElementType = ElementType> = {
237
239
  readonly tag?: TDefault;
238
240
  readonly name?: string;
239
241
  readonly defaults?: Partial<NoInfer<Props>>;
240
242
  readonly normalize?: NormalizeFn<NoInfer<Props>>;
241
- readonly styling?: StylingOptions<V, TPreset, TPluginProps>;
243
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
242
244
  readonly enforcement?: EnforcementOptions<TAllowed>;
243
245
  };
244
246
 
@@ -299,7 +301,7 @@ declare class ChildrenEvaluator extends StrictBase {
299
301
  evaluate(children: unknown[]): void;
300
302
  }
301
303
 
302
- declare function createPolymorphic<TDefault extends ElementType, Props extends AnyRecord, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>>(options?: FactoryOptions<TDefault, Props, Variants, TPreset>): PolymorphicRuntime<TDefault, Props, Variants, Extract<keyof TPreset, string>, TPreset>;
304
+ declare function createPolymorphic<TDefault extends ElementType, Props extends AnyRecord, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined>(options?: FactoryOptions<TDefault, Props, Variants, TPreset, TPlugin>): PolymorphicRuntime<TDefault, Props, Variants, Extract<keyof TPreset, string>, TPreset, PluginInstance<TPlugin>>;
303
305
 
304
306
  declare class SlotValidator extends StrictBase {
305
307
  #private;
@@ -323,7 +325,7 @@ declare function defineContractComponent<O extends FactoryOptions>(options: O):
323
325
 
324
326
  type UnknownProps = Record<string, unknown>;
325
327
 
326
- type SvelteFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps> & {
328
+ type SvelteFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = FactoryOptions<TDefault, Props, Variants, TPreset, TPlugin> & {
327
329
  /**
328
330
  * Return true for any prop key that should be consumed but not forwarded to the DOM.
329
331
  * Receives `runtime.options.variantKeys` as a convenience if needed.
@@ -339,6 +341,6 @@ type BuiltRuntime<G extends PolymorphicGenerics = PolymorphicGenerics, TOptions
339
341
  slotValidator: SlotValidator;
340
342
  };
341
343
 
342
- declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TOptions extends WithChildRules = SvelteFactoryOptions<TDefault, Props & TPluginProps, Variants, TPreset>>(options: SvelteFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps> & TOptions): BuiltRuntime<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>, TOptions>;
344
+ declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TOptions extends WithChildRules = SvelteFactoryOptions<TDefault, Props & ExtractPluginProps<TPlugin>, Variants, TPreset>>(options: SvelteFactoryOptions<TDefault, Props, Variants, TPreset, TPlugin> & TOptions): BuiltRuntime<PolymorphicGenerics<TDefault, Props & ExtractPluginProps<TPlugin>, Variants, TPreset>, TOptions>;
343
345
 
344
346
  export { type AnyFactoryOptions, type BuiltRuntime, type ElementType, type EmptyRecord, type FilterPredicate, type PolymorphicGenerics, type SvelteFactoryOptions, type UnknownProps, type WithChildRules, createContractComponent, defineContractComponent };
@@ -571,7 +571,7 @@ function isStandaloneTag(tag) {
571
571
  return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
572
572
  }
573
573
 
574
- // ../core/dist/chunk-BNVYTMYV.js
574
+ // ../core/dist/chunk-2NJ5XLOA.js
575
575
  var IMPLICIT_ROLE_RECORD2 = {
576
576
  article: "article",
577
577
  aside: "complementary",
@@ -600,26 +600,37 @@ function getImplicitRole(tag) {
600
600
  if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
601
601
  return void 0;
602
602
  }
603
- var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
604
- function resolveChildTag(child) {
603
+ var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
604
+ function getAsProp(child) {
605
+ if (!isObject(child) || !("props" in child)) return void 0;
606
+ const props = child.props;
607
+ if (!isObject(props)) return void 0;
608
+ const as = props.as;
609
+ return isString(as) && as !== "" ? as : void 0;
610
+ }
611
+ function getTag(child) {
605
612
  if (!isObject(child) || !("type" in child)) return void 0;
606
613
  const t = child.type;
607
614
  if (isString(t)) return t;
608
- if (isObject(t) && COMPONENT_DEFAULT_TAG in t) {
615
+ if (typeof t === "function" || isObject(t)) {
609
616
  const defaultTag = t[COMPONENT_DEFAULT_TAG];
610
617
  if (!isString(defaultTag)) return void 0;
611
- const props = child.props;
612
- const as = isObject(props) && "as" in props ? props.as : void 0;
613
- return isString(as) ? as : defaultTag;
618
+ return getAsProp(child) ?? defaultTag;
614
619
  }
615
620
  return void 0;
616
621
  }
617
- function isTag(...tags) {
622
+ function isTag(...args) {
623
+ if (isString(args[0])) {
624
+ const set2 = new Set(args);
625
+ return (child2) => {
626
+ const tag2 = getTag(child2);
627
+ return tag2 !== void 0 && set2.has(tag2);
628
+ };
629
+ }
630
+ const [child, ...tags] = args;
618
631
  const set = new Set(tags);
619
- return (child) => {
620
- const tag = resolveChildTag(child);
621
- return tag !== void 0 && set.has(tag);
622
- };
632
+ const tag = getTag(child);
633
+ return tag !== void 0 && set.has(tag);
623
634
  }
624
635
  var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
625
636
  var asyncWarnScheduled2 = false;
@@ -162,6 +162,7 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
162
162
  }>;
163
163
 
164
164
  type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, strict: StrictMode) => ClassPlugin<TProps>;
165
+ type ExtractPluginProps<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
165
166
 
166
167
  type AriaContext = {
167
168
  readonly tag: IntrinsicTag;
@@ -220,27 +221,27 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
220
221
  readonly allowedAs?: readonly TAllowed[];
221
222
  };
222
223
 
223
- type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
224
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = {
224
225
  readonly base?: ClassName;
225
226
  readonly variants?: V;
226
227
  readonly defaults?: Partial<DefaultVariants<V>>;
227
228
  readonly compounds?: readonly CompoundVariant<V>[];
228
229
  readonly presets?: TPreset;
229
230
  readonly tags?: Readonly<TagMap>;
230
- readonly plugin?: ClassPluginFactory<TPluginProps>;
231
+ readonly plugin?: TPlugin;
231
232
  readonly precomputedClasses?: Readonly<Record<string, string>>;
232
233
  };
233
234
 
234
235
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
235
236
  normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
236
237
  }['normalize'];
237
- type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyRecord>;
238
- type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
238
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, ClassPluginFactory<AnyRecord> | undefined>;
239
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TAllowed extends ElementType = ElementType> = {
239
240
  readonly tag?: TDefault;
240
241
  readonly name?: string;
241
242
  readonly defaults?: Partial<NoInfer<Props>>;
242
243
  readonly normalize?: NormalizeFn<NoInfer<Props>>;
243
- readonly styling?: StylingOptions<V, TPreset, TPluginProps>;
244
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
244
245
  readonly enforcement?: EnforcementOptions<TAllowed>;
245
246
  };
246
247
 
@@ -251,7 +252,7 @@ declare function defineContractComponent<O extends FactoryOptions>(options: O):
251
252
 
252
253
  type UnknownProps = Record<string, unknown>;
253
254
 
254
- type VueFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps> & {
255
+ type VueFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = FactoryOptions<TDefault, Props, Variants, TPreset, TPlugin> & {
255
256
  /**
256
257
  * Return true for any prop key that should be consumed but not forwarded to
257
258
  * the DOM. Variant keys are always stripped automatically.
@@ -308,6 +309,6 @@ type PolymorphicComponent<G extends PolymorphicGenerics> = {
308
309
  displayName?: string;
309
310
  };
310
311
 
311
- declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: VueFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
312
+ declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined>(options: VueFactoryOptions<TDefault, Props, Variants, TPreset, TPlugin>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & ExtractPluginProps<TPlugin>, Variants, TPreset>>;
312
313
 
313
314
  export { type AnyFactoryOptions, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent };
package/dist/vue/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { computed, defineComponent as defineComponent2 } from "vue";
3
3
 
4
4
  // ../shared/src/guards/children/component-id.ts
5
- var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
5
+ var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
6
6
 
7
7
  // ../../adapters/vue/src/apply-display-name.ts
8
8
  function applyDisplayName(component, name) {
@@ -596,7 +596,7 @@ function isKnownAriaRole(value) {
596
596
  return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
597
597
  }
598
598
 
599
- // ../core/dist/chunk-BNVYTMYV.js
599
+ // ../core/dist/chunk-2NJ5XLOA.js
600
600
  var IMPLICIT_ROLE_RECORD2 = {
601
601
  article: "article",
602
602
  aside: "complementary",
@@ -625,26 +625,37 @@ function getImplicitRole(tag) {
625
625
  if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
626
626
  return void 0;
627
627
  }
628
- var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
629
- function resolveChildTag(child) {
628
+ var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
629
+ function getAsProp(child) {
630
+ if (!isObject(child) || !("props" in child)) return void 0;
631
+ const props = child.props;
632
+ if (!isObject(props)) return void 0;
633
+ const as = props.as;
634
+ return isString(as) && as !== "" ? as : void 0;
635
+ }
636
+ function getTag(child) {
630
637
  if (!isObject(child) || !("type" in child)) return void 0;
631
638
  const t = child.type;
632
639
  if (isString(t)) return t;
633
- if (isObject(t) && COMPONENT_DEFAULT_TAG2 in t) {
640
+ if (typeof t === "function" || isObject(t)) {
634
641
  const defaultTag = t[COMPONENT_DEFAULT_TAG2];
635
642
  if (!isString(defaultTag)) return void 0;
636
- const props = child.props;
637
- const as = isObject(props) && "as" in props ? props.as : void 0;
638
- return isString(as) ? as : defaultTag;
643
+ return getAsProp(child) ?? defaultTag;
639
644
  }
640
645
  return void 0;
641
646
  }
642
- function isTag(...tags) {
647
+ function isTag(...args) {
648
+ if (isString(args[0])) {
649
+ const set2 = new Set(args);
650
+ return (child2) => {
651
+ const tag2 = getTag(child2);
652
+ return tag2 !== void 0 && set2.has(tag2);
653
+ };
654
+ }
655
+ const [child, ...tags] = args;
643
656
  const set = new Set(tags);
644
- return (child) => {
645
- const tag = resolveChildTag(child);
646
- return tag !== void 0 && set.has(tag);
647
- };
657
+ const tag = getTag(child);
658
+ return tag !== void 0 && set.has(tag);
648
659
  }
649
660
  var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
650
661
  var asyncWarnScheduled2 = false;
@@ -146,6 +146,7 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
146
146
  }>;
147
147
 
148
148
  type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, strict: StrictMode) => ClassPlugin<TProps>;
149
+ type ExtractPluginProps<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
149
150
 
150
151
  type AriaContext = {
151
152
  readonly tag: IntrinsicTag;
@@ -204,27 +205,27 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
204
205
  readonly allowedAs?: readonly TAllowed[];
205
206
  };
206
207
 
207
- type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
208
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = {
208
209
  readonly base?: ClassName;
209
210
  readonly variants?: V;
210
211
  readonly defaults?: Partial<DefaultVariants<V>>;
211
212
  readonly compounds?: readonly CompoundVariant<V>[];
212
213
  readonly presets?: TPreset;
213
214
  readonly tags?: Readonly<TagMap>;
214
- readonly plugin?: ClassPluginFactory<TPluginProps>;
215
+ readonly plugin?: TPlugin;
215
216
  readonly precomputedClasses?: Readonly<Record<string, string>>;
216
217
  };
217
218
 
218
219
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
219
220
  normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
220
221
  }['normalize'];
221
- type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyRecord>;
222
- type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
222
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, ClassPluginFactory<AnyRecord> | undefined>;
223
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TAllowed extends ElementType = ElementType> = {
223
224
  readonly tag?: TDefault;
224
225
  readonly name?: string;
225
226
  readonly defaults?: Partial<NoInfer<Props>>;
226
227
  readonly normalize?: NormalizeFn<NoInfer<Props>>;
227
- readonly styling?: StylingOptions<V, TPreset, TPluginProps>;
228
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
228
229
  readonly enforcement?: EnforcementOptions<TAllowed>;
229
230
  };
230
231
 
@@ -238,7 +239,7 @@ declare function defineContractComponent<O extends FactoryOptions>(options: O):
238
239
  * Identical shape to LitFactoryOptions — a plain HTMLElement subclass with
239
240
  * no framework dependency. Light DOM only; Shadow DOM is out of scope.
240
241
  */
241
- type WebFactoryOptions<TDefault extends ElementType = ElementType, TProps extends AnyRecord = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = FactoryOptions<TDefault, TProps, TVariants, TPreset, TPluginProps> & {
242
+ type WebFactoryOptions<TDefault extends ElementType = ElementType, TProps extends AnyRecord = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = FactoryOptions<TDefault, TProps, TVariants, TPreset, TPlugin> & {
242
243
  readonly filterProps?: FilterPredicate;
243
244
  };
244
245
 
@@ -249,7 +250,7 @@ type UnknownProps = Record<string, unknown>;
249
250
  * Describes the public contract without exposing HTMLElement's internal members.
250
251
  * Variant key instance properties are typed via TVariants.
251
252
  */
252
- type WebContractComponent<TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>> = {
253
+ type WebContractComponent<TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
253
254
  new (): HTMLElement & {
254
255
  as: string | undefined;
255
256
  recipe: string | undefined;
@@ -258,7 +259,7 @@ type WebContractComponent<TVariants extends Readonly<VariantMap> = Readonly<Empt
258
259
  update(): void;
259
260
  } & {
260
261
  [K in Extract<keyof TVariants, string>]?: string | null;
261
- };
262
+ } & TPluginProps;
262
263
  /** The resolved strict mode for this component — usable by subclasses for custom enforcement. */
263
264
  readonly strict: Exclude<StrictMode, undefined>;
264
265
  };
@@ -290,7 +291,7 @@ type WebContractComponent<TVariants extends Readonly<VariantMap> = Readonly<Empt
290
291
  * For non-reactive attributes (`aria-*`, `role`, `data-*`) call `element.update()`
291
292
  * after setting them to trigger an explicit pipeline re-run.
292
293
  */
293
- declare function createContractComponent<TDefault extends ElementType, TProps extends UnknownProps = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: WebFactoryOptions<TDefault, TProps, TVariants, TPreset, TPluginProps>): WebContractComponent<TVariants>;
294
+ declare function createContractComponent<TDefault extends ElementType, TProps extends UnknownProps = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined>(options: WebFactoryOptions<TDefault, TProps, TVariants, TPreset, TPlugin>): WebContractComponent<TVariants, ExtractPluginProps<TPlugin>>;
294
295
 
295
296
  /**
296
297
  * Renders a praxis-kit web component to an HTML string without requiring a DOM.
package/dist/web/index.js CHANGED
@@ -582,7 +582,7 @@ function isStandaloneTag(tag) {
582
582
  return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
583
583
  }
584
584
 
585
- // ../core/dist/chunk-BNVYTMYV.js
585
+ // ../core/dist/chunk-2NJ5XLOA.js
586
586
  var IMPLICIT_ROLE_RECORD2 = {
587
587
  article: "article",
588
588
  aside: "complementary",
@@ -611,26 +611,37 @@ function getImplicitRole(tag) {
611
611
  if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
612
612
  return void 0;
613
613
  }
614
- var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
615
- function resolveChildTag(child) {
614
+ var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
615
+ function getAsProp(child) {
616
+ if (!isObject(child) || !("props" in child)) return void 0;
617
+ const props = child.props;
618
+ if (!isObject(props)) return void 0;
619
+ const as = props.as;
620
+ return isString(as) && as !== "" ? as : void 0;
621
+ }
622
+ function getTag(child) {
616
623
  if (!isObject(child) || !("type" in child)) return void 0;
617
624
  const t = child.type;
618
625
  if (isString(t)) return t;
619
- if (isObject(t) && COMPONENT_DEFAULT_TAG in t) {
626
+ if (typeof t === "function" || isObject(t)) {
620
627
  const defaultTag = t[COMPONENT_DEFAULT_TAG];
621
628
  if (!isString(defaultTag)) return void 0;
622
- const props = child.props;
623
- const as = isObject(props) && "as" in props ? props.as : void 0;
624
- return isString(as) ? as : defaultTag;
629
+ return getAsProp(child) ?? defaultTag;
625
630
  }
626
631
  return void 0;
627
632
  }
628
- function isTag(...tags) {
633
+ function isTag(...args) {
634
+ if (isString(args[0])) {
635
+ const set2 = new Set(args);
636
+ return (child2) => {
637
+ const tag2 = getTag(child2);
638
+ return tag2 !== void 0 && set2.has(tag2);
639
+ };
640
+ }
641
+ const [child, ...tags] = args;
629
642
  const set = new Set(tags);
630
- return (child) => {
631
- const tag = resolveChildTag(child);
632
- return tag !== void 0 && set.has(tag);
633
- };
643
+ const tag = getTag(child);
644
+ return tag !== void 0 && set.has(tag);
634
645
  }
635
646
  var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
636
647
  var asyncWarnScheduled2 = false;
@@ -1868,7 +1879,8 @@ function createContractComponent(options) {
1868
1879
  const bundle = buildRuntime(options);
1869
1880
  const looseBundle = toLooseBundle(bundle);
1870
1881
  const variantKeys = options.styling?.variants ? Object.keys(options.styling.variants) : [];
1871
- const observedAttrNames = ["as", "variant-key", "praxis-class", ...variantKeys];
1882
+ const pluginKeys = "classPlugin" in bundle.runtime ? [...bundle.runtime.classPlugin.ownedKeys ?? []] : [];
1883
+ const observedAttrNames = ["as", "variant-key", "praxis-class", ...variantKeys, ...pluginKeys];
1872
1884
  const BaseElement = typeof HTMLElement !== "undefined" ? HTMLElement : class {
1873
1885
  };
1874
1886
  class PolymorphicWebElement extends BaseElement {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "praxis-kit",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./react": {
@@ -70,7 +70,7 @@
70
70
  "sideEffects": false,
71
71
  "dependencies": {
72
72
  "clsx": "^2.1.1",
73
- "type-fest": "^5.6.0"
73
+ "type-fest": "^5.7.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "react": ">=18",
@@ -130,8 +130,8 @@
130
130
  "vite": "^8.0.16",
131
131
  "vue": "^3.5.38",
132
132
  "@praxis-kit/adapter-utils": "0.0.0",
133
- "@praxis-kit/core": "0.8.0-beta.4",
134
- "@praxis-kit/shared": "0.8.0-beta.4"
133
+ "@praxis-kit/shared": "0.8.0-beta.4",
134
+ "@praxis-kit/core": "0.8.0-beta.4"
135
135
  },
136
136
  "publishConfig": {
137
137
  "access": "public"