@paroicms/tiny-modal 0.7.5 → 0.7.7
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/tiny-modal.css +1 -1
- package/dist/tiny-modal.js +6 -4
- package/package.json +1 -1
package/dist/tiny-modal.css
CHANGED
package/dist/tiny-modal.js
CHANGED
|
@@ -91,10 +91,12 @@ function loadCssFromModuleUrl() {
|
|
|
91
91
|
if (!moduleUrl)
|
|
92
92
|
throw new Error("import.meta.url not available");
|
|
93
93
|
// Derive CSS URL from the module URL by extracting the package root
|
|
94
|
-
// CDNs like
|
|
95
|
-
// e.g., https://
|
|
96
|
-
// -> https://
|
|
97
|
-
const packageRootUrl = moduleUrl
|
|
94
|
+
// CDNs like cdn.jsdelivr.net may transform JS paths (e.g., add /+esm, /es2022/), but CSS stays in /dist/
|
|
95
|
+
// e.g., https://cdn.jsdelivr.net/npm/@paroicms/tiny-modal@0.0.0/+esm
|
|
96
|
+
// -> https://cdn.jsdelivr.net/npm/@paroicms/tiny-modal@0.0.0/dist/tiny-modal.css
|
|
97
|
+
const packageRootUrl = moduleUrl
|
|
98
|
+
.replace(/\/(?:\+esm|es\d{4}|esnext|deno|denonext|node|dist)\/.*$/, "")
|
|
99
|
+
.replace(/\/\+esm$/, "");
|
|
98
100
|
const cssUrl = `${packageRootUrl}/dist/tiny-modal.css`;
|
|
99
101
|
// Check if CSS is already loaded
|
|
100
102
|
if (document.querySelector(`link[href="${cssUrl}"]`)) {
|