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