@pikacss/core 0.0.42 → 0.0.44

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/index.d.cts DELETED
@@ -1,637 +0,0 @@
1
- import * as CSS from "csstype";
2
-
3
- //#region src/internal/plugins/important.d.ts
4
- interface ImportantConfig {
5
- default?: boolean;
6
- }
7
- declare module '@pikacss/core' {
8
- interface EngineConfig {
9
- important?: ImportantConfig;
10
- }
11
- }
12
- declare function important(): EnginePlugin;
13
- //#endregion
14
- //#region src/internal/resolver.d.ts
15
- interface ResolvedResult<T> {
16
- value: T;
17
- }
18
- interface StaticRule<T> {
19
- key: string;
20
- string: string;
21
- resolved: T;
22
- }
23
- interface DynamicRule<T> {
24
- key: string;
25
- stringPattern: RegExp;
26
- createResolved: (matched: RegExpMatchArray) => Awaitable<T>;
27
- }
28
- declare abstract class AbstractResolver<T> {
29
- _resolvedResultsMap: Map<string, ResolvedResult<T>>;
30
- staticRulesMap: Map<string, StaticRule<T>>;
31
- dynamicRulesMap: Map<string, DynamicRule<T>>;
32
- onResolved: (string: string, type: 'static' | 'dynamic', result: ResolvedResult<T>) => void;
33
- get staticRules(): StaticRule<T>[];
34
- get dynamicRules(): DynamicRule<T>[];
35
- addStaticRule(rule: StaticRule<T>): this;
36
- removeStaticRule(key: string): this;
37
- addDynamicRule(rule: DynamicRule<T>): this;
38
- removeDynamicRule(key: string): this;
39
- _resolve(string: string): Promise<ResolvedResult<T> | Nullish>;
40
- _setResolvedResult(string: string, resolved: T): void;
41
- }
42
- //#endregion
43
- //#region src/internal/plugins/selectors.d.ts
44
- type Selector = string | [selector: RegExp, value: (matched: RegExpMatchArray) => Awaitable<Arrayable<UnionString | ResolvedSelector>>, autocomplete?: Arrayable<string>] | [selector: string, value: Arrayable<UnionString | ResolvedSelector>] | {
45
- selector: RegExp;
46
- value: (matched: RegExpMatchArray) => Awaitable<Arrayable<UnionString | ResolvedSelector>>;
47
- autocomplete?: Arrayable<string>;
48
- } | {
49
- selector: string;
50
- value: Arrayable<UnionString | ResolvedSelector>;
51
- };
52
- interface SelectorsConfig {
53
- /**
54
- * Define custom selectors with support for dynamic and static selectors.
55
- *
56
- * @default []
57
- * @example
58
- * ```ts
59
- * {
60
- * selectors: [
61
- * // Static selector
62
- * ['hover', '$:hover'],
63
- * // Dynamic selector
64
- * [/^screen-(\d+)$/, m => `@media (min-width: ${m[1]}px)`,
65
- * ['screen-768', 'screen-1024']], // Autocomplete suggestions
66
- * ]
67
- * }
68
- * ```
69
- */
70
- selectors: Selector[];
71
- }
72
- declare module '@pikacss/core' {
73
- interface EngineConfig {
74
- selectors?: SelectorsConfig;
75
- }
76
- interface Engine {
77
- selectors: {
78
- resolver: SelectorResolver;
79
- add: (...list: Selector[]) => void;
80
- };
81
- }
82
- }
83
- declare function selectors$1(): EnginePlugin;
84
- type StaticSelectorRule = StaticRule<string[]>;
85
- type DynamicSelectorRule = DynamicRule<string[]>;
86
- declare class SelectorResolver extends AbstractResolver<string[]> {
87
- resolve(selector: string): Promise<string[]>;
88
- }
89
- type ResolvedSelectorConfig = {
90
- type: 'static';
91
- rule: StaticSelectorRule;
92
- autocomplete: string[];
93
- } | {
94
- type: 'dynamic';
95
- rule: DynamicSelectorRule;
96
- autocomplete: string[];
97
- };
98
- declare function resolveSelectorConfig(config: Selector): ResolvedSelectorConfig | string | Nullish;
99
- //#endregion
100
- //#region src/internal/plugins/shortcuts.d.ts
101
- type Shortcut = string | [shortcut: RegExp, value: (matched: RegExpMatchArray) => Awaitable<Arrayable<ResolvedStyleItem>>, autocomplete?: Arrayable<string>] | {
102
- shortcut: RegExp;
103
- value: (matched: RegExpMatchArray) => Awaitable<Arrayable<ResolvedStyleItem>>;
104
- autocomplete?: Arrayable<string>;
105
- } | [shortcut: string, value: Arrayable<ResolvedStyleItem>] | {
106
- shortcut: string;
107
- value: Arrayable<ResolvedStyleItem>;
108
- };
109
- interface ShortcutsConfig {
110
- /**
111
- * Define style shortcuts for reusable style combinations.
112
- *
113
- * @default []
114
- * @example
115
- * ```ts
116
- * {
117
- * shortcuts: [
118
- * // Static shortcut
119
- * ['flex-center', {
120
- * display: 'flex',
121
- * alignItems: 'center',
122
- * justifyContent: 'center'
123
- * }],
124
- * // Dynamic shortcut
125
- * [/^m-(\d+)$/, m => ({ margin: `${m[1]}px` }),
126
- * ['m-4', 'm-8']] // Autocomplete suggestions
127
- * ]
128
- * }
129
- * ```
130
- */
131
- shortcuts: Shortcut[];
132
- }
133
- declare module '@pikacss/core' {
134
- interface EngineConfig {
135
- shortcuts?: ShortcutsConfig;
136
- }
137
- interface Engine {
138
- shortcuts: {
139
- resolver: ShortcutResolver;
140
- add: (...list: Shortcut[]) => void;
141
- };
142
- }
143
- }
144
- declare function shortcuts(): EnginePlugin;
145
- declare class ShortcutResolver extends AbstractResolver<InternalStyleItem[]> {
146
- resolve(shortcut: string): Promise<InternalStyleItem[]>;
147
- }
148
- //#endregion
149
- //#region src/internal/plugins/variables.d.ts
150
- type ResolvedCSSProperty = keyof ResolvedCSSProperties;
151
- type ResolvedCSSVarProperty = ResolvedCSSProperty extends infer T ? T extends `--${string}` ? T : never : never;
152
- interface VariableAutocomplete {
153
- /**
154
- * Specify the properties that the variable can be used as a value of.
155
- *
156
- * @default ['*']
157
- */
158
- asValueOf?: Arrayable<UnionString | '*' | '-' | ResolvedCSSProperty>;
159
- /**
160
- * Whether to add the variable as a CSS property.
161
- *
162
- * @default true
163
- */
164
- asProperty?: boolean;
165
- }
166
- interface VariableObject {
167
- value?: ResolvedCSSProperties[`--${string}`];
168
- autocomplete?: VariableAutocomplete;
169
- pruneUnused?: boolean;
170
- }
171
- type Variable = ResolvedCSSProperties[`--${string}`] | VariableObject;
172
- type VariablesDefinition = { [key in UnionString | ResolvedSelector | (`--${string}` & {}) | ResolvedCSSVarProperty]?: Variable | VariablesDefinition };
173
- interface VariablesConfig {
174
- /**
175
- * Define CSS variables with support for static values and autocomplete configuration.
176
- *
177
- * @default {}
178
- * @example
179
- * ```ts
180
- * {
181
- * variables: {
182
- * // The variable with value "null" will not be included in the final CSS, but can be used in autocompletion.
183
- * '--external-var': null,
184
- *
185
- * '--color-bg': '#fff',
186
- * '--color-text': '#000',
187
- *
188
- * '[data-theme="dark"]': {
189
- * '--color-bg': '#000',
190
- * '--color-text': '#fff',
191
- * },
192
- * },
193
- * }
194
- * ```
195
- */
196
- variables: Arrayable<VariablesDefinition>;
197
- /**
198
- * Whether to prune unused variables from the final CSS.
199
- *
200
- * @default true
201
- */
202
- pruneUnused?: boolean;
203
- /**
204
- * A list of CSS variables that should always be included in the final CSS, you can use this to prevent certain variables from being pruned.
205
- *
206
- * @default []
207
- * @example
208
- * ```ts
209
- * {
210
- * variables: {
211
- * safeList: ['--external-var', '--color-bg', '--color-text'],
212
- * },
213
- * }
214
- * ```
215
- */
216
- safeList?: ((`--${string}` & {}) | ResolvedCSSVarProperty)[];
217
- }
218
- declare module '@pikacss/core' {
219
- interface EngineConfig {
220
- variables?: VariablesConfig;
221
- }
222
- interface Engine {
223
- variables: {
224
- store: Map<string, ResolvedVariable[]>;
225
- add: (variables: VariablesDefinition) => void;
226
- };
227
- }
228
- }
229
- declare function variables(): EnginePlugin;
230
- interface ResolvedVariable {
231
- name: string;
232
- value: InternalPropertyValue;
233
- selector: string[];
234
- pruneUnused: boolean;
235
- autocomplete: {
236
- asValueOf: string[];
237
- asProperty: boolean;
238
- };
239
- }
240
- declare function extractUsedVarNames(input: string): string[];
241
- declare function normalizeVariableName(name: string): string;
242
- //#endregion
243
- //#region src/internal/types/utils.d.ts
244
- type Nullish = null | undefined;
245
- type UnionString = string & {};
246
- type UnionNumber = number & {};
247
- type Arrayable<T> = T | T[];
248
- type Awaitable<T> = T | Promise<T>;
249
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
250
- type IsEqual<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
251
- type IsNever<T> = [T] extends [never] ? true : false;
252
- type Simplify<T> = { [K in keyof T]: T[K] } & {};
253
- type ToKebab<T extends string> = T extends `${infer A}${infer B}` ? [A extends Uppercase<A> ? 1 : 0, A extends Lowercase<A> ? 1 : 0] extends [1, 0] ? `-${Lowercase<A>}${ToKebab<`${B}`>}` : `${A}${ToKebab<`${B}`>}` : T;
254
- type FromKebab<T extends string> = T extends `--${string}` ? T : T extends `-${infer A}${infer B}` ? `${Uppercase<A>}${FromKebab<`${B}`>}` : T extends `${infer A}${infer B}` ? `${A}${FromKebab<`${B}`>}` : T;
255
- type GetValue<Obj extends Record<string, any>, K$1 extends string> = (IsEqual<Obj, object> | IsEqual<Obj, {}> | IsEqual<Obj[K$1], unknown>) extends false ? Obj[K$1] : never;
256
- type ResolveFrom<T, Key$1 extends string, I, Fallback extends I> = Key$1 extends keyof T ? T[Key$1] extends I ? T[Key$1] : Fallback : Fallback;
257
- //#endregion
258
- //#region src/internal/types/autocomplete.d.ts
259
- interface ResolvedAutocompleteConfig {
260
- selectors: Set<string>;
261
- styleItemStrings: Set<string>;
262
- extraProperties: Set<string>;
263
- extraCssProperties: Set<string>;
264
- properties: Map<string, string[]>;
265
- cssProperties: Map<string, (string | number)[]>;
266
- }
267
- interface _Autocomplete {
268
- Selector: UnionString;
269
- StyleItemString: UnionString;
270
- ExtraProperty: UnionString;
271
- ExtraCssProperty: UnionString;
272
- Layer: UnionString;
273
- PropertiesValue: Record<string, unknown>;
274
- CssPropertiesValue: Record<string, UnionString | UnionNumber>;
275
- }
276
- type DefineAutocomplete<A$1 extends _Autocomplete> = A$1;
277
- type EmptyAutocomplete = DefineAutocomplete<{
278
- Selector: never;
279
- StyleItemString: never;
280
- ExtraProperty: never;
281
- ExtraCssProperty: never;
282
- Layer: never;
283
- PropertiesValue: never;
284
- CssPropertiesValue: never;
285
- }>;
286
- //#endregion
287
- //#region src/internal/extractor.d.ts
288
- type ExtractFn = (styleDefinition: InternalStyleDefinition) => Promise<ExtractedStyleContent[]>;
289
- //#endregion
290
- //#region src/internal/engine.d.ts
291
- declare function createEngine(config?: EngineConfig$1): Promise<Engine>;
292
- declare class Engine {
293
- config: ResolvedEngineConfig;
294
- pluginHooks: {
295
- configureRawConfig: (plugins: EnginePlugin[], payload: EngineConfig$1) => Promise<EngineConfig$1>;
296
- rawConfigConfigured: (plugins: EnginePlugin[], payload: EngineConfig$1) => void;
297
- configureResolvedConfig: (plugins: EnginePlugin[], payload: ResolvedEngineConfig) => Promise<ResolvedEngineConfig>;
298
- configureEngine: (plugins: EnginePlugin[], payload: Engine) => Promise<Engine>;
299
- transformSelectors: (plugins: EnginePlugin[], payload: string[]) => Promise<string[]>;
300
- transformStyleItems: (plugins: EnginePlugin[], payload: StyleItem[]) => Promise<StyleItem[]>;
301
- transformStyleDefinitions: (plugins: EnginePlugin[], payload: StyleDefinition[]) => Promise<StyleDefinition[]>;
302
- preflightUpdated: (plugins: EnginePlugin[]) => void;
303
- atomicStyleAdded: (plugins: EnginePlugin[], payload: AtomicStyle) => AtomicStyle;
304
- autocompleteConfigUpdated: (plugins: EnginePlugin[]) => void;
305
- };
306
- extract: ExtractFn;
307
- store: {
308
- atomicStyleIds: Map<string, string>;
309
- atomicStyles: Map<string, AtomicStyle>;
310
- };
311
- constructor(config: ResolvedEngineConfig);
312
- notifyPreflightUpdated(): void;
313
- notifyAtomicStyleAdded(atomicStyle: AtomicStyle): void;
314
- notifyAutocompleteConfigUpdated(): void;
315
- appendAutocompleteSelectors(...selectors: string[]): void;
316
- appendAutocompleteStyleItemStrings(...styleItemStrings: string[]): void;
317
- appendAutocompleteExtraProperties(...properties: string[]): void;
318
- appendAutocompleteExtraCssProperties(...properties: string[]): void;
319
- appendAutocompletePropertyValues(property: string, ...tsTypes: string[]): void;
320
- appendAutocompleteCssPropertyValues(property: string, ...values: (string | number)[]): void;
321
- addPreflight(preflight: Preflight): void;
322
- use(...itemList: InternalStyleItem[]): Promise<string[]>;
323
- renderPreflights(isFormatted: boolean): Promise<string>;
324
- renderAtomicStyles(isFormatted: boolean, options?: {
325
- atomicStyleIds?: string[];
326
- isPreview?: boolean;
327
- }): Promise<string>;
328
- renderLayerOrderDeclaration(): string;
329
- }
330
- declare function sortLayerNames(layers: Record<string, number>): string[];
331
- //#endregion
332
- //#region src/internal/plugin.d.ts
333
- type DefineHooks<Hooks extends Record<string, [type: 'sync' | 'async', payload: any, returnValue?: any]>> = Hooks;
334
- type EngineHooksDefinition = DefineHooks<{
335
- configureRawConfig: ['async', config: EngineConfig$1];
336
- rawConfigConfigured: ['sync', config: EngineConfig$1, void];
337
- configureResolvedConfig: ['async', resolvedConfig: ResolvedEngineConfig];
338
- configureEngine: ['async', engine: Engine];
339
- transformSelectors: ['async', selectors: string[]];
340
- transformStyleItems: ['async', styleItems: ResolvedStyleItem[]];
341
- transformStyleDefinitions: ['async', styleDefinitions: ResolvedStyleDefinition[]];
342
- preflightUpdated: ['sync', void];
343
- atomicStyleAdded: ['sync', AtomicStyle];
344
- autocompleteConfigUpdated: ['sync', void];
345
- }>;
346
- type EnginePluginHooksOptions = { [K in keyof EngineHooksDefinition]?: EngineHooksDefinition[K][0] extends 'async' ? (...params: EngineHooksDefinition[K][1] extends void ? [] : [payload: EngineHooksDefinition[K][1]]) => Awaitable<EngineHooksDefinition[K][1] | void> : (...params: EngineHooksDefinition[K][1] extends void ? [] : [payload: EngineHooksDefinition[K][1]]) => EngineHooksDefinition[K][1] | void };
347
- interface EnginePlugin extends EnginePluginHooksOptions {
348
- name: string;
349
- order?: 'pre' | 'post';
350
- }
351
- declare function defineEnginePlugin(plugin: EnginePlugin): EnginePlugin;
352
- //#endregion
353
- //#region src/types.d.ts
354
- interface CSSVariables {
355
- [K: (`--${string}` & {})]: UnionString | UnionNumber;
356
- }
357
- interface CSSProperties extends CSS.Properties, CSS.PropertiesHyphen, CSSVariables {}
358
- type CSSProperty = keyof CSSProperties;
359
- type PropertyValue<T> = T | [value: T, fallback: T[]] | Nullish;
360
- type Properties_CSS = { [Key in keyof CSSProperties]?: PropertyValue<Exclude<UnionString | UnionNumber | GetValue<CSSProperties, Key> | GetValue<ResolvedAutocomplete['CssPropertiesValue'], ToKebab<Key>> | GetValue<ResolvedAutocomplete['CssPropertiesValue'], FromKebab<Key>> | GetValue<ResolvedAutocomplete['CssPropertiesValue'], '*'>, Nullish>> };
361
- type Properties_ExtraCSS = { [Key in keyof ResolvedAutocomplete['ExtraCssProperty']]?: PropertyValue<Exclude<UnionString | UnionNumber | GetValue<CSSProperties, Key & string> | GetValue<ResolvedAutocomplete['CssPropertiesValue'], ToKebab<Key & string>> | GetValue<ResolvedAutocomplete['CssPropertiesValue'], FromKebab<Key & string>> | GetValue<ResolvedAutocomplete['CssPropertiesValue'], '*'>, Nullish>> };
362
- type Properties_Extra = { [Key in ResolvedAutocomplete['ExtraProperty']]?: GetValue<ResolvedAutocomplete['PropertiesValue'], Key & string> };
363
- interface Properties extends Properties_CSS, Properties_ExtraCSS, Properties_Extra {}
364
- type CSSPseudos = `${'$'}${CSS.Pseudos}`;
365
- type CSSBlockAtRules = Exclude<CSS.AtRules, '@charset' | 'import' | '@namespace'>;
366
- type CSSSelector = CSSBlockAtRules | CSSPseudos;
367
- type Selector$1 = UnionString | ResolvedAutocomplete['Selector'] | CSSSelector;
368
- type StyleDefinition = Properties | { [K in Selector$1]?: Properties | StyleDefinition | StyleItem[] };
369
- type StyleItem = UnionString | ResolvedAutocomplete['StyleItemString'] | StyleDefinition;
370
- //#endregion
371
- //#region src/internal/types/shared.d.ts
372
- interface PikaAugment {}
373
- type InternalPropertyValue = PropertyValue<string | number>;
374
- type InternalProperties = Properties;
375
- type InternalStyleDefinition = StyleDefinition;
376
- type InternalStyleItem = StyleItem;
377
- interface ExtractedStyleContent {
378
- selector: string[];
379
- property: string;
380
- value: string[] | Nullish;
381
- layer?: string;
382
- }
383
- interface StyleContent {
384
- selector: string[];
385
- property: string;
386
- value: string[];
387
- layer?: string;
388
- }
389
- interface AtomicStyle {
390
- id: string;
391
- content: StyleContent;
392
- }
393
- interface CSSStyleBlockBody {
394
- properties: {
395
- property: string;
396
- value: string;
397
- }[];
398
- children?: CSSStyleBlocks;
399
- }
400
- type CSSStyleBlocks = Map<string, CSSStyleBlockBody>;
401
- //#endregion
402
- //#region src/internal/types/resolved.d.ts
403
- type ResolvedAutocomplete = ResolveFrom<PikaAugment, 'Autocomplete', _Autocomplete, EmptyAutocomplete>;
404
- type ResolvedLayerName = IsNever<ResolvedAutocomplete['Layer']> extends true ? UnionString : ResolvedAutocomplete['Layer'];
405
- type ResolvedSelector = ResolveFrom<PikaAugment, 'Selector', string, string>;
406
- type ResolvedProperties = ResolveFrom<PikaAugment, 'Properties', any, InternalProperties>;
407
- type ResolvedCSSProperties = Omit<ResolvedProperties, ResolvedAutocomplete['ExtraProperty']>;
408
- type ResolvedStyleDefinition = ResolveFrom<PikaAugment, 'StyleDefinition', any, InternalStyleDefinition>;
409
- type ResolvedStyleItem = ResolveFrom<PikaAugment, 'StyleItem', any, InternalStyleItem>;
410
- //#endregion
411
- //#region src/internal/types/preflight.d.ts
412
- type PreflightDefinition = { [selector in UnionString | ResolvedSelector]?: ResolvedCSSProperties | PreflightDefinition };
413
- type PreflightFn = (engine: Engine, isFormatted: boolean) => Awaitable<string | PreflightDefinition>;
414
- interface WithLayer<T extends string | PreflightDefinition | PreflightFn> {
415
- layer: string;
416
- preflight: T;
417
- }
418
- interface ResolvedPreflight {
419
- layer?: string;
420
- fn: PreflightFn;
421
- }
422
- /**
423
- * Preflight can be a string, object, function, or a layer-wrapped variant.
424
- *
425
- * 1. A `string` is a static preflight style injected verbatim.
426
- * 2. A `PreflightDefinition` is a JS object describing CSS rules.
427
- * 3. A `PreflightFn` is a dynamic preflight that receives the engine instance.
428
- * 4. A `WithLayer` wrapper assigns any of the above to a specific CSS `@layer`.
429
- */
430
- type Preflight = string | PreflightDefinition | PreflightFn | WithLayer<string | PreflightDefinition | PreflightFn>;
431
- //#endregion
432
- //#region src/internal/types/engine.d.ts
433
- interface EngineConfig$1 {
434
- /**
435
- * Register plugins to extend PikaCSS functionality.
436
- *
437
- * @example
438
- * ```ts
439
- * {
440
- * plugins: [
441
- * icons(), // Add icon support
442
- * customPlugin() // Custom plugin
443
- * ]
444
- * }
445
- * ```
446
- */
447
- plugins?: EnginePlugin[];
448
- /**
449
- * Set the prefix for generated atomic style id.
450
- *
451
- * @default ''
452
- * @example
453
- * ```ts
454
- * {
455
- * prefix: 'pika-' // Generated atomic id will be 'pika-xxx'
456
- * }
457
- * ```
458
- */
459
- prefix?: string;
460
- /**
461
- * Set the default selector format. '%' will be replaced with the atomic style id.
462
- *
463
- * @default '.%'
464
- * @example
465
- * ```ts
466
- * {
467
- * defaultSelector: '.%' // Use with class attribute: <div class="a b c">
468
- * // or
469
- * defaultSelector: '[data-pika~="%"]' // Use with attribute selector: <div data-pika="a b c">
470
- * }
471
- * ```
472
- */
473
- defaultSelector?: string;
474
- /**
475
- * Define global CSS styles that will be injected before atomic styles.
476
- * Can be used for CSS variables, global animations, base styles, etc.
477
- *
478
- * @default []
479
- * @example
480
- * ```ts
481
- * {
482
- * preflights: [
483
- * // Use CSS string directly
484
- * ':root { --color: blue }',
485
- * // Or use function to generate dynamically
486
- * (engine) => ':root { --theme: dark }'
487
- * ]
488
- * }
489
- * ```
490
- */
491
- preflights?: Preflight[];
492
- /**
493
- * Configure CSS @layer order. Keys are layer names, values are order numbers (lower = earlier).
494
- * Merged on top of the default layers `{ preflights: 1, utilities: 10 }`, so any keys not
495
- * specified here will keep their default order values.
496
- *
497
- * @default { preflights: 1, utilities: 10 }
498
- * @example
499
- * ```ts
500
- * {
501
- * layers: { base: 0, components: 5, utilities: 10 }
502
- * }
503
- * ```
504
- */
505
- layers?: Record<string, number>;
506
- /**
507
- * The layer name that unlayered preflights are automatically wrapped into.
508
- *
509
- * @default 'preflights'
510
- */
511
- defaultPreflightsLayer?: string;
512
- /**
513
- * The layer name that atomic styles without an explicit `__layer` are placed into.
514
- *
515
- * @default 'utilities'
516
- */
517
- defaultUtilitiesLayer?: string;
518
- }
519
- interface ResolvedEngineConfig {
520
- rawConfig: EngineConfig$1;
521
- prefix: string;
522
- defaultSelector: string;
523
- plugins: EnginePlugin[];
524
- preflights: ResolvedPreflight[];
525
- autocomplete: ResolvedAutocompleteConfig;
526
- /** Always contains at least the default layers (`preflights` and `utilities`). */
527
- layers: Record<string, number>;
528
- defaultPreflightsLayer: string;
529
- defaultUtilitiesLayer: string;
530
- }
531
- //#endregion
532
- //#region src/internal/plugins/keyframes.d.ts
533
- interface KeyframesProgress {
534
- from?: ResolvedProperties;
535
- to?: ResolvedProperties;
536
- [K: `${number}%`]: ResolvedProperties;
537
- }
538
- type Keyframes = string | [name: string, frames?: KeyframesProgress, autocomplete?: string[], pruneUnused?: boolean] | {
539
- name: string;
540
- frames?: KeyframesProgress;
541
- autocomplete?: string[];
542
- pruneUnused?: boolean;
543
- };
544
- interface KeyframesConfig {
545
- /**
546
- * Define CSS @keyframes animations with support for frame definitions
547
- * and autocomplete suggestions.
548
- *
549
- * @default []
550
- * @example
551
- * ```ts
552
- * {
553
- * keyframes: [
554
- * // Basic animation
555
- * ['fade', {
556
- * from: { opacity: 0 },
557
- * to: { opacity: 1 }
558
- * }],
559
- * // With autocomplete suggestions
560
- * ['slide', {
561
- * from: { transform: 'translateX(-100%)' },
562
- * to: { transform: 'translateX(0)' }
563
- * }, ['slide 0.3s ease']]
564
- * ]
565
- * }
566
- * ```
567
- */
568
- keyframes: Keyframes[];
569
- /**
570
- * Whether to prune unused keyframes from the final CSS.
571
- *
572
- * @default true
573
- */
574
- pruneUnused?: boolean;
575
- }
576
- declare module '@pikacss/core' {
577
- interface EngineConfig {
578
- keyframes?: KeyframesConfig;
579
- }
580
- interface Engine {
581
- keyframes: {
582
- store: Map<string, ResolvedKeyframesConfig>;
583
- add: (...list: Keyframes[]) => void;
584
- };
585
- }
586
- }
587
- declare function keyframes(): EnginePlugin;
588
- interface ResolvedKeyframesConfig {
589
- name: string;
590
- frames: KeyframesProgress | Nullish;
591
- pruneUnused: boolean;
592
- autocomplete: string[];
593
- }
594
- //#endregion
595
- //#region src/internal/utils.d.ts
596
- declare function createLogger(prefix: string): {
597
- debug: (...args: any[]) => void;
598
- info: (...args: any[]) => void;
599
- warn: (...args: any[]) => void;
600
- error: (...args: any[]) => void;
601
- toggleDebug: () => void;
602
- setPrefix: (newPrefix: string) => void;
603
- setDebugFn: (fn: (prefix: string, ...args: any[]) => void) => void;
604
- setInfoFn: (fn: (prefix: string, ...args: any[]) => void) => void;
605
- setWarnFn: (fn: (prefix: string, ...args: any[]) => void) => void;
606
- setErrorFn: (fn: (prefix: string, ...args: any[]) => void) => void;
607
- };
608
- declare const log: {
609
- debug: (...args: any[]) => void;
610
- info: (...args: any[]) => void;
611
- warn: (...args: any[]) => void;
612
- error: (...args: any[]) => void;
613
- toggleDebug: () => void;
614
- setPrefix: (newPrefix: string) => void;
615
- setDebugFn: (fn: (prefix: string, ...args: any[]) => void) => void;
616
- setInfoFn: (fn: (prefix: string, ...args: any[]) => void) => void;
617
- setWarnFn: (fn: (prefix: string, ...args: any[]) => void) => void;
618
- setErrorFn: (fn: (prefix: string, ...args: any[]) => void) => void;
619
- };
620
- declare function appendAutocompleteSelectors(config: Pick<ResolvedEngineConfig, 'autocomplete'>, ...selectors: string[]): void;
621
- declare function appendAutocompleteStyleItemStrings(config: Pick<ResolvedEngineConfig, 'autocomplete'>, ...styleItemStrings: string[]): void;
622
- declare function appendAutocompleteExtraProperties(config: Pick<ResolvedEngineConfig, 'autocomplete'>, ...properties: string[]): void;
623
- declare function appendAutocompleteExtraCssProperties(config: Pick<ResolvedEngineConfig, 'autocomplete'>, ...properties: string[]): void;
624
- declare function appendAutocompletePropertyValues(config: Pick<ResolvedEngineConfig, 'autocomplete'>, property: string, ...tsTypes: string[]): void;
625
- declare function appendAutocompleteCssPropertyValues(config: Pick<ResolvedEngineConfig, 'autocomplete'>, property: string, ...values: (string | number)[]): void;
626
- declare function renderCSSStyleBlocks(blocks: CSSStyleBlocks, isFormatted: boolean, depth?: number): string;
627
- //#endregion
628
- //#region src/index.d.ts
629
- declare function defineEngineConfig(config: EngineConfig): EngineConfig;
630
- declare function defineStyleDefinition(styleDefinition: StyleDefinition): StyleDefinition;
631
- declare function definePreflight(preflight: Preflight): Preflight;
632
- declare function defineKeyframes(keyframes: Keyframes): Keyframes;
633
- declare function defineSelector(selector: Selector): Selector;
634
- declare function defineShortcut(shortcut: Shortcut): Shortcut;
635
- declare function defineVariables(variables: VariablesDefinition): VariablesDefinition;
636
- //#endregion
637
- export { Arrayable, Awaitable, type CSSProperty, type CSSSelector, type CSSStyleBlockBody, type CSSStyleBlocks, type DefineAutocomplete, type Engine, type EngineConfig$1 as EngineConfig, type EnginePlugin, FromKebab, GetValue, IsEqual, IsNever, Keyframes, KeyframesConfig, KeyframesProgress, Nullish, type PikaAugment, type Preflight, type PreflightDefinition, type PreflightFn, type Properties, ResolveFrom, type ResolvedLayerName, type ResolvedPreflight, Selector, SelectorsConfig, Shortcut, ShortcutsConfig, Simplify, type StyleDefinition, type StyleItem, ToKebab, UnionNumber, UnionString, UnionToIntersection, Variable, VariableAutocomplete, VariableObject, VariablesConfig, VariablesDefinition, type WithLayer, appendAutocompleteCssPropertyValues, appendAutocompleteExtraCssProperties, appendAutocompleteExtraProperties, appendAutocompletePropertyValues, appendAutocompleteSelectors, appendAutocompleteStyleItemStrings, createEngine, createLogger, defineEngineConfig, defineEnginePlugin, defineKeyframes, definePreflight, defineSelector, defineShortcut, defineStyleDefinition, defineVariables, extractUsedVarNames, important, keyframes, log, normalizeVariableName, renderCSSStyleBlocks, resolveSelectorConfig, selectors$1 as selectors, shortcuts, sortLayerNames, variables };