@hyperframes/core 0.9.8 → 0.9.10
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.
|
@@ -7,6 +7,8 @@ const hash = (text) => createHash("sha1").update(text).digest("hex").slice(0, 16
|
|
|
7
7
|
* `ignore` lists selectors for parts that change on every build without changing what is shown.
|
|
8
8
|
*/
|
|
9
9
|
export function addScenePartsManifest(html, ignore = []) {
|
|
10
|
+
if (!html.includes(SCENE_PART_ATTR))
|
|
11
|
+
return html;
|
|
10
12
|
const doc = parseHTMLContent(html);
|
|
11
13
|
const parts = [...doc.querySelectorAll(`[${SCENE_PART_ATTR}]`)];
|
|
12
14
|
if (parts.length === 0)
|
|
@@ -216,11 +216,24 @@ function collectCssCustomProperties(css, customProperties) {
|
|
|
216
216
|
}
|
|
217
217
|
const FONT_SIZE_KEYWORD = /^(?:xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|smaller|larger)$/i;
|
|
218
218
|
const FONT_SIZE_TOKEN = /^(?:\d*\.?\d+[a-z%]+|(?:calc|min|max|clamp|var)\(.*\))(?:\/\S+)?$/i;
|
|
219
|
+
function maskParens(value) {
|
|
220
|
+
let depth = 0;
|
|
221
|
+
return value.replace(/[\s\S]/g, (char) => {
|
|
222
|
+
if (char === "(")
|
|
223
|
+
depth += 1;
|
|
224
|
+
const inside = depth > 0;
|
|
225
|
+
if (char === ")")
|
|
226
|
+
depth -= 1;
|
|
227
|
+
return inside ? "_" : char;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
219
230
|
function fontShorthandFamilies(value) {
|
|
220
|
-
for (const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
231
|
+
for (const { 0: masked, index } of maskParens(value).matchAll(/\S+/g)) {
|
|
232
|
+
const end = index + masked.length;
|
|
233
|
+
const token = value.slice(index, end);
|
|
234
|
+
const size = token.split("/")[0] ?? "";
|
|
235
|
+
if (FONT_SIZE_KEYWORD.test(size) || FONT_SIZE_TOKEN.test(token)) {
|
|
236
|
+
return value.slice(end).trim();
|
|
224
237
|
}
|
|
225
238
|
}
|
|
226
239
|
return "";
|