@pandacss/types 0.0.0-dev-20230321103030 → 0.0.0-dev-20230323194924
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/dist/analyze-report.d.ts +188 -0
- package/dist/index.d.ts +10 -1
- package/dist/parser.d.ts +13 -10
- package/package.json +6 -3
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { BoxNodeEmptyInitializer, BoxNodeLiteral, BoxNodeMap } from '@box-extractor/core'
|
|
2
|
+
import type { Config } from './config'
|
|
3
|
+
|
|
4
|
+
export type ReportItemType = 'object' | 'cva' | 'pattern' | 'recipe' | 'jsx' | 'jsx-factory'
|
|
5
|
+
export type ReportItem = {
|
|
6
|
+
id: number
|
|
7
|
+
from: string
|
|
8
|
+
type: ReportItemType
|
|
9
|
+
filepath: string
|
|
10
|
+
kind: 'function' | 'component'
|
|
11
|
+
path: string[]
|
|
12
|
+
propName: string
|
|
13
|
+
conditionName?: string | undefined
|
|
14
|
+
value: string | number | true
|
|
15
|
+
category: string
|
|
16
|
+
isKnown: boolean
|
|
17
|
+
box: BoxNodeLiteral | BoxNodeEmptyInitializer
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An instance is either a component usage or a function usage
|
|
22
|
+
* @example an instance name could be 'Button', 'css', 'panda.div', 'vstack', ...
|
|
23
|
+
*/
|
|
24
|
+
export type ReportInstanceItem = Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> & {
|
|
25
|
+
instanceId: number
|
|
26
|
+
contains: Array<ReportItem['id']>
|
|
27
|
+
value: Record<string, any>
|
|
28
|
+
box: BoxNodeMap
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type 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']>>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ReportCounts = {
|
|
46
|
+
filesWithTokens: number
|
|
47
|
+
propNameUsed: number
|
|
48
|
+
tokenUsed: number
|
|
49
|
+
shorthandUsed: number
|
|
50
|
+
propertyPathUsed: number
|
|
51
|
+
typeUsed: number
|
|
52
|
+
instanceNameUsed: number
|
|
53
|
+
kindUsed: number
|
|
54
|
+
instanceOfKindUsed: number
|
|
55
|
+
colorsUsed: number
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type MostUsedItem = { key: string; count: number }
|
|
59
|
+
export type ReportStats = {
|
|
60
|
+
filesWithMostInstance: Record<string, number>
|
|
61
|
+
filesWithMostPropValueCombinations: Record<string, number>
|
|
62
|
+
mostUseds: {
|
|
63
|
+
propNames: Array<MostUsedItem>
|
|
64
|
+
tokens: Array<MostUsedItem>
|
|
65
|
+
shorthands: Array<MostUsedItem>
|
|
66
|
+
categories: Array<MostUsedItem>
|
|
67
|
+
conditions: Array<MostUsedItem>
|
|
68
|
+
propertyPaths: Array<MostUsedItem>
|
|
69
|
+
types: Array<MostUsedItem>
|
|
70
|
+
instanceNames: Array<MostUsedItem>
|
|
71
|
+
fromKinds: Array<MostUsedItem>
|
|
72
|
+
instanceOfKinds: Array<MostUsedItem>
|
|
73
|
+
colors: Array<MostUsedItem>
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type ReportDetails = {
|
|
78
|
+
counts: ReportCounts
|
|
79
|
+
stats: ReportStats
|
|
80
|
+
details: {
|
|
81
|
+
byId: Map<ReportItem['id'], ReportItem>
|
|
82
|
+
byInstanceId: Map<ReportInstanceItem['instanceId'], ReportInstanceItem>
|
|
83
|
+
byFilepath: Map<string, Set<ReportItem['id']>>
|
|
84
|
+
byInstanceInFilepath: Map<string, Set<ReportInstanceItem['instanceId']>>
|
|
85
|
+
globalMaps: ReportMaps
|
|
86
|
+
byFilePathMaps: Map<string, ReportMaps>
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type FileSizes = {
|
|
91
|
+
normal: string
|
|
92
|
+
minified: string
|
|
93
|
+
gzip: {
|
|
94
|
+
normal: string
|
|
95
|
+
minified: string
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type AnalysisReport = ReportDetails & {
|
|
100
|
+
fileSizes: FileSizes
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type ReportMapsJSON = {
|
|
104
|
+
byInstanceOfKind: Record<'function' | 'component', Array<ReportInstanceItem['instanceId']>>
|
|
105
|
+
byPropertyName: Record<string, Array<ReportItem['id']>>
|
|
106
|
+
byCategory: Record<string, Array<ReportItem['id']>>
|
|
107
|
+
byConditionName: Record<string, Array<ReportItem['id']>>
|
|
108
|
+
byShorthand: Record<string, Array<ReportItem['id']>>
|
|
109
|
+
byTokenName: Record<string, Array<ReportItem['id']>>
|
|
110
|
+
byPropertyPath: Record<string, Array<ReportItem['id']>>
|
|
111
|
+
fromKind: Record<'function' | 'component', Array<ReportItem['id']>>
|
|
112
|
+
byType: Record<string, Array<ReportItem['id']>>
|
|
113
|
+
byInstanceName: Record<string, Array<ReportItem['id']>>
|
|
114
|
+
colorsUsed: Record<string, Array<ReportItem['id']>>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type NodeRange = {
|
|
118
|
+
startPosition: number
|
|
119
|
+
startLineNumber: number
|
|
120
|
+
startColumn: number
|
|
121
|
+
endPosition: number
|
|
122
|
+
endLineNumber: number
|
|
123
|
+
endColumn: number
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type MorphNodeJSON = {
|
|
127
|
+
kind: string
|
|
128
|
+
range: NodeRange
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type ReportItemJSON = {
|
|
132
|
+
id: number
|
|
133
|
+
from: string
|
|
134
|
+
type: ReportItemType
|
|
135
|
+
filepath: string
|
|
136
|
+
kind: 'function' | 'component'
|
|
137
|
+
path: string[]
|
|
138
|
+
propName: string
|
|
139
|
+
conditionName?: string | undefined
|
|
140
|
+
value: string | number | true
|
|
141
|
+
category: string
|
|
142
|
+
isKnown: boolean
|
|
143
|
+
box: {
|
|
144
|
+
type: 'literal' | 'empty-initializer'
|
|
145
|
+
value: string | number | boolean | undefined | null
|
|
146
|
+
node: MorphNodeJSON
|
|
147
|
+
stack: MorphNodeJSON[]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type ReportInstanceItemJSON = Pick<ReportItem, 'from' | 'type' | 'kind' | 'filepath'> & {
|
|
152
|
+
instanceId: number
|
|
153
|
+
contains: Array<ReportItem['id']>
|
|
154
|
+
value: Record<string, any>
|
|
155
|
+
box: { type: 'map'; value: Record<string, any>; node: MorphNodeJSON; stack: MorphNodeJSON[] }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type AnalysisReportJSON = {
|
|
159
|
+
counts: ReportCounts
|
|
160
|
+
stats: ReportStats
|
|
161
|
+
details: {
|
|
162
|
+
byId: Record<ReportItemJSON['id'], ReportItemJSON>
|
|
163
|
+
byInstanceId: Record<ReportInstanceItemJSON['instanceId'], ReportInstanceItemJSON>
|
|
164
|
+
byFilepath: Record<string, Array<ReportItemJSON['id']>>
|
|
165
|
+
byInstanceInFilepath: Record<string, Array<ReportInstanceItemJSON['instanceId']>>
|
|
166
|
+
globalMaps: ReportMapsJSON
|
|
167
|
+
byFilePathMaps: Record<string, ReportMapsJSON>
|
|
168
|
+
}
|
|
169
|
+
fileSizes: FileSizes
|
|
170
|
+
cwd: Config['cwd']
|
|
171
|
+
theme: Config['theme']
|
|
172
|
+
utilities: Config['utilities']
|
|
173
|
+
conditions: Config['conditions']
|
|
174
|
+
shorthands: Record<string, string>
|
|
175
|
+
// Generator["parserOptions""]
|
|
176
|
+
parserOptions: {
|
|
177
|
+
importMap: {
|
|
178
|
+
css: string
|
|
179
|
+
recipe: string
|
|
180
|
+
pattern: string
|
|
181
|
+
jsx: string
|
|
182
|
+
}
|
|
183
|
+
jsx: {
|
|
184
|
+
factory: string
|
|
185
|
+
nodes: Array<{ type: 'string'; name: string; props: string[]; baseName: string }>
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ReportInstanceItem,
|
|
3
|
+
ReportItem,
|
|
4
|
+
ReportItemType,
|
|
5
|
+
AnalysisReport,
|
|
6
|
+
AnalysisReportJSON,
|
|
7
|
+
ReportInstanceItemJSON,
|
|
8
|
+
ReportItemJSON,
|
|
9
|
+
} from './analyze-report'
|
|
1
10
|
export type { CompositionStyles, LayerStyles, TextStyles } from './composition'
|
|
2
11
|
export type { ConditionDetails, Conditions, ConditionType, RawCondition } from './conditions'
|
|
3
12
|
export type { Config, LoadConfigResult, Preset, UserConfig } from './config'
|
|
4
|
-
export type { ParserResult } from './parser'
|
|
13
|
+
export type { ParserResult, ResultItem } from './parser'
|
|
5
14
|
export type { Part, Parts } from './parts'
|
|
6
15
|
export type { PatternConfig, PatternHelpers, PatternProperty } from './pattern'
|
|
7
16
|
export type { RecipeConfig, RecipeVariantRecord } from './recipe'
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { BoxNodeMap, BoxNodeList } from '@box-extractor/core'
|
|
2
|
+
|
|
3
|
+
export type ResultItem = {
|
|
2
4
|
name?: string
|
|
3
5
|
data: Record<string, any>
|
|
4
6
|
type?: string
|
|
7
|
+
box?: BoxNodeList | BoxNodeMap
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
export type ParserResult = {
|
|
8
|
-
jsx: Set<
|
|
9
|
-
css: Set<
|
|
10
|
-
cva: Set<
|
|
11
|
-
recipe: Map<string, Set<
|
|
12
|
-
pattern: Map<string, Set<
|
|
13
|
-
set: (name: 'cva' | 'css', result:
|
|
14
|
-
setCva: (result:
|
|
15
|
-
setRecipe: (name: string, result:
|
|
16
|
-
setPattern: (name: string, result:
|
|
11
|
+
jsx: Set<ResultItem>
|
|
12
|
+
css: Set<ResultItem>
|
|
13
|
+
cva: Set<ResultItem>
|
|
14
|
+
recipe: Map<string, Set<ResultItem>>
|
|
15
|
+
pattern: Map<string, Set<ResultItem>>
|
|
16
|
+
set: (name: 'cva' | 'css', result: ResultItem) => void
|
|
17
|
+
setCva: (result: ResultItem) => void
|
|
18
|
+
setRecipe: (name: string, result: ResultItem) => void
|
|
19
|
+
setPattern: (name: string, result: ResultItem) => void
|
|
17
20
|
isEmpty: () => boolean
|
|
18
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/types",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230323194924",
|
|
4
4
|
"description": "The types for css panda",
|
|
5
5
|
"main": "dist/index.d.ts",
|
|
6
6
|
"author": "Segun Adebayo <joseshegs@gmail.com>",
|
|
@@ -12,8 +12,11 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"chokidar-cli": "^3.0.0",
|
|
16
|
+
"csstype": "3.1.1"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@box-extractor/core": "^0.8.4"
|
|
17
20
|
},
|
|
18
21
|
"scripts": {
|
|
19
22
|
"build": "tsx scripts/build.ts",
|