praxis-kit 2.0.2 → 3.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.
@@ -116,9 +116,9 @@ type VariantSelection<V extends VariantMap> = {
116
116
  * Presets are named bundles of variant props that callers activate by key,
117
117
  * avoiding the need to repeat variant combinations at each call site.
118
118
  */
119
- type PresetMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
119
+ type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
120
120
 
121
- interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
121
+ interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
122
122
  default: TDefault;
123
123
  props: Props;
124
124
  variants: Variants;
@@ -126,26 +126,26 @@ interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props
126
126
  allowed: TAllowed;
127
127
  }
128
128
  type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
129
- type PresetOf<T extends PolymorphicGenerics> = T['preset'];
129
+ type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
130
130
  type AllowedOf<T extends PolymorphicGenerics> = T['allowed'];
131
131
 
132
- type PresetTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
132
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
133
133
 
134
134
  interface BaseClassOptions {
135
135
  baseClassName?: ClassName;
136
136
  }
137
137
 
138
- type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, variantKey?: string) => string;
138
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
139
139
 
140
- interface PresetOptions<TVariants extends VariantMap = VariantMap> {
141
- presetMap?: Record<string, PresetTarget<TVariants>>;
140
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
141
+ recipeMap?: Record<string, RecipeTarget<TVariants>>;
142
142
  }
143
143
 
144
144
  interface TagMapOptions {
145
145
  tagMap?: TagMap;
146
146
  }
147
147
 
148
- type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & PresetOptions<TVariants>>;
148
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
149
149
 
150
150
  type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
151
151
 
@@ -220,7 +220,7 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
220
220
  readonly allowedAs?: readonly TAllowed[];
221
221
  };
222
222
 
223
- type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
223
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
224
224
  readonly base?: ClassName;
225
225
  readonly variants?: V;
226
226
  readonly defaults?: Partial<DefaultVariants<V>>;
@@ -234,8 +234,8 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
234
234
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
235
235
  normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
236
236
  }['normalize'];
237
- type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, PresetMap<VariantMap>, AnyRecord>;
238
- type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
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> = {
239
239
  readonly tag?: TDefault;
240
240
  readonly name?: string;
241
241
  readonly defaults?: Partial<NoInfer<Props>>;
@@ -247,6 +247,8 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
247
247
  type DefaultOf<T extends PolymorphicGenerics> = T['default'];
248
248
  type PropsOf<T extends PolymorphicGenerics> = T['props'];
249
249
 
250
+ declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
251
+
250
252
  type UnknownProps = Record<string, unknown>;
251
253
  type SlotComponent = ComponentType<UnknownProps>;
252
254
 
@@ -262,7 +264,7 @@ type RenderCallbackProps = Readonly<Record<string, unknown>>;
262
264
  * Extends FactoryOptions with React-specific configuration.
263
265
  * slotComponent is intentionally not in core — it is a React rendering concern.
264
266
  */
265
- type ReactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed> & {
267
+ type ReactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed> & {
266
268
  /** Component used to render the asChild slot. Defaults to the built-in Slot. */
267
269
  slotComponent?: SlotComponent;
268
270
  /**
@@ -305,7 +307,7 @@ type OwnedProps<G extends PolymorphicGenerics> = ComponentProps<G> & ComponentVa
305
307
  type PolymorphicControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = {
306
308
  as?: TAs & AllowedOf<G>;
307
309
  className?: ClassName | undefined;
308
- variantKey?: keyof PresetOf<G>;
310
+ recipe?: keyof RecipeOf<G>;
309
311
  ref?: Ref<ElementRef<TAs>>;
310
312
  };
311
313
  /** @internal Full set of props owned by the component — used as the Omit key in IntrinsicPropsWithoutOwned. */
@@ -375,4 +377,4 @@ type PolymorphicComponent<G extends PolymorphicGenerics> = {
375
377
 
376
378
  declare function mergeRefs<T>(...refs: (Ref<T> | null | undefined)[]): Ref<T> | null;
377
379
 
378
- export { type AnyRecord as A, type ElementType as E, type FactoryOptions as F, type PresetMap as P, type ReactFactoryOptions as R, Slottable as S, type UnknownProps as U, type VariantMap as V, type EmptyRecord as a, type PolymorphicComponent as b, type PolymorphicGenerics as c, type AnyFactoryOptions as d, type ElementRef as e, type PolymorphicProps as f, type PolymorphicWithAsChild as g, type PolymorphicWithRender as h, type RenderCallbackProps as i, type SlottableProps as j, mergeRefs as m };
380
+ export { type AnyRecord as A, type ElementType as E, type FactoryOptions as F, type PolymorphicComponent as P, type RecipeMap as R, Slottable as S, type UnknownProps as U, type VariantMap as V, type EmptyRecord as a, type ReactFactoryOptions as b, type PolymorphicGenerics as c, type AnyFactoryOptions as d, type ElementRef as e, type PolymorphicProps as f, type PolymorphicWithAsChild as g, type PolymorphicWithRender as h, type RenderCallbackProps as i, type SlottableProps as j, defineContractComponent as k, mergeRefs as m };
@@ -116,9 +116,9 @@ type VariantSelection<V extends VariantMap> = {
116
116
  * Presets are named bundles of variant props that callers activate by key,
117
117
  * avoiding the need to repeat variant combinations at each call site.
118
118
  */
119
- type PresetMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
119
+ type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
120
120
 
121
- interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
121
+ interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
122
122
  default: TDefault;
123
123
  props: Props;
124
124
  variants: Variants;
@@ -126,25 +126,25 @@ interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props
126
126
  allowed: TAllowed;
127
127
  }
128
128
  type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
129
- type PresetOf<T extends PolymorphicGenerics> = T['preset'];
129
+ type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
130
130
 
131
- type PresetTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
131
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
132
132
 
133
133
  interface BaseClassOptions {
134
134
  baseClassName?: ClassName;
135
135
  }
136
136
 
137
- type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, variantKey?: string) => string;
137
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
138
138
 
139
- interface PresetOptions<TVariants extends VariantMap = VariantMap> {
140
- presetMap?: Record<string, PresetTarget<TVariants>>;
139
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
140
+ recipeMap?: Record<string, RecipeTarget<TVariants>>;
141
141
  }
142
142
 
143
143
  interface TagMapOptions {
144
144
  tagMap?: TagMap;
145
145
  }
146
146
 
147
- type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & PresetOptions<TVariants>>;
147
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
148
148
 
149
149
  type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
150
150
 
@@ -219,7 +219,7 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
219
219
  readonly allowedAs?: readonly TAllowed[];
220
220
  };
221
221
 
222
- type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
222
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
223
223
  readonly base?: ClassName;
224
224
  readonly variants?: V;
225
225
  readonly defaults?: Partial<DefaultVariants<V>>;
@@ -233,8 +233,8 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
233
233
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
234
234
  normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
235
235
  }['normalize'];
236
- type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, PresetMap<VariantMap>, AnyRecord>;
237
- type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
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> = {
238
238
  readonly tag?: TDefault;
239
239
  readonly name?: string;
240
240
  readonly defaults?: Partial<NoInfer<Props>>;
@@ -246,11 +246,13 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
246
246
  type DefaultOf<T extends PolymorphicGenerics> = T['default'];
247
247
  type PropsOf<T extends PolymorphicGenerics> = T['props'];
248
248
 
249
+ declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
250
+
249
251
  type UnknownProps = Record<string, unknown>;
250
252
  type SlotComponent = ComponentType<UnknownProps>;
251
253
  type AnyVNode = VNode<any>;
252
254
 
253
- type PreactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps> & {
255
+ type PreactFactoryOptions<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> & {
254
256
  /** Component used to render the asChild slot. Defaults to the built-in Slot. */
255
257
  slotComponent?: SlotComponent;
256
258
  /**
@@ -265,7 +267,7 @@ type IntrinsicJSXProps<T extends ElementType> = T extends IntrinsicTag ? JSX.Int
265
267
  type ControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = OmitIndexSignature<PropsOf<G>> & OmitIndexSignature<VariantProps<VariantsOf<G>>> & {
266
268
  as?: TAs;
267
269
  className?: ClassName | undefined;
268
- variantKey?: keyof PresetOf<G>;
270
+ recipe?: keyof RecipeOf<G>;
269
271
  ref?: Ref<ElementRef<TAs>>;
270
272
  };
271
273
  type SharedProps<G extends PolymorphicGenerics, TAs extends ElementType> = Omit<IntrinsicJSXProps<TAs>, keyof ControlProps<G, TAs> | 'children'> & ControlProps<G, TAs>;
@@ -284,9 +286,7 @@ type PolymorphicComponent<G extends PolymorphicGenerics> = {
284
286
  displayName?: string;
285
287
  };
286
288
 
287
- declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: PreactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
288
-
289
- declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
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: PreactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
290
290
 
291
291
  type SlottableProps = {
292
292
  children?: ComponentChildren;
@@ -10,7 +10,7 @@ function normalizeChildren(children) {
10
10
  }
11
11
 
12
12
  // ../shared/src/guards/children/component-id.ts
13
- var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
13
+ var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
14
14
 
15
15
  // ../../lib/primitive/src/utils/is-object.ts
16
16
  function isNull(value) {
@@ -49,7 +49,12 @@ function applyFilter(props, filterProps, variantKeys) {
49
49
  return out;
50
50
  }
51
51
 
52
- // ../core/dist/chunk-XFCAUPVZ.js
52
+ // ../../lib/adapter-utils/src/define-component.ts
53
+ function defineContractComponent(options) {
54
+ return (factory) => factory(options);
55
+ }
56
+
57
+ // ../core/dist/chunk-KKSHJDE7.js
53
58
  function makeResolveTag(defaultTag) {
54
59
  return function tag(as) {
55
60
  return as ?? defaultTag;
@@ -118,7 +123,7 @@ function resolveFactoryOptions(options = {}) {
118
123
  ...whenDefined("defaultProps", options.defaults),
119
124
  ...whenDefined("baseClassName", styling?.base),
120
125
  ...whenDefined("tagMap", styling?.tags),
121
- ...whenDefined("presetMap", styling?.presets),
126
+ ...whenDefined("recipeMap", styling?.presets),
122
127
  ...whenDefined("variants", styling?.variants),
123
128
  ...whenDefined("defaultVariants", styling?.defaults),
124
129
  ...whenDefined("compoundVariants", styling?.compounds),
@@ -159,10 +164,10 @@ function validateFactoryOptions(resolved) {
159
164
  }
160
165
  }
161
166
  };
162
- const { presetMap } = resolved;
163
- if (presetMap) {
164
- for (const presetKey in presetMap) {
165
- checkSelection(`preset "${presetKey}"`, presetMap[presetKey]);
167
+ const { recipeMap } = resolved;
168
+ if (recipeMap) {
169
+ for (const recipeKey in recipeMap) {
170
+ checkSelection(`preset "${recipeKey}"`, recipeMap[recipeKey]);
166
171
  }
167
172
  }
168
173
  if (resolved.defaultVariants) checkSelection("defaults", resolved.defaultVariants);
@@ -198,12 +203,12 @@ function report2(strict, message) {
198
203
  function label(name) {
199
204
  return name ? `[${name}]` : "[createContractComponent]";
200
205
  }
201
- function validateRenderProps(options, props, presetKey) {
202
- const { strict, presetMap, variants, displayName } = options;
206
+ function validateRenderProps(options, props, recipeKey) {
207
+ const { strict, recipeMap, variants, displayName } = options;
203
208
  if (!strict) return;
204
209
  const tag = label(displayName);
205
- if (presetKey !== void 0 && (!presetMap || !Object.hasOwn(presetMap, presetKey))) {
206
- report2(strict, `${tag} Unknown presetKey "${presetKey}" \u2014 no preset with that name exists.`);
210
+ if (recipeKey !== void 0 && (!recipeMap || !Object.hasOwn(recipeMap, recipeKey))) {
211
+ report2(strict, `${tag} Unknown recipeKey "${recipeKey}" \u2014 no preset with that name exists.`);
207
212
  }
208
213
  if (variants) {
209
214
  for (const key in variants) {
@@ -241,8 +246,8 @@ function assertPluginShape(result) {
241
246
  }
242
247
  function guardPipeline(pipeline) {
243
248
  if (process.env.NODE_ENV === "production") return pipeline;
244
- return function guardedPipeline(tag, props, className, variantKey) {
245
- const result = pipeline(tag, props, className, variantKey);
249
+ return function guardedPipeline(tag, props, className, recipe) {
250
+ const result = pipeline(tag, props, className, recipe);
246
251
  if (typeof result !== "string")
247
252
  panic(`[praxis-kit] Plugin pipeline must return a string. Got: ${describe(result)}.`);
248
253
  return result;
@@ -267,11 +272,11 @@ function createRuntimeMethods(resolved, classPipeline, engine) {
267
272
  resolveProps(props) {
268
273
  return mergeProps(resolved.defaultProps, props);
269
274
  },
270
- resolveClasses(tag, props, className, variantKey) {
275
+ resolveClasses(tag, props, className, recipe) {
271
276
  if (process.env.NODE_ENV !== "production") {
272
- validateRenderProps(resolved, props, variantKey);
277
+ validateRenderProps(resolved, props, recipe);
273
278
  }
274
- return classPipeline(tag, props, className, variantKey);
279
+ return classPipeline(tag, props, className, recipe);
275
280
  },
276
281
  resolveAria(tag, props) {
277
282
  if (!engine) return { props };
@@ -620,7 +625,7 @@ function isKnownAriaRole(value) {
620
625
  return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
621
626
  }
622
627
 
623
- // ../core/dist/chunk-VU44HAB7.js
628
+ // ../core/dist/chunk-2NJ5XLOA.js
624
629
  var IMPLICIT_ROLE_RECORD2 = {
625
630
  article: "article",
626
631
  aside: "complementary",
@@ -649,26 +654,37 @@ function getImplicitRole(tag) {
649
654
  if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
650
655
  return void 0;
651
656
  }
652
- var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
653
- function resolveChildTag(child) {
657
+ var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
658
+ function getAsProp(child) {
659
+ if (!isObject2(child) || !("props" in child)) return void 0;
660
+ const props = child.props;
661
+ if (!isObject2(props)) return void 0;
662
+ const as = props.as;
663
+ return isString(as) && as !== "" ? as : void 0;
664
+ }
665
+ function getTag(child) {
654
666
  if (!isObject2(child) || !("type" in child)) return void 0;
655
667
  const t = child.type;
656
668
  if (isString(t)) return t;
657
- if (isObject2(t) && COMPONENT_DEFAULT_TAG2 in t) {
669
+ if (typeof t === "function" || isObject2(t)) {
658
670
  const defaultTag = t[COMPONENT_DEFAULT_TAG2];
659
671
  if (!isString(defaultTag)) return void 0;
660
- const props = child.props;
661
- const as = isObject2(props) && "as" in props ? props.as : void 0;
662
- return isString(as) ? as : defaultTag;
672
+ return getAsProp(child) ?? defaultTag;
663
673
  }
664
674
  return void 0;
665
675
  }
666
- function isTag(...tags) {
676
+ function isTag(...args) {
677
+ if (isString(args[0])) {
678
+ const set2 = new Set(args);
679
+ return (child2) => {
680
+ const tag2 = getTag(child2);
681
+ return tag2 !== void 0 && set2.has(tag2);
682
+ };
683
+ }
684
+ const [child, ...tags] = args;
667
685
  const set = new Set(tags);
668
- return (child) => {
669
- const tag = resolveChildTag(child);
670
- return tag !== void 0 && set.has(tag);
671
- };
686
+ const tag = getTag(child);
687
+ return tag !== void 0 && set.has(tag);
672
688
  }
673
689
  var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
674
690
  var asyncWarnScheduled2 = false;
@@ -1555,7 +1571,7 @@ function getHtmlPropNormalizers(tag) {
1555
1571
  return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
1556
1572
  }
1557
1573
 
1558
- // ../core/dist/chunk-EHCOMLJ4.js
1574
+ // ../core/dist/chunk-3T4EM5FG.js
1559
1575
  var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
1560
1576
  var cx = clsx;
1561
1577
  var cva = (base, config) => (props) => {
@@ -1632,18 +1648,18 @@ var StaticClassResolver = class {
1632
1648
  };
1633
1649
  var VariantClassResolver = class _VariantClassResolver {
1634
1650
  #cvaFn;
1635
- #presetMap;
1651
+ #recipeMap;
1636
1652
  #variantKeys;
1637
1653
  #precomputedClasses;
1638
1654
  #cache = /* @__PURE__ */ new Map();
1639
- constructor(cvaFn, presetMap, variantKeys, precomputedClasses) {
1655
+ constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
1640
1656
  this.#cvaFn = cvaFn ?? null;
1641
- this.#presetMap = Object.freeze(presetMap ?? {});
1657
+ this.#recipeMap = Object.freeze(recipeMap ?? {});
1642
1658
  this.#variantKeys = variantKeys ?? null;
1643
1659
  this.#precomputedClasses = precomputedClasses ?? null;
1644
1660
  }
1645
- resolve({ props, variantKey }) {
1646
- const normalizedKey = variantKey ?? "__none__";
1661
+ resolve({ props, recipe }) {
1662
+ const normalizedKey = recipe ?? "__none__";
1647
1663
  const cacheKey = this.#createCacheKey(props, normalizedKey);
1648
1664
  if (this.#precomputedClasses !== null) {
1649
1665
  const precomputed = this.#precomputedClasses[cacheKey];
@@ -1655,7 +1671,7 @@ var VariantClassResolver = class _VariantClassResolver {
1655
1671
  this.#cache.set(cacheKey, cached);
1656
1672
  return cached;
1657
1673
  }
1658
- const result = this.#compute(props, variantKey);
1674
+ const result = this.#compute(props, recipe);
1659
1675
  this.#cache.set(cacheKey, result);
1660
1676
  if (this.#cache.size > 1e3) {
1661
1677
  const lru = this.#cache.keys().next().value;
@@ -1663,10 +1679,10 @@ var VariantClassResolver = class _VariantClassResolver {
1663
1679
  }
1664
1680
  return result;
1665
1681
  }
1666
- #compute(props, variantKey) {
1682
+ #compute(props, recipe) {
1667
1683
  if (!this.#cvaFn) return "";
1668
- if (!variantKey) return this.#cvaFn(props);
1669
- const preset = this.#presetMap[variantKey];
1684
+ if (!recipe) return this.#cvaFn(props);
1685
+ const preset = this.#recipeMap[recipe];
1670
1686
  if (!preset) return this.#cvaFn(props);
1671
1687
  return this.#cvaFn({ ...preset, ...props });
1672
1688
  }
@@ -1674,15 +1690,15 @@ var VariantClassResolver = class _VariantClassResolver {
1674
1690
  // props (className, id, etc.) produce identical CVA output and must not fragment the cache.
1675
1691
  // Iterating #variantKeys directly (fixed Set insertion order) avoids Object.keys + filter + sort.
1676
1692
  // String is built incrementally to avoid a parts[] array allocation on every render.
1677
- #createCacheKey(props, variantKey) {
1693
+ #createCacheKey(props, recipe) {
1678
1694
  if (this.#variantKeys !== null) {
1679
- let key2 = variantKey;
1695
+ let key2 = recipe;
1680
1696
  for (const k of this.#variantKeys) {
1681
1697
  if (k in props) key2 += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
1682
1698
  }
1683
1699
  return key2;
1684
1700
  }
1685
- let key = variantKey;
1701
+ let key = recipe;
1686
1702
  for (const k of Object.keys(props).sort()) {
1687
1703
  key += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
1688
1704
  }
@@ -1707,13 +1723,13 @@ function createClassPipeline(resolved) {
1707
1723
  const staticResolver = new StaticClassResolver(baseClass, resolved.tagMap);
1708
1724
  const variantResolver = new VariantClassResolver(
1709
1725
  cvaFn,
1710
- resolved.presetMap,
1726
+ resolved.recipeMap,
1711
1727
  variantKeys,
1712
1728
  resolved.precomputedClasses
1713
1729
  );
1714
- return function resolveClasses(tag, props, className, variantKey) {
1715
- const staticClasses = staticResolver.resolve(tag, variantKey !== void 0);
1716
- const variantClasses = variantResolver.resolve({ props, variantKey });
1730
+ return function resolveClasses(tag, props, className, recipe) {
1731
+ const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
1732
+ const variantClasses = variantResolver.resolve({ props, recipe });
1717
1733
  if (!className)
1718
1734
  return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
1719
1735
  return cn(staticClasses, variantClasses, className);
@@ -1992,13 +2008,13 @@ function buildRenderState(tag, directives, props, className, children) {
1992
2008
  return state;
1993
2009
  }
1994
2010
  function resolveRenderState(runtime, props, filterProps) {
1995
- const { as, asChild, children, className, variantKey, ...rest } = props;
2011
+ const { as, asChild, children, className, recipe, ...rest } = props;
1996
2012
  const tag = runtime.resolveTag(as);
1997
2013
  const mergedProps = runtime.resolveProps(rest);
1998
2014
  const baseProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(mergedProps) : mergedProps;
1999
2015
  const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
2000
2016
  const normalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), baseProps) : baseProps;
2001
- const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className, variantKey);
2017
+ const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className, recipe);
2002
2018
  const filteredProps = applyFilter(normalizedProps, filterProps, runtime.options.variantKeys);
2003
2019
  return buildRenderState(tag, buildDirectives(as, asChild), filteredProps, resolvedClass, children);
2004
2020
  }
@@ -2099,11 +2115,6 @@ function createContractComponent(options) {
2099
2115
  }
2100
2116
  return Component;
2101
2117
  }
2102
-
2103
- // ../../adapters/preact/src/define-contract-component.ts
2104
- function defineContractComponent(options) {
2105
- return (factory) => factory(options);
2106
- }
2107
2118
  export {
2108
2119
  Slottable,
2109
2120
  createContractComponent,
@@ -1,19 +1,17 @@
1
- import { E as ElementType, U as UnknownProps, V as VariantMap, P as PresetMap, a as EmptyRecord, A as AnyRecord, R as ReactFactoryOptions, b as PolymorphicComponent, c as PolymorphicGenerics, F as FactoryOptions } from '../merge-refs-tA18zYP6.js';
2
- export { d as AnyFactoryOptions, e as ElementRef, f as PolymorphicProps, g as PolymorphicWithAsChild, h as PolymorphicWithRender, i as RenderCallbackProps, S as Slottable, j as SlottableProps, m as mergeRefs } from '../merge-refs-tA18zYP6.js';
1
+ import { E as ElementType, U as UnknownProps, V as VariantMap, R as RecipeMap, a as EmptyRecord, A as AnyRecord, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics } from '../merge-refs-CfAbwCKz.js';
2
+ export { d as AnyFactoryOptions, e as ElementRef, F as FactoryOptions, f as PolymorphicProps, g as PolymorphicWithAsChild, h as PolymorphicWithRender, i as RenderCallbackProps, S as Slottable, j as SlottableProps, k as defineContractComponent, m as mergeRefs } from '../merge-refs-CfAbwCKz.js';
3
3
  import { Ref, ReactElement } from 'react';
4
4
  import 'type-fest';
5
5
 
6
- declare function createAriaEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
6
+ declare function createAriaEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
7
7
 
8
- declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
8
+ declare function createChildrenEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
9
9
 
10
- declare function createChildrenEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
10
+ 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, TAllowed extends ElementType = ElementType>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset, TAllowed>>;
11
11
 
12
- declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset, TAllowed>>;
12
+ declare function createContractedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
13
13
 
14
- declare function createContractedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
15
-
16
- declare function createPolymorphicComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
14
+ declare function createPolymorphicComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
17
15
 
18
16
  type SlotProps = {
19
17
  ref?: Ref<unknown> | null;
@@ -24,4 +22,4 @@ declare namespace Slot {
24
22
  var displayName: string;
25
23
  }
26
24
 
27
- export { ElementType, EmptyRecord, FactoryOptions, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent, defineContractComponent };
25
+ export { ElementType, EmptyRecord, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent };
@@ -11,12 +11,13 @@ import {
11
11
  composeFilter,
12
12
  createContractedPolymorphic,
13
13
  createPolymorphic,
14
+ defineContractComponent,
14
15
  isFunction,
15
16
  isPlainObject,
16
17
  mergeRefs,
17
18
  mergeSlotProps,
18
19
  render
19
- } from "../chunk-ACAKUHH5.js";
20
+ } from "../chunk-6RJN5B6L.js";
20
21
 
21
22
  // ../../adapters/react/src/current/slot/cloneSlotChild.ts
22
23
  import { Fragment } from "react";
@@ -87,11 +88,6 @@ function createAriaEnforcedComponent(options) {
87
88
  return Component;
88
89
  }
89
90
 
90
- // ../../adapters/react/src/current/define-contract-component.ts
91
- function defineContractComponent(options) {
92
- return (factory) => factory(options);
93
- }
94
-
95
91
  // ../../adapters/react/src/current/create-children-enforced-component.ts
96
92
  function createChildrenEnforcedComponent(options) {
97
93
  const name = options.name ?? "PolymorphicComponent";
@@ -1,17 +1,17 @@
1
- import { E as ElementType, U as UnknownProps, V as VariantMap, P as PresetMap, a as EmptyRecord, A as AnyRecord, R as ReactFactoryOptions, b as PolymorphicComponent, c as PolymorphicGenerics } from '../merge-refs-tA18zYP6.js';
2
- export { d as AnyFactoryOptions, e as ElementRef, F as FactoryOptions, f as PolymorphicProps, g as PolymorphicWithAsChild, h as PolymorphicWithRender, i as RenderCallbackProps, S as Slottable, j as SlottableProps, m as mergeRefs } from '../merge-refs-tA18zYP6.js';
1
+ import { E as ElementType, U as UnknownProps, V as VariantMap, R as RecipeMap, a as EmptyRecord, A as AnyRecord, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics } from '../merge-refs-CfAbwCKz.js';
2
+ export { d as AnyFactoryOptions, e as ElementRef, F as FactoryOptions, f as PolymorphicProps, g as PolymorphicWithAsChild, h as PolymorphicWithRender, i as RenderCallbackProps, S as Slottable, j as SlottableProps, k as defineContractComponent, m as mergeRefs } from '../merge-refs-CfAbwCKz.js';
3
3
  import * as react from 'react';
4
4
  import 'type-fest';
5
5
 
6
- declare function createAriaEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
6
+ declare function createAriaEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
7
7
 
8
- declare function createChildrenEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
8
+ declare function createChildrenEnforcedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
9
9
 
10
- declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset, TAllowed>>;
10
+ 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, TAllowed extends ElementType = ElementType>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset, TAllowed>>;
11
11
 
12
- declare function createContractedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
12
+ declare function createContractedComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
13
13
 
14
- declare function createPolymorphicComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
14
+ declare function createPolymorphicComponent<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: ReactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
15
15
 
16
16
  type SlotProps = {
17
17
  [key: string]: unknown;
@@ -11,12 +11,13 @@ import {
11
11
  composeFilter,
12
12
  createContractedPolymorphic,
13
13
  createPolymorphic,
14
+ defineContractComponent,
14
15
  isFunction,
15
16
  isPlainObject,
16
17
  mergeRefs,
17
18
  mergeSlotProps,
18
19
  render
19
- } from "../chunk-ACAKUHH5.js";
20
+ } from "../chunk-6RJN5B6L.js";
20
21
 
21
22
  // ../../adapters/react/src/legacy/create-aria-enforced-component.ts
22
23
  import { forwardRef as forwardRef2 } from "react";
@@ -201,5 +202,6 @@ export {
201
202
  createContractComponent,
202
203
  createContractedComponent,
203
204
  createPolymorphicComponent,
205
+ defineContractComponent,
204
206
  mergeRefs
205
207
  };