@pandacss/types 0.41.0 → 0.43.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.
@@ -1,45 +1,71 @@
1
- import type { BoxNodeEmptyInitializer, BoxNodeLiteral, BoxNodeMap } from '@pandacss/extractor'
2
1
  import type { Config } from './config'
3
2
 
4
- export type ReportItemType = 'object' | 'cva' | 'pattern' | 'recipe' | 'jsx' | 'jsx-factory'
5
- export interface ReportItem {
6
- id: number
7
- from: string
8
- type: ReportItemType
9
- filepath: string
10
- kind: 'function' | 'component'
3
+ export type ReportItemType =
4
+ | 'css'
5
+ | 'cva'
6
+ | 'sva'
7
+ | 'pattern'
8
+ | 'recipe'
9
+ | 'jsx-factory'
10
+ | 'jsx-pattern'
11
+ | 'jsx-recipe'
12
+ | 'jsx'
13
+
14
+ type ComponentKind = 'component' | 'function'
15
+
16
+ type Range = {
17
+ startPosition: number
18
+ startLineNumber: number
19
+ startColumn: number
20
+ endPosition: number
21
+ endLineNumber: number
22
+ endColumn: number
23
+ }
24
+
25
+ export interface PropertyReportItem {
26
+ index: string
27
+ componentIndex: ComponentReportItem['componentIndex']
28
+ componentName: ComponentReportItem['componentName']
29
+ reportItemKind: 'token' | 'utility'
30
+
11
31
  path: string[]
12
- propName: string
13
32
  conditionName?: string | undefined
14
- value: string | number | true
15
- category: string
16
- isKnown: boolean
17
- box: BoxNodeLiteral | BoxNodeEmptyInitializer
33
+ propName: string
34
+ value: string | number | boolean
35
+
36
+ tokenType?: string
37
+ isKnownValue: boolean
38
+
39
+ range: Range
40
+ filepath: string
18
41
  }
19
42
 
20
43
  /**
21
- * An instance is either a component usage or a function usage
22
- * @example an instance name could be 'Button', 'css', 'panda.div', 'vstack', ...
44
+ * An component is either a component usage or a function usage
45
+ * @example an component name could be 'Button', 'css', 'panda.div', 'vstack', ...
23
46
  */
24
- export interface ReportInstanceItem extends Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> {
25
- instanceId: number
26
- contains: Array<ReportItem['id']>
47
+ export interface ComponentReportItem extends Pick<PropertyReportItem, 'filepath'> {
48
+ componentIndex: string
49
+ componentName: string
50
+ reportItemType: ReportItemType
51
+ kind: ComponentKind
52
+ contains: Array<PropertyReportItem['index']>
27
53
  value: Record<string, any>
28
- box: BoxNodeMap
54
+ range: Range
29
55
  }
30
56
 
31
- export interface ReportMaps {
32
- byInstanceOfKind: Map<'function' | 'component', Set<ReportInstanceItem['instanceId']>>
33
- byPropertyName: Map<string, Set<ReportItem['id']>>
34
- byCategory: Map<string, Set<ReportItem['id']>>
35
- byConditionName: Map<string, Set<ReportItem['id']>>
36
- byShorthand: Map<string, Set<ReportItem['id']>>
37
- byTokenName: Map<string, Set<ReportItem['id']>>
38
- byPropertyPath: Map<string, Set<ReportItem['id']>>
39
- fromKind: Map<'function' | 'component', Set<ReportItem['id']>>
40
- byType: Map<string, Set<ReportItem['id']>>
41
- byInstanceName: Map<string, Set<ReportItem['id']>>
42
- colorsUsed: Map<string, Set<ReportItem['id']>>
57
+ export interface ReportDerivedMaps {
58
+ byComponentOfKind: Map<ComponentKind, Set<ComponentReportItem['componentIndex']>>
59
+ byPropertyName: Map<string, Set<PropertyReportItem['index']>>
60
+ byTokenType: Map<string, Set<PropertyReportItem['index']>>
61
+ byConditionName: Map<string, Set<PropertyReportItem['index']>>
62
+ byShorthand: Map<string, Set<PropertyReportItem['index']>>
63
+ byTokenName: Map<string, Set<PropertyReportItem['index']>>
64
+ byPropertyPath: Map<string, Set<PropertyReportItem['index']>>
65
+ fromKind: Map<ComponentKind, Set<PropertyReportItem['index']>>
66
+ byType: Map<string, Set<PropertyReportItem['index']>>
67
+ byComponentName: Map<string, Set<PropertyReportItem['index']>>
68
+ colorsUsed: Map<string, Set<PropertyReportItem['index']>>
43
69
  }
44
70
 
45
71
  export interface ReportCounts {
@@ -49,9 +75,9 @@ export interface ReportCounts {
49
75
  shorthandUsed: number
50
76
  propertyPathUsed: number
51
77
  typeUsed: number
52
- instanceNameUsed: number
78
+ componentNameUsed: number
53
79
  kindUsed: number
54
- instanceOfKindUsed: number
80
+ componentOfKindUsed: number
55
81
  colorsUsed: number
56
82
  }
57
83
 
@@ -60,8 +86,7 @@ export interface MostUsedItem {
60
86
  count: number
61
87
  }
62
88
  export interface ReportStats {
63
- filesWithMostInstance: Record<string, number>
64
- filesWithMostPropValueCombinations: Record<string, number>
89
+ filesWithMostComponent: Record<string, number>
65
90
  mostUseds: {
66
91
  propNames: Array<MostUsedItem>
67
92
  tokens: Array<MostUsedItem>
@@ -70,9 +95,9 @@ export interface ReportStats {
70
95
  conditions: Array<MostUsedItem>
71
96
  propertyPaths: Array<MostUsedItem>
72
97
  types: Array<MostUsedItem>
73
- instanceNames: Array<MostUsedItem>
98
+ componentNames: Array<MostUsedItem>
74
99
  fromKinds: Array<MostUsedItem>
75
- instanceOfKinds: Array<MostUsedItem>
100
+ componentOfKinds: Array<MostUsedItem>
76
101
  colors: Array<MostUsedItem>
77
102
  }
78
103
  }
@@ -80,13 +105,15 @@ export interface ReportStats {
80
105
  export interface ReportDetails {
81
106
  counts: ReportCounts
82
107
  stats: ReportStats
83
- details: {
84
- byId: Map<ReportItem['id'], ReportItem>
85
- byInstanceId: Map<ReportInstanceItem['instanceId'], ReportInstanceItem>
86
- byFilepath: Map<string, Set<ReportItem['id']>>
87
- byInstanceInFilepath: Map<string, Set<ReportInstanceItem['instanceId']>>
88
- globalMaps: ReportMaps
89
- byFilePathMaps: Map<string, ReportMaps>
108
+ fileSizes: FileSizes
109
+ duration: {
110
+ classify: number
111
+ cssMs: number
112
+ cssMinifyMs: number
113
+ extractTotal: number
114
+ extractTimeByFiles: Record<string, number>
115
+ lightningCssMs?: number
116
+ lightningCssMinifiedMs?: number
90
117
  }
91
118
  }
92
119
 
@@ -97,83 +124,50 @@ interface FileSizes {
97
124
  normal: string
98
125
  minified: string
99
126
  }
127
+ lightningCss?: {
128
+ normal: string
129
+ minified: string
130
+ }
100
131
  }
101
132
 
102
- export interface AnalysisReport extends ReportDetails {
103
- fileSizes: FileSizes
104
- }
133
+ export interface ReportSnapshot {
134
+ schemaVersion: string
135
+ details: ReportDetails
136
+ config: Omit<Config, 'globalCss' | 'globalFontface'>
105
137
 
106
- interface ReportMapsJSON {
107
- byInstanceOfKind: Record<'function' | 'component', Array<ReportInstanceItem['instanceId']>>
108
- byPropertyName: Record<string, Array<ReportItem['id']>>
109
- byCategory: Record<string, Array<ReportItem['id']>>
110
- byConditionName: Record<string, Array<ReportItem['id']>>
111
- byShorthand: Record<string, Array<ReportItem['id']>>
112
- byTokenName: Record<string, Array<ReportItem['id']>>
113
- byPropertyPath: Record<string, Array<ReportItem['id']>>
114
- fromKind: Record<'function' | 'component', Array<ReportItem['id']>>
115
- byType: Record<string, Array<ReportItem['id']>>
116
- byInstanceName: Record<string, Array<ReportItem['id']>>
117
- colorsUsed: Record<string, Array<ReportItem['id']>>
118
- }
138
+ propByIndex: Map<PropertyReportItem['index'], PropertyReportItem>
139
+ componentByIndex: Map<ComponentReportItem['componentIndex'], ComponentReportItem>
119
140
 
120
- export interface ReportItemJSON {
121
- id: number
122
- from: string
123
- type: ReportItemType
124
- filepath: string
125
- kind: 'function' | 'component'
126
- path: string[]
127
- propName: string
128
- conditionName?: string | undefined
129
- value: string | number | true
130
- category: string
131
- isKnown: boolean
132
- box: {
133
- type: 'literal' | 'empty-initializer'
134
- value: string | number | boolean | undefined | null
135
- node: string
136
- stack: string[]
137
- line: number
138
- column: number
141
+ derived: {
142
+ byFilepath: Map<string, Set<PropertyReportItem['index']>>
143
+ byComponentInFilepath: Map<string, Set<ComponentReportItem['componentIndex']>>
144
+ globalMaps: ReportDerivedMaps
145
+ byFilePathMaps: Map<string, ReportDerivedMaps>
139
146
  }
140
147
  }
141
148
 
142
- export interface ReportInstanceItemJSON extends Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> {
143
- instanceId: number
144
- contains: Array<ReportItem['id']>
145
- value: Record<string, any>
146
- box: { type: 'map'; value: Record<string, any>; node: string; stack: string[]; line: number; column: number }
149
+ interface ReportDerivedMapsJSON {
150
+ byComponentOfKind: Record<ComponentKind, Array<ComponentReportItem['componentIndex']>>
151
+ byPropertyName: Record<string, Array<PropertyReportItem['index']>>
152
+ byTokenType: Record<string, Array<PropertyReportItem['index']>>
153
+ byConditionName: Record<string, Array<PropertyReportItem['index']>>
154
+ byShorthand: Record<string, Array<PropertyReportItem['index']>>
155
+ byTokenName: Record<string, Array<PropertyReportItem['index']>>
156
+ byPropertyPath: Record<string, Array<PropertyReportItem['index']>>
157
+ fromKind: Record<ComponentKind, Array<PropertyReportItem['index']>>
158
+ byType: Record<string, Array<PropertyReportItem['index']>>
159
+ byComponentName: Record<string, Array<PropertyReportItem['index']>>
160
+ colorsUsed: Record<string, Array<PropertyReportItem['index']>>
147
161
  }
148
162
 
149
- export interface AnalysisReportJSON {
150
- counts: ReportCounts
151
- stats: ReportStats
152
- details: {
153
- byId: Record<ReportItemJSON['id'], ReportItemJSON>
154
- byInstanceId: Record<ReportInstanceItemJSON['instanceId'], ReportInstanceItemJSON>
155
- byFilepath: Record<string, Array<ReportItemJSON['id']>>
156
- byInstanceInFilepath: Record<string, Array<ReportInstanceItemJSON['instanceId']>>
157
- globalMaps: ReportMapsJSON
158
- byFilePathMaps: Record<string, ReportMapsJSON>
159
- }
160
- fileSizes: FileSizes
161
- cwd: Config['cwd']
162
- theme: Config['theme']
163
- utilities: Config['utilities']
164
- conditions: Config['conditions']
165
- shorthands: Record<string, string>
166
- // Generator["parserOptions""]
167
- parserOptions: {
168
- importMap: {
169
- css: string
170
- recipe: string
171
- pattern: string
172
- jsx: string
173
- }
174
- jsx: {
175
- factory: string
176
- nodes: Array<{ type: 'string'; name: string; props: string[]; baseName: string }>
177
- }
163
+ export interface ReportSnapshotJSON extends Omit<ReportSnapshot, 'propByIndex' | 'componentByIndex' | 'derived'> {
164
+ propByIndex: Record<PropertyReportItem['index'], PropertyReportItem>
165
+ componentByIndex: Record<ComponentReportItem['componentIndex'], ComponentReportItem>
166
+
167
+ derived: {
168
+ byFilepath: Record<string, Array<PropertyReportItem['index']>>
169
+ byComponentInFilepath: Record<string, Array<ComponentReportItem['componentIndex']>>
170
+ globalMaps: ReportDerivedMapsJSON
171
+ byFilePathMaps: Record<string, ReportDerivedMapsJSON>
178
172
  }
179
173
  }
package/dist/config.d.ts CHANGED
@@ -4,7 +4,12 @@ import type { PandaHooks } from './hooks'
4
4
  import type { PatternConfig } from './pattern'
5
5
  import type { Keys, LiteralUnion, PathIn, RequiredBy } from './shared'
6
6
  import type { StaticCssOptions } from './static-css'
7
- import type { ExtendableGlobalStyleObject, GlobalStyleObject } from './system-types'
7
+ import type {
8
+ ExtendableGlobalFontface,
9
+ ExtendableGlobalStyleObject,
10
+ GlobalFontface,
11
+ GlobalStyleObject,
12
+ } from './system-types'
8
13
  import type { ExtendableTheme, Theme } from './theme'
9
14
  import type { ExtendableUtilityConfig, UtilityConfig } from './utility'
10
15
 
@@ -52,6 +57,10 @@ export interface PresetCore {
52
57
  * The global styles for your project.
53
58
  */
54
59
  globalCss: GlobalStyleObject
60
+ /**
61
+ * The global fontface for your project.
62
+ */
63
+ globalFontface?: GlobalFontface
55
64
  /**
56
65
  * Used to generate css utility classes for your project.
57
66
  */
@@ -147,6 +156,10 @@ export interface ExtendableOptions {
147
156
  * The global styles for your project.
148
157
  */
149
158
  globalCss?: ExtendableGlobalStyleObject
159
+ /**
160
+ * The global fontface for your project.
161
+ */
162
+ globalFontface?: ExtendableGlobalFontface
150
163
  /**
151
164
  * Used to generate css utility classes for your project.
152
165
  */
@@ -311,11 +324,6 @@ interface CssgenOptions {
311
324
  * @default '_'
312
325
  */
313
326
  separator?: '_' | '=' | '-'
314
- /**
315
- * Whether to optimize the generated css.
316
- * @default true
317
- */
318
- optimize?: boolean
319
327
  /**
320
328
  * Whether to minify the generated css.
321
329
  * @default false
@@ -355,22 +363,6 @@ interface CssgenOptions {
355
363
  }
356
364
 
357
365
  interface CodegenOptions {
358
- /**
359
- * Whether to emit the artifacts to `node_modules` as a package.
360
- * @default false
361
- * @deprecated `emitPackage` is deprecated, it's known for causing several issues:
362
- * - bundlers sometimes eagerly cache the `node_modules`, leading to `panda codegen` updates to the `styled-system` not visible in the browser
363
- * - auto-imports are not suggested in your IDE.
364
- * - in some IDE the typings are not always reflected properly
365
- *
366
- * As alternatives, you can use:
367
- * - relative paths instead of absolute paths (e.g. `../styled-system/css` instead of `styled-system/css`)
368
- * - use package.json #imports and/or tsconfig path aliases (prefer package.json#imports when possible, TS 5.4 supports them by default) like `#styled-system/css` instead of `styled-system/css`
369
- * @see https://nodejs.org/api/packages.html#subpath-imports
370
- * - for a component library, use a dedicated workspace package (e.g. `@acme/styled-system`) and use `importMap: "@acme/styled-system"` so that Panda knows which entrypoint to extract, e.g. `import { css } from '@acme/styled-system/css'`
371
- * @see https://panda-css.com/docs/guides/component-library
372
- */
373
- emitPackage?: boolean
374
366
  /**
375
367
  * Whether to only emit the `tokens` directory
376
368
  * @default false
@@ -1,5 +1,5 @@
1
1
  import type { ConditionalValue, Nested } from './conditions'
2
- import type { PropertiesFallback } from './csstype'
2
+ import type { AtRule, PropertiesFallback } from './csstype'
3
3
  import type { SystemProperties, CssVarProperties } from './style-props'
4
4
 
5
5
  type String = string & {}
@@ -55,12 +55,33 @@ export interface ExtendableGlobalStyleObject {
55
55
  extend?: GlobalStyleObject | undefined
56
56
  }
57
57
 
58
+ /* -----------------------------------------------------------------------------
59
+ * Composition (text styles, layer styles)
60
+ * -----------------------------------------------------------------------------*/
61
+
58
62
  type FilterStyleObject<P extends string> = {
59
63
  [K in P]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown
60
64
  }
61
65
 
62
66
  export type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>
63
67
 
68
+ /* -----------------------------------------------------------------------------
69
+ * Font face
70
+ * -----------------------------------------------------------------------------*/
71
+
72
+ export type GlobalFontfaceRule = Omit<AtRule.FontFaceFallback, 'src'> & Required<Pick<AtRule.FontFaceFallback, 'src'>>
73
+
74
+ export type FontfaceRule = Omit<GlobalFontfaceRule, 'fontFamily'>
75
+
76
+ export interface GlobalFontface {
77
+ [name: string]: FontfaceRule | FontfaceRule[]
78
+ }
79
+
80
+ export interface ExtendableGlobalFontface {
81
+ [name: string]: FontfaceRule | FontfaceRule[] | GlobalFontface | undefined
82
+ extend?: GlobalFontface | undefined
83
+ }
84
+
64
85
  /* -----------------------------------------------------------------------------
65
86
  * Jsx style props
66
87
  * -----------------------------------------------------------------------------*/
package/dist/utility.d.ts CHANGED
@@ -71,33 +71,34 @@ export interface PropertyConfig {
71
71
  }
72
72
 
73
73
  export type CssSemanticGroup =
74
- | 'System'
74
+ | 'Animation'
75
+ | 'Background Gradient'
76
+ | 'Background'
77
+ | 'Border Radius'
78
+ | 'Border'
79
+ | 'Color'
75
80
  | 'Container'
76
81
  | 'Display'
77
- | 'Visibility'
78
- | 'Position'
79
- | 'Transform'
82
+ | 'Effect'
80
83
  | 'Flex Layout'
81
84
  | 'Grid Layout'
82
- | 'Layout'
83
- | 'Border'
84
- | 'Border Radius'
85
- | 'Width'
86
85
  | 'Height'
86
+ | 'Interactivity'
87
+ | 'Layout'
88
+ | 'List'
87
89
  | 'Margin'
90
+ | 'Other'
88
91
  | 'Padding'
89
- | 'Color'
90
- | 'Typography'
91
- | 'Background'
92
- | 'Background Gradient'
92
+ | 'Position'
93
+ | 'Scroll'
93
94
  | 'Shadow'
95
+ | 'System'
94
96
  | 'Table'
95
- | 'List'
96
- | 'Scroll'
97
- | 'Interactivity'
97
+ | 'Transform'
98
98
  | 'Transition'
99
- | 'Effect'
100
- | 'Other'
99
+ | 'Typography'
100
+ | 'Visibility'
101
+ | 'Width'
101
102
 
102
103
  export type UtilityConfig = {
103
104
  [property in LiteralUnion<CssProperty>]?: PropertyConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/types",
3
- "version": "0.41.0",
3
+ "version": "0.43.0",
4
4
  "description": "The types for css panda",
5
5
  "main": "dist/index.d.ts",
6
6
  "author": "Segun Adebayo <joseshegs@gmail.com>",
@@ -31,7 +31,7 @@
31
31
  "ncp": "2.0.0",
32
32
  "pkg-types": "1.0.3",
33
33
  "ts-morph": "21.0.1",
34
- "@pandacss/extractor": "0.41.0"
34
+ "@pandacss/extractor": "0.43.0"
35
35
  },
36
36
  "scripts": {
37
37
  "dev": "tsx scripts/watch.ts",