yxuse 1.0.64 → 1.0.66
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/lib/index.cjs2.js +1 -1
- package/lib/index.es2.js +54 -50
- package/package.json +1 -1
package/lib/index.cjs2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=(t,o,e)=>new Promise((c,s)=>{var n=r=>{try{l(e.next(r))}catch(h){s(h)}},a=r=>{try{l(e.throw(r))}catch(h){s(h)}},l=r=>r.done?c(r.value):Promise.resolve(r.value).then(n,a);l((e=e.apply(t,o)).next())});const S=require("./index.cjs3.js"),C=require("./index.cjs4.js"),d=require("./index.cjs5.js"),E=require("./index.cjs6.js"),V=require("./index.cjs7.js"),_="@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff'), url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff2'); font-style: normal;font-display: swap;}",A="@font-face { font-family: 'YX-SP-TITLE'; font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff2');font-style: normal; font-display: swap;}",B="@font-face {font-family: 'YX-TEXT'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff2'); font-style: normal; font-display: swap;}",L=_+A+B,b=()=>m(exports,null,function*(){var o;let t=p();try{const{data:e}=yield d.getUserThemeList();let c=t?(o=e.find(n=>n.id===t))==null?void 0:o.themeUrl:"";if(!t||!c){const a=e.find(l=>l.defaultTheme===1)||e[0];c=a.themeUrl,t=a.id}const s=yield f(c);g({themeCssVar:s,themeId:t}),y(),i.onmessage=n=>{const a=n.data;a.type==="theme"&&f(a.data.themeUrl)},console.log("主题初始化完毕!!!")}catch(e){y(),T()}}),y=()=>{const t=document.createElement("style");t.innerHTML=L,document.head.appendChild(t)},g=({themeCssVar:t,themeId:o})=>{const e=localStorage.getItem("ttcGlobalState")||"{}",c=JSON.parse(e);c.theme={themeCssVar:t,id:o},localStorage.setItem("ttcGlobalState",JSON.stringify(c))},I=t=>m(exports,null,function*(){const o=yield f(t.themeUrl);g({themeCssVar:o,themeId:t==null?void 0:t.id}),i.postMessage({type:"theme",data:t})}),T=()=>{const t=u(),o=document.documentElement;Object.keys(t).forEach(e=>{Object.keys(t[e]).forEach(c=>{const s=`--${e}-${c}`;o.style.setProperty(s,t[e][c])})})},f=t=>m(exports,null,function*(){const e=yield(yield fetch(t)).json(),c=document.documentElement;return Object.keys(e).forEach(s=>{Object.keys(e[s]).forEach(n=>{const a=`--${s}-${n}`;c.style.setProperty(a,e[s][n])})}),e}),U=()=>m(exports,null,function*(){const{data:t}=yield d.getUserThemeList(),o=t.find(c=>c.defaultTheme===1);return o?o.themeUrl:t[0].themeUrl}),p=()=>{var e;const t=localStorage.getItem("ttcGlobalState"),o=t&&((e=JSON.parse(t))==null?void 0:e.theme);return(o==null?void 0:o.id)||null},u=()=>{var e;const t=localStorage.getItem("ttcGlobalState");return(t&&((e=JSON.parse(t))==null?void 0:e.theme)).themeCssVar},w=t=>u()[t]||{},k=Object.freeze(Object.defineProperty({__proto__:null,changeTheme:I,getCurTheme:p,getCurThemeCssVar:u,getDefaultThemeUrl:U,getGroupColor:w,install:b,updateTheme:T},Symbol.toStringTag,{value:"Module"})),i=new BroadcastChannel("YXUSE_BC"),O={utils:S.utils,api:d.api,theme:k,icons:C.icons,components:E.components,directives:V.directives,BC:i};exports.BC=i;exports.changeTheme=I;exports.getCurTheme=p;exports.getCurThemeCssVar=u;exports.getDefaultThemeUrl=U;exports.getGroupColor=w;exports.index=O;exports.install=b;exports.updateTheme=T;
|
package/lib/index.es2.js
CHANGED
|
@@ -1,51 +1,55 @@
|
|
|
1
|
-
var
|
|
2
|
-
var c = (
|
|
1
|
+
var m = (t, o, e) => new Promise((s, a) => {
|
|
2
|
+
var c = (r) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
4
|
+
l(e.next(r));
|
|
5
5
|
} catch (f) {
|
|
6
6
|
a(f);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, n = (r) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
l(e.throw(r));
|
|
11
11
|
} catch (f) {
|
|
12
12
|
a(f);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, l = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(c, n);
|
|
15
|
+
l((e = e.apply(t, o)).next());
|
|
16
16
|
});
|
|
17
|
-
import { u as
|
|
18
|
-
import { i as
|
|
19
|
-
import { g as
|
|
20
|
-
import { c as
|
|
21
|
-
import { d as
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
import { u as I } from "./index.es3.js";
|
|
18
|
+
import { i as g } from "./index.es4.js";
|
|
19
|
+
import { g as p, a as w } from "./index.es5.js";
|
|
20
|
+
import { c as U } from "./index.es6.js";
|
|
21
|
+
import { d as S } from "./index.es7.js";
|
|
22
|
+
const E = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff'), url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff2'); font-style: normal;font-display: swap;}", C = "@font-face { font-family: 'YX-SP-TITLE'; font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff2');font-style: normal; font-display: swap;}", _ = "@font-face {font-family: 'YX-TEXT'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff2'); font-style: normal; font-display: swap;}", A = E + C + _, V = () => m(void 0, null, function* () {
|
|
23
|
+
var o;
|
|
24
|
+
let t = b();
|
|
25
|
+
try {
|
|
26
|
+
const { data: e } = yield p();
|
|
27
|
+
let s = t ? (o = e.find((c) => c.id === t)) == null ? void 0 : o.themeUrl : "";
|
|
28
|
+
if (!t || !s) {
|
|
29
|
+
const n = e.find((l) => l.defaultTheme === 1) || e[0];
|
|
30
|
+
s = n.themeUrl, t = n.id;
|
|
31
|
+
}
|
|
32
|
+
const a = yield u(s);
|
|
33
|
+
T({ themeCssVar: a, themeId: t }), d(), i.onmessage = (c) => {
|
|
34
|
+
const n = c.data;
|
|
35
|
+
n.type === "theme" && u(n.data.themeUrl);
|
|
36
|
+
}, console.log("主题初始化完毕!!!");
|
|
37
|
+
} catch (e) {
|
|
38
|
+
d(), y();
|
|
30
39
|
}
|
|
31
|
-
|
|
32
|
-
p({ themeCssVar: s, themeId: t }), A(), i.onmessage = (a) => {
|
|
33
|
-
const c = a.data;
|
|
34
|
-
c.type === "theme" && u(c.data.themeUrl);
|
|
35
|
-
}, console.log("主题初始化完毕!!!");
|
|
36
|
-
}), A = () => {
|
|
40
|
+
}), d = () => {
|
|
37
41
|
const t = document.createElement("style");
|
|
38
|
-
t.innerHTML =
|
|
39
|
-
},
|
|
42
|
+
t.innerHTML = A, document.head.appendChild(t);
|
|
43
|
+
}, T = ({ themeCssVar: t, themeId: o }) => {
|
|
40
44
|
const e = localStorage.getItem("ttcGlobalState") || "{}", s = JSON.parse(e);
|
|
41
45
|
s.theme = {
|
|
42
46
|
themeCssVar: t,
|
|
43
47
|
id: o
|
|
44
48
|
}, localStorage.setItem("ttcGlobalState", JSON.stringify(s));
|
|
45
|
-
},
|
|
49
|
+
}, B = (t) => m(void 0, null, function* () {
|
|
46
50
|
const o = yield u(t.themeUrl);
|
|
47
|
-
|
|
48
|
-
}),
|
|
51
|
+
T({ themeCssVar: o, themeId: t == null ? void 0 : t.id }), i.postMessage({ type: "theme", data: t });
|
|
52
|
+
}), y = () => {
|
|
49
53
|
const t = h(), o = document.documentElement;
|
|
50
54
|
Object.keys(t).forEach((e) => {
|
|
51
55
|
Object.keys(t[e]).forEach((s) => {
|
|
@@ -53,18 +57,18 @@ const U = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https:
|
|
|
53
57
|
o.style.setProperty(a, t[e][s]);
|
|
54
58
|
});
|
|
55
59
|
});
|
|
56
|
-
}, u = (t) =>
|
|
60
|
+
}, u = (t) => m(void 0, null, function* () {
|
|
57
61
|
const e = yield (yield fetch(t)).json(), s = document.documentElement;
|
|
58
62
|
return Object.keys(e).forEach((a) => {
|
|
59
63
|
Object.keys(e[a]).forEach((c) => {
|
|
60
|
-
const
|
|
61
|
-
s.style.setProperty(
|
|
64
|
+
const n = `--${a}-${c}`;
|
|
65
|
+
s.style.setProperty(n, e[a][c]);
|
|
62
66
|
});
|
|
63
67
|
}), e;
|
|
64
|
-
}), x = () =>
|
|
65
|
-
const { data: t } = yield
|
|
68
|
+
}), x = () => m(void 0, null, function* () {
|
|
69
|
+
const { data: t } = yield p(), o = t.find((s) => s.defaultTheme === 1);
|
|
66
70
|
return o ? o.themeUrl : t[0].themeUrl;
|
|
67
|
-
}),
|
|
71
|
+
}), b = () => {
|
|
68
72
|
var e;
|
|
69
73
|
const t = localStorage.getItem("ttcGlobalState"), o = t && ((e = JSON.parse(t)) == null ? void 0 : e.theme);
|
|
70
74
|
return (o == null ? void 0 : o.id) || null;
|
|
@@ -74,30 +78,30 @@ const U = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https:
|
|
|
74
78
|
return (t && ((e = JSON.parse(t)) == null ? void 0 : e.theme)).themeCssVar;
|
|
75
79
|
}, k = (t) => h()[t] || {}, L = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
76
80
|
__proto__: null,
|
|
77
|
-
changeTheme:
|
|
78
|
-
getCurTheme:
|
|
81
|
+
changeTheme: B,
|
|
82
|
+
getCurTheme: b,
|
|
79
83
|
getCurThemeCssVar: h,
|
|
80
84
|
getDefaultThemeUrl: x,
|
|
81
85
|
getGroupColor: k,
|
|
82
|
-
install:
|
|
83
|
-
updateTheme:
|
|
86
|
+
install: V,
|
|
87
|
+
updateTheme: y
|
|
84
88
|
}, Symbol.toStringTag, { value: "Module" })), i = new BroadcastChannel("YXUSE_BC"), F = {
|
|
85
|
-
utils:
|
|
86
|
-
api:
|
|
89
|
+
utils: I,
|
|
90
|
+
api: w,
|
|
87
91
|
theme: L,
|
|
88
|
-
icons:
|
|
89
|
-
components:
|
|
90
|
-
directives:
|
|
92
|
+
icons: g,
|
|
93
|
+
components: U,
|
|
94
|
+
directives: S,
|
|
91
95
|
BC: i
|
|
92
96
|
};
|
|
93
97
|
export {
|
|
94
98
|
i as B,
|
|
95
|
-
|
|
99
|
+
b as a,
|
|
96
100
|
h as b,
|
|
97
|
-
|
|
101
|
+
B as c,
|
|
98
102
|
k as d,
|
|
99
103
|
F as e,
|
|
100
104
|
x as g,
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
V as i,
|
|
106
|
+
y as u
|
|
103
107
|
};
|