@thejaredwilcurt/csslop 0.0.31 → 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/package.json +1 -1
- package/src/declarations/config.js +2 -2
- package/src/value/minify.js +34 -12
package/package.json
CHANGED
|
@@ -80,7 +80,7 @@ const shorthandMap = {
|
|
|
80
80
|
'border-block-width': ['border-block-start-width', 'border-block-end-width'],
|
|
81
81
|
transition: ['transition-property', 'transition-duration', 'transition-timing-function', 'transition-delay'],
|
|
82
82
|
animation: ['animation-name', 'animation-duration', 'animation-timing-function', 'animation-delay', 'animation-iteration-count', 'animation-direction', 'animation-fill-mode', 'animation-play-state'],
|
|
83
|
-
mask: ['mask-image', 'mask-
|
|
83
|
+
mask: ['mask-image', 'mask-position', 'mask-size', 'mask-repeat'],
|
|
84
84
|
'position-try': ['position-try-order', 'position-try-fallbacks'],
|
|
85
85
|
font: ['font-style', 'font-weight', 'font-size', 'line-height', 'font-family'],
|
|
86
86
|
marker: ['marker-start', 'marker-mid', 'marker-end'],
|
|
@@ -92,7 +92,7 @@ const shorthandOverrideMap = {
|
|
|
92
92
|
columns: ['column-wrap'],
|
|
93
93
|
border: ['border-image', 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat'],
|
|
94
94
|
font: ['font-variant', 'font-variant-alternates', 'font-variant-caps', 'font-variant-east-asian', 'font-variant-ligatures', 'font-variant-numeric', 'font-variant-position', 'font-feature-settings', 'font-kerning', 'font-language-override', 'font-optical-sizing', 'font-size-adjust', 'font-variation-settings'],
|
|
95
|
-
mask: ['mask-border', 'mask-border-source', 'mask-border-slice', 'mask-border-width', 'mask-border-outset', 'mask-border-repeat', 'mask-border-mode', 'mask-
|
|
95
|
+
mask: ['mask-border', 'mask-border-source', 'mask-border-slice', 'mask-border-width', 'mask-border-outset', 'mask-border-repeat', 'mask-border-mode', 'mask-origin', 'mask-clip', 'mask-composite', 'mask-mode']
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
/**
|
package/src/value/minify.js
CHANGED
|
@@ -980,12 +980,31 @@ const POSITION_OFFSET_SOURCE = '(?:left|center|right|top|bottom|[+-]?(?:\\d+|\\d
|
|
|
980
980
|
const POSITION_COMPONENT_SOURCE = '(' + POSITION_OFFSET_SOURCE + '(?:\\s+' + POSITION_OFFSET_SOURCE + ')?)';
|
|
981
981
|
|
|
982
982
|
/**
|
|
983
|
-
* Matches a
|
|
984
|
-
*
|
|
983
|
+
* Matches everything a `url()` holds up to but not including its own closing
|
|
984
|
+
* parenthesis. A url is written without nested parentheses, so the first one
|
|
985
|
+
* that closes it is the end of the token.
|
|
986
|
+
*
|
|
987
|
+
* @type {string}
|
|
988
|
+
*/
|
|
989
|
+
const URL_TOKEN_BODY_SOURCE = 'url\\([^()]*';
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Matches a close-paren that ends an image function, directly followed by a
|
|
993
|
+
* position that no slash follows, which is the position that needs its
|
|
994
|
+
* separator put back. The parenthesis that ends a `url()` is skipped, since
|
|
995
|
+
* that one closes a token rather than a function.
|
|
996
|
+
*
|
|
997
|
+
* @type {RegExp}
|
|
998
|
+
*/
|
|
999
|
+
const UNSEPARATED_FUNCTION_POSITION_PATTERN = new RegExp('(?<!' + URL_TOKEN_BODY_SOURCE + ')\\)' + POSITION_COMPONENT_SOURCE + '(?!\\/)', 'gi');
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Matches a `url()` separated from the position that follows it, which is the
|
|
1003
|
+
* separator a url does not need.
|
|
985
1004
|
*
|
|
986
1005
|
* @type {RegExp}
|
|
987
1006
|
*/
|
|
988
|
-
const
|
|
1007
|
+
const SEPARATED_URL_POSITION_PATTERN = new RegExp('(' + URL_TOKEN_BODY_SOURCE + '\\))\\s+' + POSITION_COMPONENT_SOURCE, 'gi');
|
|
989
1008
|
|
|
990
1009
|
/**
|
|
991
1010
|
* Matches a close-paren separated from a position that a slash follows, where
|
|
@@ -996,18 +1015,21 @@ const UNSEPARATED_IMAGE_POSITION_PATTERN = new RegExp('\\)' + POSITION_COMPONENT
|
|
|
996
1015
|
const SEPARATED_IMAGE_SIZE_POSITION_PATTERN = new RegExp('\\)\\s+' + POSITION_COMPONENT_SOURCE + '(?=\\/)', 'gi');
|
|
997
1016
|
|
|
998
1017
|
/**
|
|
999
|
-
*
|
|
1018
|
+
* Normalizes the separator between the image of a layer and the position that
|
|
1000
1019
|
* follows it. Both `background` and `mask` take a `<position> [ / <size> ]`
|
|
1001
1020
|
* component after their image, and a bare position only reads as its own
|
|
1002
|
-
* component while whitespace separates it from
|
|
1003
|
-
* that a `/` follows
|
|
1021
|
+
* component while whitespace separates it from an image function. Neither a
|
|
1022
|
+
* position that a `/` follows nor one that follows a `url()` needs the
|
|
1023
|
+
* separator, since the slash delimits the pair and a url is consumed whole as a
|
|
1024
|
+
* single token that ends at its own closing parenthesis.
|
|
1004
1025
|
*
|
|
1005
1026
|
* @param {string} value The layered image value, with the parenthesis padding removed.
|
|
1006
|
-
* @return {string} The value with the position separator
|
|
1027
|
+
* @return {string} The value with the position separator normalized.
|
|
1007
1028
|
*/
|
|
1008
|
-
function
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1029
|
+
function normalizeImagePositionSeparator (value) {
|
|
1030
|
+
const separatedFromFunction = value.replace(UNSEPARATED_FUNCTION_POSITION_PATTERN, ') $1');
|
|
1031
|
+
const joinedToUrl = separatedFromFunction.replace(SEPARATED_URL_POSITION_PATTERN, '$1$2');
|
|
1032
|
+
return joinedToUrl.replace(SEPARATED_IMAGE_SIZE_POSITION_PATTERN, ')$1');
|
|
1011
1033
|
}
|
|
1012
1034
|
|
|
1013
1035
|
/**
|
|
@@ -1227,11 +1249,11 @@ function applyPropertyOptimizations (val, property, allowsSeparatorElision) {
|
|
|
1227
1249
|
if (normalized) {
|
|
1228
1250
|
val = normalized;
|
|
1229
1251
|
}
|
|
1230
|
-
val =
|
|
1252
|
+
val = normalizeImagePositionSeparator(val);
|
|
1231
1253
|
}
|
|
1232
1254
|
|
|
1233
1255
|
if (property === 'mask') {
|
|
1234
|
-
val =
|
|
1256
|
+
val = normalizeImagePositionSeparator(val);
|
|
1235
1257
|
}
|
|
1236
1258
|
|
|
1237
1259
|
if (property === 'border') {
|