@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.
- package/CHANGELOG.md +14 -0
- package/helpers.mjs +5 -5
- package/jsx/aspect-ratio.d.ts +2 -2
- package/jsx/aspect-ratio.mjs +9 -7
- package/jsx/bleed.d.ts +2 -2
- package/jsx/bleed.mjs +10 -8
- package/jsx/box.d.ts +2 -2
- package/jsx/box.mjs +9 -7
- package/jsx/center.d.ts +2 -2
- package/jsx/center.mjs +9 -7
- package/jsx/circle.d.ts +2 -2
- package/jsx/circle.mjs +9 -7
- package/jsx/container.d.ts +2 -2
- package/jsx/container.mjs +9 -7
- package/jsx/divider.d.ts +2 -2
- package/jsx/divider.mjs +10 -8
- package/jsx/factory.d.ts +2 -2
- package/jsx/factory.mjs +11 -11
- package/jsx/flex.d.ts +2 -2
- package/jsx/flex.mjs +10 -8
- package/jsx/float.d.ts +2 -2
- package/jsx/float.mjs +10 -8
- package/jsx/grid-item.d.ts +2 -2
- package/jsx/grid-item.mjs +10 -8
- package/jsx/grid.d.ts +2 -2
- package/jsx/grid.mjs +10 -8
- package/jsx/hstack.d.ts +2 -2
- package/jsx/hstack.mjs +10 -8
- package/jsx/index.d.ts +1 -4
- package/jsx/link-box.d.ts +2 -2
- package/jsx/link-box.mjs +9 -7
- package/jsx/link-overlay.d.ts +2 -2
- package/jsx/link-overlay.mjs +9 -7
- package/jsx/spacer.d.ts +2 -2
- package/jsx/spacer.mjs +9 -7
- package/jsx/square.d.ts +2 -2
- package/jsx/square.mjs +9 -7
- package/jsx/stack.d.ts +2 -2
- package/jsx/stack.mjs +10 -8
- package/jsx/visually-hidden.d.ts +2 -2
- package/jsx/visually-hidden.mjs +9 -7
- package/jsx/vstack.d.ts +2 -2
- package/jsx/vstack.mjs +10 -8
- package/jsx/wrap.d.ts +2 -2
- package/jsx/wrap.mjs +10 -8
- package/package.json +1 -1
- package/recipes/banner-close-button-recipe.d.ts +27 -0
- package/recipes/banner-close-button-recipe.mjs +22 -0
- package/recipes/banner-description-recipe.d.ts +27 -0
- package/recipes/banner-description-recipe.mjs +22 -0
- package/recipes/banner-icon-recipe.d.ts +27 -0
- package/recipes/banner-icon-recipe.mjs +34 -0
- package/recipes/banner-icon-slot-recipe.d.ts +27 -0
- package/recipes/banner-icon-slot-recipe.mjs +34 -0
- package/recipes/banner-link-recipe.d.ts +27 -0
- package/recipes/banner-link-recipe.mjs +22 -0
- package/recipes/banner-recipe.d.ts +27 -0
- package/recipes/banner-recipe.mjs +31 -0
- package/recipes/banner-slot-recipe.d.ts +27 -0
- package/recipes/banner-slot-recipe.mjs +45 -0
- package/recipes/banner-title-recipe.d.ts +27 -0
- package/recipes/banner-title-recipe.mjs +22 -0
- package/recipes/divider-recipe.d.ts +27 -0
- package/recipes/divider-recipe.mjs +29 -0
- package/recipes/dropzone-recipe.d.ts +27 -0
- package/recipes/dropzone-recipe.mjs +34 -0
- package/recipes/dropzone-slot-recipe.d.ts +27 -0
- package/recipes/dropzone-slot-recipe.mjs +70 -0
- package/recipes/form-control-slot-recipe.d.ts +27 -0
- package/recipes/form-control-slot-recipe.mjs +46 -0
- package/recipes/index.d.ts +14 -1
- package/recipes/index.mjs +14 -1
- package/recipes/input-tag-recipe.d.ts +27 -0
- package/recipes/input-tag-recipe.mjs +38 -0
- package/recipes/input-tag-slot-recipe.d.ts +27 -0
- package/recipes/input-tag-slot-recipe.mjs +70 -0
- package/recipes/modal-slot-recipe.d.ts +27 -0
- package/recipes/modal-slot-recipe.mjs +75 -0
- package/recipes/tag-slot-recipe.mjs +9 -1
- package/recipes/upload-list-slot-recipe.d.ts +27 -0
- package/recipes/upload-list-slot-recipe.mjs +38 -0
- package/recipes/upload-slot-recipe.d.ts +27 -0
- package/recipes/upload-slot-recipe.mjs +34 -0
- package/tokens/index.css +17 -0
- package/tokens/index.mjs +112 -8
- package/tokens/tokens.d.ts +4 -4
- package/types/conditions.d.ts +1 -1
- package/types/csstype.d.ts +1270 -721
- package/types/jsx.d.ts +9 -9
- package/types/prop-type.d.ts +16 -6
- package/types/recipe.d.ts +9 -0
- 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
|
|
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
|
|
34
|
-
?
|
|
35
|
-
:
|
|
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):
|
|
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]:
|
|
47
|
+
[K in IntrinsicElement]: PixelComponent<K, {}>
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export type
|
|
50
|
+
export type Pixel = JsxFactory & JsxElements
|
|
51
51
|
|
|
52
|
-
export type
|
|
52
|
+
export type HTMLPixelProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
53
53
|
|
|
54
|
-
export type
|
|
54
|
+
export type PixelVariantProps<T extends PixelComponent<any, any>> = T extends PixelComponent<any, infer Props> ? Props : never
|
package/types/prop-type.d.ts
CHANGED
|
@@ -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
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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
|
+
}
|