@rork-ai/toolkit-sdk 0.2.21 → 0.2.23

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 (56) hide show
  1. package/lib/module/dev/error-boundary.js +133 -0
  2. package/lib/module/dev/error-boundary.js.map +1 -0
  3. package/lib/module/dev/patch-alert/patch-alert.js +4 -0
  4. package/lib/module/dev/patch-alert/patch-alert.js.map +1 -0
  5. package/lib/module/dev/patch-alert/patch-alert.web.js +7 -0
  6. package/lib/module/dev/patch-alert/patch-alert.web.js.map +1 -0
  7. package/lib/module/dev/safe-insets-content.js +13 -0
  8. package/lib/module/dev/safe-insets-content.js.map +1 -0
  9. package/lib/module/dev/safe-insets-content.web.js +61 -0
  10. package/lib/module/dev/safe-insets-content.web.js.map +1 -0
  11. package/lib/module/dev/sdk53/index.js +19 -0
  12. package/lib/module/dev/sdk53/index.js.map +1 -0
  13. package/lib/module/dev/sdk53/inspector.js +413 -0
  14. package/lib/module/dev/sdk53/inspector.js.map +1 -0
  15. package/lib/module/dev/sdk53/inspector.web.js +11 -0
  16. package/lib/module/dev/sdk53/inspector.web.js.map +1 -0
  17. package/lib/module/dev/sdk54/index.js +19 -0
  18. package/lib/module/dev/sdk54/index.js.map +1 -0
  19. package/lib/module/dev/sdk54/inspector.js +290 -0
  20. package/lib/module/dev/sdk54/inspector.js.map +1 -0
  21. package/lib/module/dev/sdk54/inspector.web.js +11 -0
  22. package/lib/module/dev/sdk54/inspector.web.js.map +1 -0
  23. package/lib/typescript/src/dev/error-boundary.d.ts +20 -0
  24. package/lib/typescript/src/dev/error-boundary.d.ts.map +1 -0
  25. package/lib/typescript/src/dev/patch-alert/patch-alert.d.ts +2 -0
  26. package/lib/typescript/src/dev/patch-alert/patch-alert.d.ts.map +1 -0
  27. package/lib/typescript/src/dev/patch-alert/patch-alert.web.d.ts +2 -0
  28. package/lib/typescript/src/dev/patch-alert/patch-alert.web.d.ts.map +1 -0
  29. package/lib/typescript/src/dev/safe-insets-content.d.ts +3 -0
  30. package/lib/typescript/src/dev/safe-insets-content.d.ts.map +1 -0
  31. package/lib/typescript/src/dev/safe-insets-content.web.d.ts +3 -0
  32. package/lib/typescript/src/dev/safe-insets-content.web.d.ts.map +1 -0
  33. package/lib/typescript/src/dev/sdk53/index.d.ts +5 -0
  34. package/lib/typescript/src/dev/sdk53/index.d.ts.map +1 -0
  35. package/lib/typescript/src/dev/sdk53/inspector.d.ts +23 -0
  36. package/lib/typescript/src/dev/sdk53/inspector.d.ts.map +1 -0
  37. package/lib/typescript/src/dev/sdk53/inspector.web.d.ts +4 -0
  38. package/lib/typescript/src/dev/sdk53/inspector.web.d.ts.map +1 -0
  39. package/lib/typescript/src/dev/sdk54/index.d.ts +5 -0
  40. package/lib/typescript/src/dev/sdk54/index.d.ts.map +1 -0
  41. package/lib/typescript/src/dev/sdk54/inspector.d.ts +23 -0
  42. package/lib/typescript/src/dev/sdk54/inspector.d.ts.map +1 -0
  43. package/lib/typescript/src/dev/sdk54/inspector.web.d.ts +4 -0
  44. package/lib/typescript/src/dev/sdk54/inspector.web.d.ts.map +1 -0
  45. package/package.json +22 -19
  46. package/src/dev/error-boundary.tsx +161 -0
  47. package/src/dev/patch-alert/patch-alert.tsx +1 -0
  48. package/src/dev/patch-alert/patch-alert.web.tsx +5 -0
  49. package/src/dev/safe-insets-content.tsx +7 -0
  50. package/src/dev/safe-insets-content.web.tsx +57 -0
  51. package/src/dev/sdk53/index.tsx +15 -0
  52. package/src/dev/sdk53/inspector.tsx +467 -0
  53. package/src/dev/sdk53/inspector.web.tsx +3 -0
  54. package/src/dev/sdk54/index.tsx +15 -0
  55. package/src/dev/sdk54/inspector.tsx +345 -0
  56. package/src/dev/sdk54/inspector.web.tsx +3 -0
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ import { requireOptionalNativeModule } from "expo-modules-core";
4
+ import React from "react";
5
+ import { Platform, StyleSheet, Text, View } from "react-native";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const IFRAME_ID = "rork-web-preview";
8
+ const webTargetOrigins = ["http://localhost:3000", "https://rorkai.com", "https://rork.com"];
9
+ const BridgeModule = requireOptionalNativeModule("Bridge");
10
+ function sendErrorToIframeParent(error, errorInfo) {
11
+ const errorData = {
12
+ message: error?.message || error?.toString() || "Unknown error",
13
+ stack: error?.stack,
14
+ componentStack: errorInfo?.componentStack,
15
+ timestamp: new Date().toISOString()
16
+ };
17
+ if (Platform.OS === "web" && typeof window !== "undefined") {
18
+ console.debug("Sending error to parent via postMessage:", {
19
+ error,
20
+ errorInfo,
21
+ referrer: document.referrer
22
+ });
23
+ const errorMessage = {
24
+ type: "ERROR",
25
+ error: errorData,
26
+ iframeId: IFRAME_ID
27
+ };
28
+ try {
29
+ window.parent.postMessage(errorMessage, webTargetOrigins.includes(document.referrer) ? document.referrer : "*");
30
+ } catch (postMessageError) {
31
+ console.warn("Failed to send error to parent:", postMessageError);
32
+ }
33
+ } else if (Platform.OS !== "web" && BridgeModule) {
34
+ BridgeModule?.sendMessage({
35
+ type: "runtime-error",
36
+ data: JSON.stringify(errorData)
37
+ });
38
+ }
39
+ }
40
+ if (Platform.OS === "web" && typeof window !== "undefined") {
41
+ window.addEventListener("error", event => {
42
+ event.preventDefault();
43
+ const errorDetails = event.error ?? {
44
+ message: event.message ?? "Unknown error",
45
+ filename: event.filename ?? "Unknown file",
46
+ lineno: event.lineno ?? "Unknown line",
47
+ colno: event.colno ?? "Unknown column"
48
+ };
49
+ sendErrorToIframeParent(errorDetails);
50
+ }, true);
51
+ window.addEventListener("unhandledrejection", event => {
52
+ event.preventDefault();
53
+ sendErrorToIframeParent(event.reason);
54
+ }, true);
55
+ }
56
+ const originalConsoleError = console.error;
57
+ console.error = (...args) => {
58
+ sendErrorToIframeParent(args.join(" "));
59
+ originalConsoleError.apply(console, args);
60
+ };
61
+ export class RorkErrorBoundary extends React.Component {
62
+ constructor(props) {
63
+ super(props);
64
+ this.state = {
65
+ hasError: false,
66
+ error: null
67
+ };
68
+ }
69
+ static getDerivedStateFromError(error) {
70
+ return {
71
+ hasError: true,
72
+ error
73
+ };
74
+ }
75
+ componentDidCatch(error, errorInfo) {
76
+ sendErrorToIframeParent(error, errorInfo);
77
+ if (this.props.onError) {
78
+ this.props.onError(error, errorInfo);
79
+ }
80
+ }
81
+ render() {
82
+ if (this.state.hasError) {
83
+ return /*#__PURE__*/_jsx(View, {
84
+ style: styles.container,
85
+ children: /*#__PURE__*/_jsxs(View, {
86
+ style: styles.content,
87
+ children: [/*#__PURE__*/_jsx(Text, {
88
+ style: styles.title,
89
+ children: "Something went wrong"
90
+ }), /*#__PURE__*/_jsx(Text, {
91
+ style: styles.subtitle,
92
+ children: this.state.error?.message
93
+ }), Platform.OS !== "web" && /*#__PURE__*/_jsx(Text, {
94
+ style: styles.description,
95
+ children: "Please check your device logs for more details."
96
+ })]
97
+ })
98
+ });
99
+ }
100
+ return this.props.children;
101
+ }
102
+ }
103
+ const styles = StyleSheet.create({
104
+ container: {
105
+ flex: 1,
106
+ backgroundColor: "#fff"
107
+ },
108
+ content: {
109
+ flex: 1,
110
+ alignItems: "center",
111
+ justifyContent: "center",
112
+ padding: 20
113
+ },
114
+ title: {
115
+ fontSize: 36,
116
+ textAlign: "center",
117
+ fontWeight: "bold",
118
+ marginBottom: 8
119
+ },
120
+ subtitle: {
121
+ fontSize: 14,
122
+ color: "#666",
123
+ marginBottom: 12,
124
+ textAlign: "center"
125
+ },
126
+ description: {
127
+ fontSize: 14,
128
+ color: "#666",
129
+ textAlign: "center",
130
+ marginTop: 8
131
+ }
132
+ });
133
+ //# sourceMappingURL=error-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["requireOptionalNativeModule","React","Platform","StyleSheet","Text","View","jsx","_jsx","jsxs","_jsxs","IFRAME_ID","webTargetOrigins","BridgeModule","sendErrorToIframeParent","error","errorInfo","errorData","message","toString","stack","componentStack","timestamp","Date","toISOString","OS","window","console","debug","referrer","document","errorMessage","type","iframeId","parent","postMessage","includes","postMessageError","warn","sendMessage","data","JSON","stringify","addEventListener","event","preventDefault","errorDetails","filename","lineno","colno","reason","originalConsoleError","args","join","apply","RorkErrorBoundary","Component","constructor","props","state","hasError","getDerivedStateFromError","componentDidCatch","onError","render","style","styles","container","children","content","title","subtitle","description","create","flex","backgroundColor","alignItems","justifyContent","padding","fontSize","textAlign","fontWeight","marginBottom","color","marginTop"],"sourceRoot":"../../../src","sources":["dev/error-boundary.tsx"],"mappings":";;AAAA,SAASA,2BAA2B,QAAQ,mBAAmB;AAC/D,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAYhE,MAAMC,SAAS,GAAG,kBAAkB;AAEpC,MAAMC,gBAAgB,GAAG,CACvB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,CACnB;AAED,MAAMC,YAAY,GAAGZ,2BAA2B,CAAC,QAAQ,CAAC;AAE1D,SAASa,uBAAuBA,CAACC,KAAU,EAAEC,SAAe,EAAE;EAC5D,MAAMC,SAAS,GAAG;IAChBC,OAAO,EAAEH,KAAK,EAAEG,OAAO,IAAIH,KAAK,EAAEI,QAAQ,CAAC,CAAC,IAAI,eAAe;IAC/DC,KAAK,EAAEL,KAAK,EAAEK,KAAK;IACnBC,cAAc,EAAEL,SAAS,EAAEK,cAAc;IACzCC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC;EACpC,CAAC;EAED,IAAIrB,QAAQ,CAACsB,EAAE,KAAK,KAAK,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IAC1DC,OAAO,CAACC,KAAK,CAAC,0CAA0C,EAAE;MACxDb,KAAK;MACLC,SAAS;MACTa,QAAQ,EAAEC,QAAQ,CAACD;IACrB,CAAC,CAAC;IAEF,MAAME,Y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A,CAACH,IAAI;YAAC4D,KAAK,EAAEC,MAAM,CAACK,QAAS;YAAAH,QAAA,EAAE,IAAI,CAACT,KAAK,CAAC5C,KAAK,EAAEG;UAAO,CAAO,CAAC,EAC/Df,QAAQ,CAACsB,EAAE,KAAK,KAAK,iBACpBjB,IAAA,CAACH,IAAI;YAAC4D,KAAK,EAAEC,MAAM,CAACM,WAAY;YAAAJ,QAAA,EAAC;UAEjC,CAAM,CACP;QAAA,CACG;MAAC,CACH,CAAC;IAEX;IAEA,OAAO,IAAI,CAACV,KAAK,CAACU,QAAQ;EAC5B;AACF;AAEA,MAAMF,MAAM,GAAG9D,UAAU,CAACqE,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE;EACnB,CAAC;EACDN,OAAO,EAAE;IACPK,IAAI,EAAE,CAAC;IACPE,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,OAAO,EAAE;EACX,CAAC;EACDR,KAAK,EAAE;IACLS,QAAQ,EAAE,EAAE;IACZC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE,MAAM;IAClBC,YAAY,EAAE;EAChB,CAAC;EACDX,QAAQ,EAAE;IACRQ,QAAQ,EAAE,EAAE;IACZI,KAAK,EAAE,MAAM;IACbD,YAAY,EAAE,EAAE;IAChBF,SAAS,EAAE;EACb,CAAC;EACDR,WAAW,EAAE;IACXO,QAAQ,EAAE,EAAE;IACZI,KAAK,EAAE,MAAM;IACbH,SAAS,EAAE,QAAQ;IACnBI,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=patch-alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["dev/patch-alert/patch-alert.tsx"],"mappings":";;AAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ import AlertNew from "@blazejkustra/react-native-alert";
4
+ import { Alert } from "react-native";
5
+ Alert.alert = AlertNew.alert;
6
+ Alert.prompt = AlertNew.prompt;
7
+ //# sourceMappingURL=patch-alert.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AlertNew","Alert","alert","prompt"],"sourceRoot":"../../../../src","sources":["dev/patch-alert/patch-alert.web.tsx"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,kCAAkC;AACvD,SAASC,KAAK,QAAQ,cAAc;AAEpCA,KAAK,CAACC,KAAK,GAAGF,QAAQ,CAACE,KAAK;AAC5BD,KAAK,CAACE,MAAM,GAAGH,QAAQ,CAACG,MAAM","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
4
+ export function RorkSafeInsets({
5
+ children
6
+ }) {
7
+ // On native, use the default safe area context from react-native-safe-area-context
8
+ // which is already provided by expo-router
9
+ return /*#__PURE__*/_jsx(_Fragment, {
10
+ children: children
11
+ });
12
+ }
13
+ //# sourceMappingURL=safe-insets-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RorkSafeInsets","children","_jsx","_Fragment"],"sourceRoot":"../../../src","sources":["dev/safe-insets-content.tsx"],"mappings":";;;AAEA,OAAO,SAASA,cAAcA,CAAC;EAAEC;AAA4B,CAAC,EAAE;EAC9D;EACA;EACA,oBAAOC,IAAA,CAAAC,SAAA;IAAAF,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB","ignoreList":[]}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useState } from "react";
4
+ import { Platform } from "react-native";
5
+ import { SafeAreaInsetsContext } from "react-native-safe-area-context";
6
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
7
+ const DEFAULT_IOS_LIKE_WEB_INSETS = {
8
+ top: 44,
9
+ right: 0,
10
+ bottom: 34,
11
+ left: 0
12
+ };
13
+ export function RorkSafeInsets({
14
+ children
15
+ }) {
16
+ if (Platform.OS !== "web") {
17
+ return /*#__PURE__*/_jsx(_Fragment, {
18
+ children: children
19
+ });
20
+ }
21
+ const [insets, setInsets] = useState(DEFAULT_IOS_LIKE_WEB_INSETS);
22
+ useEffect(() => {
23
+ const handleMessage = event => {
24
+ // Security check: validate the event origin if needed
25
+ // if (event.origin !== 'https://your-expected-origin.com') return;
26
+
27
+ if (event.data?.type === "update-safe-area-insets") {
28
+ const {
29
+ top,
30
+ right,
31
+ bottom,
32
+ left
33
+ } = event.data.insets;
34
+
35
+ // Validate that all values are numbers
36
+ if (typeof top === "number" && typeof right === "number" && typeof bottom === "number" && typeof left === "number") {
37
+ setInsets({
38
+ top,
39
+ right,
40
+ bottom,
41
+ left
42
+ });
43
+ }
44
+ }
45
+ };
46
+ window.addEventListener("message", handleMessage);
47
+
48
+ // Notify parent that we're ready to receive insets
49
+ window.parent.postMessage({
50
+ type: "safe-insets-ready"
51
+ }, "*");
52
+ return () => {
53
+ window.removeEventListener("message", handleMessage);
54
+ };
55
+ }, []);
56
+ return /*#__PURE__*/_jsx(SafeAreaInsetsContext.Provider, {
57
+ value: insets,
58
+ children: children
59
+ });
60
+ }
61
+ //# sourceMappingURL=safe-insets-content.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","Platform","SafeAreaInsetsContext","Fragment","_Fragment","jsx","_jsx","DEFAULT_IOS_LIKE_WEB_INSETS","top","right","bottom","left","RorkSafeInsets","children","OS","insets","setInsets","handleMessage","event","data","type","window","addEventListener","parent","postMessage","removeEventListener","Provider","value"],"sourceRoot":"../../../src","sources":["dev/safe-insets-content.web.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAgC,OAAO;AACnE,SAASC,QAAQ,QAAQ,cAAc;AACvC,SACEC,qBAAqB,QAEhB,gCAAgC;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAEx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IAACC,KAAK,EAAEZ,MAAO;IAAAF,QAAA,EAC3CA;EAAQ,CACqB,CAAC;AAErC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ import { RorkErrorBoundary } from "../error-boundary.js";
4
+ import { RorkSafeInsets } from "../safe-insets-content";
5
+ import { BundleInspector } from "./inspector";
6
+ import "../patch-alert";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export function RorkDevWrapper({
9
+ children
10
+ }) {
11
+ return /*#__PURE__*/_jsx(RorkErrorBoundary, {
12
+ children: /*#__PURE__*/_jsx(BundleInspector, {
13
+ children: /*#__PURE__*/_jsx(RorkSafeInsets, {
14
+ children: children
15
+ })
16
+ })
17
+ });
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RorkErrorBoundary","RorkSafeInsets","BundleInspector","jsx","_jsx","RorkDevWrapper","children"],"sourceRoot":"../../../../src","sources":["dev/sdk53/index.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,sBAAmB;AACrD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,aAAa;AAE7C,OAAO,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExB,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAAwC,CAAC,EAAE;EAC1E,oBACEF,IAAA,CAACJ,iBAAiB;IAAAM,QAAA,eAChBF,IAAA,CAACF,eAAe;MAAAI,QAAA,eACdF,IAAA,CAACH,cAAc;QAAAK,QAAA,EAAEA;MAAQ,CAAiB;IAAC,CAC5B;EAAC,CACD,CAAC;AAExB","ignoreList":[]}
@@ -0,0 +1,413 @@
1
+ "use strict";
2
+
3
+ /*
4
+ The code here will is moved to our infrastructure (with ctrl+c ctrl+v)
5
+ where we add it in _layout.tsx as it is.
6
+
7
+ It will be added at .rork/BundleInspector.tsx (web vestoin too).
8
+
9
+ That is why:
10
+ 1. This file should never import other files
11
+ 2. This file should never import other modules that will not be on the device.
12
+ We import react-native-safe-area-context and lucide-react-native
13
+ but we are confident it will be there. Still not great.
14
+
15
+ */
16
+
17
+ import { BlurView } from "expo-blur";
18
+ import { requireOptionalNativeModule } from "expo-modules-core";
19
+ import { X } from "lucide-react-native";
20
+ import React, { useCallback, useEffect, useRef, useState } from "react";
21
+ import { Dimensions, LogBox, NativeModules, StyleSheet, Text, TouchableOpacity, View } from "react-native";
22
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
23
+ // @ts-ignore
24
+ import DebuggingOverlay from "react-native/Libraries/Debugging/DebuggingOverlay.js";
25
+ // @ts-ignore
26
+ import useSubscribeToDebuggingOverlayRegistry from "react-native/Libraries/Debugging/useSubscribeToDebuggingOverlayRegistry";
27
+ import ErrorUtils from "react-native/Libraries/vendor/core/ErrorUtils";
28
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
+ const getInspectorDataForViewAtPoint = require("react-native/src/private/inspector/getInspectorDataForViewAtPoint").default;
30
+ const InspectorOverlay = require("react-native/src/private/inspector/InspectorOverlay").default;
31
+ // Removed InspectorPanel import - implementing inline
32
+
33
+ const BridgeModule = requireOptionalNativeModule("Bridge");
34
+ export function isRorkSandbox() {
35
+ return !!NativeModules.RorkSandbox;
36
+ }
37
+ if (BridgeModule) {
38
+ LogBox.ignoreAllLogs();
39
+ LogBox.uninstall();
40
+
41
+ // @ts-ignore
42
+ ErrorUtils.setGlobalHandler(error => {
43
+ sendBridgeMessage("runtime-error", {
44
+ stack: error.stack,
45
+ message: error.message
46
+ });
47
+ });
48
+ }
49
+ export function sendBridgeMessage(type, data) {
50
+ if (data) {
51
+ return BridgeModule?.sendMessage({
52
+ type,
53
+ data: JSON.stringify(data)
54
+ });
55
+ }
56
+ return BridgeModule?.sendMessage({
57
+ type
58
+ });
59
+ }
60
+ export function addBridgeListener(listener) {
61
+ return BridgeModule?.addListener("onMessage", data => {
62
+ if (typeof data !== "object") return;
63
+ if (data.data) {
64
+ listener({
65
+ ...data,
66
+ data: JSON.parse(data.data)
67
+ });
68
+ } else {
69
+ listener(data);
70
+ }
71
+ });
72
+ }
73
+ export function useBridge() {
74
+ const [state, setState] = useState({
75
+ inspectorEnabled: false
76
+ });
77
+ useEffect(() => {
78
+ const subscription = addBridgeListener(data => {
79
+ if (typeof data === "object" && data.type === "merge-inspector-state") {
80
+ setState(prev => ({
81
+ ...prev,
82
+ ...data.data
83
+ }));
84
+ }
85
+ });
86
+ sendBridgeMessage("runtime-ready");
87
+ return () => subscription?.remove();
88
+ }, []);
89
+ const disableInspector = useCallback(() => {
90
+ setState(prev => ({
91
+ ...prev,
92
+ inspectorEnabled: false
93
+ }));
94
+ sendBridgeMessage("merge-inspector-state", {
95
+ inspectorEnabled: false
96
+ });
97
+ }, []);
98
+ return {
99
+ ...state,
100
+ disableInspector
101
+ };
102
+ }
103
+ export function BundleInspector(props) {
104
+ const innerViewRef = useRef(null);
105
+ const appContainerRootViewRef = useRef(null);
106
+ const debuggingOverlayRef = useRef(null);
107
+ const {
108
+ inspectorEnabled,
109
+ disableInspector
110
+ } = useBridge();
111
+ const [panelPosition, setPanelPosition] = useState("bottom");
112
+ const [inspectedElement, setInspectedElement] = useState(null);
113
+ const [lastPayload, setLastPayload] = useState(null);
114
+ useEffect(() => {
115
+ if (inspectorEnabled) return;
116
+ setInspectedElement(null);
117
+ setPanelPosition("bottom");
118
+ }, [inspectorEnabled]);
119
+ useSubscribeToDebuggingOverlayRegistry(appContainerRootViewRef, debuggingOverlayRef);
120
+ const handleInspectedElementChange = useCallback(viewData => {
121
+ if (viewData) {
122
+ const payload = {
123
+ style: viewData.props.style,
124
+ frame: viewData.frame,
125
+ componentStack: viewData.componentStack,
126
+ hierarchy: viewData.hierarchy?.map(h => ({
127
+ name: h.name ?? null
128
+ }))
129
+ };
130
+ setLastPayload(payload);
131
+ }
132
+ }, []);
133
+ const onTouchPoint = (locationX, locationY) => {
134
+ getInspectorDataForViewAtPoint(innerViewRef.current, locationX, locationY, viewData => {
135
+ setPanelPosition(viewData.pointerY > Dimensions.get("window").height * 0.8 ? "top" : "bottom");
136
+ setInspectedElement({
137
+ frame: viewData.frame,
138
+ style: viewData.props.style
139
+ });
140
+ handleInspectedElementChange(viewData);
141
+ return false;
142
+ });
143
+ };
144
+ const {
145
+ top,
146
+ bottom
147
+ } = useSafeAreaInsets();
148
+ const panelContainerStyle = panelPosition === "bottom" ? {
149
+ bottom: 0,
150
+ marginBottom: bottom
151
+ } : {
152
+ top: 0,
153
+ marginTop: top
154
+ };
155
+ return /*#__PURE__*/_jsxs(View, {
156
+ style: styles.container,
157
+ ref: appContainerRootViewRef,
158
+ children: [/*#__PURE__*/_jsx(View, {
159
+ style: styles.container,
160
+ ref: innerViewRef,
161
+ children: props.children
162
+ }), inspectorEnabled && /*#__PURE__*/_jsx(DebuggingOverlay, {
163
+ ref: debuggingOverlayRef,
164
+ style: styles.absolute
165
+ }), inspectorEnabled && /*#__PURE__*/_jsxs(View, {
166
+ style: styles.inspectorContainer,
167
+ pointerEvents: "box-none",
168
+ children: [/*#__PURE__*/_jsx(InspectorOverlay, {
169
+ inspected: inspectedElement,
170
+ onTouchPoint: onTouchPoint
171
+ }), /*#__PURE__*/_jsx(BlurView, {
172
+ style: [{
173
+ position: "absolute",
174
+ left: 0,
175
+ right: 0,
176
+ backgroundColor: "rgba(0, 0, 0, 0.85)",
177
+ borderRadius: 30,
178
+ marginHorizontal: 12,
179
+ padding: 12,
180
+ paddingLeft: 20,
181
+ overflow: "hidden"
182
+ }, panelContainerStyle],
183
+ children: inspectedElement ? /*#__PURE__*/_jsxs(View, {
184
+ style: styles.floatingIsland,
185
+ children: [/*#__PURE__*/_jsx(Text, {
186
+ style: styles.islandText,
187
+ children: "Element selected"
188
+ }), /*#__PURE__*/_jsxs(View, {
189
+ style: styles.buttonGroup,
190
+ children: [/*#__PURE__*/_jsx(TouchableOpacity, {
191
+ style: styles.selectButton,
192
+ onPress: () => {
193
+ if (lastPayload) {
194
+ sendBridgeMessage("inspector-element", lastPayload);
195
+ disableInspector();
196
+ }
197
+ },
198
+ children: /*#__PURE__*/_jsx(Text, {
199
+ style: styles.buttonText,
200
+ children: "Select"
201
+ })
202
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
203
+ activeOpacity: 0.72,
204
+ style: styles.cancelButton,
205
+ onPress: disableInspector,
206
+ children: /*#__PURE__*/_jsx(X, {
207
+ size: 18,
208
+ color: "#808080",
209
+ strokeWidth: 2.5
210
+ })
211
+ })]
212
+ })]
213
+ }) : /*#__PURE__*/_jsxs(View, {
214
+ style: styles.floatingIsland,
215
+ children: [/*#__PURE__*/_jsx(Text, {
216
+ style: styles.islandText,
217
+ children: "Touch any element to inspect"
218
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
219
+ activeOpacity: 0.72,
220
+ style: styles.cancelTextButton,
221
+ onPress: disableInspector,
222
+ children: /*#__PURE__*/_jsx(Text, {
223
+ style: styles.buttonText,
224
+ children: "Cancel"
225
+ })
226
+ })]
227
+ })
228
+ })]
229
+ })]
230
+ });
231
+ }
232
+ const styles = StyleSheet.create({
233
+ container: {
234
+ flex: 1
235
+ },
236
+ absolute: StyleSheet.absoluteFillObject,
237
+ inspectorContainer: {
238
+ position: "absolute",
239
+ backgroundColor: "transparent",
240
+ top: 0,
241
+ left: 0,
242
+ right: 0,
243
+ bottom: 0
244
+ },
245
+ properties: {
246
+ flexShrink: 1
247
+ },
248
+ elementInfo: {
249
+ padding: 8,
250
+ gap: 3
251
+ },
252
+ section: {
253
+ marginBottom: 15
254
+ },
255
+ sectionTitle: {
256
+ color: "white",
257
+ fontSize: 11,
258
+ fontWeight: "600",
259
+ marginBottom: 4,
260
+ textTransform: "uppercase",
261
+ opacity: 0.7
262
+ },
263
+ boxModel: {
264
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
265
+ padding: 10,
266
+ borderRadius: 4,
267
+ alignItems: "center"
268
+ },
269
+ boxText: {
270
+ color: "white",
271
+ fontSize: 13,
272
+ fontWeight: "500"
273
+ },
274
+ layoutInfo: {
275
+ backgroundColor: "rgba(255, 255, 255, 0.05)",
276
+ padding: 8,
277
+ borderRadius: 4
278
+ },
279
+ layoutText: {
280
+ color: "white",
281
+ fontSize: 12,
282
+ marginBottom: 2
283
+ },
284
+ styleInfo: {
285
+ backgroundColor: "rgba(255, 255, 255, 0.05)",
286
+ padding: 8,
287
+ borderRadius: 4
288
+ },
289
+ styleText: {
290
+ color: "white",
291
+ fontSize: 11,
292
+ marginBottom: 2,
293
+ fontFamily: "monospace"
294
+ },
295
+ waiting: {
296
+ height: 60,
297
+ justifyContent: "center",
298
+ alignItems: "center"
299
+ },
300
+ waitingContent: {
301
+ flex: 1,
302
+ justifyContent: "center",
303
+ alignItems: "center"
304
+ },
305
+ waitingText: {
306
+ fontSize: 14,
307
+ textAlign: "center",
308
+ color: "white",
309
+ opacity: 0.9,
310
+ fontWeight: "500"
311
+ },
312
+ waitingSubText: {
313
+ fontSize: 12,
314
+ textAlign: "center",
315
+ color: "white",
316
+ opacity: 0.6,
317
+ marginTop: 4
318
+ },
319
+ floatingIsland: {
320
+ flexDirection: "row",
321
+ justifyContent: "space-between",
322
+ alignItems: "center",
323
+ gap: 16
324
+ },
325
+ islandText: {
326
+ color: "white",
327
+ fontSize: 16,
328
+ fontWeight: "600",
329
+ flex: 1
330
+ },
331
+ buttonGroup: {
332
+ flexDirection: "row",
333
+ gap: 8
334
+ },
335
+ selectButton: {
336
+ backgroundColor: "#007AFF",
337
+ paddingHorizontal: 12,
338
+ paddingVertical: 6,
339
+ borderRadius: 16,
340
+ minWidth: 60
341
+ },
342
+ cancelButton: {
343
+ backgroundColor: "rgba(255, 255, 255, 0.15)",
344
+ borderRadius: 16,
345
+ aspectRatio: 1,
346
+ height: 28,
347
+ justifyContent: "center",
348
+ alignItems: "center"
349
+ },
350
+ cancelTextButton: {
351
+ backgroundColor: "rgba(255, 255, 255, 0.15)",
352
+ paddingHorizontal: 12,
353
+ paddingVertical: 6,
354
+ borderRadius: 16,
355
+ minWidth: 60
356
+ },
357
+ buttonText: {
358
+ color: "white",
359
+ fontSize: 14,
360
+ fontWeight: "600",
361
+ textAlign: "center"
362
+ },
363
+ panelTitle: {
364
+ color: "white",
365
+ fontSize: 14,
366
+ fontWeight: "600",
367
+ marginBottom: 8,
368
+ textAlign: "center"
369
+ },
370
+ editorSection: {
371
+ marginBottom: 10
372
+ },
373
+ inputGrid: {
374
+ flexDirection: "row",
375
+ gap: 8
376
+ },
377
+ inputCell: {
378
+ flex: 1
379
+ },
380
+ inputLabel: {
381
+ color: "white",
382
+ fontSize: 10,
383
+ fontWeight: "500",
384
+ marginBottom: 2,
385
+ opacity: 0.8
386
+ },
387
+ compactInput: {
388
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
389
+ paddingHorizontal: 8,
390
+ paddingVertical: 4,
391
+ borderRadius: 4,
392
+ color: "white",
393
+ fontSize: 12,
394
+ borderWidth: 1,
395
+ borderColor: "rgba(255, 255, 255, 0.15)",
396
+ height: 28
397
+ },
398
+ applyButton: {
399
+ backgroundColor: "#007AFF",
400
+ paddingVertical: 10,
401
+ paddingHorizontal: 20,
402
+ borderRadius: 6,
403
+ alignItems: "center",
404
+ marginTop: 8,
405
+ alignSelf: "flex-end"
406
+ },
407
+ applyButtonText: {
408
+ color: "white",
409
+ fontSize: 14,
410
+ fontWeight: "600"
411
+ }
412
+ });
413
+ //# sourceMappingURL=inspector.js.map