@unocss/core 0.62.0 → 0.62.2
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.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +32 -41
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -606,6 +606,10 @@ interface ConfigBase<Theme extends object = object> {
|
|
|
606
606
|
*
|
|
607
607
|
*/
|
|
608
608
|
content?: ContentOptions;
|
|
609
|
+
/**
|
|
610
|
+
* Custom transformers to the source code.
|
|
611
|
+
*/
|
|
612
|
+
transformers?: SourceCodeTransformer[];
|
|
609
613
|
}
|
|
610
614
|
interface OutputCssLayersOptions {
|
|
611
615
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -606,6 +606,10 @@ interface ConfigBase<Theme extends object = object> {
|
|
|
606
606
|
*
|
|
607
607
|
*/
|
|
608
608
|
content?: ContentOptions;
|
|
609
|
+
/**
|
|
610
|
+
* Custom transformers to the source code.
|
|
611
|
+
*/
|
|
612
|
+
transformers?: SourceCodeTransformer[];
|
|
609
613
|
}
|
|
610
614
|
interface OutputCssLayersOptions {
|
|
611
615
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -94,7 +94,7 @@ function clearIdenticalEntries(entry) {
|
|
|
94
94
|
function entriesToCss(arr) {
|
|
95
95
|
if (arr == null)
|
|
96
96
|
return "";
|
|
97
|
-
return clearIdenticalEntries(arr).map(([key, value]) => value != null ? `${key}:${value};` : void 0).filter(Boolean).join("");
|
|
97
|
+
return clearIdenticalEntries(arr).map(([key, value]) => value != null && typeof value !== "function" ? `${key}:${value};` : void 0).filter(Boolean).join("");
|
|
98
98
|
}
|
|
99
99
|
function isObject(item) {
|
|
100
100
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
@@ -489,47 +489,29 @@ function resolvePresets(preset) {
|
|
|
489
489
|
return [root, ...nested];
|
|
490
490
|
}
|
|
491
491
|
function mergeContentOptions(optionsArray) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
},
|
|
499
|
-
plain: []
|
|
500
|
-
};
|
|
492
|
+
if (optionsArray.length === 0) {
|
|
493
|
+
return {};
|
|
494
|
+
}
|
|
495
|
+
const pipelineIncludes = [];
|
|
496
|
+
const pipelineExcludes = [];
|
|
497
|
+
let pipelineDisabled = false;
|
|
501
498
|
for (const options of optionsArray) {
|
|
502
|
-
if (options.
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
if (options.inline) {
|
|
506
|
-
mergedResult.inline.push(...options.inline);
|
|
507
|
-
}
|
|
508
|
-
if (options.plain) {
|
|
509
|
-
mergedResult.inline.push(...options.plain);
|
|
510
|
-
}
|
|
511
|
-
if (options.pipeline !== false) {
|
|
512
|
-
if (options.pipeline?.include) {
|
|
513
|
-
mergedResult.pipeline?.include?.push(...options.pipeline?.include);
|
|
514
|
-
}
|
|
515
|
-
if (options.pipeline?.exclude) {
|
|
516
|
-
mergedResult.pipeline?.exclude?.push(...options.pipeline?.exclude);
|
|
517
|
-
}
|
|
499
|
+
if (options.pipeline === false) {
|
|
500
|
+
pipelineDisabled = true;
|
|
518
501
|
} else {
|
|
519
|
-
|
|
502
|
+
pipelineIncludes.push(options.pipeline?.include ?? []);
|
|
503
|
+
pipelineExcludes.push(options.pipeline?.exclude ?? []);
|
|
520
504
|
}
|
|
521
505
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
return mergedResult;
|
|
506
|
+
return {
|
|
507
|
+
filesystem: uniq(optionsArray.flatMap((options) => options.filesystem ?? [])),
|
|
508
|
+
inline: uniq(optionsArray.flatMap((options) => options.inline ?? [])),
|
|
509
|
+
plain: uniq(optionsArray.flatMap((options) => options.plain ?? [])),
|
|
510
|
+
pipeline: pipelineDisabled ? false : {
|
|
511
|
+
include: uniq(mergeFilterPatterns(...pipelineIncludes)),
|
|
512
|
+
exclude: uniq(mergeFilterPatterns(...pipelineExcludes))
|
|
513
|
+
}
|
|
514
|
+
};
|
|
533
515
|
}
|
|
534
516
|
function resolveConfig(userConfig = {}, defaults = {}) {
|
|
535
517
|
const config = Object.assign({}, defaults, userConfig);
|
|
@@ -606,7 +588,8 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
606
588
|
safelist: getMerged("safelist"),
|
|
607
589
|
separators,
|
|
608
590
|
details: config.details ?? config.envMode === "dev",
|
|
609
|
-
content
|
|
591
|
+
content,
|
|
592
|
+
transformers: uniqueBy(getMerged("transformers"), (a, b) => a.name === b.name)
|
|
610
593
|
};
|
|
611
594
|
for (const p of sources)
|
|
612
595
|
p?.configResolved?.(resolved);
|
|
@@ -617,10 +600,12 @@ function mergeConfigs(configs) {
|
|
|
617
600
|
const config = configs.map((config2) => Object.entries(config2).reduce((acc, [key, value]) => ({
|
|
618
601
|
...acc,
|
|
619
602
|
[key]: maybeArrays.includes(key) ? toArray(value) : value
|
|
620
|
-
}), {})).reduce(({ theme: themeA, ...a }, { theme: themeB, ...b }) => {
|
|
603
|
+
}), {})).reduce(({ theme: themeA, content: contentA, ...a }, { theme: themeB, content: contentB, ...b }) => {
|
|
621
604
|
const c = mergeDeep(a, b, true);
|
|
622
605
|
if (themeA || themeB)
|
|
623
606
|
c.theme = mergeThemes([themeA, themeB]);
|
|
607
|
+
if (contentA || contentB)
|
|
608
|
+
c.content = mergeContentOptions([contentA || {}, contentB || {}]);
|
|
624
609
|
return c;
|
|
625
610
|
}, {});
|
|
626
611
|
return config;
|
|
@@ -644,11 +629,17 @@ function mergeAutocompleteShorthands(shorthands) {
|
|
|
644
629
|
};
|
|
645
630
|
}, {});
|
|
646
631
|
}
|
|
632
|
+
function mergeFilterPatterns(...filterPatterns) {
|
|
633
|
+
return filterPatterns.flatMap(flatternFilterPattern);
|
|
634
|
+
}
|
|
635
|
+
function flatternFilterPattern(pattern) {
|
|
636
|
+
return Array.isArray(pattern) ? pattern : pattern ? [pattern] : [];
|
|
637
|
+
}
|
|
647
638
|
function definePreset(preset) {
|
|
648
639
|
return preset;
|
|
649
640
|
}
|
|
650
641
|
|
|
651
|
-
const version = "0.62.
|
|
642
|
+
const version = "0.62.2";
|
|
652
643
|
|
|
653
644
|
var __defProp = Object.defineProperty;
|
|
654
645
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|