@pikacss/core 0.0.30 → 0.0.32

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