@hkdigital/lib-core 0.5.30 → 0.5.31

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.
@@ -53,6 +53,7 @@
53
53
  * snippetPortrait?: GameBoxSnippet,
54
54
  * snippetRequireFullscreen?: GameBoxSnippet,
55
55
  * snippetInstallOnHomeScreen?: GameBoxSnippet,
56
+ * debug?: boolean,
56
57
  * [attr: string]: any
57
58
  * }}
58
59
  */
@@ -84,7 +85,9 @@
84
85
  snippetLandscape,
85
86
  snippetPortrait,
86
87
  snippetRequireFullscreen,
87
- snippetInstallOnHomeScreen
88
+ snippetInstallOnHomeScreen,
89
+
90
+ debug = false
88
91
  } = $props();
89
92
 
90
93
  // > Game dimensions and state
@@ -149,9 +152,15 @@
149
152
  isLandscape = !isPortraitMedia;
150
153
  });
151
154
 
152
- // $inspect('isLandscape', isLandscape);
153
- // $inspect('windowWidth/Height', windowWidth, windowHeight);
154
- // $inspect('iosWindowWidth/Height', iosWindowWidth, iosWindowHeight);
155
+ // Use $effect for conditional debugging instead of $inspect
156
+ $effect(() => {
157
+ if (debug) {
158
+ console.log('[GameBox] isLandscape:', isLandscape);
159
+ console.log('[GameBox] windowWidth/Height:', windowWidth, windowHeight);
160
+ console.log('[GameBox] iosWindowWidth/Height:',
161
+ iosWindowWidth, iosWindowHeight);
162
+ }
163
+ });
155
164
 
156
165
  // Update game dimensions based on window size and orientation
157
166
  $effect(() => {
@@ -163,12 +172,15 @@
163
172
  const availWidth = width - marginLeft - marginRight;
164
173
  const availHeight = height - marginTop - marginBottom;
165
174
 
166
- // console.debug('GameBox margins:', {
167
- // marginLeft,
168
- // marginRight,
169
- // marginTop,
170
- // marginBottom
171
- // });
175
+ if( debug )
176
+ {
177
+ console.debug('GameBox margins:', {
178
+ marginLeft,
179
+ marginRight,
180
+ marginTop,
181
+ marginBottom
182
+ });
183
+ }
172
184
 
173
185
  if (availWidth > availHeight) {
174
186
  gameWidthOnLandscape = getGameWidthOnLandscape({
@@ -231,13 +243,17 @@
231
243
  iosWindowWidth = window.innerWidth;
232
244
  iosWindowHeight = window.innerHeight;
233
245
  }
234
- // console.debug('updateIosWidthHeight', {
235
- // angle,
236
- // 'window.innerWidth': window.innerWidth,
237
- // 'window.innerHeight': window.innerHeight,
238
- // iosWindowWidth,
239
- // iosWindowHeight
240
- // });
246
+
247
+ if( debug )
248
+ {
249
+ console.debug('updateIosWidthHeight', {
250
+ angle,
251
+ 'window.innerWidth': window.innerWidth,
252
+ 'window.innerHeight': window.innerHeight,
253
+ iosWindowWidth,
254
+ iosWindowHeight
255
+ });
256
+ }
241
257
  }
242
258
  }
243
259
 
@@ -271,21 +287,24 @@
271
287
  // App visibility detection for iOS debugging
272
288
  const handleVisibilityChange = () => {
273
289
  if (document.visibilityState === 'visible') {
274
- // console.log('App became visible:', {
275
- // 'window.innerWidth': window.innerWidth,
276
- // 'window.innerHeight': window.innerHeight,
277
- // 'screen.width': screen.width,
278
- // 'screen.height': screen.height,
279
- // 'screen.orientation.angle': screen.orientation.angle,
280
- // 'screen.orientation.type': screen.orientation.type,
281
- // 'matchMedia portrait':
282
- // window.matchMedia('(orientation: portrait)').matches,
283
- // 'isLandscape': isLandscape,
284
- // 'gameWidth': gameWidth,
285
- // 'gameHeight': gameHeight,
286
- // 'iosWindowWidth': iosWindowWidth,
287
- // 'iosWindowHeight': iosWindowHeight
288
- // });
290
+
291
+ if( debug ) {
292
+ console.log('App became visible:', {
293
+ 'window.innerWidth': window.innerWidth,
294
+ 'window.innerHeight': window.innerHeight,
295
+ 'screen.width': screen.width,
296
+ 'screen.height': screen.height,
297
+ 'screen.orientation.angle': screen.orientation.angle,
298
+ 'screen.orientation.type': screen.orientation.type,
299
+ 'matchMedia portrait':
300
+ window.matchMedia('(orientation: portrait)').matches,
301
+ 'isLandscape': isLandscape,
302
+ 'gameWidth': gameWidth,
303
+ 'gameHeight': gameHeight,
304
+ 'iosWindowWidth': iosWindowWidth,
305
+ 'iosWindowHeight': iosWindowHeight
306
+ });
307
+ }
289
308
 
290
309
  // Force iOS dimension update when app becomes visible
291
310
  if (isPwa && isAppleMobile) {
@@ -45,6 +45,7 @@ type GameBox = {
45
45
  snippetPortrait?: Snippet<[SnippetParams]> | undefined;
46
46
  snippetRequireFullscreen?: Snippet<[SnippetParams]> | undefined;
47
47
  snippetInstallOnHomeScreen?: Snippet<[SnippetParams]> | undefined;
48
+ debug?: boolean | undefined;
48
49
  }>): void;
49
50
  };
50
51
  declare const GameBox: import("svelte").Component<{
@@ -91,4 +92,5 @@ declare const GameBox: import("svelte").Component<{
91
92
  snippetPortrait?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
92
93
  snippetRequireFullscreen?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
93
94
  snippetInstallOnHomeScreen?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
95
+ debug?: boolean;
94
96
  }, {}, "">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.5.30",
3
+ "version": "0.5.31",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"