ds-one 0.2.5-alpha.3 → 0.2.5-alpha.5

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
 
@@ -1,4 +1,4 @@
1
- /* version 0.2.5-alpha.3 */
1
+ /* version 0.2.5-alpha.5 */
2
2
 
3
3
  input {
4
4
  padding: 0;
@@ -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,40 @@ 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
+ --type-size-default: calc(14px * var(--sf));
56
+ --type-size-small: calc(10px * var(--sf));
50
57
  --type-weight-default: 500;
51
- --type-lineheight-default: calc(15px * var(--scaling-factor));
52
- --type-size-heading: calc(15px * var(--scaling-factor));
58
+ --type-lineheight-default: calc(15px * var(--sf));
59
+ --type-size-heading: calc(15px * var(--sf));
53
60
  --type-weight-bold: 500;
54
61
 
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));
62
+ --type-size-japanese-default: calc(12px * var(--sf));
63
+ --type-size-japanese-heading: calc(14px * var(--sf));
64
+ --type-lineheight-japanese-default: calc(17px * var(--sf));
58
65
  --type-weight-product: var(--type-weight-bold);
59
66
  --type-weight-heading: var(--type-weight-bold);
60
67
  --type-size-book: 9px;
61
68
  --type-weight-book: 400;
62
69
  --type-lineheight-book: 15px;
63
70
 
64
- /* ezo-scaling-factor */
65
- --scaling-factor: var(--scaling-factor-mobile);
66
- --scaling-factor-mobile: 1;
67
-
68
71
  /* size */
69
72
  --outline-stroke: 1px solid light-dark(var(--black), var(--slate-dark));
70
- --outline-stroke-mobile: calc(1px * var(--scaling-factor)) solid
73
+ --outline-stroke-mobile: calc(1px * var(--sf)) solid
71
74
  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));
75
+ --item-width: calc(79px * var(--sf));
76
+ --item-height: calc(19px * var(--sf));
77
+ --margin-correction: calc(1px * var(--sf));
75
78
 
76
79
  /* sizes */
77
80
 
81
+ --gridrcolor: light-dark(var(--slate), var(--slate-dark));
82
+
78
83
  /* main unit */
79
84
  --1: 20px;
80
85
  /* bigger sizes */
81
86
  --2: calc(var(--1) * 2);
87
+ --3: calc(var(--1) * 3);
82
88
  --4: calc(var(--1) * 4);
83
89
 
84
90
  /* smaller sizes */
@@ -86,7 +92,7 @@ input {
86
92
  --025: calc(var(--1) * 0.25);
87
93
  --08: calc(var(--1) * 0.8);
88
94
 
89
- /* ezo-button */
95
+ /* button */
90
96
  --button-background-color-primary: var(--accent-color);
91
97
  --button-background-color-secondary: light-dark(
92
98
  var(--slate-light),
@@ -98,11 +104,11 @@ input {
98
104
  var(--slate-light)
99
105
  );
100
106
 
101
- /* ezo-text-color */
107
+ /* text-color */
102
108
  --text-color-primary: light-dark(var(--black), var(--white));
103
109
  --text-color-dimmed: light-dark(var(--slate), var(--slate-light));
104
110
 
105
- /* ezo-icon */
111
+ /* icon colors */
106
112
  --icon-background: light-dark(var(--slate-light), var(--slate-dark));
107
113
  --icon-color: light-dark(var(--black), var(--white));
108
114
 
@@ -137,7 +143,6 @@ input {
137
143
  navigation: auto;
138
144
  }
139
145
 
140
-
141
146
  @font-face {
142
147
  font-family: GT-America-Standard-Regular;
143
148
  src: url("./fonts/GT-America-Standard-Regular.woff2") format("woff2");
@@ -163,15 +168,15 @@ body {
163
168
 
164
169
  .matrix__board {
165
170
  position: relative;
166
- top: calc(21.5px * var(--scaling-factor));
167
- left: calc(-20px * var(--scaling-factor));
171
+ top: calc(21.5px * var(--sf));
172
+ left: calc(-20px * var(--sf));
173
+ width: calc(240px * var(--sf));
168
174
  display: flex;
169
- width: calc(240px * var(--scaling-factor));
170
175
  }
171
176
 
172
177
  .matrix__board--vertical {
173
178
  position: relative;
174
- left: calc(20.5px * var(--scaling-factor));
179
+ left: calc(20.5px * var(--sf));
175
180
  display: flex;
176
181
  flex-direction: row;
177
182
  align-items: start;
@@ -179,8 +184,8 @@ body {
179
184
 
180
185
  .matrix__board--horizontal {
181
186
  position: relative;
182
- top: calc(19.5px * var(--scaling-factor));
183
- left: calc(-239.5px * var(--scaling-factor));
187
+ top: calc(19.5px * var(--sf));
188
+ left: calc(-239.5px * var(--sf));
184
189
  display: flex;
185
190
  flex-direction: column;
186
191
  align-items: start;
@@ -210,11 +215,11 @@ body {
210
215
 
211
216
  .matrix__row-header {
212
217
  position: relative;
213
- top: calc(0.5px * var(--scaling-factor));
218
+ top: calc(0.5px * var(--sf));
214
219
  display: flex;
215
220
  align-items: center;
216
221
  justify-content: center;
217
- width: calc(19px * var(--scaling-factor));
222
+ width: calc(19px * var(--sf));
218
223
  height: var(--item-height);
219
224
  margin-right: var(--margin-correction);
220
225
  margin-bottom: var(--margin-correction);
@@ -266,13 +271,13 @@ body {
266
271
 
267
272
  .board__container {
268
273
  position: relative;
269
- top: calc(0.5px * var(--scaling-factor));
274
+ top: calc(0.5px * var(--sf));
270
275
  }
271
276
 
272
277
  .board {
273
278
  position: relative;
274
- top: calc(0.5px * var(--scaling-factor));
275
- left: calc(0.5px * var(--scaling-factor));
279
+ top: calc(0.5px * var(--sf));
280
+ left: calc(0.5px * var(--sf));
276
281
  display: flex;
277
282
  flex-direction: row;
278
283
  align-items: flex-start;
@@ -337,14 +342,13 @@ body {
337
342
  .header {
338
343
  display: flex;
339
344
  justify-content: center;
340
- width: calc(var(--item-width) * var(--scaling-factor));
341
- height: calc(var(--item-height) * var(--scaling-factor));
345
+ width: calc(var(--item-width) * var(--sf));
346
+ height: calc(var(--item-height) * var(--sf));
342
347
  }
343
348
 
344
349
  .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));
350
+ outline: calc(var(--outline-stroke) * var(--sf)) solid var(--black);
351
+ outline-offset: calc(var(--outline-stroke-offset) * var(--sf));
348
352
  background-color: var(--white);
349
353
  }
350
354
 
@@ -380,7 +384,7 @@ body {
380
384
  margin-top: 1px;
381
385
  z-index: 99;
382
386
  margin-bottom: 2px;
383
- padding-left: calc(3px * var(--scaling-factor));
387
+ padding-left: calc(3px * var(--sf));
384
388
  color: var(--text-color-primary);
385
389
  outline: var(--outline-stroke);
386
390
  background-color: var(--accent-color);
@@ -396,7 +400,7 @@ body {
396
400
  }
397
401
 
398
402
  .item-container.mobile {
399
- margin-left: calc(0.25px * var(--scaling-factor));
403
+ margin-left: calc(0.25px * var(--sf));
400
404
  }
401
405
 
402
406
  .group-children {
@@ -415,7 +419,7 @@ body {
415
419
  align-items: center;
416
420
  justify-content: start;
417
421
  width: var(--item-width);
418
- padding-left: calc(5px * var(--scaling-factor));
422
+ padding-left: calc(5px * var(--sf));
419
423
  overflow: hidden;
420
424
  text-overflow: ellipsis;
421
425
  white-space: nowrap;
@@ -442,5 +446,3 @@ tr {
442
446
  td {
443
447
  text-align: left;
444
448
  }
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
  }