tracked-instance 1.0.22 → 1.0.23
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/index.mjs +8 -7
- package/dist/types/utils.d.ts +4 -4
- package/package.json +6 -4
package/dist/index.mjs
CHANGED
|
@@ -1603,17 +1603,17 @@ function useTrackedInstance(initialData) {
|
|
|
1603
1603
|
const path = parentThree.concat({ target, property, receiver });
|
|
1604
1604
|
const oldValue = target[property];
|
|
1605
1605
|
const triggerChangingArrayItems = () => {
|
|
1606
|
-
const
|
|
1606
|
+
const arrayInOriginalData = get_default(
|
|
1607
1607
|
_originalData.value,
|
|
1608
1608
|
path.map((i) => i.property)
|
|
1609
1609
|
);
|
|
1610
|
-
const
|
|
1611
|
-
if (value <
|
|
1612
|
-
for (let i = value; i <
|
|
1610
|
+
const originalDataValue = arrayInOriginalData?.length || oldValue;
|
|
1611
|
+
if (value < originalDataValue) {
|
|
1612
|
+
for (let i = value; i < originalDataValue; i++) {
|
|
1613
1613
|
delete receiver[i];
|
|
1614
1614
|
}
|
|
1615
|
-
} else if (
|
|
1616
|
-
for (let i =
|
|
1615
|
+
} else if (originalDataValue < value) {
|
|
1616
|
+
for (let i = originalDataValue; i < value; i++) {
|
|
1617
1617
|
receiver[i] = void 0;
|
|
1618
1618
|
}
|
|
1619
1619
|
}
|
|
@@ -1628,7 +1628,8 @@ function useTrackedInstance(initialData) {
|
|
|
1628
1628
|
return Reflect.set(target, property, cloneDeep(value), receiver);
|
|
1629
1629
|
},
|
|
1630
1630
|
deleteProperty(target, property) {
|
|
1631
|
-
|
|
1631
|
+
const path = parentThree.concat({ target, property });
|
|
1632
|
+
snapshotValueToOriginalData(_originalData.value, path, void 0);
|
|
1632
1633
|
return Reflect.deleteProperty(target, property);
|
|
1633
1634
|
}
|
|
1634
1635
|
}));
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export interface NestedProxyPathItem {
|
|
|
9
9
|
export declare const isObject: (value: unknown) => boolean;
|
|
10
10
|
export declare const isEmpty: (value: object) => boolean;
|
|
11
11
|
export declare const iterateObject: (source: Record<string, any>, params?: {
|
|
12
|
-
goDeepCondition?: (
|
|
13
|
-
includeParent?: boolean
|
|
14
|
-
}) => Generator<[string[], any], void,
|
|
15
|
-
export declare const createNestedRef: <Source extends Record<string, any>>(source: Source, handler: <InnerSource extends Record<string, any>>(path: NestedProxyPathItem[]) => ProxyHandler<InnerSource>) => import("vue").Ref<Source>;
|
|
12
|
+
goDeepCondition?: (path: string[], value: any) => boolean;
|
|
13
|
+
includeParent?: boolean;
|
|
14
|
+
}) => Generator<[string[], any], void, any>;
|
|
15
|
+
export declare const createNestedRef: <Source extends Record<string, any>>(source: Source, handler: <InnerSource extends Record<string, any>>(path: NestedProxyPathItem[]) => ProxyHandler<InnerSource>) => import("vue").Ref<Source, Source>;
|
|
16
16
|
export declare const cloneDeep: (inputValue: any) => any;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tracked-instance",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Build large forms and track all changes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc && esbuild ./src/index.ts --bundle --external:vue --outfile=./dist/index.mjs --format=esm",
|
|
8
|
+
"test-ui": "vitest --ui",
|
|
8
9
|
"test": "vitest run"
|
|
9
10
|
},
|
|
10
11
|
"main": "./dist/index.mjs",
|
|
@@ -14,9 +15,10 @@
|
|
|
14
15
|
],
|
|
15
16
|
"devDependencies": {
|
|
16
17
|
"@types/lodash-es": "^4.17.12",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"@vitest/ui": "^3.0.5",
|
|
19
|
+
"typescript": "^5.7.3",
|
|
20
|
+
"vitest": "^3.0.5",
|
|
21
|
+
"vue": "^3.5.13"
|
|
20
22
|
},
|
|
21
23
|
"peerDependencies": {
|
|
22
24
|
"vue": "^3.0.0"
|