ds-one 0.1.11-alpha.2 → 0.1.11-alpha.3

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.
@@ -35,6 +35,7 @@ input {
35
35
  /* ezo-type */
36
36
  --typeface: "GT-America-Standard-Regular";
37
37
  --typeface-medium: "GT-America-Standard-Medium";
38
+ --typeface-compressed: "GT-America-Compressed-Regular";
38
39
  --typeface-japanese: "Noto Sans JP";
39
40
  --typeface-mono: "Iosevka";
40
41
  --type-size-default: calc(14px * var(--scaling-factor));
@@ -149,6 +150,12 @@ html {
149
150
  font-display: swap;
150
151
  }
151
152
 
153
+ @font-face {
154
+ font-family: GT-America-Compressed-Regular;
155
+ src: url("./fonts/GT-America-Compressed-Regular.woff2") format("woff2");
156
+ font-display: swap;
157
+ }
158
+
152
159
  .matrix__board {
153
160
  position: relative;
154
161
  top: calc(21.5px * var(--scaling-factor));
@@ -4,7 +4,7 @@ import { getText } from "../utils/language";
4
4
  /**
5
5
  * A component for displaying text from translations
6
6
  *
7
- * @element text-v1
7
+ * @element ds-text
8
8
  * @prop {string} key - The translation key to use
9
9
  * @prop {string} defaultValue - Default value if translation is not found
10
10
  * @prop {string} fallback - Optional fallback text if translation is not found (deprecated, use defaultValue)
@@ -35,7 +35,7 @@ export class Text extends LitElement {
35
35
  // Create bound event handlers for proper cleanup
36
36
  this.boundHandlers = {
37
37
  languageChanged: (() => {
38
- console.log("Language changed event received in text-v1");
38
+ console.log("Language changed event received in ds-text");
39
39
  this._loadText();
40
40
  }) as EventListener,
41
41
  };
@@ -112,10 +112,10 @@ export class Text extends LitElement {
112
112
  }
113
113
  }
114
114
 
115
- customElements.define("text-v1", Text);
115
+ customElements.define("ds-text", Text);
116
116
 
117
117
  declare global {
118
118
  interface HTMLElementTagNameMap {
119
- "text-v1": Text;
119
+ "ds-text": Text;
120
120
  }
121
121
  }
@@ -86,7 +86,7 @@ export class Home extends LitElement {
86
86
  }
87
87
 
88
88
  /* Inner text spacing without affecting the 80px outer width */
89
- .home > text-v1 {
89
+ .home > ds-text {
90
90
  padding: 0 calc(var(--1) * 0.15 * var(--scaling-factor));
91
91
  box-sizing: border-box;
92
92
  height: 100%;
@@ -152,7 +152,7 @@ export class Home extends LitElement {
152
152
  @click="${this._navigateHome}"
153
153
  @keydown="${this._onKeyDown}"
154
154
  >
155
- <text-v1 key="home"></text-v1>
155
+ <ds-text key="home"></ds-text>
156
156
  </div>
157
157
  `;
158
158
  }
@@ -80,14 +80,14 @@ export class DoubleNav extends LitElement {
80
80
  ? html`
81
81
  <a href="${this.previous}" class="nav-previous">
82
82
  <icon-v1 type="left"></icon-v1>
83
- <text-v1>${this.previousText || "Previous"}</text-v1>
83
+ <ds-text>${this.previousText || "Previous"}</ds-text>
84
84
  </a>
85
85
  `
86
86
  : html`<div></div>`}
87
87
  ${this.next
88
88
  ? html`
89
89
  <a href="${this.next}" class="nav-next">
90
- <text-v1>${this.nextText || "Next"}</text-v1>
90
+ <ds-text>${this.nextText || "Next"}</ds-text>
91
91
  <icon-v1 type="right"></icon-v1>
92
92
  </a>
93
93
  `
@@ -47,7 +47,7 @@ export class SingleNav extends LitElement {
47
47
 
48
48
  return html`
49
49
  <a href="${href}">
50
- <text-v1 key="${navConfig.key}"></text-v1>
50
+ <ds-text key="${navConfig.key}"></ds-text>
51
51
  <icon-v1 type="right"></icon-v1>
52
52
  </a>
53
53
  `;
package/DS1/index.ts CHANGED
@@ -6,7 +6,7 @@ import "./utils/cdn-loader";
6
6
 
7
7
  // Core components
8
8
  export * from "./2-core/ds-button";
9
- export * from "./2-core/text-v1";
9
+ export * from "./2-core/ds-text";
10
10
  export * from "./2-core/icon-v1";
11
11
  export * from "./2-core/link-v1";
12
12
  export * from "./2-core/cycle-v1";
package/README.md CHANGED
@@ -27,7 +27,7 @@ npm install ds-one@alpha
27
27
  yarn add ds-one@alpha
28
28
  ```
29
29
 
30
- **Note**: Currently published as alpha version `0.1.11-alpha.2`. Use `@alpha` tag to install.
30
+ **Note**: Currently published as alpha version `0.1.11-alpha.3`. Use `@alpha` tag to install.
31
31
 
32
32
  ### Basic Usage
33
33
 
@@ -45,12 +45,12 @@ yarn add ds-one@alpha
45
45
  ></script>
46
46
  <script
47
47
  type="module"
48
- src="node_modules/design-system-one/2 Core/text-v1.ts"
48
+ src="node_modules/design-system-one/2 Core/ds-text.ts"
49
49
  ></script>
50
50
  </head>
51
51
  <body>
52
52
  <ds-button variant="primary" key="welcomeButton">Get Started</ds-button>
53
- <text-v1 variant="heading" key="mainHeading">Welcome to DS one</text-v1>
53
+ <ds-text variant="heading" key="mainHeading">Welcome to DS one</ds-text>
54
54
  </body>
55
55
  </html>
56
56
  ```
@@ -96,7 +96,7 @@ Try DS one in your browser: **[dsone.dev](https://dsone.dev)** (documentation sl
96
96
 
97
97
  ### Completed Features
98
98
 
99
- - ✅ Core component library (ds-button, text-v1, icon-v1, etc.)
99
+ - ✅ Core component library (ds-button, ds-text, icon-v1, etc.)
100
100
  - ✅ Theming system with accent color support
101
101
  - ✅ Internationalization with language keys
102
102
  - ✅ Responsive design with mobile scaling
@@ -0,0 +1,48 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * A component for displaying text from translations
4
+ *
5
+ * @element ds-text
6
+ * @prop {string} key - The translation key to use
7
+ * @prop {string} defaultValue - Default value if translation is not found
8
+ * @prop {string} fallback - Optional fallback text if translation is not found (deprecated, use defaultValue)
9
+ */
10
+ export declare class Text extends LitElement {
11
+ static get properties(): {
12
+ key: {
13
+ type: StringConstructor;
14
+ reflect: boolean;
15
+ };
16
+ defaultValue: {
17
+ type: StringConstructor;
18
+ reflect: boolean;
19
+ attribute: string;
20
+ };
21
+ fallback: {
22
+ type: StringConstructor;
23
+ reflect: boolean;
24
+ };
25
+ _text: {
26
+ type: StringConstructor;
27
+ state: boolean;
28
+ };
29
+ };
30
+ key: string;
31
+ defaultValue: string;
32
+ fallback: string;
33
+ _text: string;
34
+ private boundHandlers;
35
+ constructor();
36
+ static styles: import("lit").CSSResult;
37
+ connectedCallback(): void;
38
+ disconnectedCallback(): void;
39
+ updated(changedProperties: Map<string, unknown>): void;
40
+ _loadText(): void;
41
+ render(): import("lit-html").TemplateResult<1>;
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ "ds-text": Text;
46
+ }
47
+ }
48
+ //# sourceMappingURL=ds-text.d.ts.map
@@ -0,0 +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;IACtB,OAAO,CAAC,aAAa,CAAqC;;IAkB1D,MAAM,CAAC,MAAM,0BAQX;IAEF,iBAAiB;IAoBjB,oBAAoB;IAYpB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQ/C,SAAS;IAgBT,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
@@ -0,0 +1,83 @@
1
+ import { LitElement, html, css } from "lit";
2
+ import { getText } from "../utils/language";
3
+ /**
4
+ * A component for displaying text from translations
5
+ *
6
+ * @element ds-text
7
+ * @prop {string} key - The translation key to use
8
+ * @prop {string} defaultValue - Default value if translation is not found
9
+ * @prop {string} fallback - Optional fallback text if translation is not found (deprecated, use defaultValue)
10
+ */
11
+ export class Text extends LitElement {
12
+ static get properties() {
13
+ return {
14
+ key: { type: String, reflect: true },
15
+ defaultValue: { type: String, reflect: true, attribute: "default-value" },
16
+ fallback: { type: String, reflect: true }, // Kept for backward compatibility
17
+ _text: { type: String, state: true },
18
+ };
19
+ }
20
+ constructor() {
21
+ super();
22
+ this.key = "";
23
+ this.defaultValue = "";
24
+ this.fallback = "";
25
+ this._text = "";
26
+ // Create bound event handlers for proper cleanup
27
+ this.boundHandlers = {
28
+ languageChanged: (() => {
29
+ console.log("Language changed event received in ds-text");
30
+ this._loadText();
31
+ }),
32
+ };
33
+ }
34
+ connectedCallback() {
35
+ super.connectedCallback();
36
+ this._loadText();
37
+ // Listen for language changes
38
+ window.addEventListener("language-changed", this.boundHandlers.languageChanged);
39
+ // Also listen for translations loaded event
40
+ window.addEventListener("translations-loaded", this.boundHandlers.languageChanged);
41
+ // Listen for language changes via events instead of signals
42
+ // The currentLanguage signal changes will trigger the language-changed event
43
+ }
44
+ disconnectedCallback() {
45
+ super.disconnectedCallback();
46
+ window.removeEventListener("language-changed", this.boundHandlers.languageChanged);
47
+ window.removeEventListener("translations-loaded", this.boundHandlers.languageChanged);
48
+ }
49
+ updated(changedProperties) {
50
+ super.updated(changedProperties);
51
+ if (changedProperties.has("key") || changedProperties.has("defaultValue")) {
52
+ this._loadText();
53
+ }
54
+ }
55
+ _loadText() {
56
+ if (!this.key) {
57
+ this._text = this.defaultValue || this.fallback || "";
58
+ return;
59
+ }
60
+ try {
61
+ const text = getText(this.key);
62
+ this._text = text || this.defaultValue || this.fallback || this.key;
63
+ }
64
+ catch (error) {
65
+ console.error("Error loading text for key:", this.key, error);
66
+ this._text = this.defaultValue || this.fallback || this.key;
67
+ }
68
+ this.requestUpdate();
69
+ }
70
+ render() {
71
+ return html `<span>${this._text || this.defaultValue || this.key}</span>`;
72
+ }
73
+ }
74
+ Text.styles = css `
75
+ :host {
76
+ display: inline;
77
+ }
78
+
79
+ .loading {
80
+ opacity: 0.6;
81
+ }
82
+ `;
83
+ customElements.define("ds-text", Text);
@@ -63,7 +63,7 @@ export class Home extends LitElement {
63
63
  @click="${this._navigateHome}"
64
64
  @keydown="${this._onKeyDown}"
65
65
  >
66
- <text-v1 key="home"></text-v1>
66
+ <ds-text key="home"></ds-text>
67
67
  </div>
68
68
  `;
69
69
  }
@@ -107,7 +107,7 @@ Home.styles = css `
107
107
  }
108
108
 
109
109
  /* Inner text spacing without affecting the 80px outer width */
110
- .home > text-v1 {
110
+ .home > ds-text {
111
111
  padding: 0 calc(var(--1) * 0.15 * var(--scaling-factor));
112
112
  box-sizing: border-box;
113
113
  height: 100%;
@@ -33,14 +33,14 @@ export class DoubleNav extends LitElement {
33
33
  ? html `
34
34
  <a href="${this.previous}" class="nav-previous">
35
35
  <icon-v1 type="left"></icon-v1>
36
- <text-v1>${this.previousText || "Previous"}</text-v1>
36
+ <ds-text>${this.previousText || "Previous"}</ds-text>
37
37
  </a>
38
38
  `
39
39
  : html `<div></div>`}
40
40
  ${this.next
41
41
  ? html `
42
42
  <a href="${this.next}" class="nav-next">
43
- <text-v1>${this.nextText || "Next"}</text-v1>
43
+ <ds-text>${this.nextText || "Next"}</ds-text>
44
44
  <icon-v1 type="right"></icon-v1>
45
45
  </a>
46
46
  `
@@ -22,7 +22,7 @@ export class SingleNav extends LitElement {
22
22
  const href = this.to || navConfig.href;
23
23
  return html `
24
24
  <a href="${href}">
25
- <text-v1 key="${navConfig.key}"></text-v1>
25
+ <ds-text key="${navConfig.key}"></ds-text>
26
26
  <icon-v1 type="right"></icon-v1>
27
27
  </a>
28
28
  `;
@@ -1169,7 +1169,7 @@ Button.styles = i`
1169
1169
  `;
1170
1170
  customElements.define("ds-button", Button);
1171
1171
 
1172
- // dist/2-core/text-v1.js
1172
+ // dist/2-core/ds-text.js
1173
1173
  var Text = class extends i4 {
1174
1174
  static get properties() {
1175
1175
  return {
@@ -1188,7 +1188,7 @@ var Text = class extends i4 {
1188
1188
  this._text = "";
1189
1189
  this.boundHandlers = {
1190
1190
  languageChanged: (() => {
1191
- console.log("Language changed event received in text-v1");
1191
+ console.log("Language changed event received in ds-text");
1192
1192
  this._loadText();
1193
1193
  })
1194
1194
  };
@@ -1237,7 +1237,7 @@ Text.styles = i`
1237
1237
  opacity: 0.6;
1238
1238
  }
1239
1239
  `;
1240
- customElements.define("text-v1", Text);
1240
+ customElements.define("ds-text", Text);
1241
1241
 
1242
1242
  // node_modules/lit-html/directive.js
1243
1243
  var t3 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
@@ -3283,7 +3283,7 @@ var Home = class extends i4 {
3283
3283
  @click="${this._navigateHome}"
3284
3284
  @keydown="${this._onKeyDown}"
3285
3285
  >
3286
- <text-v1 key="home"></text-v1>
3286
+ <ds-text key="home"></ds-text>
3287
3287
  </div>
3288
3288
  `;
3289
3289
  }
@@ -3328,7 +3328,7 @@ Home.styles = i`
3328
3328
  }
3329
3329
 
3330
3330
  /* Inner text spacing without affecting the 80px outer width */
3331
- .home > text-v1 {
3331
+ .home > ds-text {
3332
3332
  padding: 0 calc(var(--1) * 0.15 * var(--scaling-factor));
3333
3333
  box-sizing: border-box;
3334
3334
  height: 100%;
@@ -4370,7 +4370,7 @@ var SingleNav = class extends i4 {
4370
4370
  const href = this.to || navConfig.href;
4371
4371
  return x`
4372
4372
  <a href="${href}">
4373
- <text-v1 key="${navConfig.key}"></text-v1>
4373
+ <ds-text key="${navConfig.key}"></ds-text>
4374
4374
  <icon-v1 type="right"></icon-v1>
4375
4375
  </a>
4376
4376
  `;
@@ -4433,12 +4433,12 @@ var DoubleNav = class extends i4 {
4433
4433
  ${this.previous ? x`
4434
4434
  <a href="${this.previous}" class="nav-previous">
4435
4435
  <icon-v1 type="left"></icon-v1>
4436
- <text-v1>${this.previousText || "Previous"}</text-v1>
4436
+ <ds-text>${this.previousText || "Previous"}</ds-text>
4437
4437
  </a>
4438
4438
  ` : x`<div></div>`}
4439
4439
  ${this.next ? x`
4440
4440
  <a href="${this.next}" class="nav-next">
4441
- <text-v1>${this.nextText || "Next"}</text-v1>
4441
+ <ds-text>${this.nextText || "Next"}</ds-text>
4442
4442
  <icon-v1 type="right"></icon-v1>
4443
4443
  </a>
4444
4444
  ` : x`<div></div>`}