@player-devtools/basic-plugin-react 0.13.1--canary.13.710 → 0.13.1--canary.13.739
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/index.cjs +37 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +35 -14
- package/dist/index.mjs +35 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/DefaultBasicDevtoolsWrapper.tsx +25 -0
- package/src/WrapperComponent.tsx +25 -0
- package/src/index.ts +2 -0
- package/src/plugin.tsx +52 -0
- package/src/types.ts +6 -0
- package/types/DefaultBasicDevtoolsWrapper.d.ts +4 -0
- package/types/WrapperComponent.d.ts +11 -0
- package/types/index.d.ts +2 -17
- package/types/plugin.d.ts +15 -0
- package/types/types.d.ts +6 -0
- package/src/index.tsx +0 -81
package/dist/cjs/index.cjs
CHANGED
|
@@ -27,22 +27,40 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/index.
|
|
30
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
BasicReactDevtoolsPlugin: () => BasicReactDevtoolsPlugin
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx
|
|
38
|
+
var import_react3 = __toESM(require("react"));
|
|
37
39
|
var import_plugin_react = require("@player-devtools/plugin-react");
|
|
38
40
|
var import_basic_plugin = require("@player-devtools/basic-plugin");
|
|
39
|
-
|
|
41
|
+
|
|
42
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/WrapperComponent.tsx
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
var WrapperComponent = ({
|
|
45
|
+
Component,
|
|
46
|
+
Wrapper,
|
|
47
|
+
store,
|
|
48
|
+
playerID
|
|
49
|
+
}) => {
|
|
50
|
+
const [state, setState] = (0, import_react.useState)(store.getState());
|
|
51
|
+
(0, import_react.useEffect)(() => store.subscribe(setState), [store]);
|
|
52
|
+
return /* @__PURE__ */ import_react.default.createElement(Wrapper, { state, playerID }, /* @__PURE__ */ import_react.default.createElement(Component, null));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/DefaultBasicDevtoolsWrapper.tsx
|
|
56
|
+
var import_react2 = __toESM(require("react"));
|
|
57
|
+
var DefaultBasicDevtoolsWrapper = ({
|
|
40
58
|
state,
|
|
41
59
|
playerID,
|
|
42
60
|
children
|
|
43
61
|
}) => {
|
|
44
|
-
const [highlight, setHighlight] = (0,
|
|
45
|
-
(0,
|
|
62
|
+
const [highlight, setHighlight] = (0, import_react2.useState)(false);
|
|
63
|
+
(0, import_react2.useEffect)(() => {
|
|
46
64
|
if (playerID === state.currentPlayer) {
|
|
47
65
|
setHighlight(true);
|
|
48
66
|
const timer = setTimeout(() => {
|
|
@@ -51,13 +69,15 @@ var BasicDevtoolsWrapper = ({
|
|
|
51
69
|
return () => clearTimeout(timer);
|
|
52
70
|
}
|
|
53
71
|
}, [playerID, state.currentPlayer]);
|
|
54
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { id: playerID, style: highlight ? { border: "2px solid blue" } : {} }, children);
|
|
55
73
|
};
|
|
74
|
+
|
|
75
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx
|
|
56
76
|
var BasicReactDevtoolsPlugin = class extends import_plugin_react.ReactDevtoolsPlugin {
|
|
57
77
|
constructor(id, wrapper) {
|
|
58
78
|
super();
|
|
59
79
|
this.name = "BasicReactDevtoolsPlugin";
|
|
60
|
-
this.wrapper = wrapper ??
|
|
80
|
+
this.wrapper = wrapper ?? DefaultBasicDevtoolsWrapper;
|
|
61
81
|
this.corePlugin = new import_basic_plugin.BasicDevtoolsPlugin({
|
|
62
82
|
playerID: id ?? "default-id",
|
|
63
83
|
handler: this
|
|
@@ -67,13 +87,16 @@ var BasicReactDevtoolsPlugin = class extends import_plugin_react.ReactDevtoolsPl
|
|
|
67
87
|
if (!this.checkIfDevtoolsIsActive()) return;
|
|
68
88
|
super.applyReact(reactPlayer);
|
|
69
89
|
reactPlayer.hooks.webComponent.tap(this.name, (Component) => {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
const BasicReactDevtoolsComponent = () => /* @__PURE__ */ import_react3.default.createElement(
|
|
91
|
+
WrapperComponent,
|
|
92
|
+
{
|
|
93
|
+
Component,
|
|
94
|
+
Wrapper: this.wrapper,
|
|
95
|
+
store: this.store,
|
|
96
|
+
playerID: this.playerID
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
return BasicReactDevtoolsComponent;
|
|
77
100
|
});
|
|
78
101
|
}
|
|
79
102
|
processInteraction(interaction) {
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/index.ts","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/WrapperComponent.tsx","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/DefaultBasicDevtoolsWrapper.tsx"],"sourcesContent":["export * from \"./types\";\nexport * from \"./plugin\";\n","import React from \"react\";\nimport type { ReactPlayer } from \"@player-ui/react\";\nimport { ReactDevtoolsPlugin } from \"@player-devtools/plugin-react\";\nimport { BasicDevtoolsPlugin } from \"@player-devtools/basic-plugin\";\nimport type { DevtoolsPluginInteractionEvent } from \"@player-devtools/types\";\nimport { WrapperComponent } from \"./WrapperComponent\";\nimport { DefaultBasicDevtoolsWrapper } from \"./DefaultBasicDevtoolsWrapper\";\nimport type { DevtoolsWrapperProps } from \"./types\";\n\nexport class BasicReactDevtoolsPlugin extends ReactDevtoolsPlugin<BasicDevtoolsPlugin> {\n name = \"BasicReactDevtoolsPlugin\";\n\n corePlugin: BasicDevtoolsPlugin;\n\n private wrapper: React.ComponentType<DevtoolsWrapperProps>;\n\n constructor(\n id?: string,\n wrapper?: React.ComponentType<DevtoolsWrapperProps>,\n ) {\n super();\n\n this.wrapper = wrapper ?? DefaultBasicDevtoolsWrapper;\n this.corePlugin = new BasicDevtoolsPlugin({\n playerID: id ?? \"default-id\",\n handler: this,\n });\n }\n\n applyReact(reactPlayer: ReactPlayer): void {\n if (!this.checkIfDevtoolsIsActive()) return;\n\n super.applyReact(reactPlayer);\n\n reactPlayer.hooks.webComponent.tap(this.name, (Component) => {\n const BasicReactDevtoolsComponent = () => (\n <WrapperComponent\n Component={Component}\n Wrapper={this.wrapper}\n store={this.store}\n playerID={this.playerID}\n />\n );\n\n return BasicReactDevtoolsComponent;\n });\n }\n\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void {\n super.processInteraction(interaction);\n }\n}\n","import React, { useEffect, useState } from \"react\";\nimport type { PluginStore } from \"@player-devtools/plugin-react\";\nimport { DevtoolsWrapperProps } from \"./types\";\n\nexport type WrapperComponentProps = {\n Component: React.ComponentType;\n Wrapper: React.ComponentType<DevtoolsWrapperProps>;\n store: PluginStore;\n playerID: string;\n};\n\nexport const WrapperComponent = ({\n Component,\n Wrapper,\n store,\n playerID,\n}: WrapperComponentProps): React.JSX.Element => {\n const [state, setState] = useState(store.getState());\n useEffect(() => store.subscribe(setState), [store]);\n return (\n <Wrapper state={state} playerID={playerID}>\n <Component />\n </Wrapper>\n );\n};\n","import React, { useEffect, useState } from \"react\";\nimport type { DevtoolsWrapperProps } from \"./types\";\n\nexport const DefaultBasicDevtoolsWrapper = ({\n state,\n playerID,\n children,\n}: DevtoolsWrapperProps): React.JSX.Element => {\n const [highlight, setHighlight] = useState(false);\n useEffect(() => {\n if (playerID === state.currentPlayer) {\n setHighlight(true);\n const timer = setTimeout(() => {\n setHighlight(false);\n }, 1000);\n return () => clearTimeout(timer);\n }\n }, [playerID, state.currentPlayer]);\n\n return (\n <div id={playerID} style={highlight ? { border: \"2px solid blue\" } : {}}>\n {children}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkB;AAElB,0BAAoC;AACpC,0BAAoC;;;ACHpC,mBAA2C;AAWpC,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAgD;AAC9C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,MAAM,SAAS,CAAC;AACnD,8BAAU,MAAM,MAAM,UAAU,QAAQ,GAAG,CAAC,KAAK,CAAC;AAClD,SACE,6BAAAC,QAAA,cAAC,WAAQ,OAAc,YACrB,6BAAAA,QAAA,cAAC,eAAU,CACb;AAEJ;;;ACxBA,IAAAC,gBAA2C;AAGpC,IAAM,8BAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,CAAC,WAAW,YAAY,QAAI,wBAAS,KAAK;AAChD,+BAAU,MAAM;AACd,QAAI,aAAa,MAAM,eAAe;AACpC,mBAAa,IAAI;AACjB,YAAM,QAAQ,WAAW,MAAM;AAC7B,qBAAa,KAAK;AAAA,MACpB,GAAG,GAAI;AACP,aAAO,MAAM,aAAa,KAAK;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,aAAa,CAAC;AAElC,SACE,8BAAAC,QAAA,cAAC,SAAI,IAAI,UAAU,OAAO,YAAY,EAAE,QAAQ,iBAAiB,IAAI,CAAC,KACnE,QACH;AAEJ;;;AFfO,IAAM,2BAAN,cAAuC,wCAAyC;AAAA,EAOrF,YACE,IACA,SACA;AACA,UAAM;AAVR,gBAAO;AAYL,SAAK,UAAU,WAAW;AAC1B,SAAK,aAAa,IAAI,wCAAoB;AAAA,MACxC,UAAU,MAAM;AAAA,MAChB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,aAAgC;AACzC,QAAI,CAAC,KAAK,wBAAwB,EAAG;AAErC,UAAM,WAAW,WAAW;AAE5B,gBAAY,MAAM,aAAa,IAAI,KAAK,MAAM,CAAC,cAAc;AAC3D,YAAM,8BAA8B,MAClC,8BAAAC,QAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,SAAS,KAAK;AAAA,UACd,OAAO,KAAK;AAAA,UACZ,UAAU,KAAK;AAAA;AAAA,MACjB;AAGF,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,mBAAmB,aAAmD;AACpE,UAAM,mBAAmB,WAAW;AAAA,EACtC;AACF;","names":["import_react","React","import_react","React","React"]}
|
package/dist/index.legacy-esm.js
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/
|
|
2
|
-
import
|
|
1
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx
|
|
2
|
+
import React3 from "react";
|
|
3
3
|
import { ReactDevtoolsPlugin } from "@player-devtools/plugin-react";
|
|
4
4
|
import { BasicDevtoolsPlugin } from "@player-devtools/basic-plugin";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/WrapperComponent.tsx
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
var WrapperComponent = ({
|
|
9
|
+
Component,
|
|
10
|
+
Wrapper,
|
|
11
|
+
store,
|
|
12
|
+
playerID
|
|
13
|
+
}) => {
|
|
14
|
+
const [state, setState] = useState(store.getState());
|
|
15
|
+
useEffect(() => store.subscribe(setState), [store]);
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Wrapper, { state, playerID }, /* @__PURE__ */ React.createElement(Component, null));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/DefaultBasicDevtoolsWrapper.tsx
|
|
20
|
+
import React2, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
21
|
+
var DefaultBasicDevtoolsWrapper = ({
|
|
6
22
|
state,
|
|
7
23
|
playerID,
|
|
8
24
|
children
|
|
9
25
|
}) => {
|
|
10
|
-
const [highlight, setHighlight] =
|
|
11
|
-
|
|
26
|
+
const [highlight, setHighlight] = useState2(false);
|
|
27
|
+
useEffect2(() => {
|
|
12
28
|
if (playerID === state.currentPlayer) {
|
|
13
29
|
setHighlight(true);
|
|
14
30
|
const timer = setTimeout(() => {
|
|
@@ -17,13 +33,15 @@ var BasicDevtoolsWrapper = ({
|
|
|
17
33
|
return () => clearTimeout(timer);
|
|
18
34
|
}
|
|
19
35
|
}, [playerID, state.currentPlayer]);
|
|
20
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ React2.createElement("div", { id: playerID, style: highlight ? { border: "2px solid blue" } : {} }, children);
|
|
21
37
|
};
|
|
38
|
+
|
|
39
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx
|
|
22
40
|
var BasicReactDevtoolsPlugin = class extends ReactDevtoolsPlugin {
|
|
23
41
|
constructor(id, wrapper) {
|
|
24
42
|
super();
|
|
25
43
|
this.name = "BasicReactDevtoolsPlugin";
|
|
26
|
-
this.wrapper = wrapper ??
|
|
44
|
+
this.wrapper = wrapper ?? DefaultBasicDevtoolsWrapper;
|
|
27
45
|
this.corePlugin = new BasicDevtoolsPlugin({
|
|
28
46
|
playerID: id ?? "default-id",
|
|
29
47
|
handler: this
|
|
@@ -33,13 +51,16 @@ var BasicReactDevtoolsPlugin = class extends ReactDevtoolsPlugin {
|
|
|
33
51
|
if (!this.checkIfDevtoolsIsActive()) return;
|
|
34
52
|
super.applyReact(reactPlayer);
|
|
35
53
|
reactPlayer.hooks.webComponent.tap(this.name, (Component) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
const BasicReactDevtoolsComponent = () => /* @__PURE__ */ React3.createElement(
|
|
55
|
+
WrapperComponent,
|
|
56
|
+
{
|
|
57
|
+
Component,
|
|
58
|
+
Wrapper: this.wrapper,
|
|
59
|
+
store: this.store,
|
|
60
|
+
playerID: this.playerID
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return BasicReactDevtoolsComponent;
|
|
43
64
|
});
|
|
44
65
|
}
|
|
45
66
|
processInteraction(interaction) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/
|
|
2
|
-
import
|
|
1
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx
|
|
2
|
+
import React3 from "react";
|
|
3
3
|
import { ReactDevtoolsPlugin } from "@player-devtools/plugin-react";
|
|
4
4
|
import { BasicDevtoolsPlugin } from "@player-devtools/basic-plugin";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/WrapperComponent.tsx
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
var WrapperComponent = ({
|
|
9
|
+
Component,
|
|
10
|
+
Wrapper,
|
|
11
|
+
store,
|
|
12
|
+
playerID
|
|
13
|
+
}) => {
|
|
14
|
+
const [state, setState] = useState(store.getState());
|
|
15
|
+
useEffect(() => store.subscribe(setState), [store]);
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Wrapper, { state, playerID }, /* @__PURE__ */ React.createElement(Component, null));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/DefaultBasicDevtoolsWrapper.tsx
|
|
20
|
+
import React2, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
21
|
+
var DefaultBasicDevtoolsWrapper = ({
|
|
6
22
|
state,
|
|
7
23
|
playerID,
|
|
8
24
|
children
|
|
9
25
|
}) => {
|
|
10
|
-
const [highlight, setHighlight] =
|
|
11
|
-
|
|
26
|
+
const [highlight, setHighlight] = useState2(false);
|
|
27
|
+
useEffect2(() => {
|
|
12
28
|
if (playerID === state.currentPlayer) {
|
|
13
29
|
setHighlight(true);
|
|
14
30
|
const timer = setTimeout(() => {
|
|
@@ -17,13 +33,15 @@ var BasicDevtoolsWrapper = ({
|
|
|
17
33
|
return () => clearTimeout(timer);
|
|
18
34
|
}
|
|
19
35
|
}, [playerID, state.currentPlayer]);
|
|
20
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ React2.createElement("div", { id: playerID, style: highlight ? { border: "2px solid blue" } : {} }, children);
|
|
21
37
|
};
|
|
38
|
+
|
|
39
|
+
// ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx
|
|
22
40
|
var BasicReactDevtoolsPlugin = class extends ReactDevtoolsPlugin {
|
|
23
41
|
constructor(id, wrapper) {
|
|
24
42
|
super();
|
|
25
43
|
this.name = "BasicReactDevtoolsPlugin";
|
|
26
|
-
this.wrapper = wrapper ??
|
|
44
|
+
this.wrapper = wrapper ?? DefaultBasicDevtoolsWrapper;
|
|
27
45
|
this.corePlugin = new BasicDevtoolsPlugin({
|
|
28
46
|
playerID: id ?? "default-id",
|
|
29
47
|
handler: this
|
|
@@ -33,13 +51,16 @@ var BasicReactDevtoolsPlugin = class extends ReactDevtoolsPlugin {
|
|
|
33
51
|
if (!this.checkIfDevtoolsIsActive()) return;
|
|
34
52
|
super.applyReact(reactPlayer);
|
|
35
53
|
reactPlayer.hooks.webComponent.tap(this.name, (Component) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
const BasicReactDevtoolsComponent = () => /* @__PURE__ */ React3.createElement(
|
|
55
|
+
WrapperComponent,
|
|
56
|
+
{
|
|
57
|
+
Component,
|
|
58
|
+
Wrapper: this.wrapper,
|
|
59
|
+
store: this.store,
|
|
60
|
+
playerID: this.playerID
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return BasicReactDevtoolsComponent;
|
|
43
64
|
});
|
|
44
65
|
}
|
|
45
66
|
processInteraction(interaction) {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/plugin.tsx","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/WrapperComponent.tsx","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/react/src/DefaultBasicDevtoolsWrapper.tsx"],"sourcesContent":["import React from \"react\";\nimport type { ReactPlayer } from \"@player-ui/react\";\nimport { ReactDevtoolsPlugin } from \"@player-devtools/plugin-react\";\nimport { BasicDevtoolsPlugin } from \"@player-devtools/basic-plugin\";\nimport type { DevtoolsPluginInteractionEvent } from \"@player-devtools/types\";\nimport { WrapperComponent } from \"./WrapperComponent\";\nimport { DefaultBasicDevtoolsWrapper } from \"./DefaultBasicDevtoolsWrapper\";\nimport type { DevtoolsWrapperProps } from \"./types\";\n\nexport class BasicReactDevtoolsPlugin extends ReactDevtoolsPlugin<BasicDevtoolsPlugin> {\n name = \"BasicReactDevtoolsPlugin\";\n\n corePlugin: BasicDevtoolsPlugin;\n\n private wrapper: React.ComponentType<DevtoolsWrapperProps>;\n\n constructor(\n id?: string,\n wrapper?: React.ComponentType<DevtoolsWrapperProps>,\n ) {\n super();\n\n this.wrapper = wrapper ?? DefaultBasicDevtoolsWrapper;\n this.corePlugin = new BasicDevtoolsPlugin({\n playerID: id ?? \"default-id\",\n handler: this,\n });\n }\n\n applyReact(reactPlayer: ReactPlayer): void {\n if (!this.checkIfDevtoolsIsActive()) return;\n\n super.applyReact(reactPlayer);\n\n reactPlayer.hooks.webComponent.tap(this.name, (Component) => {\n const BasicReactDevtoolsComponent = () => (\n <WrapperComponent\n Component={Component}\n Wrapper={this.wrapper}\n store={this.store}\n playerID={this.playerID}\n />\n );\n\n return BasicReactDevtoolsComponent;\n });\n }\n\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void {\n super.processInteraction(interaction);\n }\n}\n","import React, { useEffect, useState } from \"react\";\nimport type { PluginStore } from \"@player-devtools/plugin-react\";\nimport { DevtoolsWrapperProps } from \"./types\";\n\nexport type WrapperComponentProps = {\n Component: React.ComponentType;\n Wrapper: React.ComponentType<DevtoolsWrapperProps>;\n store: PluginStore;\n playerID: string;\n};\n\nexport const WrapperComponent = ({\n Component,\n Wrapper,\n store,\n playerID,\n}: WrapperComponentProps): React.JSX.Element => {\n const [state, setState] = useState(store.getState());\n useEffect(() => store.subscribe(setState), [store]);\n return (\n <Wrapper state={state} playerID={playerID}>\n <Component />\n </Wrapper>\n );\n};\n","import React, { useEffect, useState } from \"react\";\nimport type { DevtoolsWrapperProps } from \"./types\";\n\nexport const DefaultBasicDevtoolsWrapper = ({\n state,\n playerID,\n children,\n}: DevtoolsWrapperProps): React.JSX.Element => {\n const [highlight, setHighlight] = useState(false);\n useEffect(() => {\n if (playerID === state.currentPlayer) {\n setHighlight(true);\n const timer = setTimeout(() => {\n setHighlight(false);\n }, 1000);\n return () => clearTimeout(timer);\n }\n }, [playerID, state.currentPlayer]);\n\n return (\n <div id={playerID} style={highlight ? { border: \"2px solid blue\" } : {}}>\n {children}\n </div>\n );\n};\n"],"mappings":";AAAA,OAAOA,YAAW;AAElB,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;;;ACHpC,OAAO,SAAS,WAAW,gBAAgB;AAWpC,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAgD;AAC9C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,MAAM,SAAS,CAAC;AACnD,YAAU,MAAM,MAAM,UAAU,QAAQ,GAAG,CAAC,KAAK,CAAC;AAClD,SACE,oCAAC,WAAQ,OAAc,YACrB,oCAAC,eAAU,CACb;AAEJ;;;ACxBA,OAAOC,UAAS,aAAAC,YAAW,YAAAC,iBAAgB;AAGpC,IAAM,8BAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,CAAC,WAAW,YAAY,IAAIA,UAAS,KAAK;AAChD,EAAAD,WAAU,MAAM;AACd,QAAI,aAAa,MAAM,eAAe;AACpC,mBAAa,IAAI;AACjB,YAAM,QAAQ,WAAW,MAAM;AAC7B,qBAAa,KAAK;AAAA,MACpB,GAAG,GAAI;AACP,aAAO,MAAM,aAAa,KAAK;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,aAAa,CAAC;AAElC,SACE,gBAAAD,OAAA,cAAC,SAAI,IAAI,UAAU,OAAO,YAAY,EAAE,QAAQ,iBAAiB,IAAI,CAAC,KACnE,QACH;AAEJ;;;AFfO,IAAM,2BAAN,cAAuC,oBAAyC;AAAA,EAOrF,YACE,IACA,SACA;AACA,UAAM;AAVR,gBAAO;AAYL,SAAK,UAAU,WAAW;AAC1B,SAAK,aAAa,IAAI,oBAAoB;AAAA,MACxC,UAAU,MAAM;AAAA,MAChB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,aAAgC;AACzC,QAAI,CAAC,KAAK,wBAAwB,EAAG;AAErC,UAAM,WAAW,WAAW;AAE5B,gBAAY,MAAM,aAAa,IAAI,KAAK,MAAM,CAAC,cAAc;AAC3D,YAAM,8BAA8B,MAClC,gBAAAG,OAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,SAAS,KAAK;AAAA,UACd,OAAO,KAAK;AAAA,UACZ,UAAU,KAAK;AAAA;AAAA,MACjB;AAGF,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEA,mBAAmB,aAAmD;AACpE,UAAM,mBAAmB,WAAW;AAAA,EACtC;AACF;","names":["React","React","useEffect","useState","React"]}
|
package/package.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"types"
|
|
7
7
|
],
|
|
8
8
|
"name": "@player-devtools/basic-plugin-react",
|
|
9
|
-
"version": "0.13.1--canary.13.
|
|
9
|
+
"version": "0.13.1--canary.13.739",
|
|
10
10
|
"main": "dist/cjs/index.cjs",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@player-devtools/basic-plugin": "0.13.1--canary.13.
|
|
13
|
-
"@player-devtools/plugin-react": "0.13.1--canary.13.
|
|
14
|
-
"@player-devtools/types": "0.13.1--canary.13.
|
|
12
|
+
"@player-devtools/basic-plugin": "0.13.1--canary.13.739",
|
|
13
|
+
"@player-devtools/plugin-react": "0.13.1--canary.13.739",
|
|
14
|
+
"@player-devtools/types": "0.13.1--canary.13.739",
|
|
15
15
|
"@devtools-ui/plugin": "0.4.0",
|
|
16
16
|
"@player-ui/react": "0.12.0-next.1",
|
|
17
17
|
"@types/react": "^18.2.51",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import type { DevtoolsWrapperProps } from "./types";
|
|
3
|
+
|
|
4
|
+
export const DefaultBasicDevtoolsWrapper = ({
|
|
5
|
+
state,
|
|
6
|
+
playerID,
|
|
7
|
+
children,
|
|
8
|
+
}: DevtoolsWrapperProps): React.JSX.Element => {
|
|
9
|
+
const [highlight, setHighlight] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (playerID === state.currentPlayer) {
|
|
12
|
+
setHighlight(true);
|
|
13
|
+
const timer = setTimeout(() => {
|
|
14
|
+
setHighlight(false);
|
|
15
|
+
}, 1000);
|
|
16
|
+
return () => clearTimeout(timer);
|
|
17
|
+
}
|
|
18
|
+
}, [playerID, state.currentPlayer]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div id={playerID} style={highlight ? { border: "2px solid blue" } : {}}>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import type { PluginStore } from "@player-devtools/plugin-react";
|
|
3
|
+
import { DevtoolsWrapperProps } from "./types";
|
|
4
|
+
|
|
5
|
+
export type WrapperComponentProps = {
|
|
6
|
+
Component: React.ComponentType;
|
|
7
|
+
Wrapper: React.ComponentType<DevtoolsWrapperProps>;
|
|
8
|
+
store: PluginStore;
|
|
9
|
+
playerID: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const WrapperComponent = ({
|
|
13
|
+
Component,
|
|
14
|
+
Wrapper,
|
|
15
|
+
store,
|
|
16
|
+
playerID,
|
|
17
|
+
}: WrapperComponentProps): React.JSX.Element => {
|
|
18
|
+
const [state, setState] = useState(store.getState());
|
|
19
|
+
useEffect(() => store.subscribe(setState), [store]);
|
|
20
|
+
return (
|
|
21
|
+
<Wrapper state={state} playerID={playerID}>
|
|
22
|
+
<Component />
|
|
23
|
+
</Wrapper>
|
|
24
|
+
);
|
|
25
|
+
};
|
package/src/index.ts
ADDED
package/src/plugin.tsx
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ReactPlayer } from "@player-ui/react";
|
|
3
|
+
import { ReactDevtoolsPlugin } from "@player-devtools/plugin-react";
|
|
4
|
+
import { BasicDevtoolsPlugin } from "@player-devtools/basic-plugin";
|
|
5
|
+
import type { DevtoolsPluginInteractionEvent } from "@player-devtools/types";
|
|
6
|
+
import { WrapperComponent } from "./WrapperComponent";
|
|
7
|
+
import { DefaultBasicDevtoolsWrapper } from "./DefaultBasicDevtoolsWrapper";
|
|
8
|
+
import type { DevtoolsWrapperProps } from "./types";
|
|
9
|
+
|
|
10
|
+
export class BasicReactDevtoolsPlugin extends ReactDevtoolsPlugin<BasicDevtoolsPlugin> {
|
|
11
|
+
name = "BasicReactDevtoolsPlugin";
|
|
12
|
+
|
|
13
|
+
corePlugin: BasicDevtoolsPlugin;
|
|
14
|
+
|
|
15
|
+
private wrapper: React.ComponentType<DevtoolsWrapperProps>;
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
id?: string,
|
|
19
|
+
wrapper?: React.ComponentType<DevtoolsWrapperProps>,
|
|
20
|
+
) {
|
|
21
|
+
super();
|
|
22
|
+
|
|
23
|
+
this.wrapper = wrapper ?? DefaultBasicDevtoolsWrapper;
|
|
24
|
+
this.corePlugin = new BasicDevtoolsPlugin({
|
|
25
|
+
playerID: id ?? "default-id",
|
|
26
|
+
handler: this,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
applyReact(reactPlayer: ReactPlayer): void {
|
|
31
|
+
if (!this.checkIfDevtoolsIsActive()) return;
|
|
32
|
+
|
|
33
|
+
super.applyReact(reactPlayer);
|
|
34
|
+
|
|
35
|
+
reactPlayer.hooks.webComponent.tap(this.name, (Component) => {
|
|
36
|
+
const BasicReactDevtoolsComponent = () => (
|
|
37
|
+
<WrapperComponent
|
|
38
|
+
Component={Component}
|
|
39
|
+
Wrapper={this.wrapper}
|
|
40
|
+
store={this.store}
|
|
41
|
+
playerID={this.playerID}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return BasicReactDevtoolsComponent;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
processInteraction(interaction: DevtoolsPluginInteractionEvent): void {
|
|
50
|
+
super.processInteraction(interaction);
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PluginStore } from "@player-devtools/plugin-react";
|
|
3
|
+
import { DevtoolsWrapperProps } from "./types";
|
|
4
|
+
export type WrapperComponentProps = {
|
|
5
|
+
Component: React.ComponentType;
|
|
6
|
+
Wrapper: React.ComponentType<DevtoolsWrapperProps>;
|
|
7
|
+
store: PluginStore;
|
|
8
|
+
playerID: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const WrapperComponent: ({ Component, Wrapper, store, playerID, }: WrapperComponentProps) => React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=WrapperComponent.d.ts.map
|
package/types/index.d.ts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ReactDevtoolsPlugin } from "@player-devtools/plugin-react";
|
|
4
|
-
import { BasicDevtoolsPlugin } from "@player-devtools/basic-plugin";
|
|
5
|
-
import type { DevtoolsPluginInteractionEvent, DevtoolsPluginsStore } from "@player-devtools/types";
|
|
6
|
-
export type DevtoolsWrapperProps = React.PropsWithChildren<{
|
|
7
|
-
state: DevtoolsPluginsStore;
|
|
8
|
-
playerID: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare class BasicReactDevtoolsPlugin extends ReactDevtoolsPlugin<BasicDevtoolsPlugin> {
|
|
11
|
-
name: string;
|
|
12
|
-
corePlugin: BasicDevtoolsPlugin;
|
|
13
|
-
private wrapper;
|
|
14
|
-
constructor(id?: string, wrapper?: React.ComponentType<DevtoolsWrapperProps>);
|
|
15
|
-
applyReact(reactPlayer: ReactPlayer): void;
|
|
16
|
-
processInteraction(interaction: DevtoolsPluginInteractionEvent): void;
|
|
17
|
-
}
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./plugin";
|
|
18
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ReactPlayer } from "@player-ui/react";
|
|
3
|
+
import { ReactDevtoolsPlugin } from "@player-devtools/plugin-react";
|
|
4
|
+
import { BasicDevtoolsPlugin } from "@player-devtools/basic-plugin";
|
|
5
|
+
import type { DevtoolsPluginInteractionEvent } from "@player-devtools/types";
|
|
6
|
+
import type { DevtoolsWrapperProps } from "./types";
|
|
7
|
+
export declare class BasicReactDevtoolsPlugin extends ReactDevtoolsPlugin<BasicDevtoolsPlugin> {
|
|
8
|
+
name: string;
|
|
9
|
+
corePlugin: BasicDevtoolsPlugin;
|
|
10
|
+
private wrapper;
|
|
11
|
+
constructor(id?: string, wrapper?: React.ComponentType<DevtoolsWrapperProps>);
|
|
12
|
+
applyReact(reactPlayer: ReactPlayer): void;
|
|
13
|
+
processInteraction(interaction: DevtoolsPluginInteractionEvent): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=plugin.d.ts.map
|
package/types/types.d.ts
ADDED
package/src/index.tsx
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { ReactPlayer } from "@player-ui/react";
|
|
3
|
-
import { ReactDevtoolsPlugin } from "@player-devtools/plugin-react";
|
|
4
|
-
import { BasicDevtoolsPlugin } from "@player-devtools/basic-plugin";
|
|
5
|
-
import type {
|
|
6
|
-
DevtoolsPluginInteractionEvent,
|
|
7
|
-
DevtoolsPluginsStore,
|
|
8
|
-
} from "@player-devtools/types";
|
|
9
|
-
|
|
10
|
-
export type DevtoolsWrapperProps = React.PropsWithChildren<{
|
|
11
|
-
state: DevtoolsPluginsStore;
|
|
12
|
-
playerID: string;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
const BasicDevtoolsWrapper = ({
|
|
16
|
-
state,
|
|
17
|
-
playerID,
|
|
18
|
-
children,
|
|
19
|
-
}: DevtoolsWrapperProps) => {
|
|
20
|
-
const [highlight, setHighlight] = useState(false);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (playerID === state.currentPlayer) {
|
|
23
|
-
setHighlight(true);
|
|
24
|
-
const timer = setTimeout(() => {
|
|
25
|
-
setHighlight(false);
|
|
26
|
-
}, 1000);
|
|
27
|
-
return () => clearTimeout(timer);
|
|
28
|
-
}
|
|
29
|
-
}, [playerID, state.currentPlayer]);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div id={playerID} style={highlight ? { border: "2px solid blue" } : {}}>
|
|
33
|
-
{children}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export class BasicReactDevtoolsPlugin extends ReactDevtoolsPlugin<BasicDevtoolsPlugin> {
|
|
39
|
-
name = "BasicReactDevtoolsPlugin";
|
|
40
|
-
|
|
41
|
-
corePlugin: BasicDevtoolsPlugin;
|
|
42
|
-
|
|
43
|
-
private wrapper: React.ComponentType<DevtoolsWrapperProps>;
|
|
44
|
-
|
|
45
|
-
constructor(
|
|
46
|
-
id?: string,
|
|
47
|
-
wrapper?: React.ComponentType<DevtoolsWrapperProps>,
|
|
48
|
-
) {
|
|
49
|
-
super();
|
|
50
|
-
|
|
51
|
-
this.wrapper = wrapper ?? BasicDevtoolsWrapper;
|
|
52
|
-
this.corePlugin = new BasicDevtoolsPlugin({
|
|
53
|
-
playerID: id ?? "default-id",
|
|
54
|
-
handler: this,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
applyReact(reactPlayer: ReactPlayer): void {
|
|
59
|
-
if (!this.checkIfDevtoolsIsActive()) return;
|
|
60
|
-
|
|
61
|
-
super.applyReact(reactPlayer);
|
|
62
|
-
|
|
63
|
-
reactPlayer.hooks.webComponent.tap(this.name, (Component) => {
|
|
64
|
-
const DevtoolsContainer = () => {
|
|
65
|
-
const Wrapper = this.wrapper;
|
|
66
|
-
const [state, setState] = useState(this.store.getState());
|
|
67
|
-
useEffect(() => this.store.subscribe(setState), [setState]);
|
|
68
|
-
return (
|
|
69
|
-
<Wrapper state={state} playerID={this.playerID}>
|
|
70
|
-
<Component />
|
|
71
|
-
</Wrapper>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
return DevtoolsContainer;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
processInteraction(interaction: DevtoolsPluginInteractionEvent): void {
|
|
79
|
-
super.processInteraction(interaction);
|
|
80
|
-
}
|
|
81
|
-
}
|