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.
@@ -1860,12 +1860,24 @@ var Text = class extends i6 {
1860
1860
  }
1861
1861
  _updateLanguageAttribute() {
1862
1862
  const lang = this._currentLanguage || currentLanguage.value;
1863
- const primaryLang = lang?.toLowerCase().split(/[-_]/)[0] || "";
1863
+ const parts = (lang || "").toLowerCase().split(/[-_]/).filter(Boolean);
1864
+ const primaryLang = parts[0] || "";
1864
1865
  if (primaryLang === "ja") {
1865
1866
  this.setAttribute("data-language", "ja");
1866
- } else {
1867
- this.removeAttribute("data-language");
1867
+ return;
1868
+ }
1869
+ if (primaryLang === "zh") {
1870
+ const hasHans = parts.includes("hans") || parts.includes("cn") || parts.includes("sg");
1871
+ const hasHant = parts.includes("hant") || parts.includes("tw") || parts.includes("hk") || parts.includes("mo");
1872
+ if (hasHans)
1873
+ this.setAttribute("data-language", "zh-hans");
1874
+ else if (hasHant)
1875
+ this.setAttribute("data-language", "zh-hant");
1876
+ else
1877
+ this.setAttribute("data-language", "zh");
1878
+ return;
1868
1879
  }
1880
+ this.removeAttribute("data-language");
1869
1881
  }
1870
1882
  _loadText() {
1871
1883
  if (!this.key) {
@@ -1904,6 +1916,17 @@ Text.styles = i4`
1904
1916
  :host([data-language="ja"]) {
1905
1917
  font-family: var(--typeface-regular-jp);
1906
1918
  }
1919
+
1920
+ :host([data-language="zh"]),
1921
+ :host([data-language="zh-hant"]) {
1922
+ font-family: var(--typeface-regular-zh-hant);
1923
+ font-weight: 800;
1924
+ }
1925
+
1926
+ :host([data-language="zh-hans"]) {
1927
+ font-family: var(--typeface-regular-zh-hans);
1928
+ font-weight: 800;
1929
+ }
1907
1930
  `;
1908
1931
  customElements.define("ds-text", Text);
1909
1932
 
@@ -2384,7 +2407,6 @@ var Cycle = class extends i6 {
2384
2407
  return {
2385
2408
  type: { type: String },
2386
2409
  values: { type: Array },
2387
- label: { type: String },
2388
2410
  currentValue: { type: String, state: true },
2389
2411
  // Make this a private state property
2390
2412
  translationsReady: { type: Boolean, state: true },
@@ -2397,7 +2419,6 @@ var Cycle = class extends i6 {
2397
2419
  super();
2398
2420
  this.type = "";
2399
2421
  this.values = [];
2400
- this.label = "";
2401
2422
  this.currentValue = "";
2402
2423
  this.translationsReady = false;
2403
2424
  this.disabled = false;
@@ -2425,12 +2446,10 @@ var Cycle = class extends i6 {
2425
2446
  const availableLanguages = getAvailableLanguagesSync();
2426
2447
  this.values = availableLanguages;
2427
2448
  this.currentValue = currentLanguage.value;
2428
- this.label = this.getLabel();
2429
2449
  } else if (this.type === "theme") {
2430
2450
  this.values = ["light", "dark"];
2431
2451
  const currentThemeValue = currentTheme.get();
2432
2452
  this.currentValue = currentThemeValue;
2433
- this.label = this.getLabel();
2434
2453
  } else if (this.type === "accent-color") {
2435
2454
  this.values = [
2436
2455
  "--apple-green",
@@ -2451,16 +2470,13 @@ var Cycle = class extends i6 {
2451
2470
  this.currentValue = currentNotesStyle;
2452
2471
  const currentPageStyle = getPageStyle();
2453
2472
  this.disabled = currentPageStyle === "note";
2454
- this.label = this.getLabel();
2455
2473
  } else if (this.type === "page-style") {
2456
2474
  this.values = ["note", "page"];
2457
2475
  const currentPageStyle = getPageStyle();
2458
2476
  this.currentValue = currentPageStyle;
2459
- this.label = this.getLabel();
2460
2477
  } else if (this.type === "icon-only") {
2461
2478
  this.values = ["note", "page"];
2462
2479
  this.currentValue = this.values[0];
2463
- this.label = "";
2464
2480
  }
2465
2481
  this.requestUpdate();
2466
2482
  }
@@ -2483,11 +2499,9 @@ var Cycle = class extends i6 {
2483
2499
  if (this.type === "language") {
2484
2500
  const currentLang = currentLanguage.value;
2485
2501
  this.currentValue = currentLang;
2486
- this.label = this.getLabel();
2487
2502
  } else if (this.type === "theme") {
2488
2503
  const currentThemeValue = currentTheme.get();
2489
2504
  this.currentValue = currentThemeValue;
2490
- this.label = this.getLabel();
2491
2505
  } else if (this.type === "accent-color") {
2492
2506
  const currentAccentColor = getAccentColor();
2493
2507
  this.currentValue = currentAccentColor;
@@ -2497,15 +2511,12 @@ var Cycle = class extends i6 {
2497
2511
  this.currentValue = currentNotesStyle;
2498
2512
  const currentPageStyle = getPageStyle();
2499
2513
  this.disabled = currentPageStyle === "note";
2500
- this.label = this.getLabel();
2501
2514
  } else if (this.type === "page-style") {
2502
2515
  const currentPageStyle = getPageStyle();
2503
2516
  this.currentValue = currentPageStyle;
2504
- this.label = this.getLabel();
2505
2517
  } else if (this.type === "icon-only") {
2506
2518
  const currentPageStyle = getPageStyle();
2507
2519
  this.currentValue = currentPageStyle;
2508
- this.label = "";
2509
2520
  }
2510
2521
  this.requestUpdate();
2511
2522
  }
@@ -2587,12 +2598,10 @@ var Cycle = class extends i6 {
2587
2598
  this.currentValue = newIconOnlyValue;
2588
2599
  savePageStyle(newIconOnlyValue);
2589
2600
  savePreferences({ pageStyle: newIconOnlyValue });
2590
- this.label = "";
2591
2601
  window.dispatchEvent(new CustomEvent("page-style-changed", {
2592
2602
  detail: { behavior: newIconOnlyValue }
2593
2603
  }));
2594
2604
  }
2595
- this.label = this.getLabel();
2596
2605
  this.requestUpdate();
2597
2606
  }
2598
2607
  getValueDisplay(value) {
@@ -2677,101 +2686,39 @@ var Cycle = class extends i6 {
2677
2686
  }
2678
2687
  return x`<span>${style}</span>`;
2679
2688
  }
2680
- getLabel() {
2681
- if (this.type === "language") {
2682
- if (this.translationsReady) {
2683
- const translatedLabel = translate("language");
2684
- if (translatedLabel && translatedLabel !== "language") {
2685
- return translatedLabel;
2686
- }
2687
- }
2688
- return "Language";
2689
- } else if (this.type === "theme") {
2690
- if (this.translationsReady) {
2691
- const translatedLabel = translate("theme");
2692
- if (translatedLabel && translatedLabel !== "theme") {
2693
- return translatedLabel;
2694
- }
2695
- }
2696
- return "Theme";
2697
- } else if (this.type === "accent-color") {
2698
- if (this.translationsReady) {
2699
- const translatedLabel = translate("accentColor");
2700
- if (translatedLabel && translatedLabel !== "accentColor") {
2701
- return translatedLabel;
2702
- }
2703
- }
2704
- return "Accent Color";
2705
- } else if (this.type === "notes-style-medium") {
2706
- if (this.translationsReady) {
2707
- const translatedLabel = translate("notesStyle");
2708
- if (translatedLabel && translatedLabel !== "notesStyle") {
2709
- return translatedLabel;
2710
- }
2711
- }
2712
- return "Notes Style";
2713
- } else if (this.type === "page-style") {
2714
- if (this.translationsReady) {
2715
- const translatedLabel = translate("clickingItem");
2716
- if (translatedLabel && translatedLabel !== "clickingItem") {
2717
- return translatedLabel;
2718
- }
2719
- }
2720
- return "Clic";
2721
- } else if (this.type === "icon-only") {
2722
- return "";
2723
- }
2724
- return this.label;
2725
- }
2726
2689
  render() {
2727
2690
  return x`
2728
- <div class="cycle-container">
2729
- ${this.type !== "icon-only" ? x`${this.type === "language" ? x`<ds-text
2730
- key="language"
2731
- default-value="Language"
2732
- class="cycle-label"
2691
+ <div class="cycle">
2692
+ <ds-button
2693
+ variant=${this.variant || (this.type === "language" || this.type === "theme" ? "secondary" : "primary")}
2694
+ ?disabled=${this.disabled}
2695
+ @click=${this.handleButtonClick}
2696
+ >
2697
+ ${this.type === "notes-style-medium" || this.type === "icon-only" ? x`<span
2698
+ style="display: inline-flex; align-items: center; gap: var(--025)"
2699
+ >${this.getValueDisplay(this.currentValue)}</span
2700
+ >` : this.type === "language" ? x`<ds-text
2701
+ default-value=${this.getValueDisplay(this.currentValue)}
2733
2702
  ></ds-text>` : this.type === "theme" ? x`<ds-text
2734
- key="theme"
2735
- default-value="Theme"
2736
- class="cycle-label"
2703
+ key=${this.currentValue}
2704
+ default-value=${this.currentValue}
2737
2705
  ></ds-text>` : this.type === "accent-color" ? x`<ds-text
2738
- key="accentColor"
2739
- default-value="Accent color"
2740
- class="cycle-label"
2741
- ></ds-text>` : x`<span class="cycle-label">${this.label}</span>`}` : ""}
2742
- <div
2743
- style="display: flex; align-items: center; ${this.type === "icon-only" ? "justify-content: center;" : ""}"
2744
- >
2745
- <ds-button
2746
- variant=${this.variant || (this.type === "language" || this.type === "theme" ? "secondary" : "primary")}
2747
- ?disabled=${this.disabled}
2748
- @click=${this.handleButtonClick}
2749
- >
2750
- ${this.type === "notes-style-medium" || this.type === "icon-only" ? x`<span
2751
- style="display: inline-flex; align-items: center; gap: var(--025)"
2752
- >${this.getValueDisplay(this.currentValue)}</span
2753
- >` : this.type === "language" ? x`<ds-text
2754
- default-value=${this.getValueDisplay(this.currentValue)}
2755
- ></ds-text>` : this.type === "theme" ? x`<ds-text
2756
- key=${this.currentValue}
2757
- default-value=${this.currentValue}
2758
- ></ds-text>` : this.type === "accent-color" ? x`<ds-text
2759
- key=${this.getColorKey(this.currentValue)}
2760
- default-value=${this.getColorName(this.currentValue)}
2761
- ></ds-text>` : this.type === "page-style" ? x`<ds-text
2762
- key=${this.currentValue}
2763
- default-value=${this.currentValue}
2764
- ></ds-text>` : x`<ds-text
2765
- default-value=${this.getValueDisplay(this.currentValue)}
2766
- ></ds-text>`}
2767
- </ds-button>
2768
- ${this.type === "accent-color" ? x`
2769
- <div
2770
- class="color-preview"
2771
- style="background-color: var(${this.currentValue})"
2772
- ></div>
2773
- ` : ""}
2774
- </div>
2706
+ key=${this.getColorKey(this.currentValue)}
2707
+ default-value=${this.getColorName(this.currentValue)}
2708
+ ></ds-text>` : this.type === "page-style" ? x`<ds-text
2709
+ key=${this.currentValue}
2710
+ default-value=${this.currentValue}
2711
+ ></ds-text>` : x`<ds-text
2712
+ default-value=${this.getValueDisplay(this.currentValue)}
2713
+ ></ds-text>`}
2714
+ </ds-button>
2715
+
2716
+ ${this.type === "accent-color" ? x`
2717
+ <div
2718
+ class="color-preview"
2719
+ style="background-color: var(${this.currentValue})"
2720
+ ></div>
2721
+ ` : ""}
2775
2722
  </div>
2776
2723
  `;
2777
2724
  }
@@ -2816,19 +2763,118 @@ var Cycle = class extends i6 {
2816
2763
  }
2817
2764
  };
2818
2765
  Cycle.styles = i4`
2819
- .cycle-container {
2820
- display: flex;
2821
- justify-content: space-between;
2766
+ :host {
2767
+ display: inline-flex;
2768
+ align-items: center;
2769
+ }
2770
+
2771
+ .cycle {
2772
+ display: inline-flex;
2773
+ align-items: center;
2822
2774
  gap: var(--025);
2823
- width: 100%;
2824
2775
  }
2825
2776
 
2826
- .cycle-label {
2827
- color: var(--text-color-primary);
2777
+ .color-preview {
2778
+ width: var(--05);
2779
+ height: var(--05);
2780
+ border-radius: 999px;
2781
+ border: 1px solid
2782
+ color-mix(in srgb, var(--text-color-primary) 20%, transparent);
2783
+ flex: 0 0 auto;
2828
2784
  }
2829
2785
  `;
2830
2786
  customElements.define("ds-cycle", Cycle);
2831
2787
 
2788
+ // dist/2-core/ds-gap.js
2789
+ var Gap = class extends i6 {
2790
+ constructor() {
2791
+ super();
2792
+ this.size = "";
2793
+ }
2794
+ render() {
2795
+ return x``;
2796
+ }
2797
+ };
2798
+ Gap.properties = {
2799
+ /** Raw scale token selector ("01", "025", "05", "08", "1", "2", "3", "4", "8", "12") */
2800
+ size: { type: String, reflect: true }
2801
+ };
2802
+ Gap.styles = i4`
2803
+ :host {
2804
+ display: block;
2805
+ width: 100%;
2806
+ /* Default if no attribute is provided */
2807
+ --gap-size: var(--unit);
2808
+ height: var(--gap-size);
2809
+ flex: 0 0 auto;
2810
+ }
2811
+
2812
+ /* Semantic sizing tokens (from DS1/1-root/one.css) */
2813
+ :host([tenth]) {
2814
+ --gap-size: var(--tenth);
2815
+ }
2816
+ :host([quarter]) {
2817
+ --gap-size: var(--quarter);
2818
+ }
2819
+ :host([half]) {
2820
+ --gap-size: var(--half);
2821
+ }
2822
+ :host([eight-tenth]) {
2823
+ --gap-size: var(--eight-tenth);
2824
+ }
2825
+ :host([unit]) {
2826
+ --gap-size: var(--unit);
2827
+ }
2828
+ :host([double]) {
2829
+ --gap-size: var(--double);
2830
+ }
2831
+ :host([triple]) {
2832
+ --gap-size: var(--triple);
2833
+ }
2834
+ :host([quad]) {
2835
+ --gap-size: var(--quad);
2836
+ }
2837
+ :host([oct]) {
2838
+ --gap-size: var(--oct);
2839
+ }
2840
+ :host([dozen]) {
2841
+ --gap-size: var(--dozen);
2842
+ }
2843
+
2844
+ /* Raw scale sizing (size="...") */
2845
+ :host([size="01"]) {
2846
+ --gap-size: var(--01);
2847
+ }
2848
+ :host([size="025"]) {
2849
+ --gap-size: var(--025);
2850
+ }
2851
+ :host([size="05"]) {
2852
+ --gap-size: var(--05);
2853
+ }
2854
+ :host([size="08"]) {
2855
+ --gap-size: var(--08);
2856
+ }
2857
+ :host([size="1"]) {
2858
+ --gap-size: var(--1);
2859
+ }
2860
+ :host([size="2"]) {
2861
+ --gap-size: var(--2);
2862
+ }
2863
+ :host([size="3"]) {
2864
+ --gap-size: var(--3);
2865
+ }
2866
+ :host([size="4"]) {
2867
+ --gap-size: var(--4);
2868
+ }
2869
+ :host([size="8"]) {
2870
+ --gap-size: var(--8);
2871
+ }
2872
+ :host([size="12"]) {
2873
+ --gap-size: var(--12);
2874
+ }
2875
+ `;
2876
+ customElements.define("ds-gap", Gap);
2877
+
2832
2878
  // dist/2-core/ds-tooltip.js
2833
2879
  var Tooltip = class extends i6 {
2834
2880
  constructor() {
@@ -3033,6 +3079,95 @@ Row.styles = i4`
3033
3079
  `;
3034
3080
  customElements.define("ds-row", Row);
3035
3081
 
3082
+ // dist/3-unit/ds-accordion.js
3083
+ var Accordion = class extends i6 {
3084
+ constructor() {
3085
+ super();
3086
+ this.summaryKey = "";
3087
+ this.detailsKey = "";
3088
+ this.open = false;
3089
+ }
3090
+ render() {
3091
+ return x`
3092
+ <details ?open=${this.open}>
3093
+ <summary>
3094
+ <ds-row class="summaryRow" type="centered">
3095
+ <ds-text .key=${this.summaryKey}></ds-text>
3096
+ <ds-icon class="chevron" aria-hidden="true">
3097
+ <svg
3098
+ viewBox="0 0 10.157 8.219"
3099
+ xmlns="http://www.w3.org/2000/svg"
3100
+ aria-hidden="true"
3101
+ focusable="false"
3102
+ >
3103
+ <path
3104
+ d="M5.078 8.219L0 3.141L1.414 1.727L5.078 5.391L8.743 1.727L10.157 3.141L5.078 8.219Z"
3105
+ fill="currentColor"
3106
+ />
3107
+ </svg>
3108
+ </ds-icon>
3109
+ </ds-row>
3110
+ </summary>
3111
+
3112
+ <div class="detailsBody">
3113
+ <ds-text class="detailsText" .key=${this.detailsKey}></ds-text>
3114
+ </div>
3115
+ </details>
3116
+ `;
3117
+ }
3118
+ };
3119
+ Accordion.properties = {
3120
+ summaryKey: { type: String, attribute: "summary-key" },
3121
+ detailsKey: { type: String, attribute: "details-key" },
3122
+ open: { type: Boolean, reflect: true }
3123
+ };
3124
+ Accordion.styles = i4`
3125
+ :host {
3126
+ display: block;
3127
+ width: calc(240px * var(--sf));
3128
+ color: var(--text-color-primary);
3129
+ }
3130
+
3131
+ details {
3132
+ width: 100%;
3133
+ }
3134
+
3135
+ summary {
3136
+ cursor: pointer;
3137
+ user-select: none;
3138
+ list-style: none;
3139
+ outline: none;
3140
+ }
3141
+
3142
+ summary::-webkit-details-marker {
3143
+ display: none;
3144
+ }
3145
+
3146
+ .summaryRow {
3147
+ width: 100%;
3148
+ }
3149
+
3150
+ ds-icon.chevron {
3151
+ transform: rotate(0deg);
3152
+ transition: transform 140ms ease;
3153
+ }
3154
+
3155
+ details[open] ds-icon.chevron {
3156
+ transform: rotate(180deg);
3157
+ }
3158
+
3159
+ .detailsBody {
3160
+ padding-top: calc(var(--half) * var(--sf));
3161
+ }
3162
+
3163
+ .detailsText {
3164
+ display: block;
3165
+ white-space: normal;
3166
+ text-align: left;
3167
+ }
3168
+ `;
3169
+ customElements.define("ds-accordion", Accordion);
3170
+
3036
3171
  // dist/3-unit/ds-table.js
3037
3172
  var DsTable = class extends i6 {
3038
3173
  constructor() {
@@ -3590,11 +3725,13 @@ Layout.styles = i4`
3590
3725
  `;
3591
3726
  customElements.define("ds-layout", Layout);
3592
3727
  export {
3728
+ Accordion,
3593
3729
  Button,
3594
3730
  Container,
3595
3731
  Cycle,
3596
3732
  DateComponent,
3597
3733
  DsTable,
3734
+ Gap,
3598
3735
  Grid,
3599
3736
  Icon,
3600
3737
  Layout,