@multiplatform.one/platform 9.17.0 → 10.1.0
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/dist/cjs/config/config.cjs +63 -76
- package/dist/cjs/config/config.native.cjs +150 -0
- package/dist/cjs/config/config.storybook-expo.cjs +64 -73
- package/dist/cjs/config/config.storybook-expo.native.cjs +144 -0
- package/dist/cjs/config/devOrigin.cjs +23 -25
- package/dist/cjs/config/devOrigin.native.cjs +43 -0
- package/dist/cjs/config/devOriginSource.cjs +15 -21
- package/dist/cjs/config/devOriginSource.native.cjs +40 -0
- package/dist/cjs/config/index.cjs +14 -18
- package/dist/cjs/config/index.native.cjs +31 -0
- package/dist/cjs/config/runtimeConfig.cjs +63 -65
- package/dist/cjs/config/runtimeConfig.native.cjs +108 -0
- package/dist/cjs/config/types.cjs +9 -11
- package/dist/cjs/config/types.native.cjs +18 -0
- package/dist/cjs/file/index.cjs +15 -17
- package/dist/cjs/file/index.native.cjs +30 -0
- package/dist/cjs/file/saveFile.cjs +24 -34
- package/dist/cjs/file/saveFile.native.cjs +127 -0
- package/dist/cjs/file/types.cjs +39 -41
- package/dist/cjs/file/types.native.cjs +174 -0
- package/dist/cjs/helpers.cjs +38 -42
- package/dist/cjs/helpers.native.cjs +67 -0
- package/dist/cjs/index.cjs +35 -60
- package/dist/cjs/index.gnome.cjs +71 -96
- package/dist/cjs/index.gnome.native.cjs +110 -0
- package/dist/cjs/index.native.cjs +60 -0
- package/dist/cjs/platform/index.android.cjs +34 -0
- package/dist/cjs/platform/index.android.js +36 -0
- package/dist/cjs/platform/index.android.js.map +1 -0
- package/dist/cjs/platform/index.cjs +28 -32
- package/dist/cjs/platform/index.gnome.cjs +34 -45
- package/dist/cjs/platform/index.gnome.native.cjs +50 -0
- package/dist/cjs/platform/index.ios.cjs +34 -0
- package/dist/cjs/platform/index.ios.js +36 -0
- package/dist/cjs/platform/index.ios.js.map +1 -0
- package/dist/cjs/platform/index.native.cjs +58 -0
- package/dist/cjs/platform/index.tauri.cjs +30 -36
- package/dist/cjs/platform/index.tauri.native.cjs +49 -0
- package/dist/cjs/platform/platformBase.cjs +75 -63
- package/dist/cjs/platform/platformBase.native.cjs +129 -0
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/utils/clipboard.cjs +20 -24
- package/dist/cjs/utils/clipboard.native.cjs +34 -0
- package/dist/cjs/utils/cookie.cjs +30 -37
- package/dist/cjs/utils/cookie.native.cjs +40 -0
- package/dist/cjs/utils/downloadFile.cjs +30 -32
- package/dist/cjs/utils/downloadFile.native.cjs +34 -0
- package/dist/cjs/utils/lifecycle.cjs +34 -36
- package/dist/cjs/utils/lifecycle.native.cjs +62 -0
- package/dist/cjs/utils/openUrl.cjs +15 -19
- package/dist/cjs/utils/openUrl.native.cjs +29 -0
- package/dist/esm/config/config.mjs +52 -59
- package/dist/esm/config/config.mjs.map +1 -1
- package/dist/esm/config/config.storybook-expo.mjs +50 -48
- package/dist/esm/config/config.storybook-expo.mjs.map +1 -1
- package/dist/esm/config/devOrigin.mjs +10 -8
- package/dist/esm/config/devOrigin.mjs.map +1 -1
- package/dist/esm/config/devOriginSource.mjs +2 -3
- package/dist/esm/config/devOriginSource.mjs.map +1 -1
- package/dist/esm/config/index.mjs +8 -3
- package/dist/esm/config/index.mjs.map +1 -1
- package/dist/esm/config/runtimeConfig.mjs +43 -42
- package/dist/esm/config/runtimeConfig.mjs.map +1 -1
- package/dist/esm/config/types.mjs +0 -2
- package/dist/esm/file/index.mjs +2 -2
- package/dist/esm/file/saveFile.mjs +12 -16
- package/dist/esm/file/saveFile.mjs.map +1 -1
- package/dist/esm/file/types.mjs +25 -24
- package/dist/esm/file/types.mjs.map +1 -1
- package/dist/esm/helpers.mjs +23 -23
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/index.gnome.mjs +24 -45
- package/dist/esm/index.gnome.mjs.map +1 -1
- package/dist/esm/index.mjs +21 -33
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/platform/index.android.js +13 -0
- package/dist/esm/platform/index.android.js.map +1 -0
- package/dist/esm/platform/index.gnome.mjs +22 -27
- package/dist/esm/platform/index.gnome.mjs.map +1 -1
- package/dist/esm/platform/index.ios.js +13 -0
- package/dist/esm/platform/index.ios.js.map +1 -0
- package/dist/esm/platform/index.mjs +16 -14
- package/dist/esm/platform/index.mjs.map +1 -1
- package/dist/esm/platform/index.tauri.mjs +19 -19
- package/dist/esm/platform/index.tauri.mjs.map +1 -1
- package/dist/esm/platform/platformBase.mjs +62 -46
- package/dist/esm/platform/platformBase.mjs.map +1 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/utils/clipboard.mjs +7 -6
- package/dist/esm/utils/clipboard.mjs.map +1 -1
- package/dist/esm/utils/cookie.mjs +15 -19
- package/dist/esm/utils/cookie.mjs.map +1 -1
- package/dist/esm/utils/downloadFile.mjs +16 -15
- package/dist/esm/utils/downloadFile.mjs.map +1 -1
- package/dist/esm/utils/lifecycle.mjs +17 -16
- package/dist/esm/utils/lifecycle.mjs.map +1 -1
- package/dist/esm/utils/openUrl.mjs +2 -1
- package/dist/esm/utils/openUrl.mjs.map +1 -1
- package/package.json +8 -8
- package/src/file/saveFile.native.ts +1 -1
- package/src/platform/index.tauri.ts +1 -1
- package/src/platform/platformBase.ts +1 -1
- package/dist/esm/config/types.mjs.map +0 -1
- package/dist/esm/file/index.mjs.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
|
@@ -1,54 +1,70 @@
|
|
|
1
|
-
import { isChrome, isClient, isServer, isTouchable, isWeb, isWebTouchable
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"Tauri",
|
|
1
|
+
import { isBrowser, isChrome, isClient, isServer, isTouchable, isWeb, isWebTouchable } from "@tamagui/constants";
|
|
2
|
+
|
|
3
|
+
const platformOrder = [
|
|
4
|
+
"Ios",
|
|
5
|
+
"Android",
|
|
6
|
+
"Gnome",
|
|
7
|
+
"Native",
|
|
8
|
+
"Tauri",
|
|
9
|
+
"Desktop",
|
|
10
|
+
"ChromeExtension",
|
|
11
|
+
"FirefoxExtension",
|
|
12
|
+
"WebExtension",
|
|
13
|
+
"Next",
|
|
14
|
+
"Expo",
|
|
15
|
+
"Chrome",
|
|
16
|
+
"Firefox",
|
|
17
|
+
"Web",
|
|
18
|
+
"Browser",
|
|
19
|
+
"Client",
|
|
20
|
+
"Server",
|
|
21
|
+
"Iframe",
|
|
22
|
+
"Storybook"
|
|
23
|
+
];
|
|
9
24
|
const platformBase = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
isAndroid: false,
|
|
26
|
+
isBrowser: false,
|
|
27
|
+
isChrome,
|
|
28
|
+
isChromeExtension: false,
|
|
29
|
+
isClient,
|
|
30
|
+
isDesktop: false,
|
|
31
|
+
isExpo: false,
|
|
32
|
+
isFirefox: false,
|
|
33
|
+
isFirefoxExtension: false,
|
|
34
|
+
isGnome: false,
|
|
35
|
+
isIframe: false,
|
|
36
|
+
isIos: false,
|
|
37
|
+
isNative: false,
|
|
38
|
+
isNext: false,
|
|
39
|
+
isServer,
|
|
40
|
+
isStorybook: isBrowser && typeof window.__STORYBOOK_ADDONS_PREVIEW === "object",
|
|
41
|
+
isTauri: false,
|
|
42
|
+
isTouchable,
|
|
43
|
+
isWeb,
|
|
44
|
+
isWebExtension: false,
|
|
45
|
+
isWebTouchable,
|
|
46
|
+
isWindowDefined: isBrowser,
|
|
47
|
+
preciseName: "unknown",
|
|
48
|
+
broadName: "unknown"
|
|
34
49
|
};
|
|
35
50
|
function getPreciseName(platform) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
const flags = platform;
|
|
52
|
+
for (const name of platformOrder) {
|
|
53
|
+
if (flags[`is${name}`]) {
|
|
54
|
+
return `${name[0].toLowerCase()}${name.slice(1)}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return "unknown";
|
|
43
58
|
}
|
|
44
59
|
function getBroadName(platform) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
const flags = platform;
|
|
61
|
+
for (const name of platformOrder.slice().reverse()) {
|
|
62
|
+
if (flags[`is${name}`]) {
|
|
63
|
+
return `${name[0].toLowerCase()}${name.slice(1)}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return "unknown";
|
|
52
67
|
}
|
|
68
|
+
|
|
53
69
|
export { getBroadName, getPreciseName, platformBase };
|
|
54
70
|
//# sourceMappingURL=platformBase.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"platformBase.js","names":["isWindowDefined"],"sources":["esm/platform/platformBase.js"],"sourcesContent":["import {\n isBrowser as isWindowDefined,\n isChrome,\n isClient,\n isServer,\n isTouchable,\n isWeb,\n isWebTouchable\n} from \"@tamagui/constants\";\nconst platformOrder = [\n \"Ios\",\n \"Android\",\n // Gnome outranks Native: the GTK target reports isNative (it is not a\n // browser) but \"gnome\" is the precise answer callers want.\n \"Gnome\",\n \"Native\",\n // Tauri outranks Desktop/Web the same way: the webview host reports isWeb\n // and isDesktop, but \"tauri\" is the precise answer.\n \"Tauri\",\n \"Desktop\",\n \"ChromeExtension\",\n \"FirefoxExtension\",\n \"WebExtension\",\n \"Next\",\n \"Expo\",\n \"Chrome\",\n \"Firefox\",\n \"Web\",\n \"Browser\",\n \"Client\",\n \"Server\",\n \"Iframe\",\n \"Storybook\"\n];\nconst platformBase = {\n isAndroid: false,\n isBrowser: false,\n isChrome,\n isChromeExtension: false,\n isClient,\n isDesktop: false,\n isExpo: false,\n isFirefox: false,\n isFirefoxExtension: false,\n isGnome: false,\n isIframe: false,\n isIos: false,\n isNative: false,\n isNext: false,\n isServer,\n isStorybook: isWindowDefined && typeof window.__STORYBOOK_ADDONS_PREVIEW === \"object\",\n isTauri: false,\n isTouchable,\n isWeb,\n isWebExtension: false,\n isWebTouchable,\n isWindowDefined,\n preciseName: \"unknown\",\n broadName: \"unknown\"\n};\nfunction getPreciseName(platform) {\n const flags = platform;\n for (const name of platformOrder) {\n if (flags[`is${name}`]) {\n return `${name[0].toLowerCase()}${name.slice(1)}`;\n }\n }\n return \"unknown\";\n}\nfunction getBroadName(platform) {\n const flags = platform;\n for (const name of platformOrder.slice().reverse()) {\n if (flags[`is${name}`]) {\n return `${name[0].toLowerCase()}${name.slice(1)}`;\n }\n }\n return \"unknown\";\n}\nexport {\n getBroadName,\n getPreciseName,\n platformBase\n};\n//# sourceMappingURL=platformBase.js.map\n"],"mappings":";;;AASA,MAAM,gBAAgB;CACpB;CACA;CAGA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,eAAe;CACnB,WAAW;CACX,WAAW;CACX;CACA,mBAAmB;CACnB;CACA,WAAW;CACX,QAAQ;CACR,WAAW;CACX,oBAAoB;CACpB,SAAS;CACT,UAAU;CACV,OAAO;CACP,UAAU;CACV,QAAQ;CACR;CACA,aAAaA,aAAmB,OAAO,OAAO,+BAA+B;CAC7E,SAAS;CACT;CACA;CACA,gBAAgB;CAChB;CACA;CACA,aAAa;CACb,WAAW;AACb;AACA,SAAS,eAAe,UAAU;CAChC,MAAM,QAAQ;CACd,KAAK,MAAM,QAAQ,eAAe;EAChC,IAAI,MAAM,KAAK,SAAS;GACtB,OAAO,GAAG,KAAK,EAAE,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;EAChD;CACF;CACA,OAAO;AACT;AACA,SAAS,aAAa,UAAU;CAC9B,MAAM,QAAQ;CACd,KAAK,MAAM,QAAQ,cAAc,MAAM,CAAC,CAAC,QAAQ,GAAG;EAClD,IAAI,MAAM,KAAK,SAAS;GACtB,OAAO,GAAG,KAAK,EAAE,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;EAChD;CACF;CACA,OAAO;AACT"}
|
package/dist/esm/types.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
async function writeToClipboard(text) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
try {
|
|
3
|
+
await navigator.clipboard.writeText(text);
|
|
4
|
+
return true;
|
|
5
|
+
} catch {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
|
+
|
|
9
10
|
export { writeToClipboard };
|
|
10
11
|
//# sourceMappingURL=clipboard.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"clipboard.js","names":[],"sources":["esm/utils/clipboard.js"],"sourcesContent":["async function writeToClipboard(text) {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n return false;\n }\n}\nexport {\n writeToClipboard\n};\n//# sourceMappingURL=clipboard.js.map\n"],"mappings":";AAAA,eAAe,iBAAiB,MAAM;CACpC,IAAI;EACF,MAAM,UAAU,UAAU,UAAU,IAAI;EACxC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
function getCookie(name) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
if (typeof document === "undefined") return null;
|
|
3
|
+
const match = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "=([^;]*)"));
|
|
4
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
5
5
|
}
|
|
6
6
|
function setCookie(name, value, options = {}) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const expires = new Date(Date.now() + days * 864e5);
|
|
17
|
-
cookie += `; expires=${expires.toUTCString()}`;
|
|
18
|
-
}
|
|
19
|
-
if (secure) cookie += "; Secure";
|
|
20
|
-
document.cookie = cookie;
|
|
7
|
+
if (typeof document === "undefined") return;
|
|
8
|
+
const { days, path = "/", sameSite = "Lax", secure = false } = options;
|
|
9
|
+
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; path=${path}; SameSite=${sameSite}`;
|
|
10
|
+
if (days != null) {
|
|
11
|
+
const expires = new Date(Date.now() + days * 864e5);
|
|
12
|
+
cookie += `; expires=${expires.toUTCString()}`;
|
|
13
|
+
}
|
|
14
|
+
if (secure) cookie += "; Secure";
|
|
15
|
+
document.cookie = cookie;
|
|
21
16
|
}
|
|
22
17
|
function deleteCookie(name, path = "/") {
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
if (typeof document === "undefined") return;
|
|
19
|
+
document.cookie = `${encodeURIComponent(name)}=; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
25
20
|
}
|
|
21
|
+
|
|
26
22
|
export { deleteCookie, getCookie, setCookie };
|
|
27
23
|
//# sourceMappingURL=cookie.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"cookie.js","names":[],"sources":["esm/utils/cookie.js"],"sourcesContent":["function getCookie(name) {\n if (typeof document === \"undefined\") return null;\n const match = document.cookie.match(\n new RegExp(\"(?:^|; )\" + name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\") + \"=([^;]*)\")\n );\n return match ? decodeURIComponent(match[1]) : null;\n}\nfunction setCookie(name, value, options = {}) {\n if (typeof document === \"undefined\") return;\n const { days, path = \"/\", sameSite = \"Lax\", secure = false } = options;\n let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; path=${path}; SameSite=${sameSite}`;\n if (days != null) {\n const expires = new Date(Date.now() + days * 864e5);\n cookie += `; expires=${expires.toUTCString()}`;\n }\n if (secure) cookie += \"; Secure\";\n document.cookie = cookie;\n}\nfunction deleteCookie(name, path = \"/\") {\n if (typeof document === \"undefined\") return;\n document.cookie = `${encodeURIComponent(name)}=; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n}\nexport {\n deleteCookie,\n getCookie,\n setCookie\n};\n//# sourceMappingURL=cookie.js.map\n"],"mappings":";AAAA,SAAS,UAAU,MAAM;CACvB,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,MAAM,QAAQ,SAAS,OAAO,MAC5B,IAAI,OAAO,aAAa,KAAK,QAAQ,uBAAuB,MAAM,IAAI,UAAU,CAClF;CACA,OAAO,QAAQ,mBAAmB,MAAM,EAAE,IAAI;AAChD;AACA,SAAS,UAAU,MAAM,OAAO,UAAU,CAAC,GAAG;CAC5C,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,EAAE,MAAM,OAAO,KAAK,WAAW,OAAO,SAAS,UAAU;CAC/D,IAAI,SAAS,GAAG,mBAAmB,IAAI,EAAE,GAAG,mBAAmB,KAAK,EAAE,SAAS,KAAK,aAAa;CACjG,IAAI,QAAQ,MAAM;EAChB,MAAM,UAAU,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK;EAClD,UAAU,aAAa,QAAQ,YAAY;CAC7C;CACA,IAAI,QAAQ,UAAU;CACtB,SAAS,SAAS;AACpB;AACA,SAAS,aAAa,MAAM,OAAO,KAAK;CACtC,IAAI,OAAO,aAAa,aAAa;CACrC,SAAS,SAAS,GAAG,mBAAmB,IAAI,EAAE,UAAU,KAAK;AAC/D"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
function downloadFile(url, filename) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
const a = document.createElement("a");
|
|
3
|
+
a.href = url;
|
|
4
|
+
a.download = filename;
|
|
5
|
+
document.body.appendChild(a);
|
|
6
|
+
try {
|
|
7
|
+
a.click();
|
|
8
|
+
} finally {
|
|
9
|
+
a.remove();
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
12
|
function downloadBlob(blob, filename) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const url = URL.createObjectURL(blob);
|
|
14
|
+
try {
|
|
15
|
+
downloadFile(url, filename);
|
|
16
|
+
} finally {
|
|
17
|
+
setTimeout(() => URL.revokeObjectURL(url), 6e4);
|
|
18
|
+
}
|
|
19
19
|
}
|
|
20
|
+
|
|
20
21
|
export { downloadBlob, downloadFile };
|
|
21
22
|
//# sourceMappingURL=downloadFile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"downloadFile.js","names":[],"sources":["esm/utils/downloadFile.js"],"sourcesContent":["function downloadFile(url, filename) {\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = filename;\n document.body.appendChild(a);\n try {\n a.click();\n } finally {\n a.remove();\n }\n}\nfunction downloadBlob(blob, filename) {\n const url = URL.createObjectURL(blob);\n try {\n downloadFile(url, filename);\n } finally {\n setTimeout(() => URL.revokeObjectURL(url), 6e4);\n }\n}\nexport {\n downloadBlob,\n downloadFile\n};\n//# sourceMappingURL=downloadFile.js.map\n"],"mappings":";AAAA,SAAS,aAAa,KAAK,UAAU;CACnC,MAAM,IAAI,SAAS,cAAc,GAAG;CACpC,EAAE,OAAO;CACT,EAAE,WAAW;CACb,SAAS,KAAK,YAAY,CAAC;CAC3B,IAAI;EACF,EAAE,MAAM;CACV,UAAU;EACR,EAAE,OAAO;CACX;AACF;AACA,SAAS,aAAa,MAAM,UAAU;CACpC,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,IAAI;EACF,aAAa,KAAK,QAAQ;CAC5B,UAAU;EACR,iBAAiB,IAAI,gBAAgB,GAAG,GAAG,GAAG;CAChD;AACF"}
|
|
@@ -2,30 +2,31 @@ const noop = () => {};
|
|
|
2
2
|
const hasWindow = typeof window !== "undefined";
|
|
3
3
|
const hasDocument = typeof document !== "undefined";
|
|
4
4
|
function onAppFocus(callback) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
if (!hasWindow) return noop;
|
|
6
|
+
window.addEventListener("focus", callback);
|
|
7
|
+
return () => window.removeEventListener("focus", callback);
|
|
8
8
|
}
|
|
9
9
|
function onAppBlur(callback) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (!hasWindow) return noop;
|
|
11
|
+
window.addEventListener("blur", callback);
|
|
12
|
+
return () => window.removeEventListener("blur", callback);
|
|
13
13
|
}
|
|
14
14
|
function onOnline(callback) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (!hasWindow) return noop;
|
|
16
|
+
window.addEventListener("online", callback);
|
|
17
|
+
return () => window.removeEventListener("online", callback);
|
|
18
18
|
}
|
|
19
19
|
function onOffline(callback) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (!hasWindow) return noop;
|
|
21
|
+
window.addEventListener("offline", callback);
|
|
22
|
+
return () => window.removeEventListener("offline", callback);
|
|
23
23
|
}
|
|
24
24
|
function onVisibilityChange(callback) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (!hasDocument) return noop;
|
|
26
|
+
const handler = () => callback(document.visibilityState === "visible");
|
|
27
|
+
document.addEventListener("visibilitychange", handler);
|
|
28
|
+
return () => document.removeEventListener("visibilitychange", handler);
|
|
29
29
|
}
|
|
30
|
+
|
|
30
31
|
export { onAppBlur, onAppFocus, onOffline, onOnline, onVisibilityChange };
|
|
31
32
|
//# sourceMappingURL=lifecycle.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"lifecycle.js","names":[],"sources":["esm/utils/lifecycle.js"],"sourcesContent":["const noop = () => {\n};\nconst hasWindow = typeof window !== \"undefined\";\nconst hasDocument = typeof document !== \"undefined\";\nfunction onAppFocus(callback) {\n if (!hasWindow) return noop;\n window.addEventListener(\"focus\", callback);\n return () => window.removeEventListener(\"focus\", callback);\n}\nfunction onAppBlur(callback) {\n if (!hasWindow) return noop;\n window.addEventListener(\"blur\", callback);\n return () => window.removeEventListener(\"blur\", callback);\n}\nfunction onOnline(callback) {\n if (!hasWindow) return noop;\n window.addEventListener(\"online\", callback);\n return () => window.removeEventListener(\"online\", callback);\n}\nfunction onOffline(callback) {\n if (!hasWindow) return noop;\n window.addEventListener(\"offline\", callback);\n return () => window.removeEventListener(\"offline\", callback);\n}\nfunction onVisibilityChange(callback) {\n if (!hasDocument) return noop;\n const handler = () => callback(document.visibilityState === \"visible\");\n document.addEventListener(\"visibilitychange\", handler);\n return () => document.removeEventListener(\"visibilitychange\", handler);\n}\nexport {\n onAppBlur,\n onAppFocus,\n onOffline,\n onOnline,\n onVisibilityChange\n};\n//# sourceMappingURL=lifecycle.js.map\n"],"mappings":";AAAA,MAAM,aAAa,CACnB;AACA,MAAM,YAAY,OAAO,WAAW;AACpC,MAAM,cAAc,OAAO,aAAa;AACxC,SAAS,WAAW,UAAU;CAC5B,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,iBAAiB,SAAS,QAAQ;CACzC,aAAa,OAAO,oBAAoB,SAAS,QAAQ;AAC3D;AACA,SAAS,UAAU,UAAU;CAC3B,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,iBAAiB,QAAQ,QAAQ;CACxC,aAAa,OAAO,oBAAoB,QAAQ,QAAQ;AAC1D;AACA,SAAS,SAAS,UAAU;CAC1B,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,iBAAiB,UAAU,QAAQ;CAC1C,aAAa,OAAO,oBAAoB,UAAU,QAAQ;AAC5D;AACA,SAAS,UAAU,UAAU;CAC3B,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,iBAAiB,WAAW,QAAQ;CAC3C,aAAa,OAAO,oBAAoB,WAAW,QAAQ;AAC7D;AACA,SAAS,mBAAmB,UAAU;CACpC,IAAI,CAAC,aAAa,OAAO;CACzB,MAAM,gBAAgB,SAAS,SAAS,oBAAoB,SAAS;CACrE,SAAS,iBAAiB,oBAAoB,OAAO;CACrD,aAAa,SAAS,oBAAoB,oBAAoB,OAAO;AACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"openUrl.js","names":[],"sources":["esm/utils/openUrl.js"],"sourcesContent":["function openUrl(url, target = \"_blank\") {\n window.open(url, target, \"noopener,noreferrer\");\n}\nexport {\n openUrl\n};\n//# sourceMappingURL=openUrl.js.map\n"],"mappings":";AAAA,SAAS,QAAQ,KAAK,SAAS,UAAU;CACvC,OAAO,KAAK,KAAK,QAAQ,qBAAqB;AAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/platform",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Platform detection flags and utilities for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"detection",
|
|
@@ -54,23 +54,23 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@tamagui/constants": "2.
|
|
57
|
+
"@tamagui/constants": "3.2.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@multiplatform.one/config": "
|
|
61
|
-
"@tamagui/build": "2.
|
|
60
|
+
"@multiplatform.one/config": "10.1.0",
|
|
61
|
+
"@tamagui/build": "3.2.3",
|
|
62
62
|
"@types/chrome": "^0.3.5",
|
|
63
63
|
"@types/firefox-webext-browser": "^143.0.1",
|
|
64
64
|
"@vitest/coverage-v8": "^4.1.12",
|
|
65
|
-
"expo-file-system": "
|
|
65
|
+
"expo-file-system": "58.0.13",
|
|
66
66
|
"happy-dom": "^21.0.3",
|
|
67
|
-
"react": "19.
|
|
67
|
+
"react": "19.3.0",
|
|
68
68
|
"typescript": "~5.9.3",
|
|
69
69
|
"vitest": "^4.1.12"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"expo-constants": "~
|
|
73
|
-
"expo-file-system": "~
|
|
72
|
+
"expo-constants": "~58.0.15",
|
|
73
|
+
"expo-file-system": "~58.0.13",
|
|
74
74
|
"react": "^19.1.0",
|
|
75
75
|
"react-native": ">=0.83.0"
|
|
76
76
|
},
|
|
@@ -61,7 +61,7 @@ export async function saveFile(options: FileSaveOptions): Promise<FileSaveResult
|
|
|
61
61
|
// Android content URIs can contain opaque IDs instead of provider display names.
|
|
62
62
|
const filename =
|
|
63
63
|
platform.isIos && uri.startsWith("file://") ? { filename: lastSegment(uri) || name } : {};
|
|
64
|
-
file.write(input.bytes);
|
|
64
|
+
await file.write(input.bytes);
|
|
65
65
|
return {
|
|
66
66
|
status: "written",
|
|
67
67
|
uri,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["saveFile","FileSaveError"],"sources":["../../../src/file/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,aAAA,QAAqB","ignoreList":[]}
|
package/dist/esm/types.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|