@hkdigital/lib-core 0.5.17 → 0.5.18

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.
@@ -87,74 +87,8 @@ declare const GameBox: import("svelte").Component<{
87
87
  max: number;
88
88
  };
89
89
  };
90
- snippetLandscape?: import("svelte").Snippet<[{
91
- isLandscape: boolean;
92
- isPortrait: boolean;
93
- isMobile: boolean;
94
- isIos: boolean;
95
- isAndroid: boolean;
96
- os: "Android" | "iOS";
97
- isFullscreen: boolean;
98
- isDevMode: boolean;
99
- requestDevmode: Function;
100
- requestFullscreen: Function;
101
- gameWidth: number;
102
- gameHeight: number;
103
- }]>;
104
- snippetPortrait?: import("svelte").Snippet<[{
105
- isLandscape: boolean;
106
- isPortrait: boolean;
107
- isMobile: boolean;
108
- isIos: boolean;
109
- isAndroid: boolean;
110
- os: "Android" | "iOS";
111
- isFullscreen: boolean;
112
- isDevMode: boolean;
113
- requestDevmode: Function;
114
- requestFullscreen: Function;
115
- gameWidth: number;
116
- gameHeight: number;
117
- }]>;
118
- snippetRequireFullscreen?: import("svelte").Snippet<[{
119
- isLandscape: boolean;
120
- isPortrait: boolean;
121
- isMobile: boolean;
122
- isIos: boolean;
123
- isAndroid: boolean;
124
- os: "Android" | "iOS";
125
- isFullscreen: boolean;
126
- isDevMode: boolean;
127
- requestDevmode: Function;
128
- requestFullscreen: Function;
129
- gameWidth: number;
130
- gameHeight: number;
131
- }]>;
132
- snippetInstallOnHomeScreen?: import("svelte").Snippet<[{
133
- isLandscape: boolean;
134
- isPortrait: boolean;
135
- isMobile: boolean;
136
- isIos: boolean;
137
- isAndroid: boolean;
138
- os: "Android" | "iOS";
139
- isFullscreen: boolean;
140
- isDevMode: boolean;
141
- requestDevmode: Function;
142
- requestFullscreen: Function;
143
- gameWidth: number;
144
- gameHeight: number;
145
- }]>;
90
+ snippetLandscape?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
91
+ snippetPortrait?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
92
+ snippetRequireFullscreen?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
93
+ snippetInstallOnHomeScreen?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
146
94
  }, {}, "">;
147
- type SnippetParams = {
148
- isLandscape: boolean;
149
- isPortrait: boolean;
150
- isMobile: boolean;
151
- isIos: boolean;
152
- isAndroid: boolean;
153
- os: "Android" | "iOS";
154
- isFullscreen: boolean;
155
- isDevMode: boolean;
156
- requestDevmode: Function;
157
- requestFullscreen: Function;
158
- gameWidth: number;
159
- gameHeight: number;
160
- };
@@ -1,27 +1,3 @@
1
- /**
2
- * Check if the device is running iOS (iPhone, iPod, or iPad)
3
- *
4
- * @returns {boolean} true if iOS device
5
- */
6
- export function isIOS(): boolean;
7
- /**
8
- * Check if the device is running iPadOS
9
- *
10
- * @returns {boolean} true if iPadOS device
11
- */
12
- export function isIpadOS(): boolean;
13
- /**
14
- * Get the operating system of the device
15
- *
16
- * @returns {'iOS'|'Android'|'unknown'} operating system
17
- */
18
- export function getOS(): "iOS" | "Android" | "unknown";
19
- /**
20
- * Check if the device is a mobile phone or tablet
21
- *
22
- * @returns {boolean} true if mobile device
23
- */
24
- export function getIsMobile(): boolean;
25
1
  /**
26
2
  * Get game width for landscape mode
27
3
  *
@@ -2,67 +2,6 @@ export const ERROR_WINDOW_SIZE_NOT_LANDSCAPE = 'Window size is not landsccape';
2
2
 
3
3
  export const ERROR_WINDOW_SIZE_NOT_PORTRAIT = 'Window size is not portrait';
4
4
 
5
- /**
6
- * Check if the device is running iOS (iPhone, iPod, or iPad)
7
- *
8
- * @returns {boolean} true if iOS device
9
- */
10
- export function isIOS() {
11
- if (/iPad|iPhone|iPod/.test(navigator.platform)) {
12
- return true;
13
- } else {
14
- return navigator.maxTouchPoints &&
15
- navigator.maxTouchPoints > 2 &&
16
- /MacIntel/.test(navigator.platform);
17
- }
18
- }
19
-
20
- /**
21
- * Check if the device is running iPadOS
22
- *
23
- * @returns {boolean} true if iPadOS device
24
- */
25
- export function isIpadOS() {
26
- return navigator.maxTouchPoints &&
27
- navigator.maxTouchPoints > 2 &&
28
- /MacIntel/.test(navigator.platform);
29
- }
30
-
31
- /**
32
- * Get the operating system of the device
33
- *
34
- * @returns {'iOS'|'Android'|'unknown'} operating system
35
- */
36
- export function getOS() {
37
- if (isIOS()) {
38
- return 'iOS';
39
- } else if (/Android/.test(navigator.userAgent)) {
40
- return 'Android';
41
- } else {
42
- return 'unknown';
43
- }
44
- }
45
-
46
- /**
47
- * Check if the device is a mobile phone or tablet
48
- *
49
- * @returns {boolean} true if mobile device
50
- */
51
- export function getIsMobile() {
52
- // @ts-ignore
53
- if (navigator?.userAgentData?.mobile !== undefined) {
54
- // Supports for mobile flag
55
- // @ts-ignore
56
- return navigator.userAgentData.mobile;
57
- } else if (isIOS()) {
58
- return true;
59
- } else if (/Android/.test(navigator.userAgent)) {
60
- return true;
61
- }
62
-
63
- return false;
64
- }
65
-
66
5
  /**
67
6
  * Get game width for landscape mode
68
7
  *
@@ -0,0 +1,16 @@
1
+ export type SnippetParams = {
2
+ isLandscape: boolean;
3
+ isPortrait: boolean;
4
+ isMobile: boolean;
5
+ isIos: boolean;
6
+ isAndroid: boolean;
7
+ isIpadOS: boolean;
8
+ isPwa: boolean;
9
+ isFullscreen: boolean;
10
+ isDevMode: boolean;
11
+ requestDevmode: Function;
12
+ requestFullscreen: Function;
13
+ gameWidth: number;
14
+ gameHeight: number;
15
+ };
16
+ export type GameBoxSnippet = import("svelte").Snippet<[SnippetParams]>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @typedef {{
3
+ * isLandscape: boolean,
4
+ * isPortrait: boolean,
5
+ * isMobile: boolean,
6
+ * isIos: boolean,
7
+ * isAndroid: boolean,
8
+ * isIpadOS: boolean,
9
+ * isPwa: boolean,
10
+ * isFullscreen: boolean,
11
+ * isDevMode: boolean,
12
+ * requestDevmode: function,
13
+ * requestFullscreen: function,
14
+ * gameWidth: number,
15
+ * gameHeight: number
16
+ * }} SnippetParams
17
+ */
18
+
19
+ /**
20
+ * @typedef {import('svelte').Snippet<[SnippetParams]>} GameBoxSnippet
21
+ */
22
+
23
+ export {};
@@ -1,5 +1,6 @@
1
1
  export * from "./button-group/typedef.js";
2
2
  export * from "./drag-drop/typedef.js";
3
+ export * from "./game-box/typedef.js";
3
4
  export * from "./image-box/typedef.js";
4
5
  export * from "./presenter/typedef.js";
5
6
  export * from "./tab-bar/typedef.js";
@@ -1,5 +1,6 @@
1
1
  export * from './button-group/typedef.js';
2
2
  export * from './drag-drop/typedef.js';
3
+ export * from './game-box/typedef.js';
3
4
  export * from './image-box/typedef.js';
4
5
  export * from './presenter/typedef.js';
5
6
  export * from './tab-bar/typedef.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.5.17",
3
+ "version": "0.5.18",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"