@vinicunca/unocss-preset 0.3.1 → 0.4.0
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 +13 -3
- package/dist/index.mjs +14 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -424,16 +424,26 @@ class Opacity {
|
|
|
424
424
|
[
|
|
425
425
|
/^opacity-(.+)$/,
|
|
426
426
|
([, body], { theme }) => {
|
|
427
|
-
const
|
|
428
|
-
const opacityValue = opacityTheme[body];
|
|
427
|
+
const opacityValue = theme.opacity?.[body];
|
|
429
428
|
return {
|
|
430
429
|
opacity: opacityValue ?? utils.handler.bracket.percent.cssvar(body)
|
|
431
430
|
};
|
|
432
431
|
}
|
|
433
|
-
]
|
|
432
|
+
],
|
|
433
|
+
[/^border-()opacity?-?(.+)$/, handlerBorderOpacity, { autocomplete: "border-opacity-<percent>" }],
|
|
434
|
+
[/^border-([xy])-opacity?-?(.+)$/, handlerBorderOpacity],
|
|
435
|
+
[/^border-([rltbse])-opacity?-?(.+)$/, handlerBorderOpacity],
|
|
436
|
+
[/^border-(block|inline)-opacity?-?(.+)$/, handlerBorderOpacity],
|
|
437
|
+
[/^border-([bi][se])-opacity?-?(.+)$/, handlerBorderOpacity]
|
|
434
438
|
];
|
|
435
439
|
}
|
|
436
440
|
}
|
|
441
|
+
function handlerBorderOpacity([, dir = "", body], ctx) {
|
|
442
|
+
const opacityValue = ctx.theme.opacity?.[body] ?? utils.handler.bracket.percent.cssvar(body);
|
|
443
|
+
if (dir in utils.directionMap && opacityValue != null) {
|
|
444
|
+
return utils.directionMap[dir].map((i) => [`--un-border${i}-opacity`, opacityValue]);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
437
447
|
|
|
438
448
|
const FONT_NAMES = {
|
|
439
449
|
"h1": {
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFilter } from '@rollup/pluginutils';
|
|
2
2
|
import { toKebabCase, partition, trimAll, isString, hasValue, parseColor as parseColor$1, APCAContrast, convertToUnit, mergeDeep } from '@vinicunca/js-utilities';
|
|
3
3
|
import { entriesToCss } from '@unocss/core';
|
|
4
|
-
import { parseColor, colorOpacityToString, colorToString, handler } from '@unocss/preset-mini/utils';
|
|
4
|
+
import { parseColor, colorOpacityToString, colorToString, handler, directionMap } from '@unocss/preset-mini/utils';
|
|
5
5
|
|
|
6
6
|
const DEFAULT_PREFIX = "vin-";
|
|
7
7
|
class VinicuncaCore {
|
|
@@ -420,16 +420,26 @@ class Opacity {
|
|
|
420
420
|
[
|
|
421
421
|
/^opacity-(.+)$/,
|
|
422
422
|
([, body], { theme }) => {
|
|
423
|
-
const
|
|
424
|
-
const opacityValue = opacityTheme[body];
|
|
423
|
+
const opacityValue = theme.opacity?.[body];
|
|
425
424
|
return {
|
|
426
425
|
opacity: opacityValue ?? handler.bracket.percent.cssvar(body)
|
|
427
426
|
};
|
|
428
427
|
}
|
|
429
|
-
]
|
|
428
|
+
],
|
|
429
|
+
[/^border-()opacity?-?(.+)$/, handlerBorderOpacity, { autocomplete: "border-opacity-<percent>" }],
|
|
430
|
+
[/^border-([xy])-opacity?-?(.+)$/, handlerBorderOpacity],
|
|
431
|
+
[/^border-([rltbse])-opacity?-?(.+)$/, handlerBorderOpacity],
|
|
432
|
+
[/^border-(block|inline)-opacity?-?(.+)$/, handlerBorderOpacity],
|
|
433
|
+
[/^border-([bi][se])-opacity?-?(.+)$/, handlerBorderOpacity]
|
|
430
434
|
];
|
|
431
435
|
}
|
|
432
436
|
}
|
|
437
|
+
function handlerBorderOpacity([, dir = "", body], ctx) {
|
|
438
|
+
const opacityValue = ctx.theme.opacity?.[body] ?? handler.bracket.percent.cssvar(body);
|
|
439
|
+
if (dir in directionMap && opacityValue != null) {
|
|
440
|
+
return directionMap[dir].map((i) => [`--un-border${i}-opacity`, opacityValue]);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
433
443
|
|
|
434
444
|
const FONT_NAMES = {
|
|
435
445
|
"h1": {
|