atom.io 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +27 -17
- package/dist/index.d.ts +27 -17
- package/dist/index.js +28 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -22
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +14 -15
- package/introspection/dist/index.d.ts +14 -15
- package/introspection/dist/index.js +2 -2
- package/introspection/dist/index.js.map +1 -1
- package/introspection/dist/index.mjs +2 -2
- package/introspection/dist/index.mjs.map +1 -1
- package/json/dist/index.d.mts +5 -7
- package/json/dist/index.d.ts +5 -7
- package/json/dist/index.js.map +1 -1
- package/json/dist/index.mjs.map +1 -1
- package/package.json +15 -7
- package/react-devtools/dist/index.css +9 -1
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +14 -15
- package/react-devtools/dist/index.d.ts +14 -15
- package/react-devtools/dist/index.js +769 -249
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +752 -227
- package/react-devtools/dist/index.mjs.map +1 -1
- package/realtime/dist/index.d.mts +6 -8
- package/realtime/dist/index.d.ts +6 -8
- package/realtime/dist/index.js +0 -1
- package/realtime/dist/index.js.map +1 -1
- package/realtime/dist/index.mjs +0 -1
- package/realtime/dist/index.mjs.map +1 -1
- package/realtime-react/dist/index.d.mts +11 -13
- package/realtime-react/dist/index.d.ts +11 -13
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/dist/index.mjs.map +1 -1
- package/src/atom.ts +4 -4
- package/src/index.ts +1 -1
- package/src/internal/families-internal.ts +23 -20
- package/src/internal/index.ts +1 -1
- package/src/internal/selector/create-read-write-selector.ts +3 -1
- package/src/internal/selector/create-readonly-selector.ts +3 -1
- package/src/internal/time-travel-internal.ts +4 -4
- package/src/internal/timeline/add-atom-to-timeline.ts +2 -2
- package/src/internal/timeline-internal.ts +2 -2
- package/src/introspection/attach-timeline-family.ts +1 -1
- package/src/json/select-json.ts +1 -1
- package/src/react-devtools/StateEditor.tsx +5 -1
- package/src/react-devtools/StateIndex.tsx +4 -1
- package/src/react-devtools/devtools.scss +0 -1
- package/src/realtime/hook-composition/expose-family.ts +2 -2
- package/src/realtime/hook-composition/expose-single.ts +1 -1
- package/src/realtime/hook-composition/receive-state.ts +1 -1
- package/src/realtime-react/realtime-hooks.ts +4 -4
- package/src/realtime-react/use-pull-family-member.ts +2 -2
- package/src/realtime-react/use-pull-family.ts +2 -2
- package/src/realtime-react/use-pull.ts +3 -1
- package/src/realtime-react/use-push.ts +3 -1
- package/src/selector.ts +14 -12
- package/src/subscribe.ts +1 -1
- package/src/tracker/index.ts +3 -0
- package/src/tracker/tracker.ts +61 -0
- package/src/web-effects/storage.ts +1 -1
- package/src/internal/subject.ts +0 -24
package/dist/index.mjs
CHANGED
|
@@ -823,7 +823,6 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
|
823
823
|
}
|
|
824
824
|
|
|
825
825
|
// ../anvl/src/json/index.ts
|
|
826
|
-
import { pipe as pipe6 } from "fp-ts/function";
|
|
827
826
|
var stringifyJson = (json) => JSON.stringify(json);
|
|
828
827
|
|
|
829
828
|
// src/internal/families-internal.ts
|
|
@@ -831,20 +830,23 @@ function atomFamily__INTERNAL(options, store = IMPLICIT.STORE) {
|
|
|
831
830
|
const subject = new Subject();
|
|
832
831
|
return Object.assign(
|
|
833
832
|
(key) => {
|
|
834
|
-
var _a;
|
|
835
833
|
const subKey = stringifyJson(key);
|
|
836
834
|
const family = { key: options.key, subKey };
|
|
837
835
|
const fullKey = `${options.key}(${subKey})`;
|
|
838
836
|
const existing = withdraw({ key: fullKey, type: `atom` }, store);
|
|
839
|
-
|
|
840
|
-
|
|
837
|
+
let token;
|
|
838
|
+
if (existing) {
|
|
839
|
+
token = deposit(existing);
|
|
840
|
+
} else {
|
|
841
|
+
const individualOptions = {
|
|
841
842
|
key: fullKey,
|
|
842
|
-
default: options.default instanceof Function ? options.default(key) : options.default
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
843
|
+
default: options.default instanceof Function ? options.default(key) : options.default
|
|
844
|
+
};
|
|
845
|
+
if (options.effects) {
|
|
846
|
+
individualOptions.effects = options.effects(key);
|
|
847
|
+
}
|
|
848
|
+
token = atom__INTERNAL(individualOptions, family, store);
|
|
849
|
+
}
|
|
848
850
|
subject.next(token);
|
|
849
851
|
return token;
|
|
850
852
|
},
|
|
@@ -958,9 +960,11 @@ var createReadWriteSelector = (options, family, store, core) => {
|
|
|
958
960
|
(_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
|
|
959
961
|
const token = {
|
|
960
962
|
key: options.key,
|
|
961
|
-
type: `selector
|
|
962
|
-
family
|
|
963
|
+
type: `selector`
|
|
963
964
|
};
|
|
965
|
+
if (family) {
|
|
966
|
+
token.family = family;
|
|
967
|
+
}
|
|
964
968
|
store.subject.selectorCreation.next(token);
|
|
965
969
|
return token;
|
|
966
970
|
};
|
|
@@ -1157,9 +1161,11 @@ var createReadonlySelector = (options, family, store, core) => {
|
|
|
1157
1161
|
(_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
|
|
1158
1162
|
const token = {
|
|
1159
1163
|
key: options.key,
|
|
1160
|
-
type: `readonly_selector
|
|
1161
|
-
family
|
|
1164
|
+
type: `readonly_selector`
|
|
1162
1165
|
};
|
|
1166
|
+
if (family) {
|
|
1167
|
+
token.family = family;
|
|
1168
|
+
}
|
|
1163
1169
|
store.subject.selectorCreation.next(token);
|
|
1164
1170
|
return token;
|
|
1165
1171
|
};
|
|
@@ -1179,7 +1185,7 @@ function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
|
1179
1185
|
return createReadWriteSelector(options, family, store, core);
|
|
1180
1186
|
}
|
|
1181
1187
|
|
|
1182
|
-
//
|
|
1188
|
+
// ../anvl/reactivity/subject.ts
|
|
1183
1189
|
var Subject = class {
|
|
1184
1190
|
constructor() {
|
|
1185
1191
|
this.subscribers = [];
|
|
@@ -1282,7 +1288,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1282
1288
|
);
|
|
1283
1289
|
return;
|
|
1284
1290
|
}
|
|
1285
|
-
timelineData.timeTraveling =
|
|
1291
|
+
timelineData.timeTraveling = `into_future`;
|
|
1286
1292
|
const update = timelineData.history[timelineData.at];
|
|
1287
1293
|
switch (update.type) {
|
|
1288
1294
|
case `atom_update`: {
|
|
@@ -1301,7 +1307,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1301
1307
|
}
|
|
1302
1308
|
++timelineData.at;
|
|
1303
1309
|
timelineData.subject.next(`redo`);
|
|
1304
|
-
timelineData.timeTraveling =
|
|
1310
|
+
timelineData.timeTraveling = null;
|
|
1305
1311
|
(_d = store.config.logger) == null ? void 0 : _d.info(
|
|
1306
1312
|
`\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
|
|
1307
1313
|
);
|
|
@@ -1322,7 +1328,7 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1322
1328
|
);
|
|
1323
1329
|
return;
|
|
1324
1330
|
}
|
|
1325
|
-
timelineData.timeTraveling =
|
|
1331
|
+
timelineData.timeTraveling = `into_past`;
|
|
1326
1332
|
--timelineData.at;
|
|
1327
1333
|
const update = timelineData.history[timelineData.at];
|
|
1328
1334
|
switch (update.type) {
|
|
@@ -1341,7 +1347,7 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1341
1347
|
}
|
|
1342
1348
|
}
|
|
1343
1349
|
timelineData.subject.next(`undo`);
|
|
1344
|
-
timelineData.timeTraveling =
|
|
1350
|
+
timelineData.timeTraveling = null;
|
|
1345
1351
|
(_d = store.config.logger) == null ? void 0 : _d.info(
|
|
1346
1352
|
`\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
|
|
1347
1353
|
);
|
|
@@ -1368,7 +1374,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1368
1374
|
update.newValue,
|
|
1369
1375
|
currentTransactionKey ? `) in transaction "${currentTransactionKey}"` : currentSelectorKey ? `) in selector "${currentSelectorKey}"` : `)`
|
|
1370
1376
|
);
|
|
1371
|
-
if (tl.timeTraveling ===
|
|
1377
|
+
if (tl.timeTraveling === null) {
|
|
1372
1378
|
if (tl.selectorTime && tl.selectorTime !== currentSelectorTime) {
|
|
1373
1379
|
const mostRecentUpdate = tl.history.at(-1);
|
|
1374
1380
|
if (mostRecentUpdate === void 0) {
|
|
@@ -1397,7 +1403,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1397
1403
|
const subscription = currentTransaction.subject.subscribe((update2) => {
|
|
1398
1404
|
var _a2;
|
|
1399
1405
|
subscription.unsubscribe();
|
|
1400
|
-
if (tl.timeTraveling ===
|
|
1406
|
+
if (tl.timeTraveling === null && currentTransactionTime) {
|
|
1401
1407
|
if (tl.at !== tl.history.length) {
|
|
1402
1408
|
tl.history.splice(tl.at);
|
|
1403
1409
|
}
|
|
@@ -1486,7 +1492,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
|
1486
1492
|
const tl = __spreadProps(__spreadValues({
|
|
1487
1493
|
key: options.key,
|
|
1488
1494
|
at: 0,
|
|
1489
|
-
timeTraveling:
|
|
1495
|
+
timeTraveling: null,
|
|
1490
1496
|
selectorTime: null,
|
|
1491
1497
|
transactionKey: null
|
|
1492
1498
|
}, data), {
|