atom.io 0.44.14 → 0.45.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/eslint-plugin/index.js +1 -1
- package/dist/introspection/index.d.ts +3 -2
- package/dist/introspection/index.d.ts.map +1 -1
- package/dist/introspection/index.js.map +1 -1
- package/dist/json/index.d.ts +34 -20
- package/dist/json/index.d.ts.map +1 -1
- package/dist/json/index.js +40 -2
- package/dist/json/index.js.map +1 -1
- package/dist/main/index.d.ts +3 -3
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +3 -2
- package/dist/main/index.js.map +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-devtools/index.js.map +1 -1
- package/dist/realtime-client/index.d.ts +1 -1
- package/dist/realtime-client/index.d.ts.map +1 -1
- package/dist/realtime-client/index.js.map +1 -1
- package/dist/realtime-server/index.d.ts +5 -0
- package/dist/realtime-server/index.d.ts.map +1 -1
- package/dist/realtime-server/index.js +38 -12
- package/dist/realtime-server/index.js.map +1 -1
- package/dist/realtime-testing/index.d.ts.map +1 -1
- package/dist/realtime-testing/index.js +3 -9
- package/dist/realtime-testing/index.js.map +1 -1
- package/dist/transceivers/o-list/index.d.ts +1 -2
- package/dist/transceivers/o-list/index.d.ts.map +1 -1
- package/dist/transceivers/o-list/index.js +23 -24
- package/dist/transceivers/o-list/index.js.map +1 -1
- package/dist/transceivers/u-list/index.d.ts +1 -2
- package/dist/transceivers/u-list/index.d.ts.map +1 -1
- package/dist/transceivers/u-list/index.js +5 -6
- package/dist/transceivers/u-list/index.js.map +1 -1
- package/package.json +2 -10
- package/src/introspection/attach-introspection-states.ts +1 -1
- package/src/introspection/attach-transaction-logs.ts +2 -2
- package/src/introspection/index.ts +3 -0
- package/src/json/canonical.ts +42 -0
- package/src/json/enumeration.ts +36 -0
- package/src/json/index.ts +3 -132
- package/src/json/json.ts +128 -0
- package/src/main/index.ts +9 -2
- package/src/main/logger.ts +4 -2
- package/src/react/use-loadable.ts +10 -5
- package/src/react-devtools/TransactionIndex.tsx +1 -1
- package/src/react-devtools/store.ts +3 -3
- package/src/realtime-client/continuity/register-and-attempt-confirmed-update.ts +2 -2
- package/src/realtime-server/realtime-family-provider.ts +44 -0
- package/src/realtime-server/realtime-mutable-family-provider.ts +38 -0
- package/src/realtime-server/realtime-mutable-provider.ts +19 -0
- package/src/realtime-server/realtime-server-stores/provide-rooms.ts +2 -1
- package/src/realtime-server/realtime-state-provider.ts +20 -0
- package/src/realtime-server/server-config.ts +2 -1
- package/src/realtime-testing/setup-realtime-test.tsx +3 -9
- package/src/transceivers/o-list/o-list.ts +27 -28
- package/src/transceivers/u-list/u-list.ts +7 -8
- package/dist/data/index.d.ts +0 -23
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js +0 -63
- package/dist/data/index.js.map +0 -1
- package/dist/struct/index.d.ts +0 -14
- package/dist/struct/index.d.ts.map +0 -1
- package/dist/struct/index.js +0 -37
- package/dist/struct/index.js.map +0 -1
- package/src/data/dict.ts +0 -31
- package/src/data/index.ts +0 -3
- package/src/data/struct-family.ts +0 -53
- package/src/data/struct.ts +0 -54
- package/src/struct/index.ts +0 -1
- package/src/struct/micro.ts +0 -72
- /package/dist/{chunk-D8lmAICg.js → chunk-CKcAJnC7.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Subject, getFromStore, getUpdateToken, subscribeInStore } from "atom.io/internal";
|
|
2
|
-
import { stringifyJson } from "atom.io/json";
|
|
3
|
-
import { enumeration, packValue, unpackValue } from "atom.io/struct";
|
|
2
|
+
import { enumeration, packCanonical, stringifyJson, unpackCanonical } from "atom.io/json";
|
|
4
3
|
|
|
5
4
|
//#region src/transceivers/o-list/o-list.ts
|
|
6
5
|
const ARRAY_UPDATES = [
|
|
@@ -348,31 +347,31 @@ var OList = class OList extends Array {
|
|
|
348
347
|
let packed = ARRAY_UPDATE_ENUM[update.type] + `\u001F`;
|
|
349
348
|
switch (update.type) {
|
|
350
349
|
case `set`:
|
|
351
|
-
packed += update.index + `\u001E` +
|
|
352
|
-
if (update.prev !== void 0) packed += `\u001E` +
|
|
350
|
+
packed += update.index + `\u001E` + packCanonical(update.next);
|
|
351
|
+
if (update.prev !== void 0) packed += `\u001E` + packCanonical(update.prev);
|
|
353
352
|
return packed;
|
|
354
|
-
case `truncate`: return packed + update.length + `\u001E` + update.items.map(
|
|
353
|
+
case `truncate`: return packed + update.length + `\u001E` + update.items.map(packCanonical).join(`\u001E`);
|
|
355
354
|
case `extend`: return packed + update.next + `\u001E` + update.prev;
|
|
356
355
|
case `pop`:
|
|
357
356
|
case `shift`:
|
|
358
|
-
if (update.value !== void 0) packed +=
|
|
357
|
+
if (update.value !== void 0) packed += packCanonical(update.value);
|
|
359
358
|
return packed;
|
|
360
359
|
case `push`:
|
|
361
|
-
case `unshift`: return packed + update.items.map(
|
|
360
|
+
case `unshift`: return packed + update.items.map(packCanonical).join(`\u001E`);
|
|
362
361
|
case `copyWithin`:
|
|
363
362
|
packed += update.target + `\u001E` + update.start;
|
|
364
363
|
if (update.end !== void 0) packed += `\u001E` + update.end;
|
|
365
|
-
packed += `\u001E\u001E` + update.prev.map(
|
|
364
|
+
packed += `\u001E\u001E` + update.prev.map(packCanonical).join(`\u001E`);
|
|
366
365
|
return packed;
|
|
367
366
|
case `fill`:
|
|
368
|
-
packed +=
|
|
367
|
+
packed += packCanonical(update.value);
|
|
369
368
|
if (update.start !== void 0) packed += `\u001E` + update.start;
|
|
370
369
|
if (update.end !== void 0) packed += `\u001E` + update.end;
|
|
371
|
-
packed += `\u001E\u001E` + update.prev.map(
|
|
370
|
+
packed += `\u001E\u001E` + update.prev.map(packCanonical).join(`\u001E`);
|
|
372
371
|
return packed;
|
|
373
|
-
case `splice`: return packed + update.start + `\u001E\u001E` + update.deleteCount + `\u001E\u001E` + update.items.map(
|
|
372
|
+
case `splice`: return packed + update.start + `\u001E\u001E` + update.deleteCount + `\u001E\u001E` + update.items.map(packCanonical).join(`\u001E`) + `\u001E\u001E` + update.deleted.map(packCanonical).join(`\u001E`);
|
|
374
373
|
case `reverse`: return packed;
|
|
375
|
-
case `sort`: return packed + update.next.map(
|
|
374
|
+
case `sort`: return packed + update.next.map(packCanonical).join(`\u001E`) + `\u001E\u001E` + update.prev.map(packCanonical).join(`\u001E`);
|
|
376
375
|
}
|
|
377
376
|
}
|
|
378
377
|
static unpackUpdate(packed) {
|
|
@@ -382,7 +381,7 @@ var OList = class OList extends Array {
|
|
|
382
381
|
case `set`: {
|
|
383
382
|
const [i, n, p] = tail.split(`\u001E`);
|
|
384
383
|
const index = +i;
|
|
385
|
-
const next =
|
|
384
|
+
const next = unpackCanonical(n);
|
|
386
385
|
if (p === void 0) return {
|
|
387
386
|
type,
|
|
388
387
|
index,
|
|
@@ -392,7 +391,7 @@ var OList = class OList extends Array {
|
|
|
392
391
|
type,
|
|
393
392
|
index,
|
|
394
393
|
next,
|
|
395
|
-
prev:
|
|
394
|
+
prev: unpackCanonical(p)
|
|
396
395
|
};
|
|
397
396
|
}
|
|
398
397
|
case `truncate`: {
|
|
@@ -400,7 +399,7 @@ var OList = class OList extends Array {
|
|
|
400
399
|
return {
|
|
401
400
|
type,
|
|
402
401
|
length: +l,
|
|
403
|
-
items: i.map(
|
|
402
|
+
items: i.map(unpackCanonical)
|
|
404
403
|
};
|
|
405
404
|
}
|
|
406
405
|
case `extend`: {
|
|
@@ -415,17 +414,17 @@ var OList = class OList extends Array {
|
|
|
415
414
|
case `shift`:
|
|
416
415
|
if (tail !== ``) return {
|
|
417
416
|
type,
|
|
418
|
-
value:
|
|
417
|
+
value: unpackCanonical(tail)
|
|
419
418
|
};
|
|
420
419
|
return { type };
|
|
421
420
|
case `push`:
|
|
422
421
|
case `unshift`: return {
|
|
423
422
|
type,
|
|
424
|
-
items: tail.split(`\u001E`).map(
|
|
423
|
+
items: tail.split(`\u001E`).map(unpackCanonical)
|
|
425
424
|
};
|
|
426
425
|
case `copyWithin`: {
|
|
427
426
|
const [numbers, data] = tail.split(`\u001E\u001E`);
|
|
428
|
-
const prev = data ? data.split(`\u001E`).map(
|
|
427
|
+
const prev = data ? data.split(`\u001E`).map(unpackCanonical) : [];
|
|
429
428
|
const [t, s, e] = numbers.split(`\u001E`);
|
|
430
429
|
const target = +t;
|
|
431
430
|
const start = +s;
|
|
@@ -445,9 +444,9 @@ var OList = class OList extends Array {
|
|
|
445
444
|
}
|
|
446
445
|
case `fill`: {
|
|
447
446
|
const [numbers, data] = tail.split(`\u001E\u001E`);
|
|
448
|
-
const prev = data ? data.split(`\u001E`).map(
|
|
447
|
+
const prev = data ? data.split(`\u001E`).map(unpackCanonical) : [];
|
|
449
448
|
const [v, s, e] = numbers.split(`\u001E`);
|
|
450
|
-
const value =
|
|
449
|
+
const value = unpackCanonical(v);
|
|
451
450
|
if (s === void 0 && e === void 0) return {
|
|
452
451
|
type,
|
|
453
452
|
value,
|
|
@@ -474,8 +473,8 @@ var OList = class OList extends Array {
|
|
|
474
473
|
type,
|
|
475
474
|
start: +s,
|
|
476
475
|
deleteCount: +c,
|
|
477
|
-
items: i ? i.split(`\u001E`).map(
|
|
478
|
-
deleted: d ? d.split(`\u001E`).map(
|
|
476
|
+
items: i ? i.split(`\u001E`).map(unpackCanonical) : [],
|
|
477
|
+
deleted: d ? d.split(`\u001E`).map(unpackCanonical) : []
|
|
479
478
|
};
|
|
480
479
|
}
|
|
481
480
|
case `reverse`: return { type };
|
|
@@ -483,8 +482,8 @@ var OList = class OList extends Array {
|
|
|
483
482
|
const [n, p] = tail.split(`\u001E\u001E`);
|
|
484
483
|
return {
|
|
485
484
|
type,
|
|
486
|
-
next: n ? n.split(`\u001E`).map(
|
|
487
|
-
prev: p ? p.split(`\u001E`).map(
|
|
485
|
+
next: n ? n.split(`\u001E`).map(unpackCanonical) : [],
|
|
486
|
+
prev: p ? p.split(`\u001E`).map(unpackCanonical) : []
|
|
488
487
|
};
|
|
489
488
|
}
|
|
490
489
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ARRAY_UPDATE_ENUM: Enumeration<typeof ARRAY_UPDATES>","prev: P | undefined","result: number","value: P | undefined","prev: P[] | undefined","oListDisposedKeyCleanupEffect: AtomEffect<OList<primitive>>"],"sources":["../../../src/transceivers/o-list/o-list.ts","../../../src/transceivers/o-list/o-list-disposed-key-cleanup-effect.ts"],"sourcesContent":["import type { Fn, Transceiver, TransceiverMode } from \"atom.io/internal\"\nimport { Subject } from \"atom.io/internal\"\nimport type { primitive } from \"atom.io/json\"\nimport type { Enumeration } from \"atom.io/struct\"\nimport { enumeration, packValue, unpackValue } from \"atom.io/struct\"\n\nexport type ArrayMutations = Exclude<keyof Array<any>, keyof ReadonlyArray<any>>\nexport type ArrayUpdate<P extends primitive> =\n\t| {\n\t\t\ttype: `copyWithin`\n\t\t\ttarget: number\n\t\t\tstart: number\n\t\t\tend?: number\n\t\t\tprev: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `extend`\n\t\t\tnext: number\n\t\t\tprev: number\n\t }\n\t| {\n\t\t\ttype: `fill`\n\t\t\tvalue: P\n\t\t\tstart?: number\n\t\t\tend?: number\n\t\t\tprev: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `pop` | `shift`\n\t\t\tvalue?: P\n\t }\n\t| {\n\t\t\ttype: `push` | `unshift`\n\t\t\titems: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `reverse`\n\t }\n\t| {\n\t\t\ttype: `set`\n\t\t\tnext: P\n\t\t\tprev?: P\n\t\t\tindex: number\n\t }\n\t| {\n\t\t\ttype: `sort`\n\t\t\tnext: readonly P[]\n\t\t\tprev: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `splice`\n\t\t\tstart: number\n\t\t\tdeleteCount: number\n\t\t\titems: readonly P[]\n\t\t\tdeleted: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `truncate`\n\t\t\tlength: number\n\t\t\titems: readonly P[]\n\t }\nexport type OListUpdateType = ArrayUpdate<any>[`type`]\ntrue satisfies ArrayMutations extends OListUpdateType\n\t? true\n\t: Exclude<ArrayMutations, OListUpdateType>\n\nexport type PackedArrayUpdate<P extends primitive> = string & {\n\tupdate?: ArrayUpdate<P>\n\ttype?: P\n}\n\nconst ARRAY_UPDATES = [\n\t// virtual methods\n\t`set`,\n\t`truncate`,\n\t`extend`,\n\t// actual methods\n\t`pop`,\n\t`push`,\n\t`shift`,\n\t`unshift`,\n\t`copyWithin`,\n\t`fill`,\n\t`splice`,\n\t`reverse`,\n\t`sort`,\n] as const\ntrue satisfies ArrayUpdate<any>[`type`] extends (typeof ARRAY_UPDATES)[number]\n\t? true\n\t: Exclude<ArrayUpdate<any>[`type`], (typeof ARRAY_UPDATES)[number]>\n\nexport const ARRAY_UPDATE_ENUM: Enumeration<typeof ARRAY_UPDATES> =\n\tenumeration(ARRAY_UPDATES)\n\nexport type ArrayMutationHandler = {\n\t[K in Exclude<OListUpdateType, `extend` | `set` | `truncate`>]: Fn\n}\n\nexport type OListView<P extends primitive> = ReadonlyArray<P> & {\n\tsubscribe: (\n\t\tkey: string,\n\t\tfn: (update: PackedArrayUpdate<P>) => void,\n\t) => () => void\n}\n\nexport class OList<P extends primitive>\n\textends Array<P>\n\timplements\n\t\tTransceiver<OListView<P>, PackedArrayUpdate<P>, ReadonlyArray<P>>,\n\t\tArrayMutationHandler\n{\n\tpublic mode: TransceiverMode = `record`\n\tpublic readonly subject: Subject<PackedArrayUpdate<P>> = new Subject()\n\n\tpublic readonly READONLY_VIEW: OListView<P> = this\n\n\tpublic constructor(arrayLength?: number)\n\tpublic constructor(...items: P[])\n\tpublic constructor(...items: P[]) {\n\t\tsuper(...items)\n\t\t// biome-ignore lint/correctness/noConstructorReturn: this is chill\n\t\treturn new Proxy(this, {\n\t\t\tset: (target, prop, value, receiver) => {\n\t\t\t\tif (\n\t\t\t\t\ttypeof prop === `string` &&\n\t\t\t\t\t!Number.isNaN(Number.parseInt(prop, 10))\n\t\t\t\t) {\n\t\t\t\t\tconst index = Number(prop)\n\t\t\t\t\tlet prev: P | undefined\n\t\t\t\t\tif (this.mode === `record`) {\n\t\t\t\t\t\tprev = target[index]\n\t\t\t\t\t}\n\t\t\t\t\ttarget[index] = value\n\t\t\t\t\tif (prev) {\n\t\t\t\t\t\tthis.emit({ type: `set`, index, next: value, prev })\n\t\t\t\t\t} else if (this.mode === `record`) {\n\t\t\t\t\t\tthis.emit({ type: `set`, index, next: value })\n\t\t\t\t\t}\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tif (prop === `length`) {\n\t\t\t\t\tif (this.mode === `record`) {\n\t\t\t\t\t\tconst prevLength = target.length\n\t\t\t\t\t\tif (prevLength === value) return true\n\t\t\t\t\t\tif (prevLength > value) {\n\t\t\t\t\t\t\tconst dropped = target.slice(value)\n\t\t\t\t\t\t\ttarget.length = value\n\t\t\t\t\t\t\tthis.emit({ type: `truncate`, length: value, items: dropped })\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttarget.length = value\n\t\t\t\t\t\t\tthis.emit({ type: `extend`, next: value, prev: prevLength })\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.length = value\n\t\t\t\t\t}\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\treturn Reflect.set(target, prop, value, receiver)\n\t\t\t},\n\t\t})\n\t}\n\n\tpublic toJSON(): ReadonlyArray<P> {\n\t\treturn [...this]\n\t}\n\n\tpublic static fromJSON<P extends primitive>(json: ReadonlyArray<P>): OList<P> {\n\t\treturn new OList<P>(...json)\n\t}\n\n\tpublic push(...items: P[]): number {\n\t\tlet result: number\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tresult = super.push(...items)\n\t\t\tthis.mode = `record`\n\t\t\tthis.emit({ type: `push`, items })\n\t\t} else {\n\t\t\tresult = super.push(...items)\n\t\t}\n\t\treturn result\n\t}\n\tpublic pop(): P | undefined {\n\t\tlet value: P | undefined\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tvalue = super.pop()\n\t\t\tif (value === undefined) {\n\t\t\t\tthis.emit({ type: `pop` })\n\t\t\t} else {\n\t\t\t\tthis.emit({ type: `pop`, value })\n\t\t\t}\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tvalue = super.pop()\n\t\t}\n\t\treturn value\n\t}\n\tpublic shift(): P | undefined {\n\t\tlet value: P | undefined\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tvalue = super.shift()\n\t\t\tif (value === undefined) {\n\t\t\t\tthis.emit({ type: `shift` })\n\t\t\t} else {\n\t\t\t\tthis.emit({ type: `shift`, value })\n\t\t\t}\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tvalue = super.shift()\n\t\t}\n\t\treturn value\n\t}\n\tpublic unshift(...items: P[]): number {\n\t\tlet result: number\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tresult = super.unshift(...items)\n\t\t\tthis.emit({ type: `unshift`, items })\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tresult = super.unshift(...items)\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic reverse(): this {\n\t\tsuper.reverse()\n\t\tif (this.mode === `record`) {\n\t\t\tthis.emit({ type: `reverse` })\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic fill(value: P, start?: number, end?: number): this {\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tconst prev = this.slice(start, end)\n\t\t\tsuper.fill(value, start, end)\n\t\t\tif (start === undefined) {\n\t\t\t\tthis.emit({ type: `fill`, value, prev })\n\t\t\t} else {\n\t\t\t\tif (end === undefined) {\n\t\t\t\t\tthis.emit({ type: `fill`, value, start, prev })\n\t\t\t\t} else {\n\t\t\t\t\tthis.emit({ type: `fill`, value, start, end, prev })\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tsuper.fill(value, start, end)\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic sort(compareFn?: (a: P, b: P) => number): this {\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tconst prev = [...this]\n\t\t\tsuper.sort(compareFn)\n\t\t\tconst next = [...this]\n\t\t\tthis.emit({ type: `sort`, next, prev })\n\t\t\tthis.mode = `record`\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic splice(start: number, deleteCount?: number): P[]\n\tpublic splice(start: number, deleteCount: number, ...items: P[]): P[]\n\tpublic splice(\n\t\t...params: [start: number, deleteCount?: number, ...items: P[]]\n\t): P[] {\n\t\tconst [start, deleteCount, ...items] = params\n\t\tconst originalMode = this.mode\n\t\tif (originalMode === `record`) this.mode = `playback`\n\t\tconst deleted = super.splice(...(params as [number, number, ...P[]]))\n\t\tif (originalMode === `record`) this.mode = `record`\n\t\tif (deleteCount === undefined) {\n\t\t\tthis.emit({\n\t\t\t\ttype: `splice`,\n\t\t\t\tstart,\n\t\t\t\titems,\n\t\t\t\tdeleted,\n\t\t\t\tdeleteCount: deleted.length,\n\t\t\t})\n\t\t} else {\n\t\t\tthis.emit({ type: `splice`, start, items, deleted, deleteCount })\n\t\t}\n\n\t\treturn deleted\n\t}\n\n\tpublic copyWithin(target: number, start: number, end?: number): this {\n\t\tconst originalMode = this.mode\n\t\tlet prev: P[] | undefined\n\t\tif (originalMode === `record`) {\n\t\t\tprev = this.slice(target)\n\t\t\tthis.mode = `playback`\n\t\t}\n\t\tsuper.copyWithin(target, start, end)\n\t\tif (originalMode === `record`) this.mode = `record`\n\t\tif (prev) {\n\t\t\tif (end === undefined) {\n\t\t\t\tthis.emit({ type: `copyWithin`, prev, target, start })\n\t\t\t} else {\n\t\t\t\tthis.emit({ type: `copyWithin`, prev, target, start, end })\n\t\t\t}\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic subscribe(\n\t\tkey: string,\n\t\tfn: (update: PackedArrayUpdate<P>) => void,\n\t): () => void {\n\t\treturn this.subject.subscribe(key, fn)\n\t}\n\n\tpublic emit(update: ArrayUpdate<P>): void {\n\t\tthis.subject.next(OList.packUpdate(update))\n\t}\n\n\tprivate doStep(update: ArrayUpdate<P>): void {\n\t\tconst type = update.type\n\t\tswitch (type) {\n\t\t\tcase `copyWithin`:\n\t\t\t\tthis.copyWithin(update.target, update.start, update.end)\n\t\t\t\tbreak\n\t\t\tcase `extend`:\n\t\t\t\tthis.length = update.next\n\t\t\t\tbreak\n\t\t\tcase `fill`:\n\t\t\t\tthis.fill(update.value, update.start, update.end)\n\t\t\t\tbreak\n\t\t\tcase `pop`:\n\t\t\t\tthis.pop()\n\t\t\t\tbreak\n\t\t\tcase `push`:\n\t\t\t\tthis.push(...update.items)\n\t\t\t\tbreak\n\t\t\tcase `reverse`:\n\t\t\t\tthis.reverse()\n\t\t\t\tbreak\n\t\t\tcase `shift`:\n\t\t\t\tthis.shift()\n\t\t\t\tbreak\n\t\t\tcase `sort`:\n\t\t\t\tfor (let i = 0; i < update.next.length; i++) {\n\t\t\t\t\tthis[i] = update.next[i]\n\t\t\t\t}\n\t\t\t\tthis.length = update.next.length\n\t\t\t\tbreak\n\t\t\tcase `splice`:\n\t\t\t\tthis.splice(update.start, update.deleteCount, ...update.items)\n\t\t\t\tbreak\n\t\t\tcase `truncate`:\n\t\t\t\tthis.length = update.length\n\t\t\t\tbreak\n\t\t\tcase `set`:\n\t\t\t\tthis[update.index] = update.next\n\t\t\t\tbreak\n\t\t\tcase `unshift`:\n\t\t\t\tthis.unshift(...update.items)\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tpublic do(update: PackedArrayUpdate<P>): null {\n\t\tthis.mode = `playback`\n\t\tconst unpacked = OList.unpackUpdate(update)\n\t\tthis.doStep(unpacked)\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic undoStep(update: ArrayUpdate<P>): void {\n\t\tswitch (update.type) {\n\t\t\tcase `copyWithin`:\n\t\t\t\tfor (let i = 0; i < update.prev.length; i++) {\n\t\t\t\t\tthis[i + update.target] = update.prev[i]\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `extend`:\n\t\t\t\tthis.length = update.prev\n\t\t\t\tbreak\n\t\t\tcase `fill`:\n\t\t\t\t{\n\t\t\t\t\tconst start = update.start ?? 0\n\t\t\t\t\tfor (let i = 0; i < update.prev.length; i++) {\n\t\t\t\t\t\tthis[i + start] = update.prev[i]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `pop`:\n\t\t\t\tif (update.value) this.push(update.value)\n\t\t\t\tbreak\n\t\t\tcase `push`:\n\t\t\t\t{\n\t\t\t\t\tlet i = update.items.length - 1\n\t\t\t\t\twhile (i >= 0) {\n\t\t\t\t\t\tthis.pop()\n\t\t\t\t\t\t--i\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `reverse`:\n\t\t\t\tthis.reverse()\n\t\t\t\tbreak\n\t\t\tcase `shift`:\n\t\t\t\tif (update.value) this.unshift(update.value)\n\t\t\t\tbreak\n\t\t\tcase `sort`:\n\t\t\t\tfor (let i = 0; i < update.prev.length; i++) {\n\t\t\t\t\tthis[i] = update.prev[i]\n\t\t\t\t}\n\t\t\t\tthis.length = update.prev.length\n\t\t\t\tbreak\n\t\t\tcase `set`:\n\t\t\t\tif (update.prev) {\n\t\t\t\t\tthis[update.index] = update.prev\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\t\tdelete this[update.index]\n\t\t\t\t\tconst firstEmptyIndex = this.findIndex(\n\t\t\t\t\t\t(_, i) => !Object.hasOwn(this, i),\n\t\t\t\t\t)\n\t\t\t\t\tif (firstEmptyIndex !== -1) {\n\t\t\t\t\t\tthis.length = firstEmptyIndex\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `splice`:\n\t\t\t\tthis.splice(update.start, update.items.length, ...update.deleted)\n\t\t\t\tbreak\n\t\t\tcase `truncate`:\n\t\t\t\tthis.push(...update.items)\n\t\t\t\tbreak\n\t\t\tcase `unshift`:\n\t\t\t\t{\n\t\t\t\t\tlet i = update.items.length - 1\n\t\t\t\t\twhile (i >= 0) {\n\t\t\t\t\t\tthis.shift()\n\t\t\t\t\t\t--i\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tpublic undo(update: PackedArrayUpdate<P>): number | null {\n\t\tthis.mode = `playback`\n\t\tconst unpacked = OList.unpackUpdate(update)\n\t\tthis.undoStep(unpacked)\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic static packUpdate<P extends primitive>(\n\t\tupdate: ArrayUpdate<P>,\n\t): PackedArrayUpdate<P> {\n\t\tlet packed = ARRAY_UPDATE_ENUM[update.type] + `\\u001F`\n\t\tswitch (update.type) {\n\t\t\tcase `set`:\n\t\t\t\tpacked += update.index + `\\u001E` + packValue(update.next)\n\t\t\t\tif (update.prev !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + packValue(update.prev)\n\t\t\t\t}\n\t\t\t\treturn packed\n\t\t\tcase `truncate`:\n\t\t\t\treturn (\n\t\t\t\t\tpacked +\n\t\t\t\t\tupdate.length +\n\t\t\t\t\t`\\u001E` +\n\t\t\t\t\tupdate.items.map(packValue).join(`\\u001E`)\n\t\t\t\t)\n\t\t\tcase `extend`:\n\t\t\t\treturn packed + update.next + `\\u001E` + update.prev\n\t\t\tcase `pop`:\n\t\t\tcase `shift`:\n\t\t\t\tif (update.value !== undefined) {\n\t\t\t\t\tpacked += packValue(update.value)\n\t\t\t\t}\n\t\t\t\treturn packed\n\t\t\tcase `push`:\n\t\t\tcase `unshift`:\n\t\t\t\treturn packed + update.items.map(packValue).join(`\\u001E`)\n\t\t\tcase `copyWithin`:\n\t\t\t\tpacked += update.target + `\\u001E` + update.start\n\t\t\t\tif (update.end !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + update.end\n\t\t\t\t}\n\t\t\t\tpacked += `\\u001E\\u001E` + update.prev.map(packValue).join(`\\u001E`)\n\t\t\t\treturn packed\n\t\t\tcase `fill`:\n\t\t\t\tpacked += packValue(update.value)\n\t\t\t\tif (update.start !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + update.start\n\t\t\t\t}\n\t\t\t\tif (update.end !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + update.end\n\t\t\t\t}\n\t\t\t\tpacked += `\\u001E\\u001E` + update.prev.map(packValue).join(`\\u001E`)\n\t\t\t\treturn packed\n\t\t\tcase `splice`:\n\t\t\t\treturn (\n\t\t\t\t\tpacked +\n\t\t\t\t\tupdate.start +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.deleteCount +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.items.map(packValue).join(`\\u001E`) +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.deleted.map(packValue).join(`\\u001E`)\n\t\t\t\t)\n\t\t\tcase `reverse`:\n\t\t\t\treturn packed\n\t\t\tcase `sort`:\n\t\t\t\treturn (\n\t\t\t\t\tpacked +\n\t\t\t\t\tupdate.next.map(packValue).join(`\\u001E`) +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.prev.map(packValue).join(`\\u001E`)\n\t\t\t\t)\n\t\t}\n\t}\n\n\tpublic static unpackUpdate<P extends primitive>(\n\t\tpacked: PackedArrayUpdate<P>,\n\t): ArrayUpdate<P> {\n\t\tconst [head, tail] = packed.split(`\\u001F`) as [\n\t\t\tExtract<keyof typeof ARRAY_UPDATE_ENUM, number>,\n\t\t\tstring,\n\t\t]\n\t\tconst type = ARRAY_UPDATE_ENUM[head]\n\t\tswitch (type) {\n\t\t\tcase `set`: {\n\t\t\t\tconst [i, n, p] = tail.split(`\\u001E`)\n\t\t\t\tconst index = +i\n\t\t\t\tconst next = unpackValue(n) as P\n\t\t\t\tif (p === undefined) {\n\t\t\t\t\treturn { type, index, next }\n\t\t\t\t}\n\t\t\t\tconst prev = unpackValue(p) as P\n\t\t\t\treturn { type, index, next, prev }\n\t\t\t}\n\t\t\tcase `truncate`: {\n\t\t\t\tconst [l, ...i] = tail.split(`\\u001E`)\n\t\t\t\tconst length = +l\n\t\t\t\tconst items = i.map(unpackValue) as P[]\n\t\t\t\treturn { type, length, items }\n\t\t\t}\n\t\t\tcase `extend`: {\n\t\t\t\tconst [n, p] = tail.split(`\\u001E`)\n\t\t\t\tconst next = +n\n\t\t\t\tconst prev = +p\n\t\t\t\treturn { type, next, prev }\n\t\t\t}\n\t\t\tcase `pop`:\n\t\t\tcase `shift`:\n\t\t\t\tif (tail !== ``) {\n\t\t\t\t\tconst value = unpackValue(tail) as P\n\t\t\t\t\treturn { type, value }\n\t\t\t\t}\n\t\t\t\treturn { type }\n\t\t\tcase `push`:\n\t\t\tcase `unshift`: {\n\t\t\t\tconst items = tail.split(`\\u001E`).map(unpackValue) as P[]\n\t\t\t\treturn { type, items }\n\t\t\t}\n\t\t\tcase `copyWithin`: {\n\t\t\t\tconst [numbers, data] = tail.split(`\\u001E\\u001E`)\n\t\t\t\tconst prev = data ? (data.split(`\\u001E`).map(unpackValue) as P[]) : []\n\t\t\t\tconst [t, s, e] = numbers.split(`\\u001E`)\n\t\t\t\tconst target = +t\n\t\t\t\tconst start = +s\n\t\t\t\tif (e === undefined) {\n\t\t\t\t\treturn { type, target, start, prev }\n\t\t\t\t}\n\t\t\t\tconst end = +e\n\t\t\t\treturn { type, target, start, prev, end }\n\t\t\t}\n\t\t\tcase `fill`: {\n\t\t\t\tconst [numbers, data] = tail.split(`\\u001E\\u001E`)\n\t\t\t\tconst prev = data ? (data.split(`\\u001E`).map(unpackValue) as P[]) : []\n\t\t\t\tconst [v, s, e] = numbers.split(`\\u001E`)\n\t\t\t\tconst value = unpackValue(v) as P\n\t\t\t\tif (s === undefined && e === undefined) {\n\t\t\t\t\treturn { type, value, prev }\n\t\t\t\t}\n\t\t\t\tconst start = +s\n\t\t\t\tif (e === undefined) {\n\t\t\t\t\treturn { type, value, prev, start }\n\t\t\t\t}\n\t\t\t\tconst end = +e\n\t\t\t\treturn { type, value, prev, start, end }\n\t\t\t}\n\t\t\tcase `splice`: {\n\t\t\t\tconst [s, c, i, d] = tail.split(`\\u001E\\u001E`)\n\n\t\t\t\tconst start = +s\n\t\t\t\tconst deleteCount = +c\n\t\t\t\tconst items = i ? (i.split(`\\u001E`).map(unpackValue) as P[]) : []\n\t\t\t\tconst deleted = d ? (d.split(`\\u001E`).map(unpackValue) as P[]) : []\n\t\t\t\treturn { type, start, deleteCount, items, deleted }\n\t\t\t}\n\t\t\tcase `reverse`:\n\t\t\t\treturn { type }\n\t\t\tcase `sort`: {\n\t\t\t\tconst [n, p] = tail.split(`\\u001E\\u001E`)\n\t\t\t\tconst next = n ? (n.split(`\\u001E`).map(unpackValue) as P[]) : []\n\t\t\t\tconst prev = p ? (p.split(`\\u001E`).map(unpackValue) as P[]) : []\n\t\t\t\treturn { type, next, prev }\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { AtomEffect } from \"atom.io\"\nimport { getFromStore, getUpdateToken, subscribeInStore } from \"atom.io/internal\"\nimport { type primitive, stringifyJson } from \"atom.io/json\"\n\nimport { OList } from \"./o-list\"\n\nexport function filterOutInPlace<T>(arr: T[], toRemove: T): T[] {\n\tlet writeIndex = 0\n\n\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\tfor (let readIndex = 0; readIndex < arr.length; readIndex++) {\n\t\tif (toRemove !== arr[readIndex]) {\n\t\t\tarr[writeIndex] = arr[readIndex]\n\t\t\twriteIndex++\n\t\t}\n\t}\n\n\tarr.length = writeIndex\n\treturn arr\n}\n\nexport const oListDisposedKeyCleanupEffect: AtomEffect<OList<primitive>> = ({\n\ttoken,\n\tsetSelf,\n\tstore,\n}) => {\n\tconst disposalSubscriptions = new Map<primitive, () => void>()\n\tconst updateToken = getUpdateToken(token)\n\n\tconst addedValues = new Set<primitive>()\n\tconst removedValues = new Set<primitive>()\n\tfunction updateSubscriptions() {\n\t\tfor (const addedValue of addedValues) {\n\t\t\tconst molecule = store.molecules.get(stringifyJson(addedValue))\n\t\t\tif (molecule) {\n\t\t\t\tdisposalSubscriptions.set(\n\t\t\t\t\taddedValue,\n\t\t\t\t\tmolecule.subject.subscribe(token.key, () => {\n\t\t\t\t\t\tdisposalSubscriptions.get(addedValue)?.()\n\t\t\t\t\t\tdisposalSubscriptions.delete(addedValue)\n\t\t\t\t\t\tsetSelf((self) => {\n\t\t\t\t\t\t\tfilterOutInPlace(self, addedValue)\n\t\t\t\t\t\t\treturn self\n\t\t\t\t\t\t})\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tstore.logger.warn(\n\t\t\t\t\t`❌`,\n\t\t\t\t\ttoken.type,\n\t\t\t\t\ttoken.key,\n\t\t\t\t\t`Added \"${addedValue}\" to ${token.key} but it has not been allocated.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tfor (const removedValue of removedValues) {\n\t\t\tif (disposalSubscriptions.has(removedValue)) {\n\t\t\t\tdisposalSubscriptions.get(removedValue)?.()\n\t\t\t\tdisposalSubscriptions.delete(removedValue)\n\t\t\t}\n\t\t}\n\t}\n\tsubscribeInStore(\n\t\tstore,\n\t\tupdateToken,\n\t\tfunction manageAutoDeletionTriggers({ newValue }) {\n\t\t\tconst currentList = getFromStore(store, token)\n\t\t\tconst unpacked = OList.unpackUpdate(newValue)\n\t\t\tswitch (unpacked.type) {\n\t\t\t\tcase `extend`:\n\t\t\t\tcase `reverse`:\n\t\t\t\tcase `sort`:\n\t\t\t\t\tbreak // these don't change what values are present in the list\n\n\t\t\t\tcase `set`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst { next } = unpacked\n\t\t\t\t\t\tif (`prev` in unpacked && !currentList.includes(unpacked.prev)) {\n\t\t\t\t\t\t\tremovedValues.add(unpacked.prev)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!disposalSubscriptions.has(next)) {\n\t\t\t\t\t\t\taddedValues.add(next)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `truncate`:\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (const item of unpacked.items) {\n\t\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `shift`:\n\t\t\t\tcase `pop`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst { value } = unpacked\n\t\t\t\t\t\tif (value !== undefined && !currentList.includes(value)) {\n\t\t\t\t\t\t\tremovedValues.add(value)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `push`:\n\t\t\t\tcase `unshift`:\n\t\t\t\t\tfor (const item of unpacked.items) {\n\t\t\t\t\t\tif (!disposalSubscriptions.has(item)) {\n\t\t\t\t\t\t\taddedValues.add(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `copyWithin`:\n\t\t\t\t\tfor (const item of unpacked.prev) {\n\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `fill`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst { value } = unpacked\n\t\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\t\tif (!disposalSubscriptions.has(value)) {\n\t\t\t\t\t\t\t\taddedValues.add(value)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const item of unpacked.prev) {\n\t\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `splice`:\n\t\t\t\t\tfor (const item of unpacked.deleted) {\n\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const addedItem of unpacked.items) {\n\t\t\t\t\t\tif (!disposalSubscriptions.has(addedItem)) {\n\t\t\t\t\t\t\taddedValues.add(addedItem)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t\tupdateSubscriptions()\n\t\t\taddedValues.clear()\n\t\t\tremovedValues.clear()\n\t\t},\n\t\t`set-auto-deletion-triggers`,\n\t)\n}\n"],"mappings":";;;;;AAuEA,MAAM,gBAAgB;CAErB;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAKD,MAAaA,oBACZ,YAAY,cAAc;AAa3B,IAAa,QAAb,MAAa,cACJ,MAIT;CACC,AAAO,OAAwB;CAC/B,AAAgB,UAAyC,IAAI,SAAS;CAEtE,AAAgB,gBAA8B;CAI9C,AAAO,YAAY,GAAG,OAAY;AACjC,QAAM,GAAG,MAAM;AAEf,SAAO,IAAI,MAAM,MAAM,EACtB,MAAM,QAAQ,MAAM,OAAO,aAAa;AACvC,OACC,OAAO,SAAS,YAChB,CAAC,OAAO,MAAM,OAAO,SAAS,MAAM,GAAG,CAAC,EACvC;IACD,MAAM,QAAQ,OAAO,KAAK;IAC1B,IAAIC;AACJ,QAAI,KAAK,SAAS,SACjB,QAAO,OAAO;AAEf,WAAO,SAAS;AAChB,QAAI,KACH,MAAK,KAAK;KAAE,MAAM;KAAO;KAAO,MAAM;KAAO;KAAM,CAAC;aAC1C,KAAK,SAAS,SACxB,MAAK,KAAK;KAAE,MAAM;KAAO;KAA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c,IAAI,KAAK;;AAI1B;GACD,KAAK;AACJ,SAAK,MAAM,QAAQ,SAAS,QAC3B,KAAI,CAAC,YAAY,SAAS,KAAK,CAC9B,eAAc,IAAI,KAAK;AAGzB,SAAK,MAAM,aAAa,SAAS,MAChC,KAAI,CAAC,sBAAsB,IAAI,UAAU,CACxC,aAAY,IAAI,UAAU;AAG5B;;AAEF,uBAAqB;AACrB,cAAY,OAAO;AACnB,gBAAc,OAAO;IAEtB,6BACA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ARRAY_UPDATE_ENUM: Enumeration<typeof ARRAY_UPDATES>","prev: P | undefined","result: number","value: P | undefined","prev: P[] | undefined","oListDisposedKeyCleanupEffect: AtomEffect<OList<primitive>>"],"sources":["../../../src/transceivers/o-list/o-list.ts","../../../src/transceivers/o-list/o-list-disposed-key-cleanup-effect.ts"],"sourcesContent":["import type { Fn, Transceiver, TransceiverMode } from \"atom.io/internal\"\nimport { Subject } from \"atom.io/internal\"\nimport type { Enumeration, packed, primitive } from \"atom.io/json\"\nimport { enumeration, packCanonical, unpackCanonical } from \"atom.io/json\"\n\nexport type ArrayMutations = Exclude<keyof Array<any>, keyof ReadonlyArray<any>>\nexport type ArrayUpdate<P extends primitive> =\n\t| {\n\t\t\ttype: `copyWithin`\n\t\t\ttarget: number\n\t\t\tstart: number\n\t\t\tend?: number\n\t\t\tprev: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `extend`\n\t\t\tnext: number\n\t\t\tprev: number\n\t }\n\t| {\n\t\t\ttype: `fill`\n\t\t\tvalue: P\n\t\t\tstart?: number\n\t\t\tend?: number\n\t\t\tprev: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `pop` | `shift`\n\t\t\tvalue?: P\n\t }\n\t| {\n\t\t\ttype: `push` | `unshift`\n\t\t\titems: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `reverse`\n\t }\n\t| {\n\t\t\ttype: `set`\n\t\t\tnext: P\n\t\t\tprev?: P\n\t\t\tindex: number\n\t }\n\t| {\n\t\t\ttype: `sort`\n\t\t\tnext: readonly P[]\n\t\t\tprev: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `splice`\n\t\t\tstart: number\n\t\t\tdeleteCount: number\n\t\t\titems: readonly P[]\n\t\t\tdeleted: readonly P[]\n\t }\n\t| {\n\t\t\ttype: `truncate`\n\t\t\tlength: number\n\t\t\titems: readonly P[]\n\t }\nexport type OListUpdateType = ArrayUpdate<any>[`type`]\ntrue satisfies ArrayMutations extends OListUpdateType\n\t? true\n\t: Exclude<ArrayMutations, OListUpdateType>\n\nexport type PackedArrayUpdate<P extends primitive> = string & {\n\tupdate?: ArrayUpdate<P>\n\ttype?: P\n}\n\nconst ARRAY_UPDATES = [\n\t// virtual methods\n\t`set`,\n\t`truncate`,\n\t`extend`,\n\t// actual methods\n\t`pop`,\n\t`push`,\n\t`shift`,\n\t`unshift`,\n\t`copyWithin`,\n\t`fill`,\n\t`splice`,\n\t`reverse`,\n\t`sort`,\n] as const\ntrue satisfies ArrayUpdate<any>[`type`] extends (typeof ARRAY_UPDATES)[number]\n\t? true\n\t: Exclude<ArrayUpdate<any>[`type`], (typeof ARRAY_UPDATES)[number]>\n\nexport const ARRAY_UPDATE_ENUM: Enumeration<typeof ARRAY_UPDATES> =\n\tenumeration(ARRAY_UPDATES)\n\nexport type ArrayMutationHandler = {\n\t[K in Exclude<OListUpdateType, `extend` | `set` | `truncate`>]: Fn\n}\n\nexport type OListView<P extends primitive> = ReadonlyArray<P> & {\n\tsubscribe: (\n\t\tkey: string,\n\t\tfn: (update: PackedArrayUpdate<P>) => void,\n\t) => () => void\n}\n\nexport class OList<P extends primitive>\n\textends Array<P>\n\timplements\n\t\tTransceiver<OListView<P>, PackedArrayUpdate<P>, ReadonlyArray<P>>,\n\t\tArrayMutationHandler\n{\n\tpublic mode: TransceiverMode = `record`\n\tpublic readonly subject: Subject<PackedArrayUpdate<P>> = new Subject()\n\n\tpublic readonly READONLY_VIEW: OListView<P> = this\n\n\tpublic constructor(arrayLength?: number)\n\tpublic constructor(...items: P[])\n\tpublic constructor(...items: P[]) {\n\t\tsuper(...items)\n\t\t// biome-ignore lint/correctness/noConstructorReturn: this is chill\n\t\treturn new Proxy(this, {\n\t\t\tset: (target, prop, value, receiver) => {\n\t\t\t\tif (\n\t\t\t\t\ttypeof prop === `string` &&\n\t\t\t\t\t!Number.isNaN(Number.parseInt(prop, 10))\n\t\t\t\t) {\n\t\t\t\t\tconst index = Number(prop)\n\t\t\t\t\tlet prev: P | undefined\n\t\t\t\t\tif (this.mode === `record`) {\n\t\t\t\t\t\tprev = target[index]\n\t\t\t\t\t}\n\t\t\t\t\ttarget[index] = value\n\t\t\t\t\tif (prev) {\n\t\t\t\t\t\tthis.emit({ type: `set`, index, next: value, prev })\n\t\t\t\t\t} else if (this.mode === `record`) {\n\t\t\t\t\t\tthis.emit({ type: `set`, index, next: value })\n\t\t\t\t\t}\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tif (prop === `length`) {\n\t\t\t\t\tif (this.mode === `record`) {\n\t\t\t\t\t\tconst prevLength = target.length\n\t\t\t\t\t\tif (prevLength === value) return true\n\t\t\t\t\t\tif (prevLength > value) {\n\t\t\t\t\t\t\tconst dropped = target.slice(value)\n\t\t\t\t\t\t\ttarget.length = value\n\t\t\t\t\t\t\tthis.emit({ type: `truncate`, length: value, items: dropped })\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttarget.length = value\n\t\t\t\t\t\t\tthis.emit({ type: `extend`, next: value, prev: prevLength })\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.length = value\n\t\t\t\t\t}\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\treturn Reflect.set(target, prop, value, receiver)\n\t\t\t},\n\t\t})\n\t}\n\n\tpublic toJSON(): ReadonlyArray<P> {\n\t\treturn [...this]\n\t}\n\n\tpublic static fromJSON<P extends primitive>(json: ReadonlyArray<P>): OList<P> {\n\t\treturn new OList<P>(...json)\n\t}\n\n\tpublic push(...items: P[]): number {\n\t\tlet result: number\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tresult = super.push(...items)\n\t\t\tthis.mode = `record`\n\t\t\tthis.emit({ type: `push`, items })\n\t\t} else {\n\t\t\tresult = super.push(...items)\n\t\t}\n\t\treturn result\n\t}\n\tpublic pop(): P | undefined {\n\t\tlet value: P | undefined\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tvalue = super.pop()\n\t\t\tif (value === undefined) {\n\t\t\t\tthis.emit({ type: `pop` })\n\t\t\t} else {\n\t\t\t\tthis.emit({ type: `pop`, value })\n\t\t\t}\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tvalue = super.pop()\n\t\t}\n\t\treturn value\n\t}\n\tpublic shift(): P | undefined {\n\t\tlet value: P | undefined\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tvalue = super.shift()\n\t\t\tif (value === undefined) {\n\t\t\t\tthis.emit({ type: `shift` })\n\t\t\t} else {\n\t\t\t\tthis.emit({ type: `shift`, value })\n\t\t\t}\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tvalue = super.shift()\n\t\t}\n\t\treturn value\n\t}\n\tpublic unshift(...items: P[]): number {\n\t\tlet result: number\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tresult = super.unshift(...items)\n\t\t\tthis.emit({ type: `unshift`, items })\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tresult = super.unshift(...items)\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic reverse(): this {\n\t\tsuper.reverse()\n\t\tif (this.mode === `record`) {\n\t\t\tthis.emit({ type: `reverse` })\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic fill(value: P, start?: number, end?: number): this {\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tconst prev = this.slice(start, end)\n\t\t\tsuper.fill(value, start, end)\n\t\t\tif (start === undefined) {\n\t\t\t\tthis.emit({ type: `fill`, value, prev })\n\t\t\t} else {\n\t\t\t\tif (end === undefined) {\n\t\t\t\t\tthis.emit({ type: `fill`, value, start, prev })\n\t\t\t\t} else {\n\t\t\t\t\tthis.emit({ type: `fill`, value, start, end, prev })\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.mode = `record`\n\t\t} else {\n\t\t\tsuper.fill(value, start, end)\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic sort(compareFn?: (a: P, b: P) => number): this {\n\t\tif (this.mode === `record`) {\n\t\t\tthis.mode = `playback`\n\t\t\tconst prev = [...this]\n\t\t\tsuper.sort(compareFn)\n\t\t\tconst next = [...this]\n\t\t\tthis.emit({ type: `sort`, next, prev })\n\t\t\tthis.mode = `record`\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic splice(start: number, deleteCount?: number): P[]\n\tpublic splice(start: number, deleteCount: number, ...items: P[]): P[]\n\tpublic splice(\n\t\t...params: [start: number, deleteCount?: number, ...items: P[]]\n\t): P[] {\n\t\tconst [start, deleteCount, ...items] = params\n\t\tconst originalMode = this.mode\n\t\tif (originalMode === `record`) this.mode = `playback`\n\t\tconst deleted = super.splice(...(params as [number, number, ...P[]]))\n\t\tif (originalMode === `record`) this.mode = `record`\n\t\tif (deleteCount === undefined) {\n\t\t\tthis.emit({\n\t\t\t\ttype: `splice`,\n\t\t\t\tstart,\n\t\t\t\titems,\n\t\t\t\tdeleted,\n\t\t\t\tdeleteCount: deleted.length,\n\t\t\t})\n\t\t} else {\n\t\t\tthis.emit({ type: `splice`, start, items, deleted, deleteCount })\n\t\t}\n\n\t\treturn deleted\n\t}\n\n\tpublic copyWithin(target: number, start: number, end?: number): this {\n\t\tconst originalMode = this.mode\n\t\tlet prev: P[] | undefined\n\t\tif (originalMode === `record`) {\n\t\t\tprev = this.slice(target)\n\t\t\tthis.mode = `playback`\n\t\t}\n\t\tsuper.copyWithin(target, start, end)\n\t\tif (originalMode === `record`) this.mode = `record`\n\t\tif (prev) {\n\t\t\tif (end === undefined) {\n\t\t\t\tthis.emit({ type: `copyWithin`, prev, target, start })\n\t\t\t} else {\n\t\t\t\tthis.emit({ type: `copyWithin`, prev, target, start, end })\n\t\t\t}\n\t\t}\n\t\treturn this\n\t}\n\n\tpublic subscribe(\n\t\tkey: string,\n\t\tfn: (update: PackedArrayUpdate<P>) => void,\n\t): () => void {\n\t\treturn this.subject.subscribe(key, fn)\n\t}\n\n\tpublic emit(update: ArrayUpdate<P>): void {\n\t\tthis.subject.next(OList.packUpdate(update))\n\t}\n\n\tprivate doStep(update: ArrayUpdate<P>): void {\n\t\tconst type = update.type\n\t\tswitch (type) {\n\t\t\tcase `copyWithin`:\n\t\t\t\tthis.copyWithin(update.target, update.start, update.end)\n\t\t\t\tbreak\n\t\t\tcase `extend`:\n\t\t\t\tthis.length = update.next\n\t\t\t\tbreak\n\t\t\tcase `fill`:\n\t\t\t\tthis.fill(update.value, update.start, update.end)\n\t\t\t\tbreak\n\t\t\tcase `pop`:\n\t\t\t\tthis.pop()\n\t\t\t\tbreak\n\t\t\tcase `push`:\n\t\t\t\tthis.push(...update.items)\n\t\t\t\tbreak\n\t\t\tcase `reverse`:\n\t\t\t\tthis.reverse()\n\t\t\t\tbreak\n\t\t\tcase `shift`:\n\t\t\t\tthis.shift()\n\t\t\t\tbreak\n\t\t\tcase `sort`:\n\t\t\t\tfor (let i = 0; i < update.next.length; i++) {\n\t\t\t\t\tthis[i] = update.next[i]\n\t\t\t\t}\n\t\t\t\tthis.length = update.next.length\n\t\t\t\tbreak\n\t\t\tcase `splice`:\n\t\t\t\tthis.splice(update.start, update.deleteCount, ...update.items)\n\t\t\t\tbreak\n\t\t\tcase `truncate`:\n\t\t\t\tthis.length = update.length\n\t\t\t\tbreak\n\t\t\tcase `set`:\n\t\t\t\tthis[update.index] = update.next\n\t\t\t\tbreak\n\t\t\tcase `unshift`:\n\t\t\t\tthis.unshift(...update.items)\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tpublic do(update: PackedArrayUpdate<P>): null {\n\t\tthis.mode = `playback`\n\t\tconst unpacked = OList.unpackUpdate(update)\n\t\tthis.doStep(unpacked)\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic undoStep(update: ArrayUpdate<P>): void {\n\t\tswitch (update.type) {\n\t\t\tcase `copyWithin`:\n\t\t\t\tfor (let i = 0; i < update.prev.length; i++) {\n\t\t\t\t\tthis[i + update.target] = update.prev[i]\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `extend`:\n\t\t\t\tthis.length = update.prev\n\t\t\t\tbreak\n\t\t\tcase `fill`:\n\t\t\t\t{\n\t\t\t\t\tconst start = update.start ?? 0\n\t\t\t\t\tfor (let i = 0; i < update.prev.length; i++) {\n\t\t\t\t\t\tthis[i + start] = update.prev[i]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `pop`:\n\t\t\t\tif (update.value) this.push(update.value)\n\t\t\t\tbreak\n\t\t\tcase `push`:\n\t\t\t\t{\n\t\t\t\t\tlet i = update.items.length - 1\n\t\t\t\t\twhile (i >= 0) {\n\t\t\t\t\t\tthis.pop()\n\t\t\t\t\t\t--i\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `reverse`:\n\t\t\t\tthis.reverse()\n\t\t\t\tbreak\n\t\t\tcase `shift`:\n\t\t\t\tif (update.value) this.unshift(update.value)\n\t\t\t\tbreak\n\t\t\tcase `sort`:\n\t\t\t\tfor (let i = 0; i < update.prev.length; i++) {\n\t\t\t\t\tthis[i] = update.prev[i]\n\t\t\t\t}\n\t\t\t\tthis.length = update.prev.length\n\t\t\t\tbreak\n\t\t\tcase `set`:\n\t\t\t\tif (update.prev) {\n\t\t\t\t\tthis[update.index] = update.prev\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\t\tdelete this[update.index]\n\t\t\t\t\tconst firstEmptyIndex = this.findIndex(\n\t\t\t\t\t\t(_, i) => !Object.hasOwn(this, i),\n\t\t\t\t\t)\n\t\t\t\t\tif (firstEmptyIndex !== -1) {\n\t\t\t\t\t\tthis.length = firstEmptyIndex\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase `splice`:\n\t\t\t\tthis.splice(update.start, update.items.length, ...update.deleted)\n\t\t\t\tbreak\n\t\t\tcase `truncate`:\n\t\t\t\tthis.push(...update.items)\n\t\t\t\tbreak\n\t\t\tcase `unshift`:\n\t\t\t\t{\n\t\t\t\t\tlet i = update.items.length - 1\n\t\t\t\t\twhile (i >= 0) {\n\t\t\t\t\t\tthis.shift()\n\t\t\t\t\t\t--i\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tpublic undo(update: PackedArrayUpdate<P>): number | null {\n\t\tthis.mode = `playback`\n\t\tconst unpacked = OList.unpackUpdate(update)\n\t\tthis.undoStep(unpacked)\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic static packUpdate<P extends primitive>(\n\t\tupdate: ArrayUpdate<P>,\n\t): PackedArrayUpdate<P> {\n\t\tlet packed = ARRAY_UPDATE_ENUM[update.type] + `\\u001F`\n\t\tswitch (update.type) {\n\t\t\tcase `set`:\n\t\t\t\tpacked += update.index + `\\u001E` + packCanonical(update.next)\n\t\t\t\tif (update.prev !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + packCanonical(update.prev)\n\t\t\t\t}\n\t\t\t\treturn packed\n\t\t\tcase `truncate`:\n\t\t\t\treturn (\n\t\t\t\t\tpacked +\n\t\t\t\t\tupdate.length +\n\t\t\t\t\t`\\u001E` +\n\t\t\t\t\tupdate.items.map(packCanonical).join(`\\u001E`)\n\t\t\t\t)\n\t\t\tcase `extend`:\n\t\t\t\treturn packed + update.next + `\\u001E` + update.prev\n\t\t\tcase `pop`:\n\t\t\tcase `shift`:\n\t\t\t\tif (update.value !== undefined) {\n\t\t\t\t\tpacked += packCanonical(update.value)\n\t\t\t\t}\n\t\t\t\treturn packed\n\t\t\tcase `push`:\n\t\t\tcase `unshift`:\n\t\t\t\treturn packed + update.items.map(packCanonical).join(`\\u001E`)\n\t\t\tcase `copyWithin`:\n\t\t\t\tpacked += update.target + `\\u001E` + update.start\n\t\t\t\tif (update.end !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + update.end\n\t\t\t\t}\n\t\t\t\tpacked += `\\u001E\\u001E` + update.prev.map(packCanonical).join(`\\u001E`)\n\t\t\t\treturn packed\n\t\t\tcase `fill`:\n\t\t\t\tpacked += packCanonical(update.value)\n\t\t\t\tif (update.start !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + update.start\n\t\t\t\t}\n\t\t\t\tif (update.end !== undefined) {\n\t\t\t\t\tpacked += `\\u001E` + update.end\n\t\t\t\t}\n\t\t\t\tpacked += `\\u001E\\u001E` + update.prev.map(packCanonical).join(`\\u001E`)\n\t\t\t\treturn packed\n\t\t\tcase `splice`:\n\t\t\t\treturn (\n\t\t\t\t\tpacked +\n\t\t\t\t\tupdate.start +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.deleteCount +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.items.map(packCanonical).join(`\\u001E`) +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.deleted.map(packCanonical).join(`\\u001E`)\n\t\t\t\t)\n\t\t\tcase `reverse`:\n\t\t\t\treturn packed\n\t\t\tcase `sort`:\n\t\t\t\treturn (\n\t\t\t\t\tpacked +\n\t\t\t\t\tupdate.next.map(packCanonical).join(`\\u001E`) +\n\t\t\t\t\t`\\u001E\\u001E` +\n\t\t\t\t\tupdate.prev.map(packCanonical).join(`\\u001E`)\n\t\t\t\t)\n\t\t}\n\t}\n\n\tpublic static unpackUpdate<P extends primitive>(\n\t\tpacked: PackedArrayUpdate<P>,\n\t): ArrayUpdate<P> {\n\t\tconst [head, tail] = packed.split(`\\u001F`) as [\n\t\t\tExtract<keyof typeof ARRAY_UPDATE_ENUM, number>,\n\t\t\tpacked<P>,\n\t\t]\n\t\tconst type = ARRAY_UPDATE_ENUM[head]\n\t\tswitch (type) {\n\t\t\tcase `set`: {\n\t\t\t\tconst [i, n, p] = tail.split(`\\u001E`)\n\t\t\t\tconst index = +i\n\t\t\t\tconst next = unpackCanonical<P>(n)\n\t\t\t\tif (p === undefined) {\n\t\t\t\t\treturn { type, index, next }\n\t\t\t\t}\n\t\t\t\tconst prev = unpackCanonical<P>(p)\n\t\t\t\treturn { type, index, next, prev }\n\t\t\t}\n\t\t\tcase `truncate`: {\n\t\t\t\tconst [l, ...i] = tail.split(`\\u001E`)\n\t\t\t\tconst length = +l\n\t\t\t\tconst items = i.map<P>(unpackCanonical)\n\t\t\t\treturn { type, length, items }\n\t\t\t}\n\t\t\tcase `extend`: {\n\t\t\t\tconst [n, p] = tail.split(`\\u001E`)\n\t\t\t\tconst next = +n\n\t\t\t\tconst prev = +p\n\t\t\t\treturn { type, next, prev }\n\t\t\t}\n\t\t\tcase `pop`:\n\t\t\tcase `shift`:\n\t\t\t\tif (tail !== ``) {\n\t\t\t\t\tconst value = unpackCanonical(tail)\n\t\t\t\t\treturn { type, value }\n\t\t\t\t}\n\t\t\t\treturn { type }\n\t\t\tcase `push`:\n\t\t\tcase `unshift`: {\n\t\t\t\tconst items = tail.split(`\\u001E`).map<P>(unpackCanonical)\n\t\t\t\treturn { type, items }\n\t\t\t}\n\t\t\tcase `copyWithin`: {\n\t\t\t\tconst [numbers, data] = tail.split(`\\u001E\\u001E`)\n\t\t\t\tconst prev = data ? data.split(`\\u001E`).map<P>(unpackCanonical) : []\n\t\t\t\tconst [t, s, e] = numbers.split(`\\u001E`)\n\t\t\t\tconst target = +t\n\t\t\t\tconst start = +s\n\t\t\t\tif (e === undefined) {\n\t\t\t\t\treturn { type, target, start, prev }\n\t\t\t\t}\n\t\t\t\tconst end = +e\n\t\t\t\treturn { type, target, start, prev, end }\n\t\t\t}\n\t\t\tcase `fill`: {\n\t\t\t\tconst [numbers, data] = tail.split(`\\u001E\\u001E`)\n\t\t\t\tconst prev = data ? data.split(`\\u001E`).map<P>(unpackCanonical) : []\n\t\t\t\tconst [v, s, e] = numbers.split(`\\u001E`)\n\t\t\t\tconst value = unpackCanonical<P>(v)\n\t\t\t\tif (s === undefined && e === undefined) {\n\t\t\t\t\treturn { type, value, prev }\n\t\t\t\t}\n\t\t\t\tconst start = +s\n\t\t\t\tif (e === undefined) {\n\t\t\t\t\treturn { type, value, prev, start }\n\t\t\t\t}\n\t\t\t\tconst end = +e\n\t\t\t\treturn { type, value, prev, start, end }\n\t\t\t}\n\t\t\tcase `splice`: {\n\t\t\t\tconst [s, c, i, d] = tail.split(`\\u001E\\u001E`)\n\n\t\t\t\tconst start = +s\n\t\t\t\tconst deleteCount = +c\n\t\t\t\tconst items = i ? i.split(`\\u001E`).map<P>(unpackCanonical) : []\n\t\t\t\tconst deleted = d ? d.split(`\\u001E`).map<P>(unpackCanonical) : []\n\t\t\t\treturn { type, start, deleteCount, items, deleted }\n\t\t\t}\n\t\t\tcase `reverse`:\n\t\t\t\treturn { type }\n\t\t\tcase `sort`: {\n\t\t\t\tconst [n, p] = tail.split(`\\u001E\\u001E`)\n\t\t\t\tconst next = n ? n.split(`\\u001E`).map<P>(unpackCanonical) : []\n\t\t\t\tconst prev = p ? p.split(`\\u001E`).map<P>(unpackCanonical) : []\n\t\t\t\treturn { type, next, prev }\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { AtomEffect } from \"atom.io\"\nimport { getFromStore, getUpdateToken, subscribeInStore } from \"atom.io/internal\"\nimport { type primitive, stringifyJson } from \"atom.io/json\"\n\nimport { OList } from \"./o-list\"\n\nexport function filterOutInPlace<T>(arr: T[], toRemove: T): T[] {\n\tlet writeIndex = 0\n\n\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\tfor (let readIndex = 0; readIndex < arr.length; readIndex++) {\n\t\tif (toRemove !== arr[readIndex]) {\n\t\t\tarr[writeIndex] = arr[readIndex]\n\t\t\twriteIndex++\n\t\t}\n\t}\n\n\tarr.length = writeIndex\n\treturn arr\n}\n\nexport const oListDisposedKeyCleanupEffect: AtomEffect<OList<primitive>> = ({\n\ttoken,\n\tsetSelf,\n\tstore,\n}) => {\n\tconst disposalSubscriptions = new Map<primitive, () => void>()\n\tconst updateToken = getUpdateToken(token)\n\n\tconst addedValues = new Set<primitive>()\n\tconst removedValues = new Set<primitive>()\n\tfunction updateSubscriptions() {\n\t\tfor (const addedValue of addedValues) {\n\t\t\tconst molecule = store.molecules.get(stringifyJson(addedValue))\n\t\t\tif (molecule) {\n\t\t\t\tdisposalSubscriptions.set(\n\t\t\t\t\taddedValue,\n\t\t\t\t\tmolecule.subject.subscribe(token.key, () => {\n\t\t\t\t\t\tdisposalSubscriptions.get(addedValue)?.()\n\t\t\t\t\t\tdisposalSubscriptions.delete(addedValue)\n\t\t\t\t\t\tsetSelf((self) => {\n\t\t\t\t\t\t\tfilterOutInPlace(self, addedValue)\n\t\t\t\t\t\t\treturn self\n\t\t\t\t\t\t})\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tstore.logger.warn(\n\t\t\t\t\t`❌`,\n\t\t\t\t\ttoken.type,\n\t\t\t\t\ttoken.key,\n\t\t\t\t\t`Added \"${addedValue}\" to ${token.key} but it has not been allocated.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tfor (const removedValue of removedValues) {\n\t\t\tif (disposalSubscriptions.has(removedValue)) {\n\t\t\t\tdisposalSubscriptions.get(removedValue)?.()\n\t\t\t\tdisposalSubscriptions.delete(removedValue)\n\t\t\t}\n\t\t}\n\t}\n\tsubscribeInStore(\n\t\tstore,\n\t\tupdateToken,\n\t\tfunction manageAutoDeletionTriggers({ newValue }) {\n\t\t\tconst currentList = getFromStore(store, token)\n\t\t\tconst unpacked = OList.unpackUpdate(newValue)\n\t\t\tswitch (unpacked.type) {\n\t\t\t\tcase `extend`:\n\t\t\t\tcase `reverse`:\n\t\t\t\tcase `sort`:\n\t\t\t\t\tbreak // these don't change what values are present in the list\n\n\t\t\t\tcase `set`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst { next } = unpacked\n\t\t\t\t\t\tif (`prev` in unpacked && !currentList.includes(unpacked.prev)) {\n\t\t\t\t\t\t\tremovedValues.add(unpacked.prev)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!disposalSubscriptions.has(next)) {\n\t\t\t\t\t\t\taddedValues.add(next)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `truncate`:\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (const item of unpacked.items) {\n\t\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `shift`:\n\t\t\t\tcase `pop`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst { value } = unpacked\n\t\t\t\t\t\tif (value !== undefined && !currentList.includes(value)) {\n\t\t\t\t\t\t\tremovedValues.add(value)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `push`:\n\t\t\t\tcase `unshift`:\n\t\t\t\t\tfor (const item of unpacked.items) {\n\t\t\t\t\t\tif (!disposalSubscriptions.has(item)) {\n\t\t\t\t\t\t\taddedValues.add(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `copyWithin`:\n\t\t\t\t\tfor (const item of unpacked.prev) {\n\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `fill`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst { value } = unpacked\n\t\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\t\tif (!disposalSubscriptions.has(value)) {\n\t\t\t\t\t\t\t\taddedValues.add(value)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const item of unpacked.prev) {\n\t\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `splice`:\n\t\t\t\t\tfor (const item of unpacked.deleted) {\n\t\t\t\t\t\tif (!currentList.includes(item)) {\n\t\t\t\t\t\t\tremovedValues.add(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const addedItem of unpacked.items) {\n\t\t\t\t\t\tif (!disposalSubscriptions.has(addedItem)) {\n\t\t\t\t\t\t\taddedValues.add(addedItem)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t\tupdateSubscriptions()\n\t\t\taddedValues.clear()\n\t\t\tremovedValues.clear()\n\t\t},\n\t\t`set-auto-deletion-triggers`,\n\t)\n}\n"],"mappings":";;;;AAsEA,MAAM,gBAAgB;CAErB;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAKD,MAAaA,oBACZ,YAAY,cAAc;AAa3B,IAAa,QAAb,MAAa,cACJ,MAIT;CACC,AAAO,OAAwB;CAC/B,AAAgB,UAAyC,IAAI,SAAS;CAEtE,AAAgB,gBAA8B;CAI9C,AAAO,YAAY,GAAG,OAAY;AACjC,QAAM,GAAG,MAAM;AAEf,SAAO,IAAI,MAAM,MAAM,EACtB,MAAM,QAAQ,MAAM,OAAO,aAAa;AACvC,OACC,OAAO,SAAS,YAChB,CAAC,OAAO,MAAM,OAAO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SAAK,MAAM,QAAQ,SAAS,KAC3B,KAAI,CAAC,YAAY,SAAS,KAAK,CAC9B,eAAc,IAAI,KAAK;AAGzB;GACD,KAAK;IACJ;KACC,MAAM,EAAE,UAAU;AAClB,SAAI,UAAU,QACb;UAAI,CAAC,sBAAsB,IAAI,MAAM,CACpC,aAAY,IAAI,MAAM;;AAGxB,UAAK,MAAM,QAAQ,SAAS,KAC3B,KAAI,CAAC,YAAY,SAAS,KAAK,CAC9B,eAAc,IAAI,KAAK;;AAI1B;GACD,KAAK;AACJ,SAAK,MAAM,QAAQ,SAAS,QAC3B,KAAI,CAAC,YAAY,SAAS,KAAK,CAC9B,eAAc,IAAI,KAAK;AAGzB,SAAK,MAAM,aAAa,SAAS,MAChC,KAAI,CAAC,sBAAsB,IAAI,UAAU,CACxC,aAAY,IAAI,UAAU;AAG5B;;AAEF,uBAAqB;AACrB,cAAY,OAAO;AACnB,gBAAc,OAAO;IAEtB,6BACA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Fn, Subject, Transceiver, TransceiverMode } from "atom.io/internal";
|
|
2
2
|
import { AtomEffect } from "atom.io";
|
|
3
|
-
import { primitive } from "atom.io/json";
|
|
4
|
-
import { Enumeration } from "atom.io/struct";
|
|
3
|
+
import { Enumeration, primitive } from "atom.io/json";
|
|
5
4
|
|
|
6
5
|
//#region src/transceivers/u-list/u-list.d.ts
|
|
7
6
|
type SetMutations = Exclude<keyof Set<any>, symbol | keyof ReadonlySet<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["SET_UPDATE_ENUM: Enumeration<[`add`, `delete`, `clear`]>","uListDisposedKeyCleanupEffect: AtomEffect<UList<primitive>>"],"sources":["../../../src/transceivers/u-list/u-list.ts","../../../src/transceivers/u-list/u-list-disposed-key-cleanup-effect.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["SET_UPDATE_ENUM: Enumeration<[`add`, `delete`, `clear`]>","uListDisposedKeyCleanupEffect: AtomEffect<UList<primitive>>"],"sources":["../../../src/transceivers/u-list/u-list.ts","../../../src/transceivers/u-list/u-list-disposed-key-cleanup-effect.ts"],"sourcesContent":[],"mappings":";;;;;KAKY,YAAA,GAAe,cACpB,yBACS;KAEJ,oBAAoB;EAJhC,IAAY,EAAA,KAAA,GAAA,QAAA;EACL,KAAA,EAMG,CANH;CACS,GAAA;EAFW,IAAA,EAAA,OAAA;EAAA,MAAA,EAWhB,CAXgB,EAAA;AAI3B,CAAA;AAAgC,KASpB,eAAA,GAAkB,SATE,CAAA,GAAA,CAAA,CAAA,MAAA,CAAA;AAGtB,KAWE,eAXF,CAAA,UAW4B,SAX5B,CAAA,GAAA,MAAA,GAAA;EAIC,MAAA,CAAA,EAQD,SARC,CAQS,CART,CAAA;CAAA;AAEC,cASCA,eATiB,EASA,WATA,CAAA,CAAA,KAAA,EAAA,QAAA,EAAA,OAAA,CAAA,CAAA;AAKlB,KAOA,kBAAA,GAPA,QAO6B,eAP7B,GAO+C,EAP/C,EAAA;AAA0B,KAS1B,SAT0B,CAAA,UASN,SATM,CAAA,GASO,WATP,CASmB,CATnB,CAAA,GAAA;EAClB,SAAA,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,EAAA,EAAA,CAAA,MAAA,EAWL,eAXK,CAWW,CAXX,CAAA,EAAA,GAAA,IAAA,EAAA,GAAA,GAAA,GAAA,IAAA;CAAV;AAAA,cAeG,KAfH,CAAA,UAemB,SAfnB,CAAA,SAgBD,GAhBC,CAgBG,CAhBH,CAAA,YAkBR,WAlBQ,CAkBI,SAlBJ,CAkBc,CAlBd,CAAA,EAkBkB,eAlBlB,CAkBkC,CAlBlC,CAAA,EAkBsC,aAlBtC,CAkBoD,CAlBpD,CAAA,CAAA,EAmBR,kBAnBQ,CAAA;EAGV,IAAaA,EAkBC,eAlB8C;EAG5D,SAAY,OAAA,EAgBc,OAhBd,CAgBsB,eAhBO,CAgBS,CAhBT,CAAA,C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|
1
1
|
import { Subject, getUpdateToken, subscribeInStore } from "atom.io/internal";
|
|
2
|
-
import { stringifyJson } from "atom.io/json";
|
|
3
|
-
import { enumeration, packValue, unpackValue } from "atom.io/struct";
|
|
2
|
+
import { enumeration, packCanonical, stringifyJson, unpackCanonical } from "atom.io/json";
|
|
4
3
|
|
|
5
4
|
//#region src/transceivers/u-list/u-list.ts
|
|
6
5
|
const SET_UPDATE_ENUM = enumeration([
|
|
@@ -87,19 +86,19 @@ var UList = class UList extends Set {
|
|
|
87
86
|
}
|
|
88
87
|
static packUpdate(update) {
|
|
89
88
|
const head = SET_UPDATE_ENUM[update.type] + `\u001F`;
|
|
90
|
-
if (update.type === `clear`) return head + update.values.map(
|
|
91
|
-
return head +
|
|
89
|
+
if (update.type === `clear`) return head + update.values.map(packCanonical).join(`\u001E`);
|
|
90
|
+
return head + packCanonical(update.value);
|
|
92
91
|
}
|
|
93
92
|
static unpackUpdate(packed) {
|
|
94
93
|
const [type, tail] = packed.split(`\u001F`);
|
|
95
94
|
const head = SET_UPDATE_ENUM[type];
|
|
96
95
|
if (head === `clear`) return {
|
|
97
96
|
type: `clear`,
|
|
98
|
-
values: tail.split(`\u001E`).map(
|
|
97
|
+
values: tail.split(`\u001E`).map(unpackCanonical)
|
|
99
98
|
};
|
|
100
99
|
return {
|
|
101
100
|
type: head,
|
|
102
|
-
value:
|
|
101
|
+
value: unpackCanonical(tail)
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SET_UPDATE_ENUM: Enumeration<[`add`, `delete`, `clear`]>","uListDisposedKeyCleanupEffect: AtomEffect<UList<primitive>>"],"sources":["../../../src/transceivers/u-list/u-list.ts","../../../src/transceivers/u-list/u-list-disposed-key-cleanup-effect.ts"],"sourcesContent":["import type { Fn, Transceiver, TransceiverMode } from \"atom.io/internal\"\nimport { Subject } from \"atom.io/internal\"\nimport type { primitive } from \"atom.io/json\"\nimport
|
|
1
|
+
{"version":3,"file":"index.js","names":["SET_UPDATE_ENUM: Enumeration<[`add`, `delete`, `clear`]>","uListDisposedKeyCleanupEffect: AtomEffect<UList<primitive>>"],"sources":["../../../src/transceivers/u-list/u-list.ts","../../../src/transceivers/u-list/u-list-disposed-key-cleanup-effect.ts"],"sourcesContent":["import type { Fn, Transceiver, TransceiverMode } from \"atom.io/internal\"\nimport { Subject } from \"atom.io/internal\"\nimport type { Enumeration, packed, primitive } from \"atom.io/json\"\nimport { enumeration, packCanonical, unpackCanonical } from \"atom.io/json\"\n\nexport type SetMutations = Exclude<\n\tkeyof Set<any>,\n\tsymbol | keyof ReadonlySet<any>\n>\nexport type SetUpdate<P extends primitive> =\n\t| {\n\t\t\ttype: `add` | `delete`\n\t\t\tvalue: P\n\t }\n\t| {\n\t\t\ttype: `clear`\n\t\t\tvalues: P[]\n\t }\nexport type UListUpdateType = SetUpdate<any>[`type`]\ntrue satisfies SetMutations extends UListUpdateType\n\t? true\n\t: Exclude<SetMutations, UListUpdateType>\n\nexport type PackedSetUpdate<P extends primitive> = string & {\n\tupdate?: SetUpdate<P>\n}\n\nexport const SET_UPDATE_ENUM: Enumeration<[`add`, `delete`, `clear`]> =\n\tenumeration([`add`, `delete`, `clear`] as const)\n\nexport type SetMutationHandler = { [K in UListUpdateType]: Fn }\n\nexport type UListView<P extends primitive> = ReadonlySet<P> & {\n\tsubscribe: (\n\t\tkey: string,\n\t\tfn: (update: PackedSetUpdate<P>) => void,\n\t) => () => void\n}\n\nexport class UList<P extends primitive>\n\textends Set<P>\n\timplements\n\t\tTransceiver<UListView<P>, PackedSetUpdate<P>, ReadonlyArray<P>>,\n\t\tSetMutationHandler\n{\n\tpublic mode: TransceiverMode = `record`\n\tpublic readonly subject: Subject<PackedSetUpdate<P>> = new Subject()\n\n\tpublic constructor(values?: Iterable<P>) {\n\t\tsuper(values)\n\t\tif (values instanceof UList) {\n\t\t}\n\t}\n\n\tpublic readonly READONLY_VIEW: UListView<P> = this\n\n\tpublic toJSON(): ReadonlyArray<P> {\n\t\treturn [...this]\n\t}\n\n\tpublic static fromJSON<P extends primitive>(json: ReadonlyArray<P>): UList<P> {\n\t\treturn new UList<P>(json)\n\t}\n\n\tpublic add(value: P): this {\n\t\tconst result = super.add(value)\n\t\tif (this.mode === `record`) {\n\t\t\tthis.emit({ type: `add`, value })\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic clear(): void {\n\t\tconst capturedContents = this.mode === `record` ? [...this] : null\n\t\tsuper.clear()\n\t\tif (capturedContents) {\n\t\t\tthis.emit({ type: `clear`, values: capturedContents })\n\t\t}\n\t}\n\n\tpublic delete(value: P): boolean {\n\t\tconst result = super.delete(value)\n\t\tif (this.mode === `record`) {\n\t\t\tthis.emit({ type: `delete`, value })\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic subscribe(\n\t\tkey: string,\n\t\tfn: (update: PackedSetUpdate<P>) => void,\n\t): () => void {\n\t\treturn this.subject.subscribe(key, fn)\n\t}\n\n\tpublic emit(update: SetUpdate<P>): void {\n\t\tthis.subject.next(UList.packUpdate(update))\n\t}\n\n\tpublic do(packed: PackedSetUpdate<P>): null {\n\t\tthis.mode = `playback`\n\t\tconst update = UList.unpackUpdate(packed)\n\t\tswitch (update.type) {\n\t\t\tcase `add`:\n\t\t\t\tthis.add(update.value)\n\t\t\t\tbreak\n\t\t\tcase `delete`:\n\t\t\t\tthis.delete(update.value)\n\t\t\t\tbreak\n\t\t\tcase `clear`:\n\t\t\t\tthis.clear()\n\t\t}\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic undo(packed: PackedSetUpdate<P>): number | null {\n\t\tconst update = UList.unpackUpdate(packed)\n\t\tthis.mode = `playback`\n\t\tswitch (update.type) {\n\t\t\tcase `add`:\n\t\t\t\tthis.delete(update.value)\n\t\t\t\tbreak\n\t\t\tcase `delete`:\n\t\t\t\tthis.add(update.value)\n\t\t\t\tbreak\n\t\t\tcase `clear`: {\n\t\t\t\tconst values = update.values\n\t\t\t\tfor (const v of values) this.add(v)\n\t\t\t}\n\t\t}\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic static packUpdate<P extends primitive>(\n\t\tupdate: SetUpdate<P>,\n\t): PackedSetUpdate<P> {\n\t\tconst head = SET_UPDATE_ENUM[update.type] + `\\u001F`\n\t\tif (update.type === `clear`) {\n\t\t\treturn head + update.values.map(packCanonical).join(`\\u001E`)\n\t\t}\n\t\treturn head + packCanonical(update.value)\n\t}\n\tpublic static unpackUpdate<P extends primitive>(\n\t\tpacked: PackedSetUpdate<P>,\n\t): SetUpdate<P> {\n\t\tconst [type, tail] = packed.split(`\\u001F`) as [0 | 1 | 2, packed<P>]\n\t\tconst head = SET_UPDATE_ENUM[type]\n\t\tif (head === `clear`) {\n\t\t\tconst values = tail.split(`\\u001E`).map<P>(unpackCanonical)\n\t\t\treturn { type: `clear`, values }\n\t\t}\n\t\treturn { type: head, value: unpackCanonical(tail) }\n\t}\n}\n","import type { AtomEffect } from \"atom.io\"\nimport { getUpdateToken, subscribeInStore } from \"atom.io/internal\"\nimport { type primitive, stringifyJson } from \"atom.io/json\"\n\nimport { UList } from \"./u-list\"\n\nexport const uListDisposedKeyCleanupEffect: AtomEffect<UList<primitive>> = ({\n\ttoken,\n\tsetSelf,\n\tstore,\n}) => {\n\tconst disposalSubscriptions = new Map<primitive, () => void>()\n\tconst updateToken = getUpdateToken(token)\n\tsubscribeInStore(\n\t\tstore,\n\t\tupdateToken,\n\t\tfunction setAutoDeletionTriggers({ newValue }) {\n\t\t\tconst unpacked = UList.unpackUpdate(newValue)\n\t\t\tswitch (unpacked.type) {\n\t\t\t\tcase `add`:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst molecule = store.molecules.get(stringifyJson(unpacked.value))\n\t\t\t\t\t\tif (molecule) {\n\t\t\t\t\t\t\tdisposalSubscriptions.set(\n\t\t\t\t\t\t\t\tunpacked.value,\n\t\t\t\t\t\t\t\tmolecule.subject.subscribe(token.key, () => {\n\t\t\t\t\t\t\t\t\tsetSelf((self) => {\n\t\t\t\t\t\t\t\t\t\tself.delete(unpacked.value)\n\t\t\t\t\t\t\t\t\t\treturn self\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase `delete`:\n\t\t\t\t\tdisposalSubscriptions.get(unpacked.value)?.()\n\t\t\t\t\tdisposalSubscriptions.delete(unpacked.value)\n\t\t\t\t\tbreak\n\t\t\t\tcase `clear`:\n\t\t\t\t\tfor (const unsub of disposalSubscriptions.values()) unsub()\n\t\t\t\t\tdisposalSubscriptions.clear()\n\t\t\t}\n\t\t},\n\t\t`set-auto-deletion-triggers`,\n\t)\n}\n"],"mappings":";;;;AA2BA,MAAaA,kBACZ,YAAY;CAAC;CAAO;CAAU;CAAQ,CAAU;AAWjD,IAAa,QAAb,MAAa,cACJ,IAIT;CACC,AAAO,OAAwB;CAC/B,AAAgB,UAAuC,IAAI,SAAS;CAEpE,AAAO,YAAY,QAAsB;AACxC,QAAM,OAAO;AACb,MAAI,kBAAkB,OAAO;;CAI9B,AAAgB,gBAA8B;CAE9C,AAAO,SAA2B;AACjC,SAAO,CAAC,GAAG,KAAK;;CAGjB,OAAc,SAA8B,MAAkC;AAC7E,SAAO,IAAI,MAAS,KAAK;;CAG1B,AAAO,IAAI,OAAgB;EAC1B,MAAM,SAAS,MAAM,IAAI,MAAM;AAC/B,MAAI,KAAK,SAAS,SACjB,MAAK,KAAK;GAAE,MAAM;GAAO;GAAO,CAAC;AAElC,SAAO;;CAGR,AAAO,QAAc;EACpB,MAAM,mBAAmB,KAAK,SAAS,WAAW,CAAC,GAAG,KAAK,GAAG;AAC9D,QAAM,OAAO;AACb,MAAI,iBACH,MAAK,KAAK;GAAE,MAAM;GAAS,QAAQ;GAAkB,CAAC;;CAIxD,AAAO,OAAO,OAAmB;EAChC,MAAM,S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,SAAO;GAAE,MAAM;GAAM,OAAO,gBAAgB,KAAK;GAAE;;;;;;ACnJrD,MAAaC,iCAA+D,EAC3E,OACA,SACA,YACK;CACL,MAAM,wCAAwB,IAAI,KAA4B;AAE9D,kBACC,OAFmB,eAAe,MAAM,EAIxC,SAAS,wBAAwB,EAAE,YAAY;EAC9C,MAAM,WAAW,MAAM,aAAa,SAAS;AAC7C,UAAQ,SAAS,MAAjB;GACC,KAAK;IACJ;KACC,MAAM,WAAW,MAAM,UAAU,IAAI,cAAc,SAAS,MAAM,CAAC;AACnE,SAAI,SACH,uBAAsB,IACrB,SAAS,OACT,SAAS,QAAQ,UAAU,MAAM,WAAW;AAC3C,eAAS,SAAS;AACjB,YAAK,OAAO,SAAS,MAAM;AAC3B,cAAO;QACN;OACD,CACF;;AAGH;GACD,KAAK;AACJ,0BAAsB,IAAI,SAAS,MAAM,IAAI;AAC7C,0BAAsB,OAAO,SAAS,MAAM;AAC5C;GACD,KAAK;AACJ,SAAK,MAAM,SAAS,sBAAsB,QAAQ,CAAE,QAAO;AAC3D,0BAAsB,OAAO;;IAGhC,6BACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@typescript-eslint/parser": "8.47.0",
|
|
73
73
|
"@typescript-eslint/rule-tester": "8.47.0",
|
|
74
74
|
"@typescript-eslint/utils": "8.47.0",
|
|
75
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
75
|
+
"@typescript/native-preview": "7.0.0-dev.20251130.1",
|
|
76
76
|
"@vitest/coverage-v8": "4.0.14",
|
|
77
77
|
"@vitest/ui": "4.0.14",
|
|
78
78
|
"arktype": "2.1.27",
|
|
@@ -111,10 +111,6 @@
|
|
|
111
111
|
"import": "./dist/main/index.js",
|
|
112
112
|
"types": "./dist/main/index.d.ts"
|
|
113
113
|
},
|
|
114
|
-
"./data": {
|
|
115
|
-
"import": "./dist/data/index.js",
|
|
116
|
-
"types": "./dist/data/index.d.ts"
|
|
117
|
-
},
|
|
118
114
|
"./eslint-plugin": {
|
|
119
115
|
"import": "./dist/eslint-plugin/index.js",
|
|
120
116
|
"types": "./dist/eslint-plugin/index.d.ts"
|
|
@@ -162,10 +158,6 @@
|
|
|
162
158
|
"import": "./dist/realtime-testing/index.js",
|
|
163
159
|
"types": "./dist/realtime-testing/index.d.ts"
|
|
164
160
|
},
|
|
165
|
-
"./struct": {
|
|
166
|
-
"import": "./dist/struct/index.js",
|
|
167
|
-
"types": "./dist/struct/index.d.ts"
|
|
168
|
-
},
|
|
169
161
|
"./transceivers/o-list": {
|
|
170
162
|
"import": "./dist/transceivers/o-list/index.js",
|
|
171
163
|
"types": "./dist/transceivers/o-list/index.d.ts"
|
|
@@ -22,7 +22,7 @@ export type IntrospectionStates = {
|
|
|
22
22
|
selectorIndex: AtomToken<SelectorTokenIndex>
|
|
23
23
|
transactionIndex: AtomToken<TransactionToken<Fn>[]>
|
|
24
24
|
transactionLogSelectors: ReadonlyPureSelectorFamilyToken<
|
|
25
|
-
TransactionOutcomeEvent<TransactionToken<Fn>>[],
|
|
25
|
+
readonly TransactionOutcomeEvent<TransactionToken<Fn>>[],
|
|
26
26
|
string
|
|
27
27
|
>
|
|
28
28
|
timelineIndex: AtomToken<TimelineToken<any>[]>
|
|
@@ -9,7 +9,7 @@ import { createRegularAtomFamily, createSelectorFamily } from "atom.io/internal"
|
|
|
9
9
|
export const attachTransactionLogs = (
|
|
10
10
|
store: RootStore,
|
|
11
11
|
): ReadonlyPureSelectorFamilyToken<
|
|
12
|
-
TransactionOutcomeEvent<TransactionToken<any>>[],
|
|
12
|
+
readonly TransactionOutcomeEvent<TransactionToken<any>>[],
|
|
13
13
|
string
|
|
14
14
|
> => {
|
|
15
15
|
const transactionUpdateLogAtoms = createRegularAtomFamily<
|
|
@@ -31,7 +31,7 @@ export const attachTransactionLogs = (
|
|
|
31
31
|
],
|
|
32
32
|
})
|
|
33
33
|
const findTransactionUpdateLogState = createSelectorFamily<
|
|
34
|
-
TransactionOutcomeEvent<TransactionToken<any>>[],
|
|
34
|
+
readonly TransactionOutcomeEvent<TransactionToken<any>>[],
|
|
35
35
|
string,
|
|
36
36
|
never
|
|
37
37
|
>(store, {
|
|
@@ -11,5 +11,8 @@ export type FamilyNode<Token extends ReadableToken<unknown, any, any>> = {
|
|
|
11
11
|
familyMembers: Map<string, Token>
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export type ReadonlyTokenIndex<Token extends ReadableToken<unknown, any, any>> =
|
|
15
|
+
ReadonlyMap<string, FamilyNode<Token> | Token>
|
|
16
|
+
|
|
14
17
|
export type WritableTokenIndex<Token extends ReadableToken<unknown, any, any>> =
|
|
15
18
|
Map<string, FamilyNode<Token> | Token>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { primitive } from "./json"
|
|
2
|
+
|
|
3
|
+
/** Only Canonical values should be used for keys because they always serialize to the same string */
|
|
4
|
+
export type Canonical = primitive | ReadonlyArray<Canonical>
|
|
5
|
+
|
|
6
|
+
export type packed<C extends Canonical> = string & { __canonical?: C }
|
|
7
|
+
|
|
8
|
+
const BOOL = `\u0001`
|
|
9
|
+
const NULL = `\u0002`
|
|
10
|
+
const STRING = `\u0003`
|
|
11
|
+
const NUMBER = `\u0004`
|
|
12
|
+
export const packCanonical = <C extends Canonical>(
|
|
13
|
+
value: Canonical,
|
|
14
|
+
): packed<C> => {
|
|
15
|
+
if (value === null) return NULL
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
17
|
+
switch (typeof value) {
|
|
18
|
+
case `string`:
|
|
19
|
+
return STRING + value
|
|
20
|
+
case `number`:
|
|
21
|
+
return NUMBER + value
|
|
22
|
+
case `boolean`:
|
|
23
|
+
return BOOL + +value
|
|
24
|
+
case `object`: // array
|
|
25
|
+
return JSON.stringify(value)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const unpackCanonical = <C extends Canonical>(value: packed<C>): C => {
|
|
29
|
+
const type = value[0] as `[` | `\u0001` | `\u0002` | `\u0003` | `\u0004`
|
|
30
|
+
switch (type) {
|
|
31
|
+
case STRING:
|
|
32
|
+
return value.slice(1) as C
|
|
33
|
+
case NUMBER:
|
|
34
|
+
return +value.slice(1) as C
|
|
35
|
+
case BOOL:
|
|
36
|
+
return (value.slice(1) === `1`) as C
|
|
37
|
+
case NULL:
|
|
38
|
+
return null as C
|
|
39
|
+
case `[`:
|
|
40
|
+
return JSON.parse(value)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Flat } from "atom.io/internal"
|
|
2
|
+
|
|
3
|
+
export type IndexOf<
|
|
4
|
+
T extends readonly unknown[],
|
|
5
|
+
E,
|
|
6
|
+
A extends unknown[] = [],
|
|
7
|
+
> = T extends readonly [infer Head, ...infer Tail]
|
|
8
|
+
? (<U>() => U extends Head ? 1 : 2) extends <U>() => U extends E ? 1 : 2
|
|
9
|
+
? A[`length`]
|
|
10
|
+
: IndexOf<Tail, E, [...A, unknown]>
|
|
11
|
+
: never
|
|
12
|
+
|
|
13
|
+
export type Flip<T extends Record<string, number | string>> = {
|
|
14
|
+
[K in keyof T as T[K]]: K
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type TwoWay<T extends Record<string, number | string>> = Flip<T> & T
|
|
18
|
+
|
|
19
|
+
export type Enumeration<T extends readonly string[]> = Flat<
|
|
20
|
+
TwoWay<{
|
|
21
|
+
[K in T[number]]: IndexOf<T, K>
|
|
22
|
+
}>
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
export function enumeration<T extends readonly string[]>(
|
|
26
|
+
values: T,
|
|
27
|
+
): Enumeration<T> {
|
|
28
|
+
const result: Record<any, any> = {}
|
|
29
|
+
let i = 0
|
|
30
|
+
for (const value of values) {
|
|
31
|
+
result[value] = i
|
|
32
|
+
result[i] = value
|
|
33
|
+
++i
|
|
34
|
+
}
|
|
35
|
+
return result as Enumeration<T>
|
|
36
|
+
}
|