yxuse 1.0.64 → 1.0.65
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 +24 -24
- 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 w=require("./index.cjs3.js"),S=require("./index.cjs4.js"),d=require("./index.cjs5.js"),C=require("./index.cjs6.js"),E=require("./index.cjs7.js"),V="@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;}",_="@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;}",A="@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;}",B=V+_+A,p=()=>m(exports,null,function*(){var s;let t=T();const{data:o}=yield d.getUserThemeList();let e=t?(s=o.find(n=>n.id===t))==null?void 0:s.themeUrl:"";if(!t||!e){const a=o.find(l=>l.defaultTheme===1)||o[0];e=a.themeUrl,t=a.id}const c=yield f(e);y({themeCssVar:c,themeId:t}),L(),i.onmessage=n=>{const a=n.data;a.type==="theme"&&f(a.data.themeUrl)},console.log("主题初始化完毕!!!")}),L=()=>{const t=document.createElement("style");t.innerHTML=B,document.head.appendChild(t)},y=({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))},b=t=>m(exports,null,function*(){const o=yield f(t.themeUrl);y({themeCssVar:o,themeId:t==null?void 0:t.id}),i.postMessage({type:"theme",data:t})}),g=()=>{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}),I=()=>m(exports,null,function*(){const{data:t}=yield d.getUserThemeList(),o=t.find(c=>c.defaultTheme===1);return o?o.themeUrl:t[0].themeUrl}),T=()=>{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},U=t=>u()[t]||{},k=Object.freeze(Object.defineProperty({__proto__:null,changeTheme:b,getCurTheme:T,getCurThemeCssVar:u,getDefaultThemeUrl:I,getGroupColor:U,install:p,updateTheme:g},Symbol.toStringTag,{value:"Module"})),i=new BroadcastChannel("YXUSE_BC"),O={utils:w.utils,api:d.api,theme:k,icons:S.icons,components:C.components,directives:E.directives,BC:i};exports.BC=i;exports.changeTheme=b;exports.getCurTheme=T;exports.getCurThemeCssVar=u;exports.getDefaultThemeUrl=I;exports.getGroupColor=U;exports.index=O;exports.install=p;exports.updateTheme=g;
|
package/lib/index.es2.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
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
17
|
import { u as y } from "./index.es3.js";
|
|
18
18
|
import { i as b } from "./index.es4.js";
|
|
19
19
|
import { g as d, a as I } from "./index.es5.js";
|
|
20
20
|
import { c as g } from "./index.es6.js";
|
|
21
21
|
import { d as w } from "./index.es7.js";
|
|
22
|
-
const U = "@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;}", S = "@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;}", E = "@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;}", C = U + S + E, _ = () =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
22
|
+
const U = "@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;}", S = "@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;}", E = "@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;}", C = U + S + E, _ = () => m(void 0, null, function* () {
|
|
23
|
+
var a;
|
|
24
|
+
let t = T();
|
|
25
|
+
const { data: o } = yield d();
|
|
26
|
+
let e = t ? (a = o.find((c) => c.id === t)) == null ? void 0 : a.themeUrl : "";
|
|
27
|
+
if (!t || !e) {
|
|
28
|
+
const n = o.find((l) => l.defaultTheme === 1) || o[0];
|
|
29
|
+
e = n.themeUrl, t = n.id;
|
|
30
30
|
}
|
|
31
|
-
const s = yield u(
|
|
32
|
-
p({ themeCssVar: s, themeId: t }), A(), i.onmessage = (
|
|
33
|
-
const
|
|
34
|
-
|
|
31
|
+
const s = yield u(e);
|
|
32
|
+
p({ themeCssVar: s, themeId: t }), A(), i.onmessage = (c) => {
|
|
33
|
+
const n = c.data;
|
|
34
|
+
n.type === "theme" && u(n.data.themeUrl);
|
|
35
35
|
}, console.log("主题初始化完毕!!!");
|
|
36
36
|
}), A = () => {
|
|
37
37
|
const t = document.createElement("style");
|
|
@@ -42,7 +42,7 @@ const U = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https:
|
|
|
42
42
|
themeCssVar: t,
|
|
43
43
|
id: o
|
|
44
44
|
}, localStorage.setItem("ttcGlobalState", JSON.stringify(s));
|
|
45
|
-
}, V = (t) =>
|
|
45
|
+
}, V = (t) => m(void 0, null, function* () {
|
|
46
46
|
const o = yield u(t.themeUrl);
|
|
47
47
|
p({ themeCssVar: o, themeId: t == null ? void 0 : t.id }), i.postMessage({ type: "theme", data: t });
|
|
48
48
|
}), B = () => {
|
|
@@ -53,15 +53,15 @@ const U = "@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https:
|
|
|
53
53
|
o.style.setProperty(a, t[e][s]);
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
|
-
}, u = (t) =>
|
|
56
|
+
}, u = (t) => m(void 0, null, function* () {
|
|
57
57
|
const e = yield (yield fetch(t)).json(), s = document.documentElement;
|
|
58
58
|
return Object.keys(e).forEach((a) => {
|
|
59
59
|
Object.keys(e[a]).forEach((c) => {
|
|
60
|
-
const
|
|
61
|
-
s.style.setProperty(
|
|
60
|
+
const n = `--${a}-${c}`;
|
|
61
|
+
s.style.setProperty(n, e[a][c]);
|
|
62
62
|
});
|
|
63
63
|
}), e;
|
|
64
|
-
}), x = () =>
|
|
64
|
+
}), x = () => m(void 0, null, function* () {
|
|
65
65
|
const { data: t } = yield d(), o = t.find((s) => s.defaultTheme === 1);
|
|
66
66
|
return o ? o.themeUrl : t[0].themeUrl;
|
|
67
67
|
}), T = () => {
|