atom.io 0.25.6 → 0.27.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/data/dist/index.d.ts +3 -3
- package/data/dist/index.js +33 -25
- package/data/package.json +1 -4
- package/data/src/dict.ts +3 -3
- package/dist/chunk-AK23DRMD.js +21 -0
- package/dist/{chunk-HYXKCFVY.js → chunk-IBTHB2PI.js} +59 -60
- package/dist/{chunk-MR5NETHW.js → chunk-IW6WYRS7.js} +4 -5
- package/dist/chunk-XWL6SNVU.js +7 -0
- package/dist/index.d.ts +32 -54
- package/dist/index.js +33 -21
- package/ephemeral/dist/index.d.ts +7 -7
- package/ephemeral/dist/index.js +1 -1
- package/ephemeral/package.json +1 -4
- package/ephemeral/src/find-state.ts +7 -7
- package/eslint-plugin/dist/index.js +7 -8
- package/eslint-plugin/package.json +1 -4
- package/immortal/dist/index.d.ts +7 -7
- package/immortal/dist/index.js +1 -1
- package/immortal/package.json +1 -4
- package/immortal/src/seek-state.ts +8 -8
- package/internal/dist/index.d.ts +56 -59
- package/internal/dist/index.js +178 -170
- package/internal/package.json +1 -4
- package/internal/src/families/create-atom-family.ts +4 -4
- package/internal/src/families/create-readonly-selector-family.ts +2 -2
- package/internal/src/families/create-regular-atom-family.ts +2 -2
- package/internal/src/families/create-selector-family.ts +4 -4
- package/internal/src/families/create-writable-selector-family.ts +2 -2
- package/internal/src/families/dispose-from-store.ts +3 -7
- package/internal/src/families/find-in-store.ts +9 -9
- package/internal/src/families/init-family-member.ts +25 -37
- package/internal/src/families/seek-in-store.ts +11 -10
- package/internal/src/get-state/get-from-store.ts +3 -3
- package/internal/src/molecule/grow-molecule-in-store.ts +9 -9
- package/internal/src/mutable/index.ts +0 -1
- package/internal/src/mutable/tracker-family.ts +2 -2
- package/internal/src/set-state/set-into-store.ts +4 -4
- package/internal/src/store/deposit.ts +3 -3
- package/internal/src/store/withdraw.ts +10 -9
- package/introspection/dist/index.js +32 -30
- package/introspection/package.json +1 -4
- package/json/dist/index.d.ts +10 -27
- package/json/dist/index.js +3 -3
- package/json/package.json +1 -4
- package/json/src/index.ts +8 -3
- package/json/src/select-json-family.ts +4 -4
- package/package.json +36 -65
- package/react/dist/index.d.ts +4 -4
- package/react/dist/index.js +2 -2
- package/react/package.json +1 -4
- package/react/src/parse-state-overloads.ts +4 -4
- package/react/src/use-i.ts +3 -3
- package/react/src/use-json.ts +3 -3
- package/react/src/use-o.ts +3 -3
- package/react-devtools/dist/index.d.ts +1 -1
- package/react-devtools/dist/index.js +90 -72
- package/react-devtools/package.json +1 -4
- package/react-devtools/src/StateIndex.tsx +5 -4
- package/realtime/dist/index.d.ts +3 -3
- package/realtime/dist/index.js +8 -9
- package/realtime/package.json +1 -4
- package/realtime/src/realtime-continuity.ts +2 -2
- package/realtime-client/dist/index.js +6 -6
- package/realtime-client/package.json +1 -4
- package/realtime-react/dist/index.d.ts +4 -4
- package/realtime-react/dist/index.js +9 -11
- package/realtime-react/package.json +1 -4
- package/realtime-react/src/use-pull-atom-family-member.ts +2 -2
- package/realtime-react/src/use-pull-mutable-family-member.ts +2 -2
- package/realtime-react/src/use-pull-selector-family-member.ts +2 -2
- package/realtime-server/dist/index.d.ts +9 -9
- package/realtime-server/dist/index.js +59 -54
- package/realtime-server/package.json +1 -4
- package/realtime-server/src/ipc-sockets/custom-socket.ts +2 -2
- package/realtime-server/src/realtime-family-provider.ts +3 -2
- package/realtime-server/src/realtime-mutable-family-provider.ts +2 -2
- package/realtime-testing/dist/index.js +3 -3
- package/realtime-testing/package.json +1 -4
- package/src/atom.ts +15 -42
- package/src/dispose-state.ts +2 -2
- package/src/get-state.ts +4 -4
- package/src/index.ts +5 -5
- package/src/molecule.ts +4 -3
- package/src/selector.ts +17 -39
- package/src/set-state.ts +3 -2
- package/src/silo.ts +4 -4
- package/transceivers/set-rtx/dist/index.js +11 -11
- package/transceivers/set-rtx/package.json +1 -4
- package/transceivers/set-rtx/src/set-rtx.ts +5 -5
- package/data/dist/index.cjs +0 -953
- package/dist/chunk-BF4MVQF6.js +0 -44
- package/dist/chunk-S4N6XNPH.js +0 -38
- package/dist/index.cjs +0 -215
- package/ephemeral/dist/index.cjs +0 -11
- package/eslint-plugin/dist/index.cjs +0 -388
- package/immortal/dist/index.cjs +0 -14
- package/internal/dist/index.cjs +0 -3405
- package/internal/src/mutable/is-mutable.ts +0 -16
- package/introspection/dist/index.cjs +0 -449
- package/json/dist/index.cjs +0 -128
- package/react/dist/index.cjs +0 -118
- package/react-devtools/dist/index.cjs +0 -2191
- package/realtime/dist/index.cjs +0 -120
- package/realtime-client/dist/index.cjs +0 -569
- package/realtime-react/dist/index.cjs +0 -189
- package/realtime-server/dist/index.cjs +0 -965
- package/realtime-testing/dist/index.cjs +0 -201
- package/transceivers/set-rtx/dist/index.cjs +0 -215
package/react/src/use-o.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReadableFamilyToken, ReadableToken } from "atom.io"
|
|
2
2
|
import { getFromStore, subscribeToState } from "atom.io/internal"
|
|
3
|
-
import type {
|
|
3
|
+
import type { Canonical } from "atom.io/json"
|
|
4
4
|
import * as React from "react"
|
|
5
5
|
|
|
6
6
|
import { parseStateOverloads } from "./parse-state-overloads"
|
|
@@ -8,12 +8,12 @@ import { StoreContext } from "./store-context"
|
|
|
8
8
|
|
|
9
9
|
export function useO<T>(token: ReadableToken<T>): T
|
|
10
10
|
|
|
11
|
-
export function useO<T, K extends
|
|
11
|
+
export function useO<T, K extends Canonical>(
|
|
12
12
|
token: ReadableFamilyToken<T, K>,
|
|
13
13
|
key: K,
|
|
14
14
|
): T
|
|
15
15
|
|
|
16
|
-
export function useO<T, K extends
|
|
16
|
+
export function useO<T, K extends Canonical>(
|
|
17
17
|
...params: [ReadableFamilyToken<T, K>, K] | [ReadableToken<T>]
|
|
18
18
|
): T {
|
|
19
19
|
const store = React.useContext(StoreContext)
|
|
@@ -69,7 +69,7 @@ declare const devtoolsAreOpenState: atom_io.RegularAtomToken<boolean>;
|
|
|
69
69
|
type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
|
|
70
70
|
declare const devtoolsViewSelectionState: atom_io.RegularAtomToken<DevtoolsView>;
|
|
71
71
|
declare const devtoolsViewOptionsState: atom_io.RegularAtomToken<DevtoolsView[]>;
|
|
72
|
-
declare const findViewIsOpenState: atom_io.
|
|
72
|
+
declare const findViewIsOpenState: atom_io.RegularAtomFamilyToken<boolean, string>;
|
|
73
73
|
declare const primitiveRefinery: Refinery<{
|
|
74
74
|
number: (input: unknown) => input is number;
|
|
75
75
|
string: (input: unknown) => input is string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { lazyLocalStorageEffect } from '../../dist/chunk-H6EDLPKH.js';
|
|
2
|
-
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-
|
|
3
|
-
import { JSON_TYPE_NAMES,
|
|
4
|
-
import
|
|
2
|
+
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-IW6WYRS7.js';
|
|
3
|
+
import { JSON_TYPE_NAMES, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-AK23DRMD.js';
|
|
4
|
+
import '../../dist/chunk-XWL6SNVU.js';
|
|
5
5
|
import { selectorFamily, atom, atomFamily, undo, redo, getState } from 'atom.io';
|
|
6
6
|
import { attachIntrospectionStates } from 'atom.io/introspection';
|
|
7
7
|
import { useI, useO } from 'atom.io/react';
|
|
@@ -18,7 +18,7 @@ var cannotExist = (_) => false;
|
|
|
18
18
|
|
|
19
19
|
// ../anvl/src/refinement/is-intersection.ts
|
|
20
20
|
function mustSatisfyAllOfTheFollowing(isTypeA, logging = false, refinements = [isTypeA]) {
|
|
21
|
-
const name = `(${refinements.map((r) =>
|
|
21
|
+
const name = `(${refinements.map((r) => r?.name || `anon`).join(` & `)})`;
|
|
22
22
|
const _ = {
|
|
23
23
|
[name]: (input) => refinements.every(
|
|
24
24
|
(refinement) => (logging && console.log(
|
|
@@ -42,19 +42,16 @@ var isIntersection = mustSatisfyAllOfTheFollowing(canExist);
|
|
|
42
42
|
|
|
43
43
|
// ../anvl/src/refinement/is-union.ts
|
|
44
44
|
var mustSatisfyOneOfTheFollowing = (isTypeA, logging = false, refinements = [isTypeA]) => {
|
|
45
|
-
const name = `(${refinements.map((r) =>
|
|
45
|
+
const name = `(${refinements.map((r) => r?.name || `anon`).join(` | `)})`;
|
|
46
46
|
const _ = {
|
|
47
47
|
[name]: (input) => refinements.some(
|
|
48
|
-
(refinement) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
refinement(input)
|
|
56
|
-
), refinement(input);
|
|
57
|
-
}
|
|
48
|
+
(refinement) => (logging && console.log(
|
|
49
|
+
refinements.map((r) => r.name || `anon`).join(` | `),
|
|
50
|
+
`>`,
|
|
51
|
+
refinement.name ?? `anon`,
|
|
52
|
+
`:`,
|
|
53
|
+
refinement(input)
|
|
54
|
+
), refinement(input))
|
|
58
55
|
)
|
|
59
56
|
};
|
|
60
57
|
const checkTypes = Object.assign(_[name], {
|
|
@@ -64,6 +61,17 @@ var mustSatisfyOneOfTheFollowing = (isTypeA, logging = false, refinements = [isT
|
|
|
64
61
|
};
|
|
65
62
|
var isUnion = mustSatisfyOneOfTheFollowing(cannotExist);
|
|
66
63
|
|
|
64
|
+
// ../anvl/src/primitive/index.ts
|
|
65
|
+
var isString = (input) => {
|
|
66
|
+
return typeof input === `string`;
|
|
67
|
+
};
|
|
68
|
+
var isNumber = (input) => {
|
|
69
|
+
return typeof input === `number`;
|
|
70
|
+
};
|
|
71
|
+
var isBoolean = (input) => {
|
|
72
|
+
return typeof input === `boolean`;
|
|
73
|
+
};
|
|
74
|
+
|
|
67
75
|
// ../anvl/src/refinement/refine-json.ts
|
|
68
76
|
var JSON_PROTOTYPES = [
|
|
69
77
|
`Array`,
|
|
@@ -76,16 +84,16 @@ var refineJsonType = (data) => data === null ? { type: `null`, data: null } : is
|
|
|
76
84
|
data === void 0 ? `undefined passed to refineJsonType. This is not valid JSON.` : `${stringifyJson(data)} with prototype "${Object.getPrototypeOf(data).constructor.name}" passed to refineJsonType. This is not valid JSON.`
|
|
77
85
|
);
|
|
78
86
|
var isJson = (input) => {
|
|
79
|
-
var _a2;
|
|
80
87
|
if (input === null) return true;
|
|
81
88
|
if (input === void 0) return false;
|
|
82
|
-
const prototype =
|
|
89
|
+
const prototype = Object.getPrototypeOf(input)?.constructor.name;
|
|
83
90
|
const refine = JSON_PROTOTYPES.includes(prototype);
|
|
84
91
|
return refine;
|
|
85
92
|
};
|
|
86
93
|
|
|
87
94
|
// ../anvl/src/refinement/refinery.ts
|
|
88
95
|
var Refinery = class {
|
|
96
|
+
supported;
|
|
89
97
|
constructor(supported) {
|
|
90
98
|
this.supported = supported;
|
|
91
99
|
}
|
|
@@ -191,6 +199,10 @@ function diffArray(a, b, recurse) {
|
|
|
191
199
|
return diffObject(a, b, recurse);
|
|
192
200
|
}
|
|
193
201
|
var Differ = class {
|
|
202
|
+
leafRefinery;
|
|
203
|
+
treeRefinery;
|
|
204
|
+
leafDiffers;
|
|
205
|
+
treeDiffers;
|
|
194
206
|
constructor(leafRefinery, treeRefinery, diffFunctions) {
|
|
195
207
|
this.leafRefinery = leafRefinery;
|
|
196
208
|
this.treeRefinery = treeRefinery;
|
|
@@ -206,7 +218,6 @@ var Differ = class {
|
|
|
206
218
|
}
|
|
207
219
|
}
|
|
208
220
|
diff(a, b) {
|
|
209
|
-
var _a2, _b2;
|
|
210
221
|
if (a === b) {
|
|
211
222
|
return { summary: `No Change` };
|
|
212
223
|
}
|
|
@@ -217,8 +228,8 @@ var Differ = class {
|
|
|
217
228
|
} catch (thrown) {
|
|
218
229
|
console.error(`Error stringifying`, a, b);
|
|
219
230
|
}
|
|
220
|
-
const aRefined =
|
|
221
|
-
const bRefined =
|
|
231
|
+
const aRefined = this.leafRefinery.refine(a) ?? this.treeRefinery.refine(a);
|
|
232
|
+
const bRefined = this.leafRefinery.refine(b) ?? this.treeRefinery.refine(b);
|
|
222
233
|
if (aRefined !== null && bRefined !== null) {
|
|
223
234
|
if (aRefined.type === bRefined.type) {
|
|
224
235
|
if (aRefined.type in this.leafDiffers) {
|
|
@@ -269,7 +280,6 @@ var button = {
|
|
|
269
280
|
OpenClose
|
|
270
281
|
};
|
|
271
282
|
var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
272
|
-
var _a2, _b2, _c, _d, _e, _f;
|
|
273
283
|
const inputRef = useRef(null);
|
|
274
284
|
const spanRef = useRef(null);
|
|
275
285
|
const [inputWidth, setInputWidth] = useState(`auto`);
|
|
@@ -277,8 +287,7 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
|
277
287
|
ref,
|
|
278
288
|
() => ({
|
|
279
289
|
focus: () => {
|
|
280
|
-
|
|
281
|
-
(_a3 = inputRef.current) == null ? void 0 : _a3.focus();
|
|
290
|
+
inputRef.current?.focus();
|
|
282
291
|
}
|
|
283
292
|
})
|
|
284
293
|
);
|
|
@@ -295,34 +304,36 @@ var ElasticInput = forwardRef(function ElasticInputFC(props, ref) {
|
|
|
295
304
|
clearInterval(interval);
|
|
296
305
|
};
|
|
297
306
|
}
|
|
298
|
-
}, [
|
|
307
|
+
}, [inputRef.current?.value, props.value]);
|
|
299
308
|
return /* @__PURE__ */ jsxs("div", { style: { display: `inline-block`, position: `relative` }, children: [
|
|
300
309
|
/* @__PURE__ */ jsx(
|
|
301
310
|
"input",
|
|
302
|
-
|
|
311
|
+
{
|
|
312
|
+
...props,
|
|
303
313
|
ref: inputRef,
|
|
304
|
-
style:
|
|
314
|
+
style: {
|
|
305
315
|
padding: 0,
|
|
306
316
|
borderRadius: 0,
|
|
307
317
|
border: `none`,
|
|
308
318
|
fontFamily: `inherit`,
|
|
309
319
|
fontSize: `inherit`,
|
|
310
|
-
width: inputWidth
|
|
311
|
-
|
|
312
|
-
|
|
320
|
+
width: inputWidth,
|
|
321
|
+
...props.style
|
|
322
|
+
}
|
|
323
|
+
}
|
|
313
324
|
),
|
|
314
325
|
/* @__PURE__ */ jsx(
|
|
315
326
|
"span",
|
|
316
327
|
{
|
|
317
328
|
ref: spanRef,
|
|
318
329
|
style: {
|
|
319
|
-
padding:
|
|
330
|
+
padding: props.style?.padding,
|
|
320
331
|
position: `absolute`,
|
|
321
332
|
visibility: `hidden`,
|
|
322
333
|
// color: `red`,
|
|
323
334
|
whiteSpace: `pre`,
|
|
324
|
-
fontFamily:
|
|
325
|
-
fontSize:
|
|
335
|
+
fontFamily: props.style?.fontFamily ?? `inherit`,
|
|
336
|
+
fontSize: props.style?.fontSize ?? `inherit`
|
|
326
337
|
},
|
|
327
338
|
children: props.value
|
|
328
339
|
}
|
|
@@ -360,9 +371,12 @@ var initRefinery = (constraints) => (input) => {
|
|
|
360
371
|
if (input === null && constraints.nullable === true) {
|
|
361
372
|
return null;
|
|
362
373
|
}
|
|
363
|
-
const { max, min, decimalPlaces } =
|
|
374
|
+
const { max, min, decimalPlaces } = {
|
|
375
|
+
...DEFAULT_NUMBER_CONSTRAINTS,
|
|
376
|
+
...constraints
|
|
377
|
+
};
|
|
364
378
|
const constrained = pipe(
|
|
365
|
-
input
|
|
379
|
+
input ?? 0,
|
|
366
380
|
clampInto(min, max),
|
|
367
381
|
(n) => decimalPlaces ? round(n, decimalPlaces) : n
|
|
368
382
|
);
|
|
@@ -396,20 +410,19 @@ var NumberInput = ({
|
|
|
396
410
|
const allowDecimal = decimalPlaces === void 0 || decimalPlaces > 0;
|
|
397
411
|
const handleBlur = () => {
|
|
398
412
|
if (userHasMadeDeliberateChange.current) {
|
|
399
|
-
set(refine(value
|
|
413
|
+
set(refine(value ?? null));
|
|
400
414
|
setTemporaryEntry(null);
|
|
401
415
|
}
|
|
402
416
|
userHasMadeDeliberateChange.current = false;
|
|
403
417
|
};
|
|
404
418
|
const handleChange = (event) => {
|
|
405
|
-
var _a2;
|
|
406
419
|
if (onChange) onChange(event);
|
|
407
420
|
if (set === void 0) return;
|
|
408
421
|
userHasMadeDeliberateChange.current = true;
|
|
409
422
|
const input = event.target.value;
|
|
410
423
|
if (isValidNonNumber(input) || isDecimalInProgress(input)) {
|
|
411
424
|
setTemporaryEntry(input);
|
|
412
|
-
const textInterpretation = isDecimalInProgress(input) ? input :
|
|
425
|
+
const textInterpretation = isDecimalInProgress(input) ? input : min?.toString() ?? `0`;
|
|
413
426
|
const newValue = textToValue(textInterpretation, allowDecimal);
|
|
414
427
|
set(refine(newValue));
|
|
415
428
|
return;
|
|
@@ -421,7 +434,7 @@ var NumberInput = ({
|
|
|
421
434
|
set(refine(numericValue));
|
|
422
435
|
}
|
|
423
436
|
};
|
|
424
|
-
const displayValue = temporaryEntry
|
|
437
|
+
const displayValue = temporaryEntry ?? valueToText(value ? refine(value) : value);
|
|
425
438
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
426
439
|
label && /* @__PURE__ */ jsx("label", { htmlFor: id, children: label }),
|
|
427
440
|
autoSize ? /* @__PURE__ */ jsx(
|
|
@@ -429,28 +442,28 @@ var NumberInput = ({
|
|
|
429
442
|
{
|
|
430
443
|
type: "text",
|
|
431
444
|
value: displayValue,
|
|
432
|
-
placeholder: placeholder
|
|
445
|
+
placeholder: placeholder ?? `-`,
|
|
433
446
|
onChange: handleChange,
|
|
434
447
|
onBlur: handleBlur,
|
|
435
448
|
disabled,
|
|
436
|
-
name: name
|
|
449
|
+
name: name ?? id,
|
|
437
450
|
id,
|
|
438
451
|
onClick,
|
|
439
|
-
"data-testid": `number-input-${testId
|
|
452
|
+
"data-testid": `number-input-${testId ?? id}`
|
|
440
453
|
}
|
|
441
454
|
) : /* @__PURE__ */ jsx(
|
|
442
455
|
"input",
|
|
443
456
|
{
|
|
444
457
|
type: "text",
|
|
445
458
|
value: displayValue,
|
|
446
|
-
placeholder: placeholder
|
|
459
|
+
placeholder: placeholder ?? `-`,
|
|
447
460
|
onChange: handleChange,
|
|
448
461
|
onBlur: handleBlur,
|
|
449
462
|
disabled,
|
|
450
|
-
name: name
|
|
463
|
+
name: name ?? id,
|
|
451
464
|
id,
|
|
452
465
|
onClick,
|
|
453
|
-
"data-testid": `number-input-${testId
|
|
466
|
+
"data-testid": `number-input-${testId ?? id}`
|
|
454
467
|
}
|
|
455
468
|
)
|
|
456
469
|
] });
|
|
@@ -469,7 +482,7 @@ var TextInput = ({
|
|
|
469
482
|
{
|
|
470
483
|
type: "text",
|
|
471
484
|
value,
|
|
472
|
-
onChange: (e) => set
|
|
485
|
+
onChange: (e) => set?.(e.target.value),
|
|
473
486
|
disabled: set === void 0,
|
|
474
487
|
placeholder
|
|
475
488
|
}
|
|
@@ -478,7 +491,7 @@ var TextInput = ({
|
|
|
478
491
|
{
|
|
479
492
|
type: "text",
|
|
480
493
|
value,
|
|
481
|
-
onChange: (e) => set
|
|
494
|
+
onChange: (e) => set?.(e.target.value),
|
|
482
495
|
disabled: set === void 0,
|
|
483
496
|
placeholder
|
|
484
497
|
}
|
|
@@ -683,7 +696,7 @@ var retrieveRef = ({
|
|
|
683
696
|
refMap = result.refMap;
|
|
684
697
|
}
|
|
685
698
|
if (isJsonSchema(node)) {
|
|
686
|
-
return { node, refMap:
|
|
699
|
+
return { node, refMap: { ...refMap, [$ref]: node } };
|
|
687
700
|
}
|
|
688
701
|
throw new TypeError(`The refNode is not a JsonSchema`);
|
|
689
702
|
};
|
|
@@ -808,12 +821,19 @@ var negationSchemaStructure = { not: isJsonSchema };
|
|
|
808
821
|
function isNegationSchema(input) {
|
|
809
822
|
return doesExtend(negationSchemaStructure)(input);
|
|
810
823
|
}
|
|
811
|
-
var mixedSchemaStructure =
|
|
824
|
+
var mixedSchemaStructure = {
|
|
825
|
+
...arraySchemaStructure,
|
|
826
|
+
...booleanSchemaStructure,
|
|
827
|
+
...integerSchemaStructure,
|
|
828
|
+
...nullSchemaStructure,
|
|
829
|
+
...numberSchemaStructure,
|
|
830
|
+
...objectSchemaStructure,
|
|
831
|
+
...stringSchemaStructure,
|
|
812
832
|
type: isArray(isWithin(JSON_SCHEMA_TYPE_NAMES)),
|
|
813
833
|
enum: ifDefined(
|
|
814
834
|
isArray(isUnion.or(isInteger).or(isBoolean).or(isNumber).or(isString))
|
|
815
835
|
)
|
|
816
|
-
}
|
|
836
|
+
};
|
|
817
837
|
function isMixedSchema(input) {
|
|
818
838
|
return doesExtend(mixedSchemaStructure)(input);
|
|
819
839
|
}
|
|
@@ -899,10 +919,7 @@ var stringToObject = (str) => {
|
|
|
899
919
|
};
|
|
900
920
|
var objectToString = (obj) => JSON.stringify(obj);
|
|
901
921
|
var objectToBoolean = (obj) => obj.true === true;
|
|
902
|
-
var objectToNumber = (obj) =>
|
|
903
|
-
var _a2, _b2, _c;
|
|
904
|
-
return Number((_c = (_b2 = (_a2 = obj.number) != null ? _a2 : obj.size) != null ? _b2 : obj.count) != null ? _c : 0);
|
|
905
|
-
};
|
|
922
|
+
var objectToNumber = (obj) => Number(obj.number ?? obj.size ?? obj.count ?? 0);
|
|
906
923
|
var objectToArray = (obj) => Object.entries(obj);
|
|
907
924
|
var booleanToString = (bool) => bool.toString();
|
|
908
925
|
var booleanToNumber = (bool) => +bool;
|
|
@@ -1026,7 +1043,7 @@ var castToJson = (input) => {
|
|
|
1026
1043
|
var makePropertySetters = (data, set) => mapObject(
|
|
1027
1044
|
data,
|
|
1028
1045
|
(value, key) => (newValue) => {
|
|
1029
|
-
set(
|
|
1046
|
+
set({ ...data, [key]: become(newValue)(value[key]) });
|
|
1030
1047
|
}
|
|
1031
1048
|
);
|
|
1032
1049
|
var makePropertyRenamers = (data, set, stableKeyMapRef) => mapObject(
|
|
@@ -1038,9 +1055,10 @@ var makePropertyRenamers = (data, set, stableKeyMapRef) => mapObject(
|
|
|
1038
1055
|
const index = entries.findIndex(([k]) => k === key);
|
|
1039
1056
|
entries[index] = [newKey, value];
|
|
1040
1057
|
const stableKeyMap = stableKeyMapRef.current;
|
|
1041
|
-
stableKeyMapRef.current =
|
|
1058
|
+
stableKeyMapRef.current = {
|
|
1059
|
+
...stableKeyMap,
|
|
1042
1060
|
[newKey]: stableKeyMap[key]
|
|
1043
|
-
}
|
|
1061
|
+
};
|
|
1044
1062
|
return Object.fromEntries(entries);
|
|
1045
1063
|
});
|
|
1046
1064
|
}
|
|
@@ -1048,20 +1066,21 @@ var makePropertyRenamers = (data, set, stableKeyMapRef) => mapObject(
|
|
|
1048
1066
|
);
|
|
1049
1067
|
var makePropertyRemovers = (data, set) => mapObject(data, (_, key) => () => {
|
|
1050
1068
|
set(() => {
|
|
1051
|
-
const
|
|
1069
|
+
const { [key]: __, ...rest } = data;
|
|
1052
1070
|
return rest;
|
|
1053
1071
|
});
|
|
1054
1072
|
});
|
|
1055
1073
|
var makePropertyRecasters = (data, set) => mapObject(
|
|
1056
1074
|
data,
|
|
1057
1075
|
(value, key) => (newType) => {
|
|
1058
|
-
set(() =>
|
|
1076
|
+
set(() => ({
|
|
1077
|
+
...data,
|
|
1059
1078
|
[key]: castToJson(value).to[newType]()
|
|
1060
1079
|
}));
|
|
1061
1080
|
}
|
|
1062
1081
|
);
|
|
1063
1082
|
var makePropertyCreationInterface = (data, set) => (key, type) => (value) => {
|
|
1064
|
-
set(
|
|
1083
|
+
set({ ...data, [key]: value ?? JSON_DEFAULTS[type] });
|
|
1065
1084
|
};
|
|
1066
1085
|
var makePropertySorter = (data, set, sortFn) => () => {
|
|
1067
1086
|
const sortedKeys = Object.keys(data).sort(sortFn);
|
|
@@ -1100,7 +1119,6 @@ var ObjectEditor = ({
|
|
|
1100
1119
|
set,
|
|
1101
1120
|
Components
|
|
1102
1121
|
}) => {
|
|
1103
|
-
var _a2;
|
|
1104
1122
|
const disabled = isReadonly(path);
|
|
1105
1123
|
const stableKeyMap = useRef(
|
|
1106
1124
|
Object.keys(data).reduce(
|
|
@@ -1118,7 +1136,7 @@ var ObjectEditor = ({
|
|
|
1118
1136
|
const sortProperties = makePropertySorter(data, set);
|
|
1119
1137
|
const makePropertyAdder = makePropertyCreationInterface(data, set);
|
|
1120
1138
|
const subSchema = isPlainObject(schema) ? findSubSchema(schema)(path) : true;
|
|
1121
|
-
const schemaKeys = isLiteral(true)(subSchema) ? true : isObjectSchema(subSchema) ? Object.keys(
|
|
1139
|
+
const schemaKeys = isLiteral(true)(subSchema) ? true : isObjectSchema(subSchema) ? Object.keys(subSchema.properties ?? {}) : [];
|
|
1122
1140
|
const dataKeys = Object.keys(data);
|
|
1123
1141
|
const [unofficialKeys, officialKeys] = dataKeys.reduce(
|
|
1124
1142
|
([unofficial, official], key) => {
|
|
@@ -1240,9 +1258,8 @@ var StringEditor = ({
|
|
|
1240
1258
|
) });
|
|
1241
1259
|
};
|
|
1242
1260
|
var DefaultFallback = ({ error, errorInfo }) => {
|
|
1243
|
-
|
|
1244
|
-
const
|
|
1245
|
-
const message = (_c = (_b2 = error == null ? void 0 : error.toString()) != null ? _b2 : errorInfo == null ? void 0 : errorInfo.componentStack) != null ? _c : `Unknown error`;
|
|
1261
|
+
const component = errorInfo?.componentStack?.split(` `).filter(Boolean)[2];
|
|
1262
|
+
const message = error?.toString() ?? errorInfo?.componentStack ?? `Unknown error`;
|
|
1246
1263
|
return /* @__PURE__ */ jsx(
|
|
1247
1264
|
"div",
|
|
1248
1265
|
{
|
|
@@ -1292,8 +1309,7 @@ var ErrorBoundary = class extends Component {
|
|
|
1292
1309
|
this.state = {};
|
|
1293
1310
|
}
|
|
1294
1311
|
componentDidCatch(error, errorInfo) {
|
|
1295
|
-
|
|
1296
|
-
(_b2 = (_a2 = this.props).onError) == null ? void 0 : _b2.call(_a2, error, errorInfo);
|
|
1312
|
+
this.props.onError?.(error, errorInfo);
|
|
1297
1313
|
this.setState({
|
|
1298
1314
|
error,
|
|
1299
1315
|
errorInfo
|
|
@@ -1363,7 +1379,10 @@ var JsonEditor = ({
|
|
|
1363
1379
|
style,
|
|
1364
1380
|
Components: CustomComponents = {}
|
|
1365
1381
|
}) => {
|
|
1366
|
-
const Components =
|
|
1382
|
+
const Components = {
|
|
1383
|
+
...DEFAULT_JSON_EDITOR_COMPONENTS,
|
|
1384
|
+
...CustomComponents
|
|
1385
|
+
};
|
|
1367
1386
|
return /* @__PURE__ */ jsx(
|
|
1368
1387
|
JsonEditor_INTERNAL,
|
|
1369
1388
|
{
|
|
@@ -1443,7 +1462,6 @@ var findStateTypeState = selectorFamily({
|
|
|
1443
1462
|
}
|
|
1444
1463
|
});
|
|
1445
1464
|
var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
|
|
1446
|
-
var _a2, _b2;
|
|
1447
1465
|
const setIsOpen = useI(isOpenState);
|
|
1448
1466
|
const isOpen = useO(isOpenState);
|
|
1449
1467
|
const state = useO(node);
|
|
@@ -1470,7 +1488,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
|
|
|
1470
1488
|
console.log(node, getState(node));
|
|
1471
1489
|
},
|
|
1472
1490
|
children: [
|
|
1473
|
-
/* @__PURE__ */ jsx("h2", { children:
|
|
1491
|
+
/* @__PURE__ */ jsx("h2", { children: node.family?.subKey ?? node.key }),
|
|
1474
1492
|
/* @__PURE__ */ jsxs("span", { className: "type detail", children: [
|
|
1475
1493
|
"(",
|
|
1476
1494
|
stateType,
|
|
@@ -1489,7 +1507,7 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
|
|
|
1489
1507
|
const isOpen = useO(isOpenState);
|
|
1490
1508
|
for (const [key, childNode] of node.familyMembers) {
|
|
1491
1509
|
findState(findViewIsOpenState, key);
|
|
1492
|
-
findState(findStateTypeState, childNode);
|
|
1510
|
+
findState(findStateTypeState, childNode.key);
|
|
1493
1511
|
}
|
|
1494
1512
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1495
1513
|
/* @__PURE__ */ jsxs("header", { children: [
|
|
@@ -1511,7 +1529,7 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
|
|
|
1511
1529
|
{
|
|
1512
1530
|
node: childNode,
|
|
1513
1531
|
isOpenState: findState(findViewIsOpenState, childNode.key),
|
|
1514
|
-
typeState: findState(findStateTypeState, childNode)
|
|
1532
|
+
typeState: findState(findStateTypeState, childNode.key)
|
|
1515
1533
|
},
|
|
1516
1534
|
key
|
|
1517
1535
|
)) : null
|
|
@@ -1535,7 +1553,7 @@ var StateIndex = ({ tokenIndex }) => {
|
|
|
1535
1553
|
{
|
|
1536
1554
|
node,
|
|
1537
1555
|
isOpenState: findState(findViewIsOpenState, node.key),
|
|
1538
|
-
typeState: findState(findStateTypeState, node)
|
|
1556
|
+
typeState: findState(findStateTypeState, node.key)
|
|
1539
1557
|
},
|
|
1540
1558
|
key
|
|
1541
1559
|
);
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
"name": "atom.io-react-devtools",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": true,
|
|
5
|
-
"main": "dist/index.
|
|
6
|
-
"module": "dist/index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
7
6
|
"types": "dist/index.d.ts",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": {
|
|
10
9
|
"import": "./dist/index.js",
|
|
11
|
-
"browser": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.cjs",
|
|
13
10
|
"types": "./dist/index.d.ts"
|
|
14
11
|
}
|
|
15
12
|
}
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
import { getState, selectorFamily } from "atom.io"
|
|
7
7
|
import { findState } from "atom.io/ephemeral"
|
|
8
8
|
import type { FamilyNode, WritableTokenIndex } from "atom.io/introspection"
|
|
9
|
+
import type { Canonical } from "atom.io/json"
|
|
9
10
|
import { useI, useO } from "atom.io/react"
|
|
10
11
|
import type { FC } from "react"
|
|
11
12
|
|
|
@@ -15,7 +16,7 @@ import { findViewIsOpenState, primitiveRefinery } from "."
|
|
|
15
16
|
import { button } from "./Button"
|
|
16
17
|
import { StoreEditor } from "./StateEditor"
|
|
17
18
|
|
|
18
|
-
const findStateTypeState = selectorFamily<string,
|
|
19
|
+
const findStateTypeState = selectorFamily<string, Canonical>({
|
|
19
20
|
key: `👁🗨 State Type`,
|
|
20
21
|
get:
|
|
21
22
|
(token) =>
|
|
@@ -83,7 +84,7 @@ export const StateIndexTreeNode: FC<{
|
|
|
83
84
|
const isOpen = useO(isOpenState)
|
|
84
85
|
for (const [key, childNode] of node.familyMembers) {
|
|
85
86
|
findState(findViewIsOpenState, key)
|
|
86
|
-
findState(findStateTypeState, childNode)
|
|
87
|
+
findState(findStateTypeState, childNode.key)
|
|
87
88
|
}
|
|
88
89
|
return (
|
|
89
90
|
<>
|
|
@@ -104,7 +105,7 @@ export const StateIndexTreeNode: FC<{
|
|
|
104
105
|
key={key}
|
|
105
106
|
node={childNode}
|
|
106
107
|
isOpenState={findState(findViewIsOpenState, childNode.key)}
|
|
107
|
-
typeState={findState(findStateTypeState, childNode)}
|
|
108
|
+
typeState={findState(findStateTypeState, childNode.key)}
|
|
108
109
|
/>
|
|
109
110
|
))
|
|
110
111
|
: null}
|
|
@@ -147,7 +148,7 @@ export const StateIndex: FC<{
|
|
|
147
148
|
key={key}
|
|
148
149
|
node={node}
|
|
149
150
|
isOpenState={findState(findViewIsOpenState, node.key)}
|
|
150
|
-
typeState={findState(findStateTypeState, node)}
|
|
151
|
+
typeState={findState(findStateTypeState, node.key)}
|
|
151
152
|
/>
|
|
152
153
|
)
|
|
153
154
|
})}
|
package/realtime/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as atom_io from 'atom.io';
|
|
2
2
|
import { AtomFamilyToken, ReadableFamilyToken, ReadableToken, AtomToken, TransactionToken, MutableAtomToken } from 'atom.io';
|
|
3
|
-
import { Json } from 'atom.io/json';
|
|
3
|
+
import { Canonical, Json } from 'atom.io/json';
|
|
4
4
|
import * as atom_io_data from 'atom.io/data';
|
|
5
5
|
import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ type ContinuityToken = {
|
|
|
18
18
|
readonly key: string;
|
|
19
19
|
readonly globals: AtomToken<any>[];
|
|
20
20
|
readonly actions: TransactionToken<any>[];
|
|
21
|
-
readonly perspectives: PerspectiveToken<AtomFamilyToken<any,
|
|
21
|
+
readonly perspectives: PerspectiveToken<AtomFamilyToken<any, Canonical>, Json.Serializable>[];
|
|
22
22
|
};
|
|
23
23
|
declare class SyncGroup {
|
|
24
24
|
protected readonly key: string;
|
|
@@ -46,6 +46,6 @@ type UserInRoomMeta = {
|
|
|
46
46
|
};
|
|
47
47
|
declare const DEFAULT_USER_IN_ROOM_META: UserInRoomMeta;
|
|
48
48
|
declare const usersInRooms: atom_io_data.JoinToken<"room", "user", "1:n", UserInRoomMeta>;
|
|
49
|
-
declare const usersInMyRoomView: atom_io.
|
|
49
|
+
declare const usersInMyRoomView: atom_io.ReadonlySelectorFamilyToken<MutableAtomToken<SetRTX<string>, SetRTXJson<string>>[], string>;
|
|
50
50
|
|
|
51
51
|
export { type ContinuityOptions, type ContinuityToken, DEFAULT_USER_IN_ROOM_META, InvariantMap, type PerspectiveToken, SyncGroup, type UserInRoomMeta, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
|
package/realtime/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../../dist/chunk-
|
|
2
|
-
import { assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity
|
|
1
|
+
import '../../dist/chunk-XWL6SNVU.js';
|
|
2
|
+
import { getUpdateToken, assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from 'atom.io/internal';
|
|
3
3
|
import { atom, selectorFamily } from 'atom.io';
|
|
4
4
|
import { join, getInternalRelations } from 'atom.io/data';
|
|
5
5
|
import { SetRTX } from 'atom.io/transceivers/set-rtx';
|
|
@@ -19,14 +19,15 @@ var InvariantMap = class extends Map {
|
|
|
19
19
|
throw new Error(`Cannot clear an InvariantMap`);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var SyncGroup = class _SyncGroup {
|
|
23
23
|
constructor(key) {
|
|
24
24
|
this.key = key;
|
|
25
|
-
this.type = `continuity`;
|
|
26
|
-
this.globals = [];
|
|
27
|
-
this.actions = [];
|
|
28
|
-
this.perspectives = [];
|
|
29
25
|
}
|
|
26
|
+
type = `continuity`;
|
|
27
|
+
globals = [];
|
|
28
|
+
actions = [];
|
|
29
|
+
perspectives = [];
|
|
30
|
+
static existing = new InvariantMap();
|
|
30
31
|
static create(key, builder) {
|
|
31
32
|
const group = new _SyncGroup(key);
|
|
32
33
|
const { type, globals, actions, perspectives } = builder(group);
|
|
@@ -62,8 +63,6 @@ var _SyncGroup = class _SyncGroup {
|
|
|
62
63
|
return this;
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
_SyncGroup.existing = new InvariantMap();
|
|
66
|
-
var SyncGroup = _SyncGroup;
|
|
67
66
|
function continuity(options) {
|
|
68
67
|
const { key, config } = options;
|
|
69
68
|
const token = SyncGroup.create(key, config);
|
package/realtime/package.json
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
"name": "atom.io-realtime",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": true,
|
|
5
|
-
"main": "dist/index.
|
|
6
|
-
"module": "dist/index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
7
6
|
"types": "dist/index.d.ts",
|
|
8
7
|
"exports": {
|
|
9
8
|
".": {
|
|
10
9
|
"import": "./dist/index.js",
|
|
11
|
-
"browser": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.cjs",
|
|
13
10
|
"types": "./dist/index.d.ts"
|
|
14
11
|
}
|
|
15
12
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
IMPLICIT,
|
|
12
12
|
setEpochNumberOfContinuity,
|
|
13
13
|
} from "atom.io/internal"
|
|
14
|
-
import type { Json } from "atom.io/json"
|
|
14
|
+
import type { Canonical, Json } from "atom.io/json"
|
|
15
15
|
|
|
16
16
|
export class InvariantMap<K, V> extends Map<K, V> {
|
|
17
17
|
public set(key: K, value: V): this {
|
|
@@ -45,7 +45,7 @@ export type ContinuityToken = {
|
|
|
45
45
|
readonly globals: AtomToken<any>[]
|
|
46
46
|
readonly actions: TransactionToken<any>[]
|
|
47
47
|
readonly perspectives: PerspectiveToken<
|
|
48
|
-
AtomFamilyToken<any,
|
|
48
|
+
AtomFamilyToken<any, Canonical>,
|
|
49
49
|
Json.Serializable
|
|
50
50
|
>[]
|
|
51
51
|
}
|