@klodd/ds 3.14.2 → 3.14.4

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.
Files changed (2) hide show
  1. package/js/pwa-register.js +16 -24
  2. package/package.json +1 -1
@@ -62,28 +62,22 @@
62
62
  }
63
63
 
64
64
  /*------------------------------------------------------------
65
- Safe-area cold-start-fix (iOS PWA + Safari)
66
- iOS Safari beraknar env(safe-area-inset-bottom) felaktigt vid
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
-
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)
65
+ Cold-start scroll-guarantee (iOS PWA)
66
+ Om dokumentet inte ar scrollbart vid initial load triggar iOS
67
+ Safari aldrig en full viewport-stabilisering, vilket bl.a.
68
+ resulterar i felresolvad env(safe-area-inset-bottom). Fix: lagg
69
+ tillfaligt en padding-bottom som gor sidan scrollbar med 1px.
70
+ iOS stabiliserar sin viewport. Padding tas bort vid forsta
71
+ scroll-event sa layouten ar tillbaka till normal.
80
72
  ------------------------------------------------------------*/
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();
73
+ function ensureScrollable() {
74
+ if (doc.documentElement.scrollHeight <= root.innerHeight) {
75
+ doc.documentElement.style.paddingBottom = (root.innerHeight + 1) + 'px';
76
+ root.addEventListener('scroll', function cleanup() {
77
+ doc.documentElement.style.paddingBottom = '';
78
+ root.removeEventListener('scroll', cleanup);
79
+ }, { once: true });
80
+ }
87
81
  }
88
82
 
89
83
  /*------------------------------------------------------------
@@ -97,7 +91,5 @@
97
91
 
98
92
  registerSW(cfg);
99
93
 
100
- doc.addEventListener('DOMContentLoaded', forceSafeAreaOnNav);
101
- root.addEventListener('load', forceSafeAreaOnNav);
102
- root.addEventListener('pageshow', forceSafeAreaOnNav);
94
+ doc.addEventListener('DOMContentLoaded', ensureScrollable);
103
95
  })(typeof window !== 'undefined' ? window : globalThis, document);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klodd/ds",
3
- "version": "3.14.2",
3
+ "version": "3.14.4",
4
4
  "description": "Klodd shared design system - tokens, components, JS",
5
5
  "main": "css/index.css",
6
6
  "bin": {