ds-one 0.1.11-alpha.10 → 0.1.11-alpha.11
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.
- package/DS1/0-face/2025-04-23-device.ts +21 -3
- package/DS1/1-root/one.css +6 -1
- package/DS1/4-page/ds-grid.ts +67 -14
- package/README.md +1 -1
- package/dist/0-face/2025-04-23-device.d.ts.map +1 -1
- package/dist/0-face/2025-04-23-device.js +13 -3
- package/dist/4-page/ds-grid.d.ts +7 -0
- package/dist/4-page/ds-grid.d.ts.map +1 -1
- package/dist/4-page/ds-grid.js +62 -14
- package/dist/ds-one.bundle.js +63 -17
- package/dist/ds-one.bundle.js.map +2 -2
- package/dist/ds-one.bundle.min.js +35 -27
- package/dist/ds-one.bundle.min.js.map +3 -3
- package/package.json +1 -1
|
@@ -79,12 +79,30 @@ export function getDeviceInfo(): DeviceInfo {
|
|
|
79
79
|
export function initDeviceDetection(): DeviceInfo {
|
|
80
80
|
const deviceInfo = getDeviceInfo();
|
|
81
81
|
|
|
82
|
-
//
|
|
83
|
-
if (deviceInfo.isMobile) {
|
|
82
|
+
// Calculate and set scaling factor for mobile
|
|
83
|
+
if (deviceInfo.isMobile && typeof document !== "undefined") {
|
|
84
|
+
// Design width: 280px (14 columns × 20px)
|
|
85
|
+
const designWidth = 280;
|
|
86
|
+
const actualWidth = deviceInfo.screenWidth;
|
|
87
|
+
const scalingFactor = actualWidth / designWidth;
|
|
88
|
+
|
|
89
|
+
// Set CSS custom property for scaling
|
|
90
|
+
document.documentElement.style.setProperty(
|
|
91
|
+
"--scaling-factor-mobile",
|
|
92
|
+
scalingFactor.toFixed(3)
|
|
93
|
+
);
|
|
94
|
+
|
|
84
95
|
console.log(
|
|
85
|
-
`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`
|
|
96
|
+
`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight}), scaling factor: ${scalingFactor.toFixed(2)}`
|
|
86
97
|
);
|
|
87
98
|
} else {
|
|
99
|
+
// Desktop - no scaling
|
|
100
|
+
if (typeof document !== "undefined") {
|
|
101
|
+
document.documentElement.style.setProperty(
|
|
102
|
+
"--scaling-factor-mobile",
|
|
103
|
+
"1"
|
|
104
|
+
);
|
|
105
|
+
}
|
|
88
106
|
console.log(
|
|
89
107
|
`[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`
|
|
90
108
|
);
|
package/DS1/1-root/one.css
CHANGED
|
@@ -57,7 +57,7 @@ input {
|
|
|
57
57
|
--type-lineheight-book: 15px;
|
|
58
58
|
|
|
59
59
|
/* ezo-scaling-factor */
|
|
60
|
-
--scaling-factor:
|
|
60
|
+
--scaling-factor: var(--scaling-factor-mobile);
|
|
61
61
|
--scaling-factor-mobile: 1;
|
|
62
62
|
|
|
63
63
|
/* size */
|
|
@@ -158,6 +158,11 @@ html {
|
|
|
158
158
|
font-display: swap;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
body {
|
|
162
|
+
margin: 0;
|
|
163
|
+
padding: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
161
166
|
.matrix__board {
|
|
162
167
|
position: relative;
|
|
163
168
|
top: calc(21.5px * var(--scaling-factor));
|
package/DS1/4-page/ds-grid.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Simple grid layout component
|
|
3
3
|
|
|
4
4
|
import { LitElement, html, css } from "lit";
|
|
5
|
+
import { detectMobileDevice } from "../0-face/2025-04-23-device";
|
|
5
6
|
|
|
6
7
|
declare global {
|
|
7
8
|
interface CustomElementRegistry {
|
|
@@ -13,9 +14,44 @@ declare global {
|
|
|
13
14
|
export class Grid extends LitElement {
|
|
14
15
|
static properties = {
|
|
15
16
|
align: { type: String },
|
|
17
|
+
_isMobile: { type: Boolean, state: true },
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
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
|
+
}
|
|
19
55
|
|
|
20
56
|
static styles = css`
|
|
21
57
|
:host {
|
|
@@ -27,11 +63,11 @@ export class Grid extends LitElement {
|
|
|
27
63
|
grid-template-columns: repeat(auto-fill, 19px);
|
|
28
64
|
grid-template-rows: repeat(auto-fill, 19px);
|
|
29
65
|
gap: 1px;
|
|
30
|
-
row-rule: 1px solid
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
light-dark(
|
|
34
|
-
|
|
66
|
+
row-rule: 1px solid light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
|
|
67
|
+
column-rule: 1px solid light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
|
|
68
|
+
outline:
|
|
69
|
+
1px solid light-dark(rgb(147, 147, 147)),
|
|
70
|
+
rgb(147, 147, 147);
|
|
35
71
|
position: fixed;
|
|
36
72
|
top: 0;
|
|
37
73
|
left: 50%;
|
|
@@ -40,15 +76,23 @@ export class Grid extends LitElement {
|
|
|
40
76
|
z-index: 300;
|
|
41
77
|
}
|
|
42
78
|
|
|
43
|
-
/*
|
|
44
|
-
|
|
45
|
-
:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
79
|
+
/* DO NOT CHANGE THIS GRID CODE FOR MOBILE. ITS PERFECT FOR MOBILE. */
|
|
80
|
+
:host(.mobile) {
|
|
81
|
+
outline: calc(2px * var(--scaling-factor)) solid rgba(251, 255, 0, 0.9);
|
|
82
|
+
width: calc(100% - calc(1px * var(--scaling-factor)));
|
|
83
|
+
max-width: 100vw;
|
|
84
|
+
margin-left: 0 !important;
|
|
85
|
+
margin-top: 0 !important;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
position: fixed;
|
|
88
|
+
top: calc(0.5px * var(--scaling-factor));
|
|
89
|
+
left: 50%;
|
|
90
|
+
transform: translateX(-50%);
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
z-index: 300;
|
|
93
|
+
gap: calc(1px * var(--scaling-factor));
|
|
94
|
+
grid-template-columns: repeat(14, calc(19px * var(--scaling-factor)));
|
|
95
|
+
grid-template-rows: repeat(auto-fill, calc(19px * var(--scaling-factor)));
|
|
52
96
|
}
|
|
53
97
|
|
|
54
98
|
:host([align="left"]) {
|
|
@@ -68,6 +112,15 @@ export class Grid extends LitElement {
|
|
|
68
112
|
}
|
|
69
113
|
`;
|
|
70
114
|
|
|
115
|
+
updated() {
|
|
116
|
+
// Apply mobile class if detected as mobile device
|
|
117
|
+
if (this._isMobile) {
|
|
118
|
+
this.classList.add("mobile");
|
|
119
|
+
} else {
|
|
120
|
+
this.classList.remove("mobile");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
71
124
|
render() {
|
|
72
125
|
return html``;
|
|
73
126
|
}
|
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.
|
|
30
|
+
**Note**: Currently published as alpha version `0.1.11-alpha.11`. Use `@alpha` tag to install.
|
|
31
31
|
|
|
32
32
|
### Basic Usage
|
|
33
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2025-04-23-device.d.ts","sourceRoot":"","sources":["../../DS1/0-face/2025-04-23-device.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CA0B5C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAsB1C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,UAAU,
|
|
1
|
+
{"version":3,"file":"2025-04-23-device.d.ts","sourceRoot":"","sources":["../../DS1/0-face/2025-04-23-device.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CA0B5C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAsB1C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,UAAU,CA8ChD"}
|
|
@@ -50,11 +50,21 @@ export function getDeviceInfo() {
|
|
|
50
50
|
*/
|
|
51
51
|
export function initDeviceDetection() {
|
|
52
52
|
const deviceInfo = getDeviceInfo();
|
|
53
|
-
//
|
|
54
|
-
if (deviceInfo.isMobile) {
|
|
55
|
-
|
|
53
|
+
// Calculate and set scaling factor for mobile
|
|
54
|
+
if (deviceInfo.isMobile && typeof document !== "undefined") {
|
|
55
|
+
// Design width: 280px (14 columns × 20px)
|
|
56
|
+
const designWidth = 280;
|
|
57
|
+
const actualWidth = deviceInfo.screenWidth;
|
|
58
|
+
const scalingFactor = actualWidth / designWidth;
|
|
59
|
+
// Set CSS custom property for scaling
|
|
60
|
+
document.documentElement.style.setProperty("--scaling-factor-mobile", scalingFactor.toFixed(3));
|
|
61
|
+
console.log(`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight}), scaling factor: ${scalingFactor.toFixed(2)}`);
|
|
56
62
|
}
|
|
57
63
|
else {
|
|
64
|
+
// Desktop - no scaling
|
|
65
|
+
if (typeof document !== "undefined") {
|
|
66
|
+
document.documentElement.style.setProperty("--scaling-factor-mobile", "1");
|
|
67
|
+
}
|
|
58
68
|
console.log(`[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`);
|
|
59
69
|
}
|
|
60
70
|
// Log additional details in development mode
|
package/dist/4-page/ds-grid.d.ts
CHANGED
|
@@ -10,9 +10,16 @@ export declare class Grid extends LitElement {
|
|
|
10
10
|
align: {
|
|
11
11
|
type: StringConstructor;
|
|
12
12
|
};
|
|
13
|
+
_isMobile: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
state: boolean;
|
|
16
|
+
};
|
|
13
17
|
};
|
|
14
18
|
align?: string;
|
|
19
|
+
_isMobile: boolean;
|
|
20
|
+
connectedCallback(): void;
|
|
15
21
|
static styles: import("lit").CSSResult;
|
|
22
|
+
updated(): void;
|
|
16
23
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
24
|
}
|
|
18
25
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds-grid.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-grid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ds-grid.d.ts","sourceRoot":"","sources":["../../DS1/4-page/ds-grid.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,UAAU,GAAG,IAAI,CAAC;KAC5D;IACD,IAAI,cAAc,EAAE,qBAAqB,CAAC;CAC3C;AAED,qBAAa,IAAK,SAAQ,UAAU;IAClC,MAAM,CAAC,UAAU;;;;;;;;MAGf;IAEF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAS;IAE3B,iBAAiB;IAiCjB,MAAM,CAAC,MAAM,0BAyDX;IAEF,OAAO;IASP,MAAM;CAGP;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAC;KACjB;CACF"}
|
package/dist/4-page/ds-grid.js
CHANGED
|
@@ -1,13 +1,53 @@
|
|
|
1
1
|
// ds-grid.ts
|
|
2
2
|
// Simple grid layout component
|
|
3
3
|
import { LitElement, html, css } from "lit";
|
|
4
|
+
import { detectMobileDevice } from "../0-face/2025-04-23-device";
|
|
4
5
|
export class Grid extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this._isMobile = false;
|
|
9
|
+
}
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
super.connectedCallback();
|
|
12
|
+
this._isMobile = detectMobileDevice();
|
|
13
|
+
console.log(`[ds-grid] Mobile device: ${this._isMobile}`);
|
|
14
|
+
// Apply mobile class immediately
|
|
15
|
+
if (this._isMobile) {
|
|
16
|
+
this.classList.add("mobile");
|
|
17
|
+
console.log(`[ds-grid] Mobile class added`);
|
|
18
|
+
}
|
|
19
|
+
// Calculate mobile grid dimensions to fit screen
|
|
20
|
+
if (this._isMobile && typeof window !== "undefined") {
|
|
21
|
+
const screenWidth = window.innerWidth;
|
|
22
|
+
const columns = 14;
|
|
23
|
+
const gap = 0.5;
|
|
24
|
+
// Calculate column size accounting for gaps between columns
|
|
25
|
+
// Total width = (columns * columnSize) + ((columns - 1) * gap)
|
|
26
|
+
// Therefore: columnSize = (screenWidth - ((columns - 1) * gap)) / columns
|
|
27
|
+
const totalGapWidth = (columns - 1) * gap;
|
|
28
|
+
const columnSize = (screenWidth - totalGapWidth) / columns;
|
|
29
|
+
console.log(`[ds-grid] Mobile grid: ${columns} columns × ${columnSize.toFixed(2)}px + ${totalGapWidth}px gaps = ${screenWidth}px`);
|
|
30
|
+
// Set custom property for this grid instance
|
|
31
|
+
this.style.setProperty("--mobile-column-size", `${columnSize}px`);
|
|
32
|
+
this.style.setProperty("--mobile-gap", `${gap}px`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
updated() {
|
|
36
|
+
// Apply mobile class if detected as mobile device
|
|
37
|
+
if (this._isMobile) {
|
|
38
|
+
this.classList.add("mobile");
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.classList.remove("mobile");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
5
44
|
render() {
|
|
6
45
|
return html ``;
|
|
7
46
|
}
|
|
8
47
|
}
|
|
9
48
|
Grid.properties = {
|
|
10
49
|
align: { type: String },
|
|
50
|
+
_isMobile: { type: Boolean, state: true },
|
|
11
51
|
};
|
|
12
52
|
Grid.styles = css `
|
|
13
53
|
:host {
|
|
@@ -19,11 +59,11 @@ Grid.styles = css `
|
|
|
19
59
|
grid-template-columns: repeat(auto-fill, 19px);
|
|
20
60
|
grid-template-rows: repeat(auto-fill, 19px);
|
|
21
61
|
gap: 1px;
|
|
22
|
-
row-rule: 1px solid
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
light-dark(
|
|
26
|
-
|
|
62
|
+
row-rule: 1px solid light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
|
|
63
|
+
column-rule: 1px solid light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
|
|
64
|
+
outline:
|
|
65
|
+
1px solid light-dark(rgb(147, 147, 147)),
|
|
66
|
+
rgb(147, 147, 147);
|
|
27
67
|
position: fixed;
|
|
28
68
|
top: 0;
|
|
29
69
|
left: 50%;
|
|
@@ -32,15 +72,23 @@ Grid.styles = css `
|
|
|
32
72
|
z-index: 300;
|
|
33
73
|
}
|
|
34
74
|
|
|
35
|
-
/*
|
|
36
|
-
|
|
37
|
-
:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
75
|
+
/* DO NOT CHANGE THIS GRID CODE FOR MOBILE. ITS PERFECT FOR MOBILE. */
|
|
76
|
+
:host(.mobile) {
|
|
77
|
+
outline: calc(2px * var(--scaling-factor)) solid rgba(251, 255, 0, 0.9);
|
|
78
|
+
width: calc(100% - calc(1px * var(--scaling-factor)));
|
|
79
|
+
max-width: 100vw;
|
|
80
|
+
margin-left: 0 !important;
|
|
81
|
+
margin-top: 0 !important;
|
|
82
|
+
box-sizing: border-box;
|
|
83
|
+
position: fixed;
|
|
84
|
+
top: calc(0.5px * var(--scaling-factor));
|
|
85
|
+
left: 50%;
|
|
86
|
+
transform: translateX(-50%);
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
z-index: 300;
|
|
89
|
+
gap: calc(1px * var(--scaling-factor));
|
|
90
|
+
grid-template-columns: repeat(14, calc(19px * var(--scaling-factor)));
|
|
91
|
+
grid-template-rows: repeat(auto-fill, calc(19px * var(--scaling-factor)));
|
|
44
92
|
}
|
|
45
93
|
|
|
46
94
|
:host([align="left"]) {
|
package/dist/ds-one.bundle.js
CHANGED
|
@@ -34,9 +34,16 @@ function getDeviceInfo() {
|
|
|
34
34
|
}
|
|
35
35
|
function initDeviceDetection() {
|
|
36
36
|
const deviceInfo = getDeviceInfo();
|
|
37
|
-
if (deviceInfo.isMobile) {
|
|
38
|
-
|
|
37
|
+
if (deviceInfo.isMobile && typeof document !== "undefined") {
|
|
38
|
+
const designWidth = 280;
|
|
39
|
+
const actualWidth = deviceInfo.screenWidth;
|
|
40
|
+
const scalingFactor = actualWidth / designWidth;
|
|
41
|
+
document.documentElement.style.setProperty("--scaling-factor-mobile", scalingFactor.toFixed(3));
|
|
42
|
+
console.log(`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight}), scaling factor: ${scalingFactor.toFixed(2)}`);
|
|
39
43
|
} else {
|
|
44
|
+
if (typeof document !== "undefined") {
|
|
45
|
+
document.documentElement.style.setProperty("--scaling-factor-mobile", "1");
|
|
46
|
+
}
|
|
40
47
|
console.log(`[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`);
|
|
41
48
|
}
|
|
42
49
|
if (typeof window !== "undefined" && window.DS_ONE_DEBUG) {
|
|
@@ -4718,12 +4725,43 @@ customElements.define("ds-table", DsTable);
|
|
|
4718
4725
|
|
|
4719
4726
|
// dist/4-page/ds-grid.js
|
|
4720
4727
|
var Grid = class extends i4 {
|
|
4728
|
+
constructor() {
|
|
4729
|
+
super(...arguments);
|
|
4730
|
+
this._isMobile = false;
|
|
4731
|
+
}
|
|
4732
|
+
connectedCallback() {
|
|
4733
|
+
super.connectedCallback();
|
|
4734
|
+
this._isMobile = detectMobileDevice();
|
|
4735
|
+
console.log(`[ds-grid] Mobile device: ${this._isMobile}`);
|
|
4736
|
+
if (this._isMobile) {
|
|
4737
|
+
this.classList.add("mobile");
|
|
4738
|
+
console.log(`[ds-grid] Mobile class added`);
|
|
4739
|
+
}
|
|
4740
|
+
if (this._isMobile && typeof window !== "undefined") {
|
|
4741
|
+
const screenWidth = window.innerWidth;
|
|
4742
|
+
const columns = 14;
|
|
4743
|
+
const gap = 0.5;
|
|
4744
|
+
const totalGapWidth = (columns - 1) * gap;
|
|
4745
|
+
const columnSize = (screenWidth - totalGapWidth) / columns;
|
|
4746
|
+
console.log(`[ds-grid] Mobile grid: ${columns} columns \xD7 ${columnSize.toFixed(2)}px + ${totalGapWidth}px gaps = ${screenWidth}px`);
|
|
4747
|
+
this.style.setProperty("--mobile-column-size", `${columnSize}px`);
|
|
4748
|
+
this.style.setProperty("--mobile-gap", `${gap}px`);
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
updated() {
|
|
4752
|
+
if (this._isMobile) {
|
|
4753
|
+
this.classList.add("mobile");
|
|
4754
|
+
} else {
|
|
4755
|
+
this.classList.remove("mobile");
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4721
4758
|
render() {
|
|
4722
4759
|
return x``;
|
|
4723
4760
|
}
|
|
4724
4761
|
};
|
|
4725
4762
|
Grid.properties = {
|
|
4726
|
-
align: { type: String }
|
|
4763
|
+
align: { type: String },
|
|
4764
|
+
_isMobile: { type: Boolean, state: true }
|
|
4727
4765
|
};
|
|
4728
4766
|
Grid.styles = i`
|
|
4729
4767
|
:host {
|
|
@@ -4735,11 +4773,11 @@ Grid.styles = i`
|
|
|
4735
4773
|
grid-template-columns: repeat(auto-fill, 19px);
|
|
4736
4774
|
grid-template-rows: repeat(auto-fill, 19px);
|
|
4737
4775
|
gap: 1px;
|
|
4738
|
-
row-rule: 1px solid
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
light-dark(
|
|
4742
|
-
|
|
4776
|
+
row-rule: 1px solid light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
|
|
4777
|
+
column-rule: 1px solid light-dark(rgb(147, 147, 147), rgb(147, 147, 147));
|
|
4778
|
+
outline:
|
|
4779
|
+
1px solid light-dark(rgb(147, 147, 147)),
|
|
4780
|
+
rgb(147, 147, 147);
|
|
4743
4781
|
position: fixed;
|
|
4744
4782
|
top: 0;
|
|
4745
4783
|
left: 50%;
|
|
@@ -4748,15 +4786,23 @@ Grid.styles = i`
|
|
|
4748
4786
|
z-index: 300;
|
|
4749
4787
|
}
|
|
4750
4788
|
|
|
4751
|
-
/*
|
|
4752
|
-
|
|
4753
|
-
:
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4789
|
+
/* DO NOT CHANGE THIS GRID CODE FOR MOBILE. ITS PERFECT FOR MOBILE. */
|
|
4790
|
+
:host(.mobile) {
|
|
4791
|
+
outline: calc(2px * var(--scaling-factor)) solid rgba(251, 255, 0, 0.9);
|
|
4792
|
+
width: calc(100% - calc(1px * var(--scaling-factor)));
|
|
4793
|
+
max-width: 100vw;
|
|
4794
|
+
margin-left: 0 !important;
|
|
4795
|
+
margin-top: 0 !important;
|
|
4796
|
+
box-sizing: border-box;
|
|
4797
|
+
position: fixed;
|
|
4798
|
+
top: calc(0.5px * var(--scaling-factor));
|
|
4799
|
+
left: 50%;
|
|
4800
|
+
transform: translateX(-50%);
|
|
4801
|
+
pointer-events: none;
|
|
4802
|
+
z-index: 300;
|
|
4803
|
+
gap: calc(1px * var(--scaling-factor));
|
|
4804
|
+
grid-template-columns: repeat(14, calc(19px * var(--scaling-factor)));
|
|
4805
|
+
grid-template-rows: repeat(auto-fill, calc(19px * var(--scaling-factor)));
|
|
4760
4806
|
}
|
|
4761
4807
|
|
|
4762
4808
|
:host([align="left"]) {
|