@klodd/ds 3.14.0 → 3.14.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/css/00-primitives.css +2 -4
- package/js/pwa-register.js +22 -18
- package/package.json +1 -1
package/css/00-primitives.css
CHANGED
|
@@ -433,10 +433,8 @@
|
|
|
433
433
|
==== PWA / SAFE AREA
|
|
434
434
|
env(safe-area-inset-*) anvands for iOS-notch/home-indicator.
|
|
435
435
|
Touch-min 44px ar Apples HIG-rekommendation.
|
|
436
|
-
--viewport-height defaultar till 100vh
|
|
437
|
-
|
|
438
|
-
fungerar som iOS-cold-start-fix (lasningen tvingar WebKit
|
|
439
|
-
att stabilisera viewport-geometri).
|
|
436
|
+
--viewport-height defaultar till 100vh - reserverat for framtida
|
|
437
|
+
JS-driven viewport-hojd-konsument (ofarlig om oanvand).
|
|
440
438
|
================================================================ */
|
|
441
439
|
:root {
|
|
442
440
|
--safe-top: env(safe-area-inset-top, 0px);
|
package/js/pwa-register.js
CHANGED
|
@@ -62,23 +62,28 @@
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/*------------------------------------------------------------
|
|
65
|
-
|
|
65
|
+
Safe-area cold-start-fix (iOS PWA + Safari)
|
|
66
66
|
iOS Safari beraknar env(safe-area-inset-bottom) felaktigt vid
|
|
67
|
-
forsta render
|
|
68
|
-
|
|
69
|
-
tvingar WebKit att
|
|
70
|
-
layout-
|
|
67
|
+
forsta render - .bottom-nav landar pa fel position. Att appenda
|
|
68
|
+
ett fixed-positionerat probe-element och lasa dess
|
|
69
|
+
boundingClientRect tvingar WebKit att resolva env-varden i
|
|
70
|
+
layout-passet, vilket retroaktivt korrigerar pillen-positionen.
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
Probe + remove ar mer palitlig an att lasa computed style pa
|
|
73
|
+
.bottom-nav direkt - en frasch fixed-element pa varje event
|
|
74
|
+
tvingar layout regardless av cache-state.
|
|
75
|
+
|
|
76
|
+
Trippel-event-binding tacker alla cold-start-cases:
|
|
77
|
+
- DOMContentLoaded: tidigt efter document parsing
|
|
78
|
+
- load: efter att alla resurser (font, splash, etc.) laddats
|
|
79
|
+
- pageshow: iOS bfcache-restore (back/forward, switch tabs)
|
|
75
80
|
------------------------------------------------------------*/
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
81
|
+
function forceSafeAreaOnNav() {
|
|
82
|
+
const probe = doc.createElement('div');
|
|
83
|
+
probe.style.cssText = 'position:fixed;bottom:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none;';
|
|
84
|
+
doc.body.appendChild(probe);
|
|
85
|
+
void probe.getBoundingClientRect();
|
|
86
|
+
probe.remove();
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
/*------------------------------------------------------------
|
|
@@ -92,8 +97,7 @@
|
|
|
92
97
|
|
|
93
98
|
registerSW(cfg);
|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
syncViewport();
|
|
100
|
+
doc.addEventListener('DOMContentLoaded', forceSafeAreaOnNav);
|
|
101
|
+
root.addEventListener('load', forceSafeAreaOnNav);
|
|
102
|
+
root.addEventListener('pageshow', forceSafeAreaOnNav);
|
|
99
103
|
})(typeof window !== 'undefined' ? window : globalThis, document);
|