@unocss/core 0.44.1 → 0.44.4
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 +5 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,7 +87,7 @@ function entriesToCss(arr) {
|
|
|
87
87
|
function isObject(item) {
|
|
88
88
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
89
89
|
}
|
|
90
|
-
function mergeDeep(original, patch) {
|
|
90
|
+
function mergeDeep(original, patch, level = Infinity) {
|
|
91
91
|
const o = original;
|
|
92
92
|
const p = patch;
|
|
93
93
|
if (Array.isArray(o) && Array.isArray(p))
|
|
@@ -97,8 +97,8 @@ function mergeDeep(original, patch) {
|
|
|
97
97
|
const output = { ...o };
|
|
98
98
|
if (isObject(o) && isObject(p)) {
|
|
99
99
|
Object.keys(p).forEach((key) => {
|
|
100
|
-
if (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key]))
|
|
101
|
-
output[key] = mergeDeep(o[key], p[key]);
|
|
100
|
+
if (level > 0 && (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key])))
|
|
101
|
+
output[key] = mergeDeep(o[key], p[key], level - 1);
|
|
102
102
|
else
|
|
103
103
|
Object.assign(output, { [key]: p[key] });
|
|
104
104
|
});
|
|
@@ -383,7 +383,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
383
383
|
const theme = clone([
|
|
384
384
|
...sortedPresets.map((p) => p.theme || {}),
|
|
385
385
|
config.theme || {}
|
|
386
|
-
].reduce((a, p) => mergeDeep(a, p), {}));
|
|
386
|
+
].reduce((a, p) => mergeDeep(a, p, 1), {}));
|
|
387
387
|
mergePresets("extendTheme").forEach((extendTheme) => extendTheme(theme));
|
|
388
388
|
const autocomplete = {
|
|
389
389
|
templates: uniq(sortedPresets.map((p) => toArray(p.autocomplete?.templates)).flat()),
|
|
@@ -414,7 +414,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
const version = "0.44.
|
|
417
|
+
const version = "0.44.4";
|
|
418
418
|
|
|
419
419
|
class UnoGenerator {
|
|
420
420
|
constructor(userConfig = {}, defaults = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ declare function normalizeCSSValues(obj: CSSValue | string | (CSSValue | string)
|
|
|
95
95
|
declare function clearIdenticalEntries(entry: CSSEntries): CSSEntries;
|
|
96
96
|
declare function entriesToCss(arr?: CSSEntries): string;
|
|
97
97
|
declare function isObject(item: any): item is Record<string, any>;
|
|
98
|
-
declare function mergeDeep<T>(original: T, patch: DeepPartial<T
|
|
98
|
+
declare function mergeDeep<T>(original: T, patch: DeepPartial<T>, level?: number): T;
|
|
99
99
|
declare function clone<T>(val: T): T;
|
|
100
100
|
declare function isStaticRule(rule: Rule): rule is StaticRule;
|
|
101
101
|
declare function isStaticShortcut(sc: Shortcut): sc is StaticShortcut;
|
|
@@ -633,12 +633,13 @@ interface TransformResult {
|
|
|
633
633
|
deps?: string[];
|
|
634
634
|
dynamicDeps?: string[];
|
|
635
635
|
}
|
|
636
|
+
declare type SourceCodeTransformerEnforce = 'pre' | 'post' | 'default';
|
|
636
637
|
interface SourceCodeTransformer {
|
|
637
638
|
name: string;
|
|
638
639
|
/**
|
|
639
640
|
* The order of transformer
|
|
640
641
|
*/
|
|
641
|
-
enforce?:
|
|
642
|
+
enforce?: SourceCodeTransformerEnforce;
|
|
642
643
|
/**
|
|
643
644
|
* Custom id filter, if not provided, the extraction filter will be applied
|
|
644
645
|
*/
|
|
@@ -672,8 +673,6 @@ interface PluginOptions {
|
|
|
672
673
|
exclude?: FilterPattern;
|
|
673
674
|
/**
|
|
674
675
|
* Custom transformers to the source code
|
|
675
|
-
*
|
|
676
|
-
* Currently only supported in Vite
|
|
677
676
|
*/
|
|
678
677
|
transformers?: SourceCodeTransformer[];
|
|
679
678
|
}
|
|
@@ -770,4 +769,4 @@ declare const extractorSplit: Extractor;
|
|
|
770
769
|
|
|
771
770
|
declare const extractorSvelte: Extractor;
|
|
772
771
|
|
|
773
|
-
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetOptions, RGBAColorValue, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, ShortcutValue, SourceCodeTransformer, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, mergeDeep, mergeSet, movePseudoElementsEnd, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
|
772
|
+
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetOptions, RGBAColorValue, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, mergeDeep, mergeSet, movePseudoElementsEnd, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.mjs
CHANGED
|
@@ -83,7 +83,7 @@ function entriesToCss(arr) {
|
|
|
83
83
|
function isObject(item) {
|
|
84
84
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
85
85
|
}
|
|
86
|
-
function mergeDeep(original, patch) {
|
|
86
|
+
function mergeDeep(original, patch, level = Infinity) {
|
|
87
87
|
const o = original;
|
|
88
88
|
const p = patch;
|
|
89
89
|
if (Array.isArray(o) && Array.isArray(p))
|
|
@@ -93,8 +93,8 @@ function mergeDeep(original, patch) {
|
|
|
93
93
|
const output = { ...o };
|
|
94
94
|
if (isObject(o) && isObject(p)) {
|
|
95
95
|
Object.keys(p).forEach((key) => {
|
|
96
|
-
if (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key]))
|
|
97
|
-
output[key] = mergeDeep(o[key], p[key]);
|
|
96
|
+
if (level > 0 && (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key])))
|
|
97
|
+
output[key] = mergeDeep(o[key], p[key], level - 1);
|
|
98
98
|
else
|
|
99
99
|
Object.assign(output, { [key]: p[key] });
|
|
100
100
|
});
|
|
@@ -379,7 +379,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
379
379
|
const theme = clone([
|
|
380
380
|
...sortedPresets.map((p) => p.theme || {}),
|
|
381
381
|
config.theme || {}
|
|
382
|
-
].reduce((a, p) => mergeDeep(a, p), {}));
|
|
382
|
+
].reduce((a, p) => mergeDeep(a, p, 1), {}));
|
|
383
383
|
mergePresets("extendTheme").forEach((extendTheme) => extendTheme(theme));
|
|
384
384
|
const autocomplete = {
|
|
385
385
|
templates: uniq(sortedPresets.map((p) => toArray(p.autocomplete?.templates)).flat()),
|
|
@@ -410,7 +410,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
const version = "0.44.
|
|
413
|
+
const version = "0.44.4";
|
|
414
414
|
|
|
415
415
|
class UnoGenerator {
|
|
416
416
|
constructor(userConfig = {}, defaults = {}) {
|