@xyo-network/react-pixel 7.0.0 → 7.0.2
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/browser/index.mjs +14 -14
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +15 -13
package/dist/browser/index.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/contexts/Pixel/Context.ts
|
|
5
2
|
import { createContextEx } from "@xylabs/react-shared";
|
|
6
3
|
var PixelContext = createContextEx();
|
|
7
4
|
|
|
8
5
|
// src/contexts/Pixel/Provider.tsx
|
|
9
6
|
import { XyPixel } from "@xylabs/pixel";
|
|
10
|
-
import
|
|
11
|
-
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var PixelProvider = (props) => {
|
|
12
10
|
const { children, id } = props;
|
|
13
11
|
XyPixel.init(id);
|
|
14
12
|
const value = useMemo(() => ({
|
|
15
13
|
pixel: XyPixel.instance,
|
|
16
14
|
provided: true
|
|
17
|
-
}), [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
15
|
+
}), [XyPixel.instance]);
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
PixelContext,
|
|
18
|
+
{
|
|
19
|
+
value,
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
24
|
|
|
25
25
|
// src/contexts/Pixel/use.ts
|
|
26
26
|
import { useContextEx } from "@xylabs/react-shared";
|
|
27
|
-
var usePixel =
|
|
27
|
+
var usePixel = (required = true) => {
|
|
28
28
|
const { pixel } = useContextEx(PixelContext, "Pixel", required);
|
|
29
29
|
return pixel;
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
export {
|
|
32
32
|
PixelContext,
|
|
33
33
|
PixelProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/Pixel/Context.ts","../../src/contexts/Pixel/Provider.tsx","../../src/contexts/Pixel/use.ts"],"sourcesContent":["import { createContextEx } from '@xylabs/react-shared'\n\nimport type { PixelContextState } from './State.ts'\n\nexport const PixelContext = createContextEx<PixelContextState>()\n","import { XyPixel } from '@xylabs/pixel'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo } from 'react'\n\nimport { PixelContext } from './Context.ts'\nimport type { PixelContextState } from './State.ts'\n\nexport interface PixelProviderProps {\n id: string\n}\n\nexport const PixelProvider: React.FC<PropsWithChildren<PixelProviderProps>> = (props) => {\n const { children, id } = props\n XyPixel.init(id)\n\n const value: PixelContextState = useMemo(() => ({\n pixel: XyPixel.instance,\n provided: true,\n }), [XyPixel.instance])\n\n return (\n <PixelContext\n value={value}\n >\n {children}\n </PixelContext>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { PixelContext } from './Context.ts'\n\nexport const usePixel = (required = true) => {\n const { pixel } = useContextEx(PixelContext, 'Pixel', required)\n return pixel\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/Pixel/Context.ts","../../src/contexts/Pixel/Provider.tsx","../../src/contexts/Pixel/use.ts"],"sourcesContent":["import { createContextEx } from '@xylabs/react-shared'\n\nimport type { PixelContextState } from './State.ts'\n\nexport const PixelContext = createContextEx<PixelContextState>()\n","import { XyPixel } from '@xylabs/pixel'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo } from 'react'\n\nimport { PixelContext } from './Context.ts'\nimport type { PixelContextState } from './State.ts'\n\nexport interface PixelProviderProps {\n id: string\n}\n\nexport const PixelProvider: React.FC<PropsWithChildren<PixelProviderProps>> = (props) => {\n const { children, id } = props\n XyPixel.init(id)\n\n const value: PixelContextState = useMemo(() => ({\n pixel: XyPixel.instance,\n provided: true,\n }), [XyPixel.instance])\n\n return (\n <PixelContext\n value={value}\n >\n {children}\n </PixelContext>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { PixelContext } from './Context.ts'\n\nexport const usePixel = (required = true) => {\n const { pixel } = useContextEx(PixelContext, 'Pixel', required)\n return pixel\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,eAAe,gBAAmC;;;ACJ/D,SAAS,eAAe;AAExB,SAAgB,eAAe;AAmB3B;AAVG,IAAM,gBAAiE,CAAC,UAAU;AACvF,QAAM,EAAE,UAAU,GAAG,IAAI;AACzB,UAAQ,KAAK,EAAE;AAEf,QAAM,QAA2B,QAAQ,OAAO;AAAA,IAC9C,OAAO,QAAQ;AAAA,IACf,UAAU;AAAA,EACZ,IAAI,CAAC,QAAQ,QAAQ,CAAC;AAEtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;AC3BA,SAAS,oBAAoB;AAItB,IAAM,WAAW,CAAC,WAAW,SAAS;AAC3C,QAAM,EAAE,MAAM,IAAI,aAAa,cAAc,SAAS,QAAQ;AAC9D,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-pixel",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -43,24 +43,26 @@
|
|
|
43
43
|
"src"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xylabs/pixel": "
|
|
47
|
-
"@xylabs/react-shared": "
|
|
46
|
+
"@xylabs/pixel": "~5.0.11",
|
|
47
|
+
"@xylabs/react-shared": "~7.0.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@mui/icons-material": "
|
|
51
|
-
"@mui/material": "
|
|
52
|
-
"@types/react": "
|
|
53
|
-
"@xylabs/ts-scripts-yarn3": "
|
|
54
|
-
"@xylabs/tsconfig
|
|
55
|
-
"
|
|
56
|
-
"react
|
|
57
|
-
"
|
|
50
|
+
"@mui/icons-material": "~7.3.1",
|
|
51
|
+
"@mui/material": "~7.3.1",
|
|
52
|
+
"@types/react": "~19.1.11",
|
|
53
|
+
"@xylabs/ts-scripts-yarn3": "~7.1.7",
|
|
54
|
+
"@xylabs/tsconfig": "~7.1.7",
|
|
55
|
+
"@xylabs/tsconfig-dom": "~7.1.7",
|
|
56
|
+
"@xylabs/tsconfig-react": "~7.1.7",
|
|
57
|
+
"react": "~19.1.1",
|
|
58
|
+
"react-dom": "~19.1.1",
|
|
59
|
+
"typescript": "~5.9.2"
|
|
58
60
|
},
|
|
59
61
|
"peerDependencies": {
|
|
60
62
|
"@mui/icons-material": ">=6 <8",
|
|
61
63
|
"@mui/material": ">=6 <8",
|
|
62
|
-
"react": "
|
|
63
|
-
"react-dom": "
|
|
64
|
+
"react": "~19",
|
|
65
|
+
"react-dom": "~19"
|
|
64
66
|
},
|
|
65
67
|
"publishConfig": {
|
|
66
68
|
"access": "public"
|