@mekari/pixel3-styled-system 0.0.1-alpha.0 → 0.0.2

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 (92) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/helpers.mjs +5 -5
  3. package/jsx/aspect-ratio.d.ts +2 -2
  4. package/jsx/aspect-ratio.mjs +9 -7
  5. package/jsx/bleed.d.ts +2 -2
  6. package/jsx/bleed.mjs +10 -8
  7. package/jsx/box.d.ts +2 -2
  8. package/jsx/box.mjs +9 -7
  9. package/jsx/center.d.ts +2 -2
  10. package/jsx/center.mjs +9 -7
  11. package/jsx/circle.d.ts +2 -2
  12. package/jsx/circle.mjs +9 -7
  13. package/jsx/container.d.ts +2 -2
  14. package/jsx/container.mjs +9 -7
  15. package/jsx/divider.d.ts +2 -2
  16. package/jsx/divider.mjs +10 -8
  17. package/jsx/factory.d.ts +2 -2
  18. package/jsx/factory.mjs +11 -11
  19. package/jsx/flex.d.ts +2 -2
  20. package/jsx/flex.mjs +10 -8
  21. package/jsx/float.d.ts +2 -2
  22. package/jsx/float.mjs +10 -8
  23. package/jsx/grid-item.d.ts +2 -2
  24. package/jsx/grid-item.mjs +10 -8
  25. package/jsx/grid.d.ts +2 -2
  26. package/jsx/grid.mjs +10 -8
  27. package/jsx/hstack.d.ts +2 -2
  28. package/jsx/hstack.mjs +10 -8
  29. package/jsx/index.d.ts +1 -4
  30. package/jsx/link-box.d.ts +2 -2
  31. package/jsx/link-box.mjs +9 -7
  32. package/jsx/link-overlay.d.ts +2 -2
  33. package/jsx/link-overlay.mjs +9 -7
  34. package/jsx/spacer.d.ts +2 -2
  35. package/jsx/spacer.mjs +9 -7
  36. package/jsx/square.d.ts +2 -2
  37. package/jsx/square.mjs +9 -7
  38. package/jsx/stack.d.ts +2 -2
  39. package/jsx/stack.mjs +10 -8
  40. package/jsx/visually-hidden.d.ts +2 -2
  41. package/jsx/visually-hidden.mjs +9 -7
  42. package/jsx/vstack.d.ts +2 -2
  43. package/jsx/vstack.mjs +10 -8
  44. package/jsx/wrap.d.ts +2 -2
  45. package/jsx/wrap.mjs +10 -8
  46. package/package.json +1 -1
  47. package/recipes/banner-close-button-recipe.d.ts +27 -0
  48. package/recipes/banner-close-button-recipe.mjs +22 -0
  49. package/recipes/banner-description-recipe.d.ts +27 -0
  50. package/recipes/banner-description-recipe.mjs +22 -0
  51. package/recipes/banner-icon-recipe.d.ts +27 -0
  52. package/recipes/banner-icon-recipe.mjs +34 -0
  53. package/recipes/banner-icon-slot-recipe.d.ts +27 -0
  54. package/recipes/banner-icon-slot-recipe.mjs +34 -0
  55. package/recipes/banner-link-recipe.d.ts +27 -0
  56. package/recipes/banner-link-recipe.mjs +22 -0
  57. package/recipes/banner-recipe.d.ts +27 -0
  58. package/recipes/banner-recipe.mjs +31 -0
  59. package/recipes/banner-slot-recipe.d.ts +27 -0
  60. package/recipes/banner-slot-recipe.mjs +45 -0
  61. package/recipes/banner-title-recipe.d.ts +27 -0
  62. package/recipes/banner-title-recipe.mjs +22 -0
  63. package/recipes/divider-recipe.d.ts +27 -0
  64. package/recipes/divider-recipe.mjs +29 -0
  65. package/recipes/dropzone-recipe.d.ts +27 -0
  66. package/recipes/dropzone-recipe.mjs +34 -0
  67. package/recipes/dropzone-slot-recipe.d.ts +27 -0
  68. package/recipes/dropzone-slot-recipe.mjs +70 -0
  69. package/recipes/form-control-slot-recipe.d.ts +27 -0
  70. package/recipes/form-control-slot-recipe.mjs +46 -0
  71. package/recipes/index.d.ts +14 -1
  72. package/recipes/index.mjs +14 -1
  73. package/recipes/input-tag-recipe.d.ts +27 -0
  74. package/recipes/input-tag-recipe.mjs +38 -0
  75. package/recipes/input-tag-slot-recipe.d.ts +27 -0
  76. package/recipes/input-tag-slot-recipe.mjs +70 -0
  77. package/recipes/modal-slot-recipe.d.ts +27 -0
  78. package/recipes/modal-slot-recipe.mjs +75 -0
  79. package/recipes/tag-slot-recipe.mjs +9 -1
  80. package/recipes/upload-list-slot-recipe.d.ts +27 -0
  81. package/recipes/upload-list-slot-recipe.mjs +38 -0
  82. package/recipes/upload-slot-recipe.d.ts +27 -0
  83. package/recipes/upload-slot-recipe.mjs +34 -0
  84. package/tokens/index.css +17 -0
  85. package/tokens/index.mjs +112 -8
  86. package/tokens/tokens.d.ts +4 -4
  87. package/types/conditions.d.ts +1 -1
  88. package/types/csstype.d.ts +1270 -721
  89. package/types/jsx.d.ts +9 -9
  90. package/types/prop-type.d.ts +16 -6
  91. package/types/recipe.d.ts +9 -0
  92. package/types/static-css.d.ts +45 -0
package/types/jsx.d.ts CHANGED
@@ -14,7 +14,7 @@ export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
14
14
  ? Props
15
15
  : never
16
16
 
17
- export interface StyledComponent<T extends ElementType, P extends Dict = {}> extends FunctionalComponent<
17
+ export interface PixelComponent<T extends ElementType, P extends Dict = {}> extends FunctionalComponent<
18
18
  JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
19
19
  > {}
20
20
 
@@ -30,12 +30,12 @@ export interface JsxFactoryOptions<TProps extends Dict> {
30
30
 
31
31
  export type JsxRecipeProps<T extends ElementType, P extends RecipeFn> = JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P['__type']>>;
32
32
 
33
- export type JsxElement<T extends ElementType, P> = T extends StyledComponent<infer A, infer B>
34
- ? StyledComponent<A, Pretty<DistributiveUnion<P, B>>>
35
- : StyledComponent<T, P>
33
+ export type JsxElement<T extends ElementType, P> = T extends PixelComponent<infer A, infer B>
34
+ ? PixelComponent<A, Pretty<DistributiveUnion<P, B>>>
35
+ : PixelComponent<T, P>
36
36
 
37
37
  export interface JsxFactory {
38
- <T extends ElementType>(component: T): StyledComponent<T, {}>
38
+ <T extends ElementType>(component: T): PixelComponent<T, {}>
39
39
  <T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): JsxElement<
40
40
  T,
41
41
  RecipeSelection<P>
@@ -44,11 +44,11 @@ export interface JsxFactory {
44
44
  }
45
45
 
46
46
  export type JsxElements = {
47
- [K in IntrinsicElement]: StyledComponent<K, {}>
47
+ [K in IntrinsicElement]: PixelComponent<K, {}>
48
48
  }
49
49
 
50
- export type Styled = JsxFactory & JsxElements
50
+ export type Pixel = JsxFactory & JsxElements
51
51
 
52
- export type HTMLStyledProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
52
+ export type HTMLPixelProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
53
53
 
54
- export type StyledVariantProps<T extends StyledComponent<any, any>> = T extends StyledComponent<any, infer Props> ? Props : never
54
+ export type PixelVariantProps<T extends PixelComponent<any, any>> = T extends PixelComponent<any, infer Props> ? Props : never
@@ -209,7 +209,7 @@ interface PropertyValueTypes {
209
209
  strokeWidth: Tokens["borderWidths"];
210
210
  srOnly: boolean;
211
211
  debug: boolean;
212
- colorPalette: "currentcolor" | "dark" | "white" | "background" | "overlay" | "brand" | "gray" | "blue" | "red" | "green" | "orange" | "sky" | "teal" | "violet" | "amber" | "rose" | "stone" | "lime" | "pink" | "apricot" | "aqua" | "leaf" | "fuchsia" | "ice" | "ash";
212
+ colorPalette: "currentcolor" | "dark" | "white" | "background" | "overlay" | "brand" | "whiteAlpha" | "blackAplpha" | "gray" | "blue" | "red" | "green" | "orange" | "sky" | "teal" | "violet" | "amber" | "rose" | "stone" | "lime" | "pink" | "apricot" | "aqua" | "leaf" | "fuchsia" | "ice" | "ash";
213
213
  textStyle: "overline" | "body.sm" | "body.md" | "label.sm" | "label.md" | "h3" | "h2" | "h1";
214
214
  }
215
215
 
@@ -310,8 +310,18 @@ interface PropertyValueTypes {
310
310
  }
311
311
 
312
312
 
313
- export type PropertyValue<T extends string> = T extends keyof PropertyTypes
314
- ? ConditionalValue<PropertyTypes[T] | CssValue<T> | (string & {})>
315
- : T extends keyof CssProperties
316
- ? ConditionalValue<CssProperties[T] | (string & {})>
317
- : ConditionalValue<string | number>
313
+
314
+ type PropertyTypeValue<T extends string> = T extends keyof PropertyTypes
315
+ ? ConditionalValue<PropertyTypes[T] | CssValue<T> | (string & {})>
316
+ : never;
317
+
318
+ type CssPropertyValue<T extends string> = T extends keyof CssProperties
319
+ ? ConditionalValue<CssProperties[T] | (string & {})>
320
+ : never;
321
+
322
+ export type PropertyValue<T extends string> = T extends keyof PropertyTypes
323
+ ? PropertyTypeValue<T>
324
+ : T extends keyof CssProperties
325
+ ? CssPropertyValue<T>
326
+ : ConditionalValue<string | number>
327
+
package/types/recipe.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable */
2
+ import type { RecipeRule } from './static-css';
2
3
  import type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types';
3
4
 
4
5
  type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
@@ -63,6 +64,10 @@ export interface RecipeDefinition<T extends RecipeVariantRecord> {
63
64
  * The styles to apply when a combination of variants is selected.
64
65
  */
65
66
  compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]
67
+ /**
68
+ * Variants to pre-generate, will be include in the final `config.staticCss`
69
+ */
70
+ staticCss?: RecipeRule[]
66
71
  }
67
72
 
68
73
  export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
@@ -134,6 +139,10 @@ export interface SlotRecipeDefinition<S extends string, T extends SlotRecipeVari
134
139
  * The styles to apply when a combination of variants is selected.
135
140
  */
136
141
  compoundVariants?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]
142
+ /**
143
+ * Variants to pre-generate, will be include in the final `config.staticCss`
144
+ */
145
+ staticCss?: RecipeRule[]
137
146
  }
138
147
 
139
148
  export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(
@@ -0,0 +1,45 @@
1
+ /* eslint-disable */
2
+ interface WithConditions {
3
+ /**
4
+ * The css conditions to generate for the rule.
5
+ * @example ['hover', 'focus']
6
+ */
7
+ conditions?: string[]
8
+ responsive?: boolean
9
+ }
10
+
11
+ export interface CssRule extends WithConditions {
12
+ /**
13
+ * The css properties to generate utilities for.
14
+ * @example ['margin', 'padding']
15
+ */
16
+ properties: {
17
+ [property: string]: Array<string | number>
18
+ }
19
+ }
20
+
21
+ interface RecipeRuleVariants {
22
+ [variant: string]: boolean | string[]
23
+ }
24
+
25
+ export type RecipeRule = '*' | (RecipeRuleVariants & WithConditions)
26
+ export type PatternRule = '*' | CssRule
27
+
28
+ export interface StaticCssOptions {
29
+ /**
30
+ * The css utility classes to generate.
31
+ */
32
+ css?: CssRule[]
33
+ /**
34
+ * The css recipes to generate.
35
+ */
36
+ recipes?: {
37
+ [recipe: string]: RecipeRule[]
38
+ }
39
+ /**
40
+ * The css patterns to generate.
41
+ */
42
+ patterns?: {
43
+ [pattern: string]: PatternRule[]
44
+ }
45
+ }