ds-one 0.3.0-alpha.3 → 0.3.0-alpha.4

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.
@@ -1,4 +1,4 @@
1
- /* version 0.3.0-alpha.3 */
1
+ /* version 0.3.0-alpha.4 */
2
2
 
3
3
  @import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@200");
4
4
  @import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@800");
@@ -125,18 +125,11 @@ input {
125
125
 
126
126
  /* Layouts */
127
127
 
128
- /* App layout (used for app) */
129
- --app-layout:
130
-
131
-
132
- /* Home layout (used for lists) */ --home-layout: calc(
133
- var(--unit) * var(--sf)
134
- )
128
+ /* Home layout (used for lists) */
129
+ --home-layout: calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
135
130
  calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
136
- calc(var(--unit) * var(--sf)) calc(var(--oct) * var(--sf))
137
- calc(var(--oct) * var(--sf)) calc(var(--quad) * var(--sf))
138
- calc(var(--double) * var(--sf));
139
- --home-layout-areas: "banner" "." "header" "." "message" "lists" "." "footer";
131
+ calc(var(--oct) * var(--sf));
132
+ --home-layout-areas: "banner" "." "header" "." "lists";
140
133
 
141
134
  /* App layout */
142
135
  --app-layout: calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
@@ -145,6 +138,11 @@ input {
145
138
  calc(var(--quad) * var(--sf)) calc(var(--double) * var(--sf));
146
139
  --app-layout-areas: "banner" "." "header" "." "main" "page-dots" "." "footer";
147
140
 
141
+ /* Settings layout */
142
+ --settings-layout: calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
143
+ 1fr;
144
+ --settings-layout-areas: "banner" "." "settings";
145
+
148
146
  /* size */
149
147
  --outline-stroke: 1px solid var(--slate-light);
150
148
  --outline-stroke-mobile: 2px solid var(--sharp-blue);
@@ -7,33 +7,23 @@ import styles from "./styles/ds-button.css?inline";
7
7
 
8
8
  export class Button extends LitElement {
9
9
  static properties = {
10
- variant: { type: String, reflect: true },
10
+ primary: { type: Boolean, reflect: true },
11
+ secondary: { type: Boolean, reflect: true },
11
12
  disabled: { type: Boolean, reflect: true },
12
- bold: { type: Boolean, reflect: true },
13
- "no-background": {
14
- type: Boolean,
15
- reflect: true,
16
- attribute: "no-background",
17
- },
18
13
  blank: { type: Boolean, reflect: true },
19
- text: { type: String },
20
- fallback: { type: String },
21
14
  language: { type: String },
22
- defaultText: { type: String, attribute: "default-text" },
15
+ text: { type: String },
23
16
  href: { type: String },
24
17
  _loading: { type: Boolean, state: true },
25
18
  };
26
19
 
27
20
  // Public properties
28
- declare variant: string;
21
+ declare primary: boolean;
22
+ declare secondary: boolean;
29
23
  declare disabled: boolean;
30
- declare bold: boolean;
31
- declare "no-background": boolean;
32
24
  declare blank: boolean;
33
- declare text: string;
34
- declare fallback: string;
35
25
  declare language: string;
36
- declare defaultText: string;
26
+ declare text: string;
37
27
  declare href: string;
38
28
 
39
29
  // Private state
@@ -41,15 +31,12 @@ export class Button extends LitElement {
41
31
 
42
32
  constructor() {
43
33
  super();
44
- this.variant = "title";
34
+ this.primary = false; // Default to no-background (no attribute)
35
+ this.secondary = false;
45
36
  this.disabled = false;
46
- this.bold = false;
47
- this["no-background"] = false;
48
37
  this.blank = false;
49
- this.text = "";
50
- this.fallback = "";
51
38
  this.language = "en-US";
52
- this.defaultText = "";
39
+ this.text = "";
53
40
  this.href = "";
54
41
  this._loading = false;
55
42
  }
@@ -61,22 +48,17 @@ export class Button extends LitElement {
61
48
  }
62
49
 
63
50
  render() {
64
- const hasTextProps = this.text || this.defaultText || this.fallback;
51
+ const hasTextProps = this.text;
65
52
 
66
53
  return html`
67
54
  <button
68
- class=${this.variant}
55
+ ?primary=${this.primary}
56
+ ?secondary=${this.secondary}
69
57
  ?disabled=${this.disabled}
70
- ?bold=${this.bold}
71
- ?no-background=${this["no-background"]}
72
58
  @click=${this._handleClick}
73
59
  >
74
60
  ${hasTextProps
75
- ? html`<ds-text
76
- .text=${this.text}
77
- .defaultValue=${this.defaultText}
78
- .fallback=${this.fallback}
79
- ></ds-text>`
61
+ ? html`<ds-text .text=${this.text}></ds-text>`
80
62
  : html`<slot></slot>`}
81
63
  </button>
82
64
  `;
@@ -539,10 +539,12 @@ export class Cycle extends LitElement {
539
539
  return html`
540
540
  <div class="cycle">
541
541
  <ds-button
542
- variant=${this.variant ||
543
- (this.type === "language" || this.type === "theme"
544
- ? "secondary"
545
- : "primary")}
542
+ variant=${this.type === "accent-color"
543
+ ? "primary"
544
+ : this.variant ||
545
+ (this.type === "language" || this.type === "theme"
546
+ ? "secondary"
547
+ : "primary")}
546
548
  ?disabled=${this.disabled}
547
549
  @click=${this.handleButtonClick}
548
550
  >
@@ -557,7 +559,7 @@ export class Cycle extends LitElement {
557
559
  ></ds-text>`
558
560
  : this.type === "theme"
559
561
  ? html`<ds-text
560
- text=${this.currentValue}
562
+ text=${this.currentValue === "light" ? "Light" : "Dark"}
561
563
  ></ds-text>`
562
564
  : this.type === "accent-color"
563
565
  ? html`<ds-text
@@ -571,15 +573,6 @@ export class Cycle extends LitElement {
571
573
  text=${this.getValueDisplay(this.currentValue)}
572
574
  ></ds-text>`}
573
575
  </ds-button>
574
-
575
- ${this.type === "accent-color"
576
- ? html`
577
- <div
578
- class="color-preview"
579
- style="background-color: var(${this.currentValue})"
580
- ></div>
581
- `
582
- : ""}
583
576
  </div>
584
577
  `;
585
578
  }
@@ -7,19 +7,16 @@ import styles from "./styles/ds-text.css?inline";
7
7
  *
8
8
  * @element ds-text
9
9
  * @prop {string} text - The translation text to use
10
- * @prop {string} fallback - Optional fallback text if translation is not found (deprecated)
11
10
  */
12
11
  export class Text extends LitElement {
13
12
  static get properties() {
14
13
  return {
15
14
  text: { type: String, reflect: true },
16
- fallback: { type: String, reflect: true }, // Kept for backward compatibility
17
15
  _text: { type: String, state: true },
18
16
  };
19
17
  }
20
18
 
21
19
  declare text: string;
22
- declare fallback: string;
23
20
  declare _text: string;
24
21
  declare _currentLanguage: string;
25
22
  private boundHandlers: { languageChanged: EventListener };
@@ -27,7 +24,6 @@ export class Text extends LitElement {
27
24
  constructor() {
28
25
  super();
29
26
  this.text = "";
30
- this.fallback = "";
31
27
  this._text = "";
32
28
  this._currentLanguage = currentLanguage.value;
33
29
 
@@ -119,7 +115,7 @@ export class Text extends LitElement {
119
115
 
120
116
  _loadText() {
121
117
  if (!this.text) {
122
- this._text = this.fallback || "";
118
+ this._text = "";
123
119
  this._updateLanguageAttribute();
124
120
  this.requestUpdate();
125
121
  return;
@@ -127,10 +123,10 @@ export class Text extends LitElement {
127
123
 
128
124
  try {
129
125
  const translatedText = getText(this.text);
130
- this._text = translatedText || this.fallback || this.text;
126
+ this._text = translatedText || this.text;
131
127
  } catch (error) {
132
128
  console.error("Error loading text for text:", this.text, error);
133
- this._text = this.fallback || this.text;
129
+ this._text = this.text;
134
130
  }
135
131
  this._updateLanguageAttribute();
136
132
  this.requestUpdate();
@@ -1,69 +1,61 @@
1
1
  /* ds-button.css */
2
2
  /* Core button component styles */
3
3
 
4
+ :host {
5
+ display: inline-flex;
6
+ min-width: 0;
7
+ flex: 0 1 auto;
8
+ max-width: 100%;
9
+ overflow: hidden;
10
+ }
11
+
4
12
  button {
5
13
  max-height: calc(var(--08) * var(--sf));
6
14
  height: calc(var(--08) * var(--sf));
7
15
  min-height: calc(var(--08) * var(--sf));
8
- width: fit-content;
16
+ width: 100%;
17
+ max-width: 100%;
18
+ min-width: 0;
9
19
  display: inline-flex;
10
20
  align-items: center;
11
- justify-content: center;
21
+ justify-content: flex-start;
12
22
  border: none;
13
23
  cursor: pointer;
14
- padding: 0 calc(0.5px * var(--sf));
15
- color: var(--button-text-color);
24
+ padding: 0;
25
+ color: var(--button-color, var(--button-text-color));
16
26
  font-family: var(--typeface-regular);
17
27
  -webkit-tap-highlight-color: transparent;
28
+ white-space: nowrap;
29
+ overflow: hidden;
30
+ text-overflow: ellipsis;
31
+ /* Default to no-background when no variant is specified */
32
+ background-color: transparent;
33
+ text-decoration: none;
18
34
  }
19
35
 
20
- button.title {
21
- background-color: var(--button-background-color-secondary);
22
- color: var(--button-text-color);
36
+ button ds-text,
37
+ button ::slotted(*) {
38
+ overflow: hidden;
39
+ text-overflow: ellipsis;
40
+ white-space: nowrap;
41
+ max-width: 100%;
42
+ text-align: left;
43
+ justify-content: flex-start;
23
44
  }
24
45
 
25
- button.primary {
46
+ button[primary] {
26
47
  background-color: var(--accent-color);
27
48
  color: var(--button-text-color);
28
49
  text-decoration-line: none;
29
50
  font-family: var(--typeface-regular);
51
+ padding: 0 calc(0.5px * var(--sf));
30
52
  }
31
53
 
32
- button.secondary {
54
+ button[secondary] {
33
55
  background-color: var(--button-background-color-secondary);
34
56
  color: var(--button-text-color);
35
57
  font-family: var(--typeface-regular);
36
- }
37
-
38
- button.text {
39
- background-color: transparent;
40
- color: var(--button-color, var(--button-text-color));
41
- font-family: var(--typeface-regular);
42
- padding: 0;
43
- text-decoration: none;
44
- }
45
-
46
- button.text:hover {
47
- opacity: 0.8;
48
- text-decoration: none;
49
- }
50
-
51
- button[bold] {
52
- font-weight: var(--type-weight-bold);
53
- font-family: var(--typeface-medium);
54
- }
55
-
56
- button[no-background] {
57
- background-color: transparent;
58
- max-height: var(--1);
59
- padding: 0;
60
- color: var(--button-color, var(--button-text-color-secondary));
61
- }
62
-
63
- button[no-background][bold] {
64
- font-weight: var(--type-weight-bold);
65
- font-family: var(--typeface-medium);
66
- color: var(--button-color, var(--button-text-color-secondary));
58
+ padding: 0 calc(0.5px * var(--sf));
67
59
  }
68
60
 
69
61
  .loading {
@@ -9,13 +9,4 @@
9
9
  .cycle {
10
10
  display: inline-flex;
11
11
  align-items: center;
12
- gap: var(--025);
13
- }
14
-
15
- .color-preview {
16
- width: var(--05);
17
- height: var(--05);
18
- border-radius: 999px;
19
- border: 1px solid color-mix(in srgb, var(--text-color-primary) 20%, transparent);
20
- flex: 0 0 auto;
21
12
  }
@@ -4,17 +4,18 @@
4
4
  :host {
5
5
  display: inline-flex;
6
6
  align-items: center;
7
- justify-content: center;
7
+ justify-content: flex-start;
8
8
  height: calc(16px * var(--sf));
9
9
  font-family: var(--typeface-regular);
10
10
  font-size: var(--type-size-default);
11
11
  font-weight: var(--type-weight-default);
12
12
  line-height: calc(var(--type-lineheight-default) * var(--sf));
13
13
  letter-spacing: calc(var(--type-letterspacing-default) * var(--sf));
14
- text-align: center;
14
+ text-align: left;
15
15
  text-transform: var(--text-transform-default);
16
16
  text-decoration: var(--text-decoration-default);
17
17
  vertical-align: middle;
18
+ white-space: nowrap;
18
19
  }
19
20
 
20
21
  :host([data-language="ja"]) {
@@ -10,6 +10,7 @@
10
10
  :host([fill]) {
11
11
  justify-content: space-between;
12
12
  height: calc(var(--1) * var(--sf));
13
+ width: 100%;
13
14
  }
14
15
 
15
16
  :host([centered]) {