@pandacss/studio 0.0.0-dev-20230613163214
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/LICENSE.md +21 -0
- package/astro.config.ts +14 -0
- package/dist/studio.d.ts +13 -0
- package/dist/studio.js +2089 -0
- package/dist/studio.mjs +2087 -0
- package/index.ts +1 -0
- package/package.json +59 -0
- package/panda.config.ts +110 -0
- package/public/favicon.svg +13 -0
- package/src/components/analyzer/category-utilities.tsx +146 -0
- package/src/components/analyzer/data-combobox.tsx +125 -0
- package/src/components/analyzer/data-table.tsx +43 -0
- package/src/components/analyzer/external-icon.tsx +8 -0
- package/src/components/analyzer/file-details.tsx +101 -0
- package/src/components/analyzer/get-report-infos-from.ts +80 -0
- package/src/components/analyzer/quick-tooltip.tsx +15 -0
- package/src/components/analyzer/report-item-columns.tsx +52 -0
- package/src/components/analyzer/report-item-link.tsx +98 -0
- package/src/components/analyzer/section.tsx +24 -0
- package/src/components/analyzer/sort-icon.tsx +7 -0
- package/src/components/analyzer/text-with-count.tsx +28 -0
- package/src/components/analyzer/token-search-combobox.tsx +39 -0
- package/src/components/analyzer/truncated-text.tsx +26 -0
- package/src/components/analyzer/utility-details.tsx +312 -0
- package/src/components/color-constrast.tsx +131 -0
- package/src/components/color-item.tsx +37 -0
- package/src/components/color-wrapper.tsx +25 -0
- package/src/components/colors.tsx +96 -0
- package/src/components/empty-state.tsx +19 -0
- package/src/components/font-family.tsx +55 -0
- package/src/components/font-tokens.tsx +69 -0
- package/src/components/head.astro +35 -0
- package/src/components/icons.tsx +207 -0
- package/src/components/input.tsx +27 -0
- package/src/components/layer-styles.tsx +38 -0
- package/src/components/logo.tsx +34 -0
- package/src/components/nav-item.tsx +39 -0
- package/src/components/overview.tsx +65 -0
- package/src/components/radii.tsx +34 -0
- package/src/components/semantic-color.tsx +27 -0
- package/src/components/side-nav-item.astro +25 -0
- package/src/components/side-nav.astro +30 -0
- package/src/components/sizes.tsx +53 -0
- package/src/components/text-styles.tsx +33 -0
- package/src/components/theme-toggle.astro +56 -0
- package/src/components/token-analyzer.tsx +390 -0
- package/src/components/token-content.tsx +5 -0
- package/src/components/token-group.tsx +6 -0
- package/src/components/typography-playground.tsx +83 -0
- package/src/env.d.ts +1 -0
- package/src/icons/moon.tsx +15 -0
- package/src/icons/sun.tsx +19 -0
- package/src/layouts/Layout.astro +19 -0
- package/src/layouts/Sidebar.astro +35 -0
- package/src/lib/analysis-data.ts +17 -0
- package/src/lib/color-contrast-checker.ts +218 -0
- package/src/lib/color.ts +40 -0
- package/src/lib/constants.ts +140 -0
- package/src/lib/create-context.ts +27 -0
- package/src/lib/get-report-item.tsx +41 -0
- package/src/lib/group-in.ts +35 -0
- package/src/lib/panda.context.ts +23 -0
- package/src/lib/pick.ts +24 -0
- package/src/lib/sizes-sort.ts +10 -0
- package/src/lib/truncate.tsx +7 -0
- package/src/lib/use-color-docs.ts +101 -0
- package/src/pages/colors.astro +11 -0
- package/src/pages/font-sizes.astro +15 -0
- package/src/pages/font-weights.astro +15 -0
- package/src/pages/fonts.astro +11 -0
- package/src/pages/index.astro +8 -0
- package/src/pages/layer-styles.astro +11 -0
- package/src/pages/letter-spacings.astro +20 -0
- package/src/pages/line-heights.astro +21 -0
- package/src/pages/playground/contrast-checker.astro +11 -0
- package/src/pages/playground/typography.astro +11 -0
- package/src/pages/radii.astro +11 -0
- package/src/pages/sizes.astro +14 -0
- package/src/pages/spacing.astro +14 -0
- package/src/pages/text-styles.astro +11 -0
- package/src/pages/token-analyzer/file.astro +11 -0
- package/src/pages/token-analyzer/index.astro +11 -0
- package/src/pages/token-analyzer/utility.astro +11 -0
- package/styled-system/chunks/..__core____tests____composition.test.css +2 -0
- package/styled-system/chunks/src__components__analyzer__category-utilities.css +97 -0
- package/styled-system/chunks/src__components__analyzer__data-combobox.css +77 -0
- package/styled-system/chunks/src__components__analyzer__data-table.css +37 -0
- package/styled-system/chunks/src__components__analyzer__file-details.css +103 -0
- package/styled-system/chunks/src__components__analyzer__quick-tooltip.css +2 -0
- package/styled-system/chunks/src__components__analyzer__report-item-columns.css +29 -0
- package/styled-system/chunks/src__components__analyzer__report-item-link.css +109 -0
- package/styled-system/chunks/src__components__analyzer__section.css +29 -0
- package/styled-system/chunks/src__components__analyzer__text-with-count.css +33 -0
- package/styled-system/chunks/src__components__analyzer__truncated-text.css +13 -0
- package/styled-system/chunks/src__components__analyzer__utility-details.css +125 -0
- package/styled-system/chunks/src__components__color-constrast.css +114 -0
- package/styled-system/chunks/src__components__color-item.css +21 -0
- package/styled-system/chunks/src__components__color-wrapper.css +73 -0
- package/styled-system/chunks/src__components__colors.css +97 -0
- package/styled-system/chunks/src__components__empty-state.css +45 -0
- package/styled-system/chunks/src__components__font-family.css +85 -0
- package/styled-system/chunks/src__components__font-tokens.css +61 -0
- package/styled-system/chunks/src__components__input.css +68 -0
- package/styled-system/chunks/src__components__layer-styles.css +66 -0
- package/styled-system/chunks/src__components__nav-item.css +73 -0
- package/styled-system/chunks/src__components__overview.css +125 -0
- package/styled-system/chunks/src__components__radii.css +49 -0
- package/styled-system/chunks/src__components__semantic-color.css +45 -0
- package/styled-system/chunks/src__components__side-nav-item.css +33 -0
- package/styled-system/chunks/src__components__side-nav.css +49 -0
- package/styled-system/chunks/src__components__sizes.css +41 -0
- package/styled-system/chunks/src__components__text-styles.css +31 -0
- package/styled-system/chunks/src__components__theme-toggle.css +63 -0
- package/styled-system/chunks/src__components__token-analyzer.css +227 -0
- package/styled-system/chunks/src__components__token-content.css +13 -0
- package/styled-system/chunks/src__components__token-group.css +21 -0
- package/styled-system/chunks/src__components__token-search-combobox.css +2 -0
- package/styled-system/chunks/src__components__typography-playground.css +61 -0
- package/styled-system/chunks/src__layouts__Layout.css +2 -0
- package/styled-system/chunks/src__layouts__Sidebar.css +113 -0
- package/styled-system/chunks/src__pages__colors.css +2 -0
- package/styled-system/chunks/src__pages__font-sizes.css +2 -0
- package/styled-system/chunks/src__pages__font-weights.css +2 -0
- package/styled-system/chunks/src__pages__fonts.css +2 -0
- package/styled-system/chunks/src__pages__index.css +2 -0
- package/styled-system/chunks/src__pages__layer-styles.css +2 -0
- package/styled-system/chunks/src__pages__letter-spacings.css +2 -0
- package/styled-system/chunks/src__pages__line-heights.css +2 -0
- package/styled-system/chunks/src__pages__playground__contrast-checker.css +2 -0
- package/styled-system/chunks/src__pages__playground__typography.css +2 -0
- package/styled-system/chunks/src__pages__radii.css +2 -0
- package/styled-system/chunks/src__pages__sizes.css +2 -0
- package/styled-system/chunks/src__pages__spacing.css +2 -0
- package/styled-system/chunks/src__pages__text-styles.css +2 -0
- package/styled-system/chunks/src__pages__token-analyzer__file.css +2 -0
- package/styled-system/chunks/src__pages__token-analyzer__index.css +2 -0
- package/styled-system/chunks/src__pages__token-analyzer__utility.css +2 -0
- package/styled-system/css/conditions.mjs +147 -0
- package/styled-system/css/css.d.ts +2 -0
- package/styled-system/css/css.mjs +391 -0
- package/styled-system/css/cva.d.ts +5 -0
- package/styled-system/css/cva.mjs +63 -0
- package/styled-system/css/cx.d.ts +4 -0
- package/styled-system/css/cx.mjs +15 -0
- package/styled-system/css/index.d.ts +3 -0
- package/styled-system/css/index.mjs +3 -0
- package/styled-system/global.css +61 -0
- package/styled-system/helpers.mjs +251 -0
- package/styled-system/jsx/absolute-center.d.ts +8 -0
- package/styled-system/jsx/absolute-center.mjs +9 -0
- package/styled-system/jsx/aspect-ratio.d.ts +8 -0
- package/styled-system/jsx/aspect-ratio.mjs +9 -0
- package/styled-system/jsx/box.d.ts +8 -0
- package/styled-system/jsx/box.mjs +8 -0
- package/styled-system/jsx/center.d.ts +8 -0
- package/styled-system/jsx/center.mjs +9 -0
- package/styled-system/jsx/circle.d.ts +8 -0
- package/styled-system/jsx/circle.mjs +9 -0
- package/styled-system/jsx/container.d.ts +8 -0
- package/styled-system/jsx/container.mjs +8 -0
- package/styled-system/jsx/divider.d.ts +8 -0
- package/styled-system/jsx/divider.mjs +9 -0
- package/styled-system/jsx/factory.d.ts +2 -0
- package/styled-system/jsx/factory.mjs +59 -0
- package/styled-system/jsx/flex.d.ts +8 -0
- package/styled-system/jsx/flex.mjs +9 -0
- package/styled-system/jsx/float.d.ts +8 -0
- package/styled-system/jsx/float.mjs +9 -0
- package/styled-system/jsx/grid-item.d.ts +8 -0
- package/styled-system/jsx/grid-item.mjs +9 -0
- package/styled-system/jsx/grid.d.ts +8 -0
- package/styled-system/jsx/grid.mjs +9 -0
- package/styled-system/jsx/hstack.d.ts +8 -0
- package/styled-system/jsx/hstack.mjs +9 -0
- package/styled-system/jsx/index.d.ts +20 -0
- package/styled-system/jsx/index.mjs +19 -0
- package/styled-system/jsx/is-valid-prop.mjs +1010 -0
- package/styled-system/jsx/spacer.d.ts +8 -0
- package/styled-system/jsx/spacer.mjs +9 -0
- package/styled-system/jsx/square.d.ts +8 -0
- package/styled-system/jsx/square.mjs +9 -0
- package/styled-system/jsx/stack.d.ts +8 -0
- package/styled-system/jsx/stack.mjs +9 -0
- package/styled-system/jsx/styled-link.d.ts +8 -0
- package/styled-system/jsx/styled-link.mjs +8 -0
- package/styled-system/jsx/vstack.d.ts +8 -0
- package/styled-system/jsx/vstack.mjs +9 -0
- package/styled-system/jsx/wrap.d.ts +8 -0
- package/styled-system/jsx/wrap.mjs +9 -0
- package/styled-system/patterns/absolute-center.d.ts +14 -0
- package/styled-system/patterns/absolute-center.mjs +23 -0
- package/styled-system/patterns/aspect-ratio.d.ts +14 -0
- package/styled-system/patterns/aspect-ratio.mjs +25 -0
- package/styled-system/patterns/box.d.ts +14 -0
- package/styled-system/patterns/box.mjs +12 -0
- package/styled-system/patterns/center.d.ts +14 -0
- package/styled-system/patterns/center.mjs +18 -0
- package/styled-system/patterns/circle.d.ts +14 -0
- package/styled-system/patterns/circle.mjs +22 -0
- package/styled-system/patterns/container.d.ts +14 -0
- package/styled-system/patterns/container.mjs +18 -0
- package/styled-system/patterns/divider.d.ts +16 -0
- package/styled-system/patterns/divider.mjs +21 -0
- package/styled-system/patterns/flex.d.ts +20 -0
- package/styled-system/patterns/flex.mjs +23 -0
- package/styled-system/patterns/float.d.ts +17 -0
- package/styled-system/patterns/float.mjs +45 -0
- package/styled-system/patterns/grid-item.d.ts +19 -0
- package/styled-system/patterns/grid-item.mjs +20 -0
- package/styled-system/patterns/grid.d.ts +18 -0
- package/styled-system/patterns/grid.mjs +25 -0
- package/styled-system/patterns/hstack.d.ts +15 -0
- package/styled-system/patterns/hstack.mjs +20 -0
- package/styled-system/patterns/index.d.ts +18 -0
- package/styled-system/patterns/index.mjs +18 -0
- package/styled-system/patterns/spacer.d.ts +14 -0
- package/styled-system/patterns/spacer.mjs +18 -0
- package/styled-system/patterns/square.d.ts +14 -0
- package/styled-system/patterns/square.mjs +21 -0
- package/styled-system/patterns/stack.d.ts +17 -0
- package/styled-system/patterns/stack.mjs +20 -0
- package/styled-system/patterns/styled-link.d.ts +14 -0
- package/styled-system/patterns/styled-link.mjs +18 -0
- package/styled-system/patterns/vstack.d.ts +15 -0
- package/styled-system/patterns/vstack.mjs +20 -0
- package/styled-system/patterns/wrap.d.ts +18 -0
- package/styled-system/patterns/wrap.mjs +22 -0
- package/styled-system/reset.css +190 -0
- package/styled-system/static.css +5 -0
- package/styled-system/styles.css +938 -0
- package/styled-system/tokens/index.css +374 -0
- package/styled-system/tokens/index.d.ts +8 -0
- package/styled-system/tokens/index.mjs +1590 -0
- package/styled-system/tokens/keyframes.css +30 -0
- package/styled-system/tokens/tokens.d.ts +56 -0
- package/styled-system/types/composition.d.ts +110 -0
- package/styled-system/types/conditions.d.ts +135 -0
- package/styled-system/types/csstype.d.ts +20748 -0
- package/styled-system/types/global.d.ts +15 -0
- package/styled-system/types/helpers.d.ts +1 -0
- package/styled-system/types/index.d.ts +3 -0
- package/styled-system/types/jsx.d.ts +27 -0
- package/styled-system/types/parts.d.ts +5 -0
- package/styled-system/types/pattern.d.ts +52 -0
- package/styled-system/types/prop-type.d.ts +300 -0
- package/styled-system/types/recipe.d.ts +79 -0
- package/styled-system/types/selectors.d.ts +56 -0
- package/styled-system/types/style-props.d.ts +688 -0
- package/styled-system/types/system-types.d.ts +76 -0
- package/virtual-panda.ts +72 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { createCss, createMergeCss, hypenateProperty, withoutSpace } from '../helpers.mjs'
|
|
2
|
+
import { sortConditions, finalizeConditions } from './conditions.mjs'
|
|
3
|
+
|
|
4
|
+
const classNameMap = {
|
|
5
|
+
aspectRatio: 'aspect',
|
|
6
|
+
boxDecorationBreak: 'decoration',
|
|
7
|
+
zIndex: 'z',
|
|
8
|
+
boxSizing: 'box',
|
|
9
|
+
objectPosition: 'object',
|
|
10
|
+
objectFit: 'object',
|
|
11
|
+
overscrollBehavior: 'overscroll',
|
|
12
|
+
overscrollBehaviorX: 'overscroll-x',
|
|
13
|
+
overscrollBehaviorY: 'overscroll-y',
|
|
14
|
+
position: 'pos',
|
|
15
|
+
top: 'top',
|
|
16
|
+
left: 'left',
|
|
17
|
+
insetInline: 'inset-x',
|
|
18
|
+
insetBlock: 'inset-y',
|
|
19
|
+
inset: 'inset',
|
|
20
|
+
insetBlockEnd: 'inset-b',
|
|
21
|
+
insetBlockStart: 'inset-t',
|
|
22
|
+
insetInlineEnd: 'end',
|
|
23
|
+
insetInlineStart: 'start',
|
|
24
|
+
right: 'right',
|
|
25
|
+
bottom: 'bottom',
|
|
26
|
+
insetX: 'inset-x',
|
|
27
|
+
insetY: 'inset-y',
|
|
28
|
+
float: 'float',
|
|
29
|
+
visibility: 'vis',
|
|
30
|
+
display: 'd',
|
|
31
|
+
hideFrom: 'hide',
|
|
32
|
+
hideBelow: 'show',
|
|
33
|
+
flexBasis: 'basis',
|
|
34
|
+
flex: 'flex',
|
|
35
|
+
flexDirection: 'flex',
|
|
36
|
+
flexGrow: 'grow',
|
|
37
|
+
flexShrink: 'shrink',
|
|
38
|
+
gridTemplateColumns: 'grid-cols',
|
|
39
|
+
gridTemplateRows: 'grid-cols',
|
|
40
|
+
gridColumn: 'col-span',
|
|
41
|
+
gridRow: 'row-span',
|
|
42
|
+
gridColumnStart: 'col-start',
|
|
43
|
+
gridColumnEnd: 'col-end',
|
|
44
|
+
gridAutoFlow: 'grid-flow',
|
|
45
|
+
gridAutoColumns: 'auto-cols',
|
|
46
|
+
gridAutoRows: 'auto-rows',
|
|
47
|
+
gap: 'gap',
|
|
48
|
+
gridGap: 'gap',
|
|
49
|
+
gridRowGap: 'gap-x',
|
|
50
|
+
gridColumnGap: 'gap-y',
|
|
51
|
+
rowGap: 'gap-x',
|
|
52
|
+
columnGap: 'gap-y',
|
|
53
|
+
justifyContent: 'justify',
|
|
54
|
+
alignContent: 'content',
|
|
55
|
+
alignItems: 'items',
|
|
56
|
+
alignSelf: 'self',
|
|
57
|
+
padding: 'p',
|
|
58
|
+
paddingLeft: 'pl',
|
|
59
|
+
paddingRight: 'pr',
|
|
60
|
+
paddingTop: 'pt',
|
|
61
|
+
paddingBottom: 'pb',
|
|
62
|
+
paddingBlock: 'py',
|
|
63
|
+
paddingBlockEnd: 'pb',
|
|
64
|
+
paddingBlockStart: 'pt',
|
|
65
|
+
paddingInline: 'px',
|
|
66
|
+
paddingInlineEnd: 'pe',
|
|
67
|
+
paddingInlineStart: 'ps',
|
|
68
|
+
marginLeft: 'ml',
|
|
69
|
+
marginRight: 'mr',
|
|
70
|
+
marginTop: 'mt',
|
|
71
|
+
marginBottom: 'mb',
|
|
72
|
+
margin: 'm',
|
|
73
|
+
marginBlock: 'my',
|
|
74
|
+
marginBlockEnd: 'mb',
|
|
75
|
+
marginBlockStart: 'mt',
|
|
76
|
+
marginInline: 'mx',
|
|
77
|
+
marginInlineEnd: 'me',
|
|
78
|
+
marginInlineStart: 'ms',
|
|
79
|
+
outlineWidth: 'ring',
|
|
80
|
+
outlineColor: 'ring',
|
|
81
|
+
outline: 'ring',
|
|
82
|
+
outlineOffset: 'ring',
|
|
83
|
+
divideX: 'divide-x',
|
|
84
|
+
divideY: 'divide-y',
|
|
85
|
+
divideColor: 'divide',
|
|
86
|
+
divideStyle: 'divide',
|
|
87
|
+
width: 'w',
|
|
88
|
+
inlineSize: 'w',
|
|
89
|
+
minWidth: 'min-w',
|
|
90
|
+
minInlineSize: 'min-w',
|
|
91
|
+
maxWidth: 'max-w',
|
|
92
|
+
maxInlineSize: 'max-w',
|
|
93
|
+
height: 'h',
|
|
94
|
+
blockSize: 'h',
|
|
95
|
+
minHeight: 'min-h',
|
|
96
|
+
minBlockSize: 'min-h',
|
|
97
|
+
maxHeight: 'max-h',
|
|
98
|
+
maxBlockSize: 'max-b',
|
|
99
|
+
color: 'text',
|
|
100
|
+
fontFamily: 'font',
|
|
101
|
+
fontSize: 'fs',
|
|
102
|
+
fontWeight: 'font',
|
|
103
|
+
fontSmoothing: 'smoothing',
|
|
104
|
+
fontVariantNumeric: 'numeric',
|
|
105
|
+
letterSpacing: 'tracking',
|
|
106
|
+
lineHeight: 'leading',
|
|
107
|
+
textAlign: 'text',
|
|
108
|
+
textDecoration: 'text-decor',
|
|
109
|
+
textDecorationColor: 'text-decor',
|
|
110
|
+
textEmphasisColor: 'text-emphasis',
|
|
111
|
+
textDecorationStyle: 'decoration',
|
|
112
|
+
textDecorationThickness: 'decoration',
|
|
113
|
+
textUnderlineOffset: 'underline-offset',
|
|
114
|
+
textTransform: 'text',
|
|
115
|
+
textIndent: 'indent',
|
|
116
|
+
textShadow: 'text-shadow',
|
|
117
|
+
textOverflow: 'text',
|
|
118
|
+
verticalAlign: 'align',
|
|
119
|
+
wordBreak: 'break',
|
|
120
|
+
textWrap: 'text',
|
|
121
|
+
truncate: 'truncate',
|
|
122
|
+
lineClamp: 'clamp',
|
|
123
|
+
listStyleType: 'list',
|
|
124
|
+
listStylePosition: 'list',
|
|
125
|
+
listStyleImage: 'list-img',
|
|
126
|
+
backgroundPosition: 'bg',
|
|
127
|
+
backgroundPositionX: 'bg-x',
|
|
128
|
+
backgroundPositionY: 'bg-y',
|
|
129
|
+
backgroundAttachment: 'bg',
|
|
130
|
+
backgroundClip: 'bg-clip',
|
|
131
|
+
background: 'bg',
|
|
132
|
+
backgroundColor: 'bg',
|
|
133
|
+
backgroundOrigin: 'bg-origin',
|
|
134
|
+
backgroundImage: 'bg-img',
|
|
135
|
+
backgroundRepeat: 'bg-repeat',
|
|
136
|
+
backgroundBlendMode: 'bg-blend',
|
|
137
|
+
backgroundSize: 'bg',
|
|
138
|
+
backgroundGradient: 'bg-gradient',
|
|
139
|
+
textGradient: 'text-gradient',
|
|
140
|
+
gradientFrom: 'from',
|
|
141
|
+
gradientTo: 'to',
|
|
142
|
+
gradientVia: 'via',
|
|
143
|
+
borderRadius: 'rounded',
|
|
144
|
+
borderTopLeftRadius: 'rounded-tl',
|
|
145
|
+
borderTopRightRadius: 'rounded-tr',
|
|
146
|
+
borderBottomRightRadius: 'rounded-br',
|
|
147
|
+
borderBottomLeftRadius: 'rounded-bl',
|
|
148
|
+
borderTopRadius: 'rounded-t',
|
|
149
|
+
borderRightRadius: 'rounded-r',
|
|
150
|
+
borderBottomRadius: 'rounded-b',
|
|
151
|
+
borderLeftRadius: 'rounded-l',
|
|
152
|
+
borderStartStartRadius: 'rounded-ss',
|
|
153
|
+
borderStartEndRadius: 'rounded-se',
|
|
154
|
+
borderStartRadius: 'rounded-s',
|
|
155
|
+
borderEndStartRadius: 'rounded-es',
|
|
156
|
+
borderEndEndRadius: 'rounded-ee',
|
|
157
|
+
borderEndRadius: 'rounded-e',
|
|
158
|
+
border: 'border',
|
|
159
|
+
borderColor: 'border',
|
|
160
|
+
borderInline: 'border-x',
|
|
161
|
+
borderInlineWidth: 'border-x',
|
|
162
|
+
borderInlineColor: 'border-x',
|
|
163
|
+
borderBlock: 'border-y',
|
|
164
|
+
borderBlockWidth: 'border-y',
|
|
165
|
+
borderBlockColor: 'border-y',
|
|
166
|
+
borderLeft: 'border-l',
|
|
167
|
+
borderLeftColor: 'border-l',
|
|
168
|
+
borderInlineStart: 'border-s',
|
|
169
|
+
borderInlineStartColor: 'border-s',
|
|
170
|
+
borderRight: 'border-r',
|
|
171
|
+
borderRightColor: 'border-r',
|
|
172
|
+
borderInlineEnd: 'border-e',
|
|
173
|
+
borderInlineEndColor: 'border-e',
|
|
174
|
+
borderTop: 'border-t',
|
|
175
|
+
borderTopColor: 'border-t',
|
|
176
|
+
borderBottom: 'border-b',
|
|
177
|
+
borderBottomColor: 'border-b',
|
|
178
|
+
borderBlockEnd: 'border-be',
|
|
179
|
+
borderBlockEndColor: 'border-be',
|
|
180
|
+
borderBlockStart: 'border-bs',
|
|
181
|
+
borderBlockStartColor: 'border-bs',
|
|
182
|
+
boxShadow: 'shadow',
|
|
183
|
+
boxShadowColor: 'shadow',
|
|
184
|
+
mixBlendMode: 'mix-blend',
|
|
185
|
+
filter: 'filter',
|
|
186
|
+
brightness: 'brightness',
|
|
187
|
+
contrast: 'contrast',
|
|
188
|
+
grayscale: 'grayscale',
|
|
189
|
+
hueRotate: 'hue-rotate',
|
|
190
|
+
invert: 'invert',
|
|
191
|
+
saturate: 'saturate',
|
|
192
|
+
sepia: 'sepia',
|
|
193
|
+
dropShadow: 'drop-shadow',
|
|
194
|
+
blur: 'blur',
|
|
195
|
+
backdropFilter: 'backdrop',
|
|
196
|
+
backdropBlur: 'backdrop-blur',
|
|
197
|
+
backdropBrightness: 'backdrop-brightness',
|
|
198
|
+
backdropContrast: 'backdrop-contrast',
|
|
199
|
+
backdropGrayscale: 'backdrop-grayscale',
|
|
200
|
+
backdropHueRotate: 'backdrop-hue-rotate',
|
|
201
|
+
backdropInvert: 'backdrop-invert',
|
|
202
|
+
backdropOpacity: 'backdrop-opacity',
|
|
203
|
+
backdropSaturate: 'backdrop-saturate',
|
|
204
|
+
backdropSepia: 'backdrop-sepia',
|
|
205
|
+
borderCollapse: 'border',
|
|
206
|
+
borderSpacing: 'border-spacing',
|
|
207
|
+
borderSpacingX: 'border-spacing-x',
|
|
208
|
+
borderSpacingY: 'border-spacing-y',
|
|
209
|
+
tableLayout: 'table',
|
|
210
|
+
transitionTimingFunction: 'ease',
|
|
211
|
+
transitionDelay: 'delay',
|
|
212
|
+
transitionDuration: 'duration',
|
|
213
|
+
transitionProperty: 'transition',
|
|
214
|
+
animation: 'animation',
|
|
215
|
+
animationDelay: 'animation-delay',
|
|
216
|
+
transform: 'transform',
|
|
217
|
+
transformOrigin: 'origin',
|
|
218
|
+
scale: 'scale',
|
|
219
|
+
scaleX: 'scale-x',
|
|
220
|
+
scaleY: 'scale-y',
|
|
221
|
+
rotate: 'rotate',
|
|
222
|
+
translateX: 'translate-x',
|
|
223
|
+
translateY: 'translate-y',
|
|
224
|
+
skewX: 'skew-x',
|
|
225
|
+
skewY: 'skew-y',
|
|
226
|
+
accentColor: 'accent',
|
|
227
|
+
caretColor: 'caret',
|
|
228
|
+
scrollBehavior: 'scroll',
|
|
229
|
+
scrollbar: 'scrollbar',
|
|
230
|
+
scrollMargin: 'scroll-m',
|
|
231
|
+
scrollMarginX: 'scroll-mx',
|
|
232
|
+
scrollMarginY: 'scroll-my',
|
|
233
|
+
scrollMarginLeft: 'scroll-ml',
|
|
234
|
+
scrollMarginRight: 'scroll-mr',
|
|
235
|
+
scrollMarginTop: 'scroll-mt',
|
|
236
|
+
scrollMarginBottom: 'scroll-mb',
|
|
237
|
+
scrollMarginBlock: 'scroll-my',
|
|
238
|
+
scrollMarginBlockEnd: 'scroll-mb',
|
|
239
|
+
scrollMarginBlockStart: 'scroll-mt',
|
|
240
|
+
scrollMarginInline: 'scroll-mx',
|
|
241
|
+
scrollMarginInlineEnd: 'scroll-me',
|
|
242
|
+
scrollMarginInlineStart: 'scroll-ms',
|
|
243
|
+
scrollPadding: 'scroll-p',
|
|
244
|
+
scrollPaddingBlock: 'scroll-pb',
|
|
245
|
+
scrollPaddingBlockStart: 'scroll-pt',
|
|
246
|
+
scrollPaddingBlockEnd: 'scroll-pb',
|
|
247
|
+
scrollPaddingInline: 'scroll-px',
|
|
248
|
+
scrollPaddingInlineEnd: 'scroll-pe',
|
|
249
|
+
scrollPaddingInlineStart: 'scroll-ps',
|
|
250
|
+
scrollPaddingX: 'scroll-px',
|
|
251
|
+
scrollPaddingY: 'scroll-py',
|
|
252
|
+
scrollPaddingLeft: 'scroll-pl',
|
|
253
|
+
scrollPaddingRight: 'scroll-pr',
|
|
254
|
+
scrollPaddingTop: 'scroll-pt',
|
|
255
|
+
scrollPaddingBottom: 'scroll-pb',
|
|
256
|
+
scrollSnapAlign: 'snap',
|
|
257
|
+
scrollSnapStop: 'snap',
|
|
258
|
+
scrollSnapType: 'snap',
|
|
259
|
+
scrollSnapStrictness: 'strictness',
|
|
260
|
+
scrollSnapMargin: 'snap-m',
|
|
261
|
+
scrollSnapMarginTop: 'snap-mt',
|
|
262
|
+
scrollSnapMarginBottom: 'snap-mb',
|
|
263
|
+
scrollSnapMarginLeft: 'snap-ml',
|
|
264
|
+
scrollSnapMarginRight: 'snap-mr',
|
|
265
|
+
touchAction: 'touch',
|
|
266
|
+
userSelect: 'select',
|
|
267
|
+
fill: 'fill',
|
|
268
|
+
stroke: 'stroke',
|
|
269
|
+
srOnly: 'sr',
|
|
270
|
+
debug: 'debug',
|
|
271
|
+
textStyle: 'textStyle',
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const shorthands = {
|
|
275
|
+
pos: 'position',
|
|
276
|
+
insetEnd: 'insetInlineEnd',
|
|
277
|
+
end: 'insetInlineEnd',
|
|
278
|
+
insetStart: 'insetInlineStart',
|
|
279
|
+
start: 'insetInlineStart',
|
|
280
|
+
flexDir: 'flexDirection',
|
|
281
|
+
p: 'padding',
|
|
282
|
+
pl: 'paddingLeft',
|
|
283
|
+
pr: 'paddingRight',
|
|
284
|
+
pt: 'paddingTop',
|
|
285
|
+
pb: 'paddingBottom',
|
|
286
|
+
py: 'paddingBlock',
|
|
287
|
+
paddingY: 'paddingBlock',
|
|
288
|
+
paddingX: 'paddingInline',
|
|
289
|
+
px: 'paddingInline',
|
|
290
|
+
pe: 'paddingInlineEnd',
|
|
291
|
+
paddingEnd: 'paddingInlineEnd',
|
|
292
|
+
ps: 'paddingInlineStart',
|
|
293
|
+
paddingStart: 'paddingInlineStart',
|
|
294
|
+
ml: 'marginLeft',
|
|
295
|
+
mr: 'marginRight',
|
|
296
|
+
mt: 'marginTop',
|
|
297
|
+
mb: 'marginBottom',
|
|
298
|
+
m: 'margin',
|
|
299
|
+
my: 'marginBlock',
|
|
300
|
+
marginY: 'marginBlock',
|
|
301
|
+
mx: 'marginInline',
|
|
302
|
+
marginX: 'marginInline',
|
|
303
|
+
me: 'marginInlineEnd',
|
|
304
|
+
marginEnd: 'marginInlineEnd',
|
|
305
|
+
ms: 'marginInlineStart',
|
|
306
|
+
marginStart: 'marginInlineStart',
|
|
307
|
+
ringWidth: 'outlineWidth',
|
|
308
|
+
ringColor: 'outlineColor',
|
|
309
|
+
ring: 'outline',
|
|
310
|
+
ringOffset: 'outlineOffset',
|
|
311
|
+
w: 'width',
|
|
312
|
+
minW: 'minWidth',
|
|
313
|
+
maxW: 'maxWidth',
|
|
314
|
+
h: 'height',
|
|
315
|
+
minH: 'minHeight',
|
|
316
|
+
maxH: 'maxHeight',
|
|
317
|
+
bgPosition: 'backgroundPosition',
|
|
318
|
+
bgPositionX: 'backgroundPositionX',
|
|
319
|
+
bgPositionY: 'backgroundPositionY',
|
|
320
|
+
bgAttachment: 'backgroundAttachment',
|
|
321
|
+
bgClip: 'backgroundClip',
|
|
322
|
+
bg: 'background',
|
|
323
|
+
bgColor: 'backgroundColor',
|
|
324
|
+
bgOrigin: 'backgroundOrigin',
|
|
325
|
+
bgImage: 'backgroundImage',
|
|
326
|
+
bgRepeat: 'backgroundRepeat',
|
|
327
|
+
bgBlendMode: 'backgroundBlendMode',
|
|
328
|
+
bgSize: 'backgroundSize',
|
|
329
|
+
bgGradient: 'backgroundGradient',
|
|
330
|
+
rounded: 'borderRadius',
|
|
331
|
+
roundedTopLeft: 'borderTopLeftRadius',
|
|
332
|
+
roundedTopRight: 'borderTopRightRadius',
|
|
333
|
+
roundedBottomRight: 'borderBottomRightRadius',
|
|
334
|
+
roundedBottomLeft: 'borderBottomLeftRadius',
|
|
335
|
+
roundedTop: 'borderTopRadius',
|
|
336
|
+
roundedRight: 'borderRightRadius',
|
|
337
|
+
roundedBottom: 'borderBottomRadius',
|
|
338
|
+
roundedLeft: 'borderLeftRadius',
|
|
339
|
+
roundedStartStart: 'borderStartStartRadius',
|
|
340
|
+
roundedStartEnd: 'borderStartEndRadius',
|
|
341
|
+
roundedStart: 'borderStartRadius',
|
|
342
|
+
roundedEndStart: 'borderEndStartRadius',
|
|
343
|
+
roundedEndEnd: 'borderEndEndRadius',
|
|
344
|
+
roundedEnd: 'borderEndRadius',
|
|
345
|
+
borderX: 'borderInline',
|
|
346
|
+
borderXWidth: 'borderInlineWidth',
|
|
347
|
+
borderXColor: 'borderInlineColor',
|
|
348
|
+
borderY: 'borderBlock',
|
|
349
|
+
borderYWidth: 'borderBlockWidth',
|
|
350
|
+
borderYColor: 'borderBlockColor',
|
|
351
|
+
borderStart: 'borderInlineStart',
|
|
352
|
+
borderStartColor: 'borderInlineStartColor',
|
|
353
|
+
borderEnd: 'borderInlineEnd',
|
|
354
|
+
borderEndColor: 'borderInlineEndColor',
|
|
355
|
+
shadow: 'boxShadow',
|
|
356
|
+
shadowColor: 'boxShadowColor',
|
|
357
|
+
x: 'translateX',
|
|
358
|
+
y: 'translateY',
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const breakpointKeys = ['base', 'sm', 'md', 'lg', 'xl', '2xl']
|
|
362
|
+
|
|
363
|
+
const hasShorthand = true
|
|
364
|
+
|
|
365
|
+
const resolveShorthand = (prop) => shorthands[prop] || prop
|
|
366
|
+
|
|
367
|
+
function transform(prop, value) {
|
|
368
|
+
const key = resolveShorthand(prop)
|
|
369
|
+
const propKey = classNameMap[key] || hypenateProperty(key)
|
|
370
|
+
const className = `${propKey}_${withoutSpace(value)}`
|
|
371
|
+
return { className }
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const context = {
|
|
375
|
+
hash: false,
|
|
376
|
+
conditions: {
|
|
377
|
+
shift: sortConditions,
|
|
378
|
+
finalize: finalizeConditions,
|
|
379
|
+
breakpoints: { keys: breakpointKeys },
|
|
380
|
+
},
|
|
381
|
+
utility: {
|
|
382
|
+
prefix: undefined,
|
|
383
|
+
transform,
|
|
384
|
+
hasShorthand,
|
|
385
|
+
resolveShorthand,
|
|
386
|
+
},
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export const css = createCss(context)
|
|
390
|
+
|
|
391
|
+
export const { mergeCss, assignCss } = createMergeCss(context)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { compact, splitProps } from '../helpers.mjs'
|
|
2
|
+
import { css, mergeCss } from './css.mjs'
|
|
3
|
+
|
|
4
|
+
export function cva(config) {
|
|
5
|
+
const { base = {}, variants = {}, defaultVariants = {}, compoundVariants = [] } = config
|
|
6
|
+
|
|
7
|
+
function resolve(props) {
|
|
8
|
+
const computedVariants = { ...defaultVariants, ...compact(props) }
|
|
9
|
+
let variantCss = { ...base }
|
|
10
|
+
for (const [key, value] of Object.entries(computedVariants)) {
|
|
11
|
+
if (variants[key]?.[value]) {
|
|
12
|
+
variantCss = mergeCss(variantCss, variants[key][value])
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants)
|
|
16
|
+
return mergeCss(variantCss, compoundVariantCss)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function cvaFn(props) {
|
|
20
|
+
return css(resolve(props))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const variantKeys = Object.keys(variants)
|
|
24
|
+
|
|
25
|
+
function splitVariantProps(props) {
|
|
26
|
+
return splitProps(props, variantKeys)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
|
|
30
|
+
|
|
31
|
+
return Object.assign(cvaFn, {
|
|
32
|
+
__cva__: true,
|
|
33
|
+
variants: variantMap,
|
|
34
|
+
variantKeys,
|
|
35
|
+
resolve,
|
|
36
|
+
config,
|
|
37
|
+
splitVariantProps,
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function getCompoundVariantCss(compoundVariants, variantMap) {
|
|
42
|
+
let result = {}
|
|
43
|
+
compoundVariants.forEach((compoundVariant) => {
|
|
44
|
+
const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
|
|
45
|
+
if (key === 'css') return true
|
|
46
|
+
|
|
47
|
+
const values = Array.isArray(value) ? value : [value]
|
|
48
|
+
return values.some((value) => variantMap[key] === value)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
if (isMatching) {
|
|
52
|
+
result = mergeCss(result, compoundVariant.css)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return result
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function assertCompoundVariant(name, compoundVariants, variants, prop) {
|
|
60
|
+
if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
|
|
61
|
+
throw new Error(`[recipe:${name}:${prop}] Conditions are not supported when using compound variants.`)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@layer base {
|
|
2
|
+
:root {
|
|
3
|
+
--made-with-panda: '🐼';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
*,
|
|
7
|
+
*::before,
|
|
8
|
+
*::after,
|
|
9
|
+
::backdrop {
|
|
10
|
+
--blur: ;
|
|
11
|
+
--brightness: ;
|
|
12
|
+
--contrast: ;
|
|
13
|
+
--grayscale: ;
|
|
14
|
+
--hue-rotate: ;
|
|
15
|
+
--invert: ;
|
|
16
|
+
--saturate: ;
|
|
17
|
+
--sepia: ;
|
|
18
|
+
--drop-shadow: ;
|
|
19
|
+
--backdrop-blur: ;
|
|
20
|
+
--backdrop-brightness: ;
|
|
21
|
+
--backdrop-contrast: ;
|
|
22
|
+
--backdrop-grayscale: ;
|
|
23
|
+
--backdrop-hue-rotate: ;
|
|
24
|
+
--backdrop-invert: ;
|
|
25
|
+
--backdrop-opacity: ;
|
|
26
|
+
--backdrop-saturate: ;
|
|
27
|
+
--backdrop-sepia: ;
|
|
28
|
+
--scroll-snap-strictness: proximity;
|
|
29
|
+
--border-spacing-x: 0;
|
|
30
|
+
--border-spacing-y: 0;
|
|
31
|
+
--translate-x: 0;
|
|
32
|
+
--translate-y: 0;
|
|
33
|
+
--rotate: 0;
|
|
34
|
+
--skew-x: 0;
|
|
35
|
+
--skew-y: 0;
|
|
36
|
+
--scale-x: 1;
|
|
37
|
+
--scale-y: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:root {
|
|
41
|
+
--global-color-border: var(--colors-border);
|
|
42
|
+
--global-color-placeholder: var(--colors-neutral-500);
|
|
43
|
+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
44
|
+
font-size: var(--font-sizes-md);
|
|
45
|
+
line-height: var(--line-heights-normal);
|
|
46
|
+
font-weight: var(--font-weights-normal);
|
|
47
|
+
color-scheme: light dark;
|
|
48
|
+
color: var(--colors-text);
|
|
49
|
+
background: var(--colors-bg);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
a {
|
|
53
|
+
color: unset;
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
body {
|
|
58
|
+
margin: 0;
|
|
59
|
+
min-height: 100vh;
|
|
60
|
+
}
|
|
61
|
+
}
|