@solid-primitives/deep 0.0.100 → 0.0.102
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 +2 -8
- package/dist/index.cjs +6 -11
- package/dist/index.js +6 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p>
|
|
2
|
-
<img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=
|
|
2
|
+
<img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=Deep" alt="Solid Primitives Deep">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# @solid-primitives/deep
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/@solid-primitives/deep)
|
|
10
10
|
[](https://github.com/solidjs-community/solid-primitives#contribution-process)
|
|
11
11
|
|
|
12
|
-
A function that allows to trigger effects when deep properties for a store change
|
|
13
|
-
|
|
14
|
-
`deepTrack` - Provides a traversed store object.
|
|
12
|
+
- [`deepTrack`](#deepTrack) - A function that allows to trigger effects when deep properties for a store change
|
|
15
13
|
|
|
16
14
|
## Installation
|
|
17
15
|
|
|
@@ -48,10 +46,6 @@ createEffect(() => {
|
|
|
48
46
|
});
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
## Demo
|
|
52
|
-
|
|
53
|
-
You can use this template for publishing your demo on CodeSandbox: https://codesandbox.io/s/solid-primitives-demo-template-sz95h
|
|
54
|
-
|
|
55
49
|
## Changelog
|
|
56
50
|
|
|
57
51
|
See [CHANGELOG.md](./CHANGELOG.md)
|
package/dist/index.cjs
CHANGED
|
@@ -4,19 +4,14 @@ var solidJs = require('solid-js');
|
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
function deepTrack(store) {
|
|
7
|
-
return deepTraverse(store);
|
|
7
|
+
return deepTraverse(store, /* @__PURE__ */ new Set());
|
|
8
8
|
}
|
|
9
9
|
function deepTraverse(value, seen) {
|
|
10
|
-
if (!isWrappable(value)) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
seen.add(value);
|
|
18
|
-
for (const key in value) {
|
|
19
|
-
deepTraverse(value[key], seen);
|
|
10
|
+
if (!seen.has(value) && isWrappable(value)) {
|
|
11
|
+
seen.add(value);
|
|
12
|
+
for (const key in value) {
|
|
13
|
+
deepTraverse(value[key], seen);
|
|
14
|
+
}
|
|
20
15
|
}
|
|
21
16
|
return value;
|
|
22
17
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,19 +2,14 @@ import { $PROXY } from 'solid-js';
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
function deepTrack(store) {
|
|
5
|
-
return deepTraverse(store);
|
|
5
|
+
return deepTraverse(store, /* @__PURE__ */ new Set());
|
|
6
6
|
}
|
|
7
7
|
function deepTraverse(value, seen) {
|
|
8
|
-
if (!isWrappable(value)) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
seen.add(value);
|
|
16
|
-
for (const key in value) {
|
|
17
|
-
deepTraverse(value[key], seen);
|
|
8
|
+
if (!seen.has(value) && isWrappable(value)) {
|
|
9
|
+
seen.add(value);
|
|
10
|
+
for (const key in value) {
|
|
11
|
+
deepTraverse(value[key], seen);
|
|
12
|
+
}
|
|
18
13
|
}
|
|
19
14
|
return value;
|
|
20
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solid-primitives/deep",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.102",
|
|
4
4
|
"description": "Deep trigger effects for Stores.",
|
|
5
5
|
"author": "Samuel Burbano <me@iosamuel.dev>",
|
|
6
6
|
"contributors": [],
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"require": "./dist/index.cjs"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"solid-js": "^1.6.
|
|
47
|
+
"solid-js": "^1.6.12"
|
|
48
48
|
},
|
|
49
49
|
"typesVersions": {},
|
|
50
50
|
"scripts": {
|