@uniweb/kit 0.9.40 → 0.9.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/kit",
3
- "version": "0.9.40",
3
+ "version": "0.9.41",
4
4
  "description": "Standard component library for Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -191,10 +191,22 @@ export function matchesShortcut(event, descriptor) {
191
191
  * `userAgentData.platform` is the modern signal; `navigator.platform` is
192
192
  * deprecated but still the most widely accurate fallback.
193
193
  *
194
- * @returns {boolean} false when there is no navigator (SSR).
194
+ * **A `navigator` check alone is not enough, and the failure is nasty.**
195
+ * Node 21+ defines `globalThis.navigator`, and on macOS its `platform` reads
196
+ * `'MacIntel'` — so during prerender this returned true and baked ⌘ into
197
+ * static HTML based on the machine that ran the BUILD. Every visitor then got
198
+ * the build box's platform, and the same source produced different output on a
199
+ * Mac laptop and a Linux CI runner.
200
+ *
201
+ * `document` is the discriminator: Node defines a navigator but never a DOM.
202
+ * Prerender therefore emits the non-Apple spelling, and the client corrects it
203
+ * on mount — which is safe here because the runtime always createRoots and
204
+ * never hydrates, so there is no mismatch to reconcile.
205
+ *
206
+ * @returns {boolean} false anywhere that is not a real browser.
195
207
  */
196
208
  export function isApplePlatform() {
197
- if (typeof navigator === 'undefined') return false
209
+ if (typeof document === 'undefined' || typeof navigator === 'undefined') return false
198
210
  const modern = navigator.userAgentData?.platform
199
211
  if (typeof modern === 'string' && modern) return /mac|ios|iphone|ipad/i.test(modern)
200
212
  return /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent || '')