@stacksjs/stx 0.2.131 → 0.2.133
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/cli.js +473 -470
- package/dist/craft.js +258 -255
- package/dist/process.js +3 -1
- package/dist/pwa.js +269 -266
- package/dist/runtime-injection.js +16 -3
- package/dist/ssg.js +230 -227
- package/dist/style-scoping.d.ts +9 -0
- package/dist/style-scoping.js +10 -0
- package/package.json +5 -5
package/dist/style-scoping.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep one copy of each rendered scoped stylesheet.
|
|
3
|
+
*
|
|
4
|
+
* Reusing the same component more than once produces the same deterministic
|
|
5
|
+
* scope attribute and CSS. A single stylesheet covers every instance, just as
|
|
6
|
+
* it does in a compiled Vue SFC, so repeating it only increases the document
|
|
7
|
+
* payload and CSS parse work.
|
|
8
|
+
*/
|
|
9
|
+
export declare function dedupeScopedStyles(html: string): string;
|
|
1
10
|
/**
|
|
2
11
|
* Process all `<style scoped>` blocks in a template.
|
|
3
12
|
*
|
package/dist/style-scoping.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { maskAtElementPosition, matchScriptElement, matchStyleElement } from "./html-masking.js";
|
|
2
2
|
import { generateComponentId, scopeCss } from "./web-components/css-scoping.js";
|
|
3
3
|
const SCOPED_STYLE_ATTR = String.raw`(?<![\w-])scoped(?![\w-])`, SCOPED_STYLE_PROBE = new RegExp(`<style\\s+[^>]*${SCOPED_STYLE_ATTR}`, "i");
|
|
4
|
+
export function dedupeScopedStyles(html) {
|
|
5
|
+
const seen = new Set;
|
|
6
|
+
return html.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi, (styleBlock) => {
|
|
7
|
+
const key = styleBlock.trim();
|
|
8
|
+
if (seen.has(key))
|
|
9
|
+
return "";
|
|
10
|
+
seen.add(key);
|
|
11
|
+
return styleBlock;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
4
14
|
export function processScopedStyles(template, filePath) {
|
|
5
15
|
if (!SCOPED_STYLE_PROBE.test(template))
|
|
6
16
|
return { html: template, hasScoped: !1 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.133",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.12",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.133",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.133",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.133",
|
|
124
124
|
"bunfig": "^0.15.15",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.133",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.1.9",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|