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.
@@ -1,117 +1,6 @@
1
- // ../../adapters/react/src/shared/merge-refs.ts
2
- function mergeRefs(...refs) {
3
- const active = refs.filter((r2) => r2 != null);
4
- if (active.length === 0) return null;
5
- if (active.length === 1) return active[0];
6
- return (value) => {
7
- for (const ref of active) {
8
- if (typeof ref === "function") {
9
- ref(value);
10
- } else {
11
- ref.current = value;
12
- }
13
- }
14
- };
15
- }
16
-
17
- // ../../adapters/react/src/shared/slot/Slottable.tsx
18
- import { Fragment } from "react";
19
- import { jsx } from "react/jsx-runtime";
20
- function Slottable({ children }) {
21
- return /* @__PURE__ */ jsx(Fragment, { children });
22
- }
23
-
24
- // ../../lib/primitive/src/utils/is-object.ts
25
- function isNull(value) {
26
- return value === null;
27
- }
28
- function isObject(value) {
29
- return !isNull(value) && typeof value === "object";
30
- }
31
-
32
- // ../../lib/primitive/src/merge/constants.ts
33
- var EVENT_HANDLER_RE = /^on[A-Z]/;
34
-
35
- // ../../lib/primitive/src/merge/predicates.ts
36
- function isFunction(value) {
37
- return typeof value === "function";
38
- }
39
- function isPlainObject(value) {
40
- if (!isObject(value)) return false;
41
- const proto = Object.getPrototypeOf(value);
42
- return proto === Object.prototype || proto === null;
43
- }
44
-
45
- // ../shared/src/constants/primitive/slot-name.ts
46
- var SLOT_NAME = "Slot";
47
-
48
- // ../../adapters/react/src/shared/slot/clone.ts
49
- import { cloneElement } from "react";
50
- function cloneWithProps(child, props, ref) {
51
- return cloneElement(child, ref !== null ? { ...props, ref } : props);
52
- }
53
-
54
- // ../../adapters/react/src/shared/slot/invariant.ts
55
- function panic(message) {
56
- throw new Error(message);
57
- }
58
- function invariant(condition, message) {
59
- if (!condition) panic(message);
60
- }
61
-
62
- // ../../adapters/react/src/shared/slot/applySlot.ts
63
- import { isValidElement as isValidElement3 } from "react";
64
-
65
- // ../../adapters/react/src/shared/slot/extractSlottable.ts
66
- import { createElement, Fragment as Fragment2, isValidElement as isValidElement2 } from "react";
67
-
68
- // ../../adapters/react/src/shared/slot/predicates.ts
69
- import { isValidElement } from "react";
70
- function isSlottableElement(value) {
71
- return isValidElement(value) && value.type === Slottable;
72
- }
73
-
74
- // ../../adapters/react/src/shared/slot/extractSlottable.ts
75
- function extractSlottable(children) {
76
- const childrenArray = Array.isArray(children) ? children : [children];
77
- const slottables = childrenArray.filter(isSlottableElement);
78
- invariant(slottables.length <= 1, "Slot: multiple Slottable children are not allowed");
79
- if (slottables.length === 0) {
80
- return null;
81
- }
82
- const [slottable] = slottables;
83
- invariant(slottable, "Missing Slottable element");
84
- const child = slottable.props.children;
85
- invariant(
86
- child !== null && child !== void 0,
87
- "Slottable expects exactly one React element child, received null"
88
- );
89
- invariant(
90
- typeof child !== "string" && typeof child !== "number",
91
- "Slottable expects exactly one React element child, received text content"
92
- );
93
- invariant(isValidElement2(child), "Slottable expects exactly one React element child");
94
- invariant(child.type !== Fragment2, "Slottable child cannot be a Fragment");
95
- const index = childrenArray.indexOf(slottable);
96
- return {
97
- child,
98
- // Fragment wrapper: Slot owns no DOM node; ref composition happens only on the merge target.
99
- rebuild(merged) {
100
- const out = childrenArray.map((node, i) => i === index ? merged : node);
101
- return createElement(Fragment2, null, ...out);
102
- }
103
- };
104
- }
105
-
106
- // ../../adapters/react/src/shared/slot/applySlot.ts
107
- function applySlot(children, slotProps, ref, cloneSlotChild) {
108
- const extraction = extractSlottable(children);
109
- if (extraction) {
110
- const merged = cloneSlotChild({ child: extraction.child, slotProps, ref });
111
- return extraction.rebuild(merged);
112
- }
113
- invariant(isValidElement3(children), "Slot: child must be a valid React element");
114
- return cloneSlotChild({ child: children, slotProps, ref });
1
+ // ../../lib/adapter-utils/src/define-component.ts
2
+ function defineContractComponent(options) {
3
+ return (factory) => factory(options);
115
4
  }
116
5
 
117
6
  // ../../lib/adapter-utils/src/apply-filter.ts
@@ -125,7 +14,7 @@ function applyFilter(props, filterProps, variantKeys) {
125
14
  return out;
126
15
  }
127
16
 
128
- // ../core/dist/chunk-XFCAUPVZ.js
17
+ // ../core/dist/chunk-KKSHJDE7.js
129
18
  function makeResolveTag(defaultTag) {
130
19
  return function tag(as) {
131
20
  return as ?? defaultTag;
@@ -156,11 +45,11 @@ function mergeProps(defaultProps, props) {
156
45
  ...props
157
46
  };
158
47
  }
159
- function isNull2(value) {
48
+ function isNull(value) {
160
49
  return value === null;
161
50
  }
162
- function isObject2(value) {
163
- return !isNull2(value) && typeof value === "object";
51
+ function isObject(value) {
52
+ return !isNull(value) && typeof value === "object";
164
53
  }
165
54
  function isString(value) {
166
55
  return typeof value === "string";
@@ -194,7 +83,7 @@ function resolveFactoryOptions(options = {}) {
194
83
  ...whenDefined("defaultProps", options.defaults),
195
84
  ...whenDefined("baseClassName", styling?.base),
196
85
  ...whenDefined("tagMap", styling?.tags),
197
- ...whenDefined("presetMap", styling?.presets),
86
+ ...whenDefined("recipeMap", styling?.presets),
198
87
  ...whenDefined("variants", styling?.variants),
199
88
  ...whenDefined("defaultVariants", styling?.defaults),
200
89
  ...whenDefined("compoundVariants", styling?.compounds),
@@ -235,10 +124,10 @@ function validateFactoryOptions(resolved) {
235
124
  }
236
125
  }
237
126
  };
238
- const { presetMap } = resolved;
239
- if (presetMap) {
240
- for (const presetKey in presetMap) {
241
- checkSelection(`preset "${presetKey}"`, presetMap[presetKey]);
127
+ const { recipeMap } = resolved;
128
+ if (recipeMap) {
129
+ for (const recipeKey in recipeMap) {
130
+ checkSelection(`preset "${recipeKey}"`, recipeMap[recipeKey]);
242
131
  }
243
132
  }
244
133
  if (resolved.defaultVariants) checkSelection("defaults", resolved.defaultVariants);
@@ -274,12 +163,12 @@ function report2(strict, message) {
274
163
  function label(name) {
275
164
  return name ? `[${name}]` : "[createContractComponent]";
276
165
  }
277
- function validateRenderProps(options, props, presetKey) {
278
- const { strict, presetMap, variants, displayName } = options;
166
+ function validateRenderProps(options, props, recipeKey) {
167
+ const { strict, recipeMap, variants, displayName } = options;
279
168
  if (!strict) return;
280
169
  const tag = label(displayName);
281
- if (presetKey !== void 0 && (!presetMap || !Object.hasOwn(presetMap, presetKey))) {
282
- report2(strict, `${tag} Unknown presetKey "${presetKey}" \u2014 no preset with that name exists.`);
170
+ if (recipeKey !== void 0 && (!recipeMap || !Object.hasOwn(recipeMap, recipeKey))) {
171
+ report2(strict, `${tag} Unknown recipeKey "${recipeKey}" \u2014 no preset with that name exists.`);
283
172
  }
284
173
  if (variants) {
285
174
  for (const key in variants) {
@@ -296,7 +185,7 @@ function validateRenderProps(options, props, presetKey) {
296
185
  }
297
186
  }
298
187
  }
299
- function panic2(message) {
188
+ function panic(message) {
300
189
  throw new Error(message);
301
190
  }
302
191
  function describe(value) {
@@ -306,21 +195,21 @@ function describe(value) {
306
195
  }
307
196
  function assertPluginShape(result) {
308
197
  if (result === null || typeof result !== "object")
309
- panic2(
198
+ panic(
310
199
  `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${result === null ? "null" : typeof result}.`
311
200
  );
312
201
  const plugin = result;
313
202
  if (typeof plugin.pipeline !== "function")
314
- panic2(
203
+ panic(
315
204
  `[praxis-kit] Plugin factory return value is missing a 'pipeline' function. Got pipeline: ${typeof plugin.pipeline}.`
316
205
  );
317
206
  }
318
207
  function guardPipeline(pipeline) {
319
208
  if (process.env.NODE_ENV === "production") return pipeline;
320
- return function guardedPipeline(tag, props, className, variantKey) {
321
- const result = pipeline(tag, props, className, variantKey);
209
+ return function guardedPipeline(tag, props, className, recipe) {
210
+ const result = pipeline(tag, props, className, recipe);
322
211
  if (typeof result !== "string")
323
- panic2(`[praxis-kit] Plugin pipeline must return a string. Got: ${describe(result)}.`);
212
+ panic(`[praxis-kit] Plugin pipeline must return a string. Got: ${describe(result)}.`);
324
213
  return result;
325
214
  };
326
215
  }
@@ -343,11 +232,11 @@ function createRuntimeMethods(resolved, classPipeline, engine) {
343
232
  resolveProps(props) {
344
233
  return mergeProps(resolved.defaultProps, props);
345
234
  },
346
- resolveClasses(tag, props, className, variantKey) {
235
+ resolveClasses(tag, props, className, recipe) {
347
236
  if (process.env.NODE_ENV !== "production") {
348
- validateRenderProps(resolved, props, variantKey);
237
+ validateRenderProps(resolved, props, recipe);
349
238
  }
350
- return classPipeline(tag, props, className, variantKey);
239
+ return classPipeline(tag, props, className, recipe);
351
240
  },
352
241
  resolveAria(tag, props) {
353
242
  if (!engine) return { props };
@@ -696,7 +585,7 @@ function isKnownAriaRole(value) {
696
585
  return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
697
586
  }
698
587
 
699
- // ../core/dist/chunk-VU44HAB7.js
588
+ // ../core/dist/chunk-2NJ5XLOA.js
700
589
  var IMPLICIT_ROLE_RECORD2 = {
701
590
  article: "article",
702
591
  aside: "complementary",
@@ -725,26 +614,37 @@ function getImplicitRole(tag) {
725
614
  if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
726
615
  return void 0;
727
616
  }
728
- var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
729
- function resolveChildTag(child) {
730
- if (!isObject2(child) || !("type" in child)) return void 0;
617
+ var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
618
+ function getAsProp(child) {
619
+ if (!isObject(child) || !("props" in child)) return void 0;
620
+ const props = child.props;
621
+ if (!isObject(props)) return void 0;
622
+ const as = props.as;
623
+ return isString(as) && as !== "" ? as : void 0;
624
+ }
625
+ function getTag(child) {
626
+ if (!isObject(child) || !("type" in child)) return void 0;
731
627
  const t = child.type;
732
628
  if (isString(t)) return t;
733
- if (isObject2(t) && COMPONENT_DEFAULT_TAG in t) {
629
+ if (typeof t === "function" || isObject(t)) {
734
630
  const defaultTag = t[COMPONENT_DEFAULT_TAG];
735
631
  if (!isString(defaultTag)) return void 0;
736
- const props = child.props;
737
- const as = isObject2(props) && "as" in props ? props.as : void 0;
738
- return isString(as) ? as : defaultTag;
632
+ return getAsProp(child) ?? defaultTag;
739
633
  }
740
634
  return void 0;
741
635
  }
742
- function isTag(...tags) {
636
+ function isTag(...args) {
637
+ if (isString(args[0])) {
638
+ const set2 = new Set(args);
639
+ return (child2) => {
640
+ const tag2 = getTag(child2);
641
+ return tag2 !== void 0 && set2.has(tag2);
642
+ };
643
+ }
644
+ const [child, ...tags] = args;
743
645
  const set = new Set(tags);
744
- return (child) => {
745
- const tag = resolveChildTag(child);
746
- return tag !== void 0 && set.has(tag);
747
- };
646
+ const tag = getTag(child);
647
+ return tag !== void 0 && set.has(tag);
748
648
  }
749
649
  var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
750
650
  var asyncWarnScheduled2 = false;
@@ -791,7 +691,7 @@ var StrictBase = class {
791
691
  }
792
692
  }
793
693
  };
794
- function isNull3(value) {
694
+ function isNull2(value) {
795
695
  return value === null;
796
696
  }
797
697
  var VALID = [{ valid: true }];
@@ -946,7 +846,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends StrictBase {
946
846
  }
947
847
  validate(tag, props) {
948
848
  const key = _AriaPolicyEngine.#createPlanKey(tag, props);
949
- if (!isNull3(key)) {
849
+ if (!isNull2(key)) {
950
850
  const cached = this.#planCache.get(key);
951
851
  if (cached !== void 0) {
952
852
  this.#planCache.delete(key);
@@ -960,7 +860,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends StrictBase {
960
860
  }
961
861
  const result = this.#extraRules.length ? _AriaPolicyEngine.#evaluateWithRules(tag, props, this.#extraRules) : _AriaPolicyEngine.evaluate(tag, props);
962
862
  if (result.violations.length > 0) this.report(result.violations);
963
- if (!isNull3(key)) {
863
+ if (!isNull2(key)) {
964
864
  const { removals, updates } = _AriaPolicyEngine.#computePlan(
965
865
  props,
966
866
  result.props
@@ -1243,7 +1143,7 @@ function normalizeChildRule(rule) {
1243
1143
  };
1244
1144
  }
1245
1145
  function getChildType(child) {
1246
- if (!isObject2(child) || !("type" in child)) return void 0;
1146
+ if (!isObject(child) || !("type" in child)) return void 0;
1247
1147
  return child.type;
1248
1148
  }
1249
1149
  function buildPartialIndex(rules) {
@@ -1553,7 +1453,7 @@ function landmarkRoleRule({ tag, props, implicitRole }) {
1553
1453
  var HTML_ARIA_RULES = [landmarkRoleRule];
1554
1454
  function isOpenContent(...blockedTags) {
1555
1455
  const set = new Set(blockedTags);
1556
- return (child) => isObject2(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
1456
+ return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
1557
1457
  }
1558
1458
  var METADATA_TAGS = ["script", "template"];
1559
1459
  var metadataMatch = isTag(...METADATA_TAGS);
@@ -1721,7 +1621,7 @@ function enforceAllowedAs(tag, allowedAs, strict, displayName) {
1721
1621
  }
1722
1622
  }
1723
1623
 
1724
- // ../core/dist/chunk-EHCOMLJ4.js
1624
+ // ../core/dist/chunk-3T4EM5FG.js
1725
1625
  var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
1726
1626
  var cx = clsx;
1727
1627
  var cva = (base, config) => (props) => {
@@ -1798,18 +1698,18 @@ var StaticClassResolver = class {
1798
1698
  };
1799
1699
  var VariantClassResolver = class _VariantClassResolver {
1800
1700
  #cvaFn;
1801
- #presetMap;
1701
+ #recipeMap;
1802
1702
  #variantKeys;
1803
1703
  #precomputedClasses;
1804
1704
  #cache = /* @__PURE__ */ new Map();
1805
- constructor(cvaFn, presetMap, variantKeys, precomputedClasses) {
1705
+ constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
1806
1706
  this.#cvaFn = cvaFn ?? null;
1807
- this.#presetMap = Object.freeze(presetMap ?? {});
1707
+ this.#recipeMap = Object.freeze(recipeMap ?? {});
1808
1708
  this.#variantKeys = variantKeys ?? null;
1809
1709
  this.#precomputedClasses = precomputedClasses ?? null;
1810
1710
  }
1811
- resolve({ props, variantKey }) {
1812
- const normalizedKey = variantKey ?? "__none__";
1711
+ resolve({ props, recipe }) {
1712
+ const normalizedKey = recipe ?? "__none__";
1813
1713
  const cacheKey = this.#createCacheKey(props, normalizedKey);
1814
1714
  if (this.#precomputedClasses !== null) {
1815
1715
  const precomputed = this.#precomputedClasses[cacheKey];
@@ -1821,7 +1721,7 @@ var VariantClassResolver = class _VariantClassResolver {
1821
1721
  this.#cache.set(cacheKey, cached);
1822
1722
  return cached;
1823
1723
  }
1824
- const result = this.#compute(props, variantKey);
1724
+ const result = this.#compute(props, recipe);
1825
1725
  this.#cache.set(cacheKey, result);
1826
1726
  if (this.#cache.size > 1e3) {
1827
1727
  const lru = this.#cache.keys().next().value;
@@ -1829,10 +1729,10 @@ var VariantClassResolver = class _VariantClassResolver {
1829
1729
  }
1830
1730
  return result;
1831
1731
  }
1832
- #compute(props, variantKey) {
1732
+ #compute(props, recipe) {
1833
1733
  if (!this.#cvaFn) return "";
1834
- if (!variantKey) return this.#cvaFn(props);
1835
- const preset = this.#presetMap[variantKey];
1734
+ if (!recipe) return this.#cvaFn(props);
1735
+ const preset = this.#recipeMap[recipe];
1836
1736
  if (!preset) return this.#cvaFn(props);
1837
1737
  return this.#cvaFn({ ...preset, ...props });
1838
1738
  }
@@ -1840,15 +1740,15 @@ var VariantClassResolver = class _VariantClassResolver {
1840
1740
  // props (className, id, etc.) produce identical CVA output and must not fragment the cache.
1841
1741
  // Iterating #variantKeys directly (fixed Set insertion order) avoids Object.keys + filter + sort.
1842
1742
  // String is built incrementally to avoid a parts[] array allocation on every render.
1843
- #createCacheKey(props, variantKey) {
1743
+ #createCacheKey(props, recipe) {
1844
1744
  if (this.#variantKeys !== null) {
1845
- let key2 = variantKey;
1745
+ let key2 = recipe;
1846
1746
  for (const k of this.#variantKeys) {
1847
1747
  if (k in props) key2 += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
1848
1748
  }
1849
1749
  return key2;
1850
1750
  }
1851
- let key = variantKey;
1751
+ let key = recipe;
1852
1752
  for (const k of Object.keys(props).sort()) {
1853
1753
  key += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
1854
1754
  }
@@ -1873,13 +1773,13 @@ function createClassPipeline(resolved) {
1873
1773
  const staticResolver = new StaticClassResolver(baseClass, resolved.tagMap);
1874
1774
  const variantResolver = new VariantClassResolver(
1875
1775
  cvaFn,
1876
- resolved.presetMap,
1776
+ resolved.recipeMap,
1877
1777
  variantKeys,
1878
1778
  resolved.precomputedClasses
1879
1779
  );
1880
- return function resolveClasses(tag, props, className, variantKey) {
1881
- const staticClasses = staticResolver.resolve(tag, variantKey !== void 0);
1882
- const variantClasses = variantResolver.resolve({ props, variantKey });
1780
+ return function resolveClasses(tag, props, className, recipe) {
1781
+ const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
1782
+ const variantClasses = variantResolver.resolve({ props, recipe });
1883
1783
  if (!className)
1884
1784
  return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
1885
1785
  return cn(staticClasses, variantClasses, className);
@@ -1951,6 +1851,30 @@ var SlotValidator = class extends StrictBase {
1951
1851
  }
1952
1852
  };
1953
1853
 
1854
+ // ../../lib/primitive/src/utils/is-object.ts
1855
+ function isNull3(value) {
1856
+ return value === null;
1857
+ }
1858
+ function isObject2(value) {
1859
+ return !isNull3(value) && typeof value === "object";
1860
+ }
1861
+
1862
+ // ../../lib/primitive/src/merge/constants.ts
1863
+ var EVENT_HANDLER_RE = /^on[A-Z]/;
1864
+
1865
+ // ../../lib/primitive/src/merge/predicates.ts
1866
+ function isFunction(value) {
1867
+ return typeof value === "function";
1868
+ }
1869
+ function isPlainObject(value) {
1870
+ if (!isObject2(value)) return false;
1871
+ const proto = Object.getPrototypeOf(value);
1872
+ return proto === Object.prototype || proto === null;
1873
+ }
1874
+
1875
+ // ../shared/src/constants/primitive/slot-name.ts
1876
+ var SLOT_NAME = "Slot";
1877
+
1954
1878
  // ../../lib/adapter-utils/src/slot/policies.ts
1955
1879
  import { clsx as clsx2 } from "clsx";
1956
1880
  function chainHandlers(childHandler, slotHandler) {
@@ -1995,6 +1919,98 @@ function applyMergePolicy(key, slotVal, childVal) {
1995
1919
  return policyHandlers[classifyProp(key, slotVal, childVal)](slotVal, childVal);
1996
1920
  }
1997
1921
 
1922
+ // ../../adapters/react/src/shared/merge-refs.ts
1923
+ function mergeRefs(...refs) {
1924
+ const active = refs.filter((r2) => r2 != null);
1925
+ if (active.length === 0) return null;
1926
+ if (active.length === 1) return active[0];
1927
+ return (value) => {
1928
+ for (const ref of active) {
1929
+ if (typeof ref === "function") {
1930
+ ref(value);
1931
+ } else {
1932
+ ref.current = value;
1933
+ }
1934
+ }
1935
+ };
1936
+ }
1937
+
1938
+ // ../../adapters/react/src/shared/slot/Slottable.tsx
1939
+ import { Fragment } from "react";
1940
+ import { jsx } from "react/jsx-runtime";
1941
+ function Slottable({ children }) {
1942
+ return /* @__PURE__ */ jsx(Fragment, { children });
1943
+ }
1944
+
1945
+ // ../../adapters/react/src/shared/slot/clone.ts
1946
+ import { cloneElement } from "react";
1947
+ function cloneWithProps(child, props, ref) {
1948
+ return cloneElement(child, ref !== null ? { ...props, ref } : props);
1949
+ }
1950
+
1951
+ // ../../adapters/react/src/shared/slot/invariant.ts
1952
+ function panic2(message) {
1953
+ throw new Error(message);
1954
+ }
1955
+ function invariant(condition, message) {
1956
+ if (!condition) panic2(message);
1957
+ }
1958
+
1959
+ // ../../adapters/react/src/shared/slot/applySlot.ts
1960
+ import { isValidElement as isValidElement3 } from "react";
1961
+
1962
+ // ../../adapters/react/src/shared/slot/extractSlottable.ts
1963
+ import { createElement, Fragment as Fragment2, isValidElement as isValidElement2 } from "react";
1964
+
1965
+ // ../../adapters/react/src/shared/slot/predicates.ts
1966
+ import { isValidElement } from "react";
1967
+ function isSlottableElement(value) {
1968
+ return isValidElement(value) && value.type === Slottable;
1969
+ }
1970
+
1971
+ // ../../adapters/react/src/shared/slot/extractSlottable.ts
1972
+ function extractSlottable(children) {
1973
+ const childrenArray = Array.isArray(children) ? children : [children];
1974
+ const slottables = childrenArray.filter(isSlottableElement);
1975
+ invariant(slottables.length <= 1, "Slot: multiple Slottable children are not allowed");
1976
+ if (slottables.length === 0) {
1977
+ return null;
1978
+ }
1979
+ const [slottable] = slottables;
1980
+ invariant(slottable, "Missing Slottable element");
1981
+ const child = slottable.props.children;
1982
+ invariant(
1983
+ child !== null && child !== void 0,
1984
+ "Slottable expects exactly one React element child, received null"
1985
+ );
1986
+ invariant(
1987
+ typeof child !== "string" && typeof child !== "number",
1988
+ "Slottable expects exactly one React element child, received text content"
1989
+ );
1990
+ invariant(isValidElement2(child), "Slottable expects exactly one React element child");
1991
+ invariant(child.type !== Fragment2, "Slottable child cannot be a Fragment");
1992
+ const index = childrenArray.indexOf(slottable);
1993
+ return {
1994
+ child,
1995
+ // Fragment wrapper: Slot owns no DOM node; ref composition happens only on the merge target.
1996
+ rebuild(merged) {
1997
+ const out = childrenArray.map((node, i) => i === index ? merged : node);
1998
+ return createElement(Fragment2, null, ...out);
1999
+ }
2000
+ };
2001
+ }
2002
+
2003
+ // ../../adapters/react/src/shared/slot/applySlot.ts
2004
+ function applySlot(children, slotProps, ref, cloneSlotChild) {
2005
+ const extraction = extractSlottable(children);
2006
+ if (extraction) {
2007
+ const merged = cloneSlotChild({ child: extraction.child, slotProps, ref });
2008
+ return extraction.rebuild(merged);
2009
+ }
2010
+ invariant(isValidElement3(children), "Slot: child must be a valid React element");
2011
+ return cloneSlotChild({ child: children, slotProps, ref });
2012
+ }
2013
+
1998
2014
  // ../../adapters/react/src/shared/slot/slot-validator.ts
1999
2015
  var SlotValidator2 = class extends SlotValidator {
2000
2016
  constructor(name, strict) {
@@ -2031,8 +2047,8 @@ function buildRuntime(options, defaultSlot, normalizeChildren) {
2031
2047
  }
2032
2048
 
2033
2049
  // ../shared/src/guards/children/component-id.ts
2034
- var COMPONENT_ID2 = /* @__PURE__ */ Symbol("praxis.component-id");
2035
- var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
2050
+ var COMPONENT_ID2 = /* @__PURE__ */ Symbol.for("praxis.component-id");
2051
+ var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
2036
2052
 
2037
2053
  // ../../adapters/react/src/shared/apply-display-name.ts
2038
2054
  function applyDisplayName(component, name) {
@@ -2058,7 +2074,7 @@ function buildRenderState(tag, directives, props, className, children) {
2058
2074
  return state;
2059
2075
  }
2060
2076
  function resolveRenderState(runtime, props, filterProps) {
2061
- const { as, asChild, render: _render, children, className, variantKey, ...rest } = props;
2077
+ const { as, asChild, render: _render, children, className, recipe, ...rest } = props;
2062
2078
  const tag = runtime.resolveTag(as);
2063
2079
  if (runtime.options.allowedAs !== void 0 && as !== void 0) {
2064
2080
  enforceAllowedAs(
@@ -2072,7 +2088,7 @@ function resolveRenderState(runtime, props, filterProps) {
2072
2088
  const baseProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(mergedProps) : mergedProps;
2073
2089
  const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
2074
2090
  const normalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), baseProps) : baseProps;
2075
- const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className, variantKey);
2091
+ const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className, recipe);
2076
2092
  const filteredProps = applyFilter(normalizedProps, filterProps, runtime.options.variantKeys);
2077
2093
  return buildRenderState(tag, buildDirectives(as, asChild), filteredProps, resolvedClass, children);
2078
2094
  }
@@ -2186,6 +2202,7 @@ function createContractedPolymorphic(options = {}) {
2186
2202
  export {
2187
2203
  createPolymorphic,
2188
2204
  createContractedPolymorphic,
2205
+ defineContractComponent,
2189
2206
  buildEngines,
2190
2207
  composeFilter,
2191
2208
  isFunction,
@@ -1,21 +1,2 @@
1
- import { Project } from 'ts-morph';
2
1
 
3
- declare function resolveReplacement(specifier: string): string | undefined;
4
- declare function migratePathsInProject(project: Project, options: {
5
- isDryRun: boolean;
6
- isVerbose: boolean;
7
- }): {
8
- totalRewrites: number;
9
- filesModified: number;
10
- };
11
- declare function renameInProject(project: Project, options: {
12
- fromName: string;
13
- toName: string;
14
- isDryRun: boolean;
15
- isVerbose: boolean;
16
- }): {
17
- totalRenames: number;
18
- filesModified: number;
19
- };
20
-
21
- export { migratePathsInProject, renameInProject, resolveReplacement };
2
+ export { }