@multiplatform.one/platform 6.0.4 → 6.3.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.
Files changed (97) hide show
  1. package/README.md +53 -0
  2. package/dist/cjs/config/config.cjs +81 -0
  3. package/dist/cjs/config/config.storybook-expo.cjs +87 -0
  4. package/dist/cjs/config/index.cjs +31 -0
  5. package/dist/cjs/config/types.cjs +18 -0
  6. package/dist/cjs/helpers.cjs +65 -0
  7. package/dist/cjs/index.cjs +81 -0
  8. package/dist/cjs/platform/index.cjs +49 -0
  9. package/dist/cjs/platform/index.tauri.cjs +53 -0
  10. package/dist/cjs/platform/platformBase.cjs +74 -0
  11. package/dist/cjs/types.cjs +18 -0
  12. package/dist/cjs/utils/clipboard.cjs +35 -0
  13. package/dist/cjs/utils/cookie.cjs +54 -0
  14. package/dist/cjs/utils/downloadFile.cjs +41 -0
  15. package/dist/cjs/utils/lifecycle.cjs +60 -0
  16. package/dist/cjs/utils/openUrl.cjs +30 -0
  17. package/dist/esm/config/config.mjs +55 -0
  18. package/dist/esm/config/config.mjs.map +1 -0
  19. package/dist/esm/config/config.storybook-expo.mjs +51 -0
  20. package/dist/esm/config/config.storybook-expo.mjs.map +1 -0
  21. package/dist/esm/config/index.mjs +5 -0
  22. package/dist/esm/config/index.mjs.map +1 -0
  23. package/dist/esm/config/types.mjs +2 -0
  24. package/dist/esm/config/types.mjs.map +1 -0
  25. package/dist/esm/helpers.mjs +37 -0
  26. package/dist/esm/helpers.mjs.map +1 -0
  27. package/dist/esm/index.mjs +35 -0
  28. package/dist/esm/index.mjs.map +1 -0
  29. package/dist/esm/platform/index.mjs +24 -0
  30. package/dist/esm/platform/index.mjs.map +1 -0
  31. package/dist/esm/platform/index.tauri.mjs +28 -0
  32. package/dist/esm/platform/index.tauri.mjs.map +1 -0
  33. package/dist/esm/platform/platformBase.mjs +47 -0
  34. package/dist/esm/platform/platformBase.mjs.map +1 -0
  35. package/dist/esm/types.mjs +2 -0
  36. package/dist/esm/types.mjs.map +1 -0
  37. package/dist/esm/utils/clipboard.mjs +10 -0
  38. package/dist/esm/utils/clipboard.mjs.map +1 -0
  39. package/dist/esm/utils/cookie.mjs +27 -0
  40. package/dist/esm/utils/cookie.mjs.map +1 -0
  41. package/dist/esm/utils/downloadFile.mjs +15 -0
  42. package/dist/esm/utils/downloadFile.mjs.map +1 -0
  43. package/dist/esm/utils/lifecycle.mjs +31 -0
  44. package/dist/esm/utils/lifecycle.mjs.map +1 -0
  45. package/dist/esm/utils/openUrl.mjs +5 -0
  46. package/dist/esm/utils/openUrl.mjs.map +1 -0
  47. package/package.json +29 -7
  48. package/types/config/config.d.ts +16 -0
  49. package/types/config/config.d.ts.map +1 -0
  50. package/types/config/config.native.d.ts +16 -0
  51. package/types/config/config.native.d.ts.map +1 -0
  52. package/types/config/config.storybook-expo.d.ts +16 -0
  53. package/types/config/config.storybook-expo.d.ts.map +1 -0
  54. package/types/config/index.d.ts +5 -0
  55. package/types/config/index.d.ts.map +1 -0
  56. package/types/config/types.d.ts +7 -0
  57. package/types/config/types.d.ts.map +1 -0
  58. package/types/helpers.d.ts +7 -0
  59. package/types/helpers.d.ts.map +1 -0
  60. package/types/index.d.ts +11 -0
  61. package/types/index.d.ts.map +1 -0
  62. package/types/platform/index.android.d.ts +3 -0
  63. package/types/platform/index.android.d.ts.map +1 -0
  64. package/types/platform/index.d.ts +11 -0
  65. package/types/platform/index.d.ts.map +1 -0
  66. package/types/platform/index.ios.d.ts +3 -0
  67. package/types/platform/index.ios.d.ts.map +1 -0
  68. package/types/platform/index.tauri.d.ts +11 -0
  69. package/types/platform/index.tauri.d.ts.map +1 -0
  70. package/types/platform/platformBase.d.ts +59 -0
  71. package/types/platform/platformBase.d.ts.map +1 -0
  72. package/types/types.d.ts +3 -0
  73. package/types/types.d.ts.map +1 -0
  74. package/types/utils/clipboard.d.ts +2 -0
  75. package/types/utils/clipboard.d.ts.map +1 -0
  76. package/types/utils/clipboard.native.d.ts +2 -0
  77. package/types/utils/clipboard.native.d.ts.map +1 -0
  78. package/types/utils/cookie.d.ts +9 -0
  79. package/types/utils/cookie.d.ts.map +1 -0
  80. package/types/utils/cookie.native.d.ts +4 -0
  81. package/types/utils/cookie.native.d.ts.map +1 -0
  82. package/types/utils/downloadFile.d.ts +3 -0
  83. package/types/utils/downloadFile.d.ts.map +1 -0
  84. package/types/utils/downloadFile.native.d.ts +3 -0
  85. package/types/utils/downloadFile.native.d.ts.map +1 -0
  86. package/types/utils/lifecycle.d.ts +11 -0
  87. package/types/utils/lifecycle.d.ts.map +1 -0
  88. package/types/utils/lifecycle.native.d.ts +6 -0
  89. package/types/utils/lifecycle.native.d.ts.map +1 -0
  90. package/types/utils/openUrl.d.ts +2 -0
  91. package/types/utils/openUrl.d.ts.map +1 -0
  92. package/types/utils/openUrl.native.d.ts +2 -0
  93. package/types/utils/openUrl.native.d.ts.map +1 -0
  94. package/CHANGELOG.md +0 -20
  95. package/tsconfig.json +0 -7
  96. package/tsconfig.tsbuildinfo +0 -1
  97. package/vitest.config.mjs +0 -9
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @multiplatform.one/platform
2
+
3
+ Platform detection flags and small cross-platform utilities for
4
+ multiplatform.one — one import to answer "where is this code running?" on web,
5
+ native, desktop, and extension surfaces.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @multiplatform.one/platform
11
+ ```
12
+
13
+ ## What it owns
14
+
15
+ - **Detection flags** — `isWeb`, `isNative`, `isIos`, `isAndroid`, `isServer`,
16
+ `isClient`, `isTauri`, `isDesktop`, `isExpo`, `isNext`, `isStorybook`,
17
+ `isChrome`, `isFirefox`, `isWebExtension`, `isChromeExtension`,
18
+ `isFirefoxExtension`, `isIframe`, `isTouchable`, `isWebTouchable`,
19
+ `isWindowDefined`, … plus the full `platform` object (`platform.preciseName`)
20
+ - **Env config** — the `config` reader used across packages
21
+ - **Utilities** — cookies, clipboard, `downloadFile`, `openUrl`, lifecycle
22
+ helpers
23
+
24
+ ## What it must not do
25
+
26
+ - No UI, no theming, no data fetching — packages above it (`theme`, `core`,
27
+ `logger`, …) build on these flags, so this package stays dependency-light
28
+
29
+ ## Usage
30
+
31
+ ```tsx
32
+ import { isNative, isServer, isTauri } from "@multiplatform.one/platform";
33
+
34
+ export function saveFile(contents: string) {
35
+ if (isServer) return;
36
+ if (isTauri) {
37
+ // desktop path (see @multiplatform.one/desktop)
38
+ return;
39
+ }
40
+ if (isNative) {
41
+ // share sheet / expo-file-system path
42
+ return;
43
+ }
44
+ // browser download path
45
+ }
46
+ ```
47
+
48
+ Flags are evaluated once at module load and are safe to use in render logic
49
+ and module scope.
50
+
51
+ ## License
52
+
53
+ Apache-2.0
@@ -0,0 +1,81 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var config_exports = {};
24
+ __export(config_exports, {
25
+ Config: () => Config
26
+ });
27
+ module.exports = __toCommonJS(config_exports);
28
+ const import_meta = {};
29
+ class Config {
30
+ _config = {};
31
+ _blacklist = /* @__PURE__ */new Set([]);
32
+ _lookupEnv(key) {
33
+ if (this._blacklist.has(key)) return void 0;
34
+ return process?.env?.[key];
35
+ }
36
+ _resolveConfig() {
37
+ return Object.keys(this._config).reduce((config, key) => {
38
+ const value = this._lookupEnv(key) || this._config[key];
39
+ if (typeof value !== "undefined") config[key] = value;
40
+ return config;
41
+ }, {});
42
+ }
43
+ _reduceConfig(config = {}) {
44
+ return Object.entries(config).reduce((config2, [key, value]) => {
45
+ if (typeof value !== "undefined") config2[key] = value.toString();
46
+ return config2;
47
+ }, {});
48
+ }
49
+ constructor(config = {}) {
50
+ let viteConfig = {};
51
+ try {
52
+ const raw = typeof import_meta !== "undefined" && import_meta.env?.VITE_MP_CONFIG;
53
+ viteConfig = JSON.parse(raw || "{}");
54
+ } catch {}
55
+ this._config = {
56
+ ...this._reduceConfig(typeof viteConfig === "object" ? viteConfig : {}),
57
+ ...this._reduceConfig(config)
58
+ };
59
+ }
60
+ get(key, defaultValue) {
61
+ const config = this._resolveConfig();
62
+ if (!key) return config;
63
+ return config[key] || defaultValue;
64
+ }
65
+ set(key, value) {
66
+ this._config[key] = value;
67
+ return value;
68
+ }
69
+ add(value) {
70
+ this._config = {
71
+ ...this._config,
72
+ ...value
73
+ };
74
+ return this.get();
75
+ }
76
+ remove(key) {
77
+ const value = this.get(key);
78
+ delete this._config[key];
79
+ return value;
80
+ }
81
+ }
@@ -0,0 +1,87 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var config_storybook_expo_exports = {};
35
+ __export(config_storybook_expo_exports, {
36
+ Config: () => Config
37
+ });
38
+ module.exports = __toCommonJS(config_storybook_expo_exports);
39
+ var import_expo_constants = __toESM(require("expo-constants"));
40
+ class Config {
41
+ _config = {};
42
+ _blacklist = /* @__PURE__ */new Set([]);
43
+ _lookupEnv(key) {
44
+ if (this._blacklist.has(key)) return void 0;
45
+ return process?.env?.[key];
46
+ }
47
+ _resolveConfig() {
48
+ return Object.keys(this._config).reduce((config, key) => {
49
+ const value = this._lookupEnv(key) || this._config[key];
50
+ if (typeof value !== "undefined") config[key] = value;
51
+ return config;
52
+ }, {});
53
+ }
54
+ _reduceConfig(config = {}) {
55
+ return Object.entries(config).reduce((config2, [key, value]) => {
56
+ if (typeof value !== "undefined") config2[key] = value.toString();
57
+ return config2;
58
+ }, {});
59
+ }
60
+ constructor(config = {}) {
61
+ this._config = {
62
+ ...this._reduceConfig(import_expo_constants.default.expoConfig?.extra || {}),
63
+ ...this._reduceConfig(config)
64
+ };
65
+ }
66
+ get(key, defaultValue) {
67
+ const config = this._resolveConfig();
68
+ if (!key) return config;
69
+ return config[key] || defaultValue;
70
+ }
71
+ set(key, value) {
72
+ this._config[key] = value;
73
+ return value;
74
+ }
75
+ add(value) {
76
+ this._config = {
77
+ ...this._config,
78
+ ...value
79
+ };
80
+ return this.get();
81
+ }
82
+ remove(key) {
83
+ const value = this.get(key);
84
+ delete this._config[key];
85
+ return value;
86
+ }
87
+ }
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ value: true
23
+ }), mod);
24
+ var config_exports = {};
25
+ __export(config_exports, {
26
+ config: () => config
27
+ });
28
+ module.exports = __toCommonJS(config_exports);
29
+ var import_config = require("./config.cjs");
30
+ __reExport(config_exports, require("./config.cjs"), module.exports);
31
+ const config = new import_config.Config();
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: true
16
+ }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var helpers_exports = {};
24
+ __export(helpers_exports, {
25
+ createWithLayout: () => createWithLayout,
26
+ fastUnique: () => fastUnique,
27
+ isDev: () => isDev,
28
+ isText: () => isText
29
+ });
30
+ module.exports = __toCommonJS(helpers_exports);
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ const isPerformanceNow = typeof performance !== "undefined" && performance.now;
33
+ const date = isPerformanceNow ? performance : Date;
34
+ let _previousUnique;
35
+ function fastUnique() {
36
+ let unique = date.now();
37
+ while (unique === _previousUnique) {
38
+ unique = date.now();
39
+ }
40
+ _previousUnique = unique;
41
+ if (isPerformanceNow) return Date.now() + unique.toString();
42
+ return unique.toString();
43
+ }
44
+ function isText(children) {
45
+ if (Array.isArray(children)) {
46
+ return children.length > 1 && typeof children[0] === "string" && "_owner" in children[1] && "_store" in children[1] && "key" in children[1] && "props" in children[1] && "ref" in children[1] && "type" in children[1];
47
+ }
48
+ return typeof children === "string";
49
+ }
50
+ function createWithLayout(Layout, extraLayouts = [], layoutProps) {
51
+ return Component => {
52
+ return flattenLayouts(props => /* @__PURE__ */(0, import_jsx_runtime.jsx)(Layout, {
53
+ ...layoutProps,
54
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
55
+ ...props
56
+ })
57
+ }), extraLayouts);
58
+ };
59
+ }
60
+ function flattenLayouts(layout, [...layouts]) {
61
+ const currentLayout = layouts.pop();
62
+ if (!currentLayout) return layout;
63
+ return flattenLayouts(currentLayout(layout), layouts);
64
+ }
65
+ const isDev = process.env.NODE_ENV === "development" || typeof __DEV__ !== "undefined" && __DEV__;
@@ -0,0 +1,81 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ value: true
23
+ }), mod);
24
+ var index_exports = {};
25
+ __export(index_exports, {
26
+ isAndroid: () => isAndroid,
27
+ isBrowser: () => isBrowser,
28
+ isChrome: () => isChrome,
29
+ isChromeExtension: () => isChromeExtension,
30
+ isClient: () => isClient,
31
+ isDesktop: () => isDesktop,
32
+ isExpo: () => isExpo,
33
+ isFirefox: () => isFirefox,
34
+ isFirefoxExtension: () => isFirefoxExtension,
35
+ isIframe: () => isIframe,
36
+ isIos: () => isIos,
37
+ isNative: () => isNative,
38
+ isNext: () => isNext,
39
+ isServer: () => isServer,
40
+ isStorybook: () => isStorybook,
41
+ isTauri: () => isTauri,
42
+ isTouchable: () => isTouchable,
43
+ isWeb: () => isWeb,
44
+ isWebExtension: () => isWebExtension,
45
+ isWebTouchable: () => isWebTouchable,
46
+ isWindowDefined: () => isWindowDefined
47
+ });
48
+ module.exports = __toCommonJS(index_exports);
49
+ var import_platform = require("./platform/index.cjs");
50
+ __reExport(index_exports, require("./platform/index.cjs"), module.exports);
51
+ __reExport(index_exports, require("./helpers.cjs"), module.exports);
52
+ __reExport(index_exports, require("./types.cjs"), module.exports);
53
+ __reExport(index_exports, require("./config/index.cjs"), module.exports);
54
+ __reExport(index_exports, require("./utils/cookie.cjs"), module.exports);
55
+ __reExport(index_exports, require("./utils/downloadFile.cjs"), module.exports);
56
+ __reExport(index_exports, require("./utils/clipboard.cjs"), module.exports);
57
+ __reExport(index_exports, require("./utils/openUrl.cjs"), module.exports);
58
+ __reExport(index_exports, require("./utils/lifecycle.cjs"), module.exports);
59
+ const {
60
+ isAndroid,
61
+ isBrowser,
62
+ isChrome,
63
+ isChromeExtension,
64
+ isClient,
65
+ isExpo,
66
+ isFirefox,
67
+ isFirefoxExtension,
68
+ isIframe,
69
+ isIos,
70
+ isNative,
71
+ isNext,
72
+ isServer,
73
+ isStorybook,
74
+ isTauri,
75
+ isDesktop,
76
+ isTouchable,
77
+ isWeb,
78
+ isWebExtension,
79
+ isWebTouchable,
80
+ isWindowDefined
81
+ } = import_platform.platform;
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var platform_exports = {};
24
+ __export(platform_exports, {
25
+ platform: () => platform
26
+ });
27
+ module.exports = __toCommonJS(platform_exports);
28
+ var import_platformBase = require("./platformBase.cjs");
29
+ const isIframe = (() => {
30
+ if (!import_platformBase.platformBase.isWindowDefined) return false;
31
+ try {
32
+ return window.self !== window.top;
33
+ } catch {
34
+ return true;
35
+ }
36
+ })();
37
+ const isWebExtension = !!(typeof chrome !== "undefined" && !!chrome?.runtime?.id || typeof browser !== "undefined" && !!browser?.runtime?.id);
38
+ const platform = {
39
+ ...import_platformBase.platformBase,
40
+ isChromeExtension: typeof chrome !== "undefined" && !!chrome?.runtime?.id,
41
+ isFirefoxExtension: typeof browser !== "undefined" && !!browser?.runtime?.id,
42
+ isIframe,
43
+ isWebExtension,
44
+ isBrowser: !!(import_platformBase.platformBase.isWeb && import_platformBase.platformBase.isWindowDefined && !isWebExtension),
45
+ isNext: import_platformBase.platformBase.isWeb && (!import_platformBase.platformBase.isWindowDefined || typeof window.__NEXT_DATA__ === "object"),
46
+ isFirefox: import_platformBase.platformBase.isWindowDefined && !!(window?.navigator?.userAgent?.toLowerCase().indexOf("firefox") > -1)
47
+ };
48
+ platform.preciseName = (0, import_platformBase.getPreciseName)(platform);
49
+ platform.broadName = (0, import_platformBase.getBroadName)(platform);
@@ -0,0 +1,53 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var index_tauri_exports = {};
24
+ __export(index_tauri_exports, {
25
+ platform: () => platform
26
+ });
27
+ module.exports = __toCommonJS(index_tauri_exports);
28
+ var import_constants = require("@tamagui/constants");
29
+ var import_platformBase = require("./platformBase.cjs");
30
+ const isIframe = (() => {
31
+ if (!import_constants.isWindowDefined) return false;
32
+ try {
33
+ return window.self !== window.top;
34
+ } catch {
35
+ return true;
36
+ }
37
+ })();
38
+ const platform = {
39
+ ...import_platformBase.platformBase,
40
+ isBrowser: false,
41
+ isChrome: import_constants.isChrome,
42
+ isClient: import_constants.isClient,
43
+ isIframe,
44
+ isServer: import_constants.isServer,
45
+ isWeb: import_constants.isWeb,
46
+ isWebTouchable: import_constants.isWebTouchable,
47
+ // Tauri-specific flags - using the same interface structure
48
+ // Platform detection: Tauri injects __TAURI_INTERNALS__ at runtime
49
+ isTauri: true,
50
+ isDesktop: true
51
+ };
52
+ platform.preciseName = (0, import_platformBase.getPreciseName)(platform);
53
+ platform.broadName = (0, import_platformBase.getBroadName)(platform);
@@ -0,0 +1,74 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var platformBase_exports = {};
24
+ __export(platformBase_exports, {
25
+ getBroadName: () => getBroadName,
26
+ getPreciseName: () => getPreciseName,
27
+ platformBase: () => platformBase
28
+ });
29
+ module.exports = __toCommonJS(platformBase_exports);
30
+ var import_constants = require("@tamagui/constants");
31
+ const platformOrder = ["Ios", "Android", "Native", "Tauri", "Desktop", "ChromeExtension", "FirefoxExtension", "WebExtension", "Next", "Expo", "Chrome", "Firefox", "Web", "Browser", "Client", "Server", "Iframe", "Storybook"];
32
+ const platformBase = {
33
+ isAndroid: false,
34
+ isBrowser: false,
35
+ isChrome: import_constants.isChrome,
36
+ isChromeExtension: false,
37
+ isClient: import_constants.isClient,
38
+ isDesktop: false,
39
+ isExpo: false,
40
+ isFirefox: false,
41
+ isFirefoxExtension: false,
42
+ isIframe: false,
43
+ isIos: false,
44
+ isNative: false,
45
+ isNext: false,
46
+ isServer: import_constants.isServer,
47
+ isStorybook: import_constants.isWindowDefined && typeof window.__STORYBOOK_ADDONS_PREVIEW === "object",
48
+ isTauri: false,
49
+ isTouchable: import_constants.isTouchable,
50
+ isWeb: import_constants.isWeb,
51
+ isWebExtension: false,
52
+ isWebTouchable: import_constants.isWebTouchable,
53
+ isWindowDefined: import_constants.isWindowDefined,
54
+ preciseName: "unknown",
55
+ broadName: "unknown"
56
+ };
57
+ function getPreciseName(platform) {
58
+ const flags = platform;
59
+ for (const name of platformOrder) {
60
+ if (flags[`is${name}`]) {
61
+ return `${name[0].toLowerCase()}${name.slice(1)}`;
62
+ }
63
+ }
64
+ return "unknown";
65
+ }
66
+ function getBroadName(platform) {
67
+ const flags = platform;
68
+ for (const name of platformOrder.slice().reverse()) {
69
+ if (flags[`is${name}`]) {
70
+ return `${name[0].toLowerCase()}${name.slice(1)}`;
71
+ }
72
+ }
73
+ return "unknown";
74
+ }
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: true
16
+ }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var clipboard_exports = {};
24
+ __export(clipboard_exports, {
25
+ writeToClipboard: () => writeToClipboard
26
+ });
27
+ module.exports = __toCommonJS(clipboard_exports);
28
+ async function writeToClipboard(text) {
29
+ try {
30
+ await navigator.clipboard.writeText(text);
31
+ return true;
32
+ } catch {
33
+ return false;
34
+ }
35
+ }