@pandacss/studio 0.0.0-dev-20230928112800 → 0.0.0-dev-20230928164751
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-20230928164751",
|
|
4
4
|
"description": "The automated token documentation for Panda CSS",
|
|
5
5
|
"main": "dist/studio.js",
|
|
6
6
|
"module": "dist/studio.mjs",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"react": "18.2.0",
|
|
34
34
|
"react-dom": "18.2.0",
|
|
35
35
|
"vite": "4.4.9",
|
|
36
|
-
"@pandacss/config": "0.0.0-dev-
|
|
37
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
38
|
-
"@pandacss/node": "0.0.0-dev-
|
|
39
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
40
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
41
|
-
"@pandacss/types": "0.0.0-dev-
|
|
36
|
+
"@pandacss/config": "0.0.0-dev-20230928164751",
|
|
37
|
+
"@pandacss/logger": "0.0.0-dev-20230928164751",
|
|
38
|
+
"@pandacss/node": "0.0.0-dev-20230928164751",
|
|
39
|
+
"@pandacss/shared": "0.0.0-dev-20230928164751",
|
|
40
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230928164751",
|
|
41
|
+
"@pandacss/types": "0.0.0-dev-20230928164751"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/react": "18.2.22",
|
|
45
45
|
"@types/react-dom": "18.2.7",
|
|
46
46
|
"@vitejs/plugin-react": "4.0.4",
|
|
47
47
|
"execa": "7.2.0",
|
|
48
|
-
"@pandacss/dev": "0.0.0-dev-
|
|
48
|
+
"@pandacss/dev": "0.0.0-dev-20230928164751"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"codegen": "panda",
|
|
@@ -3,35 +3,48 @@ import { css, cx, cva } from '../css/index.mjs';
|
|
|
3
3
|
import { splitProps, normalizeHTMLProps } from '../helpers.mjs';
|
|
4
4
|
import { isCssProperty } from './is-valid-prop.mjs';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
|
|
7
|
+
|
|
8
|
+
function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
7
9
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
8
10
|
|
|
11
|
+
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
12
|
+
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
13
|
+
|
|
14
|
+
const defaultProps = Object.assign(
|
|
15
|
+
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
16
|
+
options.defaultProps,
|
|
17
|
+
)
|
|
18
|
+
|
|
9
19
|
const PandaComponent = /* @__PURE__ */ forwardRef(function PandaComponent(props, ref) {
|
|
10
|
-
const { as: Element = Dynamic, ...restProps } = props
|
|
20
|
+
const { as: Element = Dynamic, children, ...restProps } = props
|
|
11
21
|
|
|
12
|
-
const
|
|
13
|
-
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
14
|
-
}, [restProps])
|
|
22
|
+
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
|
|
20
|
-
}
|
|
24
|
+
const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
25
|
+
return splitProps(combinedProps, shouldForwardProp, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
26
|
+
}, [combinedProps])
|
|
21
27
|
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
28
|
+
function recipeClass() {
|
|
29
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
30
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
31
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
|
|
32
|
+
}
|
|
27
33
|
|
|
34
|
+
function cvaClass() {
|
|
35
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
36
|
+
const cvaStyles = cvaFn.raw(variantProps)
|
|
37
|
+
return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.className)
|
|
38
|
+
}
|
|
28
39
|
|
|
29
40
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
30
41
|
|
|
31
42
|
return createElement(Element, {
|
|
32
43
|
ref,
|
|
44
|
+
...forwardedProps,
|
|
33
45
|
...elementProps,
|
|
34
46
|
...normalizeHTMLProps(htmlProps),
|
|
47
|
+
children,
|
|
35
48
|
className: classes(),
|
|
36
49
|
})
|
|
37
50
|
})
|
package/styled-system/styles.css
CHANGED
|
@@ -47,22 +47,6 @@
|
|
|
47
47
|
flex: 1 1 0%
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.w_auto {
|
|
51
|
-
width: auto
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.min-w_80px {
|
|
55
|
-
min-width: 80px
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.h_40px {
|
|
59
|
-
height: 40px
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.mb_2 {
|
|
63
|
-
margin-bottom: var(--spacing-2)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
50
|
.h_10 {
|
|
67
51
|
height: var(--sizes-10)
|
|
68
52
|
}
|
|
@@ -16,13 +16,21 @@ export interface PandaComponent<T extends ElementType, P extends Dict = {}> {
|
|
|
16
16
|
|
|
17
17
|
interface RecipeFn { __type: any }
|
|
18
18
|
|
|
19
|
+
interface JsxFactoryOptions<TProps extends Dict> {
|
|
20
|
+
dataAttr?: boolean
|
|
21
|
+
defaultProps?: TProps
|
|
22
|
+
shouldForwardProp?(prop: string, variantKeys: string[]): boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T>, P>;
|
|
26
|
+
|
|
19
27
|
interface JsxFactory {
|
|
20
28
|
<T extends ElementType>(component: T): PandaComponent<T, {}>
|
|
21
|
-
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P
|
|
29
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): PandaComponent<
|
|
22
30
|
T,
|
|
23
31
|
RecipeSelection<P>
|
|
24
32
|
>
|
|
25
|
-
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): PandaComponent<T, P['__type']>
|
|
33
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): PandaComponent<T, P['__type']>
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: PandaComponent<K, {}> }
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import { panda } from '../../styled-system/jsx'
|
|
3
|
-
import type { JsxStyleProps } from '../../styled-system/types'
|
|
4
|
-
import { tokenDictionary } from '../lib/analysis-data'
|
|
5
|
-
import { getReportItemFromTokenName, getUtilityLink } from '../lib/get-report-item'
|
|
6
|
-
import { ColorWrapper } from './color-wrapper'
|
|
7
|
-
|
|
8
|
-
export const ColorItem = ({
|
|
9
|
-
tokenName,
|
|
10
|
-
children,
|
|
11
|
-
...props
|
|
12
|
-
}: PropsWithChildren<{ tokenName: string } & JsxStyleProps>) => {
|
|
13
|
-
const token = tokenDictionary.getByName('colors.' + tokenName)
|
|
14
|
-
const value = token?.value ?? tokenName
|
|
15
|
-
const reportItem = getReportItemFromTokenName(tokenName)
|
|
16
|
-
|
|
17
|
-
if (!reportItem) return null
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<panda.a href={getUtilityLink({ value: reportItem.value })} key={tokenName} {...props}>
|
|
21
|
-
<ColorWrapper
|
|
22
|
-
w="auto"
|
|
23
|
-
minW="80px"
|
|
24
|
-
h="40px"
|
|
25
|
-
mb="2"
|
|
26
|
-
style={{ background: value, border: '1px solid rgba(0,0,0,0.1)' }}
|
|
27
|
-
/>
|
|
28
|
-
{children}
|
|
29
|
-
|
|
30
|
-
{tokenName !== value && (
|
|
31
|
-
<panda.div opacity={0.7}>
|
|
32
|
-
<panda.span>{value}</panda.span>
|
|
33
|
-
</panda.div>
|
|
34
|
-
)}
|
|
35
|
-
</panda.a>
|
|
36
|
-
)
|
|
37
|
-
}
|