@atscript/ui 0.1.175 → 0.1.176
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/form/apply.cjs +4 -4
- package/dist/form/apply.d.cts +4 -4
- package/dist/form/apply.d.mts +4 -4
- package/dist/form/apply.mjs +4 -4
- package/dist/form/diff.cjs +48 -33
- package/dist/form/diff.d.cts +6 -0
- package/dist/form/diff.d.mts +6 -0
- package/dist/form/diff.mjs +48 -33
- package/dist/form/path-utils.cjs +2 -3
- package/dist/form/path-utils.d.cts +2 -3
- package/dist/form/path-utils.d.mts +2 -3
- package/dist/form/path-utils.mjs +2 -3
- package/package.json +9 -9
package/dist/form/apply.cjs
CHANGED
|
@@ -15,10 +15,10 @@ const require_path_utils = require("./path-utils.cjs");
|
|
|
15
15
|
*
|
|
16
16
|
* - `kind: 'set'`:
|
|
17
17
|
* - `change.after === undefined` → DELETE the own key at `change.path` (walk
|
|
18
|
-
* to parent, `delete`). A cleared field
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* to parent, `delete`). A cleared field reads as ABSENT, not as a present
|
|
19
|
+
* `undefined` own-key, so the data holds the same keys as data that never
|
|
20
|
+
* had the field. `setByPath(…, undefined)` leaves an own key behind, so we
|
|
21
|
+
* use {@link deleteByPath} instead.
|
|
22
22
|
* - otherwise → `setByPath(data, change.path, change.after)`.
|
|
23
23
|
* - `kind: 'array'`: whole-array set via `setByPath(data, change.path,
|
|
24
24
|
* change.after)` (LOCKED Option A — no per-element merge; the diff already
|
package/dist/form/apply.d.cts
CHANGED
|
@@ -17,10 +17,10 @@ import { FormFieldChange } from "./diff.cjs";
|
|
|
17
17
|
*
|
|
18
18
|
* - `kind: 'set'`:
|
|
19
19
|
* - `change.after === undefined` → DELETE the own key at `change.path` (walk
|
|
20
|
-
* to parent, `delete`). A cleared field
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* to parent, `delete`). A cleared field reads as ABSENT, not as a present
|
|
21
|
+
* `undefined` own-key, so the data holds the same keys as data that never
|
|
22
|
+
* had the field. `setByPath(…, undefined)` leaves an own key behind, so we
|
|
23
|
+
* use {@link deleteByPath} instead.
|
|
24
24
|
* - otherwise → `setByPath(data, change.path, change.after)`.
|
|
25
25
|
* - `kind: 'array'`: whole-array set via `setByPath(data, change.path,
|
|
26
26
|
* change.after)` (LOCKED Option A — no per-element merge; the diff already
|
package/dist/form/apply.d.mts
CHANGED
|
@@ -17,10 +17,10 @@ import { FormFieldChange } from "./diff.mjs";
|
|
|
17
17
|
*
|
|
18
18
|
* - `kind: 'set'`:
|
|
19
19
|
* - `change.after === undefined` → DELETE the own key at `change.path` (walk
|
|
20
|
-
* to parent, `delete`). A cleared field
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* to parent, `delete`). A cleared field reads as ABSENT, not as a present
|
|
21
|
+
* `undefined` own-key, so the data holds the same keys as data that never
|
|
22
|
+
* had the field. `setByPath(…, undefined)` leaves an own key behind, so we
|
|
23
|
+
* use {@link deleteByPath} instead.
|
|
24
24
|
* - otherwise → `setByPath(data, change.path, change.after)`.
|
|
25
25
|
* - `kind: 'array'`: whole-array set via `setByPath(data, change.path,
|
|
26
26
|
* change.after)` (LOCKED Option A — no per-element merge; the diff already
|
package/dist/form/apply.mjs
CHANGED
|
@@ -15,10 +15,10 @@ import { deleteByPath, setByPath } from "./path-utils.mjs";
|
|
|
15
15
|
*
|
|
16
16
|
* - `kind: 'set'`:
|
|
17
17
|
* - `change.after === undefined` → DELETE the own key at `change.path` (walk
|
|
18
|
-
* to parent, `delete`). A cleared field
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* to parent, `delete`). A cleared field reads as ABSENT, not as a present
|
|
19
|
+
* `undefined` own-key, so the data holds the same keys as data that never
|
|
20
|
+
* had the field. `setByPath(…, undefined)` leaves an own key behind, so we
|
|
21
|
+
* use {@link deleteByPath} instead.
|
|
22
22
|
* - otherwise → `setByPath(data, change.path, change.after)`.
|
|
23
23
|
* - `kind: 'array'`: whole-array set via `setByPath(data, change.path,
|
|
24
24
|
* change.after)` (LOCKED Option A — no per-element merge; the diff already
|
package/dist/form/diff.cjs
CHANGED
|
@@ -182,8 +182,15 @@ function diffObjectField(field, fullPath, baseline, current, changes, patch) {
|
|
|
182
182
|
const afterObj = require_path_utils.getByPath(current, fullPath);
|
|
183
183
|
if (!require_path_utils.isPlainObject(beforeObj) && !require_path_utils.isPlainObject(afterObj)) return;
|
|
184
184
|
const nested = {};
|
|
185
|
+
const changesBefore = changes.length;
|
|
185
186
|
diffFields(field.objectDef.fields, fullPath, baseline, current, changes, nested, void 0, field.objectDef.flatMap);
|
|
186
187
|
if ((afterObj === void 0 || afterObj === null) && require_path_utils.isPlainObject(beforeObj)) {
|
|
188
|
+
if (changes.length === changesBefore) changes.push({
|
|
189
|
+
path: fullPath,
|
|
190
|
+
kind: "set",
|
|
191
|
+
before: beforeObj,
|
|
192
|
+
after: afterObj
|
|
193
|
+
});
|
|
187
194
|
setPatchLeaf(patch, field.path, null);
|
|
188
195
|
return;
|
|
189
196
|
}
|
|
@@ -274,18 +281,22 @@ function diffArray(field, before, after) {
|
|
|
274
281
|
* ({@link buildKeyedUpdate}). Either way an item is emitted only when some
|
|
275
282
|
* leaf changed.
|
|
276
283
|
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* silently drop items
|
|
284
|
+
* Fallbacks to `{ $replace: after }`, the only faithful op, when:
|
|
285
|
+
* - key identity is ambiguous — an element that is not an object or lacks ALL
|
|
286
|
+
* of its key values, or a key shared by two elements on one side (a
|
|
287
|
+
* last-write-wins collapse would silently drop items);
|
|
288
|
+
* - an element a key operator would name (a `$update`, `$remove` or `$insert`
|
|
289
|
+
* item) lacks ANY of its key values (`undefined` / `null`): the db refuses
|
|
290
|
+
* such an item (`PATCH_KEY_REQUIRED` for `$update` / `$remove`), while under
|
|
291
|
+
* `$replace` it validates the array and reports the missing field on its
|
|
292
|
+
* own path. An untouched row with an incomplete key names no operator, so
|
|
293
|
+
* it does not turn an unrelated edit into a `$replace`.
|
|
281
294
|
*/
|
|
282
295
|
function diffKeyedArray(before, after, keyProps, merge) {
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
const
|
|
287
|
-
for (const el of after) if (require_path_utils.isPlainObject(el)) afterByKey.set(keyOf(el, keyProps), el);
|
|
288
|
-
if (beforeByKey.size !== before.length || afterByKey.size !== after.length) return { $replace: after };
|
|
296
|
+
const beforeByKey = byKey(before, keyProps);
|
|
297
|
+
const afterByKey = byKey(after, keyProps);
|
|
298
|
+
if (!beforeByKey || !afterByKey) return { $replace: after };
|
|
299
|
+
const incomplete = (el) => keyProps.some((k) => el[k] === void 0 || el[k] === null);
|
|
289
300
|
const afterKeys = [...afterByKey.keys()];
|
|
290
301
|
const $update = [];
|
|
291
302
|
const $remove = [];
|
|
@@ -293,17 +304,22 @@ function diffKeyedArray(before, after, keyProps, merge) {
|
|
|
293
304
|
for (const [k, prev] of beforeByKey) {
|
|
294
305
|
const el = afterByKey.get(k);
|
|
295
306
|
if (el === void 0) {
|
|
307
|
+
if (incomplete(prev)) return { $replace: after };
|
|
296
308
|
$remove.push(pickKeys(prev, keyProps));
|
|
297
309
|
continue;
|
|
298
310
|
}
|
|
299
311
|
if (afterKeys[kept++] !== k) return { $replace: after };
|
|
300
312
|
if (deepEqual(prev, el)) continue;
|
|
301
313
|
const partial = buildKeyedUpdate(prev, el, keyProps);
|
|
302
|
-
if (partial)
|
|
314
|
+
if (!partial) continue;
|
|
315
|
+
if (incomplete(el)) return { $replace: after };
|
|
316
|
+
$update.push(merge ? partial : definedProps(el));
|
|
303
317
|
}
|
|
318
|
+
const $insert = afterKeys.slice(kept).map((k) => afterByKey.get(k));
|
|
319
|
+
if ($insert.some(incomplete)) return { $replace: after };
|
|
304
320
|
return arrayOps({
|
|
305
321
|
$update,
|
|
306
|
-
$insert
|
|
322
|
+
$insert,
|
|
307
323
|
$remove
|
|
308
324
|
});
|
|
309
325
|
}
|
|
@@ -387,21 +403,19 @@ function getArrayKeyProps(itemType) {
|
|
|
387
403
|
function isPrimitiveItem(field) {
|
|
388
404
|
return field.itemType.type.kind === "";
|
|
389
405
|
}
|
|
390
|
-
/**
|
|
391
|
-
|
|
406
|
+
/**
|
|
407
|
+
* The elements by {@link keyOf} bucket, or `undefined` when key identity is
|
|
408
|
+
* ambiguous: an element is not an object or lacks ALL of its key values
|
|
409
|
+
* (`undefined` / `null`), or two elements share a key (a Map collapse would
|
|
410
|
+
* silently lose one).
|
|
411
|
+
*/
|
|
412
|
+
function byKey(arr, keyProps) {
|
|
413
|
+
const map = /* @__PURE__ */ new Map();
|
|
392
414
|
for (const el of arr) {
|
|
393
|
-
if (!require_path_utils.isPlainObject(el)) return
|
|
394
|
-
|
|
395
|
-
for (const k of keyProps) {
|
|
396
|
-
const v = el[k];
|
|
397
|
-
if (v !== void 0 && v !== null) {
|
|
398
|
-
hasAnyKey = true;
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
if (!hasAnyKey) return true;
|
|
415
|
+
if (!require_path_utils.isPlainObject(el) || keyProps.every((k) => el[k] === void 0 || el[k] === null)) return;
|
|
416
|
+
map.set(keyOf(el, keyProps), el);
|
|
403
417
|
}
|
|
404
|
-
return
|
|
418
|
+
return map.size === arr.length ? map : void 0;
|
|
405
419
|
}
|
|
406
420
|
/**
|
|
407
421
|
* Bucket string for a keyed-array element's key values, type-strict like
|
|
@@ -458,14 +472,20 @@ function stableKey(v) {
|
|
|
458
472
|
* (revert-aware for NaN scalars) while `0` / `-0` stay equal (matches DB
|
|
459
473
|
* intent — `===` treats them equal, only NaN is special-cased).
|
|
460
474
|
*
|
|
475
|
+
* Unset is one value: `null`, `undefined` and an absent object prop are equal
|
|
476
|
+
* at any depth — a field loaded as `null` (SQL `NULL`) that the form holds as
|
|
477
|
+
* `undefined`, or an optional prop emptied to `undefined` in an array row, is
|
|
478
|
+
* unchanged. The patch cannot tell them apart either: it sends a cleared value
|
|
479
|
+
* as `null`.
|
|
480
|
+
*
|
|
461
481
|
* The single comparator shared across the form engine: diff, conflict
|
|
462
482
|
* detection ({@link buildFormRebase}), and apply all route through this — never
|
|
463
483
|
* reimplement equality elsewhere.
|
|
464
484
|
*/
|
|
465
485
|
function deepEqual(a, b) {
|
|
466
486
|
if (a === b) return true;
|
|
487
|
+
if (a === null || a === void 0 || b === null || b === void 0) return (a === null || a === void 0) && (b === null || b === void 0);
|
|
467
488
|
if (typeof a === "number" && typeof b === "number") return Number.isNaN(a) && Number.isNaN(b);
|
|
468
|
-
if (a === null || b === null || a === void 0 || b === void 0) return false;
|
|
469
489
|
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
470
490
|
const aIsArr = Array.isArray(a);
|
|
471
491
|
const bIsArr = Array.isArray(b);
|
|
@@ -477,13 +497,8 @@ function deepEqual(a, b) {
|
|
|
477
497
|
}
|
|
478
498
|
const ao = a;
|
|
479
499
|
const bo = b;
|
|
480
|
-
const
|
|
481
|
-
const
|
|
482
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
483
|
-
for (const k of aKeys) {
|
|
484
|
-
if (!Object.prototype.hasOwnProperty.call(bo, k)) return false;
|
|
485
|
-
if (!deepEqual(ao[k], bo[k])) return false;
|
|
486
|
-
}
|
|
500
|
+
for (const k of Object.keys(ao)) if (!deepEqual(ao[k], Object.hasOwn(bo, k) ? bo[k] : void 0)) return false;
|
|
501
|
+
for (const k of Object.keys(bo)) if (!Object.hasOwn(ao, k) && bo[k] !== void 0 && bo[k] !== null) return false;
|
|
487
502
|
return true;
|
|
488
503
|
}
|
|
489
504
|
//#endregion
|
package/dist/form/diff.d.cts
CHANGED
|
@@ -71,6 +71,12 @@ declare function buildFormDiff(def: FormDef, baseline: Record<string, unknown>,
|
|
|
71
71
|
* (revert-aware for NaN scalars) while `0` / `-0` stay equal (matches DB
|
|
72
72
|
* intent — `===` treats them equal, only NaN is special-cased).
|
|
73
73
|
*
|
|
74
|
+
* Unset is one value: `null`, `undefined` and an absent object prop are equal
|
|
75
|
+
* at any depth — a field loaded as `null` (SQL `NULL`) that the form holds as
|
|
76
|
+
* `undefined`, or an optional prop emptied to `undefined` in an array row, is
|
|
77
|
+
* unchanged. The patch cannot tell them apart either: it sends a cleared value
|
|
78
|
+
* as `null`.
|
|
79
|
+
*
|
|
74
80
|
* The single comparator shared across the form engine: diff, conflict
|
|
75
81
|
* detection ({@link buildFormRebase}), and apply all route through this — never
|
|
76
82
|
* reimplement equality elsewhere.
|
package/dist/form/diff.d.mts
CHANGED
|
@@ -71,6 +71,12 @@ declare function buildFormDiff(def: FormDef, baseline: Record<string, unknown>,
|
|
|
71
71
|
* (revert-aware for NaN scalars) while `0` / `-0` stay equal (matches DB
|
|
72
72
|
* intent — `===` treats them equal, only NaN is special-cased).
|
|
73
73
|
*
|
|
74
|
+
* Unset is one value: `null`, `undefined` and an absent object prop are equal
|
|
75
|
+
* at any depth — a field loaded as `null` (SQL `NULL`) that the form holds as
|
|
76
|
+
* `undefined`, or an optional prop emptied to `undefined` in an array row, is
|
|
77
|
+
* unchanged. The patch cannot tell them apart either: it sends a cleared value
|
|
78
|
+
* as `null`.
|
|
79
|
+
*
|
|
74
80
|
* The single comparator shared across the form engine: diff, conflict
|
|
75
81
|
* detection ({@link buildFormRebase}), and apply all route through this — never
|
|
76
82
|
* reimplement equality elsewhere.
|
package/dist/form/diff.mjs
CHANGED
|
@@ -182,8 +182,15 @@ function diffObjectField(field, fullPath, baseline, current, changes, patch) {
|
|
|
182
182
|
const afterObj = getByPath(current, fullPath);
|
|
183
183
|
if (!isPlainObject(beforeObj) && !isPlainObject(afterObj)) return;
|
|
184
184
|
const nested = {};
|
|
185
|
+
const changesBefore = changes.length;
|
|
185
186
|
diffFields(field.objectDef.fields, fullPath, baseline, current, changes, nested, void 0, field.objectDef.flatMap);
|
|
186
187
|
if ((afterObj === void 0 || afterObj === null) && isPlainObject(beforeObj)) {
|
|
188
|
+
if (changes.length === changesBefore) changes.push({
|
|
189
|
+
path: fullPath,
|
|
190
|
+
kind: "set",
|
|
191
|
+
before: beforeObj,
|
|
192
|
+
after: afterObj
|
|
193
|
+
});
|
|
187
194
|
setPatchLeaf(patch, field.path, null);
|
|
188
195
|
return;
|
|
189
196
|
}
|
|
@@ -274,18 +281,22 @@ function diffArray(field, before, after) {
|
|
|
274
281
|
* ({@link buildKeyedUpdate}). Either way an item is emitted only when some
|
|
275
282
|
* leaf changed.
|
|
276
283
|
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* silently drop items
|
|
284
|
+
* Fallbacks to `{ $replace: after }`, the only faithful op, when:
|
|
285
|
+
* - key identity is ambiguous — an element that is not an object or lacks ALL
|
|
286
|
+
* of its key values, or a key shared by two elements on one side (a
|
|
287
|
+
* last-write-wins collapse would silently drop items);
|
|
288
|
+
* - an element a key operator would name (a `$update`, `$remove` or `$insert`
|
|
289
|
+
* item) lacks ANY of its key values (`undefined` / `null`): the db refuses
|
|
290
|
+
* such an item (`PATCH_KEY_REQUIRED` for `$update` / `$remove`), while under
|
|
291
|
+
* `$replace` it validates the array and reports the missing field on its
|
|
292
|
+
* own path. An untouched row with an incomplete key names no operator, so
|
|
293
|
+
* it does not turn an unrelated edit into a `$replace`.
|
|
281
294
|
*/
|
|
282
295
|
function diffKeyedArray(before, after, keyProps, merge) {
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
const
|
|
287
|
-
for (const el of after) if (isPlainObject(el)) afterByKey.set(keyOf(el, keyProps), el);
|
|
288
|
-
if (beforeByKey.size !== before.length || afterByKey.size !== after.length) return { $replace: after };
|
|
296
|
+
const beforeByKey = byKey(before, keyProps);
|
|
297
|
+
const afterByKey = byKey(after, keyProps);
|
|
298
|
+
if (!beforeByKey || !afterByKey) return { $replace: after };
|
|
299
|
+
const incomplete = (el) => keyProps.some((k) => el[k] === void 0 || el[k] === null);
|
|
289
300
|
const afterKeys = [...afterByKey.keys()];
|
|
290
301
|
const $update = [];
|
|
291
302
|
const $remove = [];
|
|
@@ -293,17 +304,22 @@ function diffKeyedArray(before, after, keyProps, merge) {
|
|
|
293
304
|
for (const [k, prev] of beforeByKey) {
|
|
294
305
|
const el = afterByKey.get(k);
|
|
295
306
|
if (el === void 0) {
|
|
307
|
+
if (incomplete(prev)) return { $replace: after };
|
|
296
308
|
$remove.push(pickKeys(prev, keyProps));
|
|
297
309
|
continue;
|
|
298
310
|
}
|
|
299
311
|
if (afterKeys[kept++] !== k) return { $replace: after };
|
|
300
312
|
if (deepEqual(prev, el)) continue;
|
|
301
313
|
const partial = buildKeyedUpdate(prev, el, keyProps);
|
|
302
|
-
if (partial)
|
|
314
|
+
if (!partial) continue;
|
|
315
|
+
if (incomplete(el)) return { $replace: after };
|
|
316
|
+
$update.push(merge ? partial : definedProps(el));
|
|
303
317
|
}
|
|
318
|
+
const $insert = afterKeys.slice(kept).map((k) => afterByKey.get(k));
|
|
319
|
+
if ($insert.some(incomplete)) return { $replace: after };
|
|
304
320
|
return arrayOps({
|
|
305
321
|
$update,
|
|
306
|
-
$insert
|
|
322
|
+
$insert,
|
|
307
323
|
$remove
|
|
308
324
|
});
|
|
309
325
|
}
|
|
@@ -387,21 +403,19 @@ function getArrayKeyProps(itemType) {
|
|
|
387
403
|
function isPrimitiveItem(field) {
|
|
388
404
|
return field.itemType.type.kind === "";
|
|
389
405
|
}
|
|
390
|
-
/**
|
|
391
|
-
|
|
406
|
+
/**
|
|
407
|
+
* The elements by {@link keyOf} bucket, or `undefined` when key identity is
|
|
408
|
+
* ambiguous: an element is not an object or lacks ALL of its key values
|
|
409
|
+
* (`undefined` / `null`), or two elements share a key (a Map collapse would
|
|
410
|
+
* silently lose one).
|
|
411
|
+
*/
|
|
412
|
+
function byKey(arr, keyProps) {
|
|
413
|
+
const map = /* @__PURE__ */ new Map();
|
|
392
414
|
for (const el of arr) {
|
|
393
|
-
if (!isPlainObject(el)) return
|
|
394
|
-
|
|
395
|
-
for (const k of keyProps) {
|
|
396
|
-
const v = el[k];
|
|
397
|
-
if (v !== void 0 && v !== null) {
|
|
398
|
-
hasAnyKey = true;
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
if (!hasAnyKey) return true;
|
|
415
|
+
if (!isPlainObject(el) || keyProps.every((k) => el[k] === void 0 || el[k] === null)) return;
|
|
416
|
+
map.set(keyOf(el, keyProps), el);
|
|
403
417
|
}
|
|
404
|
-
return
|
|
418
|
+
return map.size === arr.length ? map : void 0;
|
|
405
419
|
}
|
|
406
420
|
/**
|
|
407
421
|
* Bucket string for a keyed-array element's key values, type-strict like
|
|
@@ -458,14 +472,20 @@ function stableKey(v) {
|
|
|
458
472
|
* (revert-aware for NaN scalars) while `0` / `-0` stay equal (matches DB
|
|
459
473
|
* intent — `===` treats them equal, only NaN is special-cased).
|
|
460
474
|
*
|
|
475
|
+
* Unset is one value: `null`, `undefined` and an absent object prop are equal
|
|
476
|
+
* at any depth — a field loaded as `null` (SQL `NULL`) that the form holds as
|
|
477
|
+
* `undefined`, or an optional prop emptied to `undefined` in an array row, is
|
|
478
|
+
* unchanged. The patch cannot tell them apart either: it sends a cleared value
|
|
479
|
+
* as `null`.
|
|
480
|
+
*
|
|
461
481
|
* The single comparator shared across the form engine: diff, conflict
|
|
462
482
|
* detection ({@link buildFormRebase}), and apply all route through this — never
|
|
463
483
|
* reimplement equality elsewhere.
|
|
464
484
|
*/
|
|
465
485
|
function deepEqual(a, b) {
|
|
466
486
|
if (a === b) return true;
|
|
487
|
+
if (a === null || a === void 0 || b === null || b === void 0) return (a === null || a === void 0) && (b === null || b === void 0);
|
|
467
488
|
if (typeof a === "number" && typeof b === "number") return Number.isNaN(a) && Number.isNaN(b);
|
|
468
|
-
if (a === null || b === null || a === void 0 || b === void 0) return false;
|
|
469
489
|
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
470
490
|
const aIsArr = Array.isArray(a);
|
|
471
491
|
const bIsArr = Array.isArray(b);
|
|
@@ -477,13 +497,8 @@ function deepEqual(a, b) {
|
|
|
477
497
|
}
|
|
478
498
|
const ao = a;
|
|
479
499
|
const bo = b;
|
|
480
|
-
const
|
|
481
|
-
const
|
|
482
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
483
|
-
for (const k of aKeys) {
|
|
484
|
-
if (!Object.prototype.hasOwnProperty.call(bo, k)) return false;
|
|
485
|
-
if (!deepEqual(ao[k], bo[k])) return false;
|
|
486
|
-
}
|
|
500
|
+
for (const k of Object.keys(ao)) if (!deepEqual(ao[k], Object.hasOwn(bo, k) ? bo[k] : void 0)) return false;
|
|
501
|
+
for (const k of Object.keys(bo)) if (!Object.hasOwn(ao, k) && bo[k] !== void 0 && bo[k] !== null) return false;
|
|
487
502
|
return true;
|
|
488
503
|
}
|
|
489
504
|
//#endregion
|
package/dist/form/path-utils.cjs
CHANGED
|
@@ -64,9 +64,8 @@ function setByPath(obj, path, value) {
|
|
|
64
64
|
* if any ancestor is missing, the call is a no-op (nothing to delete).
|
|
65
65
|
*
|
|
66
66
|
* Unlike `setByPath(obj, path, undefined)`, this leaves NO own key behind — the
|
|
67
|
-
* leaf reads as absent (`'k' in parent === false`),
|
|
68
|
-
*
|
|
69
|
-
* key are NOT structurally equal under the own-key walk). Used by
|
|
67
|
+
* leaf reads as absent (`'k' in parent === false`), so the cleared data holds
|
|
68
|
+
* the same keys as data that never had the field. Used by
|
|
70
69
|
* {@link applyFormChanges} to apply a clear-to-`undefined` change as a delete.
|
|
71
70
|
*
|
|
72
71
|
* Empty path clears the root domain value (`obj.value = undefined`).
|
|
@@ -28,9 +28,8 @@ declare function setByPath(obj: Record<string, unknown>, path: string, value: un
|
|
|
28
28
|
* if any ancestor is missing, the call is a no-op (nothing to delete).
|
|
29
29
|
*
|
|
30
30
|
* Unlike `setByPath(obj, path, undefined)`, this leaves NO own key behind — the
|
|
31
|
-
* leaf reads as absent (`'k' in parent === false`),
|
|
32
|
-
*
|
|
33
|
-
* key are NOT structurally equal under the own-key walk). Used by
|
|
31
|
+
* leaf reads as absent (`'k' in parent === false`), so the cleared data holds
|
|
32
|
+
* the same keys as data that never had the field. Used by
|
|
34
33
|
* {@link applyFormChanges} to apply a clear-to-`undefined` change as a delete.
|
|
35
34
|
*
|
|
36
35
|
* Empty path clears the root domain value (`obj.value = undefined`).
|
|
@@ -28,9 +28,8 @@ declare function setByPath(obj: Record<string, unknown>, path: string, value: un
|
|
|
28
28
|
* if any ancestor is missing, the call is a no-op (nothing to delete).
|
|
29
29
|
*
|
|
30
30
|
* Unlike `setByPath(obj, path, undefined)`, this leaves NO own key behind — the
|
|
31
|
-
* leaf reads as absent (`'k' in parent === false`),
|
|
32
|
-
*
|
|
33
|
-
* key are NOT structurally equal under the own-key walk). Used by
|
|
31
|
+
* leaf reads as absent (`'k' in parent === false`), so the cleared data holds
|
|
32
|
+
* the same keys as data that never had the field. Used by
|
|
34
33
|
* {@link applyFormChanges} to apply a clear-to-`undefined` change as a delete.
|
|
35
34
|
*
|
|
36
35
|
* Empty path clears the root domain value (`obj.value = undefined`).
|
package/dist/form/path-utils.mjs
CHANGED
|
@@ -64,9 +64,8 @@ function setByPath(obj, path, value) {
|
|
|
64
64
|
* if any ancestor is missing, the call is a no-op (nothing to delete).
|
|
65
65
|
*
|
|
66
66
|
* Unlike `setByPath(obj, path, undefined)`, this leaves NO own key behind — the
|
|
67
|
-
* leaf reads as absent (`'k' in parent === false`),
|
|
68
|
-
*
|
|
69
|
-
* key are NOT structurally equal under the own-key walk). Used by
|
|
67
|
+
* leaf reads as absent (`'k' in parent === false`), so the cleared data holds
|
|
68
|
+
* the same keys as data that never had the field. Used by
|
|
70
69
|
* {@link applyFormChanges} to apply a clear-to-`undefined` change as a delete.
|
|
71
70
|
*
|
|
72
71
|
* Empty path clears the root domain value (`obj.value = undefined`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.176",
|
|
4
4
|
"description": "Framework-agnostic runtime for form and table definitions from atscript annotated types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -52,20 +52,20 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@atscript/db-client": "^0.1.
|
|
55
|
+
"@atscript/db-client": "^0.1.182"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@atscript/core": "^0.2.
|
|
59
|
-
"@atscript/db": "^0.1.
|
|
60
|
-
"@atscript/typescript": "^0.2.
|
|
58
|
+
"@atscript/core": "^0.2.13",
|
|
59
|
+
"@atscript/db": "^0.1.182",
|
|
60
|
+
"@atscript/typescript": "^0.2.13",
|
|
61
61
|
"@uniqu/core": "^0.2.2",
|
|
62
|
-
"unplugin-atscript": "^0.2.
|
|
62
|
+
"unplugin-atscript": "^0.2.13",
|
|
63
63
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@atscript/core": "^0.2.
|
|
67
|
-
"@atscript/db": "^0.1.
|
|
68
|
-
"@atscript/typescript": "^0.2.
|
|
66
|
+
"@atscript/core": "^0.2.13",
|
|
67
|
+
"@atscript/db": "^0.1.182",
|
|
68
|
+
"@atscript/typescript": "^0.2.13"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "vp pack",
|