@tamagui/use-store 1.61.2 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/comparators.js +12 -18
- package/dist/cjs/comparators.js.map +1 -1
- package/dist/cjs/comparators.native.js +40 -0
- package/dist/cjs/comparators.native.js.map +6 -0
- package/dist/cjs/configureUseStore.js +5 -9
- package/dist/cjs/configureUseStore.js.map +1 -1
- package/dist/cjs/configureUseStore.native.js +31 -0
- package/dist/cjs/configureUseStore.native.js.map +6 -0
- package/dist/cjs/constants.js +7 -12
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/constants.native.js +31 -0
- package/dist/cjs/constants.native.js.map +6 -0
- package/dist/cjs/decorators.js +6 -11
- package/dist/cjs/decorators.js.map +1 -1
- package/dist/cjs/decorators.native.js +30 -0
- package/dist/cjs/decorators.native.js.map +6 -0
- package/dist/cjs/helpers.js +13 -29
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/helpers.native.js +66 -0
- package/dist/cjs/helpers.native.js.map +6 -0
- package/dist/cjs/index.js +6 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +46 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/interfaces.js +3 -6
- package/dist/cjs/interfaces.js.map +1 -1
- package/dist/cjs/interfaces.native.js +15 -0
- package/dist/cjs/interfaces.native.js.map +6 -0
- package/dist/cjs/observe.js +35 -92
- package/dist/cjs/observe.js.map +1 -1
- package/dist/cjs/observe.native.js +103 -0
- package/dist/cjs/observe.native.js.map +6 -0
- package/dist/cjs/useStore.js +114 -318
- package/dist/cjs/useStore.js.map +2 -2
- package/dist/cjs/useStore.native.js +350 -0
- package/dist/cjs/useStore.native.js.map +6 -0
- package/dist/cjs/useStoreDebug.js +14 -33
- package/dist/cjs/useStoreDebug.js.map +1 -1
- package/dist/cjs/useStoreDebug.native.js +55 -0
- package/dist/cjs/useStoreDebug.native.js.map +6 -0
- package/dist/esm/comparators.js +7 -9
- package/dist/esm/comparators.js.map +1 -1
- package/dist/esm/constants.js +2 -3
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/decorators.js +1 -2
- package/dist/esm/decorators.js.map +1 -1
- package/dist/esm/helpers.js +7 -18
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/observe.js +29 -79
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/useStore.js +108 -303
- package/dist/esm/useStore.js.map +2 -2
- package/dist/esm/useStoreDebug.js +7 -20
- package/dist/esm/useStoreDebug.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
import React, { useLayoutEffect } from "react";
|
|
2
|
-
const { ReactCurrentOwner } = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3
|
-
const useCurrentComponent = () => {
|
|
4
|
-
return ReactCurrentOwner && ReactCurrentOwner.current && ReactCurrentOwner.current.elementType ? ReactCurrentOwner.current.elementType : {};
|
|
5
|
-
};
|
|
2
|
+
const { ReactCurrentOwner } = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, useCurrentComponent = () => ReactCurrentOwner && ReactCurrentOwner.current && ReactCurrentOwner.current.elementType ? ReactCurrentOwner.current.elementType : {};
|
|
6
3
|
function useDebugStoreComponent(StoreCons) {
|
|
7
4
|
const cmp = useCurrentComponent();
|
|
8
|
-
DebugStores.add(StoreCons);
|
|
9
|
-
if (!DebugComponents.has(cmp)) {
|
|
10
|
-
DebugComponents.set(cmp, /* @__PURE__ */ new Set());
|
|
11
|
-
}
|
|
5
|
+
DebugStores.add(StoreCons), DebugComponents.has(cmp) || DebugComponents.set(cmp, /* @__PURE__ */ new Set());
|
|
12
6
|
const stores = DebugComponents.get(cmp);
|
|
13
|
-
stores.add(StoreCons)
|
|
14
|
-
|
|
15
|
-
return () => {
|
|
16
|
-
DebugStores.delete(StoreCons);
|
|
17
|
-
stores.delete(StoreCons);
|
|
18
|
-
};
|
|
7
|
+
stores.add(StoreCons), useLayoutEffect(() => () => {
|
|
8
|
+
DebugStores.delete(StoreCons), stores.delete(StoreCons);
|
|
19
9
|
}, []);
|
|
20
10
|
}
|
|
21
11
|
const shouldDebug = (component, info) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
const DebugComponents = /* @__PURE__ */ new Map();
|
|
27
|
-
const DebugStores = /* @__PURE__ */ new Set();
|
|
12
|
+
const StoreCons = info.storeInstance?.constructor;
|
|
13
|
+
return DebugComponents.get(component)?.has(StoreCons);
|
|
14
|
+
}, DebugComponents = /* @__PURE__ */ new Map(), DebugStores = /* @__PURE__ */ new Set();
|
|
28
15
|
export {
|
|
29
16
|
DebugComponents,
|
|
30
17
|
DebugStores,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useStoreDebug.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO,SAAS,uBAAuB;AAIvC,MAAM,EAAE,kBAAkB,IAAK,MAC5B
|
|
4
|
+
"mappings": "AAAA,OAAO,SAAS,uBAAuB;AAIvC,MAAM,EAAE,kBAAkB,IAAK,MAC5B,oDACU,sBAAsB,MAC1B,qBACL,kBAAkB,WAClB,kBAAkB,QAAQ,cACxB,kBAAkB,QAAQ,cAC1B,CAAC;AAGA,SAAS,uBAAuB,WAAgB;AACrD,QAAM,MAAM,oBAAoB;AAGhC,cAAY,IAAI,SAAS,GACpB,gBAAgB,IAAI,GAAG,KAC1B,gBAAgB,IAAI,KAAK,oBAAI,IAAI,CAAC;AAEpC,QAAM,SAAS,gBAAgB,IAAI,GAAG;AACtC,SAAO,IAAI,SAAS,GAEpB,gBAAgB,MACP,MAAM;AACX,gBAAY,OAAO,SAAS,GAC5B,OAAO,OAAO,SAAS;AAAA,EACzB,GACC,CAAC,CAAC;AACP;AAEO,MAAM,cAAc,CAAC,WAAgB,SAA2C;AACrF,QAAM,YAAY,KAAK,eAAe;AACtC,SAAO,gBAAgB,IAAI,SAAS,GAAG,IAAI,SAAS;AACtD,GAEa,kBAAkB,oBAAI,IAAmB,GACzC,cAAc,oBAAI,IAAS;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-store",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tamagui-build",
|
|
14
14
|
"watch": "tamagui-build --watch",
|
|
15
|
-
"test": "
|
|
15
|
+
"test": "vitest --config ../vite-plugin-internal/src/vite.config.ts --run",
|
|
16
16
|
"lint": "../../node_modules/.bin/biome check src",
|
|
17
17
|
"lint:fix": "../../node_modules/.bin/biome check --apply src",
|
|
18
18
|
"clean": "tamagui-build clean",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/simple-hash": "1.
|
|
30
|
+
"@tamagui/simple-hash": "1.62.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "1.
|
|
33
|
+
"@tamagui/build": "1.62.0",
|
|
34
34
|
"@testing-library/react": "^14.0.0",
|
|
35
35
|
"react": "^18.2.0",
|
|
36
36
|
"vitest": "^0.34.3"
|