@cupra/ui-kit 1.0.0-canary.19 → 1.0.0-canary.20
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/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist/utils/IconsManager.js +23 -22
- package/dist/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist/utils/cssWithTokens.js +1 -1
- package/dist/utils/htmlWithTokens.js +1 -1
- package/dist-react/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist-react/utils/IconsManager.js +23 -22
- package/dist-react/utils/StylesRegistry/StylesRegistry.js +1 -1
- package/dist-react/utils/cssWithTokens.js +1 -1
- package/dist-react/utils/htmlWithTokens.js +1 -1
- package/package.json +1 -1
|
@@ -54,7 +54,7 @@ let m = class extends v {
|
|
|
54
54
|
}
|
|
55
55
|
loadThemeStyles() {
|
|
56
56
|
return this.loadStyles ? new Promise((t, o) => {
|
|
57
|
-
const s = "/1.0.0-canary.
|
|
57
|
+
const s = "/1.0.0-canary.20", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
|
|
58
58
|
if (document.head.querySelector(`link[href="${r}"]`)) t();
|
|
59
59
|
else {
|
|
60
60
|
const e = `ui-kit-theme-${s}`, a = document.getElementById(e), n = document.createElement("link");
|
|
@@ -2,37 +2,38 @@ import { THEME_STORAGE_KEY as r } from "../core/theme.constants.js";
|
|
|
2
2
|
import { pubSub as l } from "./PubSub.js";
|
|
3
3
|
class f {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.icons = {}, this.handleChangeTheme = (
|
|
6
|
-
this.theme
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
this.icons = {}, this.handleChangeTheme = (e) => {
|
|
6
|
+
if (this.theme === e) return;
|
|
7
|
+
this.theme = e;
|
|
8
|
+
const i = Object.keys(this.icons);
|
|
9
|
+
this.icons = {}, i.forEach((s) => this.fetchIcon(s));
|
|
10
|
+
}, this.fetchIcon = async (e, i = {}) => {
|
|
11
|
+
const s = typeof sessionStorage < "u" ? sessionStorage == null ? void 0 : sessionStorage.getItem(r) : null;
|
|
12
|
+
!this.theme && s && (this.theme = s);
|
|
13
|
+
const t = this.icons[e];
|
|
14
|
+
if (t) return await t;
|
|
15
|
+
const n = this.loadIcon(e, i).catch((a) => {
|
|
16
|
+
throw delete this.icons[e], a;
|
|
16
17
|
});
|
|
17
|
-
return this.icons[
|
|
18
|
-
}, this.loadIcon = (
|
|
19
|
-
cache:
|
|
20
|
-
...
|
|
21
|
-
}).then((
|
|
22
|
-
if ((
|
|
23
|
-
return console.error(`Failed to fetch icon "${
|
|
18
|
+
return this.icons[e] = n, n;
|
|
19
|
+
}, this.loadIcon = (e, { cache: i = "force-cache", ...s }) => this.theme ? fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`, {
|
|
20
|
+
cache: i,
|
|
21
|
+
...s
|
|
22
|
+
}).then((t) => t.text()).catch((t) => {
|
|
23
|
+
if ((t == null ? void 0 : t.name) === "AbortError") throw t;
|
|
24
|
+
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
24
25
|
}) : Promise.resolve('<svg class="ds-icon"></svg>'), l.subscribe("theme", this.handleChangeTheme);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
const c = Symbol.for("@cupra/ui-kit/icons-manager"), h = globalThis;
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
value:
|
|
29
|
+
let o = h[c];
|
|
30
|
+
o || (o = new f(), Object.defineProperty(h, c, {
|
|
31
|
+
value: o,
|
|
31
32
|
writable: !1,
|
|
32
33
|
configurable: !1,
|
|
33
34
|
enumerable: !1
|
|
34
35
|
}));
|
|
35
|
-
const b =
|
|
36
|
+
const b = o;
|
|
36
37
|
export {
|
|
37
38
|
b as iconsManager
|
|
38
39
|
};
|
|
@@ -5,7 +5,7 @@ class s {
|
|
|
5
5
|
theme: t
|
|
6
6
|
}) => {
|
|
7
7
|
if (!t || !e) return;
|
|
8
|
-
const c = `https://ds-assets.cupra.com/1.0.0-canary.
|
|
8
|
+
const c = `https://ds-assets.cupra.com/1.0.0-canary.20/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
|
|
9
9
|
if (r) return r;
|
|
10
10
|
const i = this.fetchStyle({ url: c }).then((n) => (n || this.stylePromises.delete(c), n));
|
|
11
11
|
return this.stylePromises.set(c, i), this.stylePromises.get(c);
|
|
@@ -3,7 +3,7 @@ import "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
|
3
3
|
import "../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
4
4
|
import { unsafeCSS as n, css as o } from "../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
|
|
5
5
|
function x(t, ...r) {
|
|
6
|
-
const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-
|
|
6
|
+
const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-20"), i = n(e);
|
|
7
7
|
return o`${i}`;
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
@@ -3,7 +3,7 @@ import { html as n } from "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit
|
|
|
3
3
|
import "../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
4
4
|
import { unsafeHTML as i } from "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js";
|
|
5
5
|
function x(t, ...r) {
|
|
6
|
-
const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-
|
|
6
|
+
const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-20"), e = i(o);
|
|
7
7
|
return n`${e}`;
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
@@ -54,7 +54,7 @@ let m = class extends v {
|
|
|
54
54
|
}
|
|
55
55
|
loadThemeStyles() {
|
|
56
56
|
return this.loadStyles ? new Promise((t, o) => {
|
|
57
|
-
const s = "/1.0.0-canary.
|
|
57
|
+
const s = "/1.0.0-canary.20", r = `https://ds-assets.cupra.com${s}/styles/${this.theme}/theme.css`;
|
|
58
58
|
if (document.head.querySelector(`link[href="${r}"]`)) t();
|
|
59
59
|
else {
|
|
60
60
|
const e = `ui-kit-theme-${s}`, a = document.getElementById(e), n = document.createElement("link");
|
|
@@ -2,37 +2,38 @@ import { THEME_STORAGE_KEY as r } from "../core/theme.constants.js";
|
|
|
2
2
|
import { pubSub as l } from "./PubSub.js";
|
|
3
3
|
class f {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.icons = {}, this.handleChangeTheme = (
|
|
6
|
-
this.theme
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
this.icons = {}, this.handleChangeTheme = (e) => {
|
|
6
|
+
if (this.theme === e) return;
|
|
7
|
+
this.theme = e;
|
|
8
|
+
const i = Object.keys(this.icons);
|
|
9
|
+
this.icons = {}, i.forEach((s) => this.fetchIcon(s));
|
|
10
|
+
}, this.fetchIcon = async (e, i = {}) => {
|
|
11
|
+
const s = typeof sessionStorage < "u" ? sessionStorage == null ? void 0 : sessionStorage.getItem(r) : null;
|
|
12
|
+
!this.theme && s && (this.theme = s);
|
|
13
|
+
const t = this.icons[e];
|
|
14
|
+
if (t) return await t;
|
|
15
|
+
const n = this.loadIcon(e, i).catch((a) => {
|
|
16
|
+
throw delete this.icons[e], a;
|
|
16
17
|
});
|
|
17
|
-
return this.icons[
|
|
18
|
-
}, this.loadIcon = (
|
|
19
|
-
cache:
|
|
20
|
-
...
|
|
21
|
-
}).then((
|
|
22
|
-
if ((
|
|
23
|
-
return console.error(`Failed to fetch icon "${
|
|
18
|
+
return this.icons[e] = n, n;
|
|
19
|
+
}, this.loadIcon = (e, { cache: i = "force-cache", ...s }) => this.theme ? fetch(`https://ds-assets.cupra.com/icons/${this.theme}/${e}.svg`, {
|
|
20
|
+
cache: i,
|
|
21
|
+
...s
|
|
22
|
+
}).then((t) => t.text()).catch((t) => {
|
|
23
|
+
if ((t == null ? void 0 : t.name) === "AbortError") throw t;
|
|
24
|
+
return console.error(`Failed to fetch icon "${e}":`, t), "";
|
|
24
25
|
}) : Promise.resolve('<svg class="ds-icon"></svg>'), l.subscribe("theme", this.handleChangeTheme);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
const c = Symbol.for("@cupra/ui-kit/icons-manager"), h = globalThis;
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
value:
|
|
29
|
+
let o = h[c];
|
|
30
|
+
o || (o = new f(), Object.defineProperty(h, c, {
|
|
31
|
+
value: o,
|
|
31
32
|
writable: !1,
|
|
32
33
|
configurable: !1,
|
|
33
34
|
enumerable: !1
|
|
34
35
|
}));
|
|
35
|
-
const b =
|
|
36
|
+
const b = o;
|
|
36
37
|
export {
|
|
37
38
|
b as iconsManager
|
|
38
39
|
};
|
|
@@ -5,7 +5,7 @@ class s {
|
|
|
5
5
|
theme: t
|
|
6
6
|
}) => {
|
|
7
7
|
if (!t || !e) return;
|
|
8
|
-
const c = `https://ds-assets.cupra.com/1.0.0-canary.
|
|
8
|
+
const c = `https://ds-assets.cupra.com/1.0.0-canary.20/styles/${t}/components/${e}.css`, r = this.getCachedStyleSheetPromise({ url: c });
|
|
9
9
|
if (r) return r;
|
|
10
10
|
const i = this.fetchStyle({ url: c }).then((n) => (n || this.stylePromises.delete(c), n));
|
|
11
11
|
return this.stylePromises.set(c, i), this.stylePromises.get(c);
|
|
@@ -3,7 +3,7 @@ import "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
|
3
3
|
import "../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
4
4
|
import { unsafeCSS as n, css as o } from "../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
|
|
5
5
|
function x(t, ...r) {
|
|
6
|
-
const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-
|
|
6
|
+
const e = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-20"), i = n(e);
|
|
7
7
|
return o`${i}`;
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
@@ -3,7 +3,7 @@ import { html as n } from "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit
|
|
|
3
3
|
import "../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
4
4
|
import { unsafeHTML as i } from "../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js";
|
|
5
5
|
function x(t, ...r) {
|
|
6
|
-
const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-
|
|
6
|
+
const o = String.raw({ raw: t }, ...r).replace(/(--private-[\w-]+)(?=\s*[):,])/g, "$1-v1-0-0-canary-20"), e = i(o);
|
|
7
7
|
return n`${e}`;
|
|
8
8
|
}
|
|
9
9
|
export {
|