ds-one 0.3.0-alpha.6 → 0.3.0-alpha.7
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/DS1/1-root/one.css +1 -1
- package/DS1/2-core/ds-text.ts +29 -11
- package/README.md +2 -2
- package/dist/2-core/ds-text.d.ts +9 -1
- package/dist/2-core/ds-text.d.ts.map +1 -1
- package/dist/2-core/ds-text.js +26 -10
- package/dist/ds-one.bundle.js +21 -13
- package/dist/ds-one.bundle.js.map +1 -1
- package/dist/ds-one.bundle.min.js +19 -14
- package/dist/ds-one.bundle.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1519,21 +1519,25 @@ const ha = F.litElementPolyfillSupport;
|
|
|
1519
1519
|
ha?.({ LitElement: f });
|
|
1520
1520
|
(F.litElementVersions ?? (F.litElementVersions = [])).push("4.2.1");
|
|
1521
1521
|
const ua = ':host{display:inline-flex;align-items:center;justify-content:flex-start;height:calc(16px * var(--sf));font-family:var(--typeface-regular);font-size:var(--type-size-default);font-weight:var(--type-weight-default);line-height:calc(var(--type-lineheight-default) * var(--sf));letter-spacing:calc(var(--type-letterspacing-default) * var(--sf));text-align:left;text-transform:var(--text-transform-default);text-decoration:var(--text-decoration-default);vertical-align:middle;white-space:nowrap;color:inherit}:host([data-language="ja"]){font-family:var(--typeface-regular-jp)}:host([data-language="zh"]),:host([data-language="zh-hant"]){font-family:var(--typeface-regular-zh-hant);font-weight:800}:host([data-language="zh-hans"]){font-family:var(--typeface-regular-zh-hans);font-weight:800}:host span{color:inherit}', dt = class dt extends f {
|
|
1522
|
+
constructor() {
|
|
1523
|
+
super(), this._slotKey = "", this.text = "", this._text = "", this._currentLanguage = C.value, this.boundHandlers = {
|
|
1524
|
+
languageChanged: (() => {
|
|
1525
|
+
this._currentLanguage = C.value, this._updateLanguageAttribute(), this._loadText(), this.requestUpdate();
|
|
1526
|
+
})
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1522
1529
|
static get properties() {
|
|
1523
1530
|
return {
|
|
1524
1531
|
text: { type: String, reflect: !0 },
|
|
1525
1532
|
_text: { type: String, state: !0 }
|
|
1526
1533
|
};
|
|
1527
1534
|
}
|
|
1528
|
-
constructor() {
|
|
1529
|
-
super(), this.text = "", this._text = "", this._currentLanguage = C.value, this.boundHandlers = {
|
|
1530
|
-
languageChanged: (() => {
|
|
1531
|
-
console.log("Language changed event received in ds-text"), this._currentLanguage = C.value, this._updateLanguageAttribute(), this._loadText(), this.requestUpdate();
|
|
1532
|
-
})
|
|
1533
|
-
};
|
|
1534
|
-
}
|
|
1535
1535
|
connectedCallback() {
|
|
1536
|
-
super.connectedCallback(), this.
|
|
1536
|
+
if (super.connectedCallback(), !this.text) {
|
|
1537
|
+
const e = this.textContent?.trim() || "";
|
|
1538
|
+
e && (this._slotKey = e, this.textContent = "");
|
|
1539
|
+
}
|
|
1540
|
+
this._currentLanguage = C.value, this._updateLanguageAttribute(), this._loadText(), window.addEventListener(
|
|
1537
1541
|
"language-changed",
|
|
1538
1542
|
this.boundHandlers.languageChanged
|
|
1539
1543
|
), window.addEventListener(
|
|
@@ -1567,20 +1571,21 @@ const ua = ':host{display:inline-flex;align-items:center;justify-content:flex-st
|
|
|
1567
1571
|
this.removeAttribute("data-language");
|
|
1568
1572
|
}
|
|
1569
1573
|
_loadText() {
|
|
1570
|
-
|
|
1574
|
+
const e = this.text || this._slotKey;
|
|
1575
|
+
if (!e) {
|
|
1571
1576
|
this._text = "", this._updateLanguageAttribute(), this.requestUpdate();
|
|
1572
1577
|
return;
|
|
1573
1578
|
}
|
|
1574
1579
|
try {
|
|
1575
|
-
const
|
|
1576
|
-
this._text =
|
|
1577
|
-
} catch (
|
|
1578
|
-
console.error("Error loading text for
|
|
1580
|
+
const r = q(e);
|
|
1581
|
+
this._text = r || e;
|
|
1582
|
+
} catch (r) {
|
|
1583
|
+
console.error("Error loading text for key:", e, r), this._text = e;
|
|
1579
1584
|
}
|
|
1580
1585
|
this._updateLanguageAttribute(), this.requestUpdate();
|
|
1581
1586
|
}
|
|
1582
1587
|
render() {
|
|
1583
|
-
return l`<span>${this._text || this.text}</span>`;
|
|
1588
|
+
return l`<span>${this._text || this.text || this._slotKey}</span>`;
|
|
1584
1589
|
}
|
|
1585
1590
|
};
|
|
1586
1591
|
dt.styles = x(ua);
|