@xylabs/react-pixel-debugger 3.1.0-rc.6 → 3.1.1
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/README.md +20 -49
- package/dist/browser/PixelEvent.d.cts +5 -0
- package/dist/browser/PixelEvent.d.cts.map +1 -0
- package/dist/browser/components/PixelDebugger.d.cts +3 -0
- package/dist/browser/components/PixelDebugger.d.cts.map +1 -0
- package/dist/browser/components/PixelDebuggerProvider.d.cts +4 -0
- package/dist/browser/components/PixelDebuggerProvider.d.cts.map +1 -0
- package/dist/browser/components/PixelDebuggerToggle.d.cts +4 -0
- package/dist/browser/components/PixelDebuggerToggle.d.cts.map +1 -0
- package/dist/browser/components/index.d.cts +4 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/hooks/index.d.cts +2 -0
- package/dist/browser/hooks/index.d.cts.map +1 -0
- package/dist/browser/hooks/usePixelAltSendHandler.d.cts +2 -0
- package/dist/browser/hooks/usePixelAltSendHandler.d.cts.map +1 -0
- package/dist/{node/components/PixelDebugger.js → browser/index.cjs} +70 -20
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +4 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/browser/index.js +109 -3
- package/dist/browser/index.js.map +1 -1
- package/dist/node/PixelEvent.d.cts +5 -0
- package/dist/node/PixelEvent.d.cts.map +1 -0
- package/dist/node/components/PixelDebugger.d.cts +3 -0
- package/dist/node/components/PixelDebugger.d.cts.map +1 -0
- package/dist/node/components/PixelDebuggerProvider.d.cts +4 -0
- package/dist/node/components/PixelDebuggerProvider.d.cts.map +1 -0
- package/dist/node/components/PixelDebuggerToggle.d.cts +4 -0
- package/dist/node/components/PixelDebuggerToggle.d.cts.map +1 -0
- package/dist/node/components/index.d.cts +4 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/hooks/index.d.cts +2 -0
- package/dist/node/hooks/index.d.cts.map +1 -0
- package/dist/node/hooks/usePixelAltSendHandler.d.cts +2 -0
- package/dist/node/hooks/usePixelAltSendHandler.d.cts.map +1 -0
- package/dist/node/index.cjs +140 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +4 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +107 -24
- package/dist/node/index.js.map +1 -1
- package/package.json +25 -23
- package/src/components/PixelDebugger.tsx +2 -2
- package/dist/browser/PixelEvent.js +0 -1
- package/dist/browser/PixelEvent.js.map +0 -1
- package/dist/browser/components/PixelDebugger.js +0 -59
- package/dist/browser/components/PixelDebugger.js.map +0 -1
- package/dist/browser/components/PixelDebugger.stories.js +0 -34
- package/dist/browser/components/PixelDebugger.stories.js.map +0 -1
- package/dist/browser/components/PixelDebuggerProvider.js +0 -11
- package/dist/browser/components/PixelDebuggerProvider.js.map +0 -1
- package/dist/browser/components/PixelDebuggerToggle.js +0 -16
- package/dist/browser/components/PixelDebuggerToggle.js.map +0 -1
- package/dist/browser/components/index.js +0 -4
- package/dist/browser/components/index.js.map +0 -1
- package/dist/browser/hooks/index.js +0 -2
- package/dist/browser/hooks/index.js.map +0 -1
- package/dist/browser/hooks/usePixelAltSendHandler.js +0 -25
- package/dist/browser/hooks/usePixelAltSendHandler.js.map +0 -1
- package/dist/node/PixelEvent.js +0 -17
- package/dist/node/PixelEvent.js.map +0 -1
- package/dist/node/PixelEvent.mjs +0 -1
- package/dist/node/PixelEvent.mjs.map +0 -1
- package/dist/node/components/PixelDebugger.js.map +0 -1
- package/dist/node/components/PixelDebugger.mjs +0 -59
- package/dist/node/components/PixelDebugger.mjs.map +0 -1
- package/dist/node/components/PixelDebugger.stories.js +0 -58
- package/dist/node/components/PixelDebugger.stories.js.map +0 -1
- package/dist/node/components/PixelDebugger.stories.mjs +0 -34
- package/dist/node/components/PixelDebugger.stories.mjs.map +0 -1
- package/dist/node/components/PixelDebuggerProvider.js +0 -35
- package/dist/node/components/PixelDebuggerProvider.js.map +0 -1
- package/dist/node/components/PixelDebuggerProvider.mjs +0 -11
- package/dist/node/components/PixelDebuggerProvider.mjs.map +0 -1
- package/dist/node/components/PixelDebuggerToggle.js +0 -40
- package/dist/node/components/PixelDebuggerToggle.js.map +0 -1
- package/dist/node/components/PixelDebuggerToggle.mjs +0 -16
- package/dist/node/components/PixelDebuggerToggle.mjs.map +0 -1
- package/dist/node/components/index.js +0 -27
- package/dist/node/components/index.js.map +0 -1
- package/dist/node/components/index.mjs +0 -4
- package/dist/node/components/index.mjs.map +0 -1
- package/dist/node/hooks/index.js +0 -23
- package/dist/node/hooks/index.js.map +0 -1
- package/dist/node/hooks/index.mjs +0 -2
- package/dist/node/hooks/index.mjs.map +0 -1
- package/dist/node/hooks/usePixelAltSendHandler.js +0 -49
- package/dist/node/hooks/usePixelAltSendHandler.js.map +0 -1
- package/dist/node/hooks/usePixelAltSendHandler.mjs +0 -25
- package/dist/node/hooks/usePixelAltSendHandler.mjs.map +0 -1
- package/dist/node/index.mjs +0 -4
- package/dist/node/index.mjs.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { XyPixel } from "@xylabs/pixel";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
const usePixelAltSendHandler = (altHandler) => {
|
|
4
|
-
const [pixelSend, setPixelSend] = useState();
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (!pixelSend && XyPixel.instance.send) {
|
|
7
|
-
const oldHandler = XyPixel.instance.send.bind(XyPixel.instance);
|
|
8
|
-
setPixelSend(oldHandler);
|
|
9
|
-
} else {
|
|
10
|
-
XyPixel.instance.send = async (event, fields, eventId) => {
|
|
11
|
-
altHandler(event, fields);
|
|
12
|
-
return await pixelSend?.(event, fields, eventId);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return () => {
|
|
16
|
-
if (pixelSend) {
|
|
17
|
-
XyPixel.instance.send = pixelSend;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}, [pixelSend, altHandler]);
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
usePixelAltSendHandler
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=usePixelAltSendHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/usePixelAltSendHandler.ts"],"sourcesContent":["import { XyPixel } from '@xylabs/pixel'\nimport { useEffect, useState } from 'react'\n\nexport const usePixelAltSendHandler = (altHandler: (event: string, fields?: Record<string, unknown>) => void) => {\n const [pixelSend, setPixelSend] = useState<typeof XyPixel.instance.send>()\n useEffect(() => {\n if (!pixelSend && XyPixel.instance.send) {\n const oldHandler = XyPixel.instance.send.bind(XyPixel.instance)\n setPixelSend(oldHandler)\n } else {\n XyPixel.instance.send = async (event: string, fields?: Record<string, unknown>, eventId?: string) => {\n altHandler(event, fields)\n return await pixelSend?.(event, fields, eventId)\n }\n }\n return () => {\n //restore send on unmount\n if (pixelSend) {\n XyPixel.instance.send = pixelSend\n }\n }\n }, [pixelSend, altHandler])\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,WAAW,gBAAgB;AAE7B,MAAM,yBAAyB,CAAC,eAA0E;AAC/G,QAAM,CAAC,WAAW,YAAY,IAAI,SAAuC;AACzE,YAAU,MAAM;AACd,QAAI,CAAC,aAAa,QAAQ,SAAS,MAAM;AACvC,YAAM,aAAa,QAAQ,SAAS,KAAK,KAAK,QAAQ,QAAQ;AAC9D,mBAAa,UAAU;AAAA,IACzB,OAAO;AACL,cAAQ,SAAS,OAAO,OAAO,OAAe,QAAkC,YAAqB;AACnG,mBAAW,OAAO,MAAM;AACxB,eAAO,MAAM,YAAY,OAAO,QAAQ,OAAO;AAAA,MACjD;AAAA,IACF;AACA,WAAO,MAAM;AAEX,UAAI,WAAW;AACb,gBAAQ,SAAS,OAAO;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,UAAU,CAAC;AAC5B;","names":[]}
|
package/dist/node/PixelEvent.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var PixelEvent_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(PixelEvent_exports);
|
|
17
|
-
//# sourceMappingURL=PixelEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/PixelEvent.ts"],"sourcesContent":["export interface PixelEvent {\n event: string\n fields?: unknown\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/node/PixelEvent.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=PixelEvent.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebugger.tsx"],"sourcesContent":["import { Badge, Card, Divider, Typography, useTheme } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { DebugUserEventsContext } from '@xylabs/react-pixel'\nimport { Portal } from '@xylabs/react-portal'\nimport { useContext, useState } from 'react'\n\nimport { usePixelAltSendHandler } from '../hooks'\nimport { PixelEvent } from '../PixelEvent'\n\nexport const PixelDebugger: React.FC = () => {\n const { isDebugging } = useContext(DebugUserEventsContext)\n //TODO - when adding in the location hook to detect location change, was dropping the setEvents in usePixelAltSendHand\n const theme = useTheme()\n const [displayEvents, setDisplayEvents] = useState(false)\n const [events, setEvents] = useState<PixelEvent[]>([])\n\n usePixelAltSendHandler((event: string, fields?: Record<string, unknown>) => {\n setEvents((events) => [{ event, fields }, ...events])\n })\n\n if (!isDebugging) {\n return null\n }\n\n return (\n <Portal>\n <div style={{ bottom: 0, left: 0, position: 'fixed', width: 350 }}>\n <Badge badgeContent={events.length} color=\"primary\" sx={{ width: '100%' }}>\n <Card\n variant=\"outlined\"\n sx={{\n backdropFilter: 'blur(16px) saturate(180%)',\n backgroundColor: 'rgba(18, 18, 18, .70)',\n overflowY: 'auto',\n width: '100%',\n }}\n color={theme.palette.primary.main}\n >\n <FlexCol alignItems=\"stretch\" sx={{ flexFlow: 'column', maxHeight: 400 }}>\n <FlexCol alignItems=\"stretch\" sx={{ flex: '0 1 auto' }}>\n <ButtonEx variant=\"text\" onClick={() => setDisplayEvents(!displayEvents)}>\n XY Pixel Debugger\n </ButtonEx>\n </FlexCol>\n {displayEvents && !!events.length && (\n <FlexCol\n alignItems=\"stretch\"\n alignContent=\"start\"\n padding={2}\n sx={{ cursor: 'pointer', flex: '1 1 auto', overflowY: 'auto', userSelect: 'none' }}\n >\n {events.map((e, index) => (\n <PixelEventDetails key={`${e.event}-${index}`} events={events} index={index} {...e} />\n ))}\n </FlexCol>\n )}\n {displayEvents && !events.length && <Typography variant=\"subtitle2\">No Events</Typography>}\n </FlexCol>\n </Card>\n </Badge>\n </div>\n </Portal>\n )\n}\n\nconst PixelEventDetails: React.FC<PixelEvent & { events: PixelEvent[]; index: number }> = ({ event, fields, index, events }) => {\n const [isOpen, setIsOpen] = useState(false)\n return (\n <FlexCol alignItems=\"stretch\" marginBottom={0.5} onClick={() => setIsOpen(!isOpen)}>\n <Typography variant=\"subtitle2\">{event}</Typography>\n {isOpen && (\n <Typography marginBottom={0.5} variant=\"caption\">\n {JSON.stringify(fields, null, 2)}\n </Typography>\n )}\n {events[index + 1] && <Divider />}\n </FlexCol>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCY;AAvCZ,sBAA2D;AAC3D,0BAAyB;AACzB,2BAAwB;AACxB,yBAAuC;AACvC,0BAAuB;AACvB,mBAAqC;AAErC,mBAAuC;AAGhC,MAAM,gBAA0B,MAAM;AAC3C,QAAM,EAAE,YAAY,QAAI,yBAAW,yCAAsB;AAEzD,QAAM,YAAQ,0BAAS;AACvB,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,KAAK;AACxD,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAuB,CAAC,CAAC;AAErD,2CAAuB,CAAC,OAAe,WAAqC;AAC1E,cAAU,CAACA,YAAW,CAAC,EAAE,OAAO,OAAO,GAAG,GAAGA,OAAM,CAAC;AAAA,EACtD,CAAC;AAED,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,8BACC,sDAAC,SAAI,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,SAAS,OAAO,IAAI,GAC9D,sDAAC,yBAAM,cAAc,OAAO,QAAQ,OAAM,WAAU,IAAI,EAAE,OAAO,OAAO,GACtE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,IAAI;AAAA,QACF,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,OAAO;AAAA,MACT;AAAA,MACA,OAAO,MAAM,QAAQ,QAAQ;AAAA,MAE7B,uDAAC,gCAAQ,YAAW,WAAU,IAAI,EAAE,UAAU,UAAU,WAAW,IAAI,GACrE;AAAA,oDAAC,gCAAQ,YAAW,WAAU,IAAI,EAAE,MAAM,WAAW,GACnD,sDAAC,gCAAS,SAAQ,QAAO,SAAS,MAAM,iBAAiB,CAAC,aAAa,GAAG,+BAE1E,GACF;AAAA,QACC,iBAAiB,CAAC,CAAC,OAAO,UACzB;AAAA,UAAC;AAAA;AAAA,YACC,YAAW;AAAA,YACX,cAAa;AAAA,YACb,SAAS;AAAA,YACT,IAAI,EAAE,QAAQ,WAAW,MAAM,YAAY,WAAW,QAAQ,YAAY,OAAO;AAAA,YAEhF,iBAAO,IAAI,CAAC,GAAG,UACd,4CAAC,qBAA8C,QAAgB,OAAe,GAAG,KAAzD,GAAG,EAAE,KAAK,IAAI,KAAK,EAAyC,CACrF;AAAA;AAAA,QACH;AAAA,QAED,iBAAiB,CAAC,OAAO,UAAU,4CAAC,8BAAW,SAAQ,aAAY,uBAAS;AAAA,SAC/E;AAAA;AAAA,EACF,GACF,GACF,GACF;AAEJ;AAEA,MAAM,oBAAoF,CAAC,EAAE,OAAO,QAAQ,OAAO,OAAO,MAAM;AAC9H,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,SACE,6CAAC,gCAAQ,YAAW,WAAU,cAAc,KAAK,SAAS,MAAM,UAAU,CAAC,MAAM,GAC/E;AAAA,gDAAC,8BAAW,SAAQ,aAAa,iBAAM;AAAA,IACtC,UACC,4CAAC,8BAAW,cAAc,KAAK,SAAQ,WACpC,eAAK,UAAU,QAAQ,MAAM,CAAC,GACjC;AAAA,IAED,OAAO,QAAQ,CAAC,KAAK,4CAAC,2BAAQ;AAAA,KACjC;AAEJ;","names":["events"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Badge, Card, Divider, Typography, useTheme } from "@mui/material";
|
|
3
|
-
import { ButtonEx } from "@xylabs/react-button";
|
|
4
|
-
import { FlexCol } from "@xylabs/react-flexbox";
|
|
5
|
-
import { DebugUserEventsContext } from "@xylabs/react-pixel";
|
|
6
|
-
import { Portal } from "@xylabs/react-portal";
|
|
7
|
-
import { useContext, useState } from "react";
|
|
8
|
-
import { usePixelAltSendHandler } from "../hooks";
|
|
9
|
-
const PixelDebugger = () => {
|
|
10
|
-
const { isDebugging } = useContext(DebugUserEventsContext);
|
|
11
|
-
const theme = useTheme();
|
|
12
|
-
const [displayEvents, setDisplayEvents] = useState(false);
|
|
13
|
-
const [events, setEvents] = useState([]);
|
|
14
|
-
usePixelAltSendHandler((event, fields) => {
|
|
15
|
-
setEvents((events2) => [{ event, fields }, ...events2]);
|
|
16
|
-
});
|
|
17
|
-
if (!isDebugging) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx("div", { style: { bottom: 0, left: 0, position: "fixed", width: 350 }, children: /* @__PURE__ */ jsx(Badge, { badgeContent: events.length, color: "primary", sx: { width: "100%" }, children: /* @__PURE__ */ jsx(
|
|
21
|
-
Card,
|
|
22
|
-
{
|
|
23
|
-
variant: "outlined",
|
|
24
|
-
sx: {
|
|
25
|
-
backdropFilter: "blur(16px) saturate(180%)",
|
|
26
|
-
backgroundColor: "rgba(18, 18, 18, .70)",
|
|
27
|
-
overflowY: "auto",
|
|
28
|
-
width: "100%"
|
|
29
|
-
},
|
|
30
|
-
color: theme.palette.primary.main,
|
|
31
|
-
children: /* @__PURE__ */ jsxs(FlexCol, { alignItems: "stretch", sx: { flexFlow: "column", maxHeight: 400 }, children: [
|
|
32
|
-
/* @__PURE__ */ jsx(FlexCol, { alignItems: "stretch", sx: { flex: "0 1 auto" }, children: /* @__PURE__ */ jsx(ButtonEx, { variant: "text", onClick: () => setDisplayEvents(!displayEvents), children: "XY Pixel Debugger" }) }),
|
|
33
|
-
displayEvents && !!events.length && /* @__PURE__ */ jsx(
|
|
34
|
-
FlexCol,
|
|
35
|
-
{
|
|
36
|
-
alignItems: "stretch",
|
|
37
|
-
alignContent: "start",
|
|
38
|
-
padding: 2,
|
|
39
|
-
sx: { cursor: "pointer", flex: "1 1 auto", overflowY: "auto", userSelect: "none" },
|
|
40
|
-
children: events.map((e, index) => /* @__PURE__ */ jsx(PixelEventDetails, { events, index, ...e }, `${e.event}-${index}`))
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
displayEvents && !events.length && /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "No Events" })
|
|
44
|
-
] })
|
|
45
|
-
}
|
|
46
|
-
) }) }) });
|
|
47
|
-
};
|
|
48
|
-
const PixelEventDetails = ({ event, fields, index, events }) => {
|
|
49
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
50
|
-
return /* @__PURE__ */ jsxs(FlexCol, { alignItems: "stretch", marginBottom: 0.5, onClick: () => setIsOpen(!isOpen), children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: event }),
|
|
52
|
-
isOpen && /* @__PURE__ */ jsx(Typography, { marginBottom: 0.5, variant: "caption", children: JSON.stringify(fields, null, 2) }),
|
|
53
|
-
events[index + 1] && /* @__PURE__ */ jsx(Divider, {})
|
|
54
|
-
] });
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
PixelDebugger
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=PixelDebugger.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebugger.tsx"],"sourcesContent":["import { Badge, Card, Divider, Typography, useTheme } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { DebugUserEventsContext } from '@xylabs/react-pixel'\nimport { Portal } from '@xylabs/react-portal'\nimport { useContext, useState } from 'react'\n\nimport { usePixelAltSendHandler } from '../hooks'\nimport { PixelEvent } from '../PixelEvent'\n\nexport const PixelDebugger: React.FC = () => {\n const { isDebugging } = useContext(DebugUserEventsContext)\n //TODO - when adding in the location hook to detect location change, was dropping the setEvents in usePixelAltSendHand\n const theme = useTheme()\n const [displayEvents, setDisplayEvents] = useState(false)\n const [events, setEvents] = useState<PixelEvent[]>([])\n\n usePixelAltSendHandler((event: string, fields?: Record<string, unknown>) => {\n setEvents((events) => [{ event, fields }, ...events])\n })\n\n if (!isDebugging) {\n return null\n }\n\n return (\n <Portal>\n <div style={{ bottom: 0, left: 0, position: 'fixed', width: 350 }}>\n <Badge badgeContent={events.length} color=\"primary\" sx={{ width: '100%' }}>\n <Card\n variant=\"outlined\"\n sx={{\n backdropFilter: 'blur(16px) saturate(180%)',\n backgroundColor: 'rgba(18, 18, 18, .70)',\n overflowY: 'auto',\n width: '100%',\n }}\n color={theme.palette.primary.main}\n >\n <FlexCol alignItems=\"stretch\" sx={{ flexFlow: 'column', maxHeight: 400 }}>\n <FlexCol alignItems=\"stretch\" sx={{ flex: '0 1 auto' }}>\n <ButtonEx variant=\"text\" onClick={() => setDisplayEvents(!displayEvents)}>\n XY Pixel Debugger\n </ButtonEx>\n </FlexCol>\n {displayEvents && !!events.length && (\n <FlexCol\n alignItems=\"stretch\"\n alignContent=\"start\"\n padding={2}\n sx={{ cursor: 'pointer', flex: '1 1 auto', overflowY: 'auto', userSelect: 'none' }}\n >\n {events.map((e, index) => (\n <PixelEventDetails key={`${e.event}-${index}`} events={events} index={index} {...e} />\n ))}\n </FlexCol>\n )}\n {displayEvents && !events.length && <Typography variant=\"subtitle2\">No Events</Typography>}\n </FlexCol>\n </Card>\n </Badge>\n </div>\n </Portal>\n )\n}\n\nconst PixelEventDetails: React.FC<PixelEvent & { events: PixelEvent[]; index: number }> = ({ event, fields, index, events }) => {\n const [isOpen, setIsOpen] = useState(false)\n return (\n <FlexCol alignItems=\"stretch\" marginBottom={0.5} onClick={() => setIsOpen(!isOpen)}>\n <Typography variant=\"subtitle2\">{event}</Typography>\n {isOpen && (\n <Typography marginBottom={0.5} variant=\"caption\">\n {JSON.stringify(fields, null, 2)}\n </Typography>\n )}\n {events[index + 1] && <Divider />}\n </FlexCol>\n )\n}\n"],"mappings":"AAuCY,SAEI,KAFJ;AAvCZ,SAAS,OAAO,MAAM,SAAS,YAAY,gBAAgB;AAC3D,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,8BAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,YAAY,gBAAgB;AAErC,SAAS,8BAA8B;AAGhC,MAAM,gBAA0B,MAAM;AAC3C,QAAM,EAAE,YAAY,IAAI,WAAW,sBAAsB;AAEzD,QAAM,QAAQ,SAAS;AACvB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAuB,CAAC,CAAC;AAErD,yBAAuB,CAAC,OAAe,WAAqC;AAC1E,cAAU,CAACA,YAAW,CAAC,EAAE,OAAO,OAAO,GAAG,GAAGA,OAAM,CAAC;AAAA,EACtD,CAAC;AAED,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,UACC,8BAAC,SAAI,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,SAAS,OAAO,IAAI,GAC9D,8BAAC,SAAM,cAAc,OAAO,QAAQ,OAAM,WAAU,IAAI,EAAE,OAAO,OAAO,GACtE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,IAAI;AAAA,QACF,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,QACjB,WAAW;AAAA,QACX,OAAO;AAAA,MACT;AAAA,MACA,OAAO,MAAM,QAAQ,QAAQ;AAAA,MAE7B,+BAAC,WAAQ,YAAW,WAAU,IAAI,EAAE,UAAU,UAAU,WAAW,IAAI,GACrE;AAAA,4BAAC,WAAQ,YAAW,WAAU,IAAI,EAAE,MAAM,WAAW,GACnD,8BAAC,YAAS,SAAQ,QAAO,SAAS,MAAM,iBAAiB,CAAC,aAAa,GAAG,+BAE1E,GACF;AAAA,QACC,iBAAiB,CAAC,CAAC,OAAO,UACzB;AAAA,UAAC;AAAA;AAAA,YACC,YAAW;AAAA,YACX,cAAa;AAAA,YACb,SAAS;AAAA,YACT,IAAI,EAAE,QAAQ,WAAW,MAAM,YAAY,WAAW,QAAQ,YAAY,OAAO;AAAA,YAEhF,iBAAO,IAAI,CAAC,GAAG,UACd,oBAAC,qBAA8C,QAAgB,OAAe,GAAG,KAAzD,GAAG,EAAE,KAAK,IAAI,KAAK,EAAyC,CACrF;AAAA;AAAA,QACH;AAAA,QAED,iBAAiB,CAAC,OAAO,UAAU,oBAAC,cAAW,SAAQ,aAAY,uBAAS;AAAA,SAC/E;AAAA;AAAA,EACF,GACF,GACF,GACF;AAEJ;AAEA,MAAM,oBAAoF,CAAC,EAAE,OAAO,QAAQ,OAAO,OAAO,MAAM;AAC9H,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,SACE,qBAAC,WAAQ,YAAW,WAAU,cAAc,KAAK,SAAS,MAAM,UAAU,CAAC,MAAM,GAC/E;AAAA,wBAAC,cAAW,SAAQ,aAAa,iBAAM;AAAA,IACtC,UACC,oBAAC,cAAW,cAAc,KAAK,SAAQ,WACpC,eAAK,UAAU,QAAQ,MAAM,CAAC,GACjC;AAAA,IAED,OAAO,QAAQ,CAAC,KAAK,oBAAC,WAAQ;AAAA,KACjC;AAEJ;","names":["events"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var PixelDebugger_stories_exports = {};
|
|
20
|
-
__export(PixelDebugger_stories_exports, {
|
|
21
|
-
Default: () => Default,
|
|
22
|
-
default: () => PixelDebugger_stories_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(PixelDebugger_stories_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_pixel = require("@xylabs/pixel");
|
|
27
|
-
var import_react2 = require("react");
|
|
28
|
-
var import_index = require("./index");
|
|
29
|
-
var import_PixelDebuggerProvider = require("./PixelDebuggerProvider");
|
|
30
|
-
const StorybookEntry = {
|
|
31
|
-
argTypes: {},
|
|
32
|
-
component: import_index.PixelDebuggerToggle,
|
|
33
|
-
parameters: {
|
|
34
|
-
docs: {
|
|
35
|
-
page: null
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
title: "pixel-debugger/PixelDebuggerToggle"
|
|
39
|
-
};
|
|
40
|
-
const Template = (args) => {
|
|
41
|
-
const [pixel, setPixel] = (0, import_react2.useState)();
|
|
42
|
-
(0, import_react2.useEffect)(() => {
|
|
43
|
-
import_pixel.XyPixel.selectApi(new import_pixel.PixelApi("local"));
|
|
44
|
-
setPixel(import_pixel.XyPixel.init("storybookPixel"));
|
|
45
|
-
}, []);
|
|
46
|
-
return pixel ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_PixelDebuggerProvider.PixelDebuggerProvider, { children: [
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_index.PixelDebuggerToggle, { ...args }),
|
|
48
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_index.PixelDebugger, {})
|
|
49
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
50
|
-
};
|
|
51
|
-
const Default = Template.bind({});
|
|
52
|
-
Default.args = {};
|
|
53
|
-
var PixelDebugger_stories_default = StorybookEntry;
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
Default
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=PixelDebugger.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebugger.stories.tsx"],"sourcesContent":["import { Meta, StoryFn } from '@storybook/react'\nimport { PixelApi, XyPixel } from '@xylabs/pixel'\nimport { useEffect, useState } from 'react'\n\nimport { PixelDebugger, PixelDebuggerToggle } from './index'\nimport { PixelDebuggerProvider } from './PixelDebuggerProvider'\n\nconst StorybookEntry = {\n argTypes: {},\n component: PixelDebuggerToggle,\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'pixel-debugger/PixelDebuggerToggle',\n} as Meta<typeof PixelDebuggerToggle>\n\nconst Template: StoryFn<typeof PixelDebuggerToggle> = (args) => {\n const [pixel, setPixel] = useState<XyPixel>()\n useEffect(() => {\n XyPixel.selectApi(new PixelApi('local'))\n setPixel(XyPixel.init('storybookPixel'))\n }, [])\n return pixel ? (\n <PixelDebuggerProvider>\n <PixelDebuggerToggle {...args} />\n <PixelDebugger />\n </PixelDebuggerProvider>\n ) : (\n <></>\n )\n}\n\nconst Default = Template.bind({})\nDefault.args = {}\n\nexport { Default }\n\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAxBJ,mBAAkC;AAClC,IAAAA,gBAAoC;AAEpC,mBAAmD;AACnD,mCAAsC;AAEtC,MAAM,iBAAiB;AAAA,EACrB,UAAU,CAAC;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,WAAgD,CAAC,SAAS;AAC9D,QAAM,CAAC,OAAO,QAAQ,QAAI,wBAAkB;AAC5C,+BAAU,MAAM;AACd,yBAAQ,UAAU,IAAI,sBAAS,OAAO,CAAC;AACvC,aAAS,qBAAQ,KAAK,gBAAgB,CAAC;AAAA,EACzC,GAAG,CAAC,CAAC;AACL,SAAO,QACL,6CAAC,sDACC;AAAA,gDAAC,oCAAqB,GAAG,MAAM;AAAA,IAC/B,4CAAC,8BAAc;AAAA,KACjB,IAEA,2EAAE;AAEN;AAEA,MAAM,UAAU,SAAS,KAAK,CAAC,CAAC;AAChC,QAAQ,OAAO,CAAC;AAKhB,IAAO,gCAAQ;","names":["import_react"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PixelApi, XyPixel } from "@xylabs/pixel";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { PixelDebugger, PixelDebuggerToggle } from "./index";
|
|
5
|
-
import { PixelDebuggerProvider } from "./PixelDebuggerProvider";
|
|
6
|
-
const StorybookEntry = {
|
|
7
|
-
argTypes: {},
|
|
8
|
-
component: PixelDebuggerToggle,
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
page: null
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
title: "pixel-debugger/PixelDebuggerToggle"
|
|
15
|
-
};
|
|
16
|
-
const Template = (args) => {
|
|
17
|
-
const [pixel, setPixel] = useState();
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
XyPixel.selectApi(new PixelApi("local"));
|
|
20
|
-
setPixel(XyPixel.init("storybookPixel"));
|
|
21
|
-
}, []);
|
|
22
|
-
return pixel ? /* @__PURE__ */ jsxs(PixelDebuggerProvider, { children: [
|
|
23
|
-
/* @__PURE__ */ jsx(PixelDebuggerToggle, { ...args }),
|
|
24
|
-
/* @__PURE__ */ jsx(PixelDebugger, {})
|
|
25
|
-
] }) : /* @__PURE__ */ jsx(Fragment, {});
|
|
26
|
-
};
|
|
27
|
-
const Default = Template.bind({});
|
|
28
|
-
Default.args = {};
|
|
29
|
-
var PixelDebugger_stories_default = StorybookEntry;
|
|
30
|
-
export {
|
|
31
|
-
Default,
|
|
32
|
-
PixelDebugger_stories_default as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=PixelDebugger.stories.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebugger.stories.tsx"],"sourcesContent":["import { Meta, StoryFn } from '@storybook/react'\nimport { PixelApi, XyPixel } from '@xylabs/pixel'\nimport { useEffect, useState } from 'react'\n\nimport { PixelDebugger, PixelDebuggerToggle } from './index'\nimport { PixelDebuggerProvider } from './PixelDebuggerProvider'\n\nconst StorybookEntry = {\n argTypes: {},\n component: PixelDebuggerToggle,\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'pixel-debugger/PixelDebuggerToggle',\n} as Meta<typeof PixelDebuggerToggle>\n\nconst Template: StoryFn<typeof PixelDebuggerToggle> = (args) => {\n const [pixel, setPixel] = useState<XyPixel>()\n useEffect(() => {\n XyPixel.selectApi(new PixelApi('local'))\n setPixel(XyPixel.init('storybookPixel'))\n }, [])\n return pixel ? (\n <PixelDebuggerProvider>\n <PixelDebuggerToggle {...args} />\n <PixelDebugger />\n </PixelDebuggerProvider>\n ) : (\n <></>\n )\n}\n\nconst Default = Template.bind({})\nDefault.args = {}\n\nexport { Default }\n\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":"AAyBI,SAKA,UAJE,KADF;AAxBJ,SAAS,UAAU,eAAe;AAClC,SAAS,WAAW,gBAAgB;AAEpC,SAAS,eAAe,2BAA2B;AACnD,SAAS,6BAA6B;AAEtC,MAAM,iBAAiB;AAAA,EACrB,UAAU,CAAC;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,WAAgD,CAAC,SAAS;AAC9D,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkB;AAC5C,YAAU,MAAM;AACd,YAAQ,UAAU,IAAI,SAAS,OAAO,CAAC;AACvC,aAAS,QAAQ,KAAK,gBAAgB,CAAC;AAAA,EACzC,GAAG,CAAC,CAAC;AACL,SAAO,QACL,qBAAC,yBACC;AAAA,wBAAC,uBAAqB,GAAG,MAAM;AAAA,IAC/B,oBAAC,iBAAc;AAAA,KACjB,IAEA,gCAAE;AAEN;AAEA,MAAM,UAAU,SAAS,KAAK,CAAC,CAAC;AAChC,QAAQ,OAAO,CAAC;AAKhB,IAAO,gCAAQ;","names":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var PixelDebuggerProvider_exports = {};
|
|
20
|
-
__export(PixelDebuggerProvider_exports, {
|
|
21
|
-
PixelDebuggerProvider: () => PixelDebuggerProvider
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(PixelDebuggerProvider_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_react_pixel = require("@xylabs/react-pixel");
|
|
26
|
-
var import_react_shared = require("@xylabs/react-shared");
|
|
27
|
-
const PixelDebuggerProvider = ({ children }) => {
|
|
28
|
-
const [isDebugging, setIsDebugging] = (0, import_react_shared.useLocalStorage)("isDebuggingPixel", false);
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_pixel.DebugUserEventsContext.Provider, { value: { isDebugging, setIsDebugging }, children });
|
|
30
|
-
};
|
|
31
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
-
0 && (module.exports = {
|
|
33
|
-
PixelDebuggerProvider
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=PixelDebuggerProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebuggerProvider.tsx"],"sourcesContent":["import { DebugUserEventsContext } from '@xylabs/react-pixel'\nimport { useLocalStorage, WithChildren } from '@xylabs/react-shared'\n\nexport const PixelDebuggerProvider: React.FC<WithChildren> = ({ children }) => {\n const [isDebugging, setIsDebugging] = useLocalStorage<boolean>('isDebuggingPixel', false)\n return <DebugUserEventsContext.Provider value={{ isDebugging, setIsDebugging }}>{children}</DebugUserEventsContext.Provider>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKS;AALT,yBAAuC;AACvC,0BAA8C;AAEvC,MAAM,wBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,CAAC,aAAa,cAAc,QAAI,qCAAyB,oBAAoB,KAAK;AACxF,SAAO,4CAAC,0CAAuB,UAAvB,EAAgC,OAAO,EAAE,aAAa,eAAe,GAAI,UAAS;AAC5F;","names":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DebugUserEventsContext } from "@xylabs/react-pixel";
|
|
3
|
-
import { useLocalStorage } from "@xylabs/react-shared";
|
|
4
|
-
const PixelDebuggerProvider = ({ children }) => {
|
|
5
|
-
const [isDebugging, setIsDebugging] = useLocalStorage("isDebuggingPixel", false);
|
|
6
|
-
return /* @__PURE__ */ jsx(DebugUserEventsContext.Provider, { value: { isDebugging, setIsDebugging }, children });
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
PixelDebuggerProvider
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=PixelDebuggerProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebuggerProvider.tsx"],"sourcesContent":["import { DebugUserEventsContext } from '@xylabs/react-pixel'\nimport { useLocalStorage, WithChildren } from '@xylabs/react-shared'\n\nexport const PixelDebuggerProvider: React.FC<WithChildren> = ({ children }) => {\n const [isDebugging, setIsDebugging] = useLocalStorage<boolean>('isDebuggingPixel', false)\n return <DebugUserEventsContext.Provider value={{ isDebugging, setIsDebugging }}>{children}</DebugUserEventsContext.Provider>\n}\n"],"mappings":"AAKS;AALT,SAAS,8BAA8B;AACvC,SAAS,uBAAqC;AAEvC,MAAM,wBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,CAAC,aAAa,cAAc,IAAI,gBAAyB,oBAAoB,KAAK;AACxF,SAAO,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,EAAE,aAAa,eAAe,GAAI,UAAS;AAC5F;","names":[]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var PixelDebuggerToggle_exports = {};
|
|
20
|
-
__export(PixelDebuggerToggle_exports, {
|
|
21
|
-
PixelDebuggerToggle: () => PixelDebuggerToggle
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(PixelDebuggerToggle_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_material = require("@mui/material");
|
|
26
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
27
|
-
var import_react_pixel = require("@xylabs/react-pixel");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
const PixelDebuggerToggle = ({ ...props }) => {
|
|
30
|
-
const { setIsDebugging, isDebugging } = (0, import_react.useContext)(import_react_pixel.DebugUserEventsContext);
|
|
31
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexRow, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.FormControl, { children: [
|
|
32
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.FormLabel, { children: "Enable Debugger" }),
|
|
33
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Switch, { checked: isDebugging, onClick: () => setIsDebugging(!isDebugging) })
|
|
34
|
-
] }) });
|
|
35
|
-
};
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
PixelDebuggerToggle
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=PixelDebuggerToggle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebuggerToggle.tsx"],"sourcesContent":["import { FormControl, FormLabel, Switch } from '@mui/material'\nimport { BusyBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { DebugUserEventsContext } from '@xylabs/react-pixel'\nimport { useContext } from 'react'\n\nexport const PixelDebuggerToggle: React.FC<BusyBoxProps> = ({ ...props }) => {\n const { setIsDebugging, isDebugging } = useContext(DebugUserEventsContext)\n\n return (\n <FlexRow {...props}>\n <FormControl>\n <FormLabel>Enable Debugger</FormLabel>\n <Switch checked={isDebugging} onClick={() => setIsDebugging(!isDebugging)} />\n </FormControl>\n </FlexRow>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUM;AAVN,sBAA+C;AAC/C,2BAAsC;AACtC,yBAAuC;AACvC,mBAA2B;AAEpB,MAAM,sBAA8C,CAAC,EAAE,GAAG,MAAM,MAAM;AAC3E,QAAM,EAAE,gBAAgB,YAAY,QAAI,yBAAW,yCAAsB;AAEzE,SACE,4CAAC,gCAAS,GAAG,OACX,uDAAC,+BACC;AAAA,gDAAC,6BAAU,6BAAe;AAAA,IAC1B,4CAAC,0BAAO,SAAS,aAAa,SAAS,MAAM,eAAe,CAAC,WAAW,GAAG;AAAA,KAC7E,GACF;AAEJ;","names":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, FormLabel, Switch } from "@mui/material";
|
|
3
|
-
import { FlexRow } from "@xylabs/react-flexbox";
|
|
4
|
-
import { DebugUserEventsContext } from "@xylabs/react-pixel";
|
|
5
|
-
import { useContext } from "react";
|
|
6
|
-
const PixelDebuggerToggle = ({ ...props }) => {
|
|
7
|
-
const { setIsDebugging, isDebugging } = useContext(DebugUserEventsContext);
|
|
8
|
-
return /* @__PURE__ */ jsx(FlexRow, { ...props, children: /* @__PURE__ */ jsxs(FormControl, { children: [
|
|
9
|
-
/* @__PURE__ */ jsx(FormLabel, { children: "Enable Debugger" }),
|
|
10
|
-
/* @__PURE__ */ jsx(Switch, { checked: isDebugging, onClick: () => setIsDebugging(!isDebugging) })
|
|
11
|
-
] }) });
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
PixelDebuggerToggle
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=PixelDebuggerToggle.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PixelDebuggerToggle.tsx"],"sourcesContent":["import { FormControl, FormLabel, Switch } from '@mui/material'\nimport { BusyBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { DebugUserEventsContext } from '@xylabs/react-pixel'\nimport { useContext } from 'react'\n\nexport const PixelDebuggerToggle: React.FC<BusyBoxProps> = ({ ...props }) => {\n const { setIsDebugging, isDebugging } = useContext(DebugUserEventsContext)\n\n return (\n <FlexRow {...props}>\n <FormControl>\n <FormLabel>Enable Debugger</FormLabel>\n <Switch checked={isDebugging} onClick={() => setIsDebugging(!isDebugging)} />\n </FormControl>\n </FlexRow>\n )\n}\n"],"mappings":"AAUM,SACE,KADF;AAVN,SAAS,aAAa,WAAW,cAAc;AAC/C,SAAuB,eAAe;AACtC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAEpB,MAAM,sBAA8C,CAAC,EAAE,GAAG,MAAM,MAAM;AAC3E,QAAM,EAAE,gBAAgB,YAAY,IAAI,WAAW,sBAAsB;AAEzE,SACE,oBAAC,WAAS,GAAG,OACX,+BAAC,eACC;AAAA,wBAAC,aAAU,6BAAe;AAAA,IAC1B,oBAAC,UAAO,SAAS,aAAa,SAAS,MAAM,eAAe,CAAC,WAAW,GAAG;AAAA,KAC7E,GACF;AAEJ;","names":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var components_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(components_exports);
|
|
18
|
-
__reExport(components_exports, require("./PixelDebugger"), module.exports);
|
|
19
|
-
__reExport(components_exports, require("./PixelDebuggerProvider"), module.exports);
|
|
20
|
-
__reExport(components_exports, require("./PixelDebuggerToggle"), module.exports);
|
|
21
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
-
0 && (module.exports = {
|
|
23
|
-
...require("./PixelDebugger"),
|
|
24
|
-
...require("./PixelDebuggerProvider"),
|
|
25
|
-
...require("./PixelDebuggerToggle")
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './PixelDebugger'\nexport * from './PixelDebuggerProvider'\nexport * from './PixelDebuggerToggle'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,4BAAd;AACA,+BAAc,oCADd;AAEA,+BAAc,kCAFd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './PixelDebugger'\nexport * from './PixelDebuggerProvider'\nexport * from './PixelDebuggerToggle'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
package/dist/node/hooks/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var hooks_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(hooks_exports);
|
|
18
|
-
__reExport(hooks_exports, require("./usePixelAltSendHandler"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./usePixelAltSendHandler")
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './usePixelAltSendHandler'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,qCAAd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './usePixelAltSendHandler'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var usePixelAltSendHandler_exports = {};
|
|
20
|
-
__export(usePixelAltSendHandler_exports, {
|
|
21
|
-
usePixelAltSendHandler: () => usePixelAltSendHandler
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(usePixelAltSendHandler_exports);
|
|
24
|
-
var import_pixel = require("@xylabs/pixel");
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
const usePixelAltSendHandler = (altHandler) => {
|
|
27
|
-
const [pixelSend, setPixelSend] = (0, import_react.useState)();
|
|
28
|
-
(0, import_react.useEffect)(() => {
|
|
29
|
-
if (!pixelSend && import_pixel.XyPixel.instance.send) {
|
|
30
|
-
const oldHandler = import_pixel.XyPixel.instance.send.bind(import_pixel.XyPixel.instance);
|
|
31
|
-
setPixelSend(oldHandler);
|
|
32
|
-
} else {
|
|
33
|
-
import_pixel.XyPixel.instance.send = async (event, fields, eventId) => {
|
|
34
|
-
altHandler(event, fields);
|
|
35
|
-
return await pixelSend?.(event, fields, eventId);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return () => {
|
|
39
|
-
if (pixelSend) {
|
|
40
|
-
import_pixel.XyPixel.instance.send = pixelSend;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}, [pixelSend, altHandler]);
|
|
44
|
-
};
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
usePixelAltSendHandler
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=usePixelAltSendHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/usePixelAltSendHandler.ts"],"sourcesContent":["import { XyPixel } from '@xylabs/pixel'\nimport { useEffect, useState } from 'react'\n\nexport const usePixelAltSendHandler = (altHandler: (event: string, fields?: Record<string, unknown>) => void) => {\n const [pixelSend, setPixelSend] = useState<typeof XyPixel.instance.send>()\n useEffect(() => {\n if (!pixelSend && XyPixel.instance.send) {\n const oldHandler = XyPixel.instance.send.bind(XyPixel.instance)\n setPixelSend(oldHandler)\n } else {\n XyPixel.instance.send = async (event: string, fields?: Record<string, unknown>, eventId?: string) => {\n altHandler(event, fields)\n return await pixelSend?.(event, fields, eventId)\n }\n }\n return () => {\n //restore send on unmount\n if (pixelSend) {\n XyPixel.instance.send = pixelSend\n }\n }\n }, [pixelSend, altHandler])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwB;AACxB,mBAAoC;AAE7B,MAAM,yBAAyB,CAAC,eAA0E;AAC/G,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAuC;AACzE,8BAAU,MAAM;AACd,QAAI,CAAC,aAAa,qBAAQ,SAAS,MAAM;AACvC,YAAM,aAAa,qBAAQ,SAAS,KAAK,KAAK,qBAAQ,QAAQ;AAC9D,mBAAa,UAAU;AAAA,IACzB,OAAO;AACL,2BAAQ,SAAS,OAAO,OAAO,OAAe,QAAkC,YAAqB;AACnG,mBAAW,OAAO,MAAM;AACxB,eAAO,MAAM,YAAY,OAAO,QAAQ,OAAO;AAAA,MACjD;AAAA,IACF;AACA,WAAO,MAAM;AAEX,UAAI,WAAW;AACb,6BAAQ,SAAS,OAAO;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,UAAU,CAAC;AAC5B;","names":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { XyPixel } from "@xylabs/pixel";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
const usePixelAltSendHandler = (altHandler) => {
|
|
4
|
-
const [pixelSend, setPixelSend] = useState();
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (!pixelSend && XyPixel.instance.send) {
|
|
7
|
-
const oldHandler = XyPixel.instance.send.bind(XyPixel.instance);
|
|
8
|
-
setPixelSend(oldHandler);
|
|
9
|
-
} else {
|
|
10
|
-
XyPixel.instance.send = async (event, fields, eventId) => {
|
|
11
|
-
altHandler(event, fields);
|
|
12
|
-
return await pixelSend?.(event, fields, eventId);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return () => {
|
|
16
|
-
if (pixelSend) {
|
|
17
|
-
XyPixel.instance.send = pixelSend;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}, [pixelSend, altHandler]);
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
usePixelAltSendHandler
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=usePixelAltSendHandler.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/usePixelAltSendHandler.ts"],"sourcesContent":["import { XyPixel } from '@xylabs/pixel'\nimport { useEffect, useState } from 'react'\n\nexport const usePixelAltSendHandler = (altHandler: (event: string, fields?: Record<string, unknown>) => void) => {\n const [pixelSend, setPixelSend] = useState<typeof XyPixel.instance.send>()\n useEffect(() => {\n if (!pixelSend && XyPixel.instance.send) {\n const oldHandler = XyPixel.instance.send.bind(XyPixel.instance)\n setPixelSend(oldHandler)\n } else {\n XyPixel.instance.send = async (event: string, fields?: Record<string, unknown>, eventId?: string) => {\n altHandler(event, fields)\n return await pixelSend?.(event, fields, eventId)\n }\n }\n return () => {\n //restore send on unmount\n if (pixelSend) {\n XyPixel.instance.send = pixelSend\n }\n }\n }, [pixelSend, altHandler])\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,WAAW,gBAAgB;AAE7B,MAAM,yBAAyB,CAAC,eAA0E;AAC/G,QAAM,CAAC,WAAW,YAAY,IAAI,SAAuC;AACzE,YAAU,MAAM;AACd,QAAI,CAAC,aAAa,QAAQ,SAAS,MAAM;AACvC,YAAM,aAAa,QAAQ,SAAS,KAAK,KAAK,QAAQ,QAAQ;AAC9D,mBAAa,UAAU;AAAA,IACzB,OAAO;AACL,cAAQ,SAAS,OAAO,OAAO,OAAe,QAAkC,YAAqB;AACnG,mBAAW,OAAO,MAAM;AACxB,eAAO,MAAM,YAAY,OAAO,QAAQ,OAAO;AAAA,MACjD;AAAA,IACF;AACA,WAAO,MAAM;AAEX,UAAI,WAAW;AACb,gBAAQ,SAAS,OAAO;AAAA,MAC1B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,UAAU,CAAC;AAC5B;","names":[]}
|
package/dist/node/index.mjs
DELETED
package/dist/node/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './components'\nexport * from './hooks'\nexport * from './PixelEvent'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|