@multiplatform.one/core 7.83.1 → 7.84.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/app/CreateApp.cjs +233 -0
- package/dist/cjs/app/CreateApp.native.js +253 -0
- package/dist/cjs/app/CreateApp.native.js.map +1 -0
- package/dist/cjs/app/CreateRootLayout.cjs +181 -0
- package/dist/cjs/app/CreateRootLayout.native.js +115 -0
- package/dist/cjs/app/CreateRootLayout.native.js.map +1 -0
- package/dist/cjs/app/RuntimePublicConfigScript.cjs +40 -0
- package/dist/cjs/app/RuntimePublicConfigScript.native.js +48 -0
- package/dist/cjs/app/RuntimePublicConfigScript.native.js.map +1 -0
- package/dist/cjs/app/TanstackDevtools.cjs +145 -0
- package/dist/cjs/app/TanstackDevtools.native.js +163 -0
- package/dist/cjs/app/TanstackDevtools.native.js.map +1 -0
- package/dist/cjs/app/TanstackProvider.cjs +81 -0
- package/dist/cjs/app/TanstackProvider.native.js +56 -0
- package/dist/cjs/app/TanstackProvider.native.js.map +1 -0
- package/dist/cjs/app/deepLinkPath.cjs +41 -0
- package/dist/cjs/app/deepLinkPath.native.js +46 -0
- package/dist/cjs/app/deepLinkPath.native.js.map +1 -0
- package/dist/cjs/app/devtoolsTrigger.cjs +281 -0
- package/dist/cjs/app/devtoolsTrigger.native.js +338 -0
- package/dist/cjs/app/devtoolsTrigger.native.js.map +1 -0
- package/dist/cjs/app/frappeSocketPort.cjs +40 -0
- package/dist/cjs/app/frappeSocketPort.native.js +45 -0
- package/dist/cjs/app/frappeSocketPort.native.js.map +1 -0
- package/dist/cjs/app/frappeSyncOptions.cjs +43 -0
- package/dist/cjs/app/frappeSyncOptions.native.js +46 -0
- package/dist/cjs/app/frappeSyncOptions.native.js.map +1 -0
- package/dist/cjs/app/index.cjs +22 -0
- package/dist/cjs/app/index.native.js +25 -0
- package/dist/cjs/app/index.native.js.map +1 -0
- package/dist/cjs/app/loadWalletProvider.cjs +32 -0
- package/dist/cjs/app/loadWalletProvider.native.js +44 -0
- package/dist/cjs/app/loadWalletProvider.native.js.map +1 -0
- package/dist/cjs/app/oneFrappeNavigation.cjs +45 -0
- package/dist/cjs/app/oneFrappeNavigation.native.js +52 -0
- package/dist/cjs/app/oneFrappeNavigation.native.js.map +1 -0
- package/dist/cjs/app/rootLayoutShared.cjs +18 -0
- package/dist/cjs/app/rootLayoutShared.native.js +21 -0
- package/dist/cjs/app/rootLayoutShared.native.js.map +1 -0
- package/dist/cjs/app/runtimePublicConfigMiddleware.cjs +50 -0
- package/dist/cjs/app/runtimePublicConfigMiddleware.native.js +55 -0
- package/dist/cjs/app/runtimePublicConfigMiddleware.native.js.map +1 -0
- package/dist/cjs/app/useNativeDeepLinks.cjs +28 -0
- package/dist/cjs/app/useNativeDeepLinks.native.js +56 -0
- package/dist/cjs/app/useNativeDeepLinks.native.js.map +1 -0
- package/dist/cjs/healthz.cjs +32 -0
- package/dist/cjs/healthz.native.js +35 -0
- package/dist/cjs/healthz.native.js.map +1 -0
- package/dist/cjs/index.cjs +21 -0
- package/dist/cjs/index.native.js +24 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/layouts/CreateDefaultLayout.cjs +99 -0
- package/dist/cjs/layouts/CreateDefaultLayout.native.js +105 -0
- package/dist/cjs/layouts/CreateDefaultLayout.native.js.map +1 -0
- package/dist/cjs/layouts/index.cjs +28 -0
- package/dist/cjs/layouts/index.native.js +31 -0
- package/dist/cjs/layouts/index.native.js.map +1 -0
- package/dist/esm/app/CreateApp.mjs +196 -0
- package/dist/esm/app/CreateApp.mjs.map +1 -0
- package/dist/esm/app/CreateApp.native.js +213 -0
- package/dist/esm/app/CreateApp.native.js.map +1 -0
- package/dist/esm/app/CreateRootLayout.mjs +145 -0
- package/dist/esm/app/CreateRootLayout.mjs.map +1 -0
- package/dist/esm/app/CreateRootLayout.native.js +76 -0
- package/dist/esm/app/CreateRootLayout.native.js.map +1 -0
- package/dist/esm/app/RuntimePublicConfigScript.mjs +15 -0
- package/dist/esm/app/RuntimePublicConfigScript.mjs.map +1 -0
- package/dist/esm/app/RuntimePublicConfigScript.native.js +20 -0
- package/dist/esm/app/RuntimePublicConfigScript.native.js.map +1 -0
- package/dist/esm/app/TanstackDevtools.mjs +109 -0
- package/dist/esm/app/TanstackDevtools.mjs.map +1 -0
- package/dist/esm/app/TanstackDevtools.native.js +124 -0
- package/dist/esm/app/TanstackDevtools.native.js.map +1 -0
- package/dist/esm/app/TanstackProvider.mjs +45 -0
- package/dist/esm/app/TanstackProvider.mjs.map +1 -0
- package/dist/esm/app/TanstackProvider.native.js +28 -0
- package/dist/esm/app/TanstackProvider.native.js.map +1 -0
- package/dist/esm/app/deepLinkPath.mjs +16 -0
- package/dist/esm/app/deepLinkPath.mjs.map +1 -0
- package/dist/esm/app/deepLinkPath.native.js +18 -0
- package/dist/esm/app/deepLinkPath.native.js.map +1 -0
- package/dist/esm/app/devtoolsTrigger.mjs +238 -0
- package/dist/esm/app/devtoolsTrigger.mjs.map +1 -0
- package/dist/esm/app/devtoolsTrigger.native.js +292 -0
- package/dist/esm/app/devtoolsTrigger.native.js.map +1 -0
- package/dist/esm/app/frappeSocketPort.mjs +15 -0
- package/dist/esm/app/frappeSocketPort.mjs.map +1 -0
- package/dist/esm/app/frappeSocketPort.native.js +17 -0
- package/dist/esm/app/frappeSocketPort.native.js.map +1 -0
- package/dist/esm/app/frappeSyncOptions.mjs +18 -0
- package/dist/esm/app/frappeSyncOptions.mjs.map +1 -0
- package/dist/esm/app/frappeSyncOptions.native.js +18 -0
- package/dist/esm/app/frappeSyncOptions.native.js.map +1 -0
- package/dist/esm/app/index.mjs +4 -0
- package/dist/esm/app/index.mjs.map +1 -0
- package/dist/esm/app/index.native.js +4 -0
- package/dist/esm/app/index.native.js.map +1 -0
- package/dist/esm/app/loadWalletProvider.mjs +7 -0
- package/dist/esm/app/loadWalletProvider.mjs.map +1 -0
- package/dist/esm/app/loadWalletProvider.native.js +16 -0
- package/dist/esm/app/loadWalletProvider.native.js.map +1 -0
- package/dist/esm/app/oneFrappeNavigation.mjs +20 -0
- package/dist/esm/app/oneFrappeNavigation.mjs.map +1 -0
- package/dist/esm/app/oneFrappeNavigation.native.js +24 -0
- package/dist/esm/app/oneFrappeNavigation.native.js.map +1 -0
- package/dist/esm/app/rootLayoutShared.mjs +2 -0
- package/dist/esm/app/rootLayoutShared.mjs.map +1 -0
- package/dist/esm/app/rootLayoutShared.native.js +2 -0
- package/dist/esm/app/rootLayoutShared.native.js.map +1 -0
- package/dist/esm/app/runtimePublicConfigMiddleware.mjs +25 -0
- package/dist/esm/app/runtimePublicConfigMiddleware.mjs.map +1 -0
- package/dist/esm/app/runtimePublicConfigMiddleware.native.js +27 -0
- package/dist/esm/app/runtimePublicConfigMiddleware.native.js.map +1 -0
- package/dist/esm/app/useNativeDeepLinks.mjs +3 -0
- package/dist/esm/app/useNativeDeepLinks.mjs.map +1 -0
- package/dist/esm/app/useNativeDeepLinks.native.js +28 -0
- package/dist/esm/app/useNativeDeepLinks.native.js.map +1 -0
- package/dist/esm/healthz.mjs +7 -0
- package/dist/esm/healthz.mjs.map +1 -0
- package/dist/esm/healthz.native.js +7 -0
- package/dist/esm/healthz.native.js.map +1 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +3 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/layouts/CreateDefaultLayout.mjs +74 -0
- package/dist/esm/layouts/CreateDefaultLayout.mjs.map +1 -0
- package/dist/esm/layouts/CreateDefaultLayout.native.js +77 -0
- package/dist/esm/layouts/CreateDefaultLayout.native.js.map +1 -0
- package/dist/esm/layouts/index.mjs +3 -0
- package/dist/esm/layouts/index.mjs.map +1 -0
- package/dist/esm/layouts/index.native.js +3 -0
- package/dist/esm/layouts/index.native.js.map +1 -0
- package/package.json +32 -16
- package/src/app/CreateApp.frappeAuth.spec.tsx +73 -0
- package/src/app/CreateApp.tsx +23 -23
- package/src/app/CreateRootLayout.web.spec.tsx +15 -0
|
@@ -0,0 +1,181 @@
|
|
|
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 CreateRootLayout_web_exports = {};
|
|
35
|
+
__export(CreateRootLayout_web_exports, {
|
|
36
|
+
createRootLayout: () => createRootLayout
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(CreateRootLayout_web_exports);
|
|
39
|
+
var import_i18next = __toESM(require("i18next"));
|
|
40
|
+
var import_tamagui = require("tamagui");
|
|
41
|
+
var import_one = require("one");
|
|
42
|
+
var import_react = require("react");
|
|
43
|
+
var import_react_cookie = require("react-cookie");
|
|
44
|
+
var import_react_i18next = require("react-i18next");
|
|
45
|
+
var import_platform = require("@multiplatform.one/platform");
|
|
46
|
+
var import_i18n = require("@multiplatform.one/i18n");
|
|
47
|
+
var import_logger = require("@multiplatform.one/logger");
|
|
48
|
+
var import_store = require("@multiplatform.one/store");
|
|
49
|
+
var import_scale_attribute = require("@multiplatform.one/theme/scale-attribute");
|
|
50
|
+
var import_RuntimePublicConfigScript = require("./RuntimePublicConfigScript.cjs");
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
function createRootLayout(cfg) {
|
|
53
|
+
if (typeof window !== "undefined") {
|
|
54
|
+
try {
|
|
55
|
+
const storedValue = import_store.storage.getItem("vxrn-scheme");
|
|
56
|
+
const stored = typeof storedValue === "string" || storedValue === null ? storedValue : null;
|
|
57
|
+
if (stored === "light" || stored === "dark" || stored === "system") {
|
|
58
|
+
(0, import_one.setUserScheme)(stored);
|
|
59
|
+
} else {
|
|
60
|
+
(0, import_one.setUserScheme)("system");
|
|
61
|
+
}
|
|
62
|
+
} catch {}
|
|
63
|
+
}
|
|
64
|
+
import_i18next.default.use(import_react_i18next.initReactI18next).init((0, import_i18n.createI18nConfig)(cfg.i18n)).catch(import_logger.logger.error);
|
|
65
|
+
import_i18next.default.changeLanguage(import_platform.config.get("I18N_DEFAULT_LANGUAGE", cfg.i18n.defaultLanguage));
|
|
66
|
+
const sentryDsn = cfg.sentry?.dsn || import_platform.config.get("SENTRY_DSN");
|
|
67
|
+
if (sentryDsn && !import_platform.platform.isServer) {
|
|
68
|
+
import("@sentry/react").then(Sentry => {
|
|
69
|
+
Sentry.init({
|
|
70
|
+
dsn: sentryDsn,
|
|
71
|
+
enabled: !import_platform.isDev
|
|
72
|
+
});
|
|
73
|
+
}).catch(() => {});
|
|
74
|
+
}
|
|
75
|
+
const {
|
|
76
|
+
AppProvider,
|
|
77
|
+
RootLayout
|
|
78
|
+
} = cfg;
|
|
79
|
+
function WebRootProvider({
|
|
80
|
+
children
|
|
81
|
+
}) {
|
|
82
|
+
const {
|
|
83
|
+
value: scheme
|
|
84
|
+
} = (0, import_one.useUserScheme)();
|
|
85
|
+
const hydrated = (0, import_tamagui.useDidFinishSSR)();
|
|
86
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AppProvider, {
|
|
87
|
+
systemTheme: hydrated ? scheme : "light",
|
|
88
|
+
children
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
WebRootProvider.displayName = "WebRootProvider";
|
|
92
|
+
function Layout() {
|
|
93
|
+
const matches = (0, import_one.useMatches)();
|
|
94
|
+
const rootLoaderData = matches?.[0]?.loaderData;
|
|
95
|
+
const ssrCookies = import_platform.platform.isServer && rootLoaderData?.cookieHeader ? new import_react_cookie.Cookies(rootLoaderData.cookieHeader) : void 0;
|
|
96
|
+
const [clientScale] = (0, import_react.useState)(() => import_platform.platform.isServer ? void 0 : (0, import_scale_attribute.scaleAttributeFromCookie)(new import_react_cookie.Cookies().get(import_scale_attribute.cookiePreset)));
|
|
97
|
+
const presetScale = ssrCookies ? (0, import_scale_attribute.scaleAttributeFromCookie)(ssrCookies.get(import_scale_attribute.cookiePreset)) : clientScale;
|
|
98
|
+
const htmlLang = rootLoaderData?.detectedLanguage || import_i18next.default.language || cfg.i18n.defaultLanguage || "en";
|
|
99
|
+
if (import_platform.platform.isServer && rootLoaderData?.detectedLanguage && import_i18next.default.language !== rootLoaderData.detectedLanguage) {
|
|
100
|
+
import_i18next.default.changeLanguage(rootLoaderData.detectedLanguage);
|
|
101
|
+
}
|
|
102
|
+
const interFonts = cfg.head?.interFonts !== false;
|
|
103
|
+
const interFontCss = ['@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:optional;src:url("/fonts/inter-400.woff2") format("woff2")}', '@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:optional;src:url("/fonts/inter-500.woff2") format("woff2")}', '@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:optional;src:url("/fonts/inter-600.woff2") format("woff2")}', '@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:optional;src:url("/fonts/inter-700.woff2") format("woff2")}', '@font-face{font-family:"Inter";font-style:normal;font-weight:800;font-display:optional;src:url("/fonts/inter-800.woff2") format("woff2")}'].join("");
|
|
104
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)("html", {
|
|
105
|
+
lang: htmlLang,
|
|
106
|
+
"data-mp-scale": presetScale,
|
|
107
|
+
suppressHydrationWarning: true,
|
|
108
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)("head", {
|
|
109
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("meta", {
|
|
110
|
+
charSet: "utf-8"
|
|
111
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("script", {
|
|
112
|
+
dangerouslySetInnerHTML: {
|
|
113
|
+
__html: import_scale_attribute.scaleAttributeScript
|
|
114
|
+
},
|
|
115
|
+
suppressHydrationWarning: true
|
|
116
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_RuntimePublicConfigScript.RuntimePublicConfigScript, {}), interFonts && /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
117
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("link", {
|
|
118
|
+
rel: "preload",
|
|
119
|
+
href: "/fonts/inter-400.woff2",
|
|
120
|
+
as: "font",
|
|
121
|
+
type: "font/woff2",
|
|
122
|
+
crossOrigin: ""
|
|
123
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("link", {
|
|
124
|
+
rel: "preload",
|
|
125
|
+
href: "/fonts/inter-600.woff2",
|
|
126
|
+
as: "font",
|
|
127
|
+
type: "font/woff2",
|
|
128
|
+
crossOrigin: ""
|
|
129
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("link", {
|
|
130
|
+
rel: "preload",
|
|
131
|
+
href: "/fonts/inter-700.woff2",
|
|
132
|
+
as: "font",
|
|
133
|
+
type: "font/woff2",
|
|
134
|
+
crossOrigin: ""
|
|
135
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("link", {
|
|
136
|
+
rel: "preload",
|
|
137
|
+
href: "/fonts/inter-800.woff2",
|
|
138
|
+
as: "font",
|
|
139
|
+
type: "font/woff2",
|
|
140
|
+
crossOrigin: ""
|
|
141
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
|
|
142
|
+
precedence: "reset",
|
|
143
|
+
href: "__font_inter",
|
|
144
|
+
children: interFontCss
|
|
145
|
+
})]
|
|
146
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
|
|
147
|
+
precedence: "reset",
|
|
148
|
+
href: "__critical_reset",
|
|
149
|
+
children: ["html{max-width:100vw;color-scheme:light dark}", "body{overflow-x:hidden;margin:0;display:flex;flex-direction:column;min-width:100%;min-height:100vh}", "#root,#__next{display:flex;flex-direction:column;min-width:100%;min-height:100vh}", "*{box-sizing:border-box}", "a{color:inherit;text-decoration:none}", "h1,h2,h3,h4,h5,h6{margin:0;padding:0}", "p,input,textarea,button,ul,ol,li,pre,dialog{all:unset;box-sizing:border-box}"].join("")
|
|
150
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("meta", {
|
|
151
|
+
name: "viewport",
|
|
152
|
+
content: "width=device-width, initial-scale=1, maximum-scale=5"
|
|
153
|
+
}), cfg.head && /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
154
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("meta", {
|
|
155
|
+
httpEquiv: "X-UA-Compatible",
|
|
156
|
+
content: "IE=edge"
|
|
157
|
+
}), cfg.head.title && /* @__PURE__ */(0, import_jsx_runtime.jsx)("title", {
|
|
158
|
+
children: cfg.head.title
|
|
159
|
+
}), cfg.head.favicon && /* @__PURE__ */(0, import_jsx_runtime.jsx)("link", {
|
|
160
|
+
rel: "icon",
|
|
161
|
+
href: cfg.head.favicon
|
|
162
|
+
})]
|
|
163
|
+
})]
|
|
164
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsxs)("body", {
|
|
165
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_one.LoadProgressBar, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_one.SchemeProvider, {
|
|
166
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_cookie.CookiesProvider, {
|
|
167
|
+
cookies: ssrCookies,
|
|
168
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(WebRootProvider, {
|
|
169
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(RootLayout, {
|
|
170
|
+
ssrSession: rootLoaderData?.session,
|
|
171
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_one.Slot, {})
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
})]
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
Layout.displayName = "RootLayout";
|
|
180
|
+
return Layout;
|
|
181
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
36
|
+
var CreateRootLayout_native_exports = {};
|
|
37
|
+
__export(CreateRootLayout_native_exports, {
|
|
38
|
+
createRootLayout: () => createRootLayout
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(CreateRootLayout_native_exports);
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_expo_font = require("expo-font");
|
|
43
|
+
var import_i18next = __toESM(require("i18next"));
|
|
44
|
+
var import_one = require("one");
|
|
45
|
+
var import_react_native = require("react-native");
|
|
46
|
+
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
47
|
+
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
48
|
+
var import_react_i18next = require("react-i18next");
|
|
49
|
+
var import_platform = require("@multiplatform.one/platform");
|
|
50
|
+
var import_i18n = require("@multiplatform.one/i18n");
|
|
51
|
+
var import_logger = require("@multiplatform.one/logger");
|
|
52
|
+
var import_useNativeDeepLinks = require("./useNativeDeepLinks.native.js");
|
|
53
|
+
var styles = import_react_native.StyleSheet.create({
|
|
54
|
+
container: {
|
|
55
|
+
flex: 1
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
function createRootLayout(cfg) {
|
|
59
|
+
var _cfg_fonts;
|
|
60
|
+
import_i18next.default.use(import_react_i18next.initReactI18next).init((0, import_i18n.createI18nConfig)(cfg.i18n)).catch(import_logger.logger.error);
|
|
61
|
+
import_i18next.default.changeLanguage(import_platform.config.get("I18N_DEFAULT_LANGUAGE", cfg.i18n.defaultLanguage));
|
|
62
|
+
var {
|
|
63
|
+
AppProvider,
|
|
64
|
+
RootLayout
|
|
65
|
+
} = cfg;
|
|
66
|
+
function NativeRootProvider(param) {
|
|
67
|
+
var {
|
|
68
|
+
children
|
|
69
|
+
} = param;
|
|
70
|
+
var {
|
|
71
|
+
value: systemScheme
|
|
72
|
+
} = (0, import_one.useUserScheme)();
|
|
73
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AppProvider, {
|
|
74
|
+
systemTheme: systemScheme,
|
|
75
|
+
children
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
NativeRootProvider.displayName = "NativeRootProvider";
|
|
79
|
+
var fontsMap = (_cfg_fonts = cfg.fonts) !== null && _cfg_fonts !== void 0 ? _cfg_fonts : {};
|
|
80
|
+
function DeepLinkBridge() {
|
|
81
|
+
(0, import_useNativeDeepLinks.useNativeDeepLinks)();
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
DeepLinkBridge.displayName = "DeepLinkBridge";
|
|
85
|
+
function NativeRootLayout(param) {
|
|
86
|
+
var {
|
|
87
|
+
children
|
|
88
|
+
} = param;
|
|
89
|
+
var snap = import_one.routerStore.useOneRouter();
|
|
90
|
+
if (!(snap === null || snap === void 0 ? void 0 : snap.routeInfo)) return children;
|
|
91
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(RootLayout, {
|
|
92
|
+
children
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
NativeRootLayout.displayName = "NativeRootLayout";
|
|
96
|
+
function Layout() {
|
|
97
|
+
var [fontsLoaded, fontError] = (0, import_expo_font.useFonts)(fontsMap);
|
|
98
|
+
if (!fontsLoaded && !fontError) return null;
|
|
99
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, {
|
|
100
|
+
style: styles.container,
|
|
101
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native_safe_area_context.SafeAreaProvider, {
|
|
102
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_one.SchemeProvider, {
|
|
103
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(NativeRootProvider, {
|
|
104
|
+
children: [cfg.deepLinks !== false && /* @__PURE__ */(0, import_jsx_runtime.jsx)(DeepLinkBridge, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(NativeRootLayout, {
|
|
105
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_one.Slot, {})
|
|
106
|
+
})]
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
Layout.displayName = "RootLayout";
|
|
113
|
+
return Layout;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=CreateRootLayout.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CreateRootLayout_native_exports","__export","createRootLayout","module","exports","__toCommonJS","import_jsx_runtime","require","import_expo_font","import_i18next","__toESM","import_one","import_react_native","import_react_native_gesture_handler","import_react_native_safe_area_context","import_react_i18next","import_platform","import_i18n","import_logger","import_useNativeDeepLinks","styles","StyleSheet","create","container","flex","cfg","_cfg_fonts","default","use","initReactI18next","init","createI18nConfig","i18n","catch","logger","error","changeLanguage","config","get","defaultLanguage","AppProvider","RootLayout","NativeRootProvider","param","children","value","systemScheme","useUserScheme","jsx","systemTheme","displayName","fontsMap","fonts","DeepLinkBridge","useNativeDeepLinks","NativeRootLayout","snap","routerStore","useOneRouter","routeInfo","Layout","fontsLoaded","fontError","useFonts","GestureHandlerRootView","style","SafeAreaProvider","SchemeProvider","jsxs","deepLinks","Slot"],"sources":["../../../src/app/CreateRootLayout.native.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 RuntimePublicConfigScript_exports = {};
|
|
24
|
+
__export(RuntimePublicConfigScript_exports, {
|
|
25
|
+
RuntimePublicConfigScript: () => RuntimePublicConfigScript
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(RuntimePublicConfigScript_exports);
|
|
28
|
+
var import_platform = require("@multiplatform.one/platform");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
function RuntimePublicConfigScript() {
|
|
31
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("script", {
|
|
32
|
+
async: true,
|
|
33
|
+
href: import_platform.runtimePublicConfigKey,
|
|
34
|
+
suppressHydrationWarning: true,
|
|
35
|
+
dangerouslySetInnerHTML: {
|
|
36
|
+
__html: import_platform.platform.isServer ? (0, import_platform.serializeRuntimePublicConfig)() : ""
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
RuntimePublicConfigScript.displayName = "RuntimePublicConfigScript";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var RuntimePublicConfigScript_exports = {};
|
|
26
|
+
__export(RuntimePublicConfigScript_exports, {
|
|
27
|
+
RuntimePublicConfigScript: () => RuntimePublicConfigScript
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(RuntimePublicConfigScript_exports);
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_platform = require("@multiplatform.one/platform");
|
|
32
|
+
function RuntimePublicConfigScript() {
|
|
33
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("script", {
|
|
34
|
+
async: true,
|
|
35
|
+
// @ts-expect-error `href` is not on React's ScriptHTMLAttributes — React 19
|
|
36
|
+
// keys hoisted scripts by it anyway, and `one`'s ServerContextScript (the
|
|
37
|
+
// sibling payload this deliberately mirrors) carries the identical
|
|
38
|
+
// suppression on the identical line. Copying the transport means copying
|
|
39
|
+
// this, not inventing a differently-keyed script.
|
|
40
|
+
href: import_platform.runtimePublicConfigKey,
|
|
41
|
+
suppressHydrationWarning: true,
|
|
42
|
+
dangerouslySetInnerHTML: {
|
|
43
|
+
__html: import_platform.platform.isServer ? (0, import_platform.serializeRuntimePublicConfig)() : ""
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
RuntimePublicConfigScript.displayName = "RuntimePublicConfigScript";
|
|
48
|
+
//# sourceMappingURL=RuntimePublicConfigScript.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","RuntimePublicConfigScript_exports","__export","RuntimePublicConfigScript","module","exports","import_jsx_runtime","require","import_platform","jsx","async","href","runtimePublicConfigKey","suppressHydrationWarning","dangerouslySetInnerHTML","__html","platform","isServer","serializeRuntimePublicConfig"],"sources":["../../../src/app/RuntimePublicConfigScript.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iCAAA;AAAAC,QAAA,CAAAD,iCAAA;EAAAE,yBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAIO,CAAAK,iCAAA;AAkCH,IAAAK,kBAAA,GAAAC,OAAA;AAFG,IAAAC,eAAS,GAAAD,OAAA,8BAA4B;AAC1C,SACEJ,0BAAA;EAAA,OAAC,mBAAAG,kBAAA,CAAAG,GAAA;IAAAC,KAAA;IAAA;IACM;IAMC;IACkB;IACC;IACsCC,IAC/D,EAAAH,eAAA,CAAAI,sBAAA;IAAAC,wBAAA;IACFC,uBAAA;MAEJC,MAAA,EAAAP,eAAA,CAAAQ,QAAA,CAAAC,QAAA,OAAAT,eAAA,CAAAU,4BAAA;IACA","ignoreList":[]}
|
|
@@ -0,0 +1,145 @@
|
|
|
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 TanstackDevtools_exports = {};
|
|
35
|
+
__export(TanstackDevtools_exports, {
|
|
36
|
+
default: () => TanstackDevtoolsWrapper
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(TanstackDevtools_exports);
|
|
39
|
+
var import_production = require("@tanstack/react-query-devtools/production");
|
|
40
|
+
var import_react_devtools = require("@tanstack/react-devtools");
|
|
41
|
+
var import_production2 = require("@tanstack/react-form-devtools/production");
|
|
42
|
+
var import_react = require("@tanstack/devtools-utils/react");
|
|
43
|
+
var import_production3 = require("@tanstack/pacer-devtools/production");
|
|
44
|
+
var import_theme = require("@multiplatform.one/theme");
|
|
45
|
+
var import_store = require("@multiplatform.one/store");
|
|
46
|
+
var import_react2 = require("react");
|
|
47
|
+
var import_devtoolsTrigger = require("./devtoolsTrigger.cjs");
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
const devtoolsSettingsKey = "tanstack_devtools_settings";
|
|
50
|
+
const [PacerDevtoolsPanel] = (0, import_react.createReactPanel)(import_production3.PacerDevtoolsCore);
|
|
51
|
+
const [pacerDevtoolsPlugin] = (0, import_react.createReactPlugin)({
|
|
52
|
+
name: "TanStack Pacer",
|
|
53
|
+
Component: PacerDevtoolsPanel
|
|
54
|
+
});
|
|
55
|
+
async function syncDevtoolsTheme(resolvedScheme) {
|
|
56
|
+
try {
|
|
57
|
+
const raw = await Promise.resolve(import_store.storage.getItem(devtoolsSettingsKey));
|
|
58
|
+
const settings = raw ? JSON.parse(raw) : {};
|
|
59
|
+
if (settings.theme !== resolvedScheme) {
|
|
60
|
+
settings.theme = resolvedScheme;
|
|
61
|
+
await Promise.resolve(import_store.storage.setItem(devtoolsSettingsKey, JSON.stringify(settings)));
|
|
62
|
+
}
|
|
63
|
+
} catch {}
|
|
64
|
+
}
|
|
65
|
+
function useFrappePlugin() {
|
|
66
|
+
const [plugin, setPlugin] = (0, import_react2.useState)(null);
|
|
67
|
+
(0, import_react2.useEffect)(() => {
|
|
68
|
+
let cancelled = false;
|
|
69
|
+
async function tryResolve() {
|
|
70
|
+
try {
|
|
71
|
+
const [{
|
|
72
|
+
frappeDevtoolsPlugin
|
|
73
|
+
}, {
|
|
74
|
+
__getActiveSyncModule
|
|
75
|
+
}] = await Promise.all([import("@multiplatform.one/frappe/devtools"), import("@multiplatform.one/frappe")]);
|
|
76
|
+
const sync = __getActiveSyncModule();
|
|
77
|
+
if (sync && !cancelled) {
|
|
78
|
+
setPlugin(frappeDevtoolsPlugin(sync));
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
} catch {}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
void tryResolve().then(found => {
|
|
85
|
+
if (found || cancelled) return;
|
|
86
|
+
let attempts = 0;
|
|
87
|
+
const interval = setInterval(async () => {
|
|
88
|
+
attempts++;
|
|
89
|
+
const found2 = await tryResolve();
|
|
90
|
+
if (found2 || cancelled || attempts >= 10) clearInterval(interval);
|
|
91
|
+
}, 2e3);
|
|
92
|
+
return () => clearInterval(interval);
|
|
93
|
+
});
|
|
94
|
+
return () => {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
98
|
+
return plugin;
|
|
99
|
+
}
|
|
100
|
+
function TanstackDevtoolsWrapper({
|
|
101
|
+
resolvedScheme,
|
|
102
|
+
tanstackConfig
|
|
103
|
+
}) {
|
|
104
|
+
(0, import_react2.useEffect)(() => {
|
|
105
|
+
if (typeof window === "undefined") return;
|
|
106
|
+
void syncDevtoolsTheme(resolvedScheme);
|
|
107
|
+
}, [resolvedScheme]);
|
|
108
|
+
const frappePlugin = useFrappePlugin();
|
|
109
|
+
(0, import_devtoolsTrigger.useShakeToOpen)(tanstackConfig.shakeToOpen !== false);
|
|
110
|
+
(0, import_devtoolsTrigger.useDevtoolsKeyboardTrigger)(true);
|
|
111
|
+
const openRequests = (0, import_devtoolsTrigger.useDevtoolsOpenRequests)();
|
|
112
|
+
const plugins = [{
|
|
113
|
+
id: "react-query",
|
|
114
|
+
name: "React Query",
|
|
115
|
+
render: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_production.ReactQueryDevtools, {
|
|
116
|
+
initialIsOpen: false
|
|
117
|
+
})
|
|
118
|
+
}, (0, import_production2.formDevtoolsPlugin)(), pacerDevtoolsPlugin(), {
|
|
119
|
+
id: "theme",
|
|
120
|
+
name: "Theme",
|
|
121
|
+
// The panel opens focused on Theme, so a shake (or the hotkey) lands
|
|
122
|
+
// straight on the theme flipper — the whole point of the trigger is
|
|
123
|
+
// to check that everything is themable. `defaultOpen` seeds the tab
|
|
124
|
+
// only on first open, when no layout is persisted yet; once the user
|
|
125
|
+
// moves to another tab their choice is restored on later opens.
|
|
126
|
+
defaultOpen: true,
|
|
127
|
+
render: (_el, props) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_theme.ThemeDevtoolsPanel, {
|
|
128
|
+
useUserScheme: tanstackConfig.useUserScheme,
|
|
129
|
+
devtoolsTheme: props.theme,
|
|
130
|
+
tamaguiConfig: tanstackConfig.tamaguiConfig,
|
|
131
|
+
themeColors: tanstackConfig.themeColors,
|
|
132
|
+
currentThemeColor: tanstackConfig.currentThemeColor,
|
|
133
|
+
onThemeColorChange: tanstackConfig.onThemeColorChange
|
|
134
|
+
})
|
|
135
|
+
}, ...(frappePlugin ? [frappePlugin] : [])];
|
|
136
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_devtools.TanStackDevtools, {
|
|
137
|
+
config: {
|
|
138
|
+
defaultOpen: false,
|
|
139
|
+
triggerHidden: true,
|
|
140
|
+
openHotkey: [...import_devtoolsTrigger.devtoolsOpenHotkey],
|
|
141
|
+
theme: resolvedScheme
|
|
142
|
+
},
|
|
143
|
+
plugins
|
|
144
|
+
}, `${resolvedScheme}:${openRequests}`);
|
|
145
|
+
}
|