ds-one 0.2.5-alpha.17 → 0.2.5-alpha.19
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 +130 -0
- package/DS1/0-face/scaling.ts +152 -0
- package/DS1/1-root/one.css +48 -18
- package/DS1/2-core/ds-banner.ts +3 -77
- package/DS1/2-core/ds-button.ts +3 -67
- package/DS1/2-core/ds-card.ts +137 -0
- package/DS1/2-core/ds-cycle.ts +3 -22
- package/DS1/2-core/ds-date.ts +3 -9
- package/DS1/2-core/ds-gap.ts +3 -75
- package/DS1/2-core/ds-icon.ts +3 -33
- 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 +3 -29
- package/DS1/2-core/ds-tooltip.ts +3 -49
- 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 +27 -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 +3 -46
- 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 -85
- 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 +3 -35
- package/DS1/4-page/ds-grid.ts +3 -56
- package/DS1/4-page/ds-layout.ts +528 -50
- 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 +251 -0
- package/DS1/index.ts +7 -2
- package/DS1/vite-env.d.ts +9 -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/README.md +2 -2
- package/dist/0-face/device.d.ts +5 -0
- package/dist/0-face/device.d.ts.map +1 -1
- package/dist/0-face/device.js +105 -0
- package/dist/0-face/scaling.d.ts +48 -0
- package/dist/0-face/scaling.d.ts.map +1 -0
- package/dist/0-face/scaling.js +114 -0
- package/dist/2-core/ds-banner.d.ts.map +1 -1
- package/dist/2-core/ds-banner.js +3 -77
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +3 -67
- 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.map +1 -1
- package/dist/2-core/ds-cycle.js +3 -22
- 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.map +1 -1
- package/dist/2-core/ds-gap.js +3 -75
- package/dist/2-core/ds-icon.d.ts.map +1 -1
- package/dist/2-core/ds-icon.js +3 -33
- 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.map +1 -1
- package/dist/2-core/ds-text.js +3 -29
- package/dist/2-core/ds-tooltip.d.ts.map +1 -1
- package/dist/2-core/ds-tooltip.js +3 -49
- package/dist/2-core/styles/ds-banner.css +77 -0
- package/dist/2-core/styles/ds-button.css +67 -0
- package/dist/2-core/styles/ds-cycle.css +21 -0
- package/dist/2-core/styles/ds-date.css +9 -0
- package/dist/2-core/styles/ds-gap.css +93 -0
- package/dist/2-core/styles/ds-icon.css +30 -0
- package/dist/2-core/styles/ds-input.css +46 -0
- package/dist/2-core/styles/ds-pagedots.css +26 -0
- package/dist/2-core/styles/ds-text.css +29 -0
- package/dist/2-core/styles/ds-tooltip.css +49 -0
- package/dist/3-unit/ds-accordion.d.ts.map +1 -1
- package/dist/3-unit/ds-accordion.js +3 -46
- 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 -85
- package/dist/3-unit/styles/ds-accordion.css +46 -0
- package/dist/3-unit/styles/ds-list.css +9 -0
- package/dist/3-unit/styles/ds-row.css +19 -0
- package/dist/3-unit/styles/ds-table.css +80 -0
- package/dist/4-page/ds-container.d.ts.map +1 -1
- package/dist/4-page/ds-container.js +3 -35
- package/dist/4-page/ds-grid.d.ts.map +1 -1
- package/dist/4-page/ds-grid.js +3 -56
- package/dist/4-page/ds-layout.d.ts +1 -1
- package/dist/4-page/ds-layout.d.ts.map +1 -1
- package/dist/4-page/ds-layout.js +528 -50
- package/dist/4-page/styles/ds-container.css +35 -0
- package/dist/4-page/styles/ds-grid.css +56 -0
- package/dist/4-page/styles/ds-layout.css +251 -0
- package/dist/ds-one.bundle.css +700 -0
- package/dist/ds-one.bundle.css.map +7 -0
- package/dist/ds-one.bundle.js +1370 -535
- package/dist/ds-one.bundle.js.map +4 -4
- package/dist/ds-one.bundle.min.css +2 -0
- package/dist/ds-one.bundle.min.css.map +7 -0
- package/dist/ds-one.bundle.min.js +783 -527
- package/dist/ds-one.bundle.min.js.map +4 -4
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/package.json +1 -1
- 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 +0 -25
- 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
|
@@ -164,3 +164,133 @@ if (typeof window !== "undefined") {
|
|
|
164
164
|
}, 100);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Disable double-tap to zoom in the browser (app-like behavior)
|
|
170
|
+
* Prevents all zoom gestures including double-tap and pinch-to-zoom
|
|
171
|
+
*/
|
|
172
|
+
export function applike(): void {
|
|
173
|
+
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Set viewport meta tag to prevent zoom - this is the most important step
|
|
178
|
+
let viewport = document.querySelector('meta[name="viewport"]');
|
|
179
|
+
if (!viewport) {
|
|
180
|
+
viewport = document.createElement("meta");
|
|
181
|
+
viewport.setAttribute("name", "viewport");
|
|
182
|
+
document.head.appendChild(viewport);
|
|
183
|
+
}
|
|
184
|
+
viewport.setAttribute(
|
|
185
|
+
"content",
|
|
186
|
+
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
// Apply touch-action: pan-x pan-y globally to prevent zoom but allow panning
|
|
190
|
+
const style = document.createElement("style");
|
|
191
|
+
style.id = "ds-one-applike-style";
|
|
192
|
+
style.textContent = `
|
|
193
|
+
* {
|
|
194
|
+
touch-action: pan-x pan-y !important;
|
|
195
|
+
-ms-touch-action: pan-x pan-y !important;
|
|
196
|
+
}
|
|
197
|
+
html, body {
|
|
198
|
+
touch-action: pan-x pan-y !important;
|
|
199
|
+
-ms-touch-action: pan-x pan-y !important;
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
202
|
+
// Remove existing style if present
|
|
203
|
+
const existingStyle = document.getElementById("ds-one-applike-style");
|
|
204
|
+
if (existingStyle) {
|
|
205
|
+
existingStyle.remove();
|
|
206
|
+
}
|
|
207
|
+
document.head.appendChild(style);
|
|
208
|
+
|
|
209
|
+
// Track touch events to prevent double-tap zoom
|
|
210
|
+
let lastTouchEnd = 0;
|
|
211
|
+
let touchStartTime = 0;
|
|
212
|
+
|
|
213
|
+
const preventZoom = (event: TouchEvent | WheelEvent | Event) => {
|
|
214
|
+
// Prevent pinch zoom (two fingers)
|
|
215
|
+
if (event instanceof TouchEvent) {
|
|
216
|
+
if (event.touches.length > 1) {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
event.stopPropagation();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const now = Date.now();
|
|
223
|
+
|
|
224
|
+
if (event.type === "touchstart") {
|
|
225
|
+
// If touchstart happens within 300ms of last touchend, it's likely a double-tap
|
|
226
|
+
if (now - lastTouchEnd < 300) {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
event.stopPropagation();
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
touchStartTime = now;
|
|
232
|
+
} else if (event.type === "touchend") {
|
|
233
|
+
const touchDuration = now - touchStartTime;
|
|
234
|
+
// If this is a quick tap (< 300ms) and happened soon after previous touchend, prevent it
|
|
235
|
+
if (touchDuration < 300 && now - lastTouchEnd < 300) {
|
|
236
|
+
event.preventDefault();
|
|
237
|
+
event.stopPropagation();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
lastTouchEnd = now;
|
|
241
|
+
} else if (event.type === "touchmove") {
|
|
242
|
+
// Prevent any touchmove that might trigger zoom
|
|
243
|
+
if (event.touches.length > 1) {
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Prevent wheel zoom with ctrl/cmd key (common on trackpads)
|
|
252
|
+
if (event instanceof WheelEvent && (event.ctrlKey || event.metaKey)) {
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
event.stopPropagation();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// Use capture phase to catch events earlier
|
|
260
|
+
const options = { passive: false, capture: true };
|
|
261
|
+
|
|
262
|
+
// Prevent all zoom gestures - use capture phase
|
|
263
|
+
document.addEventListener("touchstart", preventZoom, options);
|
|
264
|
+
document.addEventListener("touchmove", preventZoom, options);
|
|
265
|
+
document.addEventListener("touchend", preventZoom, options);
|
|
266
|
+
document.addEventListener("touchcancel", preventZoom, options);
|
|
267
|
+
|
|
268
|
+
// Prevent wheel zoom
|
|
269
|
+
document.addEventListener("wheel", preventZoom, options);
|
|
270
|
+
|
|
271
|
+
// Prevent gesture events (iOS Safari) - use capture phase
|
|
272
|
+
document.addEventListener(
|
|
273
|
+
"gesturestart",
|
|
274
|
+
(e) => {
|
|
275
|
+
e.preventDefault();
|
|
276
|
+
e.stopPropagation();
|
|
277
|
+
},
|
|
278
|
+
options
|
|
279
|
+
);
|
|
280
|
+
document.addEventListener(
|
|
281
|
+
"gesturechange",
|
|
282
|
+
(e) => {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
},
|
|
286
|
+
options
|
|
287
|
+
);
|
|
288
|
+
document.addEventListener(
|
|
289
|
+
"gestureend",
|
|
290
|
+
(e) => {
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
e.stopPropagation();
|
|
293
|
+
},
|
|
294
|
+
options
|
|
295
|
+
);
|
|
296
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// scaling.ts
|
|
2
|
+
// Responsive scaling utilities for the design system
|
|
3
|
+
|
|
4
|
+
import { signal } from "@lit-labs/signals";
|
|
5
|
+
|
|
6
|
+
export type ScalingMode = "auto" | "fixed" | "fluid";
|
|
7
|
+
|
|
8
|
+
export interface ScalingConfig {
|
|
9
|
+
mode: ScalingMode;
|
|
10
|
+
baseWidth: number;
|
|
11
|
+
minScale: number;
|
|
12
|
+
maxScale: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const defaultConfig: ScalingConfig = {
|
|
16
|
+
mode: "auto",
|
|
17
|
+
baseWidth: 280,
|
|
18
|
+
minScale: 0.75,
|
|
19
|
+
maxScale: 2.0,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Reactive scaling factor signal
|
|
23
|
+
export const scalingFactor = signal<number>(1);
|
|
24
|
+
|
|
25
|
+
// Current scaling configuration
|
|
26
|
+
export const scalingConfig = signal<ScalingConfig>(defaultConfig);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Calculate the scaling factor based on viewport width
|
|
30
|
+
* @param viewportWidth - Current viewport width in pixels
|
|
31
|
+
* @param config - Scaling configuration
|
|
32
|
+
* @returns The calculated scaling factor
|
|
33
|
+
*/
|
|
34
|
+
export function calculateScalingFactor(
|
|
35
|
+
viewportWidth: number,
|
|
36
|
+
config: ScalingConfig = scalingConfig.get()
|
|
37
|
+
): number {
|
|
38
|
+
if (config.mode === "fixed") {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const rawScale = viewportWidth / config.baseWidth;
|
|
43
|
+
const clampedScale = Math.max(
|
|
44
|
+
config.minScale,
|
|
45
|
+
Math.min(config.maxScale, rawScale)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return Number(clampedScale.toFixed(3));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Set the scaling configuration
|
|
53
|
+
* @param config - Partial scaling configuration to apply
|
|
54
|
+
*/
|
|
55
|
+
export function setScalingConfig(config: Partial<ScalingConfig>): void {
|
|
56
|
+
const currentConfig = scalingConfig.get();
|
|
57
|
+
const newConfig = { ...currentConfig, ...config };
|
|
58
|
+
scalingConfig.set(newConfig);
|
|
59
|
+
|
|
60
|
+
// Recalculate scaling factor if in browser
|
|
61
|
+
if (typeof window !== "undefined") {
|
|
62
|
+
updateScalingFactor();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Update the scaling factor based on current viewport
|
|
68
|
+
*/
|
|
69
|
+
export function updateScalingFactor(): void {
|
|
70
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
75
|
+
const config = scalingConfig.get();
|
|
76
|
+
const newFactor = calculateScalingFactor(viewportWidth, config);
|
|
77
|
+
|
|
78
|
+
scalingFactor.set(newFactor);
|
|
79
|
+
|
|
80
|
+
// Update CSS custom property
|
|
81
|
+
document.documentElement.style.setProperty("--sf", newFactor.toString());
|
|
82
|
+
|
|
83
|
+
// Dispatch event for components that need to react
|
|
84
|
+
window.dispatchEvent(
|
|
85
|
+
new CustomEvent("scaling-changed", {
|
|
86
|
+
detail: { scalingFactor: newFactor, config },
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the current scaling factor
|
|
93
|
+
* @returns The current scaling factor
|
|
94
|
+
*/
|
|
95
|
+
export function getScalingFactor(): number {
|
|
96
|
+
return scalingFactor.get();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Convert a design pixel value to scaled pixels
|
|
101
|
+
* @param designPx - The design pixel value (based on 280px width)
|
|
102
|
+
* @returns The scaled pixel value
|
|
103
|
+
*/
|
|
104
|
+
export function scale(designPx: number): number {
|
|
105
|
+
return designPx * scalingFactor.get();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Convert a scaled pixel value back to design pixels
|
|
110
|
+
* @param scaledPx - The scaled pixel value
|
|
111
|
+
* @returns The design pixel value
|
|
112
|
+
*/
|
|
113
|
+
export function unscale(scaledPx: number): number {
|
|
114
|
+
const factor = scalingFactor.get();
|
|
115
|
+
return factor === 0 ? scaledPx : scaledPx / factor;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Initialize scaling system
|
|
120
|
+
* This is typically called automatically when the module loads
|
|
121
|
+
*/
|
|
122
|
+
export function initScaling(): void {
|
|
123
|
+
if (typeof window === "undefined") {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Initial calculation
|
|
128
|
+
updateScalingFactor();
|
|
129
|
+
|
|
130
|
+
// Update on resize (debounced)
|
|
131
|
+
let resizeTimeout: ReturnType<typeof setTimeout>;
|
|
132
|
+
window.addEventListener("resize", () => {
|
|
133
|
+
clearTimeout(resizeTimeout);
|
|
134
|
+
resizeTimeout = setTimeout(() => {
|
|
135
|
+
updateScalingFactor();
|
|
136
|
+
}, 100);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Update on orientation change
|
|
140
|
+
window.addEventListener("orientationchange", () => {
|
|
141
|
+
setTimeout(updateScalingFactor, 100);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Auto-initialize when module loads in browser
|
|
146
|
+
if (typeof window !== "undefined") {
|
|
147
|
+
if (document.readyState === "loading") {
|
|
148
|
+
document.addEventListener("DOMContentLoaded", initScaling);
|
|
149
|
+
} else {
|
|
150
|
+
initScaling();
|
|
151
|
+
}
|
|
152
|
+
}
|
package/DS1/1-root/one.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* version 0.2.5-alpha.
|
|
1
|
+
/* version 0.2.5-alpha.19 */
|
|
2
2
|
|
|
3
3
|
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@200");
|
|
4
4
|
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@800");
|
|
@@ -33,6 +33,7 @@ input {
|
|
|
33
33
|
--slate: #1e1e1e;
|
|
34
34
|
--slate-light: #e6e6e6;
|
|
35
35
|
--slate-dark: #3c3c3c;
|
|
36
|
+
--stealth: #554455;
|
|
36
37
|
--black: #2a2a2a;
|
|
37
38
|
|
|
38
39
|
/* Accent/[color] */
|
|
@@ -52,7 +53,7 @@ input {
|
|
|
52
53
|
|
|
53
54
|
/* ds-grid color */
|
|
54
55
|
--grid-color: light-dark(var(--grid-color-light), var(--grid-color-dark));
|
|
55
|
-
--grid-color-light:
|
|
56
|
+
--grid-color-light: #1e1e1e2b;
|
|
56
57
|
--grid-color-dark: var(--white);
|
|
57
58
|
|
|
58
59
|
/* typefaces */
|
|
@@ -103,6 +104,7 @@ input {
|
|
|
103
104
|
--4: calc(var(--1) * 4);
|
|
104
105
|
--8: calc(var(--1) * 8);
|
|
105
106
|
--12: calc(var(--1) * 12);
|
|
107
|
+
--20: calc(var(--1) * 20);
|
|
106
108
|
|
|
107
109
|
/* Semantic sizing units */
|
|
108
110
|
|
|
@@ -116,15 +118,50 @@ input {
|
|
|
116
118
|
--quad: var(--4);
|
|
117
119
|
--oct: var(--8);
|
|
118
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";
|
|
119
144
|
|
|
120
145
|
/* size */
|
|
121
|
-
--outline-stroke: 1px solid
|
|
122
|
-
--outline-stroke-mobile:
|
|
123
|
-
light-dark(var(--black), var(--slate-dark));
|
|
146
|
+
--outline-stroke: 1px solid var(--slate-light);
|
|
147
|
+
--outline-stroke-mobile: 2px solid var(--sharp-blue);
|
|
124
148
|
--item-width: calc(79px * var(--sf));
|
|
125
149
|
--item-height: calc(19px * var(--sf));
|
|
126
150
|
--margin-correction: calc(1px * var(--sf));
|
|
127
151
|
|
|
152
|
+
--column-width: calc(var(--quad) * var(--sf));
|
|
153
|
+
|
|
154
|
+
--column-header-height: calc(var(--unit) * var(--sf));
|
|
155
|
+
--column-header-width: calc(var(--quad) * var(--sf));
|
|
156
|
+
|
|
157
|
+
/* ----------------------------------------------------------
|
|
158
|
+
SURFACE COLORS
|
|
159
|
+
-
|
|
160
|
+
---------------------------------------------------------- */
|
|
161
|
+
|
|
162
|
+
--background: light-dark(var(--white), var(--black));
|
|
163
|
+
--dialog-background: var(--background);
|
|
164
|
+
|
|
128
165
|
/* button */
|
|
129
166
|
--button-background-color-primary: var(--accent-color);
|
|
130
167
|
--button-background-color-secondary: light-dark(
|
|
@@ -138,7 +175,7 @@ input {
|
|
|
138
175
|
);
|
|
139
176
|
|
|
140
177
|
/* text-color */
|
|
141
|
-
--text-color
|
|
178
|
+
--text-color: light-dark(var(--black), var(--white));
|
|
142
179
|
--text-color-dimmed: light-dark(var(--slate), var(--slate-light));
|
|
143
180
|
|
|
144
181
|
/* icon colors */
|
|
@@ -183,7 +220,6 @@ body {
|
|
|
183
220
|
|
|
184
221
|
.matrix__board {
|
|
185
222
|
position: relative;
|
|
186
|
-
top: calc(21.5px * var(--sf));
|
|
187
223
|
left: calc(-20px * var(--sf));
|
|
188
224
|
width: calc(240px * var(--sf));
|
|
189
225
|
display: flex;
|
|
@@ -224,28 +260,22 @@ body {
|
|
|
224
260
|
height: var(--item-height);
|
|
225
261
|
margin-right: var(--margin-correction);
|
|
226
262
|
margin-bottom: var(--margin-correction);
|
|
227
|
-
outline: var(--outline-stroke);
|
|
228
263
|
background-color: light-dark(var(--white), var(--black));
|
|
229
264
|
}
|
|
230
265
|
|
|
231
266
|
.matrix__row-header {
|
|
232
267
|
position: relative;
|
|
233
|
-
top: calc(0.5px * var(--sf));
|
|
268
|
+
/* top: calc(0.5px * var(--sf)); */
|
|
234
269
|
display: flex;
|
|
235
270
|
align-items: center;
|
|
236
271
|
justify-content: center;
|
|
237
|
-
width: calc(
|
|
238
|
-
height: var(--
|
|
239
|
-
margin-right: var(--margin-correction);
|
|
240
|
-
margin-bottom: var(--margin-correction);
|
|
241
|
-
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); */
|
|
242
276
|
background-color: light-dark(rgb(220 241 213), var(--slate-dark));
|
|
243
277
|
}
|
|
244
278
|
|
|
245
|
-
.mobile .matrix__row-header {
|
|
246
|
-
outline: var(--outline-stroke-mobile);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
279
|
.matrix__column-content {
|
|
250
280
|
display: flex;
|
|
251
281
|
flex-direction: column;
|
package/DS1/2-core/ds-banner.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// ds-banner.ts
|
|
2
2
|
// Fixed banner component for notifications/alerts
|
|
3
3
|
|
|
4
|
-
import { LitElement, html,
|
|
4
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
5
5
|
import { getText } from "../0-face/i18n.js";
|
|
6
6
|
import "./ds-text.js";
|
|
7
7
|
import "./ds-button.js";
|
|
8
|
+
import styles from "./styles/ds-banner.css?inline";
|
|
8
9
|
|
|
9
10
|
declare global {
|
|
10
11
|
interface CustomElementRegistry {
|
|
@@ -53,82 +54,7 @@ export class Banner extends LitElement {
|
|
|
53
54
|
window.removeEventListener("language-changed", this._boundUpdate);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
static styles =
|
|
57
|
-
:host {
|
|
58
|
-
display: flex;
|
|
59
|
-
position: absolute;
|
|
60
|
-
top: 0;
|
|
61
|
-
left: 0;
|
|
62
|
-
right: 0;
|
|
63
|
-
width: 100%;
|
|
64
|
-
height: calc(var(--unit) * var(--sf, 1));
|
|
65
|
-
align-items: center;
|
|
66
|
-
justify-content: space-between;
|
|
67
|
-
padding: 0 calc(var(--unit) * var(--sf, 1));
|
|
68
|
-
box-sizing: border-box;
|
|
69
|
-
z-index: 9999;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
:host([variant="warning"]) {
|
|
73
|
-
background-color: color-mix(in srgb, var(--yellow) 50%, transparent);
|
|
74
|
-
--banner-text-color: color-mix(in srgb, var(--black) 50%, transparent);
|
|
75
|
-
--banner-action-color: var(--slate);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
:host([variant="info"]) {
|
|
79
|
-
background-color: rgba(var(--sharp-blue-rgb, 0, 122, 255), 0.7);
|
|
80
|
-
--banner-text-color: var(--white, #fff);
|
|
81
|
-
--banner-action-color: var(--white, #fff);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
:host([variant="success"]) {
|
|
85
|
-
background-color: rgba(var(--apple-green-rgb, 52, 199, 89), 0.7);
|
|
86
|
-
--banner-text-color: var(--white, #fff);
|
|
87
|
-
--banner-action-color: var(--white, #fff);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
:host([variant="error"]) {
|
|
91
|
-
background-color: rgba(var(--tuned-red-rgb, 255, 59, 48), 0.7);
|
|
92
|
-
--banner-text-color: var(--white, #fff);
|
|
93
|
-
--banner-action-color: var(--slate, #1e1e1e);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.text-wrapper {
|
|
97
|
-
flex: 1;
|
|
98
|
-
cursor: pointer;
|
|
99
|
-
user-select: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.text-wrapper ds-text,
|
|
103
|
-
.text-wrapper .version {
|
|
104
|
-
color: var(--banner-text-color);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.action-wrapper {
|
|
108
|
-
font-size: calc(12px * var(--sf, 1));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.action-wrapper a {
|
|
112
|
-
color: var(--banner-action-color);
|
|
113
|
-
text-decoration: none;
|
|
114
|
-
font-family: var(--typeface-regular);
|
|
115
|
-
font-size: calc(12px * var(--sf, 1));
|
|
116
|
-
cursor: pointer;
|
|
117
|
-
pointer-events: auto;
|
|
118
|
-
display: inline-block;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.action-wrapper a:hover {
|
|
122
|
-
opacity: 0.8;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.action-wrapper ds-text {
|
|
126
|
-
color: var(--banner-action-color);
|
|
127
|
-
font-family: var(--typeface-regular);
|
|
128
|
-
font-size: calc(12px * var(--sf, 1));
|
|
129
|
-
pointer-events: none;
|
|
130
|
-
}
|
|
131
|
-
`;
|
|
57
|
+
static styles = unsafeCSS(styles);
|
|
132
58
|
|
|
133
59
|
private _toggleVersion() {
|
|
134
60
|
if (this.version) {
|
package/DS1/2-core/ds-button.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// ds-button.ts
|
|
2
2
|
// Core button component
|
|
3
3
|
|
|
4
|
-
import { LitElement, html,
|
|
4
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
5
5
|
import "./ds-text";
|
|
6
|
+
import styles from "./styles/ds-button.css?inline";
|
|
6
7
|
|
|
7
8
|
export class Button extends LitElement {
|
|
8
9
|
static properties = {
|
|
@@ -53,72 +54,7 @@ export class Button extends LitElement {
|
|
|
53
54
|
this._loading = false;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
static styles =
|
|
57
|
-
button {
|
|
58
|
-
max-height: calc(var(--08) * var(--sf));
|
|
59
|
-
display: inline-flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
border: none;
|
|
63
|
-
cursor: pointer;
|
|
64
|
-
padding: 0 calc(0.5px * var(--sf));
|
|
65
|
-
color: var(--button-text-color);
|
|
66
|
-
font-family: var(--typeface-regular);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
button.title {
|
|
70
|
-
background-color: var(--button-background-color-secondary);
|
|
71
|
-
color: var(--button-text-color);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
button.primary {
|
|
75
|
-
background-color: var(--accent-color);
|
|
76
|
-
color: var(--button-text-color);
|
|
77
|
-
text-decoration-line: none;
|
|
78
|
-
font-family: var(--typeface-regular);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
button.secondary {
|
|
82
|
-
background-color: var(--button-background-color-secondary);
|
|
83
|
-
color: var(--button-text-color);
|
|
84
|
-
font-family: var(--typeface-regular);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
button.text {
|
|
88
|
-
background-color: transparent;
|
|
89
|
-
color: var(--button-color, var(--button-text-color));
|
|
90
|
-
font-family: var(--typeface-regular);
|
|
91
|
-
padding: 0;
|
|
92
|
-
text-decoration: none;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
button.text:hover {
|
|
96
|
-
opacity: 0.8;
|
|
97
|
-
text-decoration: none;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
button[bold] {
|
|
101
|
-
font-weight: var(--type-weight-bold);
|
|
102
|
-
font-family: var(--typeface-medium);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
button[no-background] {
|
|
106
|
-
background-color: transparent;
|
|
107
|
-
max-height: var(--1);
|
|
108
|
-
padding: 0;
|
|
109
|
-
color: var(--button-color, var(--button-text-color-secondary));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
button[no-background][bold] {
|
|
113
|
-
font-weight: var(--type-weight-bold);
|
|
114
|
-
font-family: var(--typeface-medium);
|
|
115
|
-
color: var(--button-color, var(--button-text-color-secondary));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.loading {
|
|
119
|
-
opacity: 0.7;
|
|
120
|
-
}
|
|
121
|
-
`;
|
|
57
|
+
static styles = unsafeCSS(styles);
|
|
122
58
|
|
|
123
59
|
connectedCallback() {
|
|
124
60
|
super.connectedCallback();
|