@pikacss/core 0.0.35 → 0.0.37

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.cjs CHANGED
@@ -119,6 +119,14 @@ function renderCSSStyleBlocks(blocks, isFormatted, depth = 0) {
119
119
  });
120
120
  return lines.join(lineEnd);
121
121
  }
122
+ /* c8 ignore start */
123
+ function defineEngineConfig(config) {
124
+ return config;
125
+ }
126
+ function definePreflight(preflight) {
127
+ return preflight;
128
+ }
129
+ /* c8 ignore end */
122
130
 
123
131
  //#endregion
124
132
  //#region src/internal/extractor.ts
@@ -348,6 +356,11 @@ function createResolveConfigFn({ pruneUnused: defaultPruneUnused = true } = {})
348
356
  };
349
357
  };
350
358
  }
359
+ /* c8 ignore start */
360
+ function defineKeyframes(keyframes$1) {
361
+ return keyframes$1;
362
+ }
363
+ /* c8 ignore end */
351
364
 
352
365
  //#endregion
353
366
  //#region src/internal/resolver.ts
@@ -540,6 +553,11 @@ function resolveSelectorConfig(config) {
540
553
  };
541
554
  }
542
555
  }
556
+ /* c8 ignore start */
557
+ function defineSelector(selector) {
558
+ return selector;
559
+ }
560
+ /* c8 ignore end */
543
561
 
544
562
  //#endregion
545
563
  //#region src/internal/plugins/shortcuts.ts
@@ -662,6 +680,11 @@ function resolveShortcutConfig(config) {
662
680
  };
663
681
  }
664
682
  }
683
+ /* c8 ignore start */
684
+ function defineShortcut(shortcut) {
685
+ return shortcut;
686
+ }
687
+ /* c8 ignore end */
665
688
 
666
689
  //#endregion
667
690
  //#region src/internal/plugins/variables.ts
@@ -673,7 +696,7 @@ function variables() {
673
696
  name: "core:variables",
674
697
  rawConfigConfigured(config) {
675
698
  resolveVariables = createResolveVariablesFn({ pruneUnused: config.variables?.pruneUnused });
676
- rawVariables = config.variables?.variables ?? {};
699
+ rawVariables = [config.variables?.variables ?? []].flat();
677
700
  safeSet = new Set(config.variables?.safeList ?? []);
678
701
  },
679
702
  configureEngine(engine) {
@@ -695,7 +718,7 @@ function variables() {
695
718
  engine.notifyPreflightUpdated();
696
719
  }
697
720
  };
698
- engine.variables.add(rawVariables);
721
+ rawVariables.forEach((variables$1) => engine.variables.add(variables$1));
699
722
  engine.addPreflight(async (engine$1) => {
700
723
  const used = /* @__PURE__ */ new Set();
701
724
  engine$1.store.atomicStyles.forEach(({ content: { value } }) => {
@@ -751,14 +774,14 @@ function normalizeVariableName(name) {
751
774
  if (name.startsWith("--")) return name;
752
775
  return `--${name}`;
753
776
  }
754
-
755
- //#endregion
756
- //#region src/internal/engine.ts
757
777
  /* c8 ignore start */
758
- function defineEngineConfig(config) {
759
- return config;
778
+ function defineVariables(variables$1) {
779
+ return variables$1;
760
780
  }
761
781
  /* c8 ignore end */
782
+
783
+ //#endregion
784
+ //#region src/internal/engine.ts
762
785
  async function createEngine(config = {}) {
763
786
  log.debug("Creating engine with config:", config);
764
787
  const corePlugins = [
@@ -1047,5 +1070,10 @@ exports.createEngine = createEngine;
1047
1070
  exports.createLogger = createLogger;
1048
1071
  exports.defineEngineConfig = defineEngineConfig;
1049
1072
  exports.defineEnginePlugin = defineEnginePlugin;
1073
+ exports.defineKeyframes = defineKeyframes;
1074
+ exports.definePreflight = definePreflight;
1075
+ exports.defineSelector = defineSelector;
1076
+ exports.defineShortcut = defineShortcut;
1077
+ exports.defineVariables = defineVariables;
1050
1078
  exports.log = log;
1051
1079
  exports.renderCSSStyleBlocks = renderCSSStyleBlocks;
package/dist/index.d.cts CHANGED
@@ -71,6 +71,7 @@ interface ResolvedKeyframesConfig {
71
71
  pruneUnused: boolean;
72
72
  autocomplete: string[];
73
73
  }
74
+ declare function defineKeyframes(keyframes: Keyframes): Keyframes;
74
75
  //#endregion
75
76
  //#region src/internal/resolver.d.ts
76
77
  interface ResolvedResult<T$1> {
@@ -144,6 +145,7 @@ declare module '@pikacss/core' {
144
145
  declare class SelectorResolver extends AbstractResolver<string[]> {
145
146
  resolve(selector: string): Promise<string[]>;
146
147
  }
148
+ declare function defineSelector(selector: Selector): Selector;
147
149
  //#endregion
148
150
  //#region src/internal/plugins/shortcuts.d.ts
149
151
  type Shortcut = string | [shortcut: RegExp, value: (matched: RegExpMatchArray) => Awaitable<Arrayable<ResolvedStyleItem>>, autocomplete?: Arrayable<string>] | {
@@ -192,6 +194,7 @@ declare module '@pikacss/core' {
192
194
  declare class ShortcutResolver extends AbstractResolver<StyleItem$1[]> {
193
195
  resolve(shortcut: string): Promise<StyleItem$1[]>;
194
196
  }
197
+ declare function defineShortcut(shortcut: Shortcut): Shortcut;
195
198
  //#endregion
196
199
  //#region src/internal/plugins/variables.d.ts
197
200
  type ResolvedCSSProperty = keyof ResolvedCSSProperties;
@@ -240,7 +243,7 @@ interface VariablesConfig {
240
243
  * }
241
244
  * ```
242
245
  */
243
- variables: VariablesDefinition;
246
+ variables: Arrayable<VariablesDefinition>;
244
247
  /**
245
248
  * Whether to prune unused variables from the final CSS.
246
249
  *
@@ -283,6 +286,7 @@ interface ResolvedVariable {
283
286
  asProperty: boolean;
284
287
  };
285
288
  }
289
+ declare function defineVariables(variables: VariablesDefinition): VariablesDefinition;
286
290
  //#endregion
287
291
  //#region src/internal/types/utils.d.ts
288
292
  type Nullish = null | undefined;
@@ -471,7 +475,6 @@ interface ResolvedEngineConfig {
471
475
  type ExtractFn = (styleDefinition: StyleDefinition$1) => Promise<ExtractedStyleContent[]>;
472
476
  //#endregion
473
477
  //#region src/internal/engine.d.ts
474
- declare function defineEngineConfig(config: EngineConfig): EngineConfig;
475
478
  declare function createEngine(config?: EngineConfig): Promise<Engine>;
476
479
  declare class Engine {
477
480
  config: ResolvedEngineConfig;
@@ -543,6 +546,8 @@ declare function appendAutocompleteExtraCssProperties(config: Pick<ResolvedEngin
543
546
  declare function appendAutocompletePropertyValues(config: Pick<ResolvedEngineConfig, 'autocomplete'>, property: string, ...tsTypes: string[]): void;
544
547
  declare function appendAutocompleteCssPropertyValues(config: Pick<ResolvedEngineConfig, 'autocomplete'>, property: string, ...values: (string | number)[]): void;
545
548
  declare function renderCSSStyleBlocks(blocks: CSSStyleBlocks, isFormatted: boolean, depth?: number): string;
549
+ declare function defineEngineConfig(config: EngineConfig): EngineConfig;
550
+ declare function definePreflight(preflight: Preflight): Preflight;
546
551
  //#endregion
547
552
  //#region src/types.d.ts
548
553
  interface CSSVariables {
@@ -560,4 +565,4 @@ type MakeStyleDefinition<MaxDepth extends number, Tuple extends any[] = []> = Tu
560
565
  type StyleDefinition = MakeStyleDefinition<5>;
561
566
  type StyleItem = UnionString | ResolvedAutocomplete['StyleItemString'] | StyleDefinition;
562
567
  //#endregion
563
- 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, createLogger, defineEngineConfig, defineEnginePlugin, log, renderCSSStyleBlocks };
568
+ 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, createLogger, defineEngineConfig, defineEnginePlugin, defineKeyframes, definePreflight, defineSelector, defineShortcut, defineVariables, log, renderCSSStyleBlocks };
package/dist/index.d.mts CHANGED
@@ -71,6 +71,7 @@ interface ResolvedKeyframesConfig {
71
71
  pruneUnused: boolean;
72
72
  autocomplete: string[];
73
73
  }
74
+ declare function defineKeyframes(keyframes: Keyframes): Keyframes;
74
75
  //#endregion
75
76
  //#region src/internal/resolver.d.ts
76
77
  interface ResolvedResult<T$1> {
@@ -144,6 +145,7 @@ declare module '@pikacss/core' {
144
145
  declare class SelectorResolver extends AbstractResolver<string[]> {
145
146
  resolve(selector: string): Promise<string[]>;
146
147
  }
148
+ declare function defineSelector(selector: Selector): Selector;
147
149
  //#endregion
148
150
  //#region src/internal/plugins/shortcuts.d.ts
149
151
  type Shortcut = string | [shortcut: RegExp, value: (matched: RegExpMatchArray) => Awaitable<Arrayable<ResolvedStyleItem>>, autocomplete?: Arrayable<string>] | {
@@ -192,6 +194,7 @@ declare module '@pikacss/core' {
192
194
  declare class ShortcutResolver extends AbstractResolver<StyleItem$1[]> {
193
195
  resolve(shortcut: string): Promise<StyleItem$1[]>;
194
196
  }
197
+ declare function defineShortcut(shortcut: Shortcut): Shortcut;
195
198
  //#endregion
196
199
  //#region src/internal/plugins/variables.d.ts
197
200
  type ResolvedCSSProperty = keyof ResolvedCSSProperties;
@@ -240,7 +243,7 @@ interface VariablesConfig {
240
243
  * }
241
244
  * ```
242
245
  */
243
- variables: VariablesDefinition;
246
+ variables: Arrayable<VariablesDefinition>;
244
247
  /**
245
248
  * Whether to prune unused variables from the final CSS.
246
249
  *
@@ -283,6 +286,7 @@ interface ResolvedVariable {
283
286
  asProperty: boolean;
284
287
  };
285
288
  }
289
+ declare function defineVariables(variables: VariablesDefinition): VariablesDefinition;
286
290
  //#endregion
287
291
  //#region src/internal/types/utils.d.ts
288
292
  type Nullish = null | undefined;
@@ -471,7 +475,6 @@ interface ResolvedEngineConfig {
471
475
  type ExtractFn = (styleDefinition: StyleDefinition$1) => Promise<ExtractedStyleContent[]>;
472
476
  //#endregion
473
477
  //#region src/internal/engine.d.ts
474
- declare function defineEngineConfig(config: EngineConfig): EngineConfig;
475
478
  declare function createEngine(config?: EngineConfig): Promise<Engine>;
476
479
  declare class Engine {
477
480
  config: ResolvedEngineConfig;
@@ -543,6 +546,8 @@ declare function appendAutocompleteExtraCssProperties(config: Pick<ResolvedEngin
543
546
  declare function appendAutocompletePropertyValues(config: Pick<ResolvedEngineConfig, 'autocomplete'>, property: string, ...tsTypes: string[]): void;
544
547
  declare function appendAutocompleteCssPropertyValues(config: Pick<ResolvedEngineConfig, 'autocomplete'>, property: string, ...values: (string | number)[]): void;
545
548
  declare function renderCSSStyleBlocks(blocks: CSSStyleBlocks, isFormatted: boolean, depth?: number): string;
549
+ declare function defineEngineConfig(config: EngineConfig): EngineConfig;
550
+ declare function definePreflight(preflight: Preflight): Preflight;
546
551
  //#endregion
547
552
  //#region src/types.d.ts
548
553
  interface CSSVariables {
@@ -560,4 +565,4 @@ type MakeStyleDefinition<MaxDepth extends number, Tuple extends any[] = []> = Tu
560
565
  type StyleDefinition = MakeStyleDefinition<5>;
561
566
  type StyleItem = UnionString | ResolvedAutocomplete['StyleItemString'] | StyleDefinition;
562
567
  //#endregion
563
- 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, createLogger, defineEngineConfig, defineEnginePlugin, log, renderCSSStyleBlocks };
568
+ 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, createLogger, defineEngineConfig, defineEnginePlugin, defineKeyframes, definePreflight, defineSelector, defineShortcut, defineVariables, log, renderCSSStyleBlocks };
package/dist/index.mjs CHANGED
@@ -118,6 +118,14 @@ function renderCSSStyleBlocks(blocks, isFormatted, depth = 0) {
118
118
  });
119
119
  return lines.join(lineEnd);
120
120
  }
121
+ /* c8 ignore start */
122
+ function defineEngineConfig(config) {
123
+ return config;
124
+ }
125
+ function definePreflight(preflight) {
126
+ return preflight;
127
+ }
128
+ /* c8 ignore end */
121
129
 
122
130
  //#endregion
123
131
  //#region src/internal/extractor.ts
@@ -347,6 +355,11 @@ function createResolveConfigFn({ pruneUnused: defaultPruneUnused = true } = {})
347
355
  };
348
356
  };
349
357
  }
358
+ /* c8 ignore start */
359
+ function defineKeyframes(keyframes$1) {
360
+ return keyframes$1;
361
+ }
362
+ /* c8 ignore end */
350
363
 
351
364
  //#endregion
352
365
  //#region src/internal/resolver.ts
@@ -539,6 +552,11 @@ function resolveSelectorConfig(config) {
539
552
  };
540
553
  }
541
554
  }
555
+ /* c8 ignore start */
556
+ function defineSelector(selector) {
557
+ return selector;
558
+ }
559
+ /* c8 ignore end */
542
560
 
543
561
  //#endregion
544
562
  //#region src/internal/plugins/shortcuts.ts
@@ -661,6 +679,11 @@ function resolveShortcutConfig(config) {
661
679
  };
662
680
  }
663
681
  }
682
+ /* c8 ignore start */
683
+ function defineShortcut(shortcut) {
684
+ return shortcut;
685
+ }
686
+ /* c8 ignore end */
664
687
 
665
688
  //#endregion
666
689
  //#region src/internal/plugins/variables.ts
@@ -672,7 +695,7 @@ function variables() {
672
695
  name: "core:variables",
673
696
  rawConfigConfigured(config) {
674
697
  resolveVariables = createResolveVariablesFn({ pruneUnused: config.variables?.pruneUnused });
675
- rawVariables = config.variables?.variables ?? {};
698
+ rawVariables = [config.variables?.variables ?? []].flat();
676
699
  safeSet = new Set(config.variables?.safeList ?? []);
677
700
  },
678
701
  configureEngine(engine) {
@@ -694,7 +717,7 @@ function variables() {
694
717
  engine.notifyPreflightUpdated();
695
718
  }
696
719
  };
697
- engine.variables.add(rawVariables);
720
+ rawVariables.forEach((variables$1) => engine.variables.add(variables$1));
698
721
  engine.addPreflight(async (engine$1) => {
699
722
  const used = /* @__PURE__ */ new Set();
700
723
  engine$1.store.atomicStyles.forEach(({ content: { value } }) => {
@@ -750,14 +773,14 @@ function normalizeVariableName(name) {
750
773
  if (name.startsWith("--")) return name;
751
774
  return `--${name}`;
752
775
  }
753
-
754
- //#endregion
755
- //#region src/internal/engine.ts
756
776
  /* c8 ignore start */
757
- function defineEngineConfig(config) {
758
- return config;
777
+ function defineVariables(variables$1) {
778
+ return variables$1;
759
779
  }
760
780
  /* c8 ignore end */
781
+
782
+ //#endregion
783
+ //#region src/internal/engine.ts
761
784
  async function createEngine(config = {}) {
762
785
  log.debug("Creating engine with config:", config);
763
786
  const corePlugins = [
@@ -1036,4 +1059,4 @@ async function renderPreflightDefinition(payload) {
1036
1059
  /* c8 ignore end */
1037
1060
 
1038
1061
  //#endregion
1039
- export { appendAutocompleteCssPropertyValues, appendAutocompleteExtraCssProperties, appendAutocompleteExtraProperties, appendAutocompletePropertyValues, appendAutocompleteSelectors, appendAutocompleteStyleItemStrings, createEngine, createLogger, defineEngineConfig, defineEnginePlugin, log, renderCSSStyleBlocks };
1062
+ export { appendAutocompleteCssPropertyValues, appendAutocompleteExtraCssProperties, appendAutocompleteExtraProperties, appendAutocompletePropertyValues, appendAutocompleteSelectors, appendAutocompleteStyleItemStrings, createEngine, createLogger, defineEngineConfig, defineEnginePlugin, defineKeyframes, definePreflight, defineSelector, defineShortcut, defineVariables, log, renderCSSStyleBlocks };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pikacss/core",
3
3
  "type": "module",
4
- "version": "0.0.35",
4
+ "version": "0.0.37",
5
5
  "author": "DevilTea <ch19980814@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -10,7 +10,7 @@
10
10
  "directory": "packages/core"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/DevilTea/pikacss/issues"
13
+ "url": "https://github.com/pikacss/pikacss/issues"
14
14
  },
15
15
  "keywords": [
16
16
  "pikacss",
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsdown && pnpm exec publint",
47
+ "build:watch": "tsdown --watch",
47
48
  "typecheck": "pnpm typecheck:package && pnpm typecheck:test",
48
49
  "typecheck:package": "tsc --project ./tsconfig.package.json --noEmit",
49
50
  "typecheck:test": "tsc --project ./tsconfig.tests.json --noEmit",