dreaction-react-native 1.4.7 → 1.6.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.
@@ -60,7 +60,7 @@ exports.ConfigDialog = react_1.default.memo((props) => {
60
60
  dreaction_1.dreaction.asyncStorageHandler?.setItem(LOCAL_CACHE_HOST_NAME, host);
61
61
  onConfirm(host);
62
62
  };
63
- return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { animationType: "fade", transparent: true, visible: visible, onRequestClose: () => onCancel(), children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.modalOverlay, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.modalContent, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.title, children: "DReaction Desktop Application Url" }), (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: styles.input, selectTextOnFocus: selectTextOnFocus, value: inputValue, keyboardType: "url", onChangeText: setInputValue, placeholder: (0, getHost_1.getHost)() }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.buttonContainer, children: [(0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.buttonView, onPress: onCancel, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.buttonText, children: "Cancel" }) }), (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.buttonView, onPress: handleConfirm, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.buttonText, children: "Confirm" }) })] })] }) }) }));
63
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { animationType: "fade", transparent: true, visible: visible, onRequestClose: () => onCancel(), children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.modalOverlay, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.modalContent, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.title, children: "DReaction Desktop Application Host" }), (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: styles.input, selectTextOnFocus: selectTextOnFocus, value: inputValue, keyboardType: "url", onChangeText: setInputValue, placeholder: (0, getHost_1.getHost)() }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.buttonContainer, children: [(0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.buttonView, onPress: onCancel, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.buttonText, children: "Cancel" }) }), (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.buttonView, onPress: handleConfirm, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.buttonText, children: "Confirm" }) })] })] }) }) }));
64
64
  });
65
65
  exports.ConfigDialog.displayName = 'ConfigDialog';
66
66
  const styles = react_native_1.StyleSheet.create({
@@ -0,0 +1,5 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ export declare const Profiler: React.FC<PropsWithChildren<{
3
+ id: string;
4
+ }>>;
5
+ //# sourceMappingURL=Profiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Profiler.d.ts","sourceRoot":"","sources":["../../src/components/Profiler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG5E,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CA2BhE,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Profiler = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const react_1 = __importStar(require("react"));
39
+ const dreaction_1 = require("../dreaction");
40
+ exports.Profiler = react_1.default.memo((props) => {
41
+ return ((0, jsx_runtime_1.jsx)(react_1.Profiler, { id: props.id, onRender: (id, phase, actualDuration, baseDuration, startTime, commitTime) => {
42
+ dreaction_1.dreaction.send('profiler.render', {
43
+ id,
44
+ phase,
45
+ actualDuration,
46
+ baseDuration,
47
+ startTime,
48
+ commitTime,
49
+ });
50
+ }, children: props.children }));
51
+ });
52
+ exports.Profiler.displayName = 'Profiler';
@@ -32,4 +32,5 @@ export interface DReactionReactNative extends DReaction, ReactNativePluginFeatur
32
32
  };
33
33
  }
34
34
  export declare const dreaction: DReactionReactNative;
35
+ export declare function watchFPS(): () => void;
35
36
  //# sourceMappingURL=dreaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dreaction.d.ts","sourceRoot":"","sources":["../src/dreaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,wB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B,CAAC;AAEF,MAAM,WAAW,oBACf,SAAQ,SAAS,EAEf,yBAAyB;IAC3B,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC1D,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,sBAAsB,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnE,mBAAmB,EAAE,CAAC,CAAC,GAAG,OAAO,EAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,KACE;QACH,iBAAiB,EAAE,CAAC,GAAG,SAAS,CAAC;QACjC,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;QAC1C,iBAAiB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;KAC9C,CAAC;CACH;AAkFD,eAAO,MAAM,SAAS,sBAA+C,CAAC;AAyFtE,wBAAgB,QAAQ,eAMvB"}
package/lib/dreaction.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.dreaction = exports.reactNativeCorePlugins = void 0;
7
+ exports.watchFPS = watchFPS;
7
8
  const react_native_1 = require("react-native");
8
9
  const dreaction_client_core_1 = require("dreaction-client-core");
9
10
  const getReactNativeVersion_1 = __importDefault(require("./helpers/getReactNativeVersion"));
@@ -145,3 +146,10 @@ exports.dreaction.registerDataWatcher = (name, type, options) => {
145
146
  },
146
147
  };
147
148
  };
149
+ function watchFPS() {
150
+ return (0, dreaction_client_core_1.runFPSMeter)((fps) => {
151
+ exports.dreaction.send('profiler.fps', {
152
+ fps,
153
+ });
154
+ });
155
+ }
package/lib/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export type { Command } from 'dreaction-protocol';
2
2
  import { DraggableBall } from './components/DraggableBall';
3
+ import { Profiler } from './components/Profiler';
3
4
  export { DraggableBall as DReactionDraggableBall };
5
+ export { Profiler as DReactionProfiler };
4
6
  export * from './dreaction';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,CAAC;AAEnD,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,CAAC;AACnD,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,CAAC;AAEzC,cAAc,aAAa,CAAC"}
package/lib/index.js CHANGED
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DReactionDraggableBall = void 0;
17
+ exports.DReactionProfiler = exports.DReactionDraggableBall = void 0;
18
18
  const DraggableBall_1 = require("./components/DraggableBall");
19
19
  Object.defineProperty(exports, "DReactionDraggableBall", { enumerable: true, get: function () { return DraggableBall_1.DraggableBall; } });
20
+ const Profiler_1 = require("./components/Profiler");
21
+ Object.defineProperty(exports, "DReactionProfiler", { enumerable: true, get: function () { return Profiler_1.Profiler; } });
20
22
  __exportStar(require("./dreaction"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dreaction-react-native",
3
- "version": "1.4.7",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -15,8 +15,8 @@
15
15
  "author": "moonrailgun <moonrailgun@gmail.com>",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "dreaction-client-core": "1.1.10",
19
- "dreaction-protocol": "1.0.6"
18
+ "dreaction-client-core": "1.2.0",
19
+ "dreaction-protocol": "1.0.8"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@react-native-async-storage/async-storage": "^2.1.0",
@@ -50,7 +50,7 @@ export const ConfigDialog: React.FC<ConfigDialogProps> = React.memo((props) => {
50
50
  >
51
51
  <View style={styles.modalOverlay}>
52
52
  <View style={styles.modalContent}>
53
- <Text style={styles.title}>DReaction Desktop Application Url</Text>
53
+ <Text style={styles.title}>DReaction Desktop Application Host</Text>
54
54
  <TextInput
55
55
  style={styles.input}
56
56
  selectTextOnFocus={selectTextOnFocus}
@@ -0,0 +1,32 @@
1
+ import React, { Profiler as ReactProfiler, PropsWithChildren } from 'react';
2
+ import { dreaction } from '../dreaction';
3
+
4
+ export const Profiler: React.FC<PropsWithChildren<{ id: string }>> = React.memo(
5
+ (props) => {
6
+ return (
7
+ <ReactProfiler
8
+ id={props.id}
9
+ onRender={(
10
+ id,
11
+ phase,
12
+ actualDuration,
13
+ baseDuration,
14
+ startTime,
15
+ commitTime
16
+ ) => {
17
+ dreaction.send('profiler.render', {
18
+ id,
19
+ phase,
20
+ actualDuration,
21
+ baseDuration,
22
+ startTime,
23
+ commitTime,
24
+ });
25
+ }}
26
+ >
27
+ {props.children}
28
+ </ReactProfiler>
29
+ );
30
+ }
31
+ );
32
+ Profiler.displayName = 'Profiler';
package/src/dreaction.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
- import { createClient } from 'dreaction-client-core';
2
+ import { createClient, runFPSMeter } from 'dreaction-client-core';
3
3
  import type {
4
4
  ClientOptions,
5
5
  InferFeaturesFromPlugins,
@@ -244,3 +244,11 @@ dreaction.registerDataWatcher = <T = unknown>(
244
244
  },
245
245
  };
246
246
  };
247
+
248
+ export function watchFPS() {
249
+ return runFPSMeter((fps) => {
250
+ dreaction.send('profiler.fps', {
251
+ fps,
252
+ });
253
+ });
254
+ }
package/src/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export type { Command } from 'dreaction-protocol';
2
2
  import { DraggableBall } from './components/DraggableBall';
3
+ import { Profiler } from './components/Profiler';
3
4
 
4
5
  export { DraggableBall as DReactionDraggableBall };
6
+ export { Profiler as DReactionProfiler };
5
7
 
6
8
  export * from './dreaction';