@likec4/styles 1.27.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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/build.config.ts +27 -0
  4. package/dev.ts +36 -0
  5. package/dist/css/conditions.mjs +36 -0
  6. package/dist/css/css.d.ts +22 -0
  7. package/dist/css/css.mjs +45 -0
  8. package/dist/css/cva.d.ts +6 -0
  9. package/dist/css/cva.mjs +87 -0
  10. package/dist/css/cx.d.ts +5 -0
  11. package/dist/css/cx.mjs +15 -0
  12. package/dist/css/index.d.ts +5 -0
  13. package/dist/css/index.mjs +4 -0
  14. package/dist/css/sva.d.ts +4 -0
  15. package/dist/css/sva.mjs +41 -0
  16. package/dist/helpers.mjs +336 -0
  17. package/dist/jsx/aspect-ratio.d.ts +10 -0
  18. package/dist/jsx/aspect-ratio.mjs +14 -0
  19. package/dist/jsx/bleed.d.ts +10 -0
  20. package/dist/jsx/bleed.mjs +14 -0
  21. package/dist/jsx/box.d.ts +10 -0
  22. package/dist/jsx/box.mjs +14 -0
  23. package/dist/jsx/center.d.ts +10 -0
  24. package/dist/jsx/center.mjs +14 -0
  25. package/dist/jsx/circle.d.ts +10 -0
  26. package/dist/jsx/circle.mjs +14 -0
  27. package/dist/jsx/container.d.ts +10 -0
  28. package/dist/jsx/container.mjs +14 -0
  29. package/dist/jsx/cq.d.ts +10 -0
  30. package/dist/jsx/cq.mjs +14 -0
  31. package/dist/jsx/divider.d.ts +10 -0
  32. package/dist/jsx/divider.mjs +14 -0
  33. package/dist/jsx/factory-helper.mjs +22 -0
  34. package/dist/jsx/factory.d.ts +3 -0
  35. package/dist/jsx/factory.mjs +80 -0
  36. package/dist/jsx/flex.d.ts +10 -0
  37. package/dist/jsx/flex.mjs +14 -0
  38. package/dist/jsx/float.d.ts +10 -0
  39. package/dist/jsx/float.mjs +14 -0
  40. package/dist/jsx/grid-item.d.ts +10 -0
  41. package/dist/jsx/grid-item.mjs +14 -0
  42. package/dist/jsx/grid.d.ts +10 -0
  43. package/dist/jsx/grid.mjs +14 -0
  44. package/dist/jsx/hstack.d.ts +10 -0
  45. package/dist/jsx/hstack.mjs +14 -0
  46. package/dist/jsx/index.d.ts +24 -0
  47. package/dist/jsx/index.mjs +22 -0
  48. package/dist/jsx/is-valid-prop.d.ts +11 -0
  49. package/dist/jsx/is-valid-prop.mjs +17 -0
  50. package/dist/jsx/link-overlay.d.ts +10 -0
  51. package/dist/jsx/link-overlay.mjs +14 -0
  52. package/dist/jsx/spacer.d.ts +10 -0
  53. package/dist/jsx/spacer.mjs +14 -0
  54. package/dist/jsx/square.d.ts +10 -0
  55. package/dist/jsx/square.mjs +14 -0
  56. package/dist/jsx/stack.d.ts +10 -0
  57. package/dist/jsx/stack.mjs +14 -0
  58. package/dist/jsx/visually-hidden.d.ts +10 -0
  59. package/dist/jsx/visually-hidden.mjs +14 -0
  60. package/dist/jsx/vstack.d.ts +10 -0
  61. package/dist/jsx/vstack.mjs +14 -0
  62. package/dist/jsx/wrap.d.ts +10 -0
  63. package/dist/jsx/wrap.mjs +14 -0
  64. package/dist/patterns/aspect-ratio.d.ts +21 -0
  65. package/dist/patterns/aspect-ratio.mjs +38 -0
  66. package/dist/patterns/bleed.d.ts +22 -0
  67. package/dist/patterns/bleed.mjs +24 -0
  68. package/dist/patterns/box.d.ts +21 -0
  69. package/dist/patterns/box.mjs +15 -0
  70. package/dist/patterns/center.d.ts +21 -0
  71. package/dist/patterns/center.mjs +21 -0
  72. package/dist/patterns/circle.d.ts +21 -0
  73. package/dist/patterns/circle.mjs +25 -0
  74. package/dist/patterns/container.d.ts +21 -0
  75. package/dist/patterns/container.mjs +21 -0
  76. package/dist/patterns/cq.d.ts +22 -0
  77. package/dist/patterns/cq.mjs +21 -0
  78. package/dist/patterns/divider.d.ts +23 -0
  79. package/dist/patterns/divider.mjs +25 -0
  80. package/dist/patterns/flex.d.ts +27 -0
  81. package/dist/patterns/flex.mjs +26 -0
  82. package/dist/patterns/float.d.ts +24 -0
  83. package/dist/patterns/float.mjs +52 -0
  84. package/dist/patterns/grid-item.d.ts +26 -0
  85. package/dist/patterns/grid-item.mjs +25 -0
  86. package/dist/patterns/grid.d.ts +25 -0
  87. package/dist/patterns/grid.mjs +27 -0
  88. package/dist/patterns/hstack.d.ts +22 -0
  89. package/dist/patterns/hstack.mjs +24 -0
  90. package/dist/patterns/index.d.ts +21 -0
  91. package/dist/patterns/index.mjs +20 -0
  92. package/dist/patterns/link-overlay.d.ts +21 -0
  93. package/dist/patterns/link-overlay.mjs +24 -0
  94. package/dist/patterns/spacer.d.ts +21 -0
  95. package/dist/patterns/spacer.mjs +21 -0
  96. package/dist/patterns/square.d.ts +21 -0
  97. package/dist/patterns/square.mjs +24 -0
  98. package/dist/patterns/stack.d.ts +24 -0
  99. package/dist/patterns/stack.mjs +24 -0
  100. package/dist/patterns/visually-hidden.d.ts +21 -0
  101. package/dist/patterns/visually-hidden.mjs +18 -0
  102. package/dist/patterns/vstack.d.ts +22 -0
  103. package/dist/patterns/vstack.mjs +24 -0
  104. package/dist/patterns/wrap.d.ts +25 -0
  105. package/dist/patterns/wrap.mjs +25 -0
  106. package/dist/recipes/action-btn.d.ts +43 -0
  107. package/dist/recipes/action-btn.mjs +41 -0
  108. package/dist/recipes/create-recipe.mjs +82 -0
  109. package/dist/recipes/index.d.ts +2 -0
  110. package/dist/recipes/index.mjs +1 -0
  111. package/dist/styles.css +1601 -0
  112. package/dist/tokens/index.d.ts +9 -0
  113. package/dist/tokens/index.mjs +5044 -0
  114. package/dist/tokens/tokens.d.ts +45 -0
  115. package/dist/types/composition.d.ts +164 -0
  116. package/dist/types/conditions.d.ts +328 -0
  117. package/dist/types/csstype.d.ts +21298 -0
  118. package/dist/types/global.d.ts +20 -0
  119. package/dist/types/index.d.ts +8 -0
  120. package/dist/types/jsx.d.ts +52 -0
  121. package/dist/types/parts.d.ts +8 -0
  122. package/dist/types/pattern.d.ts +78 -0
  123. package/dist/types/prop-type.d.ts +232 -0
  124. package/dist/types/recipe.d.ts +181 -0
  125. package/dist/types/selectors.d.ts +59 -0
  126. package/dist/types/static-css.d.ts +56 -0
  127. package/dist/types/style-props.d.ts +7499 -0
  128. package/dist/types/system-types.d.ts +193 -0
  129. package/package.json +85 -0
  130. package/panda.config.ts +6 -0
  131. package/postcss.d.mts +6 -0
  132. package/postcss.mjs +2 -0
  133. package/preset.d.mts +2746 -0
  134. package/preset.mjs +2746 -0
  135. package/preset.ts +3 -0
  136. package/vite.d.mts +5 -0
  137. package/vite.mjs +5 -0
@@ -0,0 +1,24 @@
1
+ import { getPatternStyles, patternFns } from '../helpers.mjs';
2
+ import { css } from '../css/index.mjs';
3
+
4
+ const stackConfig = {
5
+ transform(props) {
6
+ const { align, justify, direction, gap, ...rest } = props;
7
+ return {
8
+ display: "flex",
9
+ flexDirection: direction,
10
+ alignItems: align,
11
+ justifyContent: justify,
12
+ gap,
13
+ ...rest
14
+ };
15
+ },
16
+ defaultValues:{direction:'column',gap:'10px'}}
17
+
18
+ export const getStackStyle = (styles = {}) => {
19
+ const _styles = getPatternStyles(stackConfig, styles)
20
+ return stackConfig.transform(_styles, patternFns)
21
+ }
22
+
23
+ export const stack = (styles) => css(getStackStyle(styles))
24
+ stack.raw = getStackStyle
@@ -0,0 +1,21 @@
1
+ /* eslint-disable */
2
+ import type { SystemStyleObject, ConditionalValue } from '../types/index';
3
+ import type { Properties } from '../types/csstype';
4
+ import type { SystemProperties } from '../types/style-props';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+ import type { Tokens } from '../tokens/index';
7
+
8
+ export interface VisuallyHiddenProperties {
9
+
10
+ }
11
+
12
+
13
+ interface VisuallyHiddenStyles extends VisuallyHiddenProperties, DistributiveOmit<SystemStyleObject, keyof VisuallyHiddenProperties > {}
14
+
15
+ interface VisuallyHiddenPatternFn {
16
+ (styles?: VisuallyHiddenStyles): string
17
+ raw: (styles?: VisuallyHiddenStyles) => SystemStyleObject
18
+ }
19
+
20
+
21
+ export declare const visuallyHidden: VisuallyHiddenPatternFn;
@@ -0,0 +1,18 @@
1
+ import { getPatternStyles, patternFns } from '../helpers.mjs';
2
+ import { css } from '../css/index.mjs';
3
+
4
+ const visuallyHiddenConfig = {
5
+ transform(props) {
6
+ return {
7
+ srOnly: true,
8
+ ...props
9
+ };
10
+ }}
11
+
12
+ export const getVisuallyHiddenStyle = (styles = {}) => {
13
+ const _styles = getPatternStyles(visuallyHiddenConfig, styles)
14
+ return visuallyHiddenConfig.transform(_styles, patternFns)
15
+ }
16
+
17
+ export const visuallyHidden = (styles) => css(getVisuallyHiddenStyle(styles))
18
+ visuallyHidden.raw = getVisuallyHiddenStyle
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+ import type { SystemStyleObject, ConditionalValue } from '../types/index';
3
+ import type { Properties } from '../types/csstype';
4
+ import type { SystemProperties } from '../types/style-props';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+ import type { Tokens } from '../tokens/index';
7
+
8
+ export interface VstackProperties {
9
+ justify?: SystemProperties["justifyContent"]
10
+ gap?: SystemProperties["gap"]
11
+ }
12
+
13
+
14
+ interface VstackStyles extends VstackProperties, DistributiveOmit<SystemStyleObject, keyof VstackProperties > {}
15
+
16
+ interface VstackPatternFn {
17
+ (styles?: VstackStyles): string
18
+ raw: (styles?: VstackStyles) => SystemStyleObject
19
+ }
20
+
21
+
22
+ export declare const vstack: VstackPatternFn;
@@ -0,0 +1,24 @@
1
+ import { getPatternStyles, patternFns } from '../helpers.mjs';
2
+ import { css } from '../css/index.mjs';
3
+
4
+ const vstackConfig = {
5
+ transform(props) {
6
+ const { justify, gap, ...rest } = props;
7
+ return {
8
+ display: "flex",
9
+ alignItems: "center",
10
+ justifyContent: justify,
11
+ gap,
12
+ flexDirection: "column",
13
+ ...rest
14
+ };
15
+ },
16
+ defaultValues:{gap:'10px'}}
17
+
18
+ export const getVstackStyle = (styles = {}) => {
19
+ const _styles = getPatternStyles(vstackConfig, styles)
20
+ return vstackConfig.transform(_styles, patternFns)
21
+ }
22
+
23
+ export const vstack = (styles) => css(getVstackStyle(styles))
24
+ vstack.raw = getVstackStyle
@@ -0,0 +1,25 @@
1
+ /* eslint-disable */
2
+ import type { SystemStyleObject, ConditionalValue } from '../types/index';
3
+ import type { Properties } from '../types/csstype';
4
+ import type { SystemProperties } from '../types/style-props';
5
+ import type { DistributiveOmit } from '../types/system-types';
6
+ import type { Tokens } from '../tokens/index';
7
+
8
+ export interface WrapProperties {
9
+ gap?: SystemProperties["gap"]
10
+ rowGap?: SystemProperties["gap"]
11
+ columnGap?: SystemProperties["gap"]
12
+ align?: SystemProperties["alignItems"]
13
+ justify?: SystemProperties["justifyContent"]
14
+ }
15
+
16
+
17
+ interface WrapStyles extends WrapProperties, DistributiveOmit<SystemStyleObject, keyof WrapProperties > {}
18
+
19
+ interface WrapPatternFn {
20
+ (styles?: WrapStyles): string
21
+ raw: (styles?: WrapStyles) => SystemStyleObject
22
+ }
23
+
24
+
25
+ export declare const wrap: WrapPatternFn;
@@ -0,0 +1,25 @@
1
+ import { getPatternStyles, patternFns } from '../helpers.mjs';
2
+ import { css } from '../css/index.mjs';
3
+
4
+ const wrapConfig = {
5
+ transform(props) {
6
+ const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "10px", align, justify, ...rest } = props;
7
+ return {
8
+ display: "flex",
9
+ flexWrap: "wrap",
10
+ alignItems: align,
11
+ justifyContent: justify,
12
+ gap,
13
+ columnGap,
14
+ rowGap,
15
+ ...rest
16
+ };
17
+ }}
18
+
19
+ export const getWrapStyle = (styles = {}) => {
20
+ const _styles = getPatternStyles(wrapConfig, styles)
21
+ return wrapConfig.transform(_styles, patternFns)
22
+ }
23
+
24
+ export const wrap = (styles) => css(getWrapStyle(styles))
25
+ wrap.raw = getWrapStyle
@@ -0,0 +1,43 @@
1
+ /* eslint-disable */
2
+ import type { ConditionalValue } from '../types/index';
3
+ import type { DistributiveOmit, Pretty } from '../types/system-types';
4
+
5
+ interface ActionBtnVariant {
6
+ /**
7
+ * @default "filled"
8
+ */
9
+ variant: "transparent" | "filled"
10
+ /**
11
+ * @default "md"
12
+ */
13
+ size: "sm" | "md"
14
+ /**
15
+ * @default "md"
16
+ */
17
+ radius: "sm" | "md"
18
+ }
19
+
20
+ type ActionBtnVariantMap = {
21
+ [key in keyof ActionBtnVariant]: Array<ActionBtnVariant[key]>
22
+ }
23
+
24
+ export type ActionBtnVariantProps = {
25
+ [key in keyof ActionBtnVariant]?: ConditionalValue<ActionBtnVariant[key]> | undefined
26
+ }
27
+
28
+ export interface ActionBtnRecipe {
29
+ __type: ActionBtnVariantProps
30
+ (props?: ActionBtnVariantProps): string
31
+ raw: (props?: ActionBtnVariantProps) => ActionBtnVariantProps
32
+ variantMap: ActionBtnVariantMap
33
+ variantKeys: Array<keyof ActionBtnVariant>
34
+ splitVariantProps<Props extends ActionBtnVariantProps>(props: Props): [ActionBtnVariantProps, Pretty<DistributiveOmit<Props, keyof ActionBtnVariantProps>>]
35
+ getVariantProps: (props?: ActionBtnVariantProps) => ActionBtnVariantProps
36
+ }
37
+
38
+ /**
39
+ * The styles for the Action Buttons
40
+
41
+
42
+ */
43
+ export declare const actionBtn: ActionBtnRecipe
@@ -0,0 +1,41 @@
1
+ import { memo, splitProps } from '../helpers.mjs';
2
+ import { createRecipe, mergeRecipes } from './create-recipe.mjs';
3
+
4
+ const actionBtnFn = /* @__PURE__ */ createRecipe('action-btn', {
5
+ "size": "md",
6
+ "radius": "md",
7
+ "variant": "filled"
8
+ }, [])
9
+
10
+ const actionBtnVariantMap = {
11
+ "variant": [
12
+ "transparent",
13
+ "filled"
14
+ ],
15
+ "size": [
16
+ "sm",
17
+ "md"
18
+ ],
19
+ "radius": [
20
+ "sm",
21
+ "md"
22
+ ]
23
+ }
24
+
25
+ const actionBtnVariantKeys = Object.keys(actionBtnVariantMap)
26
+
27
+ export const actionBtn = /* @__PURE__ */ Object.assign(memo(actionBtnFn.recipeFn), {
28
+ __recipe__: true,
29
+ __name__: 'actionBtn',
30
+ __getCompoundVariantCss__: actionBtnFn.__getCompoundVariantCss__,
31
+ raw: (props) => props,
32
+ variantKeys: actionBtnVariantKeys,
33
+ variantMap: actionBtnVariantMap,
34
+ merge(recipe) {
35
+ return mergeRecipes(this, recipe)
36
+ },
37
+ splitVariantProps(props) {
38
+ return splitProps(props, actionBtnVariantKeys)
39
+ },
40
+ getVariantProps: actionBtnFn.getVariantProps,
41
+ })
@@ -0,0 +1,82 @@
1
+ import { finalizeConditions, sortConditions } from '../css/conditions.mjs';
2
+ import { css } from '../css/css.mjs';
3
+ import { assertCompoundVariant, getCompoundVariantCss } from '../css/cva.mjs';
4
+ import { cx } from '../css/cx.mjs';
5
+ import { compact, createCss, splitProps, uniq, withoutSpace } from '../helpers.mjs';
6
+
7
+ export const createRecipe = (name, defaultVariants, compoundVariants) => {
8
+ const getVariantProps = (variants) => {
9
+ return {
10
+ [name]: '__ignore__',
11
+ ...defaultVariants,
12
+ ...compact(variants),
13
+ };
14
+ };
15
+
16
+ const recipeFn = (variants, withCompoundVariants = true) => {
17
+ const transform = (prop, value) => {
18
+ assertCompoundVariant(name, compoundVariants, variants, prop)
19
+
20
+ if (value === '__ignore__') {
21
+ return { className: name }
22
+ }
23
+
24
+ value = withoutSpace(value)
25
+ return { className: `${name}--${prop}_${value}` }
26
+ }
27
+
28
+ const recipeCss = createCss({
29
+
30
+ conditions: {
31
+ shift: sortConditions,
32
+ finalize: finalizeConditions,
33
+ breakpoints: { keys: ["base","xs","sm","md","lg","xl"] }
34
+ },
35
+ utility: {
36
+
37
+ toHash: (path, hashFn) => hashFn(path.join(":")),
38
+ transform,
39
+ }
40
+ })
41
+
42
+ const recipeStyles = getVariantProps(variants)
43
+
44
+ if (withCompoundVariants) {
45
+ const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
46
+ return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
47
+ }
48
+
49
+ return recipeCss(recipeStyles)
50
+ }
51
+
52
+ return {
53
+ recipeFn,
54
+ getVariantProps,
55
+ __getCompoundVariantCss__: (variants) => {
56
+ return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
57
+ },
58
+ }
59
+ }
60
+
61
+ export const mergeRecipes = (recipeA, recipeB) => {
62
+ if (recipeA && !recipeB) return recipeA
63
+ if (!recipeA && recipeB) return recipeB
64
+
65
+ const recipeFn = (...args) => cx(recipeA(...args), recipeB(...args))
66
+ const variantKeys = uniq(recipeA.variantKeys, recipeB.variantKeys)
67
+ const variantMap = variantKeys.reduce((acc, key) => {
68
+ acc[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key])
69
+ return acc
70
+ }, {})
71
+
72
+ return Object.assign(recipeFn, {
73
+ __recipe__: true,
74
+ __name__: `${recipeA.__name__} ${recipeB.__name__}`,
75
+ raw: (props) => props,
76
+ variantKeys,
77
+ variantMap,
78
+ splitVariantProps(props) {
79
+ return splitProps(props, variantKeys)
80
+ },
81
+ })
82
+ }
@@ -0,0 +1,2 @@
1
+ /* eslint-disable */
2
+ export * from './action-btn';
@@ -0,0 +1 @@
1
+ export * from './action-btn.mjs';