ds-one 0.2.5-alpha.9 → 0.3.0-alpha.1

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.
Files changed (209) hide show
  1. package/DS1/0-face/device.ts +138 -0
  2. package/DS1/0-face/scaling.ts +152 -0
  3. package/DS1/1-root/fonts/Iosevka-Regular.woff2 +0 -0
  4. package/DS1/1-root/one.css +124 -77
  5. package/DS1/2-core/ds-banner.ts +120 -1
  6. package/DS1/2-core/ds-button.ts +16 -93
  7. package/DS1/2-core/ds-card.ts +137 -0
  8. package/DS1/2-core/ds-cycle.ts +77 -179
  9. package/DS1/2-core/ds-date.ts +3 -10
  10. package/DS1/2-core/ds-gap.ts +38 -0
  11. package/DS1/2-core/ds-icon.ts +6 -35
  12. package/DS1/2-core/ds-input.ts +306 -1
  13. package/DS1/2-core/ds-pagedots.ts +52 -0
  14. package/DS1/2-core/ds-text.ts +55 -28
  15. package/DS1/2-core/ds-tooltip.ts +12 -58
  16. package/DS1/2-core/styles/ds-banner.css +77 -0
  17. package/DS1/2-core/styles/ds-button.css +67 -0
  18. package/DS1/2-core/styles/ds-cycle.css +21 -0
  19. package/DS1/2-core/styles/ds-date.css +9 -0
  20. package/DS1/2-core/styles/ds-gap.css +93 -0
  21. package/DS1/2-core/styles/ds-icon.css +30 -0
  22. package/DS1/2-core/styles/ds-input.css +46 -0
  23. package/DS1/2-core/styles/ds-pagedots.css +31 -0
  24. package/DS1/2-core/styles/ds-text.css +29 -0
  25. package/DS1/2-core/styles/ds-tooltip.css +49 -0
  26. package/DS1/3-unit/ds-accordion.ts +95 -0
  27. package/DS1/3-unit/ds-form.ts +304 -0
  28. package/DS1/3-unit/ds-list.ts +5 -14
  29. package/DS1/3-unit/ds-row.ts +3 -19
  30. package/DS1/3-unit/ds-table.ts +3 -86
  31. package/DS1/3-unit/styles/ds-accordion.css +46 -0
  32. package/DS1/3-unit/styles/ds-list.css +9 -0
  33. package/DS1/3-unit/styles/ds-row.css +19 -0
  34. package/DS1/3-unit/styles/ds-table.css +80 -0
  35. package/DS1/4-page/ds-container.ts +28 -0
  36. package/DS1/4-page/ds-grid.ts +37 -50
  37. package/DS1/4-page/ds-layout.ts +652 -163
  38. package/DS1/4-page/styles/ds-container.css +35 -0
  39. package/DS1/4-page/styles/ds-grid.css +56 -0
  40. package/DS1/4-page/styles/ds-layout.css +246 -0
  41. package/DS1/index.ts +9 -1
  42. package/DS1/vite-env.d.ts +13 -0
  43. package/DS1/x-icon/2x.svg +4 -0
  44. package/DS1/x-icon/2xdots.svg +18 -0
  45. package/DS1/x-icon/2xgrid.svg +6 -0
  46. package/DS1/x-icon/2xlines.svg +6 -0
  47. package/DS1/x-icon/4x4.svg +18 -0
  48. package/DS1/x-icon/apple.svg +4 -0
  49. package/DS1/x-icon/avatar.svg +4 -0
  50. package/DS1/x-icon/big.svg +4 -0
  51. package/DS1/x-icon/blank.svg +3 -0
  52. package/DS1/x-icon/check.svg +3 -0
  53. package/DS1/x-icon/close.svg +3 -0
  54. package/DS1/x-icon/collapse.svg +3 -0
  55. package/DS1/x-icon/color.svg +4 -0
  56. package/DS1/x-icon/column.svg +5 -0
  57. package/DS1/x-icon/default.svg +3 -0
  58. package/DS1/x-icon/delete.svg +5 -0
  59. package/DS1/x-icon/dictate.svg +6 -0
  60. package/DS1/x-icon/do.svg +3 -0
  61. package/DS1/x-icon/down.svg +3 -0
  62. package/DS1/x-icon/duplicate.svg +4 -0
  63. package/DS1/x-icon/gallery.svg +5 -0
  64. package/DS1/x-icon/google.svg +6 -0
  65. package/DS1/x-icon/head.svg +5 -0
  66. package/DS1/x-icon/home.svg +3 -0
  67. package/DS1/x-icon/icon.svg +4 -0
  68. package/DS1/x-icon/in.svg +4 -0
  69. package/DS1/x-icon/lock.svg +5 -0
  70. package/DS1/x-icon/loop.svg +5 -0
  71. package/DS1/x-icon/mic.svg +5 -0
  72. package/DS1/x-icon/minimize.svg +3 -0
  73. package/DS1/x-icon/more.svg +5 -0
  74. package/DS1/x-icon/neutral.svg +6 -0
  75. package/DS1/x-icon/note.svg +6 -0
  76. package/DS1/x-icon/page.svg +4 -0
  77. package/DS1/x-icon/plus.svg +3 -0
  78. package/DS1/x-icon/rewind.svg +4 -0
  79. package/DS1/x-icon/row.svg +5 -0
  80. package/DS1/x-icon/sdown.svg +3 -0
  81. package/DS1/x-icon/search.svg +4 -0
  82. package/DS1/x-icon/see.svg +4 -0
  83. package/DS1/x-icon/ship.svg +5 -0
  84. package/DS1/x-icon/star.svg +3 -0
  85. package/DS1/x-icon/status.svg +4 -0
  86. package/DS1/x-icon/sup.svg +3 -0
  87. package/DS1/x-icon/title.svg +3 -0
  88. package/DS1/x-icon/undo.svg +3 -0
  89. package/DS1/x-icon/ungroup.svg +4 -0
  90. package/DS1/x-icon/unhead.svg +3 -0
  91. package/DS1/x-icon/unicon.svg +3 -0
  92. package/DS1/x-icon/unlock.svg +5 -0
  93. package/DS1/x-icon/unmic.svg +6 -0
  94. package/DS1/x-icon/unsee.svg +5 -0
  95. package/DS1/x-icon/unstar.svg +3 -0
  96. package/DS1/x-icon/untitle.svg +3 -0
  97. package/DS1/x-icon/up.svg +3 -0
  98. package/LICENSE +1 -1
  99. package/README.md +4 -4
  100. package/dist/0-face/device.d.ts +5 -0
  101. package/dist/0-face/device.d.ts.map +1 -1
  102. package/dist/0-face/device.js +111 -0
  103. package/dist/0-face/scaling.d.ts +48 -0
  104. package/dist/0-face/scaling.d.ts.map +1 -0
  105. package/dist/0-face/scaling.js +114 -0
  106. package/dist/2-core/ds-banner.d.ts +67 -0
  107. package/dist/2-core/ds-banner.d.ts.map +1 -1
  108. package/dist/2-core/ds-banner.js +97 -1
  109. package/dist/2-core/ds-button.d.ts +4 -15
  110. package/dist/2-core/ds-button.d.ts.map +1 -1
  111. package/dist/2-core/ds-button.js +14 -86
  112. package/dist/2-core/ds-card.d.ts +39 -0
  113. package/dist/2-core/ds-card.d.ts.map +1 -0
  114. package/dist/2-core/ds-card.js +119 -0
  115. package/dist/2-core/ds-cycle.d.ts +1 -5
  116. package/dist/2-core/ds-cycle.d.ts.map +1 -1
  117. package/dist/2-core/ds-cycle.js +74 -163
  118. package/dist/2-core/ds-date.d.ts.map +1 -1
  119. package/dist/2-core/ds-date.js +3 -9
  120. package/dist/2-core/ds-gap.d.ts +28 -0
  121. package/dist/2-core/ds-gap.d.ts.map +1 -0
  122. package/dist/2-core/ds-gap.js +25 -0
  123. package/dist/2-core/ds-icon.d.ts.map +1 -1
  124. package/dist/2-core/ds-icon.js +6 -35
  125. package/dist/2-core/ds-input.d.ts +127 -0
  126. package/dist/2-core/ds-input.d.ts.map +1 -1
  127. package/dist/2-core/ds-input.js +252 -1
  128. package/dist/2-core/ds-pagedots.d.ts +32 -0
  129. package/dist/2-core/ds-pagedots.d.ts.map +1 -0
  130. package/dist/2-core/ds-pagedots.js +36 -0
  131. package/dist/2-core/ds-text.d.ts +5 -3
  132. package/dist/2-core/ds-text.d.ts.map +1 -1
  133. package/dist/2-core/ds-text.js +49 -27
  134. package/dist/2-core/ds-tooltip.d.ts +2 -2
  135. package/dist/2-core/ds-tooltip.d.ts.map +1 -1
  136. package/dist/2-core/ds-tooltip.js +11 -57
  137. package/dist/2-core/styles/ds-banner.css +77 -0
  138. package/dist/2-core/styles/ds-button.css +67 -0
  139. package/dist/2-core/styles/ds-cycle.css +21 -0
  140. package/dist/2-core/styles/ds-date.css +9 -0
  141. package/dist/2-core/styles/ds-gap.css +93 -0
  142. package/dist/2-core/styles/ds-icon.css +30 -0
  143. package/dist/2-core/styles/ds-input.css +46 -0
  144. package/dist/2-core/styles/ds-pagedots.css +26 -0
  145. package/dist/2-core/styles/ds-text.css +29 -0
  146. package/dist/2-core/styles/ds-tooltip.css +49 -0
  147. package/dist/3-unit/ds-accordion.d.ts +47 -0
  148. package/dist/3-unit/ds-accordion.d.ts.map +1 -0
  149. package/dist/3-unit/ds-accordion.js +75 -0
  150. package/dist/3-unit/ds-form.d.ts +70 -0
  151. package/dist/3-unit/ds-form.d.ts.map +1 -0
  152. package/dist/3-unit/ds-form.js +232 -0
  153. package/dist/3-unit/ds-list.d.ts.map +1 -1
  154. package/dist/3-unit/ds-list.js +5 -11
  155. package/dist/3-unit/ds-row.d.ts.map +1 -1
  156. package/dist/3-unit/ds-row.js +3 -19
  157. package/dist/3-unit/ds-table.d.ts.map +1 -1
  158. package/dist/3-unit/ds-table.js +3 -86
  159. package/dist/3-unit/styles/ds-accordion.css +46 -0
  160. package/dist/3-unit/styles/ds-list.css +9 -0
  161. package/dist/3-unit/styles/ds-row.css +19 -0
  162. package/dist/3-unit/styles/ds-table.css +80 -0
  163. package/dist/{3-unit/row-v1.d.ts → 4-page/ds-container.d.ts} +3 -11
  164. package/dist/4-page/ds-container.d.ts.map +1 -0
  165. package/dist/4-page/ds-container.js +11 -0
  166. package/dist/4-page/ds-grid.d.ts +5 -0
  167. package/dist/4-page/ds-grid.d.ts.map +1 -1
  168. package/dist/4-page/ds-grid.js +38 -56
  169. package/dist/4-page/ds-layout.d.ts +3 -3
  170. package/dist/4-page/ds-layout.d.ts.map +1 -1
  171. package/dist/4-page/ds-layout.js +651 -162
  172. package/dist/4-page/styles/ds-container.css +35 -0
  173. package/dist/4-page/styles/ds-grid.css +56 -0
  174. package/dist/4-page/styles/ds-layout.css +251 -0
  175. package/dist/ds-one.bundle.css +700 -0
  176. package/dist/ds-one.bundle.css.map +7 -0
  177. package/dist/ds-one.bundle.js +2642 -1469
  178. package/dist/ds-one.bundle.js.map +1 -7
  179. package/dist/ds-one.bundle.min.css +2 -0
  180. package/dist/ds-one.bundle.min.css.map +7 -0
  181. package/dist/ds-one.bundle.min.js +3850 -550
  182. package/dist/ds-one.bundle.min.js.map +1 -7
  183. package/dist/index.d.ts +9 -1
  184. package/dist/index.d.ts.map +1 -1
  185. package/dist/index.js +9 -1
  186. package/package.json +4 -2
  187. package/dist/3-unit/doublenav-v1.d.ts +0 -51
  188. package/dist/3-unit/doublenav-v1.d.ts.map +0 -1
  189. package/dist/3-unit/doublenav-v1.js +0 -88
  190. package/dist/3-unit/ds-portfolio-doublenav.d.ts +0 -51
  191. package/dist/3-unit/ds-portfolio-doublenav.d.ts.map +0 -1
  192. package/dist/3-unit/ds-portfolio-doublenav.js +0 -88
  193. package/dist/3-unit/ds-portfolio-panel.d.ts +0 -11
  194. package/dist/3-unit/ds-portfolio-panel.d.ts.map +0 -1
  195. package/dist/3-unit/ds-portfolio-panel.js +0 -16
  196. package/dist/3-unit/ds-portfolio-singlenav.d.ts +0 -32
  197. package/dist/3-unit/ds-portfolio-singlenav.d.ts.map +0 -1
  198. package/dist/3-unit/ds-portfolio-singlenav.js +0 -62
  199. package/dist/3-unit/list-v1.d.ts +0 -11
  200. package/dist/3-unit/list-v1.d.ts.map +0 -1
  201. package/dist/3-unit/list-v1.js +0 -15
  202. package/dist/3-unit/panel-v1.d.ts +0 -11
  203. package/dist/3-unit/panel-v1.d.ts.map +0 -1
  204. package/dist/3-unit/panel-v1.js +0 -16
  205. package/dist/3-unit/row-v1.d.ts.map +0 -1
  206. package/dist/3-unit/row-v1.js +0 -32
  207. package/dist/3-unit/singlenav-v1.d.ts +0 -32
  208. package/dist/3-unit/singlenav-v1.d.ts.map +0 -1
  209. package/dist/3-unit/singlenav-v1.js +0 -62
@@ -1 +1,252 @@
1
- // here should be an input component
1
+ // ds-input.ts
2
+ // Input component for text and other input types
3
+ import { LitElement, html, css } from "lit";
4
+ import "./ds-text";
5
+ export class Input extends LitElement {
6
+ constructor() {
7
+ super();
8
+ this.type = "text";
9
+ this.name = "";
10
+ this.value = "";
11
+ this.placeholder = "";
12
+ this.placeholderKey = "";
13
+ this.label = "";
14
+ this.labelText = "";
15
+ this.disabled = false;
16
+ this.readonly = false;
17
+ this.required = false;
18
+ this.autofocus = false;
19
+ this.autocomplete = "off";
20
+ this.pattern = "";
21
+ this.minlength = 0;
22
+ this.maxlength = 0;
23
+ this.min = "";
24
+ this.max = "";
25
+ this.step = "";
26
+ this.variant = "default";
27
+ this.error = "";
28
+ this.errorText = "";
29
+ this._focused = false;
30
+ }
31
+ _handleInput(e) {
32
+ const target = e.target;
33
+ this.value = target.value;
34
+ this.dispatchEvent(new CustomEvent("input-change", {
35
+ detail: { value: this.value, name: this.name },
36
+ bubbles: true,
37
+ }));
38
+ }
39
+ _handleFocus() {
40
+ this._focused = true;
41
+ this.dispatchEvent(new CustomEvent("input-focus", { bubbles: true }));
42
+ }
43
+ _handleBlur() {
44
+ this._focused = false;
45
+ this.dispatchEvent(new CustomEvent("input-blur", { bubbles: true }));
46
+ }
47
+ /**
48
+ * Focus the input element
49
+ */
50
+ focus() {
51
+ const input = this.shadowRoot?.querySelector("input");
52
+ input?.focus();
53
+ }
54
+ /**
55
+ * Blur the input element
56
+ */
57
+ blur() {
58
+ const input = this.shadowRoot?.querySelector("input");
59
+ input?.blur();
60
+ }
61
+ /**
62
+ * Select all text in the input
63
+ */
64
+ select() {
65
+ const input = this.shadowRoot?.querySelector("input");
66
+ input?.select();
67
+ }
68
+ render() {
69
+ const hasError = Boolean(this.error || this.errorText);
70
+ return html `
71
+ <div class="input-wrapper">
72
+ ${this.label || this.labelText
73
+ ? html `
74
+ <label for="input">
75
+ ${this.labelText
76
+ ? html `<ds-text .text=${this.labelText}></ds-text>`
77
+ : this.label}
78
+ </label>
79
+ `
80
+ : null}
81
+
82
+ <div class="input-container">
83
+ <input
84
+ id="input"
85
+ .type=${this.type}
86
+ .name=${this.name}
87
+ .value=${this.value}
88
+ .placeholder=${this.placeholder}
89
+ ?disabled=${this.disabled}
90
+ ?readonly=${this.readonly}
91
+ ?required=${this.required}
92
+ ?autofocus=${this.autofocus}
93
+ autocomplete=${this.autocomplete}
94
+ pattern=${this.pattern || ""}
95
+ minlength=${this.minlength || ""}
96
+ maxlength=${this.maxlength || ""}
97
+ min=${this.min}
98
+ max=${this.max}
99
+ step=${this.step}
100
+ class=${hasError ? "has-error" : ""}
101
+ @input=${this._handleInput}
102
+ @focus=${this._handleFocus}
103
+ @blur=${this._handleBlur}
104
+ />
105
+ </div>
106
+
107
+ ${hasError
108
+ ? html `
109
+ <div class="error-message">
110
+ ${this.errorText
111
+ ? html `<ds-text .text=${this.errorText}></ds-text>`
112
+ : this.error}
113
+ </div>
114
+ `
115
+ : null}
116
+ </div>
117
+ `;
118
+ }
119
+ }
120
+ Input.properties = {
121
+ type: { type: String, reflect: true },
122
+ name: { type: String, reflect: true },
123
+ value: { type: String },
124
+ placeholder: { type: String },
125
+ placeholderKey: { type: String, attribute: "placeholder-key" },
126
+ label: { type: String },
127
+ labelText: { type: String, attribute: "label-text" },
128
+ disabled: { type: Boolean, reflect: true },
129
+ readonly: { type: Boolean, reflect: true },
130
+ required: { type: Boolean, reflect: true },
131
+ autofocus: { type: Boolean },
132
+ autocomplete: { type: String },
133
+ pattern: { type: String },
134
+ minlength: { type: Number },
135
+ maxlength: { type: Number },
136
+ min: { type: String },
137
+ max: { type: String },
138
+ step: { type: String },
139
+ variant: { type: String, reflect: true },
140
+ error: { type: String },
141
+ errorText: { type: String, attribute: "error-text" },
142
+ _focused: { type: Boolean, state: true },
143
+ };
144
+ Input.styles = css `
145
+ :host {
146
+ display: block;
147
+ width: 100%;
148
+ }
149
+
150
+ .input-wrapper {
151
+ display: flex;
152
+ flex-direction: column;
153
+ gap: calc(var(--025) * var(--sf, 1));
154
+ width: 100%;
155
+ }
156
+
157
+ label {
158
+ font-family: var(--typeface-regular);
159
+ font-size: calc(12px * var(--sf, 1));
160
+ color: var(--text-color-secondary);
161
+ }
162
+
163
+ .input-container {
164
+ position: relative;
165
+ display: flex;
166
+ align-items: center;
167
+ width: 100%;
168
+ }
169
+
170
+ input {
171
+ width: 100%;
172
+ height: calc(var(--1) * var(--sf, 1));
173
+ padding: 0 calc(var(--025) * var(--sf, 1));
174
+ font-family: var(--typeface-regular);
175
+ font-size: calc(14px * var(--sf, 1));
176
+ color: var(--text-color-primary);
177
+ background-color: var(--input-background, transparent);
178
+ border: 1px solid var(--input-border-color, var(--border-color, #ccc));
179
+ border-radius: calc(var(--025) * var(--sf, 1));
180
+ outline: none;
181
+ transition:
182
+ border-color 0.2s ease,
183
+ box-shadow 0.2s ease;
184
+ box-sizing: border-box;
185
+ }
186
+
187
+ input::placeholder {
188
+ color: var(--text-color-tertiary, #999);
189
+ }
190
+
191
+ input:focus {
192
+ border-color: var(--accent-color, #007aff);
193
+ box-shadow: 0 0 0 2px var(--input-focus-ring, rgba(0, 122, 255, 0.2));
194
+ }
195
+
196
+ input:disabled {
197
+ opacity: 0.5;
198
+ cursor: not-allowed;
199
+ background-color: var(--input-disabled-background, #f5f5f5);
200
+ }
201
+
202
+ input:read-only {
203
+ background-color: var(--input-readonly-background, #fafafa);
204
+ }
205
+
206
+ :host([variant="filled"]) input {
207
+ background-color: var(
208
+ --input-filled-background,
209
+ var(--surface-color-secondary, #f5f5f5)
210
+ );
211
+ border: none;
212
+ border-bottom: 2px solid var(--border-color, #ccc);
213
+ border-radius: calc(var(--025) * var(--sf, 1))
214
+ calc(var(--025) * var(--sf, 1)) 0 0;
215
+ }
216
+
217
+ :host([variant="filled"]) input:focus {
218
+ border-bottom-color: var(--accent-color, #007aff);
219
+ box-shadow: none;
220
+ }
221
+
222
+ :host([variant="outlined"]) input {
223
+ background-color: transparent;
224
+ border: 2px solid var(--border-color, #ccc);
225
+ }
226
+
227
+ :host([variant="outlined"]) input:focus {
228
+ border-color: var(--accent-color, #007aff);
229
+ }
230
+
231
+ .error-message {
232
+ font-family: var(--typeface-regular);
233
+ font-size: calc(12px * var(--sf, 1));
234
+ color: var(--error-color, #ff3b30);
235
+ margin-top: calc(var(--025) * var(--sf, 1));
236
+ }
237
+
238
+ :host([required]) label::after {
239
+ content: " *";
240
+ color: var(--error-color, #ff3b30);
241
+ }
242
+
243
+ /* Error state */
244
+ input.has-error {
245
+ border-color: var(--error-color, #ff3b30);
246
+ }
247
+
248
+ input.has-error:focus {
249
+ box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.2);
250
+ }
251
+ `;
252
+ customElements.define("ds-input", Input);
@@ -0,0 +1,32 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * Page dots indicator component for carousels and pagination.
4
+ *
5
+ * Usage:
6
+ * - <ds-pagedots count="3" active="0"></ds-pagedots>
7
+ */
8
+ export declare class Pagedots extends LitElement {
9
+ static properties: {
10
+ /** Number of dots to display */
11
+ count: {
12
+ type: NumberConstructor;
13
+ reflect: boolean;
14
+ };
15
+ /** Index of the active dot (0-based) */
16
+ active: {
17
+ type: NumberConstructor;
18
+ reflect: boolean;
19
+ };
20
+ };
21
+ count: number;
22
+ active: number;
23
+ constructor();
24
+ static styles: import("lit").CSSResult;
25
+ render(): import("lit-html").TemplateResult<1>;
26
+ }
27
+ declare global {
28
+ interface HTMLElementTagNameMap {
29
+ "ds-pagedots": Pagedots;
30
+ }
31
+ }
32
+ //# sourceMappingURL=ds-pagedots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ds-pagedots.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-pagedots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAGlD;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,UAAU;QACf,gCAAgC;;;;;QAEhC,wCAAwC;;;;;MAExC;IAEM,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;;IAQvB,MAAM,CAAC,MAAM,0BAAqB;IAElC,MAAM;CAeP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,QAAQ,CAAC;KACzB;CACF"}
@@ -0,0 +1,36 @@
1
+ import { LitElement, html, unsafeCSS } from "lit";
2
+ import styles from "./styles/ds-pagedots.css?inline";
3
+ /**
4
+ * Page dots indicator component for carousels and pagination.
5
+ *
6
+ * Usage:
7
+ * - <ds-pagedots count="3" active="0"></ds-pagedots>
8
+ */
9
+ export class Pagedots extends LitElement {
10
+ constructor() {
11
+ super();
12
+ this.count = 3;
13
+ this.active = 0;
14
+ }
15
+ render() {
16
+ const dots = Array.from({ length: this.count }, (_, i) => i);
17
+ return html `
18
+ ${dots.map((index) => html `
19
+ <span
20
+ class="dot ${index === this.active ? "active" : ""}"
21
+ role="button"
22
+ aria-label="Slide ${index + 1}"
23
+ aria-current="${index === this.active ? "true" : "false"}"
24
+ ></span>
25
+ `)}
26
+ `;
27
+ }
28
+ }
29
+ Pagedots.properties = {
30
+ /** Number of dots to display */
31
+ count: { type: Number, reflect: true },
32
+ /** Index of the active dot (0-based) */
33
+ active: { type: Number, reflect: true },
34
+ };
35
+ Pagedots.styles = unsafeCSS(styles);
36
+ customElements.define("ds-pagedots", Pagedots);
@@ -3,13 +3,13 @@ import { LitElement } from "lit";
3
3
  * A component for displaying text from translations
4
4
  *
5
5
  * @element ds-text
6
- * @prop {string} key - The translation key to use
6
+ * @prop {string} text - The translation text to use
7
7
  * @prop {string} defaultValue - Default value if translation is not found
8
8
  * @prop {string} fallback - Optional fallback text if translation is not found (deprecated, use defaultValue)
9
9
  */
10
10
  export declare class Text extends LitElement {
11
11
  static get properties(): {
12
- key: {
12
+ text: {
13
13
  type: StringConstructor;
14
14
  reflect: boolean;
15
15
  };
@@ -27,16 +27,18 @@ export declare class Text extends LitElement {
27
27
  state: boolean;
28
28
  };
29
29
  };
30
- key: string;
30
+ text: string;
31
31
  defaultValue: string;
32
32
  fallback: string;
33
33
  _text: string;
34
+ _currentLanguage: string;
34
35
  private boundHandlers;
35
36
  constructor();
36
37
  static styles: import("lit").CSSResult;
37
38
  connectedCallback(): void;
38
39
  disconnectedCallback(): void;
39
40
  updated(changedProperties: Map<string, unknown>): void;
41
+ _updateLanguageAttribute(): void;
40
42
  _loadText(): void;
41
43
  render(): import("lit-html").TemplateResult<1>;
42
44
  }
@@ -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;IACtB,OAAO,CAAC,aAAa,CAAqC;;IAkB1D,MAAM,CAAC,MAAM,0BAcX;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"}
1
+ {"version":3,"file":"ds-text.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAIlD;;;;;;;GAOG;AACH,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,KAAK,UAAU;;;;;;;;;;;;;;;;;;MAOpB;IAEO,IAAI,EAAE,MAAM,CAAC;IACb,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,0BAAqB;IAElC,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"}
@@ -1,17 +1,18 @@
1
- import { LitElement, html, css } from "lit";
2
- import { getText } from "../0-face/i18n";
1
+ import { LitElement, html, unsafeCSS } from "lit";
2
+ import { getText, currentLanguage } from "../0-face/i18n";
3
+ import styles from "./styles/ds-text.css?inline";
3
4
  /**
4
5
  * A component for displaying text from translations
5
6
  *
6
7
  * @element ds-text
7
- * @prop {string} key - The translation key to use
8
+ * @prop {string} text - The translation text to use
8
9
  * @prop {string} defaultValue - Default value if translation is not found
9
10
  * @prop {string} fallback - Optional fallback text if translation is not found (deprecated, use defaultValue)
10
11
  */
11
12
  export class Text extends LitElement {
12
13
  static get properties() {
13
14
  return {
14
- key: { type: String, reflect: true },
15
+ text: { type: String, reflect: true },
15
16
  defaultValue: { type: String, reflect: true, attribute: "default-value" },
16
17
  fallback: { type: String, reflect: true }, // Kept for backward compatibility
17
18
  _text: { type: String, state: true },
@@ -19,20 +20,26 @@ export class Text extends LitElement {
19
20
  }
20
21
  constructor() {
21
22
  super();
22
- this.key = "";
23
+ this.text = "";
23
24
  this.defaultValue = "";
24
25
  this.fallback = "";
25
26
  this._text = "";
27
+ this._currentLanguage = currentLanguage.value;
26
28
  // Create bound event handlers for proper cleanup
27
29
  this.boundHandlers = {
28
30
  languageChanged: (() => {
29
31
  console.log("Language changed event received in ds-text");
32
+ this._currentLanguage = currentLanguage.value;
33
+ this._updateLanguageAttribute();
30
34
  this._loadText();
35
+ this.requestUpdate();
31
36
  }),
32
37
  };
33
38
  }
34
39
  connectedCallback() {
35
40
  super.connectedCallback();
41
+ this._currentLanguage = currentLanguage.value;
42
+ this._updateLanguageAttribute();
36
43
  this._loadText();
37
44
  // Listen for language changes
38
45
  window.addEventListener("language-changed", this.boundHandlers.languageChanged);
@@ -48,42 +55,57 @@ export class Text extends LitElement {
48
55
  }
49
56
  updated(changedProperties) {
50
57
  super.updated(changedProperties);
51
- if (changedProperties.has("key") || changedProperties.has("defaultValue")) {
58
+ if (changedProperties.has("text") || changedProperties.has("defaultValue")) {
52
59
  this._loadText();
53
60
  }
54
61
  }
62
+ _updateLanguageAttribute() {
63
+ const lang = this._currentLanguage || currentLanguage.value;
64
+ // Handles "ja", "ja-JP", "zh-Hant", "zh-Hans", etc.
65
+ const parts = (lang || "").toLowerCase().split(/[-_]/).filter(Boolean);
66
+ const primaryLang = parts[0] || "";
67
+ if (primaryLang === "ja") {
68
+ this.setAttribute("data-language", "ja");
69
+ return;
70
+ }
71
+ if (primaryLang === "zh") {
72
+ // Prefer explicit script; otherwise infer from common regions.
73
+ const hasHans = parts.includes("hans") || parts.includes("cn") || parts.includes("sg");
74
+ const hasHant = parts.includes("hant") ||
75
+ parts.includes("tw") ||
76
+ parts.includes("hk") ||
77
+ parts.includes("mo");
78
+ if (hasHans)
79
+ this.setAttribute("data-language", "zh-hans");
80
+ else if (hasHant)
81
+ this.setAttribute("data-language", "zh-hant");
82
+ else
83
+ this.setAttribute("data-language", "zh");
84
+ return;
85
+ }
86
+ this.removeAttribute("data-language");
87
+ }
55
88
  _loadText() {
56
- if (!this.key) {
89
+ if (!this.text) {
57
90
  this._text = this.defaultValue || this.fallback || "";
91
+ this._updateLanguageAttribute();
92
+ this.requestUpdate();
58
93
  return;
59
94
  }
60
95
  try {
61
- const text = getText(this.key);
62
- this._text = text || this.defaultValue || this.fallback || this.key;
96
+ const translatedText = getText(this.text);
97
+ this._text = translatedText || this.defaultValue || this.fallback || this.text;
63
98
  }
64
99
  catch (error) {
65
- console.error("Error loading text for key:", this.key, error);
66
- this._text = this.defaultValue || this.fallback || this.key;
100
+ console.error("Error loading text for text:", this.text, error);
101
+ this._text = this.defaultValue || this.fallback || this.text;
67
102
  }
103
+ this._updateLanguageAttribute();
68
104
  this.requestUpdate();
69
105
  }
70
106
  render() {
71
- return html `<span>${this._text || this.defaultValue || this.key}</span>`;
107
+ return html `<span>${this._text || this.defaultValue || this.text}</span>`;
72
108
  }
73
109
  }
74
- Text.styles = css `
75
- :host {
76
- display: inline;
77
- font-family: var(--typeface);
78
- font-size: calc(var(--type-size-default) * var(--scaling-factor));
79
- font-weight: var(--type-weight-default);
80
- line-height: calc(var(--type-lineheight-default) * var(--scaling-factor));
81
- letter-spacing: calc(
82
- var(--type-letterspacing-default) * var(--scaling-factor)
83
- );
84
- text-align: var(--text-align-default);
85
- text-transform: var(--text-transform-default);
86
- text-decoration: var(--text-decoration-default);
87
- }
88
- `;
110
+ Text.styles = unsafeCSS(styles);
89
111
  customElements.define("ds-text", Text);
@@ -1,7 +1,7 @@
1
1
  import { LitElement } from "lit";
2
2
  export declare class Tooltip extends LitElement {
3
3
  static properties: {
4
- key: {
4
+ text: {
5
5
  type: StringConstructor;
6
6
  reflect: boolean;
7
7
  };
@@ -17,7 +17,7 @@ export declare class Tooltip extends LitElement {
17
17
  state: boolean;
18
18
  };
19
19
  };
20
- key: string;
20
+ text: string;
21
21
  defaultValue: string;
22
22
  private _text;
23
23
  private _visible;
@@ -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;IAM5C,SAAS,IAAI,IAAI;IAiBjB,MAAM;CAUP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,OAAO,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"ds-tooltip.d.ts","sourceRoot":"","sources":["../../DS1/2-core/ds-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAIlD,qBAAa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;MAKf;IAEM,IAAI,EAAE,MAAM,CAAC;IACb,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,0BAAqB;IAElC,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,9 +1,10 @@
1
- import { LitElement, html, css } from "lit";
1
+ import { LitElement, html, unsafeCSS } from "lit";
2
2
  import { translate } from "../0-face/i18n";
3
+ import styles from "./styles/ds-tooltip.css?inline";
3
4
  export class Tooltip extends LitElement {
4
5
  constructor() {
5
6
  super();
6
- this.key = "";
7
+ this.text = "";
7
8
  this.defaultValue = "";
8
9
  this._text = "";
9
10
  this._visible = false;
@@ -54,23 +55,23 @@ export class Tooltip extends LitElement {
54
55
  this.removeEventListener("focusout", this.boundHostHandlers.focusout);
55
56
  }
56
57
  updated(changed) {
57
- if (changed.has("key") || changed.has("defaultValue")) {
58
+ if (changed.has("text") || changed.has("defaultValue")) {
58
59
  this._loadText();
59
60
  }
60
61
  }
61
62
  _loadText() {
62
- if (!this.key) {
63
+ if (!this.text) {
63
64
  this._text = this.defaultValue || "";
64
65
  this.requestUpdate();
65
66
  return;
66
67
  }
67
68
  try {
68
- const t = translate(this.key);
69
- this._text = t && t !== this.key ? t : this.defaultValue || this.key;
69
+ const t = translate(this.text);
70
+ this._text = t && t !== this.text ? t : this.defaultValue || this.text;
70
71
  }
71
72
  catch (err) {
72
- console.error("ds-tooltip: error loading text for key", this.key, err);
73
- this._text = this.defaultValue || this.key;
73
+ console.error("ds-tooltip: error loading text for text", this.text, err);
74
+ this._text = this.defaultValue || this.text;
74
75
  }
75
76
  this.requestUpdate();
76
77
  }
@@ -85,57 +86,10 @@ export class Tooltip extends LitElement {
85
86
  }
86
87
  }
87
88
  Tooltip.properties = {
88
- key: { type: String, reflect: true },
89
+ text: { type: String, reflect: true },
89
90
  defaultValue: { type: String, reflect: true, attribute: "default-value" },
90
91
  _text: { state: true },
91
92
  _visible: { state: true },
92
93
  };
93
- Tooltip.styles = css `
94
- :host {
95
- position: relative;
96
- display: inline-block;
97
- }
98
-
99
- .slot-wrapper {
100
- display: inline-flex;
101
- align-items: center;
102
- }
103
-
104
- .bubble {
105
- display: flex;
106
- align-items: center;
107
- justify-content: center;
108
- position: absolute;
109
- left: 50%;
110
- bottom: 100%;
111
- transform: translate(-50%, calc(-2px * var(--sf)));
112
- z-index: 1000;
113
- pointer-events: none;
114
- height: calc(var(--08) * var(--sf));
115
- opacity: 0;
116
- transition:
117
- opacity 120ms ease,
118
- transform 120ms ease;
119
- background-color: light-dark(var(--black), var(--white));
120
- color: light-dark(var(--white), var(--black));
121
- border-radius: 0;
122
- font-size: var(--type-size-default);
123
- padding: 0px calc(1px * var(--sf));
124
- font-family: var(
125
- --typeface,
126
- -apple-system,
127
- BlinkMacSystemFont,
128
- "Segoe UI",
129
- Roboto,
130
- sans-serif
131
- );
132
- font-weight: 500;
133
- white-space: nowrap;
134
- min-width: max-content;
135
- }
136
-
137
- .bubble.visible {
138
- opacity: 1;
139
- }
140
- `;
94
+ Tooltip.styles = unsafeCSS(styles);
141
95
  customElements.define("ds-tooltip", Tooltip);