@pandacss/studio 0.0.0-dev-20240402215554 → 0.0.0-dev-20240403113532
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/studio",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20240403113532",
|
|
4
4
|
"description": "The automated token documentation for Panda CSS",
|
|
5
5
|
"main": "dist/studio.js",
|
|
6
6
|
"module": "dist/studio.mjs",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"react": "18.2.0",
|
|
49
49
|
"react-dom": "18.2.0",
|
|
50
50
|
"vite": "5.1.3",
|
|
51
|
-
"@pandacss/config": "0.0.0-dev-
|
|
52
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
53
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
54
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
55
|
-
"@pandacss/types": "0.0.0-dev-
|
|
56
|
-
"@pandacss/astro-plugin-studio": "0.0.0-dev-
|
|
51
|
+
"@pandacss/config": "0.0.0-dev-20240403113532",
|
|
52
|
+
"@pandacss/logger": "0.0.0-dev-20240403113532",
|
|
53
|
+
"@pandacss/shared": "0.0.0-dev-20240403113532",
|
|
54
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20240403113532",
|
|
55
|
+
"@pandacss/types": "0.0.0-dev-20240403113532",
|
|
56
|
+
"@pandacss/astro-plugin-studio": "0.0.0-dev-20240403113532"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "18.2.55",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSlotRecipes, memo, splitProps } from '../helpers.mjs';
|
|
1
|
+
import { compact, getSlotRecipes, memo, splitProps } from '../helpers.mjs';
|
|
2
2
|
import { cva } from './cva.mjs';
|
|
3
3
|
import { cx } from './cx.mjs';
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@ const slotClass = (className, slot) => className + '__' + slot
|
|
|
6
6
|
|
|
7
7
|
export function sva(config) {
|
|
8
8
|
const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
|
|
9
|
+
const defaultVariants = config.defaultVariants ?? {}
|
|
9
10
|
|
|
10
11
|
function svaFn(props) {
|
|
11
12
|
const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config.className && slotClass(config.className, slot))])
|
|
@@ -23,6 +24,7 @@ export function sva(config) {
|
|
|
23
24
|
function splitVariantProps(props) {
|
|
24
25
|
return splitProps(props, variantKeys);
|
|
25
26
|
}
|
|
27
|
+
const getVariantProps = (variants) => ({ ...(defaultVariants || {}), ...compact(variants) })
|
|
26
28
|
|
|
27
29
|
const variantMap = Object.fromEntries(
|
|
28
30
|
Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
|
|
@@ -34,5 +36,6 @@ export function sva(config) {
|
|
|
34
36
|
variantMap,
|
|
35
37
|
variantKeys,
|
|
36
38
|
splitVariantProps,
|
|
39
|
+
getVariantProps,
|
|
37
40
|
})
|
|
38
41
|
}
|
|
@@ -123,6 +123,9 @@ export interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVaria
|
|
|
123
123
|
raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>
|
|
124
124
|
variantKeys: (keyof T)[]
|
|
125
125
|
variantMap: RecipeVariantMap<T>
|
|
126
|
+
splitVariantProps<Props extends RecipeSelection<T>>(
|
|
127
|
+
props: Props,
|
|
128
|
+
): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]
|
|
126
129
|
getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>
|
|
127
130
|
}
|
|
128
131
|
|