ds-one 0.2.5-alpha.16 → 0.2.5-alpha.17

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.
@@ -10,9 +10,6 @@ export declare class Cycle extends LitElement {
10
10
  values: {
11
11
  type: ArrayConstructor;
12
12
  };
13
- label: {
14
- type: StringConstructor;
15
- };
16
13
  currentValue: {
17
14
  type: StringConstructor;
18
15
  state: boolean;
@@ -32,7 +29,6 @@ export declare class Cycle extends LitElement {
32
29
  static styles: import("lit").CSSResult;
33
30
  type: string;
34
31
  values: string[];
35
- label: string;
36
32
  currentValue: string;
37
33
  translationsReady: boolean;
38
34
  disabled: boolean;
@@ -51,7 +47,6 @@ export declare class Cycle extends LitElement {
51
47
  getColorKey(colorVar: string): string;
52
48
  getColorName(colorVar: string): string;
53
49
  getNotesStyleIcon(style: string): import("lit-html").TemplateResult<1>;
54
- getLabel(): string;
55
50
  render(): import("lit-html").TemplateResult<1>;
56
51
  private waitForTranslations;
57
52
  private handleTranslationsLoaded;
@@ -1 +1 @@
1
- {"version":3,"file":"ds-cycle.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAY5C,OAAO,aAAa,CAAC;AACrB,OAAO,WAAW,CAAC;AACnB,OAAO,WAAW,CAAC;AAqCnB,qBAAa,KAAM,SAAQ,UAAU;IAEnC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;MAUpB;IAED,MAAM,CAAC,MAAM,0BAWX;IAIM,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,aAAa,CAOnB;;IAyBF,iBAAiB;IA6BX,gBAAgB;IA6EtB,sBAAsB;IAatB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IASnE,iBAAiB;IAoDvB,qBAAqB;IAKrB,oBAAoB;IA0BpB,iBAAiB,CAAC,CAAC,EAAE,KAAK;IAuJ1B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IA+C5C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAgBrC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAyBtC,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAe/B,QAAQ,IAAI,MAAM;IAgElB,MAAM;YAgFQ,mBAAmB;IAwBjC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,yBAAyB;CAGlC;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAC;KACnB;CACF"}
1
+ {"version":3,"file":"ds-cycle.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAY5C,OAAO,aAAa,CAAC;AACrB,OAAO,WAAW,CAAC;AACnB,OAAO,WAAW,CAAC;AAqCnB,qBAAa,KAAM,SAAQ,UAAU;IAEnC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;;;;;MASpB;IAED,MAAM,CAAC,MAAM,0BAoBX;IAIM,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,aAAa,CAOnB;;IAwBF,iBAAiB;IA6BX,gBAAgB;IA8DtB,sBAAsB;IAatB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IASnE,iBAAiB;IAqCvB,qBAAqB;IAKrB,oBAAoB;IA0BpB,iBAAiB,CAAC,CAAC,EAAE,KAAK;IAiJ1B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IA+C5C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAgBrC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAyBtC,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAe/B,MAAM;YAoDQ,mBAAmB;IAwBjC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,yBAAyB;CAGlC;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAC;KACnB;CACF"}
@@ -38,7 +38,6 @@ export class Cycle extends LitElement {
38
38
  return {
39
39
  type: { type: String },
40
40
  values: { type: Array },
41
- label: { type: String },
42
41
  currentValue: { type: String, state: true }, // Make this a private state property
43
42
  translationsReady: { type: Boolean, state: true }, // Track if translations are loaded
44
43
  disabled: { type: Boolean, state: true },
@@ -50,7 +49,6 @@ export class Cycle extends LitElement {
50
49
  // Initialize properties with default values
51
50
  this.type = "";
52
51
  this.values = [];
53
- this.label = "";
54
52
  this.currentValue = "";
55
53
  this.translationsReady = false;
56
54
  this.disabled = false;
@@ -82,8 +80,6 @@ export class Cycle extends LitElement {
82
80
  const availableLanguages = getAvailableLanguagesSync();
83
81
  this.values = availableLanguages;
84
82
  this.currentValue = currentLanguage.value;
85
- // Set label
86
- this.label = this.getLabel();
87
83
  }
88
84
  else if (this.type === "theme") {
89
85
  // Set up theme cycling
@@ -91,8 +87,6 @@ export class Cycle extends LitElement {
91
87
  // Set initial value based on current theme
92
88
  const currentThemeValue = currentTheme.get();
93
89
  this.currentValue = currentThemeValue;
94
- // Set label
95
- this.label = this.getLabel();
96
90
  }
97
91
  else if (this.type === "accent-color") {
98
92
  // Set up accent color cycling
@@ -121,8 +115,6 @@ export class Cycle extends LitElement {
121
115
  // Check if this should be disabled based on note behavior
122
116
  const currentPageStyle = getPageStyle();
123
117
  this.disabled = currentPageStyle === "note";
124
- // Set label
125
- this.label = this.getLabel();
126
118
  }
127
119
  else if (this.type === "page-style") {
128
120
  // Set up page style cycling
@@ -130,16 +122,12 @@ export class Cycle extends LitElement {
130
122
  // Set initial value based on current page style
131
123
  const currentPageStyle = getPageStyle();
132
124
  this.currentValue = currentPageStyle;
133
- // Set label
134
- this.label = this.getLabel();
135
125
  }
136
126
  else if (this.type === "icon-only") {
137
127
  // Set up icon-only cycling (no label)
138
128
  this.values = ["note", "page"];
139
129
  // Set initial value
140
130
  this.currentValue = this.values[0];
141
- // No label for icon-only type
142
- this.label = "";
143
131
  }
144
132
  // Request update to re-render with new values
145
133
  this.requestUpdate();
@@ -166,15 +154,11 @@ export class Cycle extends LitElement {
166
154
  // Get current language
167
155
  const currentLang = currentLanguage.value;
168
156
  this.currentValue = currentLang;
169
- // Update label
170
- this.label = this.getLabel();
171
157
  }
172
158
  else if (this.type === "theme") {
173
159
  // Get current theme
174
160
  const currentThemeValue = currentTheme.get();
175
161
  this.currentValue = currentThemeValue;
176
- // Update label
177
- this.label = this.getLabel();
178
162
  }
179
163
  else if (this.type === "accent-color") {
180
164
  // Get current accent color
@@ -190,22 +174,16 @@ export class Cycle extends LitElement {
190
174
  // Check if this should be disabled based on note behavior
191
175
  const currentPageStyle = getPageStyle();
192
176
  this.disabled = currentPageStyle === "note";
193
- // Update label
194
- this.label = this.getLabel();
195
177
  }
196
178
  else if (this.type === "page-style") {
197
179
  // Get current page style
198
180
  const currentPageStyle = getPageStyle();
199
181
  this.currentValue = currentPageStyle;
200
- // Update label
201
- this.label = this.getLabel();
202
182
  }
203
183
  else if (this.type === "icon-only") {
204
184
  // Get current page style for icon-only
205
185
  const currentPageStyle = getPageStyle();
206
186
  this.currentValue = currentPageStyle;
207
- // Update label
208
- this.label = "";
209
187
  }
210
188
  this.requestUpdate();
211
189
  }
@@ -326,15 +304,11 @@ export class Cycle extends LitElement {
326
304
  savePageStyle(newIconOnlyValue);
327
305
  // Save preferences
328
306
  savePreferences({ pageStyle: newIconOnlyValue });
329
- // No label update for icon-only type
330
- this.label = "";
331
307
  // Dispatch page style change event
332
308
  window.dispatchEvent(new CustomEvent("page-style-changed", {
333
309
  detail: { behavior: newIconOnlyValue },
334
310
  }));
335
311
  }
336
- // Update label
337
- this.label = this.getLabel();
338
312
  // Request update to re-render
339
313
  this.requestUpdate();
340
314
  }
@@ -440,142 +414,54 @@ export class Cycle extends LitElement {
440
414
  }
441
415
  return html `<span>${style}</span>`;
442
416
  }
443
- getLabel() {
444
- if (this.type === "language") {
445
- // Try to get translated label
446
- if (this.translationsReady) {
447
- const translatedLabel = translate("language");
448
- if (translatedLabel && translatedLabel !== "language") {
449
- return translatedLabel;
450
- }
451
- }
452
- // Fall back to English
453
- return "Language";
454
- }
455
- else if (this.type === "theme") {
456
- // Try to get translated label
457
- if (this.translationsReady) {
458
- const translatedLabel = translate("theme");
459
- if (translatedLabel && translatedLabel !== "theme") {
460
- return translatedLabel;
461
- }
462
- }
463
- // Fall back to English
464
- return "Theme";
465
- }
466
- else if (this.type === "accent-color") {
467
- // Try to get translated label
468
- if (this.translationsReady) {
469
- const translatedLabel = translate("accentColor");
470
- if (translatedLabel && translatedLabel !== "accentColor") {
471
- return translatedLabel;
472
- }
473
- }
474
- // Fall back to English
475
- return "Accent Color";
476
- }
477
- else if (this.type === "notes-style-medium") {
478
- // Try to get translated label
479
- if (this.translationsReady) {
480
- const translatedLabel = translate("notesStyle");
481
- if (translatedLabel && translatedLabel !== "notesStyle") {
482
- return translatedLabel;
483
- }
484
- }
485
- // Fall back to English
486
- return "Notes Style";
487
- }
488
- else if (this.type === "page-style") {
489
- // Try to get translated label
490
- if (this.translationsReady) {
491
- const translatedLabel = translate("clickingItem");
492
- if (translatedLabel && translatedLabel !== "clickingItem") {
493
- return translatedLabel;
494
- }
495
- }
496
- // Fall back to English
497
- return "Clic";
498
- }
499
- else if (this.type === "icon-only") {
500
- // No label for icon-only type
501
- return "";
502
- }
503
- return this.label;
504
- }
505
417
  render() {
506
418
  return html `
507
- <div class="cycle-container">
508
- ${this.type !== "icon-only"
509
- ? html `${this.type === "language"
510
- ? html `<ds-text
511
- key="language"
512
- default-value="Language"
513
- class="cycle-label"
514
- ></ds-text>`
515
- : this.type === "theme"
516
- ? html `<ds-text
517
- key="theme"
518
- default-value="Theme"
519
- class="cycle-label"
520
- ></ds-text>`
521
- : this.type === "accent-color"
522
- ? html `<ds-text
523
- key="accentColor"
524
- default-value="Accent color"
525
- class="cycle-label"
526
- ></ds-text>`
527
- : html `<span class="cycle-label">${this.label}</span>`}`
528
- : ""}
529
- <div
530
- style="display: flex; align-items: center; ${this.type === "icon-only"
531
- ? "justify-content: center;"
532
- : ""}"
533
- >
534
- <ds-button
535
- variant=${this.variant ||
419
+ <div class="cycle">
420
+ <ds-button
421
+ variant=${this.variant ||
536
422
  (this.type === "language" || this.type === "theme"
537
423
  ? "secondary"
538
424
  : "primary")}
539
- ?disabled=${this.disabled}
540
- @click=${this.handleButtonClick}
541
- >
542
- ${this.type === "notes-style-medium" || this.type === "icon-only"
425
+ ?disabled=${this.disabled}
426
+ @click=${this.handleButtonClick}
427
+ >
428
+ ${this.type === "notes-style-medium" || this.type === "icon-only"
543
429
  ? html `<span
544
- style="display: inline-flex; align-items: center; gap: var(--025)"
545
- >${this.getValueDisplay(this.currentValue)}</span
546
- >`
430
+ style="display: inline-flex; align-items: center; gap: var(--025)"
431
+ >${this.getValueDisplay(this.currentValue)}</span
432
+ >`
547
433
  : this.type === "language"
548
434
  ? html `<ds-text
549
- default-value=${this.getValueDisplay(this.currentValue)}
550
- ></ds-text>`
435
+ default-value=${this.getValueDisplay(this.currentValue)}
436
+ ></ds-text>`
551
437
  : this.type === "theme"
552
438
  ? html `<ds-text
553
- key=${this.currentValue}
554
- default-value=${this.currentValue}
555
- ></ds-text>`
439
+ key=${this.currentValue}
440
+ default-value=${this.currentValue}
441
+ ></ds-text>`
556
442
  : this.type === "accent-color"
557
443
  ? html `<ds-text
558
- key=${this.getColorKey(this.currentValue)}
559
- default-value=${this.getColorName(this.currentValue)}
560
- ></ds-text>`
444
+ key=${this.getColorKey(this.currentValue)}
445
+ default-value=${this.getColorName(this.currentValue)}
446
+ ></ds-text>`
561
447
  : this.type === "page-style"
562
448
  ? html `<ds-text
563
- key=${this.currentValue}
564
- default-value=${this.currentValue}
565
- ></ds-text>`
449
+ key=${this.currentValue}
450
+ default-value=${this.currentValue}
451
+ ></ds-text>`
566
452
  : html `<ds-text
567
- default-value=${this.getValueDisplay(this.currentValue)}
568
- ></ds-text>`}
569
- </ds-button>
570
- ${this.type === "accent-color"
453
+ default-value=${this.getValueDisplay(this.currentValue)}
454
+ ></ds-text>`}
455
+ </ds-button>
456
+
457
+ ${this.type === "accent-color"
571
458
  ? html `
572
- <div
573
- class="color-preview"
574
- style="background-color: var(${this.currentValue})"
575
- ></div>
576
- `
459
+ <div
460
+ class="color-preview"
461
+ style="background-color: var(${this.currentValue})"
462
+ ></div>
463
+ `
577
464
  : ""}
578
- </div>
579
465
  </div>
580
466
  `;
581
467
  }
@@ -622,15 +508,24 @@ export class Cycle extends LitElement {
622
508
  }
623
509
  }
624
510
  Cycle.styles = css `
625
- .cycle-container {
626
- display: flex;
627
- justify-content: space-between;
511
+ :host {
512
+ display: inline-flex;
513
+ align-items: center;
514
+ }
515
+
516
+ .cycle {
517
+ display: inline-flex;
518
+ align-items: center;
628
519
  gap: var(--025);
629
- width: 100%;
630
520
  }
631
521
 
632
- .cycle-label {
633
- color: var(--text-color-primary);
522
+ .color-preview {
523
+ width: var(--05);
524
+ height: var(--05);
525
+ border-radius: 999px;
526
+ border: 1px solid
527
+ color-mix(in srgb, var(--text-color-primary) 20%, transparent);
528
+ flex: 0 0 auto;
634
529
  }
635
530
  `;
636
531
  customElements.define("ds-cycle", Cycle);
@@ -0,0 +1,28 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * Full-width vertical spacer.
4
+ *
5
+ * Usage:
6
+ * - <ds-gap unit></ds-gap>
7
+ * - <ds-gap double></ds-gap>
8
+ * - <ds-gap size="05"></ds-gap>
9
+ */
10
+ export declare class Gap extends LitElement {
11
+ static properties: {
12
+ /** Raw scale token selector ("01", "025", "05", "08", "1", "2", "3", "4", "8", "12") */
13
+ size: {
14
+ type: StringConstructor;
15
+ reflect: boolean;
16
+ };
17
+ };
18
+ size: string;
19
+ constructor();
20
+ static styles: import("lit").CSSResult;
21
+ render(): import("lit-html").TemplateResult<1>;
22
+ }
23
+ declare global {
24
+ interface HTMLElementTagNameMap {
25
+ "ds-gap": Gap;
26
+ }
27
+ }
28
+ //# sourceMappingURL=ds-gap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ds-gap.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-gap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,GAAI,SAAQ,UAAU;IACjC,MAAM,CAAC,UAAU;QACf,wFAAwF;;;;;MAExF;IAEM,IAAI,EAAE,MAAM,CAAC;;IAOrB,MAAM,CAAC,MAAM,0BAyEX;IAEF,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,QAAQ,EAAE,GAAG,CAAC;KACf;CACF"}
@@ -0,0 +1,97 @@
1
+ import { LitElement, html, css } from "lit";
2
+ /**
3
+ * Full-width vertical spacer.
4
+ *
5
+ * Usage:
6
+ * - <ds-gap unit></ds-gap>
7
+ * - <ds-gap double></ds-gap>
8
+ * - <ds-gap size="05"></ds-gap>
9
+ */
10
+ export class Gap extends LitElement {
11
+ constructor() {
12
+ super();
13
+ this.size = "";
14
+ }
15
+ render() {
16
+ return html ``;
17
+ }
18
+ }
19
+ Gap.properties = {
20
+ /** Raw scale token selector ("01", "025", "05", "08", "1", "2", "3", "4", "8", "12") */
21
+ size: { type: String, reflect: true },
22
+ };
23
+ Gap.styles = css `
24
+ :host {
25
+ display: block;
26
+ width: 100%;
27
+ /* Default if no attribute is provided */
28
+ --gap-size: var(--unit);
29
+ height: var(--gap-size);
30
+ flex: 0 0 auto;
31
+ }
32
+
33
+ /* Semantic sizing tokens (from DS1/1-root/one.css) */
34
+ :host([tenth]) {
35
+ --gap-size: var(--tenth);
36
+ }
37
+ :host([quarter]) {
38
+ --gap-size: var(--quarter);
39
+ }
40
+ :host([half]) {
41
+ --gap-size: var(--half);
42
+ }
43
+ :host([eight-tenth]) {
44
+ --gap-size: var(--eight-tenth);
45
+ }
46
+ :host([unit]) {
47
+ --gap-size: var(--unit);
48
+ }
49
+ :host([double]) {
50
+ --gap-size: var(--double);
51
+ }
52
+ :host([triple]) {
53
+ --gap-size: var(--triple);
54
+ }
55
+ :host([quad]) {
56
+ --gap-size: var(--quad);
57
+ }
58
+ :host([oct]) {
59
+ --gap-size: var(--oct);
60
+ }
61
+ :host([dozen]) {
62
+ --gap-size: var(--dozen);
63
+ }
64
+
65
+ /* Raw scale sizing (size="...") */
66
+ :host([size="01"]) {
67
+ --gap-size: var(--01);
68
+ }
69
+ :host([size="025"]) {
70
+ --gap-size: var(--025);
71
+ }
72
+ :host([size="05"]) {
73
+ --gap-size: var(--05);
74
+ }
75
+ :host([size="08"]) {
76
+ --gap-size: var(--08);
77
+ }
78
+ :host([size="1"]) {
79
+ --gap-size: var(--1);
80
+ }
81
+ :host([size="2"]) {
82
+ --gap-size: var(--2);
83
+ }
84
+ :host([size="3"]) {
85
+ --gap-size: var(--3);
86
+ }
87
+ :host([size="4"]) {
88
+ --gap-size: var(--4);
89
+ }
90
+ :host([size="8"]) {
91
+ --gap-size: var(--8);
92
+ }
93
+ :host([size="12"]) {
94
+ --gap-size: var(--12);
95
+ }
96
+ `;
97
+ customElements.define("ds-gap", Gap);
@@ -1 +1 @@
1
- {"version":3,"file":"ds-text.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;GAOG;AACH,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;MAOpB;IAEO,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACjC,OAAO,CAAC,aAAa,CAAqC;;IAsB1D,MAAM,CAAC,MAAM,0BAgBX;IAEF,iBAAiB;IAsBjB,oBAAoB;IAYpB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQ/C,wBAAwB;IAWxB,SAAS;IAmBT,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
1
+ {"version":3,"file":"ds-text.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C;;;;;;;GAOG;AACH,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;MAOpB;IAEO,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACjC,OAAO,CAAC,aAAa,CAAqC;;IAsB1D,MAAM,CAAC,MAAM,0BA2BX;IAEF,iBAAiB;IAsBjB,oBAAoB;IAYpB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQ/C,wBAAwB;IA8BxB,SAAS;IAmBT,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
@@ -60,14 +60,29 @@ export class Text extends LitElement {
60
60
  }
61
61
  _updateLanguageAttribute() {
62
62
  const lang = this._currentLanguage || currentLanguage.value;
63
- // Check if language is Japanese (handles "ja", "ja-JP", etc.)
64
- const primaryLang = lang?.toLowerCase().split(/[-_]/)[0] || "";
63
+ // Handles "ja", "ja-JP", "zh-Hant", "zh-Hans", etc.
64
+ const parts = (lang || "").toLowerCase().split(/[-_]/).filter(Boolean);
65
+ const primaryLang = parts[0] || "";
65
66
  if (primaryLang === "ja") {
66
67
  this.setAttribute("data-language", "ja");
68
+ return;
67
69
  }
68
- else {
69
- this.removeAttribute("data-language");
70
+ if (primaryLang === "zh") {
71
+ // Prefer explicit script; otherwise infer from common regions.
72
+ const hasHans = parts.includes("hans") || parts.includes("cn") || parts.includes("sg");
73
+ const hasHant = parts.includes("hant") ||
74
+ parts.includes("tw") ||
75
+ parts.includes("hk") ||
76
+ parts.includes("mo");
77
+ if (hasHans)
78
+ this.setAttribute("data-language", "zh-hans");
79
+ else if (hasHant)
80
+ this.setAttribute("data-language", "zh-hant");
81
+ else
82
+ this.setAttribute("data-language", "zh");
83
+ return;
70
84
  }
85
+ this.removeAttribute("data-language");
71
86
  }
72
87
  _loadText() {
73
88
  if (!this.key) {
@@ -107,5 +122,16 @@ Text.styles = css `
107
122
  :host([data-language="ja"]) {
108
123
  font-family: var(--typeface-regular-jp);
109
124
  }
125
+
126
+ :host([data-language="zh"]),
127
+ :host([data-language="zh-hant"]) {
128
+ font-family: var(--typeface-regular-zh-hant);
129
+ font-weight: 800;
130
+ }
131
+
132
+ :host([data-language="zh-hans"]) {
133
+ font-family: var(--typeface-regular-zh-hans);
134
+ font-weight: 800;
135
+ }
110
136
  `;
111
137
  customElements.define("ds-text", Text);
@@ -0,0 +1,38 @@
1
+ import { LitElement } from "lit";
2
+ import "../2-core/ds-text";
3
+ import "../2-core/ds-icon";
4
+ import "./ds-row";
5
+ /**
6
+ * Native accordion using <details>/<summary> (no JS toggle logic).
7
+ *
8
+ * Usage:
9
+ * <ds-accordion summary-key="howItBegan" details-key="designedInHokkaido"></ds-accordion>
10
+ */
11
+ export declare class Accordion extends LitElement {
12
+ static properties: {
13
+ summaryKey: {
14
+ type: StringConstructor;
15
+ attribute: string;
16
+ };
17
+ detailsKey: {
18
+ type: StringConstructor;
19
+ attribute: string;
20
+ };
21
+ open: {
22
+ type: BooleanConstructor;
23
+ reflect: boolean;
24
+ };
25
+ };
26
+ summaryKey: string;
27
+ detailsKey: string;
28
+ open: boolean;
29
+ constructor();
30
+ static styles: import("lit").CSSResult;
31
+ render(): import("lit-html").TemplateResult<1>;
32
+ }
33
+ declare global {
34
+ interface HTMLElementTagNameMap {
35
+ "ds-accordion": Accordion;
36
+ }
37
+ }
38
+ //# sourceMappingURL=ds-accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ds-accordion.d.ts","sourceRoot":"","sources":["../../DS1/3-unit/ds-accordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAC5C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAElB;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACvC,MAAM,CAAC,UAAU;;;;;;;;;;;;;MAIf;IAEM,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;;IAStB,MAAM,CAAC,MAAM,0BA4CX;IAEF,MAAM;CA4BP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,SAAS,CAAC;KAC3B;CACF"}
@@ -0,0 +1,97 @@
1
+ import { LitElement, html, css } from "lit";
2
+ import "../2-core/ds-text";
3
+ import "../2-core/ds-icon";
4
+ import "./ds-row";
5
+ /**
6
+ * Native accordion using <details>/<summary> (no JS toggle logic).
7
+ *
8
+ * Usage:
9
+ * <ds-accordion summary-key="howItBegan" details-key="designedInHokkaido"></ds-accordion>
10
+ */
11
+ export class Accordion extends LitElement {
12
+ constructor() {
13
+ super();
14
+ this.summaryKey = "";
15
+ this.detailsKey = "";
16
+ this.open = false;
17
+ }
18
+ render() {
19
+ return html `
20
+ <details ?open=${this.open}>
21
+ <summary>
22
+ <ds-row class="summaryRow" type="centered">
23
+ <ds-text .key=${this.summaryKey}></ds-text>
24
+ <ds-icon class="chevron" aria-hidden="true">
25
+ <svg
26
+ viewBox="0 0 10.157 8.219"
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ aria-hidden="true"
29
+ focusable="false"
30
+ >
31
+ <path
32
+ d="M5.078 8.219L0 3.141L1.414 1.727L5.078 5.391L8.743 1.727L10.157 3.141L5.078 8.219Z"
33
+ fill="currentColor"
34
+ />
35
+ </svg>
36
+ </ds-icon>
37
+ </ds-row>
38
+ </summary>
39
+
40
+ <div class="detailsBody">
41
+ <ds-text class="detailsText" .key=${this.detailsKey}></ds-text>
42
+ </div>
43
+ </details>
44
+ `;
45
+ }
46
+ }
47
+ Accordion.properties = {
48
+ summaryKey: { type: String, attribute: "summary-key" },
49
+ detailsKey: { type: String, attribute: "details-key" },
50
+ open: { type: Boolean, reflect: true },
51
+ };
52
+ Accordion.styles = css `
53
+ :host {
54
+ display: block;
55
+ width: calc(240px * var(--sf));
56
+ color: var(--text-color-primary);
57
+ }
58
+
59
+ details {
60
+ width: 100%;
61
+ }
62
+
63
+ summary {
64
+ cursor: pointer;
65
+ user-select: none;
66
+ list-style: none;
67
+ outline: none;
68
+ }
69
+
70
+ summary::-webkit-details-marker {
71
+ display: none;
72
+ }
73
+
74
+ .summaryRow {
75
+ width: 100%;
76
+ }
77
+
78
+ ds-icon.chevron {
79
+ transform: rotate(0deg);
80
+ transition: transform 140ms ease;
81
+ }
82
+
83
+ details[open] ds-icon.chevron {
84
+ transform: rotate(180deg);
85
+ }
86
+
87
+ .detailsBody {
88
+ padding-top: calc(var(--half) * var(--sf));
89
+ }
90
+
91
+ .detailsText {
92
+ display: block;
93
+ white-space: normal;
94
+ text-align: left;
95
+ }
96
+ `;
97
+ customElements.define("ds-accordion", Accordion);