ds-one 0.2.5-alpha.9 → 0.3.0-alpha.2
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/device.ts +313 -29
- package/DS1/1-root/fonts/Iosevka-Regular.woff2 +0 -0
- package/DS1/1-root/one.css +124 -77
- package/DS1/2-core/ds-banner.ts +120 -1
- package/DS1/2-core/ds-button.ts +16 -93
- package/DS1/2-core/ds-card.ts +137 -0
- package/DS1/2-core/ds-cycle.ts +77 -179
- package/DS1/2-core/ds-date.ts +3 -10
- package/DS1/2-core/ds-gap.ts +38 -0
- package/DS1/2-core/ds-icon.ts +6 -35
- package/DS1/2-core/ds-input.ts +306 -1
- package/DS1/2-core/ds-pagedots.ts +52 -0
- package/DS1/2-core/ds-text.ts +55 -28
- package/DS1/2-core/ds-tooltip.ts +12 -58
- package/DS1/2-core/styles/ds-banner.css +77 -0
- package/DS1/2-core/styles/ds-button.css +67 -0
- package/DS1/2-core/styles/ds-cycle.css +21 -0
- package/DS1/2-core/styles/ds-date.css +9 -0
- package/DS1/2-core/styles/ds-gap.css +93 -0
- package/DS1/2-core/styles/ds-icon.css +30 -0
- package/DS1/2-core/styles/ds-input.css +46 -0
- package/DS1/2-core/styles/ds-pagedots.css +31 -0
- package/DS1/2-core/styles/ds-text.css +29 -0
- package/DS1/2-core/styles/ds-tooltip.css +49 -0
- package/DS1/3-unit/ds-accordion.ts +95 -0
- package/DS1/3-unit/ds-form.ts +304 -0
- package/DS1/3-unit/ds-list.ts +5 -14
- package/DS1/3-unit/ds-row.ts +3 -19
- package/DS1/3-unit/ds-table.ts +3 -86
- package/DS1/3-unit/styles/ds-accordion.css +46 -0
- package/DS1/3-unit/styles/ds-list.css +9 -0
- package/DS1/3-unit/styles/ds-row.css +19 -0
- package/DS1/3-unit/styles/ds-table.css +80 -0
- package/DS1/4-page/ds-container.ts +28 -0
- package/DS1/4-page/ds-grid.ts +37 -50
- package/DS1/4-page/ds-layout.ts +652 -163
- package/DS1/4-page/styles/ds-container.css +35 -0
- package/DS1/4-page/styles/ds-grid.css +56 -0
- package/DS1/4-page/styles/ds-layout.css +246 -0
- package/DS1/index.ts +8 -1
- package/DS1/vite-env.d.ts +13 -0
- package/DS1/x-icon/2x.svg +4 -0
- package/DS1/x-icon/2xdots.svg +18 -0
- package/DS1/x-icon/2xgrid.svg +6 -0
- package/DS1/x-icon/2xlines.svg +6 -0
- package/DS1/x-icon/4x4.svg +18 -0
- package/DS1/x-icon/apple.svg +4 -0
- package/DS1/x-icon/avatar.svg +4 -0
- package/DS1/x-icon/big.svg +4 -0
- package/DS1/x-icon/blank.svg +3 -0
- package/DS1/x-icon/check.svg +3 -0
- package/DS1/x-icon/close.svg +3 -0
- package/DS1/x-icon/collapse.svg +3 -0
- package/DS1/x-icon/color.svg +4 -0
- package/DS1/x-icon/column.svg +5 -0
- package/DS1/x-icon/default.svg +3 -0
- package/DS1/x-icon/delete.svg +5 -0
- package/DS1/x-icon/dictate.svg +6 -0
- package/DS1/x-icon/do.svg +3 -0
- package/DS1/x-icon/down.svg +3 -0
- package/DS1/x-icon/duplicate.svg +4 -0
- package/DS1/x-icon/gallery.svg +5 -0
- package/DS1/x-icon/google.svg +6 -0
- package/DS1/x-icon/head.svg +5 -0
- package/DS1/x-icon/home.svg +3 -0
- package/DS1/x-icon/icon.svg +4 -0
- package/DS1/x-icon/in.svg +4 -0
- package/DS1/x-icon/lock.svg +5 -0
- package/DS1/x-icon/loop.svg +5 -0
- package/DS1/x-icon/mic.svg +5 -0
- package/DS1/x-icon/minimize.svg +3 -0
- package/DS1/x-icon/more.svg +5 -0
- package/DS1/x-icon/neutral.svg +6 -0
- package/DS1/x-icon/note.svg +6 -0
- package/DS1/x-icon/page.svg +4 -0
- package/DS1/x-icon/plus.svg +3 -0
- package/DS1/x-icon/rewind.svg +4 -0
- package/DS1/x-icon/row.svg +5 -0
- package/DS1/x-icon/sdown.svg +3 -0
- package/DS1/x-icon/search.svg +4 -0
- package/DS1/x-icon/see.svg +4 -0
- package/DS1/x-icon/ship.svg +5 -0
- package/DS1/x-icon/star.svg +3 -0
- package/DS1/x-icon/status.svg +4 -0
- package/DS1/x-icon/sup.svg +3 -0
- package/DS1/x-icon/title.svg +3 -0
- package/DS1/x-icon/undo.svg +3 -0
- package/DS1/x-icon/ungroup.svg +4 -0
- package/DS1/x-icon/unhead.svg +3 -0
- package/DS1/x-icon/unicon.svg +3 -0
- package/DS1/x-icon/unlock.svg +5 -0
- package/DS1/x-icon/unmic.svg +6 -0
- package/DS1/x-icon/unsee.svg +5 -0
- package/DS1/x-icon/unstar.svg +3 -0
- package/DS1/x-icon/untitle.svg +3 -0
- package/DS1/x-icon/up.svg +3 -0
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/dist/0-face/device.d.ts +52 -1
- package/dist/0-face/device.d.ts.map +1 -1
- package/dist/0-face/device.js +239 -21
- package/dist/2-core/ds-banner.d.ts +67 -0
- package/dist/2-core/ds-banner.d.ts.map +1 -1
- package/dist/2-core/ds-banner.js +97 -1
- package/dist/2-core/ds-button.d.ts +4 -15
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +14 -86
- package/dist/2-core/ds-card.d.ts +39 -0
- package/dist/2-core/ds-card.d.ts.map +1 -0
- package/dist/2-core/ds-card.js +119 -0
- package/dist/2-core/ds-cycle.d.ts +1 -5
- package/dist/2-core/ds-cycle.d.ts.map +1 -1
- package/dist/2-core/ds-cycle.js +74 -163
- package/dist/2-core/ds-date.d.ts.map +1 -1
- package/dist/2-core/ds-date.js +3 -9
- package/dist/2-core/ds-gap.d.ts +28 -0
- package/dist/2-core/ds-gap.d.ts.map +1 -0
- package/dist/2-core/ds-gap.js +25 -0
- package/dist/2-core/ds-icon.d.ts.map +1 -1
- package/dist/2-core/ds-icon.js +6 -35
- package/dist/2-core/ds-input.d.ts +127 -0
- package/dist/2-core/ds-input.d.ts.map +1 -1
- package/dist/2-core/ds-input.js +252 -1
- package/dist/2-core/ds-pagedots.d.ts +32 -0
- package/dist/2-core/ds-pagedots.d.ts.map +1 -0
- package/dist/2-core/ds-pagedots.js +36 -0
- package/dist/2-core/ds-text.d.ts +5 -3
- package/dist/2-core/ds-text.d.ts.map +1 -1
- package/dist/2-core/ds-text.js +49 -27
- package/dist/2-core/ds-tooltip.d.ts +2 -2
- package/dist/2-core/ds-tooltip.d.ts.map +1 -1
- package/dist/2-core/ds-tooltip.js +11 -57
- package/dist/3-unit/ds-accordion.d.ts +47 -0
- package/dist/3-unit/ds-accordion.d.ts.map +1 -0
- package/dist/3-unit/ds-accordion.js +75 -0
- package/dist/3-unit/ds-form.d.ts +70 -0
- package/dist/3-unit/ds-form.d.ts.map +1 -0
- package/dist/3-unit/ds-form.js +232 -0
- package/dist/3-unit/ds-list.d.ts.map +1 -1
- package/dist/3-unit/ds-list.js +5 -11
- package/dist/3-unit/ds-row.d.ts.map +1 -1
- package/dist/3-unit/ds-row.js +3 -19
- package/dist/3-unit/ds-table.d.ts.map +1 -1
- package/dist/3-unit/ds-table.js +3 -86
- package/dist/{3-unit/row-v1.d.ts → 4-page/ds-container.d.ts} +3 -11
- package/dist/4-page/ds-container.d.ts.map +1 -0
- package/dist/4-page/ds-container.js +11 -0
- package/dist/4-page/ds-grid.d.ts +5 -0
- package/dist/4-page/ds-grid.d.ts.map +1 -1
- package/dist/4-page/ds-grid.js +38 -56
- package/dist/4-page/ds-layout.d.ts +3 -3
- package/dist/4-page/ds-layout.d.ts.map +1 -1
- package/dist/4-page/ds-layout.js +651 -162
- package/dist/ds-one.bundle.js +3247 -2089
- package/dist/ds-one.bundle.js.map +1 -7
- package/dist/ds-one.bundle.min.js +3839 -550
- package/dist/ds-one.bundle.min.js.map +1 -7
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/package.json +4 -2
- package/dist/3-unit/doublenav-v1.d.ts +0 -51
- package/dist/3-unit/doublenav-v1.d.ts.map +0 -1
- package/dist/3-unit/doublenav-v1.js +0 -88
- package/dist/3-unit/ds-portfolio-doublenav.d.ts +0 -51
- package/dist/3-unit/ds-portfolio-doublenav.d.ts.map +0 -1
- package/dist/3-unit/ds-portfolio-doublenav.js +0 -88
- package/dist/3-unit/ds-portfolio-panel.d.ts +0 -11
- package/dist/3-unit/ds-portfolio-panel.d.ts.map +0 -1
- package/dist/3-unit/ds-portfolio-panel.js +0 -16
- package/dist/3-unit/ds-portfolio-singlenav.d.ts +0 -32
- package/dist/3-unit/ds-portfolio-singlenav.d.ts.map +0 -1
- package/dist/3-unit/ds-portfolio-singlenav.js +0 -62
- package/dist/3-unit/list-v1.d.ts +0 -11
- package/dist/3-unit/list-v1.d.ts.map +0 -1
- package/dist/3-unit/list-v1.js +0 -15
- package/dist/3-unit/panel-v1.d.ts +0 -11
- package/dist/3-unit/panel-v1.d.ts.map +0 -1
- package/dist/3-unit/panel-v1.js +0 -16
- package/dist/3-unit/row-v1.d.ts.map +0 -1
- package/dist/3-unit/row-v1.js +0 -32
- package/dist/3-unit/singlenav-v1.d.ts +0 -32
- package/dist/3-unit/singlenav-v1.d.ts.map +0 -1
- package/dist/3-unit/singlenav-v1.js +0 -62
package/DS1/0-face/device.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Device detection and
|
|
1
|
+
// device.ts
|
|
2
|
+
// Device detection, context utilities, and responsive scaling
|
|
3
|
+
|
|
4
|
+
import { signal } from "@lit-labs/signals";
|
|
5
|
+
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Types
|
|
8
|
+
// ============================================================================
|
|
3
9
|
|
|
4
10
|
export type DeviceType = "mobile" | "tablet" | "desktop";
|
|
5
11
|
|
|
@@ -14,6 +20,36 @@ export interface DeviceInfo {
|
|
|
14
20
|
screenHeight: number;
|
|
15
21
|
}
|
|
16
22
|
|
|
23
|
+
export type ScalingMode = "auto" | "fixed" | "fluid";
|
|
24
|
+
|
|
25
|
+
export interface ScalingConfig {
|
|
26
|
+
mode: ScalingMode;
|
|
27
|
+
baseWidth: number;
|
|
28
|
+
minScale: number;
|
|
29
|
+
maxScale: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Configuration & Signals
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
const defaultScalingConfig: ScalingConfig = {
|
|
37
|
+
mode: "auto",
|
|
38
|
+
baseWidth: 280,
|
|
39
|
+
minScale: 0.75,
|
|
40
|
+
maxScale: 2.0,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Reactive scaling factor signal */
|
|
44
|
+
export const scalingFactor = signal<number>(1);
|
|
45
|
+
|
|
46
|
+
/** Current scaling configuration */
|
|
47
|
+
export const scalingConfig = signal<ScalingConfig>(defaultScalingConfig);
|
|
48
|
+
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// Device Detection
|
|
51
|
+
// ============================================================================
|
|
52
|
+
|
|
17
53
|
/**
|
|
18
54
|
* Comprehensive mobile device detection
|
|
19
55
|
* Combines user agent detection, touch capability, and viewport size
|
|
@@ -80,40 +116,148 @@ export function getDeviceInfo(): DeviceInfo {
|
|
|
80
116
|
};
|
|
81
117
|
}
|
|
82
118
|
|
|
119
|
+
// ============================================================================
|
|
120
|
+
// Scaling
|
|
121
|
+
// ============================================================================
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Calculate the scaling factor based on viewport width
|
|
125
|
+
* @param viewportWidth - Current viewport width in pixels
|
|
126
|
+
* @param config - Scaling configuration
|
|
127
|
+
* @returns The calculated scaling factor
|
|
128
|
+
*/
|
|
129
|
+
export function calculateScalingFactor(
|
|
130
|
+
viewportWidth: number,
|
|
131
|
+
config: ScalingConfig = scalingConfig.get()
|
|
132
|
+
): number {
|
|
133
|
+
if (config.mode === "fixed") {
|
|
134
|
+
return 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const rawScale = viewportWidth / config.baseWidth;
|
|
138
|
+
const clampedScale = Math.max(
|
|
139
|
+
config.minScale,
|
|
140
|
+
Math.min(config.maxScale, rawScale)
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
return Number(clampedScale.toFixed(3));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Set the scaling configuration
|
|
148
|
+
* @param config - Partial scaling configuration to apply
|
|
149
|
+
*/
|
|
150
|
+
export function setScalingConfig(config: Partial<ScalingConfig>): void {
|
|
151
|
+
const currentConfig = scalingConfig.get();
|
|
152
|
+
const newConfig = { ...currentConfig, ...config };
|
|
153
|
+
scalingConfig.set(newConfig);
|
|
154
|
+
|
|
155
|
+
// Recalculate scaling factor if in browser
|
|
156
|
+
if (typeof window !== "undefined") {
|
|
157
|
+
updateScalingFactor();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Update the scaling factor based on current viewport
|
|
163
|
+
* Desktop always uses factor 1; mobile uses computed factor
|
|
164
|
+
*/
|
|
165
|
+
export function updateScalingFactor(): void {
|
|
166
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const isMobile = detectMobileDevice();
|
|
171
|
+
|
|
172
|
+
// Desktop: always use factor 1
|
|
173
|
+
if (!isMobile) {
|
|
174
|
+
const factor = 1;
|
|
175
|
+
scalingFactor.set(factor);
|
|
176
|
+
document.documentElement.style.setProperty("--sf", factor.toString());
|
|
177
|
+
window.dispatchEvent(
|
|
178
|
+
new CustomEvent("scaling-changed", {
|
|
179
|
+
detail: { scalingFactor: factor, config: scalingConfig.get() },
|
|
180
|
+
})
|
|
181
|
+
);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Mobile: compute scaling based on viewport
|
|
186
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
187
|
+
const config = scalingConfig.get();
|
|
188
|
+
const newFactor = calculateScalingFactor(viewportWidth, config);
|
|
189
|
+
|
|
190
|
+
scalingFactor.set(newFactor);
|
|
191
|
+
document.documentElement.style.setProperty("--sf", newFactor.toString());
|
|
192
|
+
|
|
193
|
+
window.dispatchEvent(
|
|
194
|
+
new CustomEvent("scaling-changed", {
|
|
195
|
+
detail: { scalingFactor: newFactor, config },
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Get the current scaling factor
|
|
202
|
+
* @returns The current scaling factor
|
|
203
|
+
*/
|
|
204
|
+
export function getScalingFactor(): number {
|
|
205
|
+
return scalingFactor.get();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Convert a design pixel value to scaled pixels
|
|
210
|
+
* @param designPx - The design pixel value (based on 280px width)
|
|
211
|
+
* @returns The scaled pixel value
|
|
212
|
+
*/
|
|
213
|
+
export function scale(designPx: number): number {
|
|
214
|
+
return designPx * scalingFactor.get();
|
|
215
|
+
}
|
|
216
|
+
|
|
83
217
|
/**
|
|
84
|
-
*
|
|
218
|
+
* Convert a scaled pixel value back to design pixels
|
|
219
|
+
* @param scaledPx - The scaled pixel value
|
|
220
|
+
* @returns The design pixel value
|
|
221
|
+
*/
|
|
222
|
+
export function unscale(scaledPx: number): number {
|
|
223
|
+
const factor = scalingFactor.get();
|
|
224
|
+
return factor === 0 ? scaledPx : scaledPx / factor;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ============================================================================
|
|
228
|
+
// Unified Initialization
|
|
229
|
+
// ============================================================================
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Initialize device detection and scaling
|
|
233
|
+
* Sets CSS classes (.mobile/.desktop) and --sf custom property
|
|
85
234
|
*/
|
|
86
235
|
export function initDeviceDetection(): DeviceInfo {
|
|
87
236
|
const deviceInfo = getDeviceInfo();
|
|
88
237
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const designWidth = 280;
|
|
93
|
-
const actualWidth = deviceInfo.screenWidth;
|
|
94
|
-
const scalingFactor = actualWidth / designWidth;
|
|
95
|
-
|
|
96
|
-
// Set CSS custom property for scaling on html element
|
|
97
|
-
document.documentElement.style.setProperty(
|
|
98
|
-
"--sf",
|
|
99
|
-
scalingFactor.toFixed(3)
|
|
100
|
-
);
|
|
101
|
-
// Also set --sf for backwards compatibility
|
|
102
|
-
document.documentElement.style.setProperty(
|
|
103
|
-
"--sf",
|
|
104
|
-
scalingFactor.toFixed(3)
|
|
105
|
-
);
|
|
238
|
+
if (typeof document === "undefined") {
|
|
239
|
+
return deviceInfo;
|
|
240
|
+
}
|
|
106
241
|
|
|
242
|
+
// Set device class on html element
|
|
243
|
+
if (deviceInfo.isMobile) {
|
|
244
|
+
document.documentElement.classList.add("mobile");
|
|
245
|
+
document.documentElement.classList.remove("desktop");
|
|
246
|
+
} else {
|
|
247
|
+
document.documentElement.classList.add("desktop");
|
|
248
|
+
document.documentElement.classList.remove("mobile");
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Update scaling factor (handles --sf CSS property)
|
|
252
|
+
updateScalingFactor();
|
|
253
|
+
|
|
254
|
+
// Log device info
|
|
255
|
+
const factor = scalingFactor.get();
|
|
256
|
+
if (deviceInfo.isMobile) {
|
|
107
257
|
console.log(
|
|
108
|
-
`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight}), scaling factor: ${
|
|
258
|
+
`[DS one] Mobile device detected - ${deviceInfo.deviceType} (${deviceInfo.screenWidth}x${deviceInfo.screenHeight}), scaling factor: ${factor.toFixed(2)}`
|
|
109
259
|
);
|
|
110
260
|
} else {
|
|
111
|
-
// Desktop - no scaling
|
|
112
|
-
if (typeof document !== "undefined") {
|
|
113
|
-
document.documentElement.style.setProperty("--sf", "1");
|
|
114
|
-
// Also set --sf for backwards compatibility
|
|
115
|
-
document.documentElement.style.setProperty("--sf", "1");
|
|
116
|
-
}
|
|
117
261
|
console.log(
|
|
118
262
|
`[DS one] Desktop device detected (${deviceInfo.screenWidth}x${deviceInfo.screenHeight})`
|
|
119
263
|
);
|
|
@@ -128,6 +272,7 @@ export function initDeviceDetection(): DeviceInfo {
|
|
|
128
272
|
isDesktop: deviceInfo.isDesktop,
|
|
129
273
|
isTouchCapable: deviceInfo.isTouchCapable,
|
|
130
274
|
viewport: `${deviceInfo.screenWidth}x${deviceInfo.screenHeight}`,
|
|
275
|
+
scalingFactor: factor,
|
|
131
276
|
userAgent: deviceInfo.userAgent,
|
|
132
277
|
});
|
|
133
278
|
}
|
|
@@ -147,12 +292,151 @@ if (typeof window !== "undefined") {
|
|
|
147
292
|
initDeviceDetection();
|
|
148
293
|
}
|
|
149
294
|
|
|
150
|
-
//
|
|
151
|
-
let resizeTimeout:
|
|
295
|
+
// Single debounced resize handler for both device detection + scaling
|
|
296
|
+
let resizeTimeout: ReturnType<typeof setTimeout>;
|
|
152
297
|
window.addEventListener("resize", () => {
|
|
153
298
|
clearTimeout(resizeTimeout);
|
|
154
299
|
resizeTimeout = setTimeout(() => {
|
|
155
300
|
initDeviceDetection();
|
|
156
301
|
}, 100);
|
|
157
302
|
});
|
|
303
|
+
|
|
304
|
+
// Also handle orientation change
|
|
305
|
+
window.addEventListener("orientationchange", () => {
|
|
306
|
+
setTimeout(initDeviceDetection, 100);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// ============================================================================
|
|
311
|
+
// App-like Behavior
|
|
312
|
+
// ============================================================================
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Disable double-tap to zoom in the browser (app-like behavior)
|
|
316
|
+
* Prevents all zoom gestures including double-tap and pinch-to-zoom
|
|
317
|
+
*/
|
|
318
|
+
export function applike(): void {
|
|
319
|
+
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Set viewport meta tag to prevent zoom - this is the most important step
|
|
324
|
+
let viewport = document.querySelector('meta[name="viewport"]');
|
|
325
|
+
if (!viewport) {
|
|
326
|
+
viewport = document.createElement("meta");
|
|
327
|
+
viewport.setAttribute("name", "viewport");
|
|
328
|
+
document.head.appendChild(viewport);
|
|
329
|
+
}
|
|
330
|
+
viewport.setAttribute(
|
|
331
|
+
"content",
|
|
332
|
+
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
// Apply touch-action: pan-x pan-y globally to prevent zoom but allow panning
|
|
336
|
+
const style = document.createElement("style");
|
|
337
|
+
style.id = "ds-one-applike-style";
|
|
338
|
+
style.textContent = `
|
|
339
|
+
* {
|
|
340
|
+
touch-action: pan-x pan-y !important;
|
|
341
|
+
-ms-touch-action: pan-x pan-y !important;
|
|
342
|
+
}
|
|
343
|
+
html, body {
|
|
344
|
+
touch-action: pan-x pan-y !important;
|
|
345
|
+
-ms-touch-action: pan-x pan-y !important;
|
|
346
|
+
}
|
|
347
|
+
`;
|
|
348
|
+
// Remove existing style if present
|
|
349
|
+
const existingStyle = document.getElementById("ds-one-applike-style");
|
|
350
|
+
if (existingStyle) {
|
|
351
|
+
existingStyle.remove();
|
|
352
|
+
}
|
|
353
|
+
document.head.appendChild(style);
|
|
354
|
+
|
|
355
|
+
// Track touch events to prevent double-tap zoom
|
|
356
|
+
let lastTouchEnd = 0;
|
|
357
|
+
let touchStartTime = 0;
|
|
358
|
+
|
|
359
|
+
const preventZoom = (event: TouchEvent | WheelEvent | Event) => {
|
|
360
|
+
// Prevent pinch zoom (two fingers)
|
|
361
|
+
if (event instanceof TouchEvent) {
|
|
362
|
+
if (event.touches.length > 1) {
|
|
363
|
+
event.preventDefault();
|
|
364
|
+
event.stopPropagation();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const now = Date.now();
|
|
369
|
+
|
|
370
|
+
if (event.type === "touchstart") {
|
|
371
|
+
// If touchstart happens within 300ms of last touchend, it's likely a double-tap
|
|
372
|
+
if (now - lastTouchEnd < 300) {
|
|
373
|
+
event.preventDefault();
|
|
374
|
+
event.stopPropagation();
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
touchStartTime = now;
|
|
378
|
+
} else if (event.type === "touchend") {
|
|
379
|
+
const touchDuration = now - touchStartTime;
|
|
380
|
+
// If this is a quick tap (< 300ms) and happened soon after previous touchend, prevent it
|
|
381
|
+
if (touchDuration < 300 && now - lastTouchEnd < 300) {
|
|
382
|
+
event.preventDefault();
|
|
383
|
+
event.stopPropagation();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
lastTouchEnd = now;
|
|
387
|
+
} else if (event.type === "touchmove") {
|
|
388
|
+
// Prevent any touchmove that might trigger zoom
|
|
389
|
+
if (event.touches.length > 1) {
|
|
390
|
+
event.preventDefault();
|
|
391
|
+
event.stopPropagation();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Prevent wheel zoom with ctrl/cmd key (common on trackpads)
|
|
398
|
+
if (event instanceof WheelEvent && (event.ctrlKey || event.metaKey)) {
|
|
399
|
+
event.preventDefault();
|
|
400
|
+
event.stopPropagation();
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// Use capture phase to catch events earlier
|
|
406
|
+
const options = { passive: false, capture: true };
|
|
407
|
+
|
|
408
|
+
// Prevent all zoom gestures - use capture phase
|
|
409
|
+
document.addEventListener("touchstart", preventZoom, options);
|
|
410
|
+
document.addEventListener("touchmove", preventZoom, options);
|
|
411
|
+
document.addEventListener("touchend", preventZoom, options);
|
|
412
|
+
document.addEventListener("touchcancel", preventZoom, options);
|
|
413
|
+
|
|
414
|
+
// Prevent wheel zoom
|
|
415
|
+
document.addEventListener("wheel", preventZoom, options);
|
|
416
|
+
|
|
417
|
+
// Prevent gesture events (iOS Safari) - use capture phase
|
|
418
|
+
document.addEventListener(
|
|
419
|
+
"gesturestart",
|
|
420
|
+
(e) => {
|
|
421
|
+
e.preventDefault();
|
|
422
|
+
e.stopPropagation();
|
|
423
|
+
},
|
|
424
|
+
options
|
|
425
|
+
);
|
|
426
|
+
document.addEventListener(
|
|
427
|
+
"gesturechange",
|
|
428
|
+
(e) => {
|
|
429
|
+
e.preventDefault();
|
|
430
|
+
e.stopPropagation();
|
|
431
|
+
},
|
|
432
|
+
options
|
|
433
|
+
);
|
|
434
|
+
document.addEventListener(
|
|
435
|
+
"gestureend",
|
|
436
|
+
(e) => {
|
|
437
|
+
e.preventDefault();
|
|
438
|
+
e.stopPropagation();
|
|
439
|
+
},
|
|
440
|
+
options
|
|
441
|
+
);
|
|
158
442
|
}
|
|
Binary file
|
package/DS1/1-root/one.css
CHANGED
|
@@ -1,57 +1,76 @@
|
|
|
1
|
-
/* version 0.
|
|
1
|
+
/* version 0.3.0-alpha.2 */
|
|
2
|
+
|
|
3
|
+
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@200");
|
|
4
|
+
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@800");
|
|
5
|
+
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@800");
|
|
6
|
+
|
|
7
|
+
@font-face {
|
|
8
|
+
font-family: GT-America-Standard-Regular;
|
|
9
|
+
src: url("./fonts/GT-America-Standard-Regular.woff2") format("woff2");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@font-face {
|
|
13
|
+
font-family: GT-America-Standard-Medium;
|
|
14
|
+
src: url("./fonts/GT-America-Standard-Medium.woff2") format("woff2");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@font-face {
|
|
18
|
+
font-family: GT-America-Compressed-Regular;
|
|
19
|
+
src: url("./fonts/GT-America-Compressed-Regular.woff2") format("woff2");
|
|
20
|
+
}
|
|
2
21
|
|
|
3
22
|
input {
|
|
4
23
|
padding: 0;
|
|
5
24
|
}
|
|
6
25
|
|
|
7
26
|
:root {
|
|
8
|
-
/* colors */
|
|
9
|
-
|
|
27
|
+
/* DS one colors */
|
|
28
|
+
|
|
29
|
+
/* Base/[color] */
|
|
30
|
+
|
|
10
31
|
--white: rgb(255 255 255);
|
|
11
|
-
--
|
|
32
|
+
--light-grey: #e8e8e8;
|
|
33
|
+
--slate: #1e1e1e;
|
|
12
34
|
--slate-light: #e6e6e6;
|
|
13
35
|
--slate-dark: #3c3c3c;
|
|
14
|
-
--
|
|
15
|
-
--
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
--stealth: #554455;
|
|
37
|
+
--black: #2a2a2a;
|
|
38
|
+
|
|
39
|
+
/* Accent/[color] */
|
|
40
|
+
--tuned-red: #ff5f5f;
|
|
18
41
|
--pink: #f5aad1;
|
|
19
|
-
--
|
|
42
|
+
--sharp-blue: #594dff;
|
|
43
|
+
--zenith-blue: #ccccff;
|
|
44
|
+
--every-green: #979441;
|
|
45
|
+
--apple-green: #99ff73;
|
|
46
|
+
--chartreuse-green: #ccff4d;
|
|
47
|
+
--yellow: #eaff00;
|
|
20
48
|
--orange: #fec20d;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* DS1 Documentation Colors */
|
|
24
|
-
--ds1-docs-header-bg: light-dark(#f5f5f5, #232323);
|
|
25
|
-
--ds1-docs-header-border: light-dark(#e0e0e0, #000000);
|
|
26
|
-
--ds1-docs-header-text: light-dark(#2a2a2a, #f1f1f1);
|
|
27
|
-
--ds1-docs-header-text-secondary: light-dark(#666666, #cdcdcd);
|
|
28
|
-
--ds1-docs-accent-green: #72ff3d;
|
|
29
|
-
--ds1-docs-sidebar-bg: light-dark(#fafafa, #1f1f1f);
|
|
30
|
-
--ds1-docs-content-bg: light-dark(#ffffff, #171717);
|
|
31
|
-
--ds1-docs-search-bg: light-dark(#f0f0f0, #171717);
|
|
32
|
-
--ds1-docs-divider: light-dark(#e0e0e0, #000000);
|
|
49
|
+
|
|
50
|
+
--accent-color: var(--apple-green);
|
|
33
51
|
|
|
34
52
|
/* 4-page component colors */
|
|
35
53
|
|
|
36
54
|
/* ds-grid color */
|
|
37
55
|
--grid-color: light-dark(var(--grid-color-light), var(--grid-color-dark));
|
|
38
|
-
--grid-color-light:
|
|
56
|
+
--grid-color-light: #1e1e1e2b;
|
|
39
57
|
--grid-color-dark: var(--white);
|
|
40
58
|
|
|
41
|
-
/* ds-layout colors */
|
|
42
|
-
|
|
43
|
-
--layout-color: light-dark(
|
|
44
|
-
var(--layout-color-light),
|
|
45
|
-
var(--layout-color-dark)
|
|
46
|
-
);
|
|
47
|
-
|
|
48
59
|
/* typefaces */
|
|
49
|
-
--typeface: "GT-America-Standard-Regular";
|
|
60
|
+
--typeface-regular: "GT-America-Standard-Regular";
|
|
50
61
|
--typeface-medium: "GT-America-Standard-Medium";
|
|
51
62
|
--typeface-compressed: "GT-America-Compressed-Regular";
|
|
52
|
-
--typeface-japanese: "Noto Sans JP";
|
|
53
63
|
--typeface-mono: "Iosevka";
|
|
54
64
|
|
|
65
|
+
/* language specific typefaces */
|
|
66
|
+
|
|
67
|
+
--typeface-regular-jp: "Noto Sans JP";
|
|
68
|
+
--typeface-regular-zh-hans: "Noto Sans SC";
|
|
69
|
+
--typeface-regular-zh-hant: "Noto Sans TC";
|
|
70
|
+
--typeface-regular-zh: var(--typeface-regular-zh-hant);
|
|
71
|
+
|
|
72
|
+
/* typefaces sizes and weight */
|
|
73
|
+
|
|
55
74
|
--type-size-default: calc(14px * var(--sf));
|
|
56
75
|
--type-size-small: calc(10px * var(--sf));
|
|
57
76
|
--type-weight-default: 500;
|
|
@@ -68,27 +87,80 @@ input {
|
|
|
68
87
|
--type-weight-book: 400;
|
|
69
88
|
--type-lineheight-book: 15px;
|
|
70
89
|
|
|
90
|
+
/* ----------------------------------------------------------
|
|
91
|
+
SIZING SCALE
|
|
92
|
+
- Define a base unit ( --1 ) and derive all other sizes
|
|
93
|
+
- Larger sizes are simple multipliers (×2, ×3, ×4)
|
|
94
|
+
- Smaller sizes use fractional multipliers (0.1, 0.25, 0.8)
|
|
95
|
+
---------------------------------------------------------- */
|
|
96
|
+
|
|
97
|
+
--01: calc(var(--1) * 0.1);
|
|
98
|
+
--025: calc(var(--1) * 0.25);
|
|
99
|
+
--05: calc(var(--1) * 0.5);
|
|
100
|
+
--08: calc(var(--1) * 0.8);
|
|
101
|
+
--1: 20px; /* SET BASE UNIT HERE FOR EXAMPLE 20px */
|
|
102
|
+
--2: calc(var(--1) * 2);
|
|
103
|
+
--3: calc(var(--1) * 3);
|
|
104
|
+
--4: calc(var(--1) * 4);
|
|
105
|
+
--8: calc(var(--1) * 8);
|
|
106
|
+
--12: calc(var(--1) * 12);
|
|
107
|
+
--20: calc(var(--1) * 20);
|
|
108
|
+
|
|
109
|
+
/* Semantic sizing units */
|
|
110
|
+
|
|
111
|
+
--tenth: var(--01);
|
|
112
|
+
--quarter: var(--025);
|
|
113
|
+
--half: var(--05);
|
|
114
|
+
--eight-tenth: var(--08);
|
|
115
|
+
--unit: var(--1);
|
|
116
|
+
--double: var(--2);
|
|
117
|
+
--triple: var(--3);
|
|
118
|
+
--quad: var(--4);
|
|
119
|
+
--oct: var(--8);
|
|
120
|
+
--dozen: var(--12);
|
|
121
|
+
--twenty: var(--20);
|
|
122
|
+
|
|
123
|
+
/* Layouts */
|
|
124
|
+
|
|
125
|
+
/* App layout (used for app) */
|
|
126
|
+
--app-layout:
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
/* Home layout (used for lists) */ --home-layout: calc(
|
|
130
|
+
var(--unit) * var(--sf)
|
|
131
|
+
)
|
|
132
|
+
calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
|
|
133
|
+
calc(var(--unit) * var(--sf)) calc(var(--oct) * var(--sf))
|
|
134
|
+
calc(var(--oct) * var(--sf)) calc(var(--quad) * var(--sf))
|
|
135
|
+
calc(var(--double) * var(--sf));
|
|
136
|
+
--home-layout-areas: "banner" "." "header" "." "message" "lists" "." "footer";
|
|
137
|
+
|
|
138
|
+
/* App layout */
|
|
139
|
+
--app-layout: calc(var(--unit) * var(--sf)) calc(var(--unit) * var(--sf))
|
|
140
|
+
calc(var(--unit) * var(--sf)) calc(var(--double) * var(--sf))
|
|
141
|
+
calc(var(--dozen) * var(--sf)) calc(var(--unit) * var(--sf))
|
|
142
|
+
calc(var(--quad) * var(--sf)) calc(var(--double) * var(--sf));
|
|
143
|
+
--app-layout-areas: "banner" "." "header" "." "main" "page-dots" "." "footer";
|
|
144
|
+
|
|
71
145
|
/* size */
|
|
72
|
-
--outline-stroke: 1px solid
|
|
73
|
-
--outline-stroke-mobile:
|
|
74
|
-
light-dark(var(--black), var(--slate-dark));
|
|
146
|
+
--outline-stroke: 1px solid var(--slate-light);
|
|
147
|
+
--outline-stroke-mobile: 2px solid var(--sharp-blue);
|
|
75
148
|
--item-width: calc(79px * var(--sf));
|
|
76
149
|
--item-height: calc(19px * var(--sf));
|
|
77
150
|
--margin-correction: calc(1px * var(--sf));
|
|
78
151
|
|
|
79
|
-
|
|
152
|
+
--column-width: calc(var(--quad) * var(--sf));
|
|
80
153
|
|
|
81
|
-
|
|
82
|
-
--
|
|
83
|
-
/* bigger sizes */
|
|
84
|
-
--2: calc(var(--1) * 2);
|
|
85
|
-
--3: calc(var(--1) * 3);
|
|
86
|
-
--4: calc(var(--1) * 4);
|
|
154
|
+
--column-header-height: calc(var(--unit) * var(--sf));
|
|
155
|
+
--column-header-width: calc(var(--quad) * var(--sf));
|
|
87
156
|
|
|
88
|
-
/*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
157
|
+
/* ----------------------------------------------------------
|
|
158
|
+
SURFACE COLORS
|
|
159
|
+
-
|
|
160
|
+
---------------------------------------------------------- */
|
|
161
|
+
|
|
162
|
+
--background: light-dark(var(--white), var(--black));
|
|
163
|
+
--dialog-background: var(--background);
|
|
92
164
|
|
|
93
165
|
/* button */
|
|
94
166
|
--button-background-color-primary: var(--accent-color);
|
|
@@ -103,7 +175,7 @@ input {
|
|
|
103
175
|
);
|
|
104
176
|
|
|
105
177
|
/* text-color */
|
|
106
|
-
--text-color
|
|
178
|
+
--text-color: light-dark(var(--black), var(--white));
|
|
107
179
|
--text-color-dimmed: light-dark(var(--slate), var(--slate-light));
|
|
108
180
|
|
|
109
181
|
/* icon colors */
|
|
@@ -141,24 +213,6 @@ input {
|
|
|
141
213
|
navigation: auto;
|
|
142
214
|
}
|
|
143
215
|
|
|
144
|
-
@font-face {
|
|
145
|
-
font-family: GT-America-Standard-Regular;
|
|
146
|
-
src: url("./fonts/GT-America-Standard-Regular.woff2") format("woff2");
|
|
147
|
-
font-display: swap;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@font-face {
|
|
151
|
-
font-family: GT-America-Standard-Medium;
|
|
152
|
-
src: url("./fonts/GT-America-Standard-Medium.woff2") format("woff2");
|
|
153
|
-
font-display: swap;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
@font-face {
|
|
157
|
-
font-family: GT-America-Compressed-Regular;
|
|
158
|
-
src: url("./fonts/GT-America-Compressed-Regular.woff2") format("woff2");
|
|
159
|
-
font-display: swap;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
216
|
body {
|
|
163
217
|
margin: 0;
|
|
164
218
|
padding: 0;
|
|
@@ -166,7 +220,6 @@ body {
|
|
|
166
220
|
|
|
167
221
|
.matrix__board {
|
|
168
222
|
position: relative;
|
|
169
|
-
top: calc(21.5px * var(--sf));
|
|
170
223
|
left: calc(-20px * var(--sf));
|
|
171
224
|
width: calc(240px * var(--sf));
|
|
172
225
|
display: flex;
|
|
@@ -207,28 +260,22 @@ body {
|
|
|
207
260
|
height: var(--item-height);
|
|
208
261
|
margin-right: var(--margin-correction);
|
|
209
262
|
margin-bottom: var(--margin-correction);
|
|
210
|
-
outline: var(--outline-stroke);
|
|
211
263
|
background-color: light-dark(var(--white), var(--black));
|
|
212
264
|
}
|
|
213
265
|
|
|
214
266
|
.matrix__row-header {
|
|
215
267
|
position: relative;
|
|
216
|
-
top: calc(0.5px * var(--sf));
|
|
268
|
+
/* top: calc(0.5px * var(--sf)); */
|
|
217
269
|
display: flex;
|
|
218
270
|
align-items: center;
|
|
219
271
|
justify-content: center;
|
|
220
|
-
width: calc(
|
|
221
|
-
height: var(--
|
|
222
|
-
margin-right: var(--margin-correction);
|
|
223
|
-
margin-bottom: var(--margin-correction);
|
|
224
|
-
outline: var(--outline-stroke);
|
|
272
|
+
width: calc(var(--unit) * var(--sf));
|
|
273
|
+
height: calc(var(--unit) * var(--sf));
|
|
274
|
+
/* margin-right: var(--margin-correction);
|
|
275
|
+
margin-bottom: var(--margin-correction); */
|
|
225
276
|
background-color: light-dark(rgb(220 241 213), var(--slate-dark));
|
|
226
277
|
}
|
|
227
278
|
|
|
228
|
-
.mobile .matrix__row-header {
|
|
229
|
-
outline: var(--outline-stroke-mobile);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
279
|
.matrix__column-content {
|
|
233
280
|
display: flex;
|
|
234
281
|
flex-direction: column;
|
|
@@ -438,7 +485,7 @@ table {
|
|
|
438
485
|
}
|
|
439
486
|
|
|
440
487
|
tr {
|
|
441
|
-
background-color: var(--
|
|
488
|
+
background-color: var(--apple-green);
|
|
442
489
|
}
|
|
443
490
|
|
|
444
491
|
td {
|