@pandacss/types 1.11.2 → 2.0.0-beta.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.
- package/LICENSE.md +1 -1
- package/README.md +18 -0
- package/dist/conditions.d.ts +6 -18
- package/dist/config.d.ts +38 -96
- package/dist/hooks.d.ts +67 -191
- package/dist/index.d.ts +0 -2
- package/dist/theme.d.ts +2 -2
- package/package.json +3 -4
- package/dist/parser.d.ts +0 -40
- package/dist/reporter.d.ts +0 -167
package/LICENSE.md
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @pandacss/types
|
|
2
|
+
|
|
3
|
+
The public TypeScript types for [Panda CSS](https://panda-css.com) — `Config`, `Preset`, `UserConfig`, and the
|
|
4
|
+
supporting type surface used across the Panda packages.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install -D @pandacss/types
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
Visit the [Panda CSS documentation](https://panda-css.com) to learn more.
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
MIT © [Chakra Systems Inc.](https://github.com/chakra-ui)
|
package/dist/conditions.d.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { AnySelector, Selectors } from './selectors'
|
|
2
2
|
|
|
3
|
-
export type ConditionType =
|
|
4
|
-
| 'at-rule'
|
|
5
|
-
| 'parent-nesting'
|
|
6
|
-
| 'self-nesting'
|
|
7
|
-
| 'combinator-nesting'
|
|
8
|
-
| 'mixed'
|
|
9
|
-
| 'multi-block'
|
|
3
|
+
export type ConditionType = 'at-rule' | 'parent-nesting' | 'self-nesting' | 'combinator-nesting' | 'mixed'
|
|
10
4
|
|
|
11
|
-
export type ConditionDetails = AtRuleCondition | SelectorCondition | MixedCondition
|
|
5
|
+
export type ConditionDetails = AtRuleCondition | SelectorCondition | MixedCondition
|
|
12
6
|
|
|
13
7
|
export interface AtRuleCondition {
|
|
14
8
|
type: 'at-rule'
|
|
@@ -30,21 +24,15 @@ export interface MixedCondition {
|
|
|
30
24
|
raw: string[]
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
export interface MultiBlockCondition {
|
|
34
|
-
type: 'multi-block'
|
|
35
|
-
value: MixedCondition[]
|
|
36
|
-
raw: Record<string, any>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
27
|
/* -----------------------------------------------------------------------------
|
|
40
28
|
* Shadowed export (in CLI): DO NOT REMOVE
|
|
41
29
|
* -----------------------------------------------------------------------------*/
|
|
42
30
|
|
|
43
|
-
export type
|
|
44
|
-
|
|
31
|
+
export type ConditionSlot = '@slot'
|
|
32
|
+
export interface ConditionBlock {
|
|
33
|
+
[selector: string]: ConditionSlot | ConditionBlock
|
|
45
34
|
}
|
|
46
|
-
|
|
47
|
-
export type ConditionQuery = string | string[] | ConditionObjectQuery
|
|
35
|
+
export type ConditionQuery = string | ConditionBlock
|
|
48
36
|
|
|
49
37
|
export interface Conditions {
|
|
50
38
|
[condition: string]: ConditionQuery
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TSConfig } from 'pkg-types'
|
|
2
2
|
import type { Conditions, ExtendableConditions } from './conditions'
|
|
3
|
-
import type {
|
|
3
|
+
import type { HookRegistry } 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'
|
|
@@ -20,30 +20,6 @@ export type CascadeLayer = 'reset' | 'base' | 'tokens' | 'recipes' | 'utilities'
|
|
|
20
20
|
|
|
21
21
|
export type CascadeLayers = Record<CascadeLayer, string>
|
|
22
22
|
|
|
23
|
-
export interface StudioOptions {
|
|
24
|
-
/**
|
|
25
|
-
* Used to customize the design system studio
|
|
26
|
-
* @default { title: 'Panda', logo: '🐼' }
|
|
27
|
-
*/
|
|
28
|
-
studio?: {
|
|
29
|
-
/**
|
|
30
|
-
* The output directory for the design system studio when the build command is run.
|
|
31
|
-
*/
|
|
32
|
-
outdir?: string
|
|
33
|
-
/**
|
|
34
|
-
* The logo url for the design system studio.
|
|
35
|
-
*/
|
|
36
|
-
logo?: string
|
|
37
|
-
/**
|
|
38
|
-
* Used to inject custom html into the head or body of the studio
|
|
39
|
-
*/
|
|
40
|
-
inject?: {
|
|
41
|
-
head?: string
|
|
42
|
-
body?: string
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
23
|
export interface Patterns {
|
|
48
24
|
[pattern: string]: PatternConfig
|
|
49
25
|
}
|
|
@@ -206,7 +182,9 @@ export interface ExtendableOptions {
|
|
|
206
182
|
|
|
207
183
|
export interface ImportMapInput {
|
|
208
184
|
css?: string | string[]
|
|
185
|
+
recipe?: string | string[]
|
|
209
186
|
recipes?: string | string[]
|
|
187
|
+
pattern?: string | string[]
|
|
210
188
|
patterns?: string | string[]
|
|
211
189
|
jsx?: string | string[]
|
|
212
190
|
tokens?: string | string[]
|
|
@@ -223,11 +201,6 @@ export interface ImportMapOutput<T = string> {
|
|
|
223
201
|
type ImportMapOption = string | ImportMapInput
|
|
224
202
|
|
|
225
203
|
interface FileSystemOptions {
|
|
226
|
-
/**
|
|
227
|
-
* Whether to clean the output directory before generating the css.
|
|
228
|
-
* @default false
|
|
229
|
-
*/
|
|
230
|
-
clean?: boolean
|
|
231
204
|
/**
|
|
232
205
|
* The output directory.
|
|
233
206
|
* @default 'styled-system'
|
|
@@ -263,16 +236,6 @@ interface FileSystemOptions {
|
|
|
263
236
|
* Use this option as a workaround.
|
|
264
237
|
*/
|
|
265
238
|
dependencies?: string[]
|
|
266
|
-
/**
|
|
267
|
-
* Whether to watch for changes and regenerate the css.
|
|
268
|
-
* @default false
|
|
269
|
-
*/
|
|
270
|
-
watch?: boolean
|
|
271
|
-
/**
|
|
272
|
-
* Whether to use polling instead of filesystem events when watching.
|
|
273
|
-
* @default false
|
|
274
|
-
*/
|
|
275
|
-
poll?: boolean
|
|
276
239
|
/**
|
|
277
240
|
* The current working directory.
|
|
278
241
|
* @default 'process.cwd()'
|
|
@@ -344,11 +307,6 @@ interface CssgenOptions {
|
|
|
344
307
|
* @default '_'
|
|
345
308
|
*/
|
|
346
309
|
separator?: '_' | '=' | '-'
|
|
347
|
-
/**
|
|
348
|
-
* Whether to minify the generated css.
|
|
349
|
-
* @default false
|
|
350
|
-
*/
|
|
351
|
-
minify?: boolean
|
|
352
310
|
/**
|
|
353
311
|
* The root selector for the css variables.
|
|
354
312
|
* @default ':where(:host, :root)'
|
|
@@ -360,69 +318,63 @@ interface CssgenOptions {
|
|
|
360
318
|
*/
|
|
361
319
|
syntax?: 'template-literal' | 'object-literal'
|
|
362
320
|
/**
|
|
363
|
-
*
|
|
364
|
-
* @default
|
|
321
|
+
* Layer mappings used in the generated css.
|
|
322
|
+
* @default 'true'
|
|
365
323
|
*/
|
|
366
|
-
|
|
324
|
+
layers?: Partial<CascadeLayers>
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface OptimizeOptions {
|
|
367
328
|
/**
|
|
368
|
-
*
|
|
369
|
-
* @see https://www.npmjs.com/package/browserslist
|
|
329
|
+
* Remove unused token declarations based on extracted project usage.
|
|
370
330
|
*/
|
|
371
|
-
|
|
331
|
+
removeUnusedTokens?: boolean
|
|
372
332
|
/**
|
|
373
|
-
*
|
|
374
|
-
* @default 'true'
|
|
333
|
+
* Remove unused keyframes based on extracted project usage.
|
|
375
334
|
*/
|
|
376
|
-
|
|
335
|
+
removeUnusedKeyframes?: boolean
|
|
377
336
|
/**
|
|
378
|
-
*
|
|
379
|
-
* @default 'false'
|
|
380
|
-
* @see https://www.npmjs.com/package/@csstools/postcss-cascade-layers
|
|
337
|
+
* Narrow compound variant CSS to statically selected variant combinations.
|
|
381
338
|
*/
|
|
382
|
-
|
|
339
|
+
smartCompoundVariants?: boolean
|
|
383
340
|
}
|
|
384
341
|
|
|
385
342
|
interface CodegenOptions {
|
|
386
|
-
/**
|
|
387
|
-
* Whether to only emit the `tokens` directory
|
|
388
|
-
* @default false
|
|
389
|
-
*/
|
|
390
|
-
emitTokensOnly?: boolean
|
|
391
343
|
/**
|
|
392
344
|
* Whether to hash the generated class names / css variables.
|
|
393
|
-
* This is useful if want to shorten the class names or css variables.
|
|
345
|
+
* This is useful if you want to shorten the class names or css variables.
|
|
394
346
|
* @default false
|
|
395
347
|
*/
|
|
396
348
|
hash?: boolean | { cssVar: boolean; className: boolean }
|
|
397
349
|
/**
|
|
398
|
-
*
|
|
350
|
+
* Whether to resolve configured utility shorthands like `p` -> `padding`.
|
|
351
|
+
* @default true
|
|
399
352
|
*/
|
|
400
|
-
|
|
353
|
+
shorthands?: boolean
|
|
401
354
|
/**
|
|
402
|
-
* Change generated
|
|
355
|
+
* Change generated TypeScript definitions to be more strict for properties
|
|
356
|
+
* having a token or utility.
|
|
403
357
|
*/
|
|
404
|
-
|
|
358
|
+
strictTokens?: boolean
|
|
405
359
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
360
|
+
* Change generated TypeScript definitions to be more strict for built-in CSS
|
|
361
|
+
* properties to only allow valid CSS values.
|
|
408
362
|
*/
|
|
409
|
-
|
|
363
|
+
strictPropertyValues?: boolean
|
|
410
364
|
/**
|
|
411
|
-
*
|
|
412
|
-
* @default '
|
|
365
|
+
* Generated runtime file extension.
|
|
366
|
+
* @default 'js'
|
|
413
367
|
*/
|
|
414
|
-
|
|
368
|
+
outExtension?: 'ts' | 'js' | 'mjs'
|
|
415
369
|
/**
|
|
416
|
-
*
|
|
417
|
-
* @default
|
|
370
|
+
* Whether generated import specifiers include runtime file extensions.
|
|
371
|
+
* @default false
|
|
418
372
|
*/
|
|
419
|
-
|
|
373
|
+
forceImportExtension?: boolean
|
|
420
374
|
/**
|
|
421
|
-
*
|
|
422
|
-
* If set to `true` and `outExtension` is set to `mjs`, the generated typescript .d.ts files will have the extension `.d.mts`.
|
|
423
|
-
* @default false
|
|
375
|
+
* CSS emission optimizations. All optimizations are opt-in.
|
|
424
376
|
*/
|
|
425
|
-
|
|
377
|
+
optimize?: OptimizeOptions
|
|
426
378
|
}
|
|
427
379
|
|
|
428
380
|
interface PresetOptions {
|
|
@@ -432,12 +384,9 @@ interface PresetOptions {
|
|
|
432
384
|
presets?: (string | Preset | Promise<Preset>)[]
|
|
433
385
|
}
|
|
434
386
|
|
|
435
|
-
export interface
|
|
436
|
-
hooks?: Partial<PandaHooks>
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
export interface PandaPlugin extends HooksOptions {
|
|
387
|
+
export interface PandaPlugin {
|
|
440
388
|
name: string
|
|
389
|
+
hooks?: Partial<HookRegistry>
|
|
441
390
|
}
|
|
442
391
|
|
|
443
392
|
export interface PluginsOptions {
|
|
@@ -445,20 +394,13 @@ export interface PluginsOptions {
|
|
|
445
394
|
}
|
|
446
395
|
|
|
447
396
|
export interface Config
|
|
448
|
-
extends
|
|
449
|
-
ExtendableOptions,
|
|
397
|
+
extends ExtendableOptions,
|
|
450
398
|
CssgenOptions,
|
|
451
399
|
CodegenOptions,
|
|
452
400
|
FileSystemOptions,
|
|
453
401
|
JsxOptions,
|
|
454
402
|
PresetOptions,
|
|
455
|
-
HooksOptions,
|
|
456
403
|
PluginsOptions {
|
|
457
|
-
/**
|
|
458
|
-
* Whether to opt-out of the defaults config presets: [`@pandacss/preset-base`, `@pandacss/preset-panda`]
|
|
459
|
-
* @default 'false'
|
|
460
|
-
*/
|
|
461
|
-
eject?: boolean
|
|
462
404
|
/**
|
|
463
405
|
* The validation strictness to use when validating the config.
|
|
464
406
|
* - When set to 'none', no validation will be performed.
|
|
@@ -470,7 +412,7 @@ export interface Config
|
|
|
470
412
|
validation?: 'none' | 'warn' | 'error'
|
|
471
413
|
}
|
|
472
414
|
|
|
473
|
-
export interface Preset extends ExtendableOptions, PresetOptions {
|
|
415
|
+
export interface Preset extends ExtendableOptions, PresetOptions, PluginsOptions {
|
|
474
416
|
name: string
|
|
475
417
|
}
|
|
476
418
|
|
|
@@ -501,7 +443,7 @@ export interface LoadConfigResult extends LoadTsConfigResult {
|
|
|
501
443
|
serialized: string
|
|
502
444
|
deserialize: () => Config
|
|
503
445
|
dependencies: string[]
|
|
504
|
-
hooks: Partial<
|
|
446
|
+
hooks: Partial<HookRegistry>
|
|
505
447
|
}
|
|
506
448
|
|
|
507
449
|
export interface HashOptions {
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,237 +1,113 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { LoadConfigResult, UserConfig } from './config'
|
|
3
|
-
import type { HooksApiInterface } from './hooks-api'
|
|
4
|
-
import type { LoggerInterface } from './logger'
|
|
5
|
-
import type { ParserResultInterface, ResultItem } from './parser'
|
|
6
|
-
|
|
7
|
-
export interface PandaHooks {
|
|
8
|
-
/**
|
|
9
|
-
* Called when the config is resolved, after all the presets are loaded and merged.
|
|
10
|
-
* This is the first hook called, you can use it to tweak the config before the context is created.
|
|
11
|
-
*/
|
|
12
|
-
'config:resolved': (args: ConfigResolvedHookArgs) => MaybeAsyncReturn<void | ConfigResolvedHookArgs['config']>
|
|
13
|
-
/**
|
|
14
|
-
* Called when each preset is resolved, allowing modification of individual presets.
|
|
15
|
-
* This hook is called for each preset during the resolution process, before they are merged together.
|
|
16
|
-
*/
|
|
17
|
-
'preset:resolved': (args: PresetResolvedHookArgs) => MaybeAsyncReturn<void | PresetResolvedHookArgs['preset']>
|
|
18
|
-
/**
|
|
19
|
-
* Called when the token engine has been created
|
|
20
|
-
*/
|
|
21
|
-
'tokens:created': (args: TokenCreatedHookArgs) => MaybeAsyncReturn
|
|
22
|
-
/**
|
|
23
|
-
* Called when the classname engine has been created
|
|
24
|
-
*/
|
|
25
|
-
'utility:created': (args: UtilityCreatedHookArgs) => MaybeAsyncReturn
|
|
26
|
-
/**
|
|
27
|
-
* Called when the Panda context has been created and the API is ready to be used.
|
|
28
|
-
*/
|
|
29
|
-
'context:created': (args: ContextCreatedHookArgs) => void
|
|
30
|
-
/**
|
|
31
|
-
* Called when the config file or one of its dependencies (imports) has changed.
|
|
32
|
-
*/
|
|
33
|
-
'config:change': (args: ConfigChangeHookArgs) => MaybeAsyncReturn
|
|
34
|
-
/**
|
|
35
|
-
* Called after reading the file content but before parsing it.
|
|
36
|
-
* You can use this hook to transform the file content to a tsx-friendly syntax so that Panda's parser can parse it.
|
|
37
|
-
* You can also use this hook to parse the file's content on your side using a custom parser, in this case you don't have to return anything.
|
|
38
|
-
*/
|
|
39
|
-
'parser:before': (args: ParserResultBeforeHookArgs) => string | void
|
|
40
|
-
/**
|
|
41
|
-
* @private USE IT ONLY IF YOU KNOW WHAT YOU ARE DOING
|
|
42
|
-
*/
|
|
43
|
-
'parser:preprocess': JsxFactoryResultTransform['transform']
|
|
44
|
-
/**
|
|
45
|
-
* Called after the file styles are extracted and processed into the resulting ParserResult object.
|
|
46
|
-
* You can also use this hook to add your own extraction results from your custom parser to the ParserResult object.
|
|
47
|
-
*/
|
|
48
|
-
'parser:after': (args: ParserResultAfterHookArgs) => void
|
|
49
|
-
/**
|
|
50
|
-
* Called right before writing the codegen files to disk.
|
|
51
|
-
* You can use this hook to tweak the codegen files before they are written to disk.
|
|
52
|
-
*/
|
|
53
|
-
'codegen:prepare': (args: CodegenPrepareHookArgs) => MaybeAsyncReturn<void | Artifact[]>
|
|
54
|
-
/**
|
|
55
|
-
* Called after the codegen is completed
|
|
56
|
-
*/
|
|
57
|
-
'codegen:done': (args: CodegenDoneHookArgs) => MaybeAsyncReturn
|
|
58
|
-
/**
|
|
59
|
-
* Called right before adding the design-system CSS (global, static, preflight, tokens, keyframes) to the final CSS
|
|
60
|
-
* Called right before writing/injecting the final CSS (styles.css) that contains the design-system CSS and the parser CSS
|
|
61
|
-
* You can use it to tweak the CSS content before it's written to disk or injected through the postcss plugin.
|
|
62
|
-
*/
|
|
63
|
-
'cssgen:done': (args: CssgenDoneHookArgs) => string | void
|
|
64
|
-
/**
|
|
65
|
-
* Called when CSS needs to be optimized. Use this hook to replace the default PostCSS-based optimizer
|
|
66
|
-
* with a custom one (e.g. LightningCSS).
|
|
67
|
-
* Return the optimized CSS string, or void to fall through to the default PostCSS optimizer.
|
|
68
|
-
*/
|
|
69
|
-
'css:optimize': (args: CssOptimizeHookArgs) => string | void
|
|
70
|
-
}
|
|
1
|
+
import type { Config } from './config'
|
|
71
2
|
|
|
72
3
|
type MaybeAsyncReturn<T = void> = Promise<T> | T
|
|
73
4
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
hash?: boolean
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface TokenCssVar {
|
|
85
|
-
var: `--${string}`
|
|
86
|
-
ref: string
|
|
87
|
-
}
|
|
5
|
+
export type HookFilterPattern =
|
|
6
|
+
| string
|
|
7
|
+
| RegExp
|
|
8
|
+
| {
|
|
9
|
+
include?: Array<string | RegExp> | undefined
|
|
10
|
+
exclude?: Array<string | RegExp> | undefined
|
|
11
|
+
}
|
|
88
12
|
|
|
89
|
-
export interface
|
|
90
|
-
|
|
91
|
-
|
|
13
|
+
export interface HookFilter {
|
|
14
|
+
id?: HookFilterPattern | undefined
|
|
15
|
+
code?:
|
|
16
|
+
| {
|
|
17
|
+
include?: string | RegExp | undefined
|
|
18
|
+
exclude?: string | RegExp | undefined
|
|
19
|
+
}
|
|
20
|
+
| undefined
|
|
92
21
|
}
|
|
93
22
|
|
|
94
|
-
|
|
95
|
-
configure(opts: TokenConfigureOptions): void
|
|
96
|
-
}
|
|
23
|
+
type HookHandler = (...args: never[]) => unknown
|
|
97
24
|
|
|
98
|
-
|
|
99
|
-
* Utility hooks
|
|
100
|
-
* -----------------------------------------------------------------------------*/
|
|
25
|
+
export type PandaHook<Handler extends HookHandler> = Handler | { filter?: HookFilter; handler: Handler }
|
|
101
26
|
|
|
102
|
-
export interface
|
|
103
|
-
|
|
27
|
+
export interface ParserResultBeforeHookArgs {
|
|
28
|
+
filePath: string
|
|
29
|
+
content: string
|
|
30
|
+
original?: string
|
|
104
31
|
}
|
|
105
32
|
|
|
106
|
-
export interface
|
|
107
|
-
|
|
33
|
+
export interface PresetResolvedHookArgs {
|
|
34
|
+
preset: Config
|
|
35
|
+
name: string
|
|
108
36
|
}
|
|
109
37
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
* -----------------------------------------------------------------------------*/
|
|
113
|
-
|
|
114
|
-
interface CallbackItem {
|
|
115
|
-
value: any
|
|
38
|
+
interface TraverseItem {
|
|
39
|
+
value: unknown
|
|
116
40
|
path: string
|
|
117
41
|
depth: number
|
|
118
|
-
parent:
|
|
42
|
+
parent: unknown[] | Record<string, unknown>
|
|
119
43
|
key: string
|
|
120
44
|
}
|
|
121
45
|
|
|
122
|
-
type CallbackFn = (args: CallbackItem) => void
|
|
123
|
-
|
|
124
46
|
interface TraverseOptions {
|
|
125
|
-
separator
|
|
47
|
+
separator?: string | undefined
|
|
126
48
|
maxDepth?: number | undefined
|
|
127
49
|
}
|
|
128
50
|
|
|
129
|
-
interface
|
|
130
|
-
(obj:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
interface ConfigResolvedHookUtils {
|
|
134
|
-
omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>
|
|
135
|
-
pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>
|
|
136
|
-
traverse: TraverseFn
|
|
51
|
+
export interface ConfigResolvedHookUtils {
|
|
52
|
+
omit<T extends object>(obj: T, paths: string[]): T
|
|
53
|
+
pick<T extends object>(obj: T, paths: string[]): Partial<T>
|
|
54
|
+
traverse(obj: unknown, callback: (item: TraverseItem) => void, options?: TraverseOptions): void
|
|
137
55
|
}
|
|
138
56
|
|
|
139
57
|
export interface ConfigResolvedHookArgs {
|
|
140
|
-
config:
|
|
58
|
+
config: Config
|
|
141
59
|
path: string
|
|
142
60
|
dependencies: string[]
|
|
143
61
|
utils: ConfigResolvedHookUtils
|
|
144
|
-
original?: LoadConfigResult['config']
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface ConfigChangeHookArgs {
|
|
148
|
-
config: UserConfig
|
|
149
|
-
changes: DiffConfigResult
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface PresetResolvedHookArgs {
|
|
153
|
-
preset: LoadConfigResult['config']
|
|
154
|
-
name: string
|
|
155
|
-
utils: ConfigResolvedHookUtils
|
|
156
|
-
original?: LoadConfigResult['config']
|
|
157
62
|
}
|
|
158
63
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
export interface ParserResultConfigureOptions {
|
|
164
|
-
matchTag?: (tag: string, isPandaComponent: boolean) => boolean
|
|
165
|
-
matchTagMode?: 'extend' | 'override'
|
|
166
|
-
matchTagProp?: (tag: string, prop: string) => boolean
|
|
64
|
+
export interface CodegenFile {
|
|
65
|
+
path: string
|
|
66
|
+
code: string
|
|
67
|
+
dependencies: string[]
|
|
167
68
|
}
|
|
168
69
|
|
|
169
|
-
export interface
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
configure: (opts: ParserResultConfigureOptions) => void
|
|
173
|
-
original?: string
|
|
70
|
+
export interface CodegenArtifact {
|
|
71
|
+
id: string
|
|
72
|
+
files: CodegenFile[]
|
|
174
73
|
}
|
|
175
74
|
|
|
176
|
-
export interface
|
|
177
|
-
|
|
75
|
+
export interface CodegenPrepareHookArgs {
|
|
76
|
+
artifacts: CodegenArtifact[]
|
|
77
|
+
outdir: string
|
|
78
|
+
cwd?: string | undefined
|
|
178
79
|
}
|
|
179
80
|
|
|
180
|
-
export interface
|
|
181
|
-
|
|
182
|
-
|
|
81
|
+
export interface CodegenDoneHookArgs {
|
|
82
|
+
files: string[]
|
|
83
|
+
outdir: string
|
|
84
|
+
cwd?: string | undefined
|
|
183
85
|
}
|
|
184
86
|
|
|
185
|
-
|
|
186
|
-
* Codegen hooks
|
|
187
|
-
* -----------------------------------------------------------------------------*/
|
|
188
|
-
|
|
189
|
-
export interface CodegenPrepareHookArgs {
|
|
190
|
-
artifacts: Artifact[]
|
|
87
|
+
export interface PandaHooks {
|
|
191
88
|
/**
|
|
192
|
-
*
|
|
89
|
+
* Called after authored presets are merged, before defaults and serialization.
|
|
193
90
|
*/
|
|
194
|
-
|
|
195
|
-
changed: ArtifactId[] | undefined
|
|
196
|
-
}
|
|
197
|
-
export interface CodegenDoneHookArgs {
|
|
198
|
-
changed: ArtifactId[] | undefined
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/* -----------------------------------------------------------------------------
|
|
202
|
-
* Cssgen hooks
|
|
203
|
-
* -----------------------------------------------------------------------------*/
|
|
204
|
-
|
|
205
|
-
type CssgenArtifact = 'global' | 'static' | 'reset' | 'tokens' | 'keyframes' | 'styles.css'
|
|
206
|
-
|
|
207
|
-
export interface CssgenDoneHookArgs {
|
|
208
|
-
artifact: CssgenArtifact
|
|
91
|
+
'config:resolved': (args: ConfigResolvedHookArgs) => MaybeAsyncReturn<void | Config>
|
|
209
92
|
/**
|
|
210
|
-
*
|
|
93
|
+
* Called when an authored preset is resolved, before all configs are merged.
|
|
211
94
|
*/
|
|
212
|
-
|
|
95
|
+
'preset:resolved': (args: PresetResolvedHookArgs) => MaybeAsyncReturn<void | Config>
|
|
213
96
|
/**
|
|
214
|
-
*
|
|
97
|
+
* Called after reading file content but before parsing it.
|
|
98
|
+
* Use this to transform non-standard source into TSX-friendly syntax.
|
|
215
99
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
minify?: boolean
|
|
226
|
-
browserslist?: string[]
|
|
227
|
-
original?: string
|
|
100
|
+
'parser:before': (args: ParserResultBeforeHookArgs) => MaybeAsyncReturn<string | void>
|
|
101
|
+
/**
|
|
102
|
+
* Called before generated files are written by a JS host.
|
|
103
|
+
*/
|
|
104
|
+
'codegen:prepare': (args: CodegenPrepareHookArgs) => void | CodegenArtifact[]
|
|
105
|
+
/**
|
|
106
|
+
* Called after generated files are written by a JS host.
|
|
107
|
+
*/
|
|
108
|
+
'codegen:done': (args: CodegenDoneHookArgs) => void
|
|
228
109
|
}
|
|
229
110
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
* -----------------------------------------------------------------------------*/
|
|
233
|
-
|
|
234
|
-
export interface ContextCreatedHookArgs {
|
|
235
|
-
ctx: HooksApiInterface
|
|
236
|
-
logger: LoggerInterface
|
|
111
|
+
export type HookRegistry = {
|
|
112
|
+
[Name in keyof PandaHooks]: PandaHook<PandaHooks[Name]>
|
|
237
113
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,9 @@ export type * from './config'
|
|
|
5
5
|
export type * from './hooks'
|
|
6
6
|
export type * from './hooks-api'
|
|
7
7
|
export type * from './logger'
|
|
8
|
-
export type * from './parser'
|
|
9
8
|
export type * from './parts'
|
|
10
9
|
export type * from './pattern'
|
|
11
10
|
export type * from './recipe'
|
|
12
|
-
export type * from './reporter'
|
|
13
11
|
export type * from './runtime'
|
|
14
12
|
export type * from './shared'
|
|
15
13
|
export type * from './spec'
|
package/dist/theme.d.ts
CHANGED
|
@@ -64,9 +64,9 @@ export interface Theme {
|
|
|
64
64
|
*/
|
|
65
65
|
containerNames?: string[]
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Container query sizes for your project.
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
containers?: Record<string, string>
|
|
70
70
|
/**
|
|
71
71
|
* The color palette configuration for your project.
|
|
72
72
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.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,11 +31,10 @@
|
|
|
31
31
|
"microdiff": "1.5.0",
|
|
32
32
|
"ncp": "2.0.0",
|
|
33
33
|
"pkg-types": "2.3.0",
|
|
34
|
-
"ts-morph": "28.0.0"
|
|
35
|
-
"@pandacss/extractor": "1.11.2"
|
|
34
|
+
"ts-morph": "28.0.0"
|
|
36
35
|
},
|
|
37
36
|
"scripts": {
|
|
38
37
|
"dev": "tsx scripts/watch.ts",
|
|
39
|
-
"build": "
|
|
38
|
+
"build": "tsx scripts/build.ts"
|
|
40
39
|
}
|
|
41
40
|
}
|
package/dist/parser.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { BoxNodeArray, BoxNodeLiteral, BoxNodeMap, Unboxed } from '@pandacss/extractor'
|
|
2
|
-
|
|
3
|
-
export interface ResultItem {
|
|
4
|
-
name?: string
|
|
5
|
-
data: Array<Unboxed['raw']>
|
|
6
|
-
type?: 'css' | 'cva' | 'sva' | 'token' | 'pattern' | 'recipe' | 'jsx-factory' | 'jsx-pattern' | 'jsx-recipe' | 'jsx'
|
|
7
|
-
box?: BoxNodeMap | BoxNodeLiteral | BoxNodeArray
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ParserResultInterface {
|
|
11
|
-
all: Array<ResultItem>
|
|
12
|
-
jsx: Set<ResultItem>
|
|
13
|
-
css: Set<ResultItem>
|
|
14
|
-
cva: Set<ResultItem>
|
|
15
|
-
sva: Set<ResultItem>
|
|
16
|
-
token: Set<ResultItem>
|
|
17
|
-
recipe: Map<string, Set<ResultItem>>
|
|
18
|
-
pattern: Map<string, Set<ResultItem>>
|
|
19
|
-
filePath: string | undefined
|
|
20
|
-
isEmpty: () => boolean
|
|
21
|
-
toArray: () => Array<ResultItem>
|
|
22
|
-
set: (name: 'cva' | 'css' | 'sva' | 'token', result: ResultItem) => void
|
|
23
|
-
setCss: (result: ResultItem) => void
|
|
24
|
-
setCva: (result: ResultItem) => void
|
|
25
|
-
setSva: (result: ResultItem) => void
|
|
26
|
-
setToken: (result: ResultItem) => void
|
|
27
|
-
setJsx: (result: ResultItem) => void
|
|
28
|
-
setPattern: (name: string, result: ResultItem) => void
|
|
29
|
-
setRecipe: (name: string, result: ResultItem) => void
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface EncoderJson {
|
|
33
|
-
schemaVersion: string
|
|
34
|
-
styles: {
|
|
35
|
-
atomic?: string[]
|
|
36
|
-
recipes?: {
|
|
37
|
-
[name: string]: string[]
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
package/dist/reporter.d.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import type { ParserResultInterface } from './parser'
|
|
2
|
-
|
|
3
|
-
export type ReportItemType =
|
|
4
|
-
| 'css'
|
|
5
|
-
| 'cva'
|
|
6
|
-
| 'sva'
|
|
7
|
-
| 'token'
|
|
8
|
-
| 'pattern'
|
|
9
|
-
| 'recipe'
|
|
10
|
-
| 'jsx-factory'
|
|
11
|
-
| 'jsx-pattern'
|
|
12
|
-
| 'jsx-recipe'
|
|
13
|
-
| 'jsx'
|
|
14
|
-
|
|
15
|
-
type ComponentKind = 'component' | 'function'
|
|
16
|
-
|
|
17
|
-
interface PropertyLocationRange {
|
|
18
|
-
startPosition: number
|
|
19
|
-
startLineNumber: number
|
|
20
|
-
startColumn: number
|
|
21
|
-
endPosition: number
|
|
22
|
-
endLineNumber: number
|
|
23
|
-
endColumn: number
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface PropertyReportItem {
|
|
27
|
-
index: string
|
|
28
|
-
componentIndex: ComponentReportItem['componentIndex']
|
|
29
|
-
componentName: ComponentReportItem['componentName']
|
|
30
|
-
reportItemKind: 'token' | 'utility'
|
|
31
|
-
reportItemType: ReportItemType
|
|
32
|
-
|
|
33
|
-
path: string[]
|
|
34
|
-
conditionName?: string | undefined
|
|
35
|
-
propName: string
|
|
36
|
-
value: string | number | boolean
|
|
37
|
-
|
|
38
|
-
tokenType?: string
|
|
39
|
-
isKnownValue: boolean
|
|
40
|
-
|
|
41
|
-
range: PropertyLocationRange | null
|
|
42
|
-
filepath: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* An component is either a component usage or a function usage
|
|
47
|
-
* @example an component name could be 'Button', 'css', 'panda.div', 'vstack', ...
|
|
48
|
-
*/
|
|
49
|
-
export interface ComponentReportItem extends Pick<PropertyReportItem, 'filepath'> {
|
|
50
|
-
componentIndex: string
|
|
51
|
-
componentName: string
|
|
52
|
-
reportItemType: ReportItemType
|
|
53
|
-
kind: ComponentKind
|
|
54
|
-
contains: Array<PropertyReportItem['index']>
|
|
55
|
-
value: Record<string, any>
|
|
56
|
-
range: PropertyLocationRange | null
|
|
57
|
-
debug?: boolean
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ReportDerivedMaps {
|
|
61
|
-
byComponentOfKind: Map<ComponentKind, Set<ComponentReportItem['componentIndex']>>
|
|
62
|
-
byPropertyName: Map<string, Set<PropertyReportItem['index']>>
|
|
63
|
-
byTokenType: Map<string, Set<PropertyReportItem['index']>>
|
|
64
|
-
byConditionName: Map<string, Set<PropertyReportItem['index']>>
|
|
65
|
-
byShorthand: Map<string, Set<PropertyReportItem['index']>>
|
|
66
|
-
byTokenName: Map<string, Set<PropertyReportItem['index']>>
|
|
67
|
-
byPropertyPath: Map<string, Set<PropertyReportItem['index']>>
|
|
68
|
-
fromKind: Map<ComponentKind, Set<PropertyReportItem['index']>>
|
|
69
|
-
byType: Map<string, Set<PropertyReportItem['index']>>
|
|
70
|
-
byComponentName: Map<string, Set<PropertyReportItem['index']>>
|
|
71
|
-
colorsUsed: Map<string, Set<PropertyReportItem['index']>>
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface ReportDerivedMapsJSON {
|
|
75
|
-
byComponentOfKind: Record<ComponentKind, Array<ComponentReportItem['componentIndex']>>
|
|
76
|
-
byPropertyName: Record<string, Array<PropertyReportItem['index']>>
|
|
77
|
-
byTokenType: Record<string, Array<PropertyReportItem['index']>>
|
|
78
|
-
byConditionName: Record<string, Array<PropertyReportItem['index']>>
|
|
79
|
-
byShorthand: Record<string, Array<PropertyReportItem['index']>>
|
|
80
|
-
byTokenName: Record<string, Array<PropertyReportItem['index']>>
|
|
81
|
-
byPropertyPath: Record<string, Array<PropertyReportItem['index']>>
|
|
82
|
-
fromKind: Record<ComponentKind, Array<PropertyReportItem['index']>>
|
|
83
|
-
byType: Record<string, Array<PropertyReportItem['index']>>
|
|
84
|
-
byComponentName: Record<string, Array<PropertyReportItem['index']>>
|
|
85
|
-
colorsUsed: Record<string, Array<PropertyReportItem['index']>>
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface ReportCounts {
|
|
89
|
-
filesWithTokens: number
|
|
90
|
-
propNameUsed: number
|
|
91
|
-
tokenUsed: number
|
|
92
|
-
shorthandUsed: number
|
|
93
|
-
propertyPathUsed: number
|
|
94
|
-
typeUsed: number
|
|
95
|
-
componentNameUsed: number
|
|
96
|
-
kindUsed: number
|
|
97
|
-
componentOfKindUsed: number
|
|
98
|
-
colorsUsed: number
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface MostUsedItem {
|
|
102
|
-
key: string
|
|
103
|
-
count: number
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface ReportStats {
|
|
107
|
-
filesWithMostComponent: Record<string, number>
|
|
108
|
-
mostUseds: {
|
|
109
|
-
propNames: Array<MostUsedItem>
|
|
110
|
-
tokens: Array<MostUsedItem>
|
|
111
|
-
shorthands: Array<MostUsedItem>
|
|
112
|
-
categories: Array<MostUsedItem>
|
|
113
|
-
conditions: Array<MostUsedItem>
|
|
114
|
-
propertyPaths: Array<MostUsedItem>
|
|
115
|
-
types: Array<MostUsedItem>
|
|
116
|
-
componentNames: Array<MostUsedItem>
|
|
117
|
-
fromKinds: Array<MostUsedItem>
|
|
118
|
-
componentOfKinds: Array<MostUsedItem>
|
|
119
|
-
colors: Array<MostUsedItem>
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface ReportDetails {
|
|
124
|
-
counts: ReportCounts
|
|
125
|
-
stats: ReportStats
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface AnalysisOptions {
|
|
129
|
-
onResult?: (file: string, result: ParserResultInterface) => void
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
interface ReportDerivedMap {
|
|
133
|
-
byFilepath: Map<string, Set<PropertyReportItem['index']>>
|
|
134
|
-
byComponentInFilepath: Map<string, Set<ComponentReportItem['componentIndex']>>
|
|
135
|
-
globalMaps: ReportDerivedMaps
|
|
136
|
-
byFilePathMaps: Map<string, ReportDerivedMaps>
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface ReportDerivedMapJSON {
|
|
140
|
-
byFilepath: Record<string, Array<PropertyReportItem['index']>>
|
|
141
|
-
byComponentInFilepath: Record<string, Array<ComponentReportItem['componentIndex']>>
|
|
142
|
-
globalMaps: ReportDerivedMapsJSON
|
|
143
|
-
byFilePathMaps: Record<string, ReportDerivedMapsJSON>
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface AnalysisReport {
|
|
147
|
-
schemaVersion: string
|
|
148
|
-
details: ReportDetails
|
|
149
|
-
|
|
150
|
-
propByIndex: Map<PropertyReportItem['index'], PropertyReportItem>
|
|
151
|
-
componentByIndex: Map<ComponentReportItem['componentIndex'], ComponentReportItem>
|
|
152
|
-
|
|
153
|
-
derived: ReportDerivedMap
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export interface ReportSnapshotJSON extends Omit<AnalysisReport, 'propByIndex' | 'componentByIndex' | 'derived'> {
|
|
157
|
-
propByIndex: Record<PropertyReportItem['index'], PropertyReportItem>
|
|
158
|
-
componentByIndex: Record<ComponentReportItem['componentIndex'], ComponentReportItem>
|
|
159
|
-
derived: ReportDerivedMapJSON
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface ClassifyReport {
|
|
163
|
-
propById: Map<string, PropertyReportItem>
|
|
164
|
-
componentById: Map<ComponentReportItem['componentIndex'], ComponentReportItem>
|
|
165
|
-
details: Pick<ReportDetails, 'counts' | 'stats'>
|
|
166
|
-
derived: ReportDerivedMap
|
|
167
|
-
}
|