@zag-js/store 0.0.0-dev-20220707125149 → 0.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/LICENSE +21 -0
- package/README.md +2 -5
- package/dist/index.d.ts +9 -8
- package/dist/index.js +11 -1
- package/dist/index.mjs +1 -1
- package/package.json +11 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Chakra UI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -12,11 +12,8 @@ npm i @zag-js/store
|
|
|
12
12
|
|
|
13
13
|
## Contribution
|
|
14
14
|
|
|
15
|
-
Yes please! See the
|
|
16
|
-
[contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md)
|
|
17
|
-
for details.
|
|
15
|
+
Yes please! See the [contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md) for details.
|
|
18
16
|
|
|
19
17
|
## Licence
|
|
20
18
|
|
|
21
|
-
This project is licensed under the terms of the
|
|
22
|
-
[MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE).
|
|
19
|
+
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
interface AsRef {
|
|
2
2
|
$$valtioRef: true;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
declare function ref<T extends object>(o: T): T & AsRef;
|
|
5
5
|
declare type Path = (string | symbol)[];
|
|
6
6
|
declare type Op = [op: "set", path: Path, value: unknown, prevValue: unknown] | [op: "delete", path: Path, prevValue: unknown] | [op: "resolve", path: Path, value: unknown] | [op: "reject", path: Path, error: unknown];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
declare function proxy<T extends object>(initialObject?: T): T;
|
|
8
|
+
declare function getVersion(proxyObject: unknown): number | undefined;
|
|
9
|
+
declare function subscribe<T extends object>(proxyObject: T, callback: (ops: Op[]) => void, notifyInSync?: boolean): () => void;
|
|
10
10
|
declare type AnyFunction = (...args: any[]) => any;
|
|
11
11
|
declare type Snapshot<T> = T extends AnyFunction ? T : T extends AsRef ? T : T extends Promise<infer V> ? Snapshot<V> : {
|
|
12
12
|
readonly [K in keyof T]: Snapshot<T[K]>;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
declare function snapshot<T extends object>(proxyObject: T): Snapshot<T>;
|
|
15
|
+
declare function getHandler<T extends object>(proxyObject: T): any;
|
|
16
|
+
declare function proxyWithComputed<T extends object, U extends object>(initialObject: T, computedFns: {
|
|
17
17
|
[K in keyof U]: ((snap: Snapshot<T>) => U[K]) | {
|
|
18
18
|
get: (snap: Snapshot<T>) => U[K];
|
|
19
19
|
set?: (state: T, newValue: U[K]) => void;
|
|
20
20
|
};
|
|
21
21
|
}): T & U;
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
export { getHandler, getVersion, proxy, proxyWithComputed, ref, snapshot, subscribe };
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ __export(src_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(src_exports);
|
|
32
32
|
var import_proxy_compare = require("proxy-compare");
|
|
33
|
-
var __DEV__ =
|
|
33
|
+
var __DEV__ = process.env.NODE_ENV !== "production";
|
|
34
34
|
var VERSION = Symbol();
|
|
35
35
|
var LISTENERS = Symbol();
|
|
36
36
|
var SNAPSHOT = Symbol();
|
|
@@ -258,3 +258,13 @@ function proxyWithComputed(initialObject, computedFns) {
|
|
|
258
258
|
const proxyObject = proxy(initialObject);
|
|
259
259
|
return proxyObject;
|
|
260
260
|
}
|
|
261
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
262
|
+
0 && (module.exports = {
|
|
263
|
+
getHandler,
|
|
264
|
+
getVersion,
|
|
265
|
+
proxy,
|
|
266
|
+
proxyWithComputed,
|
|
267
|
+
ref,
|
|
268
|
+
snapshot,
|
|
269
|
+
subscribe
|
|
270
|
+
});
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The reactive store package for zag machines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -19,15 +19,6 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist/**/*"
|
|
21
21
|
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build:fast": "yarn zag build",
|
|
24
|
-
"start": "yarn zag build --watch",
|
|
25
|
-
"build": "yarn zag build --prod",
|
|
26
|
-
"test": "jest --config ../../../jest.config.js --rootDir tests",
|
|
27
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
28
|
-
"test:ci": "yarn test --ci --runInBand --updateSnapshot",
|
|
29
|
-
"test:watch": "yarn test --watchAll"
|
|
30
|
-
},
|
|
31
22
|
"publishConfig": {
|
|
32
23
|
"access": "public"
|
|
33
24
|
},
|
|
@@ -36,5 +27,14 @@
|
|
|
36
27
|
},
|
|
37
28
|
"dependencies": {
|
|
38
29
|
"proxy-compare": "2.2.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build-fast": "tsup src/index.ts --format=esm,cjs",
|
|
33
|
+
"start": "pnpm build --watch",
|
|
34
|
+
"build": "tsup src/index.ts --format=esm,cjs --dts",
|
|
35
|
+
"test": "jest --config ../../../jest.config.js --rootDir tests",
|
|
36
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
37
|
+
"test-ci": "pnpm test --ci --runInBand -u",
|
|
38
|
+
"test-watch": "pnpm test --watchAll"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|