praxis-kit 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ACAKUHH5.js → chunk-PBBPAHMV.js} +170 -164
- package/dist/contract/index.d.ts +9 -9
- package/dist/contract/index.js +2 -2
- package/dist/lit/index.d.ts +14 -14
- package/dist/lit/index.js +45 -45
- package/dist/{merge-refs-tA18zYP6.d.ts → merge-refs-CfAbwCKz.d.ts} +16 -14
- package/dist/preact/index.d.ts +16 -16
- package/dist/preact/index.js +40 -40
- package/dist/react/index.d.ts +8 -10
- package/dist/react/index.js +2 -6
- package/dist/react/legacy.d.ts +7 -7
- package/dist/react/legacy.js +3 -1
- package/dist/solid/index.d.ts +17 -17
- package/dist/solid/index.js +40 -40
- package/dist/svelte/index.d.ts +20 -20
- package/dist/svelte/index.js +38 -38
- package/dist/tailwind/index.js +23 -23
- package/dist/vite-plugin/index.d.ts +76 -50
- package/dist/vite-plugin/index.js +146 -41
- package/dist/vue/index.d.ts +16 -16
- package/dist/vue/index.js +40 -40
- package/dist/web/index.d.ts +14 -14
- package/dist/web/index.js +43 -43
- package/package.json +3 -3
package/dist/preact/index.js
CHANGED
|
@@ -49,7 +49,12 @@ function applyFilter(props, filterProps, variantKeys) {
|
|
|
49
49
|
return out;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
//
|
|
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("
|
|
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 {
|
|
163
|
-
if (
|
|
164
|
-
for (const
|
|
165
|
-
checkSelection(`preset "${
|
|
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,
|
|
202
|
-
const { strict,
|
|
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 (
|
|
206
|
-
report2(strict, `${tag} Unknown
|
|
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,
|
|
245
|
-
const result = pipeline(tag, props, className,
|
|
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,
|
|
275
|
+
resolveClasses(tag, props, className, recipe) {
|
|
271
276
|
if (process.env.NODE_ENV !== "production") {
|
|
272
|
-
validateRenderProps(resolved, props,
|
|
277
|
+
validateRenderProps(resolved, props, recipe);
|
|
273
278
|
}
|
|
274
|
-
return classPipeline(tag, props, className,
|
|
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-
|
|
628
|
+
// ../core/dist/chunk-BNVYTMYV.js
|
|
624
629
|
var IMPLICIT_ROLE_RECORD2 = {
|
|
625
630
|
article: "article",
|
|
626
631
|
aside: "complementary",
|
|
@@ -1555,7 +1560,7 @@ function getHtmlPropNormalizers(tag) {
|
|
|
1555
1560
|
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
1556
1561
|
}
|
|
1557
1562
|
|
|
1558
|
-
// ../core/dist/chunk-
|
|
1563
|
+
// ../core/dist/chunk-3T4EM5FG.js
|
|
1559
1564
|
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
1560
1565
|
var cx = clsx;
|
|
1561
1566
|
var cva = (base, config) => (props) => {
|
|
@@ -1632,18 +1637,18 @@ var StaticClassResolver = class {
|
|
|
1632
1637
|
};
|
|
1633
1638
|
var VariantClassResolver = class _VariantClassResolver {
|
|
1634
1639
|
#cvaFn;
|
|
1635
|
-
#
|
|
1640
|
+
#recipeMap;
|
|
1636
1641
|
#variantKeys;
|
|
1637
1642
|
#precomputedClasses;
|
|
1638
1643
|
#cache = /* @__PURE__ */ new Map();
|
|
1639
|
-
constructor(cvaFn,
|
|
1644
|
+
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
1640
1645
|
this.#cvaFn = cvaFn ?? null;
|
|
1641
|
-
this.#
|
|
1646
|
+
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
1642
1647
|
this.#variantKeys = variantKeys ?? null;
|
|
1643
1648
|
this.#precomputedClasses = precomputedClasses ?? null;
|
|
1644
1649
|
}
|
|
1645
|
-
resolve({ props,
|
|
1646
|
-
const normalizedKey =
|
|
1650
|
+
resolve({ props, recipe }) {
|
|
1651
|
+
const normalizedKey = recipe ?? "__none__";
|
|
1647
1652
|
const cacheKey = this.#createCacheKey(props, normalizedKey);
|
|
1648
1653
|
if (this.#precomputedClasses !== null) {
|
|
1649
1654
|
const precomputed = this.#precomputedClasses[cacheKey];
|
|
@@ -1655,7 +1660,7 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
1655
1660
|
this.#cache.set(cacheKey, cached);
|
|
1656
1661
|
return cached;
|
|
1657
1662
|
}
|
|
1658
|
-
const result = this.#compute(props,
|
|
1663
|
+
const result = this.#compute(props, recipe);
|
|
1659
1664
|
this.#cache.set(cacheKey, result);
|
|
1660
1665
|
if (this.#cache.size > 1e3) {
|
|
1661
1666
|
const lru = this.#cache.keys().next().value;
|
|
@@ -1663,10 +1668,10 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
1663
1668
|
}
|
|
1664
1669
|
return result;
|
|
1665
1670
|
}
|
|
1666
|
-
#compute(props,
|
|
1671
|
+
#compute(props, recipe) {
|
|
1667
1672
|
if (!this.#cvaFn) return "";
|
|
1668
|
-
if (!
|
|
1669
|
-
const preset = this.#
|
|
1673
|
+
if (!recipe) return this.#cvaFn(props);
|
|
1674
|
+
const preset = this.#recipeMap[recipe];
|
|
1670
1675
|
if (!preset) return this.#cvaFn(props);
|
|
1671
1676
|
return this.#cvaFn({ ...preset, ...props });
|
|
1672
1677
|
}
|
|
@@ -1674,15 +1679,15 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
1674
1679
|
// props (className, id, etc.) produce identical CVA output and must not fragment the cache.
|
|
1675
1680
|
// Iterating #variantKeys directly (fixed Set insertion order) avoids Object.keys + filter + sort.
|
|
1676
1681
|
// String is built incrementally to avoid a parts[] array allocation on every render.
|
|
1677
|
-
#createCacheKey(props,
|
|
1682
|
+
#createCacheKey(props, recipe) {
|
|
1678
1683
|
if (this.#variantKeys !== null) {
|
|
1679
|
-
let key2 =
|
|
1684
|
+
let key2 = recipe;
|
|
1680
1685
|
for (const k of this.#variantKeys) {
|
|
1681
1686
|
if (k in props) key2 += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
1682
1687
|
}
|
|
1683
1688
|
return key2;
|
|
1684
1689
|
}
|
|
1685
|
-
let key =
|
|
1690
|
+
let key = recipe;
|
|
1686
1691
|
for (const k of Object.keys(props).sort()) {
|
|
1687
1692
|
key += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
1688
1693
|
}
|
|
@@ -1707,13 +1712,13 @@ function createClassPipeline(resolved) {
|
|
|
1707
1712
|
const staticResolver = new StaticClassResolver(baseClass, resolved.tagMap);
|
|
1708
1713
|
const variantResolver = new VariantClassResolver(
|
|
1709
1714
|
cvaFn,
|
|
1710
|
-
resolved.
|
|
1715
|
+
resolved.recipeMap,
|
|
1711
1716
|
variantKeys,
|
|
1712
1717
|
resolved.precomputedClasses
|
|
1713
1718
|
);
|
|
1714
|
-
return function resolveClasses(tag, props, className,
|
|
1715
|
-
const staticClasses = staticResolver.resolve(tag,
|
|
1716
|
-
const variantClasses = variantResolver.resolve({ props,
|
|
1719
|
+
return function resolveClasses(tag, props, className, recipe) {
|
|
1720
|
+
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
1721
|
+
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
1717
1722
|
if (!className)
|
|
1718
1723
|
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
1719
1724
|
return cn(staticClasses, variantClasses, className);
|
|
@@ -1992,13 +1997,13 @@ function buildRenderState(tag, directives, props, className, children) {
|
|
|
1992
1997
|
return state;
|
|
1993
1998
|
}
|
|
1994
1999
|
function resolveRenderState(runtime, props, filterProps) {
|
|
1995
|
-
const { as, asChild, children, className,
|
|
2000
|
+
const { as, asChild, children, className, recipe, ...rest } = props;
|
|
1996
2001
|
const tag = runtime.resolveTag(as);
|
|
1997
2002
|
const mergedProps = runtime.resolveProps(rest);
|
|
1998
2003
|
const baseProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(mergedProps) : mergedProps;
|
|
1999
2004
|
const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
|
|
2000
2005
|
const normalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), baseProps) : baseProps;
|
|
2001
|
-
const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className,
|
|
2006
|
+
const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className, recipe);
|
|
2002
2007
|
const filteredProps = applyFilter(normalizedProps, filterProps, runtime.options.variantKeys);
|
|
2003
2008
|
return buildRenderState(tag, buildDirectives(as, asChild), filteredProps, resolvedClass, children);
|
|
2004
2009
|
}
|
|
@@ -2099,11 +2104,6 @@ function createContractComponent(options) {
|
|
|
2099
2104
|
}
|
|
2100
2105
|
return Component;
|
|
2101
2106
|
}
|
|
2102
|
-
|
|
2103
|
-
// ../../adapters/preact/src/define-contract-component.ts
|
|
2104
|
-
function defineContractComponent(options) {
|
|
2105
|
-
return (factory) => factory(options);
|
|
2106
|
-
}
|
|
2107
2107
|
export {
|
|
2108
2108
|
Slottable,
|
|
2109
2109
|
createContractComponent,
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { E as ElementType, U as UnknownProps, V as VariantMap,
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
25
|
+
export { ElementType, EmptyRecord, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent };
|
package/dist/react/index.js
CHANGED
|
@@ -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-
|
|
20
|
+
} from "../chunk-PBBPAHMV.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";
|
package/dist/react/legacy.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { E as ElementType, U as UnknownProps, V as VariantMap,
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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;
|
package/dist/react/legacy.js
CHANGED
|
@@ -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-
|
|
20
|
+
} from "../chunk-PBBPAHMV.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
|
};
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
129
|
+
type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
|
|
130
130
|
|
|
131
|
-
type
|
|
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,
|
|
137
|
+
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
|
|
138
138
|
|
|
139
|
-
interface
|
|
140
|
-
|
|
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 &
|
|
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
|
|
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,
|
|
237
|
-
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends
|
|
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 SolidElement = JSX.Element;
|
|
251
253
|
type SlotRenderFn = (props: UnknownProps) => SolidElement;
|
|
252
254
|
|
|
253
|
-
type SolidFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends
|
|
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> & {
|
|
254
256
|
/**
|
|
255
257
|
* Return true for any prop key that should be consumed but not forwarded to the DOM.
|
|
256
258
|
* Receives `runtime.options.variantKeys` as a convenience if needed.
|
|
@@ -263,7 +265,7 @@ type IntrinsicJSXProps<T extends ElementType> = T extends IntrinsicTag ? JSX.Int
|
|
|
263
265
|
type ControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = OmitIndexSignature<PropsOf<G>> & OmitIndexSignature<VariantProps<VariantsOf<G>>> & {
|
|
264
266
|
as?: TAs;
|
|
265
267
|
class?: ClassName | undefined;
|
|
266
|
-
|
|
268
|
+
recipe?: keyof RecipeOf<G>;
|
|
267
269
|
ref?: (el: ElementRef<TAs>) => void;
|
|
268
270
|
};
|
|
269
271
|
type SharedProps<G extends PolymorphicGenerics, TAs extends ElementType> = Omit<IntrinsicJSXProps<TAs>, keyof ControlProps<G, TAs> | 'children' | 'ref'> & ControlProps<G, TAs>;
|
|
@@ -272,7 +274,7 @@ type AsChildProps<G extends PolymorphicGenerics> = Partial<OmitIndexSignature<Pr
|
|
|
272
274
|
asChild: true;
|
|
273
275
|
children: SlotRenderFn;
|
|
274
276
|
class?: ClassName | undefined;
|
|
275
|
-
|
|
277
|
+
recipe?: keyof RecipeOf<G>;
|
|
276
278
|
ref?: unknown;
|
|
277
279
|
};
|
|
278
280
|
type PolymorphicProps<G extends PolymorphicGenerics, TAs extends ElementType = DefaultOf<G>> = Simplify<(SharedProps<G, TAs> & {
|
|
@@ -284,8 +286,6 @@ 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
|
|
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: SolidFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
|
|
290
290
|
|
|
291
291
|
export { type AnyFactoryOptions, type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type SolidFactoryOptions, createContractComponent, defineContractComponent };
|
package/dist/solid/index.js
CHANGED
|
@@ -17,7 +17,12 @@ function applyFilter(props, filterProps, variantKeys) {
|
|
|
17
17
|
return out;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// ../../lib/adapter-utils/src/define-component.ts
|
|
21
|
+
function defineContractComponent(options) {
|
|
22
|
+
return (factory) => factory(options);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ../core/dist/chunk-KKSHJDE7.js
|
|
21
26
|
function makeResolveTag(defaultTag) {
|
|
22
27
|
return function tag(as) {
|
|
23
28
|
return as ?? defaultTag;
|
|
@@ -86,7 +91,7 @@ function resolveFactoryOptions(options = {}) {
|
|
|
86
91
|
...whenDefined("defaultProps", options.defaults),
|
|
87
92
|
...whenDefined("baseClassName", styling?.base),
|
|
88
93
|
...whenDefined("tagMap", styling?.tags),
|
|
89
|
-
...whenDefined("
|
|
94
|
+
...whenDefined("recipeMap", styling?.presets),
|
|
90
95
|
...whenDefined("variants", styling?.variants),
|
|
91
96
|
...whenDefined("defaultVariants", styling?.defaults),
|
|
92
97
|
...whenDefined("compoundVariants", styling?.compounds),
|
|
@@ -127,10 +132,10 @@ function validateFactoryOptions(resolved) {
|
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
};
|
|
130
|
-
const {
|
|
131
|
-
if (
|
|
132
|
-
for (const
|
|
133
|
-
checkSelection(`preset "${
|
|
135
|
+
const { recipeMap } = resolved;
|
|
136
|
+
if (recipeMap) {
|
|
137
|
+
for (const recipeKey in recipeMap) {
|
|
138
|
+
checkSelection(`preset "${recipeKey}"`, recipeMap[recipeKey]);
|
|
134
139
|
}
|
|
135
140
|
}
|
|
136
141
|
if (resolved.defaultVariants) checkSelection("defaults", resolved.defaultVariants);
|
|
@@ -166,12 +171,12 @@ function report2(strict, message) {
|
|
|
166
171
|
function label(name) {
|
|
167
172
|
return name ? `[${name}]` : "[createContractComponent]";
|
|
168
173
|
}
|
|
169
|
-
function validateRenderProps(options, props,
|
|
170
|
-
const { strict,
|
|
174
|
+
function validateRenderProps(options, props, recipeKey) {
|
|
175
|
+
const { strict, recipeMap, variants, displayName } = options;
|
|
171
176
|
if (!strict) return;
|
|
172
177
|
const tag = label(displayName);
|
|
173
|
-
if (
|
|
174
|
-
report2(strict, `${tag} Unknown
|
|
178
|
+
if (recipeKey !== void 0 && (!recipeMap || !Object.hasOwn(recipeMap, recipeKey))) {
|
|
179
|
+
report2(strict, `${tag} Unknown recipeKey "${recipeKey}" \u2014 no preset with that name exists.`);
|
|
175
180
|
}
|
|
176
181
|
if (variants) {
|
|
177
182
|
for (const key in variants) {
|
|
@@ -209,8 +214,8 @@ function assertPluginShape(result) {
|
|
|
209
214
|
}
|
|
210
215
|
function guardPipeline(pipeline) {
|
|
211
216
|
if (process.env.NODE_ENV === "production") return pipeline;
|
|
212
|
-
return function guardedPipeline(tag, props, className,
|
|
213
|
-
const result = pipeline(tag, props, className,
|
|
217
|
+
return function guardedPipeline(tag, props, className, recipe) {
|
|
218
|
+
const result = pipeline(tag, props, className, recipe);
|
|
214
219
|
if (typeof result !== "string")
|
|
215
220
|
panic(`[praxis-kit] Plugin pipeline must return a string. Got: ${describe(result)}.`);
|
|
216
221
|
return result;
|
|
@@ -235,11 +240,11 @@ function createRuntimeMethods(resolved, classPipeline, engine) {
|
|
|
235
240
|
resolveProps(props) {
|
|
236
241
|
return mergeProps(resolved.defaultProps, props);
|
|
237
242
|
},
|
|
238
|
-
resolveClasses(tag, props, className,
|
|
243
|
+
resolveClasses(tag, props, className, recipe) {
|
|
239
244
|
if (process.env.NODE_ENV !== "production") {
|
|
240
|
-
validateRenderProps(resolved, props,
|
|
245
|
+
validateRenderProps(resolved, props, recipe);
|
|
241
246
|
}
|
|
242
|
-
return classPipeline(tag, props, className,
|
|
247
|
+
return classPipeline(tag, props, className, recipe);
|
|
243
248
|
},
|
|
244
249
|
resolveAria(tag, props) {
|
|
245
250
|
if (!engine) return { props };
|
|
@@ -588,7 +593,7 @@ function isKnownAriaRole(value) {
|
|
|
588
593
|
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
589
594
|
}
|
|
590
595
|
|
|
591
|
-
// ../core/dist/chunk-
|
|
596
|
+
// ../core/dist/chunk-BNVYTMYV.js
|
|
592
597
|
var IMPLICIT_ROLE_RECORD2 = {
|
|
593
598
|
article: "article",
|
|
594
599
|
aside: "complementary",
|
|
@@ -1523,7 +1528,7 @@ function getHtmlPropNormalizers(tag) {
|
|
|
1523
1528
|
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
1524
1529
|
}
|
|
1525
1530
|
|
|
1526
|
-
// ../core/dist/chunk-
|
|
1531
|
+
// ../core/dist/chunk-3T4EM5FG.js
|
|
1527
1532
|
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
1528
1533
|
var cx = clsx;
|
|
1529
1534
|
var cva = (base, config) => (props) => {
|
|
@@ -1600,18 +1605,18 @@ var StaticClassResolver = class {
|
|
|
1600
1605
|
};
|
|
1601
1606
|
var VariantClassResolver = class _VariantClassResolver {
|
|
1602
1607
|
#cvaFn;
|
|
1603
|
-
#
|
|
1608
|
+
#recipeMap;
|
|
1604
1609
|
#variantKeys;
|
|
1605
1610
|
#precomputedClasses;
|
|
1606
1611
|
#cache = /* @__PURE__ */ new Map();
|
|
1607
|
-
constructor(cvaFn,
|
|
1612
|
+
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
1608
1613
|
this.#cvaFn = cvaFn ?? null;
|
|
1609
|
-
this.#
|
|
1614
|
+
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
1610
1615
|
this.#variantKeys = variantKeys ?? null;
|
|
1611
1616
|
this.#precomputedClasses = precomputedClasses ?? null;
|
|
1612
1617
|
}
|
|
1613
|
-
resolve({ props,
|
|
1614
|
-
const normalizedKey =
|
|
1618
|
+
resolve({ props, recipe }) {
|
|
1619
|
+
const normalizedKey = recipe ?? "__none__";
|
|
1615
1620
|
const cacheKey = this.#createCacheKey(props, normalizedKey);
|
|
1616
1621
|
if (this.#precomputedClasses !== null) {
|
|
1617
1622
|
const precomputed = this.#precomputedClasses[cacheKey];
|
|
@@ -1623,7 +1628,7 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
1623
1628
|
this.#cache.set(cacheKey, cached);
|
|
1624
1629
|
return cached;
|
|
1625
1630
|
}
|
|
1626
|
-
const result = this.#compute(props,
|
|
1631
|
+
const result = this.#compute(props, recipe);
|
|
1627
1632
|
this.#cache.set(cacheKey, result);
|
|
1628
1633
|
if (this.#cache.size > 1e3) {
|
|
1629
1634
|
const lru = this.#cache.keys().next().value;
|
|
@@ -1631,10 +1636,10 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
1631
1636
|
}
|
|
1632
1637
|
return result;
|
|
1633
1638
|
}
|
|
1634
|
-
#compute(props,
|
|
1639
|
+
#compute(props, recipe) {
|
|
1635
1640
|
if (!this.#cvaFn) return "";
|
|
1636
|
-
if (!
|
|
1637
|
-
const preset = this.#
|
|
1641
|
+
if (!recipe) return this.#cvaFn(props);
|
|
1642
|
+
const preset = this.#recipeMap[recipe];
|
|
1638
1643
|
if (!preset) return this.#cvaFn(props);
|
|
1639
1644
|
return this.#cvaFn({ ...preset, ...props });
|
|
1640
1645
|
}
|
|
@@ -1642,15 +1647,15 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
1642
1647
|
// props (className, id, etc.) produce identical CVA output and must not fragment the cache.
|
|
1643
1648
|
// Iterating #variantKeys directly (fixed Set insertion order) avoids Object.keys + filter + sort.
|
|
1644
1649
|
// String is built incrementally to avoid a parts[] array allocation on every render.
|
|
1645
|
-
#createCacheKey(props,
|
|
1650
|
+
#createCacheKey(props, recipe) {
|
|
1646
1651
|
if (this.#variantKeys !== null) {
|
|
1647
|
-
let key2 =
|
|
1652
|
+
let key2 = recipe;
|
|
1648
1653
|
for (const k of this.#variantKeys) {
|
|
1649
1654
|
if (k in props) key2 += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
1650
1655
|
}
|
|
1651
1656
|
return key2;
|
|
1652
1657
|
}
|
|
1653
|
-
let key =
|
|
1658
|
+
let key = recipe;
|
|
1654
1659
|
for (const k of Object.keys(props).sort()) {
|
|
1655
1660
|
key += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
1656
1661
|
}
|
|
@@ -1675,13 +1680,13 @@ function createClassPipeline(resolved) {
|
|
|
1675
1680
|
const staticResolver = new StaticClassResolver(baseClass, resolved.tagMap);
|
|
1676
1681
|
const variantResolver = new VariantClassResolver(
|
|
1677
1682
|
cvaFn,
|
|
1678
|
-
resolved.
|
|
1683
|
+
resolved.recipeMap,
|
|
1679
1684
|
variantKeys,
|
|
1680
1685
|
resolved.precomputedClasses
|
|
1681
1686
|
);
|
|
1682
|
-
return function resolveClasses(tag, props, className,
|
|
1683
|
-
const staticClasses = staticResolver.resolve(tag,
|
|
1684
|
-
const variantClasses = variantResolver.resolve({ props,
|
|
1687
|
+
return function resolveClasses(tag, props, className, recipe) {
|
|
1688
|
+
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
1689
|
+
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
1685
1690
|
if (!className)
|
|
1686
1691
|
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
1687
1692
|
return cn(staticClasses, variantClasses, className);
|
|
@@ -1778,7 +1783,7 @@ function buildRuntime(options) {
|
|
|
1778
1783
|
import { createEffect, createMemo, splitProps } from "solid-js";
|
|
1779
1784
|
import { Dynamic } from "solid-js/web";
|
|
1780
1785
|
import { jsx } from "solid-js/jsx-runtime";
|
|
1781
|
-
var SPLIT_KEYS = ["as", "asChild", "children", "class", "
|
|
1786
|
+
var SPLIT_KEYS = ["as", "asChild", "children", "class", "recipe", "ref"];
|
|
1782
1787
|
function toChildArray(children) {
|
|
1783
1788
|
if (children === void 0 || children === null) return [];
|
|
1784
1789
|
if (Array.isArray(children)) return children;
|
|
@@ -1842,7 +1847,7 @@ function render({
|
|
|
1842
1847
|
tag(),
|
|
1843
1848
|
normalizedProps(),
|
|
1844
1849
|
known.class,
|
|
1845
|
-
known.
|
|
1850
|
+
known.recipe
|
|
1846
1851
|
)
|
|
1847
1852
|
);
|
|
1848
1853
|
const filteredProps = createMemo(
|
|
@@ -1875,11 +1880,6 @@ function createContractComponent(options) {
|
|
|
1875
1880
|
}
|
|
1876
1881
|
return Component;
|
|
1877
1882
|
}
|
|
1878
|
-
|
|
1879
|
-
// ../../adapters/solid/src/define-contract-component.ts
|
|
1880
|
-
function defineContractComponent(options) {
|
|
1881
|
-
return (factory) => factory(options);
|
|
1882
|
-
}
|
|
1883
1883
|
export {
|
|
1884
1884
|
createContractComponent,
|
|
1885
1885
|
defineContractComponent
|