@bamboocss/types 1.11.1 → 1.11.3

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.
@@ -0,0 +1,150 @@
1
+ import type { ConditionalValue, Nested } from './conditions'
2
+ import type { AtRule, Globals, PropertiesFallback } from './csstype'
3
+ import type { SystemProperties, CssVarProperties } from './style-props'
4
+
5
+ type String = string & {}
6
+ type Number = number & {}
7
+
8
+ export type Pretty<T> = { [K in keyof T]: T[K] } & {}
9
+
10
+ export type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never
11
+
12
+ export type DistributiveUnion<T, U> = {
13
+ [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]
14
+ } & DistributiveOmit<U, keyof T>
15
+
16
+ export type Assign<T, U> = {
17
+ [K in keyof T]: K extends keyof U ? U[K] : T[K]
18
+ } & U
19
+
20
+ /* -----------------------------------------------------------------------------
21
+ * Native css properties
22
+ * -----------------------------------------------------------------------------*/
23
+
24
+ type CornerShapeValue = 'round' | 'square' | 'bevel' | 'scoop' | 'notch' | 'squircle' | `superellipse(${number})`
25
+
26
+ export interface ModernCssProperties {
27
+ /**
28
+ * Controls whether the entire element should be draggable instead of its contents.
29
+ */
30
+ WebkitUserDrag?: Globals | 'auto' | 'element' | 'none'
31
+
32
+ /**
33
+ * Specifies whether an element can be used to drag the entire app window (Electron).
34
+ */
35
+ WebkitAppRegion?: Globals | 'drag' | 'no-drag'
36
+
37
+ /**
38
+ * Sets the horizontal spacing between table borders.
39
+ */
40
+ WebkitBorderHorizontalSpacing?: Globals | String | Number
41
+
42
+ /**
43
+ * Sets the vertical spacing between table borders.
44
+ */
45
+ WebkitBorderVerticalSpacing?: Globals | String | Number
46
+
47
+ /**
48
+ * Controls the display of text content for security purposes (e.g., password fields).
49
+ */
50
+ WebkitTextSecurity?: Globals | 'none' | 'circle' | 'disc' | 'square'
51
+
52
+ /**
53
+ * Specifies the shape of a box's corners within the area defined by the border-radius property.
54
+ * @experimental
55
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/corner-shape
56
+ */
57
+ cornerShape?:
58
+ | Globals
59
+ | CornerShapeValue
60
+ | `${CornerShapeValue} ${CornerShapeValue}`
61
+ | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`
62
+ | `${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue} ${CornerShapeValue}`
63
+ | String
64
+ }
65
+
66
+ export type CssProperty = keyof PropertiesFallback
67
+
68
+ export interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties, ModernCssProperties {}
69
+
70
+ export interface CssKeyframes {
71
+ [name: string]: {
72
+ [time: string]: CssProperties
73
+ }
74
+ }
75
+
76
+ /* -----------------------------------------------------------------------------
77
+ * Conditional css properties
78
+ * -----------------------------------------------------------------------------*/
79
+
80
+ interface GenericProperties {
81
+ [key: string]: ConditionalValue<String | Number | boolean>
82
+ }
83
+
84
+ /* -----------------------------------------------------------------------------
85
+ * Native css props
86
+ * -----------------------------------------------------------------------------*/
87
+
88
+ export type NestedCssProperties = Nested<CssProperties>
89
+
90
+ export type SystemStyleObject = Nested<(SystemProperties | GenericProperties) & CssVarProperties>
91
+
92
+ export interface GlobalStyleObject {
93
+ [selector: string]: SystemStyleObject
94
+ }
95
+ export interface ExtendableGlobalStyleObject {
96
+ [selector: string]: SystemStyleObject | undefined
97
+ extend?: GlobalStyleObject | undefined
98
+ }
99
+
100
+ /* -----------------------------------------------------------------------------
101
+ * Composition (text styles, layer styles)
102
+ * -----------------------------------------------------------------------------*/
103
+
104
+ type FilterStyleObject<P extends string> = {
105
+ [K in P]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown
106
+ }
107
+
108
+ export type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>
109
+
110
+ /* -----------------------------------------------------------------------------
111
+ * Font face
112
+ * -----------------------------------------------------------------------------*/
113
+
114
+ export type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>
115
+
116
+ export type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>
117
+
118
+ export interface GlobalFontface {
119
+ [name: string]: FontfaceRule | FontfaceRule[]
120
+ }
121
+
122
+ export interface ExtendableGlobalFontface {
123
+ [name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined
124
+ extend?: GlobalFontface | undefined
125
+ }
126
+
127
+ /* -----------------------------------------------------------------------------
128
+ * Jsx style props
129
+ * -----------------------------------------------------------------------------*/
130
+ interface WithCss {
131
+ css?: SystemStyleObject | SystemStyleObject[]
132
+ }
133
+
134
+ export type JsxStyleProps = SystemStyleObject & WithCss
135
+
136
+ export interface PatchedHTMLProps {
137
+ htmlWidth?: string | number
138
+ htmlHeight?: string | number
139
+ htmlTranslate?: 'yes' | 'no' | undefined
140
+ htmlContent?: string
141
+ }
142
+
143
+ export type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'
144
+
145
+ type WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps
146
+
147
+ export type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<
148
+ WithHTMLProps<T>,
149
+ P
150
+ >
@@ -0,0 +1,94 @@
1
+ import type { AnimationStyles, LayerStyles, TextStyles } from './composition'
2
+ import type { RecipeConfig, SlotRecipeConfig } from './recipe'
3
+ import type { CssKeyframes } from './system-types'
4
+ import type { SemanticTokens, Tokens } from './tokens'
5
+
6
+ export interface ColorPaletteOptions {
7
+ /**
8
+ * Whether to enable color palette generation.
9
+ * @default true
10
+ */
11
+ enabled?: boolean
12
+ /**
13
+ * List of color names to include in color palette generation.
14
+ * When specified, only these colors will be used for color palettes.
15
+ */
16
+ include?: string[]
17
+ /**
18
+ * List of color names to exclude from color palette generation.
19
+ * When specified, these colors will not be used for color palettes.
20
+ */
21
+ exclude?: string[]
22
+ }
23
+
24
+ export interface Theme {
25
+ /**
26
+ * The breakpoints for your project.
27
+ */
28
+ breakpoints?: Record<string, string>
29
+ /**
30
+ * The css animation keyframes definitions.
31
+ */
32
+ keyframes?: CssKeyframes
33
+ /**
34
+ * The design tokens for your project.
35
+ */
36
+ tokens?: Tokens
37
+ /**
38
+ * The semantic design tokens for your project.
39
+ */
40
+ semanticTokens?: SemanticTokens
41
+ /**
42
+ * The typography styles for your project.
43
+ */
44
+ textStyles?: TextStyles
45
+ /**
46
+ * The layer styles for your project.
47
+ */
48
+ layerStyles?: LayerStyles
49
+ /**
50
+ * The animation styles for your project.
51
+ */
52
+ animationStyles?: AnimationStyles
53
+ /**
54
+ * Multi-variant style definitions for your project.
55
+ * Useful for defining component styles.
56
+ */
57
+ recipes?: Record<string, RecipeConfig>
58
+ /**
59
+ * Multi-variant style definitions for component slots.
60
+ */
61
+ slotRecipes?: Record<string, SlotRecipeConfig>
62
+ /**
63
+ * The predefined container names for your project.
64
+ */
65
+ containerNames?: string[]
66
+ /**
67
+ * The predefined container sizes for your project.
68
+ */
69
+ containerSizes?: Record<string, string>
70
+ /**
71
+ * The color palette configuration for your project.
72
+ */
73
+ colorPalette?: ColorPaletteOptions
74
+ }
75
+
76
+ interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes'> {
77
+ /**
78
+ * Multi-variant style definitions for your project.
79
+ * Useful for defining component styles.
80
+ */
81
+ recipes?: Record<string, Partial<RecipeConfig>>
82
+ /**
83
+ * Multi-variant style definitions for component slots.
84
+ */
85
+ slotRecipes?: Record<string, Partial<SlotRecipeConfig>>
86
+ /**
87
+ * The color palette configuration for your project.
88
+ */
89
+ colorPalette?: Partial<ColorPaletteOptions>
90
+ }
91
+
92
+ export interface ExtendableTheme extends Theme {
93
+ extend?: PartialTheme | undefined
94
+ }
@@ -0,0 +1,104 @@
1
+ import type { Recursive } from './shared'
2
+
3
+ export interface Token<Value = any> {
4
+ value: Value
5
+ description?: string
6
+ type?: string
7
+ deprecated?: boolean | string
8
+ extensions?: {
9
+ [key: string]: any
10
+ }
11
+ }
12
+
13
+ type RecursiveToken<C extends string, V> =
14
+ | V
15
+ | {
16
+ [K in C]: RecursiveToken<C, V>
17
+ }
18
+
19
+ export interface SemanticToken<Value = string, Condition extends string = string> extends Token<
20
+ RecursiveToken<Condition, Value>
21
+ > {}
22
+
23
+ /* -----------------------------------------------------------------------------
24
+ * Token data types
25
+ * -----------------------------------------------------------------------------*/
26
+
27
+ type BorderStyle =
28
+ | 'dashed'
29
+ | 'dotted'
30
+ | 'double'
31
+ | 'groove'
32
+ | 'hidden'
33
+ | 'inset'
34
+ | 'none'
35
+ | 'outset'
36
+ | 'ridge'
37
+ | 'solid'
38
+
39
+ export interface Border {
40
+ color: string
41
+ width: string | number
42
+ style: BorderStyle
43
+ }
44
+
45
+ export interface Shadow {
46
+ offsetX: number | string
47
+ offsetY: number | string
48
+ blur: number | string
49
+ spread: number | string
50
+ color: string
51
+ inset?: boolean
52
+ }
53
+
54
+ export interface Gradient {
55
+ type: 'linear' | 'radial'
56
+ placement: string | number
57
+ stops:
58
+ | Array<{
59
+ color: string
60
+ position: number
61
+ }>
62
+ | Array<string>
63
+ }
64
+
65
+ export interface Asset {
66
+ type: 'url' | 'svg'
67
+ value: string
68
+ }
69
+
70
+ export interface TokenDataTypes {
71
+ cursor: string
72
+ zIndex: string | number
73
+ opacity: string | number
74
+ colors: string
75
+ fonts: string | string[]
76
+ fontSizes: string
77
+ fontWeights: string | number
78
+ lineHeights: string | number
79
+ letterSpacings: string
80
+ sizes: string
81
+ shadows: Shadow | Shadow[] | string | string[]
82
+ spacing: string | number
83
+ radii: string
84
+ borders: string | Border
85
+ durations: string
86
+ easings: string | number[]
87
+ animations: string
88
+ blurs: string
89
+ gradients: string | Gradient
90
+ assets: string | Asset
91
+ borderWidths: string
92
+ aspectRatios: string
93
+ containerNames: string
94
+ }
95
+
96
+ export type Tokens = {
97
+ [key in keyof TokenDataTypes]?: Recursive<Token<TokenDataTypes[key]>>
98
+ }
99
+
100
+ export type SemanticTokens<ConditionKey extends string = string> = {
101
+ [key in keyof TokenDataTypes]?: Recursive<SemanticToken<TokenDataTypes[key], ConditionKey>>
102
+ }
103
+
104
+ export type TokenCategory = keyof TokenDataTypes
@@ -0,0 +1,114 @@
1
+ import type { LiteralUnion } from './shared'
2
+ import type { CssProperty, NestedCssProperties } from './system-types'
3
+ import type { Token, TokenCategory } from './tokens'
4
+
5
+ interface TokenFn {
6
+ (path: string): string | undefined
7
+ raw: (path: string) => Token | undefined
8
+ }
9
+
10
+ type ThemeFn = (token: (path: string) => any) => Record<string, string>
11
+
12
+ export type PropertyValues =
13
+ | LiteralUnion<TokenCategory | 'keyframes'>
14
+ | string[]
15
+ | { type: string }
16
+ | Record<string, string>
17
+ | ThemeFn
18
+
19
+ export interface ColorMixResult {
20
+ invalid: boolean
21
+ value: string
22
+ color?: string
23
+ }
24
+
25
+ export interface TransformUtils {
26
+ colorMix(value: string): ColorMixResult
27
+ }
28
+
29
+ export interface TransformArgs<T = any> {
30
+ token: TokenFn
31
+ raw: T
32
+ utils: TransformUtils
33
+ }
34
+
35
+ export type PropertyTransform = (value: any, args: TransformArgs) => NestedCssProperties | undefined
36
+
37
+ export interface PropertyConfig {
38
+ /**
39
+ * @internal
40
+ * The cascade layer to which the property belongs
41
+ */
42
+ layer?: string
43
+ /**
44
+ * The classname this property will generate.
45
+ */
46
+ className?: string
47
+ /**
48
+ * The css style object this property will generate.
49
+ */
50
+ transform?: PropertyTransform
51
+ /**
52
+ * The possible values this property can have.
53
+ */
54
+ values?: PropertyValues
55
+ /**
56
+ * The css property this utility maps to.
57
+ */
58
+ property?: CssProperty
59
+ /**
60
+ * The shorthand of the property.
61
+ */
62
+ shorthand?: string | string[]
63
+ /**
64
+ * The CSS semantic group this property belongs
65
+ */
66
+ group?: CssSemanticGroup
67
+ /**
68
+ * Whether this utility is deprecated or not.
69
+ */
70
+ deprecated?: boolean
71
+ }
72
+
73
+ export type CssSemanticGroup =
74
+ | 'Animation'
75
+ | 'Background Gradient'
76
+ | 'Background'
77
+ | 'Border Radius'
78
+ | 'Border'
79
+ | 'Color'
80
+ | 'Container'
81
+ | 'Display'
82
+ | 'Focus Ring'
83
+ | 'Effect'
84
+ | 'Flex Layout'
85
+ | 'Grid Layout'
86
+ | 'Height'
87
+ | 'Interactivity'
88
+ | 'Layout'
89
+ | 'List'
90
+ | 'Margin'
91
+ | 'Other'
92
+ | 'Padding'
93
+ | 'Position'
94
+ | 'Scroll'
95
+ | 'Shadow'
96
+ | 'System'
97
+ | 'Table'
98
+ | 'Transform'
99
+ | 'Transition'
100
+ | 'Typography'
101
+ | 'Visibility'
102
+ | 'Width'
103
+
104
+ export type UtilityConfig = {
105
+ [property in LiteralUnion<CssProperty>]?: PropertyConfig
106
+ }
107
+
108
+ type UtilityConfigWithExtend = {
109
+ [pattern in LiteralUnion<CssProperty>]?: PropertyConfig | UtilityConfig | undefined
110
+ }
111
+
112
+ export type ExtendableUtilityConfig = UtilityConfigWithExtend & {
113
+ extend?: UtilityConfig | undefined
114
+ }
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@bamboocss/types",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "description": "The types for css bamboo",
5
5
  "homepage": "https://bamboo-css.com",
6
6
  "license": "MIT",
7
7
  "author": "Segun Adebayo <joseshegs@gmail.com>",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/chakra-ui/bamboo.git",
10
+ "url": "git+https://github.com/bamboocss/bamboo.git",
11
11
  "directory": "packages/types"
12
12
  },
13
13
  "files": [
14
14
  "dist"
15
15
  ],
16
16
  "sideEffects": false,
17
- "main": "dist/index.d.ts",
17
+ "main": "dist/index.d.cts",
18
18
  "exports": {
19
19
  ".": {
20
20
  "source": "./src/index.ts",
21
- "types": "./dist/index.d.ts",
22
- "default": "./dist/index.d.ts"
21
+ "types": "./dist/index.d.cts",
22
+ "default": "./dist/index.d.cts"
23
23
  },
24
24
  "./package.json": "./package.json"
25
25
  },
@@ -32,7 +32,7 @@
32
32
  "ncp": "2.0.0",
33
33
  "pkg-types": "2.3.0",
34
34
  "ts-morph": "28.0.0",
35
- "@bamboocss/extractor": "1.11.1"
35
+ "@bamboocss/extractor": "1.11.3"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "tsx scripts/watch.ts",