@xyo-network/react-pixel 5.3.0 → 5.3.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 +2 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/contexts/Pixel/Context.d.ts +5 -2
- package/dist/types/contexts/Pixel/Context.d.ts.map +1 -1
- package/dist/types/contexts/Pixel/Provider.d.ts.map +1 -1
- package/dist/types/contexts/Pixel/State.d.ts +3 -3
- package/dist/types/contexts/Pixel/State.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/contexts/Pixel/Context.ts +1 -1
- package/src/contexts/Pixel/Provider.tsx +2 -1
- package/src/contexts/Pixel/State.ts +3 -3
- package/src/contexts/Pixel/use.ts +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/contexts/Pixel/Context.ts
|
|
5
|
-
import { createContextEx } from "@
|
|
5
|
+
import { createContextEx } from "@xylabs/react-shared";
|
|
6
6
|
var PixelContext = createContextEx();
|
|
7
7
|
|
|
8
8
|
// src/contexts/Pixel/Provider.tsx
|
|
@@ -23,7 +23,7 @@ var PixelProvider = /* @__PURE__ */ __name((props) => {
|
|
|
23
23
|
}, "PixelProvider");
|
|
24
24
|
|
|
25
25
|
// src/contexts/Pixel/use.ts
|
|
26
|
-
import { useContextEx } from "@
|
|
26
|
+
import { useContextEx } from "@xylabs/react-shared";
|
|
27
27
|
var usePixel = /* @__PURE__ */ __name((required = true) => {
|
|
28
28
|
const { pixel } = useContextEx(PixelContext, "Pixel", required);
|
|
29
29
|
return pixel;
|
|
@@ -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 '@
|
|
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,SAASA,uBAAuB;AAIzB,IAAMC,eAAeD,gBAAAA;;;ACJ5B,SAASE,eAAe;AAExB,OAAOC,SAASC,eAAe;AASxB,IAAMC,gBAAiE,wBAACC,UAAAA;AAC7E,QAAM,EAAEC,UAAUC,GAAE,IAAKF;AACzBG,UAAQC,KAAKF,EAAAA;AAEb,QAAMG,QAA2BC,QAAQ,OAAO;IAC9CC,OAAOJ,QAAQK;IACfC,UAAU;EACZ,IAAI;IAACN,QAAQK;GAAS;AAEtB,SACE,sBAAA,cAACE,cAAAA;IACCL;KAECJ,QAAAA;AAGP,GAhB8E;;;ACX9E,SAASU,oBAAoB;AAItB,IAAMC,WAAW,wBAACC,WAAW,SAAI;AACtC,QAAM,EAAEC,MAAK,IAAKC,aAAaC,cAAc,SAASH,QAAAA;AACtD,SAAOC;AACT,GAHwB;","names":["createContextEx","PixelContext","XyPixel","React","useMemo","PixelProvider","props","children","id","XyPixel","init","value","useMemo","pixel","instance","provided","PixelContext","useContextEx","usePixel","required","pixel","useContextEx","PixelContext"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const PixelContext: import("react").Context<{
|
|
2
|
+
pixel?: import("@xylabs/pixel").XyPixel;
|
|
3
|
+
} & {
|
|
4
|
+
provided: true;
|
|
5
|
+
}>;
|
|
3
6
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Pixel/Context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Pixel/Context.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;EAAuC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Pixel/Provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAkB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Pixel/Provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAkB,MAAM,OAAO,CAAA;AAKtC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;CACX;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAgBzE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { XyPixel } from '@xylabs/pixel';
|
|
2
|
-
import type { ContextExState } from '@
|
|
3
|
-
export
|
|
2
|
+
import type { ContextExState } from '@xylabs/react-shared';
|
|
3
|
+
export type PixelContextState = ContextExState<{
|
|
4
4
|
pixel?: XyPixel;
|
|
5
|
-
}
|
|
5
|
+
}>;
|
|
6
6
|
//# sourceMappingURL=State.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Pixel/State.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Pixel/State.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-pixel",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"types": "dist/types/index.d.ts",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@xylabs/pixel": "^4.9.15",
|
|
43
|
-
"@
|
|
43
|
+
"@xylabs/react-shared": "^6.3.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@mui/icons-material": "^7.1.0",
|
|
@@ -3,6 +3,7 @@ import type { PropsWithChildren } from 'react'
|
|
|
3
3
|
import React, { useMemo } from 'react'
|
|
4
4
|
|
|
5
5
|
import { PixelContext } from './Context.ts'
|
|
6
|
+
import type { PixelContextState } from './State.ts'
|
|
6
7
|
|
|
7
8
|
export interface PixelProviderProps {
|
|
8
9
|
id: string
|
|
@@ -12,7 +13,7 @@ export const PixelProvider: React.FC<PropsWithChildren<PixelProviderProps>> = (p
|
|
|
12
13
|
const { children, id } = props
|
|
13
14
|
XyPixel.init(id)
|
|
14
15
|
|
|
15
|
-
const value = useMemo(() => ({
|
|
16
|
+
const value: PixelContextState = useMemo(() => ({
|
|
16
17
|
pixel: XyPixel.instance,
|
|
17
18
|
provided: true,
|
|
18
19
|
}), [XyPixel.instance])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { XyPixel } from '@xylabs/pixel'
|
|
2
|
-
import type { ContextExState } from '@
|
|
2
|
+
import type { ContextExState } from '@xylabs/react-shared'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export type PixelContextState = ContextExState<{
|
|
5
5
|
pixel?: XyPixel
|
|
6
|
-
}
|
|
6
|
+
}>
|