@stillwind/integration 0.6.0 → 0.7.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/astro/index.js +1 -1
- package/dist/fresh/index.js +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/{plugin-BFSq3lEh.js → plugin-DOKl8qk3.js} +30 -1
- package/dist/plugin-DOKl8qk3.js.map +1 -0
- package/dist/vite/index.js +1 -1
- package/index.d.ts +2 -0
- package/package.json +10 -7
- package/dist/plugin-BFSq3lEh.js.map +0 -1
package/dist/astro/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-DOKl8qk3.js";
|
|
2
2
|
import { registerDevelopmentCss } from "./development.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
package/dist/fresh/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-DOKl8qk3.js";
|
|
2
2
|
// src/fresh/manifest.ts
|
|
3
3
|
/** Filters repeated static files for Fresh's move operation without changing the emitted manifest. */
|
|
4
4
|
function registrationManifest(source) {
|
package/dist/nuxt/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-DOKl8qk3.js";
|
|
2
2
|
import { addPluginTemplate, defineNuxtModule } from "nuxt/kit";
|
|
3
3
|
// src/nuxt/index.ts
|
|
4
4
|
/**
|
|
@@ -31,6 +31,31 @@ function sourceModuleId(root, id) {
|
|
|
31
31
|
}
|
|
32
32
|
// src/vite/chunk-styles.ts
|
|
33
33
|
/**
|
|
34
|
+
* Browser code that keeps loader links across Astro ClientRouter navigations.
|
|
35
|
+
*
|
|
36
|
+
* Astro removes each head element that the incoming document does not contain, and the chunk that
|
|
37
|
+
* added a link does not run again, so the link would stay missing. Astro keeps an old stylesheet
|
|
38
|
+
* link when the incoming head has a link with the same `href`, and each incoming link matches one
|
|
39
|
+
* old link. The listener therefore copies each loader link while the incoming head has fewer links
|
|
40
|
+
* with its `href` than the current head, which also keeps repeated split occurrences. One listener
|
|
41
|
+
* serves all chunks in a document.
|
|
42
|
+
*/
|
|
43
|
+
const persistAcrossSwaps = `const key = Symbol.for("stillwind.persistLinks");
|
|
44
|
+
if (!globalThis[key]) {
|
|
45
|
+
globalThis[key] = true;
|
|
46
|
+
document.addEventListener("astro:before-swap", (event) => {
|
|
47
|
+
const head = event.newDocument.head;
|
|
48
|
+
const count = (parent, href) =>
|
|
49
|
+
[...parent.querySelectorAll('link[rel="stylesheet"]')].filter((l) => l.getAttribute("href") === href).length;
|
|
50
|
+
for (const link of document.head.querySelectorAll("link[data-stillwind-loader]")) {
|
|
51
|
+
const href = link.getAttribute("href");
|
|
52
|
+
if (count(head, href) < count(document.head, href)) {
|
|
53
|
+
head.append(link.cloneNode());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}`;
|
|
58
|
+
/**
|
|
34
59
|
* Associates emitted CSS with a chunk and loads its stylesheets in the browser.
|
|
35
60
|
*
|
|
36
61
|
* Split parts retain manifest order and relative-base URLs resolve against the chunk. Hosts can
|
|
@@ -93,8 +118,10 @@ if (typeof document !== "undefined") {
|
|
|
93
118
|
l.href = p.relative ? new URL(p.href, import.meta.url).href : p.href;
|
|
94
119
|
l.dataset.stillwindPart = p.id;
|
|
95
120
|
l.dataset.stillwindOrder = String(p.order);
|
|
121
|
+
l.dataset.stillwindLoader = "";
|
|
96
122
|
document.head.insertBefore(l, links.find((e) => Number(e.dataset.stillwindOrder) > p.order) ?? null);
|
|
97
123
|
}
|
|
124
|
+
${persistAcrossSwaps}
|
|
98
125
|
}
|
|
99
126
|
`,
|
|
100
127
|
map: null
|
|
@@ -117,8 +144,10 @@ if (typeof document !== "undefined") {
|
|
|
117
144
|
const link = document.createElement("link");
|
|
118
145
|
link.rel = "stylesheet";
|
|
119
146
|
link.href = href;
|
|
147
|
+
link.dataset.stillwindLoader = "";
|
|
120
148
|
document.head.append(link);
|
|
121
149
|
}
|
|
150
|
+
${persistAcrossSwaps}
|
|
122
151
|
}
|
|
123
152
|
`,
|
|
124
153
|
map: null
|
|
@@ -2613,4 +2642,4 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2613
2642
|
}
|
|
2614
2643
|
export { renderChunkStyles as i, stillwind as n, createViteProject as r, createVitePlugins as t };
|
|
2615
2644
|
|
|
2616
|
-
//# sourceMappingURL=plugin-
|
|
2645
|
+
//# sourceMappingURL=plugin-DOKl8qk3.js.map
|