ds-one 0.2.5-alpha.8 → 0.2.5-alpha.9
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/0-face/i18n.ts +36 -89
- package/DS1/1-root/one.css +1 -1
- package/DS1/2-core/ds-button.ts +6 -9
- package/DS1/2-core/ds-cycle.ts +9 -9
- package/DS1/2-core/ds-tooltip.ts +2 -8
- package/README.md +2 -2
- package/dist/0-face/i18n.d.ts +0 -2
- package/dist/0-face/i18n.d.ts.map +1 -1
- package/dist/0-face/i18n.js +36 -73
- package/dist/2-core/ds-button.d.ts +2 -7
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +5 -7
- package/dist/2-core/ds-cycle.d.ts.map +1 -1
- package/dist/2-core/ds-cycle.js +9 -7
- package/dist/2-core/ds-tooltip.d.ts +1 -1
- package/dist/2-core/ds-tooltip.d.ts.map +1 -1
- package/dist/2-core/ds-tooltip.js +2 -8
- package/dist/ds-one.bundle.js +50 -92
- package/dist/ds-one.bundle.js.map +2 -2
- package/dist/ds-one.bundle.min.js +19 -15
- package/dist/ds-one.bundle.min.js.map +3 -3
- package/package.json +1 -2
package/dist/2-core/ds-cycle.js
CHANGED
|
@@ -111,8 +111,6 @@ export class Cycle extends LitElement {
|
|
|
111
111
|
this.currentValue = currentAccentColor;
|
|
112
112
|
// Apply the accent color to ensure it's active
|
|
113
113
|
applyAccentColor();
|
|
114
|
-
// Set label
|
|
115
|
-
this.label = this.getLabel();
|
|
116
114
|
}
|
|
117
115
|
else if (this.type === "notes-style-medium") {
|
|
118
116
|
// Set up notes style medium cycling
|
|
@@ -184,8 +182,6 @@ export class Cycle extends LitElement {
|
|
|
184
182
|
this.currentValue = currentAccentColor;
|
|
185
183
|
// Apply the accent color to ensure it's active
|
|
186
184
|
applyAccentColor();
|
|
187
|
-
// Update label
|
|
188
|
-
this.label = this.getLabel();
|
|
189
185
|
}
|
|
190
186
|
else if (this.type === "notes-style-medium") {
|
|
191
187
|
// Get current notes style medium
|
|
@@ -351,8 +347,8 @@ export class Cycle extends LitElement {
|
|
|
351
347
|
else if (this.type === "theme") {
|
|
352
348
|
// Try to get translated theme name
|
|
353
349
|
if (this.translationsReady) {
|
|
354
|
-
const translatedName = translate(
|
|
355
|
-
if (translatedName && translatedName !==
|
|
350
|
+
const translatedName = translate(value);
|
|
351
|
+
if (translatedName && translatedName !== value) {
|
|
356
352
|
return translatedName;
|
|
357
353
|
}
|
|
358
354
|
}
|
|
@@ -508,7 +504,13 @@ export class Cycle extends LitElement {
|
|
|
508
504
|
default-value="Theme"
|
|
509
505
|
class="cycle-label"
|
|
510
506
|
></ds-text>`
|
|
511
|
-
:
|
|
507
|
+
: this.type === "accent-color"
|
|
508
|
+
? html `<ds-text
|
|
509
|
+
key="accentColor"
|
|
510
|
+
default-value="Accent color"
|
|
511
|
+
class="cycle-label"
|
|
512
|
+
></ds-text>`
|
|
513
|
+
: html `<span class="cycle-label">${this.label}</span>`}`
|
|
512
514
|
: ""}
|
|
513
515
|
<div
|
|
514
516
|
style="display: flex; align-items: center; ${this.type === "icon-only"
|
|
@@ -28,7 +28,7 @@ export declare class Tooltip extends LitElement {
|
|
|
28
28
|
connectedCallback(): void;
|
|
29
29
|
disconnectedCallback(): void;
|
|
30
30
|
updated(changed: Map<string, unknown>): void;
|
|
31
|
-
_loadText():
|
|
31
|
+
_loadText(): void;
|
|
32
32
|
render(): import("lit-html").TemplateResult<1>;
|
|
33
33
|
}
|
|
34
34
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-tooltip.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBAAa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;MAKf;IAEM,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,mBAAmB,CAGzB;IACF,OAAO,CAAC,iBAAiB,CAKvB;;IAsCF,MAAM,CAAC,MAAM,0BA+CX;IAEF,iBAAiB,IAAI,IAAI;IAmBzB,oBAAoB,IAAI,IAAI;IAiB5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"ds-tooltip.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBAAa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;MAKf;IAEM,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,mBAAmB,CAGzB;IACF,OAAO,CAAC,iBAAiB,CAKvB;;IAsCF,MAAM,CAAC,MAAM,0BA+CX;IAEF,iBAAiB,IAAI,IAAI;IAmBzB,oBAAoB,IAAI,IAAI;IAiB5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAM5C,SAAS,IAAI,IAAI;IAiBjB,MAAM;CAUP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,OAAO,CAAC;KACvB;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { translate
|
|
2
|
+
import { translate } from "../0-face/i18n";
|
|
3
3
|
export class Tooltip extends LitElement {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
@@ -58,19 +58,13 @@ export class Tooltip extends LitElement {
|
|
|
58
58
|
this._loadText();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
_loadText() {
|
|
62
62
|
if (!this.key) {
|
|
63
63
|
this._text = this.defaultValue || "";
|
|
64
64
|
this.requestUpdate();
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
68
|
-
const notionText = await getNotionText(this.key);
|
|
69
|
-
if (notionText) {
|
|
70
|
-
this._text = notionText;
|
|
71
|
-
this.requestUpdate();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
68
|
const t = translate(this.key);
|
|
75
69
|
this._text = t && t !== this.key ? t : this.defaultValue || this.key;
|
|
76
70
|
}
|
package/dist/ds-one.bundle.js
CHANGED
|
@@ -82,41 +82,41 @@ if (typeof window !== "undefined") {
|
|
|
82
82
|
var translationKeys = {};
|
|
83
83
|
var LANGUAGE_PRIORITY_ORDER = [
|
|
84
84
|
"da",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"pt",
|
|
85
|
+
"de",
|
|
86
|
+
"en",
|
|
88
87
|
"es",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
88
|
+
"fr",
|
|
89
|
+
"it",
|
|
91
90
|
"ja",
|
|
92
|
-
"
|
|
93
|
-
"
|
|
91
|
+
"pt",
|
|
92
|
+
"sv",
|
|
93
|
+
"zh"
|
|
94
94
|
];
|
|
95
95
|
var LANGUAGE_PRIORITY_LOOKUP = new Map(LANGUAGE_PRIORITY_ORDER.map((code, index) => [code, index]));
|
|
96
96
|
var FALLBACK_LANGUAGE_NAMES = {
|
|
97
97
|
da: "Danish",
|
|
98
98
|
"da-dk": "Danish",
|
|
99
|
-
nb: "Norwegian",
|
|
100
|
-
"nb-no": "Norwegian",
|
|
101
|
-
sv: "Swedish",
|
|
102
|
-
"sv-se": "Swedish",
|
|
103
99
|
de: "German",
|
|
104
100
|
"de-de": "German",
|
|
105
101
|
en: "English",
|
|
106
102
|
"en-us": "English",
|
|
107
|
-
pt: "Portuguese",
|
|
108
|
-
"pt-pt": "Portuguese",
|
|
109
|
-
"pt-br": "Portuguese (Brazil)",
|
|
110
103
|
es: "Spanish",
|
|
111
104
|
"es-es": "Spanish",
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"
|
|
105
|
+
fr: "French",
|
|
106
|
+
"fr-fr": "French",
|
|
107
|
+
it: "Italian",
|
|
108
|
+
"it-it": "Italian",
|
|
116
109
|
ja: "Japanese",
|
|
117
110
|
"ja-jp": "Japanese",
|
|
118
|
-
|
|
119
|
-
"
|
|
111
|
+
pt: "Portuguese",
|
|
112
|
+
"pt-pt": "Portuguese",
|
|
113
|
+
sv: "Swedish",
|
|
114
|
+
"sv-se": "Swedish",
|
|
115
|
+
zh: "Chinese",
|
|
116
|
+
"zh-cn": "Chinese",
|
|
117
|
+
"zh-tw": "Chinese",
|
|
118
|
+
"zh-hans": "Chinese",
|
|
119
|
+
"zh-hant": "Chinese"
|
|
120
120
|
};
|
|
121
121
|
var DISPLAY_NAME_CACHE = /* @__PURE__ */ new Map();
|
|
122
122
|
var displayNameFallbackWarningShown = false;
|
|
@@ -232,7 +232,6 @@ function getTranslationData() {
|
|
|
232
232
|
return translationKeys;
|
|
233
233
|
}
|
|
234
234
|
var translationData = getTranslationData();
|
|
235
|
-
var notionStore = /* @__PURE__ */ new Map();
|
|
236
235
|
var defaultLanguage = "en";
|
|
237
236
|
function extractPrimarySubtag(code) {
|
|
238
237
|
if (!code) {
|
|
@@ -336,33 +335,30 @@ function getLanguageDisplayName(code, options = {}) {
|
|
|
336
335
|
var BROWSER_LANGUAGE_PREFERENCES = {
|
|
337
336
|
da: "da",
|
|
338
337
|
"da-dk": "da",
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
"
|
|
344
|
-
sv: "sv",
|
|
345
|
-
"sv-se": "sv",
|
|
346
|
-
pt: "pt",
|
|
347
|
-
"pt-pt": "pt",
|
|
348
|
-
"pt-br": "pt",
|
|
338
|
+
de: "de",
|
|
339
|
+
"de-de": "de",
|
|
340
|
+
en: "en",
|
|
341
|
+
"en-us": "en",
|
|
342
|
+
"en-gb": "en",
|
|
349
343
|
es: "es",
|
|
350
344
|
"es-es": "es",
|
|
351
345
|
"es-mx": "es",
|
|
346
|
+
fr: "fr",
|
|
347
|
+
"fr-fr": "fr",
|
|
348
|
+
it: "it",
|
|
349
|
+
"it-it": "it",
|
|
350
|
+
ja: "ja",
|
|
351
|
+
"ja-jp": "ja",
|
|
352
|
+
pt: "pt",
|
|
353
|
+
"pt-pt": "pt",
|
|
354
|
+
"pt-br": "pt",
|
|
355
|
+
sv: "sv",
|
|
356
|
+
"sv-se": "sv",
|
|
352
357
|
zh: "zh",
|
|
353
358
|
"zh-cn": "zh",
|
|
354
359
|
"zh-hans": "zh",
|
|
355
360
|
"zh-tw": "zh",
|
|
356
|
-
"zh-hant": "zh"
|
|
357
|
-
ko: "ko",
|
|
358
|
-
"ko-kr": "ko",
|
|
359
|
-
ja: "ja",
|
|
360
|
-
"ja-jp": "ja",
|
|
361
|
-
en: "en",
|
|
362
|
-
"en-us": "en",
|
|
363
|
-
"en-gb": "en",
|
|
364
|
-
de: "de",
|
|
365
|
-
"de-de": "de"
|
|
361
|
+
"zh-hant": "zh"
|
|
366
362
|
};
|
|
367
363
|
function resolvePreferredLanguage(languageTag) {
|
|
368
364
|
if (!languageTag) {
|
|
@@ -427,7 +423,6 @@ if (typeof window !== "undefined") {
|
|
|
427
423
|
window.addEventListener("translations-ready", () => {
|
|
428
424
|
translationData = getTranslationData();
|
|
429
425
|
window.dispatchEvent(new CustomEvent("translations-loaded"));
|
|
430
|
-
window.notionDataLoaded = true;
|
|
431
426
|
const currentLang = currentLanguage.value;
|
|
432
427
|
window.dispatchEvent(new CustomEvent("language-changed", {
|
|
433
428
|
detail: { language: currentLang },
|
|
@@ -438,7 +433,6 @@ if (typeof window !== "undefined") {
|
|
|
438
433
|
}
|
|
439
434
|
setTimeout(() => {
|
|
440
435
|
window.dispatchEvent(new CustomEvent("translations-loaded"));
|
|
441
|
-
window.notionDataLoaded = true;
|
|
442
436
|
const currentLang = currentLanguage.value;
|
|
443
437
|
window.dispatchEvent(new CustomEvent("language-changed", {
|
|
444
438
|
detail: { language: currentLang },
|
|
@@ -473,34 +467,6 @@ function hasTranslation(key, language = currentLanguage.value) {
|
|
|
473
467
|
function getText(key) {
|
|
474
468
|
return translate(key);
|
|
475
469
|
}
|
|
476
|
-
async function getNotionText(key, language = currentLanguage.value) {
|
|
477
|
-
if (!key) {
|
|
478
|
-
return null;
|
|
479
|
-
}
|
|
480
|
-
if (!translationData || !translationData[language]) {
|
|
481
|
-
return null;
|
|
482
|
-
}
|
|
483
|
-
const text = translationData[language][key];
|
|
484
|
-
if (text) {
|
|
485
|
-
return text;
|
|
486
|
-
}
|
|
487
|
-
if (language !== defaultLanguage && translationData[defaultLanguage]?.[key]) {
|
|
488
|
-
return translationData[defaultLanguage][key];
|
|
489
|
-
}
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
function setNotionText(key, value, language = currentLanguage.value) {
|
|
493
|
-
if (!key)
|
|
494
|
-
return;
|
|
495
|
-
const bucket = getLanguageBucket(language);
|
|
496
|
-
bucket.set(key, value);
|
|
497
|
-
}
|
|
498
|
-
function getLanguageBucket(language) {
|
|
499
|
-
if (!notionStore.has(language)) {
|
|
500
|
-
notionStore.set(language, /* @__PURE__ */ new Map());
|
|
501
|
-
}
|
|
502
|
-
return notionStore.get(language);
|
|
503
|
-
}
|
|
504
470
|
function getAvailableLanguages() {
|
|
505
471
|
const currentData = getTranslationData();
|
|
506
472
|
if (currentData && Object.keys(currentData).length > 0) {
|
|
@@ -1853,14 +1819,13 @@ var Button = class extends i6 {
|
|
|
1853
1819
|
this.bold = false;
|
|
1854
1820
|
this["no-background"] = false;
|
|
1855
1821
|
this.blank = false;
|
|
1856
|
-
this.notionKey = null;
|
|
1857
1822
|
this.key = "";
|
|
1858
1823
|
this.fallback = "";
|
|
1859
1824
|
this.language = "en-US";
|
|
1860
1825
|
this.defaultText = "";
|
|
1861
1826
|
this.href = "";
|
|
1862
1827
|
this._loading = false;
|
|
1863
|
-
this.
|
|
1828
|
+
this._text = null;
|
|
1864
1829
|
}
|
|
1865
1830
|
connectedCallback() {
|
|
1866
1831
|
super.connectedCallback();
|
|
@@ -1882,9 +1847,9 @@ var Button = class extends i6 {
|
|
|
1882
1847
|
*/
|
|
1883
1848
|
_updateText() {
|
|
1884
1849
|
if (this.key) {
|
|
1885
|
-
this.
|
|
1850
|
+
this._text = getText(this.key);
|
|
1886
1851
|
} else {
|
|
1887
|
-
this.
|
|
1852
|
+
this._text = this.defaultText || this.fallback || null;
|
|
1888
1853
|
}
|
|
1889
1854
|
this.requestUpdate();
|
|
1890
1855
|
}
|
|
@@ -1897,7 +1862,7 @@ var Button = class extends i6 {
|
|
|
1897
1862
|
?no-background=${this["no-background"]}
|
|
1898
1863
|
@click=${this._handleClick}
|
|
1899
1864
|
>
|
|
1900
|
-
${this.
|
|
1865
|
+
${this._text ? this._text : x`<slot></slot>`}
|
|
1901
1866
|
</button>
|
|
1902
1867
|
`;
|
|
1903
1868
|
}
|
|
@@ -1929,14 +1894,13 @@ Button.properties = {
|
|
|
1929
1894
|
attribute: "no-background"
|
|
1930
1895
|
},
|
|
1931
1896
|
blank: { type: Boolean, reflect: true },
|
|
1932
|
-
notionKey: { type: String, attribute: "notion-key" },
|
|
1933
1897
|
key: { type: String },
|
|
1934
1898
|
fallback: { type: String },
|
|
1935
1899
|
language: { type: String },
|
|
1936
1900
|
defaultText: { type: String, attribute: "default-text" },
|
|
1937
1901
|
href: { type: String },
|
|
1938
1902
|
_loading: { type: Boolean, state: true },
|
|
1939
|
-
|
|
1903
|
+
_text: { type: String, state: true }
|
|
1940
1904
|
};
|
|
1941
1905
|
Button.styles = i4`
|
|
1942
1906
|
button {
|
|
@@ -2465,7 +2429,6 @@ var Cycle = class extends i6 {
|
|
|
2465
2429
|
const currentAccentColor = getAccentColor();
|
|
2466
2430
|
this.currentValue = currentAccentColor;
|
|
2467
2431
|
applyAccentColor();
|
|
2468
|
-
this.label = this.getLabel();
|
|
2469
2432
|
} else if (this.type === "notes-style-medium") {
|
|
2470
2433
|
this.values = ["default", "big", "gallery"];
|
|
2471
2434
|
const currentNotesStyle = getNotesStyleMedium();
|
|
@@ -2513,7 +2476,6 @@ var Cycle = class extends i6 {
|
|
|
2513
2476
|
const currentAccentColor = getAccentColor();
|
|
2514
2477
|
this.currentValue = currentAccentColor;
|
|
2515
2478
|
applyAccentColor();
|
|
2516
|
-
this.label = this.getLabel();
|
|
2517
2479
|
} else if (this.type === "notes-style-medium") {
|
|
2518
2480
|
const currentNotesStyle = getNotesStyleMedium();
|
|
2519
2481
|
this.currentValue = currentNotesStyle;
|
|
@@ -2624,8 +2586,8 @@ var Cycle = class extends i6 {
|
|
|
2624
2586
|
});
|
|
2625
2587
|
} else if (this.type === "theme") {
|
|
2626
2588
|
if (this.translationsReady) {
|
|
2627
|
-
const translatedName = translate(
|
|
2628
|
-
if (translatedName && translatedName !==
|
|
2589
|
+
const translatedName = translate(value);
|
|
2590
|
+
if (translatedName && translatedName !== value) {
|
|
2629
2591
|
return translatedName;
|
|
2630
2592
|
}
|
|
2631
2593
|
}
|
|
@@ -2743,7 +2705,11 @@ var Cycle = class extends i6 {
|
|
|
2743
2705
|
key="theme"
|
|
2744
2706
|
default-value="Theme"
|
|
2745
2707
|
class="cycle-label"
|
|
2746
|
-
></ds-text>` :
|
|
2708
|
+
></ds-text>` : this.type === "accent-color" ? x`<ds-text
|
|
2709
|
+
key="accentColor"
|
|
2710
|
+
default-value="Accent color"
|
|
2711
|
+
class="cycle-label"
|
|
2712
|
+
></ds-text>` : x`<span class="cycle-label">${this.label}</span>`}` : ""}
|
|
2747
2713
|
<div
|
|
2748
2714
|
style="display: flex; align-items: center; ${this.type === "icon-only" ? "justify-content: center;" : ""}"
|
|
2749
2715
|
>
|
|
@@ -2880,19 +2846,13 @@ var Tooltip = class extends i6 {
|
|
|
2880
2846
|
this._loadText();
|
|
2881
2847
|
}
|
|
2882
2848
|
}
|
|
2883
|
-
|
|
2849
|
+
_loadText() {
|
|
2884
2850
|
if (!this.key) {
|
|
2885
2851
|
this._text = this.defaultValue || "";
|
|
2886
2852
|
this.requestUpdate();
|
|
2887
2853
|
return;
|
|
2888
2854
|
}
|
|
2889
2855
|
try {
|
|
2890
|
-
const notionText = await getNotionText(this.key);
|
|
2891
|
-
if (notionText) {
|
|
2892
|
-
this._text = notionText;
|
|
2893
|
-
this.requestUpdate();
|
|
2894
|
-
return;
|
|
2895
|
-
}
|
|
2896
2856
|
const t5 = translate(this.key);
|
|
2897
2857
|
this._text = t5 && t5 !== this.key ? t5 : this.defaultValue || this.key;
|
|
2898
2858
|
} catch (err) {
|
|
@@ -3523,7 +3483,6 @@ export {
|
|
|
3523
3483
|
getBrowserLanguage,
|
|
3524
3484
|
getDeviceInfo,
|
|
3525
3485
|
getLanguageDisplayName,
|
|
3526
|
-
getNotionText,
|
|
3527
3486
|
getPriceLabel,
|
|
3528
3487
|
getText,
|
|
3529
3488
|
hasTranslation,
|
|
@@ -3531,7 +3490,6 @@ export {
|
|
|
3531
3490
|
loadTranslations,
|
|
3532
3491
|
savePreferences,
|
|
3533
3492
|
setLanguage,
|
|
3534
|
-
setNotionText,
|
|
3535
3493
|
setTheme,
|
|
3536
3494
|
translate
|
|
3537
3495
|
};
|