@mekari/pixel3-styled-system 0.0.7 → 0.0.8-dev.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.
Files changed (187) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/css/conditions.mjs +1 -1
  3. package/css/css.d.ts +15 -2
  4. package/css/css.mjs +2 -1
  5. package/css/cva.d.ts +1 -1
  6. package/css/cva.mjs +3 -1
  7. package/css/sva.mjs +8 -2
  8. package/helpers.mjs +44 -48
  9. package/jsx/aspect-ratio.mjs +1 -1
  10. package/jsx/bleed.mjs +1 -1
  11. package/jsx/box.mjs +1 -1
  12. package/jsx/center.mjs +1 -1
  13. package/jsx/circle.mjs +1 -1
  14. package/jsx/container.mjs +1 -1
  15. package/jsx/cq.mjs +1 -1
  16. package/jsx/divider.mjs +1 -1
  17. package/jsx/factory.mjs +46 -18
  18. package/jsx/flex.mjs +1 -1
  19. package/jsx/float.mjs +1 -1
  20. package/jsx/grid-item.mjs +1 -1
  21. package/jsx/grid.mjs +1 -1
  22. package/jsx/hstack.mjs +1 -1
  23. package/jsx/index.d.ts +0 -1
  24. package/jsx/index.mjs +0 -1
  25. package/jsx/is-valid-prop.d.ts +1 -2
  26. package/jsx/is-valid-prop.mjs +2 -2
  27. package/jsx/link-overlay.mjs +1 -1
  28. package/jsx/spacer.mjs +1 -1
  29. package/jsx/square.mjs +1 -1
  30. package/jsx/stack.mjs +1 -1
  31. package/jsx/visually-hidden.mjs +1 -1
  32. package/jsx/vstack.mjs +1 -1
  33. package/jsx/wrap.mjs +1 -1
  34. package/package.json +1 -1
  35. package/patterns/aspect-ratio.d.ts +1 -1
  36. package/patterns/bleed.d.ts +3 -3
  37. package/patterns/box.d.ts +1 -1
  38. package/patterns/center.d.ts +1 -1
  39. package/patterns/circle.d.ts +2 -2
  40. package/patterns/container.d.ts +1 -1
  41. package/patterns/cq.d.ts +2 -2
  42. package/patterns/divider.d.ts +1 -1
  43. package/patterns/flex.d.ts +8 -8
  44. package/patterns/float.d.ts +1 -1
  45. package/patterns/grid-item.d.ts +1 -1
  46. package/patterns/grid.d.ts +4 -4
  47. package/patterns/hstack.d.ts +3 -3
  48. package/patterns/index.d.ts +0 -1
  49. package/patterns/index.mjs +0 -1
  50. package/patterns/link-overlay.d.ts +1 -1
  51. package/patterns/link-overlay.mjs +0 -3
  52. package/patterns/spacer.d.ts +1 -1
  53. package/patterns/square.d.ts +2 -2
  54. package/patterns/stack.d.ts +5 -5
  55. package/patterns/visually-hidden.d.ts +1 -1
  56. package/patterns/vstack.d.ts +3 -3
  57. package/patterns/wrap.d.ts +6 -6
  58. package/recipes/accordion.d.ts +1 -0
  59. package/recipes/accordion.mjs +4 -2
  60. package/recipes/avatar-group-slot-recipe.d.ts +1 -0
  61. package/recipes/avatar-group-slot-recipe.mjs +4 -2
  62. package/recipes/avatar-slot-recipe.d.ts +1 -0
  63. package/recipes/avatar-slot-recipe.mjs +4 -2
  64. package/recipes/badge-recipe.d.ts +1 -0
  65. package/recipes/badge-recipe.mjs +3 -1
  66. package/recipes/banner-close-button-recipe.d.ts +1 -0
  67. package/recipes/banner-close-button-recipe.mjs +3 -1
  68. package/recipes/banner-description-recipe.d.ts +1 -0
  69. package/recipes/banner-description-recipe.mjs +3 -1
  70. package/recipes/banner-icon-slot-recipe.d.ts +1 -0
  71. package/recipes/banner-icon-slot-recipe.mjs +4 -2
  72. package/recipes/banner-link-recipe.d.ts +1 -0
  73. package/recipes/banner-link-recipe.mjs +3 -1
  74. package/recipes/banner-slot-recipe.d.ts +1 -0
  75. package/recipes/banner-slot-recipe.mjs +4 -2
  76. package/recipes/banner-title-recipe.d.ts +1 -0
  77. package/recipes/banner-title-recipe.mjs +3 -1
  78. package/recipes/broadcast-slot-recipe.d.ts +1 -0
  79. package/recipes/broadcast-slot-recipe.mjs +4 -2
  80. package/recipes/button-group-recipe.d.ts +1 -0
  81. package/recipes/button-group-recipe.mjs +3 -1
  82. package/recipes/button-recipe.d.ts +1 -0
  83. package/recipes/button-recipe.mjs +3 -1
  84. package/recipes/calendar-panel-range-recipe.d.ts +1 -0
  85. package/recipes/calendar-panel-range-recipe.mjs +3 -1
  86. package/recipes/carousel-slot-recipe.d.ts +1 -0
  87. package/recipes/carousel-slot-recipe.mjs +4 -2
  88. package/recipes/chart-slot-recipe.d.ts +28 -0
  89. package/recipes/chart-slot-recipe.mjs +80 -0
  90. package/recipes/checkbox-slot-recipe.d.ts +1 -0
  91. package/recipes/checkbox-slot-recipe.mjs +4 -2
  92. package/recipes/create-recipe.mjs +8 -5
  93. package/recipes/date-item-recipe.d.ts +1 -0
  94. package/recipes/date-item-recipe.mjs +3 -1
  95. package/recipes/date-picker-slot-recipe.d.ts +1 -0
  96. package/recipes/date-picker-slot-recipe.mjs +4 -2
  97. package/recipes/day-item-recipe.d.ts +1 -0
  98. package/recipes/day-item-recipe.mjs +3 -1
  99. package/recipes/divider-recipe.d.ts +1 -0
  100. package/recipes/divider-recipe.mjs +3 -1
  101. package/recipes/dropzone-slot-recipe.d.ts +1 -0
  102. package/recipes/dropzone-slot-recipe.mjs +4 -2
  103. package/recipes/form-control-slot-recipe.d.ts +1 -0
  104. package/recipes/form-control-slot-recipe.mjs +4 -2
  105. package/recipes/icon-recipe.d.ts +1 -0
  106. package/recipes/icon-recipe.mjs +3 -1
  107. package/recipes/index.d.ts +2 -1
  108. package/recipes/index.mjs +2 -1
  109. package/recipes/input-addon-slot-recipe.d.ts +1 -0
  110. package/recipes/input-addon-slot-recipe.mjs +4 -2
  111. package/recipes/input-group-slot-recipe.d.ts +1 -0
  112. package/recipes/input-group-slot-recipe.mjs +4 -2
  113. package/recipes/input-slot-recipe.d.ts +1 -0
  114. package/recipes/input-slot-recipe.mjs +4 -2
  115. package/recipes/input-tag-slot-recipe.d.ts +1 -0
  116. package/recipes/input-tag-slot-recipe.mjs +4 -2
  117. package/recipes/modal-slot-recipe.d.ts +6 -1
  118. package/recipes/modal-slot-recipe.mjs +4 -2
  119. package/recipes/month-item-recipe.d.ts +1 -0
  120. package/recipes/month-item-recipe.mjs +3 -1
  121. package/recipes/pinbar-slot-recipe.d.ts +1 -0
  122. package/recipes/pinbar-slot-recipe.mjs +4 -2
  123. package/recipes/popover-content-recipe.d.ts +1 -0
  124. package/recipes/popover-content-recipe.mjs +3 -1
  125. package/recipes/popover-list-item-recipe.d.ts +1 -0
  126. package/recipes/popover-list-item-recipe.mjs +3 -1
  127. package/recipes/popover-list-recipe.d.ts +1 -0
  128. package/recipes/popover-list-recipe.mjs +3 -1
  129. package/recipes/progress-slot-recipe.d.ts +1 -0
  130. package/recipes/progress-slot-recipe.mjs +4 -2
  131. package/recipes/radio-slot-recipe.d.ts +1 -0
  132. package/recipes/radio-slot-recipe.mjs +4 -2
  133. package/recipes/rich-text-editor-slot-recipe.d.ts +1 -0
  134. package/recipes/rich-text-editor-slot-recipe.mjs +4 -2
  135. package/recipes/rtestyle-provider-recipe.d.ts +1 -0
  136. package/recipes/rtestyle-provider-recipe.mjs +3 -1
  137. package/recipes/segmented-control-slot-recipe.d.ts +1 -0
  138. package/recipes/segmented-control-slot-recipe.mjs +4 -2
  139. package/recipes/select-slot-recipe.d.ts +1 -0
  140. package/recipes/select-slot-recipe.mjs +4 -2
  141. package/recipes/selected-border-recipe.d.ts +1 -0
  142. package/recipes/selected-border-recipe.mjs +3 -1
  143. package/recipes/shared-slot-recipe.d.ts +1 -0
  144. package/recipes/shared-slot-recipe.mjs +4 -2
  145. package/recipes/spinner-recipe.d.ts +1 -0
  146. package/recipes/spinner-recipe.mjs +3 -1
  147. package/recipes/tab-list-recipe.d.ts +1 -0
  148. package/recipes/tab-list-recipe.mjs +3 -1
  149. package/recipes/tab-recipe.d.ts +1 -0
  150. package/recipes/tab-recipe.mjs +3 -1
  151. package/recipes/table-container-recipe.d.ts +1 -0
  152. package/recipes/table-container-recipe.mjs +3 -1
  153. package/recipes/table-date-slot-recipe.d.ts +1 -0
  154. package/recipes/table-date-slot-recipe.mjs +4 -2
  155. package/recipes/table-month-slot-recipe.d.ts +1 -0
  156. package/recipes/table-month-slot-recipe.mjs +4 -2
  157. package/recipes/table-recipe.d.ts +1 -0
  158. package/recipes/table-recipe.mjs +3 -1
  159. package/recipes/table-year-slot-recipe.d.ts +1 -0
  160. package/recipes/table-year-slot-recipe.mjs +4 -2
  161. package/recipes/tag-slot-recipe.d.ts +1 -0
  162. package/recipes/tag-slot-recipe.mjs +4 -2
  163. package/recipes/text-recipe.d.ts +1 -0
  164. package/recipes/text-recipe.mjs +3 -1
  165. package/recipes/textarea-recipe.d.ts +1 -0
  166. package/recipes/textarea-recipe.mjs +3 -1
  167. package/recipes/toast-slot-recipe.d.ts +1 -0
  168. package/recipes/toast-slot-recipe.mjs +4 -2
  169. package/recipes/toggle-slot-recipe.d.ts +1 -0
  170. package/recipes/toggle-slot-recipe.mjs +4 -2
  171. package/recipes/tooltip-recipe.d.ts +1 -0
  172. package/recipes/tooltip-recipe.mjs +3 -1
  173. package/recipes/upload-list-slot-recipe.d.ts +1 -0
  174. package/recipes/upload-list-slot-recipe.mjs +4 -2
  175. package/recipes/upload-slot-recipe.d.ts +1 -0
  176. package/recipes/upload-slot-recipe.mjs +4 -2
  177. package/recipes/year-item-recipe.d.ts +1 -0
  178. package/recipes/year-item-recipe.mjs +3 -1
  179. package/tokens/tokens.d.ts +0 -3
  180. package/types/composition.d.ts +39 -12
  181. package/types/conditions.d.ts +24 -26
  182. package/types/pattern.d.ts +4 -0
  183. package/types/prop-type.d.ts +51 -223
  184. package/types/recipe.d.ts +33 -10
  185. package/types/static-css.d.ts +4 -0
  186. package/types/style-props.d.ts +7458 -644
  187. package/types/system-types.d.ts +3 -8
@@ -150,9 +150,9 @@ export interface Conditions {
150
150
  "_landscape": string
151
151
  /** `@media (orientation: portrait)` */
152
152
  "_portrait": string
153
- /** ` &.dark, .dark &` */
153
+ /** `.dark &` */
154
154
  "_dark": string
155
- /** ` &.light, .light &` */
155
+ /** `.light &` */
156
156
  "_light": string
157
157
  /** `@media (prefers-color-scheme: dark)` */
158
158
  "_osDark": string
@@ -178,6 +178,8 @@ export interface Conditions {
178
178
  "_horizontal": string
179
179
  /** `&[data-orientation=vertical]` */
180
180
  "_vertical": string
181
+ /** `@starting-style` */
182
+ "_starting": string
181
183
  /** `&:is([hidden])` */
182
184
  "_hidden": string
183
185
  /** `&:is([aria-collapsed=true], [data-collapsed], [data-state="collapsed"])` */
@@ -198,57 +200,53 @@ export interface Conditions {
198
200
  "_placementLeft": string
199
201
  /** `&[data-placement=right]` */
200
202
  "_placementRight": string
201
- /** `@media screen and (min-width: 22.5em)` */
203
+ /** `@media screen and (min-width: 22.5rem)` */
202
204
  "sm": string
203
- /** `@media screen and (min-width: 22.5em) and (max-width: 47.9975em)` */
205
+ /** `@media screen and (min-width: 22.5rem) and (max-width: 47.9975rem)` */
204
206
  "smOnly": string
205
- /** `@media screen and (max-width: 22.4975em)` */
207
+ /** `@media screen and (max-width: 22.4975rem)` */
206
208
  "smDown": string
207
- /** `@media screen and (min-width: 48em)` */
209
+ /** `@media screen and (min-width: 48rem)` */
208
210
  "md": string
209
- /** `@media screen and (min-width: 48em) and (max-width: 63.9975em)` */
211
+ /** `@media screen and (min-width: 48rem) and (max-width: 63.9975rem)` */
210
212
  "mdOnly": string
211
- /** `@media screen and (max-width: 47.9975em)` */
213
+ /** `@media screen and (max-width: 47.9975rem)` */
212
214
  "mdDown": string
213
- /** `@media screen and (min-width: 64em)` */
215
+ /** `@media screen and (min-width: 64rem)` */
214
216
  "lg": string
215
- /** `@media screen and (min-width: 64em) and (max-width: 79.9975em)` */
217
+ /** `@media screen and (min-width: 64rem) and (max-width: 79.9975rem)` */
216
218
  "lgOnly": string
217
- /** `@media screen and (max-width: 63.9975em)` */
219
+ /** `@media screen and (max-width: 63.9975rem)` */
218
220
  "lgDown": string
219
- /** `@media screen and (min-width: 80em)` */
221
+ /** `@media screen and (min-width: 80rem)` */
220
222
  "xl": string
221
- /** `@media screen and (min-width: 80em)` */
223
+ /** `@media screen and (min-width: 80rem)` */
222
224
  "xlOnly": string
223
- /** `@media screen and (max-width: 79.9975em)` */
225
+ /** `@media screen and (max-width: 79.9975rem)` */
224
226
  "xlDown": string
225
- /** `@media screen and (min-width: 22.5em) and (max-width: 47.9975em)` */
227
+ /** `@media screen and (min-width: 22.5rem) and (max-width: 47.9975rem)` */
226
228
  "smToMd": string
227
- /** `@media screen and (min-width: 22.5em) and (max-width: 63.9975em)` */
229
+ /** `@media screen and (min-width: 22.5rem) and (max-width: 63.9975rem)` */
228
230
  "smToLg": string
229
- /** `@media screen and (min-width: 22.5em) and (max-width: 79.9975em)` */
231
+ /** `@media screen and (min-width: 22.5rem) and (max-width: 79.9975rem)` */
230
232
  "smToXl": string
231
- /** `@media screen and (min-width: 48em) and (max-width: 63.9975em)` */
233
+ /** `@media screen and (min-width: 48rem) and (max-width: 63.9975rem)` */
232
234
  "mdToLg": string
233
- /** `@media screen and (min-width: 48em) and (max-width: 79.9975em)` */
235
+ /** `@media screen and (min-width: 48rem) and (max-width: 79.9975rem)` */
234
236
  "mdToXl": string
235
- /** `@media screen and (min-width: 64em) and (max-width: 79.9975em)` */
237
+ /** `@media screen and (min-width: 64rem) and (max-width: 79.9975rem)` */
236
238
  "lgToXl": string
237
239
  /** The base (=no conditions) styles to apply */
238
240
  "base": string
239
241
  }
240
242
 
241
- export type Condition = keyof Conditions
242
-
243
- export type Conditional<V> =
243
+ export type ConditionalValue<V> =
244
244
  | V
245
245
  | Array<V | null>
246
246
  | {
247
- [K in keyof Conditions]?: Conditional<V>
247
+ [K in keyof Conditions]?: ConditionalValue<V>
248
248
  }
249
249
 
250
- export type ConditionalValue<T> = Conditional<T>
251
-
252
250
  export type Nested<P> = P & {
253
251
  [K in Selectors]?: Nested<P>
254
252
  } & {
@@ -50,6 +50,10 @@ export interface PatternConfig<T extends PatternProperties = PatternProperties>
50
50
  * The css object this pattern will generate.
51
51
  */
52
52
  transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject
53
+ /**
54
+ * Whether the pattern is deprecated.
55
+ */
56
+ deprecated?: boolean | string
53
57
  /**
54
58
  * The jsx element name this pattern will generate.
55
59
  */
@@ -3,8 +3,7 @@ import type { ConditionalValue } from './conditions';
3
3
  import type { CssProperties } from './system-types';
4
4
  import type { Tokens } from '../tokens/index';
5
5
 
6
- interface PropertyValueTypes {
7
- aspectRatio: Tokens["aspectRatios"];
6
+ export interface UtilityValues {
8
7
  zIndex: Tokens["zIndex"];
9
8
  top: Tokens["spacing"];
10
9
  left: Tokens["spacing"];
@@ -17,9 +16,7 @@ interface PropertyValueTypes {
17
16
  insetInlineStart: Tokens["spacing"];
18
17
  right: Tokens["spacing"];
19
18
  bottom: Tokens["spacing"];
20
- insetX: Tokens["spacing"] | CssProperties["insetInline"];
21
- insetY: Tokens["spacing"] | CssProperties["insetBlock"];
22
- float: "left" | "right" | "start" | "end";
19
+ float: "start" | "end" | CssProperties["float"];
23
20
  hideFrom: Tokens["breakpoints"];
24
21
  hideBelow: Tokens["breakpoints"];
25
22
  flexBasis: Tokens["spacing"] | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6" | "1/12" | "2/12" | "3/12" | "4/12" | "5/12" | "6/12" | "7/12" | "8/12" | "9/12" | "10/12" | "11/12" | "full";
@@ -58,12 +55,11 @@ interface PropertyValueTypes {
58
55
  marginInline: "auto" | Tokens["spacing"];
59
56
  marginInlineEnd: "auto" | Tokens["spacing"];
60
57
  marginInlineStart: "auto" | Tokens["spacing"];
61
- outlineWidth: Tokens["borderWidths"];
58
+ spaceX: "auto" | Tokens["spacing"] | CssProperties["marginInlineStart"];
59
+ spaceY: "auto" | Tokens["spacing"] | CssProperties["marginBlockStart"];
62
60
  outlineColor: Tokens["colors"];
63
61
  outline: Tokens["borders"];
64
62
  outlineOffset: Tokens["spacing"];
65
- divideX: string;
66
- divideY: string;
67
63
  divideColor: Tokens["colors"];
68
64
  divideStyle: CssProperties["borderStyle"];
69
65
  width: "auto" | Tokens["sizes"] | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6" | "1/12" | "2/12" | "3/12" | "4/12" | "5/12" | "6/12" | "7/12" | "8/12" | "9/12" | "10/12" | "11/12" | "screen";
@@ -89,14 +85,13 @@ interface PropertyValueTypes {
89
85
  textEmphasisColor: Tokens["colors"];
90
86
  textIndent: Tokens["spacing"];
91
87
  textShadow: Tokens["shadows"];
88
+ textShadowColor: Tokens["colors"];
92
89
  textWrap: "wrap" | "balance" | "nowrap";
93
90
  truncate: boolean;
94
- listStyleImage: Tokens["assets"];
95
91
  background: Tokens["colors"];
96
92
  backgroundColor: Tokens["colors"];
97
- backgroundImage: Tokens["assets"];
98
- backgroundGradient: Tokens["gradients"] | "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
99
- textGradient: Tokens["gradients"] | "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
93
+ backgroundGradient: "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
94
+ textGradient: "to-t" | "to-tr" | "to-r" | "to-br" | "to-b" | "to-bl" | "to-l" | "to-tl";
100
95
  gradientFrom: Tokens["colors"];
101
96
  gradientTo: Tokens["colors"];
102
97
  gradientVia: Tokens["colors"];
@@ -116,27 +111,18 @@ interface PropertyValueTypes {
116
111
  borderEndEndRadius: Tokens["radii"];
117
112
  borderEndRadius: Tokens["radii"] | CssProperties["borderRadius"];
118
113
  border: Tokens["borders"];
119
- borderWidth: Tokens["borderWidths"];
120
- borderTopWidth: Tokens["borderWidths"];
121
- borderLeftWidth: Tokens["borderWidths"];
122
- borderRightWidth: Tokens["borderWidths"];
123
- borderBottomWidth: Tokens["borderWidths"];
124
114
  borderColor: Tokens["colors"];
125
115
  borderInline: Tokens["borders"];
126
- borderInlineWidth: Tokens["borderWidths"];
127
116
  borderInlineColor: Tokens["colors"];
128
117
  borderBlock: Tokens["borders"];
129
- borderBlockWidth: Tokens["borderWidths"];
130
118
  borderBlockColor: Tokens["colors"];
131
119
  borderLeft: Tokens["borders"];
132
120
  borderLeftColor: Tokens["colors"];
133
121
  borderInlineStart: Tokens["borders"];
134
- borderInlineStartWidth: Tokens["borderWidths"];
135
122
  borderInlineStartColor: Tokens["colors"];
136
123
  borderRight: Tokens["borders"];
137
124
  borderRightColor: Tokens["colors"];
138
125
  borderInlineEnd: Tokens["borders"];
139
- borderInlineEndWidth: Tokens["borderWidths"];
140
126
  borderInlineEndColor: Tokens["colors"];
141
127
  borderTop: Tokens["borders"];
142
128
  borderTopColor: Tokens["colors"];
@@ -150,30 +136,29 @@ interface PropertyValueTypes {
150
136
  boxShadow: Tokens["shadows"];
151
137
  boxShadowColor: Tokens["colors"];
152
138
  filter: "auto";
153
- dropShadow: Tokens["dropShadows"];
154
- blur: Tokens["blurs"];
155
139
  backdropFilter: "auto";
156
- backdropBlur: Tokens["blurs"];
157
- borderSpacing: Tokens["spacing"];
140
+ borderSpacing: Tokens["spacing"] | "auto";
158
141
  borderSpacingX: Tokens["spacing"];
159
142
  borderSpacingY: Tokens["spacing"];
160
- transitionTimingFunction: Tokens["easings"];
161
143
  transitionDelay: Tokens["durations"];
162
144
  transitionDuration: Tokens["durations"];
163
145
  transition: "all" | "common" | "background" | "colors" | "opacity" | "shadow" | "transform";
164
- animation: Tokens["animations"];
165
- animationName: Tokens["animationName"];
146
+ animationName: "fade-in" | "fade-out" | "spin";
147
+ animationDuration: Tokens["durations"];
166
148
  animationDelay: Tokens["durations"];
149
+ rotate: "auto" | "auto-3d" | CssProperties["rotate"];
150
+ rotateX: CssProperties["rotate"];
151
+ rotateY: CssProperties["rotate"];
152
+ rotateZ: CssProperties["rotate"];
167
153
  scale: "auto" | CssProperties["scale"];
168
- translate: "auto" | CssProperties["translate"];
154
+ translate: "auto" | "auto-3d" | CssProperties["translate"];
169
155
  translateX: Tokens["spacing"] | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "full" | "-1/2" | "-1/3" | "-2/3" | "-1/4" | "-2/4" | "-3/4" | "-full";
170
156
  translateY: Tokens["spacing"] | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "full" | "-1/2" | "-1/3" | "-2/3" | "-1/4" | "-2/4" | "-3/4" | "-full";
157
+ translateZ: Tokens["spacing"] | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "full" | "-1/2" | "-1/3" | "-2/3" | "-1/4" | "-2/4" | "-3/4" | "-full";
171
158
  accentColor: Tokens["colors"];
172
159
  caretColor: Tokens["colors"];
173
160
  scrollbar: "visible" | "hidden";
174
161
  scrollMargin: Tokens["spacing"];
175
- scrollMarginX: Tokens["spacing"] | CssProperties["scrollMarginInline"];
176
- scrollMarginY: Tokens["spacing"] | CssProperties["scrollMarginBlock"];
177
162
  scrollMarginLeft: Tokens["spacing"];
178
163
  scrollMarginRight: Tokens["spacing"];
179
164
  scrollMarginTop: Tokens["spacing"];
@@ -191,8 +176,6 @@ interface PropertyValueTypes {
191
176
  scrollPaddingInline: Tokens["spacing"];
192
177
  scrollPaddingInlineEnd: Tokens["spacing"];
193
178
  scrollPaddingInlineStart: Tokens["spacing"];
194
- scrollPaddingX: Tokens["spacing"] | CssProperties["scrollPaddingInline"];
195
- scrollPaddingY: Tokens["spacing"] | CssProperties["scrollPaddingBlock"];
196
179
  scrollPaddingLeft: Tokens["spacing"];
197
180
  scrollPaddingRight: Tokens["spacing"];
198
181
  scrollPaddingTop: Tokens["spacing"];
@@ -206,205 +189,50 @@ interface PropertyValueTypes {
206
189
  scrollSnapMarginRight: Tokens["spacing"];
207
190
  fill: Tokens["colors"];
208
191
  stroke: Tokens["colors"];
209
- strokeWidth: Tokens["borderWidths"];
210
192
  srOnly: boolean;
211
193
  debug: boolean;
212
- containerName: Tokens["containerNames"] | CssProperties["containerName"];
194
+ containerName: CssProperties["containerName"];
213
195
  colorPalette: "currentcolor" | "dark" | "white" | "background" | "overlay" | "brand" | "whiteAlpha" | "blackAlpha" | "gray" | "blue" | "red" | "green" | "orange" | "sky" | "teal" | "violet" | "amber" | "rose" | "stone" | "lime" | "pink" | "apricot" | "aqua" | "leaf" | "fuchsia" | "ice" | "ash";
214
196
  textStyle: "overline" | "body.sm" | "body.md" | "label.sm" | "label.md" | "h3" | "h2" | "h1";
215
197
  }
216
198
 
217
199
 
218
200
 
219
- type CssValue<T> = T extends keyof CssProperties ? CssProperties[T] : never
201
+ type WithColorOpacityModifier<T> = T extends string ? `${T}/${string}` : T
220
202
 
221
- type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T] | CssValue<T> : CssValue<T>
203
+ type ImportantMark = "!" | "!important"
204
+ type WhitespaceImportant = ` ${ImportantMark}`
205
+ type Important = ImportantMark | WhitespaceImportant
206
+ type WithImportant<T> = T extends string ? `${T}${Important}` & { __important?: true } : T;
222
207
 
223
- export interface PropertyTypes extends PropertyValueTypes {
224
-
225
- pos: Shorthand<"position">;
226
- insetEnd: Shorthand<"insetInlineEnd">;
227
- end: Shorthand<"insetInlineEnd">;
228
- insetStart: Shorthand<"insetInlineStart">;
229
- start: Shorthand<"insetInlineStart">;
230
- flexDir: Shorthand<"flexDirection">;
231
- p: Shorthand<"padding">;
232
- pl: Shorthand<"paddingLeft">;
233
- pr: Shorthand<"paddingRight">;
234
- pt: Shorthand<"paddingTop">;
235
- pb: Shorthand<"paddingBottom">;
236
- py: Shorthand<"paddingBlock">;
237
- paddingY: Shorthand<"paddingBlock">;
238
- paddingX: Shorthand<"paddingInline">;
239
- px: Shorthand<"paddingInline">;
240
- pe: Shorthand<"paddingInlineEnd">;
241
- paddingEnd: Shorthand<"paddingInlineEnd">;
242
- ps: Shorthand<"paddingInlineStart">;
243
- paddingStart: Shorthand<"paddingInlineStart">;
244
- ml: Shorthand<"marginLeft">;
245
- mr: Shorthand<"marginRight">;
246
- mt: Shorthand<"marginTop">;
247
- mb: Shorthand<"marginBottom">;
248
- m: Shorthand<"margin">;
249
- my: Shorthand<"marginBlock">;
250
- marginY: Shorthand<"marginBlock">;
251
- mx: Shorthand<"marginInline">;
252
- marginX: Shorthand<"marginInline">;
253
- me: Shorthand<"marginInlineEnd">;
254
- marginEnd: Shorthand<"marginInlineEnd">;
255
- ms: Shorthand<"marginInlineStart">;
256
- marginStart: Shorthand<"marginInlineStart">;
257
- ringWidth: Shorthand<"outlineWidth">;
258
- ringColor: Shorthand<"outlineColor">;
259
- ring: Shorthand<"outline">;
260
- ringOffset: Shorthand<"outlineOffset">;
261
- w: Shorthand<"width">;
262
- minW: Shorthand<"minWidth">;
263
- maxW: Shorthand<"maxWidth">;
264
- h: Shorthand<"height">;
265
- minH: Shorthand<"minHeight">;
266
- maxH: Shorthand<"maxHeight">;
267
- bgPosition: Shorthand<"backgroundPosition">;
268
- bgPositionX: Shorthand<"backgroundPositionX">;
269
- bgPositionY: Shorthand<"backgroundPositionY">;
270
- bgAttachment: Shorthand<"backgroundAttachment">;
271
- bgClip: Shorthand<"backgroundClip">;
272
- bg: Shorthand<"background">;
273
- bgColor: Shorthand<"backgroundColor">;
274
- bgOrigin: Shorthand<"backgroundOrigin">;
275
- bgImage: Shorthand<"backgroundImage">;
276
- bgRepeat: Shorthand<"backgroundRepeat">;
277
- bgBlendMode: Shorthand<"backgroundBlendMode">;
278
- bgSize: Shorthand<"backgroundSize">;
279
- bgGradient: Shorthand<"backgroundGradient">;
280
- rounded: Shorthand<"borderRadius">;
281
- roundedTopLeft: Shorthand<"borderTopLeftRadius">;
282
- roundedTopRight: Shorthand<"borderTopRightRadius">;
283
- roundedBottomRight: Shorthand<"borderBottomRightRadius">;
284
- roundedBottomLeft: Shorthand<"borderBottomLeftRadius">;
285
- roundedTop: Shorthand<"borderTopRadius">;
286
- roundedRight: Shorthand<"borderRightRadius">;
287
- roundedBottom: Shorthand<"borderBottomRadius">;
288
- roundedLeft: Shorthand<"borderLeftRadius">;
289
- roundedStartStart: Shorthand<"borderStartStartRadius">;
290
- roundedStartEnd: Shorthand<"borderStartEndRadius">;
291
- roundedStart: Shorthand<"borderStartRadius">;
292
- roundedEndStart: Shorthand<"borderEndStartRadius">;
293
- roundedEndEnd: Shorthand<"borderEndEndRadius">;
294
- roundedEnd: Shorthand<"borderEndRadius">;
295
- borderX: Shorthand<"borderInline">;
296
- borderXWidth: Shorthand<"borderInlineWidth">;
297
- borderXColor: Shorthand<"borderInlineColor">;
298
- borderY: Shorthand<"borderBlock">;
299
- borderYWidth: Shorthand<"borderBlockWidth">;
300
- borderYColor: Shorthand<"borderBlockColor">;
301
- borderStart: Shorthand<"borderInlineStart">;
302
- borderStartWidth: Shorthand<"borderInlineStartWidth">;
303
- borderStartColor: Shorthand<"borderInlineStartColor">;
304
- borderEnd: Shorthand<"borderInlineEnd">;
305
- borderEndWidth: Shorthand<"borderInlineEndWidth">;
306
- borderEndColor: Shorthand<"borderInlineEndColor">;
307
- shadow: Shorthand<"boxShadow">;
308
- shadowColor: Shorthand<"boxShadowColor">;
309
- x: Shorthand<"translateX">;
310
- y: Shorthand<"translateY">;
311
- }
312
-
313
- type StrictableProps =
314
- | 'alignContent'
315
- | 'alignItems'
316
- | 'alignSelf'
317
- | 'all'
318
- | 'animationComposition'
319
- | 'animationDirection'
320
- | 'animationFillMode'
321
- | 'appearance'
322
- | 'backfaceVisibility'
323
- | 'backgroundAttachment'
324
- | 'backgroundClip'
325
- | 'borderCollapse'
326
- | 'border'
327
- | 'borderBlock'
328
- | 'borderBlockEnd'
329
- | 'borderBlockStart'
330
- | 'borderBottom'
331
- | 'borderInline'
332
- | 'borderInlineEnd'
333
- | 'borderInlineStart'
334
- | 'borderLeft'
335
- | 'borderRight'
336
- | 'borderTop'
337
- | 'borderBlockEndStyle'
338
- | 'borderBlockStartStyle'
339
- | 'borderBlockStyle'
340
- | 'borderBottomStyle'
341
- | 'borderInlineEndStyle'
342
- | 'borderInlineStartStyle'
343
- | 'borderInlineStyle'
344
- | 'borderLeftStyle'
345
- | 'borderRightStyle'
346
- | 'borderTopStyle'
347
- | 'boxDecorationBreak'
348
- | 'boxSizing'
349
- | 'breakAfter'
350
- | 'breakBefore'
351
- | 'breakInside'
352
- | 'captionSide'
353
- | 'clear'
354
- | 'columnFill'
355
- | 'columnRuleStyle'
356
- | 'contentVisibility'
357
- | 'direction'
358
- | 'display'
359
- | 'emptyCells'
360
- | 'flexDirection'
361
- | 'flexWrap'
362
- | 'float'
363
- | 'fontKerning'
364
- | 'forcedColorAdjust'
365
- | 'isolation'
366
- | 'lineBreak'
367
- | 'mixBlendMode'
368
- | 'objectFit'
369
- | 'outlineStyle'
370
- | 'overflow'
371
- | 'overflowX'
372
- | 'overflowY'
373
- | 'overflowBlock'
374
- | 'overflowInline'
375
- | 'overflowWrap'
376
- | 'pointerEvents'
377
- | 'position'
378
- | 'resize'
379
- | 'scrollBehavior'
380
- | 'touchAction'
381
- | 'transformBox'
382
- | 'transformStyle'
383
- | 'userSelect'
384
- | 'visibility'
385
- | 'wordBreak'
386
- | 'writingMode'
208
+ /**
209
+ * Only relevant when using `strictTokens` or `strictPropertyValues` in your config.
210
+ * - Allows you to use an escape hatch (e.g. `[123px]`) to use any string as a value.
211
+ * - Allows you to use a color opacity modifier (e.g. `red/300`) with known color values.
212
+ * - Allows you to use an important mark (e.g. `!` or `!important`) in the value.
213
+ *
214
+ * This is useful when you want to use a value that is not defined in the config or want to opt-out of the defaults.
215
+ *
216
+ * @example
217
+ * css({
218
+ * fontSize: '[123px]', // ⚠️ will not throw even if you haven't defined 123px as a token
219
+ * })
220
+ *
221
+ * @see https://panda-css.com/docs/concepts/writing-styles#stricttokens
222
+ * @see https://panda-css.com/docs/concepts/writing-styles#strictpropertyvalues
223
+ */
224
+ export type WithEscapeHatch<T> = T | `[${string}]` | WithColorOpacityModifier<T> | WithImportant<T>
387
225
 
388
- type WithEscapeHatch<T> = T | `[${string}]`
389
-
390
- type FilterVagueString<Key, Value> = Value extends boolean
226
+ /**
227
+ * Will restrict the value of properties that have predefined values to those values only.
228
+ *
229
+ * @example
230
+ * css({
231
+ * display: 'abc', // ❌ will throw
232
+ * })
233
+ *
234
+ * @see https://panda-css.com/docs/concepts/writing-styles#strictpropertyvalues
235
+ */
236
+ export type OnlyKnown<Key, Value> = Value extends boolean
391
237
  ? Value
392
- : Key extends StrictableProps
393
- ? Value extends `${infer _}` ? Value : never
394
- : Value
395
-
396
- type PropOrCondition<Key, Value> = ConditionalValue<Value | (string & {})>
397
-
398
- type PropertyTypeValue<T extends string> = T extends keyof PropertyTypes
399
- ? PropOrCondition<T, PropertyTypes[T] | CssValue<T>>
400
- : never;
401
-
402
- type CssPropertyValue<T extends string> = T extends keyof CssProperties
403
- ? PropOrCondition<T, CssProperties[T]>
404
- : never;
405
-
406
- export type PropertyValue<T extends string> = T extends keyof PropertyTypes
407
- ? PropertyTypeValue<T>
408
- : T extends keyof CssProperties
409
- ? CssPropertyValue<T>
410
- : PropOrCondition<T, string | number>
238
+ : Value extends `${infer _}` ? Value : never
package/types/recipe.d.ts CHANGED
@@ -14,10 +14,21 @@ export type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends k
14
14
 
15
15
  export type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string
16
16
 
17
+ /**
18
+ * Extract the variant as optional props from a `cva` function.
19
+ * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.
20
+ */
17
21
  export type RecipeVariantProps<
18
22
  T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,
19
23
  > = Pretty<Parameters<T>[0]>
20
24
 
25
+ /**
26
+ * Extract the variants from a `cva` function.
27
+ */
28
+ export type RecipeVariant<
29
+ T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,
30
+ > = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>
31
+
21
32
  type RecipeVariantMap<T extends RecipeVariantRecord> = {
22
33
  [K in keyof T]: Array<keyof T[K]>
23
34
  }
@@ -35,6 +46,7 @@ export interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVa
35
46
  splitVariantProps<Props extends RecipeSelection<T>>(
36
47
  props: Props,
37
48
  ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]
49
+ getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>
38
50
  }
39
51
 
40
52
  type OneOrMore<T> = T | Array<T>
@@ -52,6 +64,10 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
52
64
  * The base styles of the recipe.
53
65
  */
54
66
  base?: SystemStyleObject
67
+ /**
68
+ * Whether the recipe is deprecated.
69
+ */
70
+ deprecated?: boolean | string
55
71
  /**
56
72
  * The multi-variant styles of the recipe.
57
73
  */
@@ -64,17 +80,13 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
64
80
  * The styles to apply when a combination of variants is selected.
65
81
  */
66
82
  compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]
67
- /**
68
- * Variants to pre-generate, will be include in the final `config.staticCss`
69
- */
70
- staticCss?: RecipeRule[]
71
83
  }
72
84
 
73
85
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
74
86
 
75
87
  interface RecipeConfigMeta {
76
88
  /**
77
- * The name of the recipe.
89
+ * The class name of the recipe.
78
90
  */
79
91
  className: string
80
92
  /**
@@ -88,6 +100,10 @@ interface RecipeConfigMeta {
88
100
  * @example ['Button', 'Link', /Button$/]
89
101
  */
90
102
  jsx?: Array<string | RegExp>
103
+ /**
104
+ * Variants to pre-generate, will be include in the final `config.staticCss`
105
+ */
106
+ staticCss?: RecipeRule[]
91
107
  }
92
108
 
93
109
  export interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>
@@ -111,7 +127,10 @@ export interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVaria
111
127
  raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>
112
128
  variantKeys: (keyof T)[]
113
129
  variantMap: RecipeVariantMap<T>
114
- splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]
130
+ splitVariantProps<Props extends RecipeSelection<T>>(
131
+ props: Props,
132
+ ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]
133
+ getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>
115
134
  }
116
135
 
117
136
  export type SlotRecipeCompoundVariant<S extends string, T> = T & {
@@ -122,6 +141,14 @@ export interface SlotRecipeDefinition<
122
141
  S extends string = string,
123
142
  T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,
124
143
  > {
144
+ /**
145
+ * An optional class name that can be used to target slots in the DOM.
146
+ */
147
+ className?: string
148
+ /**
149
+ * Whether the recipe is deprecated.
150
+ */
151
+ deprecated?: boolean | string
125
152
  /**
126
153
  * The parts/slots of the recipe.
127
154
  */
@@ -142,10 +169,6 @@ export interface SlotRecipeDefinition<
142
169
  * The styles to apply when a combination of variants is selected.
143
170
  */
144
171
  compoundVariants?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]
145
- /**
146
- * Variants to pre-generate, will be include in the final `config.staticCss`
147
- */
148
- staticCss?: RecipeRule[]
149
172
  }
150
173
 
151
174
  export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(
@@ -44,4 +44,8 @@ export interface StaticCssOptions {
44
44
  patterns?: {
45
45
  [pattern: string]: PatternRule[]
46
46
  }
47
+ /**
48
+ * The CSS themes to generate
49
+ */
50
+ themes?: string[]
47
51
  }