@hkdigital/lib-core 0.5.36 → 0.5.38

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.
@@ -33,3 +33,4 @@ export type LogEventData = {
33
33
  export type LogEvent = LogEventData & {
34
34
  eventName?: string;
35
35
  };
36
+ export type Logger = import("./internal/logger/Logger.js").default;
@@ -18,4 +18,8 @@
18
18
  * eventName - Original event name if log came from an event (optional)
19
19
  */
20
20
 
21
+ /**
22
+ * @typedef {import('./internal/logger/Logger.js').default} Logger
23
+ */
24
+
21
25
  export default {};
@@ -138,20 +138,20 @@
138
138
  windowWidth &&
139
139
  windowHeight
140
140
  ) {
141
- updateIosWidthHeight();
141
+ updateIosWidthHeightAndOrientation();
142
142
  }
143
143
  });
144
144
 
145
145
  $effect(() => {
146
146
  // Use matchMedia as a trigger for orientation changes
147
- // The actual orientation is determined in updateIosWidthHeight()
147
+ // The actual orientation is determined in updateIosWidthHeightAndOrientation()
148
148
  if (typeof window !== 'undefined') {
149
149
  const isPortraitMedia =
150
150
  window.matchMedia('(orientation: portrait)').matches;
151
151
 
152
152
  // Trigger iOS dimension update when orientation might have changed
153
153
  if (isPwa && isAppleMobile) {
154
- updateIosWidthHeight();
154
+ updateIosWidthHeightAndOrientation();
155
155
  } else {
156
156
  // For non-iOS, matchMedia is reliable
157
157
  isLandscape = !isPortraitMedia;
@@ -238,16 +238,19 @@
238
238
 
239
239
  let supportsFullscreen = $state(false);
240
240
 
241
- function updateIosWidthHeight() {
242
- if (isPwa && isAppleMobile) {
241
+ function updateIosWidthHeightAndOrientation() {
242
+ if (isAppleMobile) {
243
+
244
+ // unreliable on ios >>
243
245
  // const angle = screen.orientation.angle;
244
- if( window.matchMedia('(orientation: portrait)').matches ) {
245
- isLandscape = false;
246
- }
247
- else {
248
- isLandscape = true;
249
- }
246
+ // if( window.matchMedia('(orientation: portrait)').matches ) {
247
+ // isLandscape = false;
248
+ // }
249
+ // else {
250
+ // isLandscape = true;
251
+ // }
250
252
 
253
+ // unreliable on ios >>
251
254
  // switch( screen.orientation.type ) {
252
255
  // case "portrait-primary":
253
256
  // case "portrait-secondary":
@@ -271,9 +274,17 @@
271
274
  iosWindowWidth = window.innerWidth;
272
275
  iosWindowHeight = window.innerHeight;
273
276
 
277
+ if( iosWindowHeight > iosWindowWidth )
278
+ {
279
+ isLandscape = false;
280
+ }
281
+ else {
282
+ isLandscape = true;
283
+ }
284
+
274
285
  if( debug )
275
286
  {
276
- console.debug('updateIosWidthHeight', {
287
+ console.debug('updateIosWidthHeightAndOrientation', {
277
288
  'screen.orientation.type': screen.orientation.type,
278
289
  isLandscape,
279
290
  'window.innerWidth': window.innerWidth,
@@ -298,16 +309,17 @@
298
309
 
299
310
  isPwa = getIsPwa();
300
311
 
301
- updateIosWidthHeight();
312
+ updateIosWidthHeightAndOrientation();
302
313
 
303
314
  // Listen for orientation changes using matchMedia (works on all iOS)
304
315
  const portraitMediaQuery = window.matchMedia('(orientation: portrait)');
305
316
  const handleOrientationChange = (e) => {
306
317
  // Update iOS dimensions if needed
307
- if (isPwa && isAppleMobile) {
308
- updateIosWidthHeight();
318
+ if (isAppleMobile) {
319
+ updateIosWidthHeightAndOrientation();
309
320
  } else {
310
321
  // For non-iOS, matchMedia is reliable
322
+ // as well is window width and height
311
323
  isLandscape = !e.matches;
312
324
  }
313
325
  };
@@ -337,7 +349,7 @@
337
349
 
338
350
  // Force iOS dimension update when app becomes visible
339
351
  if (isPwa && isAppleMobile) {
340
- updateIosWidthHeight();
352
+ updateIosWidthHeightAndOrientation();
341
353
  }
342
354
  }
343
355
  };
@@ -533,7 +545,7 @@
533
545
  gameHeight
534
546
  })}
535
547
  </ScaledContainer>
536
- {:else if isMobile && snippetInstallOnHomeScreen && !isDevMode}
548
+ {:else if isMobile && snippetInstallOnHomeScreen && !isPwa && !isDevMode}
537
549
  <!-- Require install on home screen on mobile -->
538
550
  <ScaledContainer
539
551
  enableScaling={enableScaling}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.5.36",
3
+ "version": "0.5.38",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"