atom.io 0.19.1 → 0.19.2
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/data/dist/index.cjs +99 -79
- package/data/dist/index.js +2 -2
- package/data/src/join.ts +67 -50
- package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
- package/dist/{chunk-7VCCW45K.js → chunk-CC7IF7QF.js} +4 -3
- package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
- package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
- package/dist/index.cjs +14 -7
- package/dist/index.d.ts +23 -35
- package/dist/index.js +14 -7
- package/internal/dist/index.cjs +55 -43
- package/internal/dist/index.d.ts +20 -20
- package/internal/dist/index.js +48 -36
- package/internal/src/atom/create-regular-atom.ts +7 -5
- package/internal/src/atom/delete-atom.ts +2 -2
- package/internal/src/families/create-readonly-selector-family.ts +2 -2
- package/internal/src/families/create-regular-atom-family.ts +1 -1
- package/internal/src/families/create-writable-selector-family.ts +1 -1
- package/internal/src/future.ts +4 -2
- package/internal/src/lineage.ts +1 -0
- package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
- package/internal/src/mutable/create-mutable-atom.ts +7 -5
- package/internal/src/mutable/tracker.ts +3 -3
- package/internal/src/mutable/transceiver.ts +2 -2
- package/internal/src/selector/delete-selector.ts +1 -1
- package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
- package/internal/src/store/deposit.ts +5 -5
- package/internal/src/store/store.ts +5 -5
- package/internal/src/store/withdraw.ts +4 -5
- package/internal/src/subject.ts +3 -1
- package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
- package/internal/src/timeline/add-atom-to-timeline.ts +13 -8
- package/internal/src/timeline/create-timeline.ts +3 -4
- package/internal/src/transaction/act-upon-store.ts +5 -5
- package/internal/src/transaction/apply-transaction.ts +4 -4
- package/internal/src/transaction/build-transaction.ts +9 -6
- package/internal/src/transaction/create-transaction.ts +10 -10
- package/internal/src/transaction/index.ts +3 -3
- package/internal/src/transaction/is-root-store.ts +2 -2
- package/introspection/dist/index.d.ts +3 -3
- package/introspection/src/attach-introspection-states.ts +3 -3
- package/introspection/src/attach-transaction-index.ts +4 -4
- package/introspection/src/attach-transaction-logs.ts +8 -4
- package/json/dist/index.cjs +6 -2
- package/json/dist/index.js +6 -2
- package/json/src/select-json-family.ts +3 -2
- package/json/src/select-json.ts +3 -1
- package/package.json +243 -241
- package/react/dist/index.cjs +9 -3
- package/react/dist/index.js +9 -3
- package/react/src/use-i.ts +3 -1
- package/react/src/use-tl.ts +6 -2
- package/react-devtools/dist/index.cjs +116 -53
- package/react-devtools/dist/index.d.ts +3 -5
- package/react-devtools/dist/index.js +113 -51
- package/react-devtools/src/AtomIODevtools.tsx +3 -1
- package/react-devtools/src/Button.tsx +3 -1
- package/react-devtools/src/StateIndex.tsx +6 -2
- package/react-devtools/src/TimelineIndex.tsx +6 -2
- package/react-devtools/src/TransactionIndex.tsx +3 -3
- package/react-devtools/src/Updates.tsx +14 -6
- package/realtime/dist/index.cjs +1 -0
- package/realtime/dist/index.d.ts +2 -2
- package/realtime/dist/index.js +1 -0
- package/realtime/src/realtime-continuity.ts +4 -3
- package/realtime-client/dist/index.cjs +29 -29
- package/realtime-client/dist/index.d.ts +2 -2
- package/realtime-client/dist/index.js +1 -1
- package/realtime-client/src/server-action.ts +2 -2
- package/realtime-client/src/sync-continuity.ts +23 -23
- package/realtime-react/dist/index.cjs +29 -29
- package/realtime-react/dist/index.d.ts +2 -2
- package/realtime-react/dist/index.js +1 -1
- package/realtime-react/src/use-server-action.ts +3 -3
- package/realtime-server/dist/index.cjs +54 -44
- package/realtime-server/dist/index.d.ts +5 -5
- package/realtime-server/dist/index.js +34 -24
- package/realtime-server/src/ipc-sockets/child-socket.ts +6 -6
- package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
- package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
- package/realtime-server/src/realtime-action-receiver.ts +7 -5
- package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
- package/realtime-server/src/realtime-state-receiver.ts +3 -1
- package/realtime-testing/dist/index.cjs +15 -13
- package/realtime-testing/dist/index.js +9 -7
- package/realtime-testing/src/setup-realtime-test.tsx +6 -4
- package/src/atom.ts +4 -8
- package/src/dispose.ts +1 -0
- package/src/index.ts +2 -9
- package/src/selector.ts +4 -8
- package/src/silo.ts +9 -3
- package/src/subscribe.ts +6 -6
- package/src/timeline.ts +4 -4
- package/src/transaction.ts +24 -24
- package/transceivers/set-rtx/dist/index.cjs +11 -12
- package/transceivers/set-rtx/dist/index.js +11 -12
- package/transceivers/set-rtx/src/set-rtx.ts +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, recordToEntries, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-
|
|
1
|
+
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, recordToEntries, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-CC7IF7QF.js';
|
|
2
2
|
import { lazyLocalStorageEffect } from '../../dist/chunk-BWWVY5O5.js';
|
|
3
3
|
import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-BF4MVQF6.js';
|
|
4
4
|
import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-U2IICNHQ.js';
|
|
@@ -28,7 +28,7 @@ var Refinery = class {
|
|
|
28
28
|
if (input instanceof refiner) {
|
|
29
29
|
return { type: key, data: input };
|
|
30
30
|
}
|
|
31
|
-
} catch (
|
|
31
|
+
} catch (_) {
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -72,8 +72,8 @@ var isJson = (input) => {
|
|
|
72
72
|
if (input === void 0)
|
|
73
73
|
return false;
|
|
74
74
|
const prototype = (_a2 = Object.getPrototypeOf(input)) == null ? void 0 : _a2.constructor.name;
|
|
75
|
-
const
|
|
76
|
-
return
|
|
75
|
+
const refine = JSON_PROTOTYPES.includes(prototype);
|
|
76
|
+
return refine;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
// ../anvl/src/refinement/can-exist.ts
|
|
@@ -258,7 +258,9 @@ var OpenClose = ({ isOpen, setIsOpen, disabled, testid }) => {
|
|
|
258
258
|
type: "button",
|
|
259
259
|
"data-testid": testid,
|
|
260
260
|
className: `carat ${isOpen ? `open` : `closed`}`,
|
|
261
|
-
onClick: () =>
|
|
261
|
+
onClick: () => {
|
|
262
|
+
setIsOpen((prev) => !prev);
|
|
263
|
+
},
|
|
262
264
|
disabled,
|
|
263
265
|
children: "\u25B6"
|
|
264
266
|
}
|
|
@@ -268,7 +270,7 @@ var button = {
|
|
|
268
270
|
OpenClose
|
|
269
271
|
};
|
|
270
272
|
var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
271
|
-
var _a2, _b, _c, _d;
|
|
273
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
272
274
|
const inputRef = useRef(null);
|
|
273
275
|
const spanRef = useRef(null);
|
|
274
276
|
const [inputWidth, setInputWidth] = useState(`auto`);
|
|
@@ -290,7 +292,9 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
|
290
292
|
setInputWidth(`${spanRef.current.offsetWidth + extraWidth}px`);
|
|
291
293
|
}
|
|
292
294
|
}, 1e3);
|
|
293
|
-
return () =>
|
|
295
|
+
return () => {
|
|
296
|
+
clearInterval(interval);
|
|
297
|
+
};
|
|
294
298
|
}
|
|
295
299
|
}, [(_a2 = inputRef.current) == null ? void 0 : _a2.value, props.value]);
|
|
296
300
|
return /* @__PURE__ */ jsxs("div", { style: { display: `inline-block`, position: `relative` }, children: [
|
|
@@ -318,8 +322,8 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
|
318
322
|
visibility: `hidden`,
|
|
319
323
|
// color: `red`,
|
|
320
324
|
whiteSpace: `pre`,
|
|
321
|
-
fontFamily: ((_c = props.style) == null ? void 0 : _c.fontFamily)
|
|
322
|
-
fontSize: ((
|
|
325
|
+
fontFamily: (_d = (_c = props.style) == null ? void 0 : _c.fontFamily) != null ? _d : `inherit`,
|
|
326
|
+
fontSize: (_f = (_e = props.style) == null ? void 0 : _e.fontSize) != null ? _f : `inherit`
|
|
323
327
|
},
|
|
324
328
|
children: props.value
|
|
325
329
|
}
|
|
@@ -529,7 +533,9 @@ var JsonEditor_INTERNAL = ({
|
|
|
529
533
|
ElasticInput,
|
|
530
534
|
{
|
|
531
535
|
value: name,
|
|
532
|
-
onChange: disabled ? doNothing : (e) =>
|
|
536
|
+
onChange: disabled ? doNothing : (e) => {
|
|
537
|
+
rename(e.target.value);
|
|
538
|
+
},
|
|
533
539
|
disabled
|
|
534
540
|
}
|
|
535
541
|
) }),
|
|
@@ -550,7 +556,9 @@ var JsonEditor_INTERNAL = ({
|
|
|
550
556
|
recast && dataIsJson ? /* @__PURE__ */ jsx(
|
|
551
557
|
"select",
|
|
552
558
|
{
|
|
553
|
-
onChange: disabled ? doNothing : (e) =>
|
|
559
|
+
onChange: disabled ? doNothing : (e) => {
|
|
560
|
+
recast(e.target.value);
|
|
561
|
+
},
|
|
554
562
|
value: refined.type,
|
|
555
563
|
disabled,
|
|
556
564
|
children: Object.keys(SubEditors).map((type) => /* @__PURE__ */ jsx("option", { value: type, children: type }, type))
|
|
@@ -560,13 +568,13 @@ var JsonEditor_INTERNAL = ({
|
|
|
560
568
|
};
|
|
561
569
|
|
|
562
570
|
// ../hamr/react-json-editor/src/editors-by-type/utilities/array-elements.ts
|
|
563
|
-
var makeElementSetters = (data, set) => data.map(
|
|
564
|
-
|
|
571
|
+
var makeElementSetters = (data, set) => data.map((value, index) => (newValue) => {
|
|
572
|
+
set(() => {
|
|
565
573
|
const newData = [...data];
|
|
566
574
|
newData[index] = become(newValue)(value);
|
|
567
575
|
return newData;
|
|
568
|
-
})
|
|
569
|
-
);
|
|
576
|
+
});
|
|
577
|
+
});
|
|
570
578
|
var ArrayEditor = ({
|
|
571
579
|
path = [],
|
|
572
580
|
isReadonly = () => false,
|
|
@@ -863,7 +871,9 @@ var expandPathForSchema = (path) => {
|
|
|
863
871
|
);
|
|
864
872
|
default:
|
|
865
873
|
throw new TypeError(
|
|
866
|
-
`The key ${
|
|
874
|
+
`The key ${JSON.stringify(
|
|
875
|
+
key
|
|
876
|
+
)} is not a valid JSON key; expected string or number, got ${typeof key}`
|
|
867
877
|
);
|
|
868
878
|
}
|
|
869
879
|
});
|
|
@@ -886,10 +896,11 @@ var findSubSchema = (schema) => {
|
|
|
886
896
|
if (typeof schema === `boolean`) {
|
|
887
897
|
return new TypeError(`The schema is not a JsonSchema`);
|
|
888
898
|
}
|
|
889
|
-
const
|
|
899
|
+
const reduction = pathIntoSchema.reduce(
|
|
890
900
|
({ node: node2, refMap: refMap2 = void 0 }, key) => (console.log({ node: node2, key }), isJsonSchemaRef(node2) ? retrieveRef({ refNode: node2, root: schema, refMap: refMap2 }) : { node: node2[key], refMap: refMap2 }),
|
|
891
901
|
{ node: schema, refMap: void 0 }
|
|
892
902
|
);
|
|
903
|
+
const { node, refMap } = reduction;
|
|
893
904
|
if (node instanceof Error)
|
|
894
905
|
throw node;
|
|
895
906
|
let subSchema = node;
|
|
@@ -1044,35 +1055,44 @@ var castToJson = (input) => {
|
|
|
1044
1055
|
// ../hamr/react-json-editor/src/editors-by-type/utilities/object-properties.ts
|
|
1045
1056
|
var makePropertySetters = (data, set) => mapObject(
|
|
1046
1057
|
data,
|
|
1047
|
-
(value, key) => (newValue) =>
|
|
1058
|
+
(value, key) => (newValue) => {
|
|
1059
|
+
set(__spreadProps(__spreadValues({}, data), { [key]: become(newValue)(value[key]) }));
|
|
1060
|
+
}
|
|
1048
1061
|
);
|
|
1049
1062
|
var makePropertyRenamers = (data, set, stableKeyMapRef) => mapObject(
|
|
1050
1063
|
data,
|
|
1051
|
-
(value, key) => (newKey) =>
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1064
|
+
(value, key) => (newKey) => {
|
|
1065
|
+
if (!Object.hasOwn(data, newKey)) {
|
|
1066
|
+
set(() => {
|
|
1067
|
+
const entries = Object.entries(data);
|
|
1068
|
+
const index = entries.findIndex(([k]) => k === key);
|
|
1069
|
+
entries[index] = [newKey, value];
|
|
1070
|
+
const stableKeyMap = stableKeyMapRef.current;
|
|
1071
|
+
stableKeyMapRef.current = __spreadProps(__spreadValues({}, stableKeyMap), {
|
|
1072
|
+
[newKey]: stableKeyMap[key]
|
|
1073
|
+
});
|
|
1074
|
+
return Object.fromEntries(entries);
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1061
1078
|
);
|
|
1062
|
-
var makePropertyRemovers = (data, set) => mapObject(
|
|
1063
|
-
|
|
1064
|
-
(_, key) => () => set(() => {
|
|
1079
|
+
var makePropertyRemovers = (data, set) => mapObject(data, (_, key) => () => {
|
|
1080
|
+
set(() => {
|
|
1065
1081
|
const _a2 = data, rest = __objRest(_a2, [__restKey(key)]);
|
|
1066
1082
|
return rest;
|
|
1067
|
-
})
|
|
1068
|
-
);
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1069
1085
|
var makePropertyRecasters = (data, set) => mapObject(
|
|
1070
1086
|
data,
|
|
1071
|
-
(value, key) => (newType) =>
|
|
1072
|
-
|
|
1073
|
-
|
|
1087
|
+
(value, key) => (newType) => {
|
|
1088
|
+
set(() => __spreadProps(__spreadValues({}, data), {
|
|
1089
|
+
[key]: castToJson(value).to[newType]()
|
|
1090
|
+
}));
|
|
1091
|
+
}
|
|
1074
1092
|
);
|
|
1075
|
-
var makePropertyCreationInterface = (data, set) => (key, type) => (value) =>
|
|
1093
|
+
var makePropertyCreationInterface = (data, set) => (key, type) => (value) => {
|
|
1094
|
+
set(__spreadProps(__spreadValues({}, data), { [key]: value != null ? value : JSON_DEFAULTS[type] }));
|
|
1095
|
+
};
|
|
1076
1096
|
var makePropertySorter = (data, set, sortFn) => () => {
|
|
1077
1097
|
const sortedKeys = Object.keys(data).sort(sortFn);
|
|
1078
1098
|
const sortedObj = {};
|
|
@@ -1090,7 +1110,16 @@ var PropertyAdder = ({
|
|
|
1090
1110
|
/* @__PURE__ */ jsx(ElasticInput, { disabled: true, defaultValue: propertyKey }),
|
|
1091
1111
|
` `,
|
|
1092
1112
|
/* @__PURE__ */ jsx(ElasticInput, { disabled: true, defaultValue: "is missing" }),
|
|
1093
|
-
/* @__PURE__ */ jsx(
|
|
1113
|
+
/* @__PURE__ */ jsx(
|
|
1114
|
+
Components.Button,
|
|
1115
|
+
{
|
|
1116
|
+
onClick: () => {
|
|
1117
|
+
addProperty();
|
|
1118
|
+
},
|
|
1119
|
+
disabled,
|
|
1120
|
+
children: "+"
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1094
1123
|
] });
|
|
1095
1124
|
var ObjectEditor = ({
|
|
1096
1125
|
schema,
|
|
@@ -1130,7 +1159,16 @@ var ObjectEditor = ({
|
|
|
1130
1159
|
);
|
|
1131
1160
|
const missingKeys = schemaKeys === true ? [] : schemaKeys.filter((key) => !dataKeys.includes(key));
|
|
1132
1161
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1133
|
-
/* @__PURE__ */ jsx(
|
|
1162
|
+
/* @__PURE__ */ jsx(
|
|
1163
|
+
Components.Button,
|
|
1164
|
+
{
|
|
1165
|
+
onClick: () => {
|
|
1166
|
+
sortProperties();
|
|
1167
|
+
},
|
|
1168
|
+
disabled,
|
|
1169
|
+
children: "Sort"
|
|
1170
|
+
}
|
|
1171
|
+
),
|
|
1134
1172
|
/* @__PURE__ */ jsxs(Components.ObjectWrapper, { children: [
|
|
1135
1173
|
/* @__PURE__ */ jsx("div", { className: "json_editor_properties", children: [...missingKeys, ...officialKeys, ...unofficialKeys].map((key) => {
|
|
1136
1174
|
const originalKey = stableKeyMap.current[key];
|
|
@@ -1169,7 +1207,9 @@ var ObjectEditor = ({
|
|
|
1169
1207
|
/* @__PURE__ */ jsx(
|
|
1170
1208
|
Components.Button,
|
|
1171
1209
|
{
|
|
1172
|
-
onClick: disabled ? doNothing : () =>
|
|
1210
|
+
onClick: disabled ? doNothing : () => {
|
|
1211
|
+
makePropertyAdder(`new_property`, `string`)();
|
|
1212
|
+
},
|
|
1173
1213
|
disabled,
|
|
1174
1214
|
children: "+"
|
|
1175
1215
|
}
|
|
@@ -1186,7 +1226,9 @@ var BooleanEditor = ({
|
|
|
1186
1226
|
{
|
|
1187
1227
|
type: "checkbox",
|
|
1188
1228
|
checked: data,
|
|
1189
|
-
onChange: (event) =>
|
|
1229
|
+
onChange: (event) => {
|
|
1230
|
+
set(event.target.checked);
|
|
1231
|
+
}
|
|
1190
1232
|
}
|
|
1191
1233
|
) });
|
|
1192
1234
|
var NullEditor = ({
|
|
@@ -1202,7 +1244,9 @@ var NumberEditor = ({
|
|
|
1202
1244
|
NumberInput,
|
|
1203
1245
|
{
|
|
1204
1246
|
value: data,
|
|
1205
|
-
set: isReadonly(path) ? void 0 : (newValue) =>
|
|
1247
|
+
set: isReadonly(path) ? void 0 : (newValue) => {
|
|
1248
|
+
set(Number(newValue));
|
|
1249
|
+
},
|
|
1206
1250
|
autoSize: true
|
|
1207
1251
|
}
|
|
1208
1252
|
) });
|
|
@@ -1448,8 +1492,12 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
|
|
|
1448
1492
|
/* @__PURE__ */ jsxs(
|
|
1449
1493
|
"label",
|
|
1450
1494
|
{
|
|
1451
|
-
onClick: () =>
|
|
1452
|
-
|
|
1495
|
+
onClick: () => {
|
|
1496
|
+
console.log(node, getState(node));
|
|
1497
|
+
},
|
|
1498
|
+
onKeyUp: () => {
|
|
1499
|
+
console.log(node, getState(node));
|
|
1500
|
+
},
|
|
1453
1501
|
children: [
|
|
1454
1502
|
/* @__PURE__ */ jsx("h2", { children: (_b = (_a2 = node.family) == null ? void 0 : _a2.subKey) != null ? _b : node.key }),
|
|
1455
1503
|
/* @__PURE__ */ jsxs("span", { className: "type detail", children: [
|
|
@@ -1527,8 +1575,12 @@ var AtomUpdateFC = ({ atomUpdate }) => {
|
|
|
1527
1575
|
"article",
|
|
1528
1576
|
{
|
|
1529
1577
|
className: "node atom_update",
|
|
1530
|
-
onClick: () =>
|
|
1531
|
-
|
|
1578
|
+
onClick: () => {
|
|
1579
|
+
console.log(atomUpdate);
|
|
1580
|
+
},
|
|
1581
|
+
onKeyUp: () => {
|
|
1582
|
+
console.log(atomUpdate);
|
|
1583
|
+
},
|
|
1532
1584
|
children: [
|
|
1533
1585
|
/* @__PURE__ */ jsxs("span", { className: "detail", children: [
|
|
1534
1586
|
atomUpdate.key,
|
|
@@ -1556,8 +1608,12 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
|
|
|
1556
1608
|
"article",
|
|
1557
1609
|
{
|
|
1558
1610
|
className: "node transaction_param",
|
|
1559
|
-
onClick: () =>
|
|
1560
|
-
|
|
1611
|
+
onClick: () => {
|
|
1612
|
+
console.log(transactionUpdate);
|
|
1613
|
+
},
|
|
1614
|
+
onKeyUp: () => {
|
|
1615
|
+
console.log(transactionUpdate);
|
|
1616
|
+
},
|
|
1561
1617
|
children: [
|
|
1562
1618
|
/* @__PURE__ */ jsxs("span", { className: "detail", children: [
|
|
1563
1619
|
discoverType(param),
|
|
@@ -1691,7 +1747,9 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
|
|
|
1691
1747
|
"button",
|
|
1692
1748
|
{
|
|
1693
1749
|
type: "button",
|
|
1694
|
-
onClick: () =>
|
|
1750
|
+
onClick: () => {
|
|
1751
|
+
undo(token);
|
|
1752
|
+
},
|
|
1695
1753
|
disabled: timeline.at === 0,
|
|
1696
1754
|
children: "undo"
|
|
1697
1755
|
}
|
|
@@ -1700,7 +1758,9 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
|
|
|
1700
1758
|
"button",
|
|
1701
1759
|
{
|
|
1702
1760
|
type: "button",
|
|
1703
|
-
onClick: () =>
|
|
1761
|
+
onClick: () => {
|
|
1762
|
+
redo(token);
|
|
1763
|
+
},
|
|
1704
1764
|
disabled: timeline.at === timeline.history.length,
|
|
1705
1765
|
children: "redo"
|
|
1706
1766
|
}
|
|
@@ -1836,7 +1896,9 @@ var AtomIODevtools = () => {
|
|
|
1836
1896
|
type: "button",
|
|
1837
1897
|
"data-testid": `view-${viewOption}`,
|
|
1838
1898
|
className: viewOption === devtoolsView ? `active` : ``,
|
|
1839
|
-
onClick: () =>
|
|
1899
|
+
onClick: () => {
|
|
1900
|
+
setDevtoolsView(viewOption);
|
|
1901
|
+
},
|
|
1840
1902
|
disabled: viewOption === devtoolsView,
|
|
1841
1903
|
children: viewOption
|
|
1842
1904
|
},
|
|
@@ -67,7 +67,9 @@ export const AtomIODevtools = (): JSX.Element => {
|
|
|
67
67
|
type="button"
|
|
68
68
|
data-testid={`view-${viewOption}`}
|
|
69
69
|
className={viewOption === devtoolsView ? `active` : ``}
|
|
70
|
-
onClick={() =>
|
|
70
|
+
onClick={() => {
|
|
71
|
+
setDevtoolsView(viewOption)
|
|
72
|
+
}}
|
|
71
73
|
disabled={viewOption === devtoolsView}
|
|
72
74
|
>
|
|
73
75
|
{viewOption}
|
|
@@ -12,7 +12,9 @@ export const OpenClose: FC<{
|
|
|
12
12
|
type="button"
|
|
13
13
|
data-testid={testid}
|
|
14
14
|
className={`carat ${isOpen ? `open` : `closed`}`}
|
|
15
|
-
onClick={() =>
|
|
15
|
+
onClick={() => {
|
|
16
|
+
setIsOpen((prev) => !prev)
|
|
17
|
+
}}
|
|
16
18
|
disabled={disabled}
|
|
17
19
|
>
|
|
18
20
|
▶
|
|
@@ -59,8 +59,12 @@ export const StateIndexLeafNode: FC<{
|
|
|
59
59
|
disabled={isPrimitive}
|
|
60
60
|
/>
|
|
61
61
|
<label
|
|
62
|
-
onClick={() =>
|
|
63
|
-
|
|
62
|
+
onClick={() => {
|
|
63
|
+
console.log(node, getState(node))
|
|
64
|
+
}}
|
|
65
|
+
onKeyUp={() => {
|
|
66
|
+
console.log(node, getState(node))
|
|
67
|
+
}}
|
|
64
68
|
>
|
|
65
69
|
<h2>{node.family?.subKey ?? node.key}</h2>
|
|
66
70
|
<span className="type detail">({stateType})</span>
|
|
@@ -42,14 +42,18 @@ export const TimelineLog: FC<{
|
|
|
42
42
|
<nav>
|
|
43
43
|
<button
|
|
44
44
|
type="button"
|
|
45
|
-
onClick={() =>
|
|
45
|
+
onClick={() => {
|
|
46
|
+
undo(token)
|
|
47
|
+
}}
|
|
46
48
|
disabled={timeline.at === 0}
|
|
47
49
|
>
|
|
48
50
|
undo
|
|
49
51
|
</button>
|
|
50
52
|
<button
|
|
51
53
|
type="button"
|
|
52
|
-
onClick={() =>
|
|
54
|
+
onClick={() => {
|
|
55
|
+
redo(token)
|
|
56
|
+
}}
|
|
53
57
|
disabled={timeline.at === timeline.history.length}
|
|
54
58
|
>
|
|
55
59
|
redo
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type TransactionToken,
|
|
5
5
|
type TransactionUpdate,
|
|
6
6
|
findState,
|
|
7
|
-
type
|
|
7
|
+
type Func,
|
|
8
8
|
} from "atom.io"
|
|
9
9
|
import { useI, useO } from "atom.io/react"
|
|
10
10
|
import type { FC } from "react"
|
|
@@ -18,9 +18,9 @@ import { button } from "./Button"
|
|
|
18
18
|
import { article } from "./Updates"
|
|
19
19
|
|
|
20
20
|
export const TransactionLog: FC<{
|
|
21
|
-
token: TransactionToken
|
|
21
|
+
token: TransactionToken<Func>
|
|
22
22
|
isOpenState: RegularAtomToken<boolean>
|
|
23
|
-
logState: ReadonlySelectorToken<TransactionUpdate
|
|
23
|
+
logState: ReadonlySelectorToken<TransactionUpdate<Func>[]>
|
|
24
24
|
}> = ({ token, isOpenState, logState }) => {
|
|
25
25
|
const log = useO(logState)
|
|
26
26
|
const isOpen = useO(isOpenState)
|
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
KeyedStateUpdate,
|
|
3
3
|
TimelineUpdate,
|
|
4
4
|
TransactionUpdate,
|
|
5
|
-
|
|
5
|
+
Func,
|
|
6
6
|
} from "atom.io"
|
|
7
7
|
import * as React from "react"
|
|
8
8
|
|
|
@@ -18,8 +18,12 @@ const AtomUpdateFC: React.FC<{
|
|
|
18
18
|
<article
|
|
19
19
|
key={atomUpdate.key}
|
|
20
20
|
className="node atom_update"
|
|
21
|
-
onClick={() =>
|
|
22
|
-
|
|
21
|
+
onClick={() => {
|
|
22
|
+
console.log(atomUpdate)
|
|
23
|
+
}}
|
|
24
|
+
onKeyUp={() => {
|
|
25
|
+
console.log(atomUpdate)
|
|
26
|
+
}}
|
|
23
27
|
>
|
|
24
28
|
<span className="detail">{atomUpdate.key}: </span>
|
|
25
29
|
<span>
|
|
@@ -33,7 +37,7 @@ const AtomUpdateFC: React.FC<{
|
|
|
33
37
|
|
|
34
38
|
const TransactionUpdateFC: React.FC<{
|
|
35
39
|
serialNumber: number
|
|
36
|
-
transactionUpdate: TransactionUpdate
|
|
40
|
+
transactionUpdate: TransactionUpdate<Func>
|
|
37
41
|
}> = ({ serialNumber, transactionUpdate }) => {
|
|
38
42
|
return (
|
|
39
43
|
<article
|
|
@@ -51,8 +55,12 @@ const TransactionUpdateFC: React.FC<{
|
|
|
51
55
|
<article
|
|
52
56
|
key={`param` + index}
|
|
53
57
|
className="node transaction_param"
|
|
54
|
-
onClick={() =>
|
|
55
|
-
|
|
58
|
+
onClick={() => {
|
|
59
|
+
console.log(transactionUpdate)
|
|
60
|
+
}}
|
|
61
|
+
onKeyUp={() => {
|
|
62
|
+
console.log(transactionUpdate)
|
|
63
|
+
}}
|
|
56
64
|
>
|
|
57
65
|
<span className="detail">{discoverType(param)}: </span>
|
|
58
66
|
<span className="summary">
|
package/realtime/dist/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var InvariantMap = class extends Map {
|
|
|
24
24
|
var _SyncGroup = class _SyncGroup {
|
|
25
25
|
constructor(key) {
|
|
26
26
|
this.key = key;
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
27
28
|
this.type = `continuity`;
|
|
28
29
|
this.globals = [];
|
|
29
30
|
this.actions = [];
|
package/realtime/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare class InvariantMap<K, V> extends Map<K, V> {
|
|
|
8
8
|
set(key: K, value: V): this;
|
|
9
9
|
clear(): void;
|
|
10
10
|
}
|
|
11
|
-
type PerspectiveToken<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer
|
|
11
|
+
type PerspectiveToken<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer U, any> ? U : never> = {
|
|
12
12
|
type: `realtime_perspective`;
|
|
13
13
|
resourceAtoms: F;
|
|
14
14
|
viewAtoms: ReadableFamilyToken<ReadableToken<T>[], string>;
|
|
@@ -31,7 +31,7 @@ declare class SyncGroup {
|
|
|
31
31
|
static create(key: string, builder: (group: SyncGroup) => SyncGroup): ContinuityToken;
|
|
32
32
|
add(...atoms: AtomToken<any>[]): SyncGroup;
|
|
33
33
|
add(...args: TransactionToken<any>[]): SyncGroup;
|
|
34
|
-
add<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer
|
|
34
|
+
add<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer U> ? U : never>(family: AtomFamilyToken<T, any>, index: ReadableFamilyToken<Iterable<AtomToken<T>>, string>): SyncGroup;
|
|
35
35
|
}
|
|
36
36
|
type ContinuityOptions = {
|
|
37
37
|
key: string;
|
package/realtime/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var InvariantMap = class extends Map {
|
|
|
22
22
|
var _SyncGroup = class _SyncGroup {
|
|
23
23
|
constructor(key) {
|
|
24
24
|
this.key = key;
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
25
26
|
this.type = `continuity`;
|
|
26
27
|
this.globals = [];
|
|
27
28
|
this.actions = [];
|
|
@@ -32,7 +32,7 @@ export class InvariantMap<K, V> extends Map<K, V> {
|
|
|
32
32
|
|
|
33
33
|
export type PerspectiveToken<
|
|
34
34
|
F extends AtomFamilyToken<any>,
|
|
35
|
-
T extends F extends AtomFamilyToken<infer
|
|
35
|
+
T extends F extends AtomFamilyToken<infer U, any> ? U : never,
|
|
36
36
|
> = {
|
|
37
37
|
type: `realtime_perspective`
|
|
38
38
|
resourceAtoms: F
|
|
@@ -51,6 +51,7 @@ export type ContinuityToken = {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export class SyncGroup {
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
54
55
|
protected type = `continuity` as const
|
|
55
56
|
|
|
56
57
|
protected globals: AtomToken<any>[] = []
|
|
@@ -76,7 +77,7 @@ export class SyncGroup {
|
|
|
76
77
|
public add(...args: TransactionToken<any>[]): SyncGroup
|
|
77
78
|
public add<
|
|
78
79
|
F extends AtomFamilyToken<any>,
|
|
79
|
-
T extends F extends AtomFamilyToken<infer
|
|
80
|
+
T extends F extends AtomFamilyToken<infer U> ? U : never,
|
|
80
81
|
>(
|
|
81
82
|
family: AtomFamilyToken<T, any>,
|
|
82
83
|
index: ReadableFamilyToken<Iterable<AtomToken<T>>, string>,
|
|
@@ -86,7 +87,7 @@ export class SyncGroup {
|
|
|
86
87
|
| readonly AtomToken<any>[]
|
|
87
88
|
| readonly TransactionToken<any>[]
|
|
88
89
|
| [AtomFamilyToken<any, any>, ReadableFamilyToken<Iterable<any>, string>]
|
|
89
|
-
):
|
|
90
|
+
): this {
|
|
90
91
|
const zeroth = args[0]
|
|
91
92
|
if (zeroth.type === `atom` || zeroth.type === `mutable_atom`) {
|
|
92
93
|
const globals = args as AtomToken<any>[]
|