@everymatrix/general-styling-wrapper 1.67.0 → 1.68.0
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.
|
@@ -11,8 +11,8 @@ const mergeTranslations = (url, target) => {
|
|
|
11
11
|
.then((data) => {
|
|
12
12
|
Object.keys(data).forEach((item) => {
|
|
13
13
|
target[item] = target[item] || target['en'];
|
|
14
|
-
|
|
15
|
-
//if there is
|
|
14
|
+
Object.keys(data[item]).forEach((key) => {
|
|
15
|
+
//if there is not key in target, do nothing
|
|
16
16
|
if (!target['en'][key]) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
@@ -26,7 +26,7 @@ const mergeTranslations = (url, target) => {
|
|
|
26
26
|
else {
|
|
27
27
|
target[item][key] = data[item][key];
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
});
|
|
30
30
|
});
|
|
31
31
|
resolve(true);
|
|
32
32
|
});
|
|
@@ -5,8 +5,8 @@ export const mergeTranslations = (url, target) => {
|
|
|
5
5
|
.then((data) => {
|
|
6
6
|
Object.keys(data).forEach((item) => {
|
|
7
7
|
target[item] = target[item] || target['en'];
|
|
8
|
-
|
|
9
|
-
//if there is
|
|
8
|
+
Object.keys(data[item]).forEach((key) => {
|
|
9
|
+
//if there is not key in target, do nothing
|
|
10
10
|
if (!target['en'][key]) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -20,7 +20,7 @@ export const mergeTranslations = (url, target) => {
|
|
|
20
20
|
else {
|
|
21
21
|
target[item][key] = data[item][key];
|
|
22
22
|
}
|
|
23
|
-
}
|
|
23
|
+
});
|
|
24
24
|
});
|
|
25
25
|
resolve(true);
|
|
26
26
|
});
|
|
@@ -7,8 +7,8 @@ const mergeTranslations = (url, target) => {
|
|
|
7
7
|
.then((data) => {
|
|
8
8
|
Object.keys(data).forEach((item) => {
|
|
9
9
|
target[item] = target[item] || target['en'];
|
|
10
|
-
|
|
11
|
-
//if there is
|
|
10
|
+
Object.keys(data[item]).forEach((key) => {
|
|
11
|
+
//if there is not key in target, do nothing
|
|
12
12
|
if (!target['en'][key]) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
@@ -22,7 +22,7 @@ const mergeTranslations = (url, target) => {
|
|
|
22
22
|
else {
|
|
23
23
|
target[item][key] = data[item][key];
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
});
|
|
26
26
|
});
|
|
27
27
|
resolve(true);
|
|
28
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as
|
|
1
|
+
import{r as t,h as s,g as e}from"./index-5d1b44a7.js";const i=class{constructor(s){t(this,s),this.stylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.el.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),s=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{s.innerHTML=t,setTimeout((()=>{this.el.prepend(s)}),1)})).catch((t=>{console.log("error ",t)}))},this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.targetTranslations=void 0}componentDidRender(){this.stylingAppends||(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}async componentWillLoad(){const t=[];if(this.translationUrl){const i=(s=this.translationUrl,e=this.targetTranslations,new Promise((t=>{fetch(s).then((t=>t.json())).then((s=>{Object.keys(s).forEach((t=>{e[t]=e[t]||e.en,Object.keys(s[t]).forEach((i=>{e.en[i]&&(e[t][i]=e[t][i]||e.en[i],"object"==typeof s[t][i]?Object.keys(s[t][i]).forEach((o=>{e[t][i][o]=s[t][i][o]})):e[t][i]=s[t][i])}))})),t(!0)}))})));t.push(i)}var s,e;return await Promise.all(t)}render(){return s("div",{key:"4d3414408c7662f88331dbe655966237f74d6958",class:"StyleShell"},s("slot",{key:"1d004644d84602c4314bdf5dfc26b55b160f57df",name:"mainContent"}))}get el(){return e(this)}};i.style=":host{display:block}";export{i as general_styling_wrapper}
|