ds-one 0.2.5-alpha.3 → 0.2.5-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.
@@ -93,9 +93,14 @@ export function initDeviceDetection(): DeviceInfo {
93
93
  const actualWidth = deviceInfo.screenWidth;
94
94
  const scalingFactor = actualWidth / designWidth;
95
95
 
96
- // Set CSS custom property for scaling
96
+ // Set CSS custom property for scaling on html element
97
97
  document.documentElement.style.setProperty(
98
- "--scaling-factor-mobile",
98
+ "--sf",
99
+ scalingFactor.toFixed(3)
100
+ );
101
+ // Also set --sf for backwards compatibility
102
+ document.documentElement.style.setProperty(
103
+ "--sf",
99
104
  scalingFactor.toFixed(3)
100
105
  );
101
106
 
@@ -105,10 +110,9 @@ export function initDeviceDetection(): DeviceInfo {
105
110
  } else {
106
111
  // Desktop - no scaling
107
112
  if (typeof document !== "undefined") {
108
- document.documentElement.style.setProperty(
109
- "--scaling-factor-mobile",
110
- "1"
111
- );
113
+ document.documentElement.style.setProperty("--sf", "1");
114
+ // Also set --sf for backwards compatibility
115
+ document.documentElement.style.setProperty("--sf", "1");
112
116
  }
113
117
  console.log(
114
118
  `[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`
@@ -579,7 +579,9 @@ export function translate(key: string): string {
579
579
  return translationData[defaultLanguage][key];
580
580
  }
581
581
 
582
- console.warn(`[translate] No translation found for key "${key}"`);
582
+ console.warn(
583
+ `[DS one (Internationalization)] No translation found for key "${key}"`
584
+ );
583
585
  return key;
584
586
  }
585
587
 
@@ -20,9 +20,6 @@ input {
20
20
  --orange: #fec20d;
21
21
  --yellow: #ffff00;
22
22
 
23
- /* accent color - defaults to blue but can be changed by user */
24
- --accent-color: var(--light-green);
25
-
26
23
  /* DS1 Documentation Colors */
27
24
  --ds1-docs-header-bg: light-dark(#f5f5f5, #232323);
28
25
  --ds1-docs-header-border: light-dark(#e0e0e0, #000000);
@@ -34,10 +31,19 @@ input {
34
31
  --ds1-docs-search-bg: light-dark(#f0f0f0, #171717);
35
32
  --ds1-docs-divider: light-dark(#e0e0e0, #000000);
36
33
 
37
- /* grid colors */
38
- --grid-color: light-dark(var(--slate), var(--slate-dark));
34
+ /* 4-page component colors */
35
+
36
+ /* ds-grid color */
37
+ --grid-color: light-dark(var(--grid-color-light), var(--grid-color-dark));
38
+ --grid-color-light: var(--slate);
39
+ --grid-color-dark: var(--white);
39
40
 
41
+ /* ds-layout colors */
40
42
 
43
+ --layout-color: light-dark(
44
+ var(--layout-color-light),
45
+ var(--layout-color-dark)
46
+ );
41
47
 
42
48
  /* typefaces */
43
49
  --typeface: "GT-America-Standard-Regular";
@@ -45,40 +51,41 @@ input {
45
51
  --typeface-compressed: "GT-America-Compressed-Regular";
46
52
  --typeface-japanese: "Noto Sans JP";
47
53
  --typeface-mono: "Iosevka";
48
- --type-size-default: calc(14px * var(--scaling-factor));
49
- --type-size-small: calc(10px * var(--scaling-factor));
54
+
55
+
56
+ --type-size-default: calc(14px * var(--sf));
57
+ --type-size-small: calc(10px * var(--sf));
50
58
  --type-weight-default: 500;
51
- --type-lineheight-default: calc(15px * var(--scaling-factor));
52
- --type-size-heading: calc(15px * var(--scaling-factor));
59
+ --type-lineheight-default: calc(15px * var(--sf));
60
+ --type-size-heading: calc(15px * var(--sf));
53
61
  --type-weight-bold: 500;
54
62
 
55
- --type-size-japanese-default: calc(12px * var(--scaling-factor));
56
- --type-size-japanese-heading: calc(14px * var(--scaling-factor));
57
- --type-lineheight-japanese-default: calc(17px * var(--scaling-factor));
63
+ --type-size-japanese-default: calc(12px * var(--sf));
64
+ --type-size-japanese-heading: calc(14px * var(--sf));
65
+ --type-lineheight-japanese-default: calc(17px * var(--sf));
58
66
  --type-weight-product: var(--type-weight-bold);
59
67
  --type-weight-heading: var(--type-weight-bold);
60
68
  --type-size-book: 9px;
61
69
  --type-weight-book: 400;
62
70
  --type-lineheight-book: 15px;
63
71
 
64
- /* ezo-scaling-factor */
65
- --scaling-factor: var(--scaling-factor-mobile);
66
- --scaling-factor-mobile: 1;
67
-
68
72
  /* size */
69
73
  --outline-stroke: 1px solid light-dark(var(--black), var(--slate-dark));
70
- --outline-stroke-mobile: calc(1px * var(--scaling-factor)) solid
74
+ --outline-stroke-mobile: calc(1px * var(--sf)) solid
71
75
  light-dark(var(--black), var(--slate-dark));
72
- --item-width: calc(79px * var(--scaling-factor));
73
- --item-height: calc(19px * var(--scaling-factor));
74
- --margin-correction: calc(1px * var(--scaling-factor));
76
+ --item-width: calc(79px * var(--sf));
77
+ --item-height: calc(19px * var(--sf));
78
+ --margin-correction: calc(1px * var(--sf));
75
79
 
76
80
  /* sizes */
77
81
 
82
+ --gridrcolor: light-dark(var(--slate), var(--slate-dark));
83
+
78
84
  /* main unit */
79
85
  --1: 20px;
80
86
  /* bigger sizes */
81
87
  --2: calc(var(--1) * 2);
88
+ --3: calc(var(--1) * 3);
82
89
  --4: calc(var(--1) * 4);
83
90
 
84
91
  /* smaller sizes */
@@ -86,7 +93,7 @@ input {
86
93
  --025: calc(var(--1) * 0.25);
87
94
  --08: calc(var(--1) * 0.8);
88
95
 
89
- /* ezo-button */
96
+ /* button */
90
97
  --button-background-color-primary: var(--accent-color);
91
98
  --button-background-color-secondary: light-dark(
92
99
  var(--slate-light),
@@ -98,11 +105,11 @@ input {
98
105
  var(--slate-light)
99
106
  );
100
107
 
101
- /* ezo-text-color */
108
+ /* text-color */
102
109
  --text-color-primary: light-dark(var(--black), var(--white));
103
110
  --text-color-dimmed: light-dark(var(--slate), var(--slate-light));
104
111
 
105
- /* ezo-icon */
112
+ /* icon colors */
106
113
  --icon-background: light-dark(var(--slate-light), var(--slate-dark));
107
114
  --icon-color: light-dark(var(--black), var(--white));
108
115
 
@@ -137,7 +144,6 @@ input {
137
144
  navigation: auto;
138
145
  }
139
146
 
140
-
141
147
  @font-face {
142
148
  font-family: GT-America-Standard-Regular;
143
149
  src: url("./fonts/GT-America-Standard-Regular.woff2") format("woff2");
@@ -163,15 +169,15 @@ body {
163
169
 
164
170
  .matrix__board {
165
171
  position: relative;
166
- top: calc(21.5px * var(--scaling-factor));
167
- left: calc(-20px * var(--scaling-factor));
172
+ top: calc(21.5px * var(--sf));
173
+ left: calc(-20px * var(--sf));
174
+ width: calc(240px * var(--sf));
168
175
  display: flex;
169
- width: calc(240px * var(--scaling-factor));
170
176
  }
171
177
 
172
178
  .matrix__board--vertical {
173
179
  position: relative;
174
- left: calc(20.5px * var(--scaling-factor));
180
+ left: calc(20.5px * var(--sf));
175
181
  display: flex;
176
182
  flex-direction: row;
177
183
  align-items: start;
@@ -179,8 +185,8 @@ body {
179
185
 
180
186
  .matrix__board--horizontal {
181
187
  position: relative;
182
- top: calc(19.5px * var(--scaling-factor));
183
- left: calc(-239.5px * var(--scaling-factor));
188
+ top: calc(19.5px * var(--sf));
189
+ left: calc(-239.5px * var(--sf));
184
190
  display: flex;
185
191
  flex-direction: column;
186
192
  align-items: start;
@@ -210,11 +216,11 @@ body {
210
216
 
211
217
  .matrix__row-header {
212
218
  position: relative;
213
- top: calc(0.5px * var(--scaling-factor));
219
+ top: calc(0.5px * var(--sf));
214
220
  display: flex;
215
221
  align-items: center;
216
222
  justify-content: center;
217
- width: calc(19px * var(--scaling-factor));
223
+ width: calc(19px * var(--sf));
218
224
  height: var(--item-height);
219
225
  margin-right: var(--margin-correction);
220
226
  margin-bottom: var(--margin-correction);
@@ -266,13 +272,13 @@ body {
266
272
 
267
273
  .board__container {
268
274
  position: relative;
269
- top: calc(0.5px * var(--scaling-factor));
275
+ top: calc(0.5px * var(--sf));
270
276
  }
271
277
 
272
278
  .board {
273
279
  position: relative;
274
- top: calc(0.5px * var(--scaling-factor));
275
- left: calc(0.5px * var(--scaling-factor));
280
+ top: calc(0.5px * var(--sf));
281
+ left: calc(0.5px * var(--sf));
276
282
  display: flex;
277
283
  flex-direction: row;
278
284
  align-items: flex-start;
@@ -337,14 +343,13 @@ body {
337
343
  .header {
338
344
  display: flex;
339
345
  justify-content: center;
340
- width: calc(var(--item-width) * var(--scaling-factor));
341
- height: calc(var(--item-height) * var(--scaling-factor));
346
+ width: calc(var(--item-width) * var(--sf));
347
+ height: calc(var(--item-height) * var(--sf));
342
348
  }
343
349
 
344
350
  .header.dragging {
345
- outline: calc(var(--outline-stroke) * var(--scaling-factor)) solid
346
- var(--black);
347
- outline-offset: calc(var(--outline-stroke-offset) * var(--scaling-factor));
351
+ outline: calc(var(--outline-stroke) * var(--sf)) solid var(--black);
352
+ outline-offset: calc(var(--outline-stroke-offset) * var(--sf));
348
353
  background-color: var(--white);
349
354
  }
350
355
 
@@ -380,7 +385,7 @@ body {
380
385
  margin-top: 1px;
381
386
  z-index: 99;
382
387
  margin-bottom: 2px;
383
- padding-left: calc(3px * var(--scaling-factor));
388
+ padding-left: calc(3px * var(--sf));
384
389
  color: var(--text-color-primary);
385
390
  outline: var(--outline-stroke);
386
391
  background-color: var(--accent-color);
@@ -396,7 +401,7 @@ body {
396
401
  }
397
402
 
398
403
  .item-container.mobile {
399
- margin-left: calc(0.25px * var(--scaling-factor));
404
+ margin-left: calc(0.25px * var(--sf));
400
405
  }
401
406
 
402
407
  .group-children {
@@ -415,7 +420,7 @@ body {
415
420
  align-items: center;
416
421
  justify-content: start;
417
422
  width: var(--item-width);
418
- padding-left: calc(5px * var(--scaling-factor));
423
+ padding-left: calc(5px * var(--sf));
419
424
  overflow: hidden;
420
425
  text-overflow: ellipsis;
421
426
  white-space: nowrap;
@@ -442,5 +447,3 @@ tr {
442
447
  td {
443
448
  text-align: left;
444
449
  }
445
-
446
-
@@ -12,6 +12,7 @@ import type { ThemeType } from "../0-face/theme";
12
12
  import { savePreferences } from "../0-face/preferences";
13
13
  import "./ds-button";
14
14
  import "./ds-icon";
15
+ import "./ds-text";
15
16
 
16
17
  // Accent color utilities
17
18
  const saveAccentColor = (color: string) => {
@@ -641,7 +642,19 @@ export class Cycle extends LitElement {
641
642
  return html`
642
643
  <div class="cycle-container">
643
644
  ${this.type !== "icon-only"
644
- ? html`<span class="cycle-label">${this.label}</span>`
645
+ ? html`${this.type === "language"
646
+ ? html`<ds-text
647
+ key="language"
648
+ default-value="Language"
649
+ class="cycle-label"
650
+ ></ds-text>`
651
+ : this.type === "theme"
652
+ ? html`<ds-text
653
+ key="theme"
654
+ default-value="Theme"
655
+ class="cycle-label"
656
+ ></ds-text>`
657
+ : html`<span class="cycle-label">${this.label}</span>`}`
645
658
  : ""}
646
659
  <div
647
660
  style="display: flex; align-items: center; ${this.type === "icon-only"
@@ -26,8 +26,8 @@ export class Icon extends LitElement {
26
26
  display: inline-flex;
27
27
  justify-content: center;
28
28
  align-items: center;
29
- width: calc(16px * var(--scaling-factor));
30
- height: calc(16px * var(--scaling-factor));
29
+ width: calc(16px * var(--sf));
30
+ height: calc(16px * var(--sf));
31
31
  }
32
32
 
33
33
  svg {
@@ -44,8 +44,8 @@ export class Icon extends LitElement {
44
44
  display: flex;
45
45
  justify-content: center;
46
46
  align-items: center;
47
- width: calc(16px * var(--scaling-factor));
48
- height: calc(16px * var(--scaling-factor));
47
+ width: calc(16px * var(--sf));
48
+ height: calc(16px * var(--sf));
49
49
  }
50
50
 
51
51
  /* Notes style color variable for future implementation */
@@ -44,10 +44,16 @@ export class Text extends LitElement {
44
44
  static styles = css`
45
45
  :host {
46
46
  display: inline;
47
- }
48
-
49
- .loading {
50
- opacity: 0.6;
47
+ font-family: var(--typeface);
48
+ font-size: calc(var(--type-size-default) * var(--scaling-factor));
49
+ font-weight: var(--type-weight-default);
50
+ line-height: calc(var(--type-lineheight-default) * var(--scaling-factor));
51
+ letter-spacing: calc(
52
+ var(--type-letterspacing-default) * var(--scaling-factor)
53
+ );
54
+ text-align: var(--text-align-default);
55
+ text-transform: var(--text-transform-default);
56
+ text-decoration: var(--text-decoration-default);
51
57
  }
52
58
  `;
53
59
 
@@ -79,10 +79,10 @@ export class Tooltip extends LitElement {
79
79
  position: absolute;
80
80
  left: 50%;
81
81
  bottom: 100%;
82
- transform: translate(-50%, calc(-2px * var(--scaling-factor)));
82
+ transform: translate(-50%, calc(-2px * var(--sf)));
83
83
  z-index: 1000;
84
84
  pointer-events: none;
85
- height: calc(var(--08) * var(--scaling-factor));
85
+ height: calc(var(--08) * var(--sf));
86
86
  opacity: 0;
87
87
  transition:
88
88
  opacity 120ms ease,
@@ -91,7 +91,7 @@ export class Tooltip extends LitElement {
91
91
  color: light-dark(var(--white), var(--black));
92
92
  border-radius: 0;
93
93
  font-size: var(--type-size-default);
94
- padding: 0px calc(1px * var(--scaling-factor));
94
+ padding: 0px calc(1px * var(--sf));
95
95
  font-family: var(
96
96
  --typeface,
97
97
  -apple-system,
@@ -27,15 +27,15 @@ export class PortfolioSingleNav extends LitElement {
27
27
  :host {
28
28
  display: flex;
29
29
  justify-content: end;
30
- gap: calc(5px * var(--scaling-factor));
31
- padding: calc(2px * var(--scaling-factor));
30
+ gap: calc(5px * var(--sf));
31
+ padding: calc(2px * var(--sf));
32
32
  align-items: center;
33
33
  }
34
34
 
35
35
  a {
36
36
  display: inline-flex;
37
37
  align-items: center;
38
- gap: calc(5px * var(--scaling-factor));
38
+ gap: calc(5px * var(--sf));
39
39
  text-decoration: none;
40
40
  color: inherit;
41
41
  }
@@ -76,4 +76,3 @@ declare global {
76
76
  "portfolio-singlenav": PortfolioSingleNav;
77
77
  }
78
78
  }
79
-
@@ -23,18 +23,18 @@ export class Row extends LitElement {
23
23
  :host {
24
24
  display: flex;
25
25
  align-items: end;
26
- width: calc(240px * var(--scaling-factor));
26
+ width: calc(240px * var(--sf));
27
27
  }
28
28
 
29
29
  :host([type="fill"]) {
30
30
  justify-content: space-between;
31
- height: calc(var(--1) * var(--scaling-factor));
31
+ height: calc(var(--1) * var(--sf));
32
32
  }
33
33
 
34
34
  :host([type="centered"]) {
35
35
  justify-content: center;
36
- height: calc(var(--1) * var(--scaling-factor));
37
- gap: calc(var(--025) * var(--scaling-factor));
36
+ height: calc(var(--1) * var(--sf));
37
+ gap: calc(var(--025) * var(--sf));
38
38
  }
39
39
  `;
40
40
 
@@ -50,4 +50,3 @@ declare global {
50
50
  "ds-row": Row;
51
51
  }
52
52
  }
53
-
@@ -2,7 +2,6 @@
2
2
  // Simple grid layout component
3
3
 
4
4
  import { LitElement, html, css } from "lit";
5
- import { detectMobileDevice } from "../0-face/device";
6
5
 
7
6
  declare global {
8
7
  interface CustomElementRegistry {
@@ -14,44 +13,9 @@ declare global {
14
13
  export class Grid extends LitElement {
15
14
  static properties = {
16
15
  align: { type: String },
17
- _isMobile: { type: Boolean, state: true },
18
16
  };
19
17
 
20
18
  align?: string;
21
- _isMobile: boolean = false;
22
-
23
- connectedCallback() {
24
- super.connectedCallback();
25
- this._isMobile = detectMobileDevice();
26
- console.log(`[ds-grid] Mobile device: ${this._isMobile}`);
27
-
28
- // Apply mobile class immediately
29
- if (this._isMobile) {
30
- this.classList.add("mobile");
31
- console.log(`[ds-grid] Mobile class added`);
32
- }
33
-
34
- // Calculate mobile grid dimensions to fit screen
35
- if (this._isMobile && typeof window !== "undefined") {
36
- const screenWidth = window.innerWidth;
37
- const columns = 14;
38
- const gap = 0.5;
39
-
40
- // Calculate column size accounting for gaps between columns
41
- // Total width = (columns * columnSize) + ((columns - 1) * gap)
42
- // Therefore: columnSize = (screenWidth - ((columns - 1) * gap)) / columns
43
- const totalGapWidth = (columns - 1) * gap;
44
- const columnSize = (screenWidth - totalGapWidth) / columns;
45
-
46
- console.log(
47
- `[ds-grid] Mobile grid: ${columns} columns × ${columnSize.toFixed(2)}px + ${totalGapWidth}px gaps = ${screenWidth}px`
48
- );
49
-
50
- // Set custom property for this grid instance
51
- this.style.setProperty("--mobile-column-size", `${columnSize}px`);
52
- this.style.setProperty("--mobile-gap", `${gap}px`);
53
- }
54
- }
55
19
 
56
20
  static styles = css`
57
21
  :host {
@@ -59,17 +23,13 @@ export class Grid extends LitElement {
59
23
  margin-left: 0.5px !important;
60
24
  display: grid;
61
25
  width: 1440px;
62
- height: 100%;
26
+ height: 360px;
63
27
  grid-template-columns: repeat(auto-fill, 19px);
64
28
  grid-template-rows: repeat(auto-fill, 19px);
65
29
  gap: 1px;
66
- row-rule: calc(1px * var(--scaling-factor)) solid
67
- light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
68
- column-rule: calc(1px * var(--scaling-factor)) solid
69
- light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
70
- outline:
71
- 1px solid light-dark(rgb(147, 147, 147)),
72
- rgb(147, 147, 147);
30
+ row-rule: calc(1px * var(--sf)) solid var(--grid-color);
31
+ column-rule: calc(1px * var(--sf)) solid var(--grid-color);
32
+ outline: 1px solid black;
73
33
  position: fixed;
74
34
  top: 0;
75
35
  left: 50%;
@@ -80,21 +40,20 @@ export class Grid extends LitElement {
80
40
 
81
41
  /* DO NOT CHANGE THIS GRID CODE FOR MOBILE. ITS PERFECT FOR MOBILE. */
82
42
  :host(.mobile) {
83
- outline: calc(2px * var(--scaling-factor)) solid rgba(251, 255, 0, 0.9);
84
- width: calc(100% - calc(1px * var(--scaling-factor)));
43
+ width: calc(100% - calc(1px * var(--sf)));
85
44
  max-width: 100vw;
86
45
  margin-left: 0 !important;
87
46
  margin-top: 0 !important;
88
47
  box-sizing: border-box;
89
48
  position: fixed;
90
- top: calc(0.5px * var(--scaling-factor));
49
+ top: calc(0.5px * var(--sf));
91
50
  left: 50%;
92
51
  transform: translateX(-50%);
93
52
  pointer-events: none;
94
53
  z-index: 300;
95
- gap: calc(1px * var(--scaling-factor));
96
- grid-template-columns: repeat(14, calc(19px * var(--scaling-factor)));
97
- grid-template-rows: repeat(auto-fill, calc(19px * var(--scaling-factor)));
54
+ gap: calc(1px * var(--sf));
55
+ grid-template-columns: repeat(14, calc(19px * var(--sf)));
56
+ grid-template-rows: repeat(auto-fill, calc(19px * var(--sf)));
98
57
  }
99
58
 
100
59
  :host([align="left"]) {
@@ -114,15 +73,6 @@ export class Grid extends LitElement {
114
73
  }
115
74
  `;
116
75
 
117
- updated() {
118
- // Apply mobile class if detected as mobile device
119
- if (this._isMobile) {
120
- this.classList.add("mobile");
121
- } else {
122
- this.classList.remove("mobile");
123
- }
124
- }
125
-
126
76
  render() {
127
77
  return html``;
128
78
  }