atom.io 0.32.2 → 0.32.4
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/README.md +17 -37
- package/data/dist/index.js +1 -1
- package/data/src/struct.ts +1 -0
- package/dist/{chunk-RXQWAO26.js → chunk-7SJVR7FZ.js} +111 -119
- package/dist/{chunk-XN3EO2UT.js → chunk-IR77IXS7.js} +6 -3
- package/dist/{chunk-NDTM5IY3.js → chunk-PG57JXN4.js} +2 -2
- package/dist/{chunk-QRPY4LSO.js → chunk-PXB4YZDI.js} +4 -4
- package/dist/{chunk-KMBRCA5Q.js → chunk-Q6OOJWM4.js} +33 -31
- package/dist/{chunk-HEEVASKG.js → chunk-TJPLOX7Z.js} +4 -6
- package/dist/{chunk-YPME5OLO.js → chunk-U4K63VLA.js} +1 -1
- package/dist/index.js +1 -1
- package/eslint-plugin/dist/index.d.ts +2 -15
- package/internal/dist/index.d.ts +10 -4
- package/internal/dist/index.js +1 -1
- package/internal/src/families/create-writable-selector-family.ts +4 -2
- package/internal/src/get-state/read-or-compute-value.ts +23 -13
- package/internal/src/index.ts +2 -1
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -12
- package/internal/src/join/find-relations-in-store.ts +12 -0
- package/internal/src/reserved-keys.ts +7 -0
- package/internal/src/selector/register-selector.ts +2 -1
- package/internal/src/set-state/copy-mutable-if-needed.ts +12 -11
- package/internal/src/set-state/set-atom-or-selector.ts +1 -1
- package/internal/src/set-state/set-atom.ts +43 -21
- package/internal/src/store/store.ts +11 -8
- package/internal/src/transaction/build-transaction.ts +2 -1
- package/internal/src/transaction/get-epoch-number.ts +15 -19
- package/internal/src/transaction/set-epoch-number.ts +2 -2
- package/introspection/dist/index.js +2 -2
- package/introspection/src/attach-atom-index.ts +16 -14
- package/introspection/src/attach-selector-index.ts +16 -14
- package/json/dist/index.js +1 -1
- package/package.json +26 -24
- package/react/dist/index.js +2 -2
- package/react/src/use-i.ts +3 -5
- package/react-devtools/dist/index.d.ts +12 -3
- package/react-devtools/dist/index.js +80 -68
- package/react-devtools/src/AtomIODevtools.tsx +10 -2
- package/react-devtools/src/error-boundary/ReactErrorBoundary.tsx +1 -1
- package/react-devtools/src/json-editor/developer-interface.tsx +2 -2
- package/react-devtools/src/json-editor/editors-by-type/utilities/cast-json.ts +2 -2
- package/react-devtools/src/json-editor/editors-by-type/utilities/object-properties.ts +3 -3
- package/react-devtools/src/json-editor/index.ts +2 -5
- package/react-devtools/src/json-editor/json-editor-internal.tsx +4 -2
- package/realtime/dist/index.js +2 -2
- package/realtime-client/dist/index.js +2 -2
- package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +5 -2
- package/realtime-react/dist/index.js +4 -4
- package/realtime-react/src/use-single-effect.ts +2 -1
- package/realtime-server/dist/index.js +3 -3
- package/realtime-server/src/ipc-sockets/child-socket.ts +1 -1
- package/realtime-testing/dist/index.js +6 -6
- package/transceivers/set-rtx/dist/index.js +1 -1
- package/internal/src/set-state/stow-update.ts +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.4",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -52,45 +52,45 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@testing-library/react": "16.
|
|
55
|
+
"@testing-library/react": "16.3.0",
|
|
56
56
|
"@types/eslint": "9.6.1",
|
|
57
57
|
"@types/estree": "1.0.6",
|
|
58
58
|
"@types/http-proxy": "1.17.16",
|
|
59
59
|
"@types/npmlog": "7.0.0",
|
|
60
|
-
"@types/react": "19.0
|
|
60
|
+
"@types/react": "19.1.0",
|
|
61
61
|
"@types/tmp": "0.2.6",
|
|
62
|
-
"@typescript-eslint/parser": "8.
|
|
63
|
-
"@typescript-eslint/rule-tester": "8.
|
|
64
|
-
"@typescript-eslint/utils": "8.
|
|
65
|
-
"@vitest/coverage-v8": "3.
|
|
66
|
-
"@vitest/ui": "3.
|
|
67
|
-
"bun-types": "1.2.
|
|
62
|
+
"@typescript-eslint/parser": "8.29.1",
|
|
63
|
+
"@typescript-eslint/rule-tester": "8.29.1",
|
|
64
|
+
"@typescript-eslint/utils": "8.29.1",
|
|
65
|
+
"@vitest/coverage-v8": "3.1.1",
|
|
66
|
+
"@vitest/ui": "3.1.1",
|
|
67
|
+
"bun-types": "1.2.9",
|
|
68
68
|
"concurrently": "9.1.2",
|
|
69
|
-
"drizzle-kit": "0.30.
|
|
70
|
-
"drizzle-orm": "0.
|
|
71
|
-
"eslint": "9.
|
|
72
|
-
"happy-dom": "17.
|
|
69
|
+
"drizzle-kit": "0.30.6",
|
|
70
|
+
"drizzle-orm": "0.41.0",
|
|
71
|
+
"eslint": "9.24.0",
|
|
72
|
+
"happy-dom": "17.4.4",
|
|
73
73
|
"http-proxy": "1.18.1",
|
|
74
|
-
"motion": "12.
|
|
74
|
+
"motion": "12.6.3",
|
|
75
75
|
"npmlog": "7.0.1",
|
|
76
76
|
"nyc": "17.1.0",
|
|
77
77
|
"postgres": "3.4.5",
|
|
78
|
-
"preact": "10.26.
|
|
79
|
-
"react": "19.
|
|
80
|
-
"react-dom": "19.
|
|
81
|
-
"react-router-dom": "7.
|
|
78
|
+
"preact": "10.26.5",
|
|
79
|
+
"react": "19.1.0",
|
|
80
|
+
"react-dom": "19.1.0",
|
|
81
|
+
"react-router-dom": "7.5.0",
|
|
82
|
+
"recoverage": "0.1.7",
|
|
82
83
|
"socket.io": "4.8.1",
|
|
83
84
|
"socket.io-client": "4.8.1",
|
|
84
85
|
"tmp": "0.2.3",
|
|
85
86
|
"tsup": "8.4.0",
|
|
86
87
|
"tsx": "4.19.3",
|
|
87
|
-
"typescript": "5.8.
|
|
88
|
-
"vite": "6.2.
|
|
88
|
+
"typescript": "5.8.3",
|
|
89
|
+
"vite": "6.2.6",
|
|
89
90
|
"vite-tsconfig-paths": "5.1.4",
|
|
90
|
-
"vitest": "3.
|
|
91
|
+
"vitest": "3.1.1",
|
|
91
92
|
"zod": "3.24.2",
|
|
92
|
-
"
|
|
93
|
-
"break-check": "0.6.6"
|
|
93
|
+
"break-check": "0.6.10"
|
|
94
94
|
},
|
|
95
95
|
"main": "dist/index.js",
|
|
96
96
|
"types": "dist/index.d.ts",
|
|
@@ -243,7 +243,9 @@
|
|
|
243
243
|
"watch:types": "tsc --watch --noEmit",
|
|
244
244
|
"lint": "concurrently \"bun:lint:*\"",
|
|
245
245
|
"test": "vitest",
|
|
246
|
-
"test:coverage": "
|
|
246
|
+
"test:coverage": "pnpm test:coverage:once && pnpm test:coverage:increased",
|
|
247
|
+
"test:coverage:once": "vitest run --coverage",
|
|
248
|
+
"test:coverage:increased": "recoverage",
|
|
247
249
|
"test:build": "bun run test:manifest && cross-env IMPORT=dist vitest run",
|
|
248
250
|
"test:once": "echo tested built code",
|
|
249
251
|
"test:once:public": "cross-env IMPORT=dist vitest run public",
|
package/react/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { StoreContext, StoreProvider, useI, useJSON, useO, useTL } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
1
|
+
export { StoreContext, StoreProvider, useI, useJSON, useO, useTL } from '../../dist/chunk-TJPLOX7Z.js';
|
|
2
|
+
import '../../dist/chunk-7SJVR7FZ.js';
|
|
3
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
package/react/src/use-i.ts
CHANGED
|
@@ -20,13 +20,11 @@ export function useI<T, K extends Canonical>(
|
|
|
20
20
|
): <New extends T>(next: New | ((old: T) => New)) => void {
|
|
21
21
|
const store = React.useContext(StoreContext)
|
|
22
22
|
const token = parseStateOverloads(store, ...params)
|
|
23
|
-
const setter: React.
|
|
23
|
+
const setter: React.RefObject<
|
|
24
24
|
(<New extends T>(next: New | ((old: T) => New)) => void) | null
|
|
25
25
|
> = React.useRef(null)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
setIntoStore(store, token, next)
|
|
29
|
-
}
|
|
26
|
+
setter.current ??= (next) => {
|
|
27
|
+
setIntoStore(store, token, next)
|
|
30
28
|
}
|
|
31
29
|
return setter.current
|
|
32
30
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
1
2
|
import { DetailedHTMLProps, InputHTMLAttributes, ForwardRefExoticComponent, FC, ErrorInfo, ReactNode, Component, CSSProperties, ReactElement } from 'react';
|
|
3
|
+
import * as atom_io_json from 'atom.io/json';
|
|
2
4
|
import { JsonTypes, Json } from 'atom.io/json';
|
|
3
5
|
|
|
4
6
|
declare const AtomIODevtools: React.FC;
|
|
@@ -131,7 +133,7 @@ type JsonEditorProps<T> = {
|
|
|
131
133
|
set: (valOrUpdater: T | ((currVal: T) => T)) => void;
|
|
132
134
|
name?: string | undefined;
|
|
133
135
|
rename?: ((newKey: string) => void) | undefined;
|
|
134
|
-
remove?: () => void;
|
|
136
|
+
remove?: (() => void) | undefined;
|
|
135
137
|
path?: ReadonlyArray<number | string>;
|
|
136
138
|
isReadonly?: (path: ReadonlyArray<number | string>) => boolean;
|
|
137
139
|
isHidden?: (path: ReadonlyArray<number | string>) => boolean;
|
|
@@ -141,7 +143,7 @@ type JsonEditorProps<T> = {
|
|
|
141
143
|
data: T;
|
|
142
144
|
}>;
|
|
143
145
|
Components?: Partial<JsonEditorComponents>;
|
|
144
|
-
testid?: string;
|
|
146
|
+
testid?: string | undefined;
|
|
145
147
|
};
|
|
146
148
|
declare const JsonEditor: <T>({ data, set, name, rename, remove, isReadonly, isHidden, className, Header, style, Components: CustomComponents, testid, }: JsonEditorProps<T>) => ReactElement;
|
|
147
149
|
|
|
@@ -155,6 +157,13 @@ declare const castToJson: (input: unknown) => {
|
|
|
155
157
|
};
|
|
156
158
|
|
|
157
159
|
type SetterOrUpdater<T> = <New extends T>(next: New | ((old: T) => New)) => void;
|
|
158
|
-
declare const SubEditors:
|
|
160
|
+
declare const SubEditors: {
|
|
161
|
+
array: ({ path, isReadonly, isHidden, data, set, Components, testid, }: JsonEditorProps_INTERNAL<atom_io_json.Json.Tree.Array>) => react.ReactElement;
|
|
162
|
+
boolean: ({ data, set, Components, testid, }: JsonEditorProps_INTERNAL<boolean>) => react.ReactElement;
|
|
163
|
+
null: ({ Components, testid, }: JsonEditorProps_INTERNAL<null>) => react.ReactElement;
|
|
164
|
+
number: ({ path, isReadonly, data, set, Components, testid, }: JsonEditorProps_INTERNAL<number>) => react.ReactElement;
|
|
165
|
+
object: <T extends atom_io_json.Json.Tree.Object>({ path, isReadonly, isHidden, data, set, Components, testid, }: JsonEditorProps_INTERNAL<T>) => react.ReactElement;
|
|
166
|
+
string: ({ path, isReadonly, data, set, Components, testid, }: JsonEditorProps_INTERNAL<string>) => react.ReactElement;
|
|
167
|
+
};
|
|
159
168
|
|
|
160
169
|
export { AtomIODevtools, DEFAULT_JSON_EDITOR_COMPONENTS, DEFAULT_NUMBER_CONSTRAINTS, type DecimalInProgress, DefaultFallback, type Dict, ElasticInput, type ElasticInputProps, ErrorBoundary, type ErrorBoundaryProps, type ErrorBoundaryState, type FallbackProps, JsonEditor, type JsonEditorComponents, type JsonEditorProps, type NumberConstraints, NumberInput, type SetterOrUpdater, SubEditors, TextInput, type TextInputProps, VALID_NON_NUMBERS, VALID_NON_NUMBER_INTERPRETATIONS, type ValidNonNumber, type WC, type WrapperComponent, castToJson, clampInto, isDecimalInProgress, isValidNonNumber };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { persistSync } from '../../dist/chunk-4LWKCEW3.js';
|
|
2
|
-
import { attachIntrospectionStates, jsonRefinery, primitiveRefinery, discoverType, prettyJson } from '../../dist/chunk-
|
|
3
|
-
import { StoreContext, useI, useO } from '../../dist/chunk-
|
|
4
|
-
import { IMPLICIT, createStandaloneAtom, createAtomFamily, fromEntries, become, isJson, toEntries, JSON_DEFAULTS, findInStore, undo, redo, getState, stringifyJson } from '../../dist/chunk-
|
|
2
|
+
import { attachIntrospectionStates, jsonRefinery, primitiveRefinery, discoverType, prettyJson } from '../../dist/chunk-Q6OOJWM4.js';
|
|
3
|
+
import { StoreContext, useI, useO } from '../../dist/chunk-TJPLOX7Z.js';
|
|
4
|
+
import { IMPLICIT, createStandaloneAtom, createAtomFamily, fromEntries, become, isJson, toEntries, JSON_DEFAULTS, findInStore, undo, redo, getState, stringifyJson } from '../../dist/chunk-7SJVR7FZ.js';
|
|
5
5
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
6
6
|
import { motion, spring, LayoutGroup } from 'motion/react';
|
|
7
7
|
import { forwardRef, useRef, useState, useImperativeHandle, useLayoutEffect, createContext, useId, Component, useContext, Fragment as Fragment$1 } from 'react';
|
|
@@ -401,8 +401,8 @@ var stringToObject = (str) => {
|
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
403
|
var objectToString = (obj) => JSON.stringify(obj);
|
|
404
|
-
var objectToBoolean = (obj) => obj
|
|
405
|
-
var objectToNumber = (obj) => Number(obj
|
|
404
|
+
var objectToBoolean = (obj) => obj[`true`] === true;
|
|
405
|
+
var objectToNumber = (obj) => Number(obj[`number`] ?? obj[`size`] ?? obj[`count`] ?? 0);
|
|
406
406
|
var objectToArray = (obj) => Object.entries(obj);
|
|
407
407
|
var booleanToString = (bool) => bool.toString();
|
|
408
408
|
var booleanToNumber = (bool) => +bool;
|
|
@@ -1396,74 +1396,86 @@ var AtomIODevtoolsInternal = () => {
|
|
|
1396
1396
|
const devtoolsView = useO(devtoolsViewSelectionState);
|
|
1397
1397
|
const devtoolsViewOptions = useO(devtoolsViewOptionsState);
|
|
1398
1398
|
const mouseHasMoved = useRef(false);
|
|
1399
|
-
return /* @__PURE__ */ jsxs(
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
{
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1399
|
+
return /* @__PURE__ */ jsxs(
|
|
1400
|
+
"span",
|
|
1401
|
+
{
|
|
1402
|
+
style: {
|
|
1403
|
+
position: `fixed`,
|
|
1404
|
+
top: 0,
|
|
1405
|
+
left: 0,
|
|
1406
|
+
right: 0,
|
|
1407
|
+
bottom: 0
|
|
1408
|
+
},
|
|
1409
|
+
children: [
|
|
1410
|
+
/* @__PURE__ */ jsx(
|
|
1411
|
+
motion.span,
|
|
1412
|
+
{
|
|
1413
|
+
ref: constraintsRef,
|
|
1414
|
+
"data-css": "atom_io_devtools_zone",
|
|
1415
|
+
style: {
|
|
1416
|
+
position: `fixed`,
|
|
1417
|
+
top: 0,
|
|
1418
|
+
left: 0,
|
|
1419
|
+
right: 0,
|
|
1420
|
+
bottom: 0,
|
|
1421
|
+
pointerEvents: `none`
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ jsxs(
|
|
1426
|
+
motion.main,
|
|
1427
|
+
{
|
|
1428
|
+
drag: true,
|
|
1429
|
+
dragConstraints: constraintsRef,
|
|
1430
|
+
"data-css": "atom_io_devtools",
|
|
1431
|
+
transition: spring,
|
|
1432
|
+
style: devtoolsAreOpen ? {} : {
|
|
1433
|
+
backgroundColor: `#0000`,
|
|
1434
|
+
borderColor: `#0000`,
|
|
1435
|
+
maxHeight: 28,
|
|
1436
|
+
maxWidth: 33
|
|
1437
|
+
},
|
|
1438
|
+
children: [
|
|
1439
|
+
devtoolsAreOpen ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1440
|
+
/* @__PURE__ */ jsxs(motion.header, { children: [
|
|
1441
|
+
/* @__PURE__ */ jsx("h1", { children: "atom.io" }),
|
|
1442
|
+
/* @__PURE__ */ jsx("nav", { children: devtoolsViewOptions.map((viewOption) => /* @__PURE__ */ jsx(
|
|
1443
|
+
"button",
|
|
1444
|
+
{
|
|
1445
|
+
type: "button",
|
|
1446
|
+
"data-testid": `view-${viewOption}`,
|
|
1447
|
+
className: viewOption === devtoolsView ? `active` : ``,
|
|
1448
|
+
onClick: () => {
|
|
1449
|
+
setDevtoolsView(viewOption);
|
|
1450
|
+
},
|
|
1451
|
+
disabled: viewOption === devtoolsView,
|
|
1452
|
+
children: viewOption
|
|
1453
|
+
},
|
|
1454
|
+
viewOption
|
|
1455
|
+
)) })
|
|
1456
|
+
] }),
|
|
1457
|
+
/* @__PURE__ */ jsx(motion.main, { children: /* @__PURE__ */ jsx(LayoutGroup, { children: devtoolsView === `atoms` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: atomIndex }) : devtoolsView === `selectors` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: selectorIndex }) : devtoolsView === `transactions` ? /* @__PURE__ */ jsx(TransactionIndex, {}) : /* @__PURE__ */ jsx(TimelineIndex, {}) }) })
|
|
1458
|
+
] }) : null,
|
|
1459
|
+
/* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(
|
|
1433
1460
|
"button",
|
|
1434
1461
|
{
|
|
1435
1462
|
type: "button",
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1463
|
+
onMouseDown: () => mouseHasMoved.current = false,
|
|
1464
|
+
onMouseMove: () => mouseHasMoved.current = true,
|
|
1465
|
+
onMouseUp: () => {
|
|
1466
|
+
if (!mouseHasMoved.current) {
|
|
1467
|
+
setDevtoolsAreOpen((open) => !open);
|
|
1468
|
+
}
|
|
1440
1469
|
},
|
|
1441
|
-
|
|
1442
|
-
children: viewOption
|
|
1443
|
-
},
|
|
1444
|
-
viewOption
|
|
1445
|
-
)) })
|
|
1446
|
-
] }),
|
|
1447
|
-
/* @__PURE__ */ jsx(motion.main, { children: /* @__PURE__ */ jsx(LayoutGroup, { children: devtoolsView === `atoms` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: atomIndex }) : devtoolsView === `selectors` ? /* @__PURE__ */ jsx(StateIndex, { tokenIndex: selectorIndex }) : devtoolsView === `transactions` ? /* @__PURE__ */ jsx(TransactionIndex, {}) : /* @__PURE__ */ jsx(TimelineIndex, {}) }) })
|
|
1448
|
-
] }) : null,
|
|
1449
|
-
/* @__PURE__ */ jsx("footer", { children: /* @__PURE__ */ jsx(
|
|
1450
|
-
"button",
|
|
1451
|
-
{
|
|
1452
|
-
type: "button",
|
|
1453
|
-
onMouseDown: () => mouseHasMoved.current = false,
|
|
1454
|
-
onMouseMove: () => mouseHasMoved.current = true,
|
|
1455
|
-
onMouseUp: () => {
|
|
1456
|
-
if (!mouseHasMoved.current) {
|
|
1457
|
-
setDevtoolsAreOpen((open) => !open);
|
|
1470
|
+
children: "\u{1F50D}"
|
|
1458
1471
|
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
] });
|
|
1472
|
+
) })
|
|
1473
|
+
]
|
|
1474
|
+
}
|
|
1475
|
+
)
|
|
1476
|
+
]
|
|
1477
|
+
}
|
|
1478
|
+
);
|
|
1467
1479
|
};
|
|
1468
1480
|
|
|
1469
1481
|
export { AtomIODevtools, DEFAULT_JSON_EDITOR_COMPONENTS, DEFAULT_NUMBER_CONSTRAINTS, DefaultFallback, ElasticInput, ErrorBoundary, JsonEditor, NumberInput, SubEditors, TextInput, VALID_NON_NUMBERS, VALID_NON_NUMBER_INTERPRETATIONS, castToJson, clampInto, isDecimalInProgress, isValidNonNumber };
|
|
@@ -38,7 +38,15 @@ const AtomIODevtoolsInternal = (): React.ReactNode => {
|
|
|
38
38
|
const mouseHasMoved = useRef(false)
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
|
-
|
|
41
|
+
<span
|
|
42
|
+
style={{
|
|
43
|
+
position: `fixed`,
|
|
44
|
+
top: 0,
|
|
45
|
+
left: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
bottom: 0,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
42
50
|
<motion.span
|
|
43
51
|
ref={constraintsRef}
|
|
44
52
|
data-css="atom_io_devtools_zone"
|
|
@@ -118,6 +126,6 @@ const AtomIODevtoolsInternal = (): React.ReactNode => {
|
|
|
118
126
|
</button>
|
|
119
127
|
</footer>
|
|
120
128
|
</motion.main>
|
|
121
|
-
|
|
129
|
+
</span>
|
|
122
130
|
)
|
|
123
131
|
}
|
|
@@ -31,7 +31,7 @@ export type JsonEditorProps<T> = {
|
|
|
31
31
|
set: (valOrUpdater: T | ((currVal: T) => T)) => void
|
|
32
32
|
name?: string | undefined
|
|
33
33
|
rename?: ((newKey: string) => void) | undefined
|
|
34
|
-
remove?: () => void
|
|
34
|
+
remove?: (() => void) | undefined
|
|
35
35
|
path?: ReadonlyArray<number | string>
|
|
36
36
|
isReadonly?: (path: ReadonlyArray<number | string>) => boolean
|
|
37
37
|
isHidden?: (path: ReadonlyArray<number | string>) => boolean
|
|
@@ -39,7 +39,7 @@ export type JsonEditorProps<T> = {
|
|
|
39
39
|
style?: CSSProperties
|
|
40
40
|
Header?: FC<{ data: T }>
|
|
41
41
|
Components?: Partial<JsonEditorComponents>
|
|
42
|
-
testid?: string
|
|
42
|
+
testid?: string | undefined
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const JsonEditor = <T,>({
|
|
@@ -14,9 +14,9 @@ export const stringToObject = (str: string): Json.Tree.Object => {
|
|
|
14
14
|
export const objectToString = (obj: Json.Tree.Object): string =>
|
|
15
15
|
JSON.stringify(obj)
|
|
16
16
|
export const objectToBoolean = (obj: Json.Tree.Object): boolean =>
|
|
17
|
-
obj
|
|
17
|
+
obj[`true`] === true
|
|
18
18
|
export const objectToNumber = (obj: Json.Tree.Object): number =>
|
|
19
|
-
Number(obj
|
|
19
|
+
Number(obj[`number`] ?? obj[`size`] ?? obj[`count`] ?? 0)
|
|
20
20
|
export const objectToArray = <T>(
|
|
21
21
|
obj: Json.Tree.Object<string, T>,
|
|
22
22
|
): [key: string, value: T][] => Object.entries(obj)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { become } from "atom.io/internal"
|
|
2
2
|
import type { Json, JsonTypeName } from "atom.io/json"
|
|
3
3
|
import { fromEntries, JSON_DEFAULTS, toEntries } from "atom.io/json"
|
|
4
|
-
import type {
|
|
4
|
+
import type { RefObject } from "react"
|
|
5
5
|
|
|
6
6
|
import type { SetterOrUpdater } from "../.."
|
|
7
7
|
import { castToJson } from "./cast-to-json"
|
|
@@ -13,7 +13,7 @@ export const makePropertySetters = <T extends Json.Tree.Object>(
|
|
|
13
13
|
fromEntries(
|
|
14
14
|
toEntries(data).map(([key, value]) => [
|
|
15
15
|
key,
|
|
16
|
-
(newValue) => {
|
|
16
|
+
(newValue: unknown) => {
|
|
17
17
|
set({ ...data, [key]: become(newValue)(value) })
|
|
18
18
|
},
|
|
19
19
|
]),
|
|
@@ -22,7 +22,7 @@ export const makePropertySetters = <T extends Json.Tree.Object>(
|
|
|
22
22
|
export const makePropertyRenamers = <T extends Json.Tree.Object>(
|
|
23
23
|
data: T,
|
|
24
24
|
set: SetterOrUpdater<T>,
|
|
25
|
-
stableKeyMapRef:
|
|
25
|
+
stableKeyMapRef: RefObject<{ [Key in keyof T]: keyof T }>,
|
|
26
26
|
): { [K in keyof T]: (newKey: string) => void } =>
|
|
27
27
|
fromEntries(
|
|
28
28
|
toEntries(data).map(([key, value]) => [
|
|
@@ -19,14 +19,11 @@ export type SetterOrUpdater<T> = <New extends T>(
|
|
|
19
19
|
next: New | ((old: T) => New),
|
|
20
20
|
) => void
|
|
21
21
|
|
|
22
|
-
export const SubEditors
|
|
23
|
-
keyof JsonTypes,
|
|
24
|
-
FC<JsonEditorProps_INTERNAL<any>>
|
|
25
|
-
> = {
|
|
22
|
+
export const SubEditors = {
|
|
26
23
|
array: ArrayEditor,
|
|
27
24
|
boolean: BooleanEditor,
|
|
28
25
|
null: NullEditor,
|
|
29
26
|
number: NumberEditor,
|
|
30
27
|
object: ObjectEditor,
|
|
31
28
|
string: StringEditor,
|
|
32
|
-
}
|
|
29
|
+
} satisfies Record<keyof JsonTypes, FC<JsonEditorProps_INTERNAL<any>>>
|
|
@@ -47,7 +47,9 @@ export const JsonEditor_INTERNAL = <T,>({
|
|
|
47
47
|
type: `non-json`,
|
|
48
48
|
data,
|
|
49
49
|
}
|
|
50
|
-
const SubEditor = dataIsJson
|
|
50
|
+
const SubEditor = dataIsJson
|
|
51
|
+
? SubEditors[refined.type as keyof JsonTypes]
|
|
52
|
+
: NonJsonEditor
|
|
51
53
|
|
|
52
54
|
const disabled = isReadonly(path)
|
|
53
55
|
|
|
@@ -92,7 +94,7 @@ export const JsonEditor_INTERNAL = <T,>({
|
|
|
92
94
|
</Components.KeyWrapper>
|
|
93
95
|
)}
|
|
94
96
|
<SubEditor
|
|
95
|
-
data={refined.data}
|
|
97
|
+
data={refined.data as never}
|
|
96
98
|
set={set}
|
|
97
99
|
remove={remove}
|
|
98
100
|
rename={rename}
|
package/realtime/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
1
|
+
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex } from '../../dist/chunk-U4K63VLA.js';
|
|
2
|
+
import '../../dist/chunk-7SJVR7FZ.js';
|
|
3
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState } from '../../dist/chunk-
|
|
1
|
+
export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState } from '../../dist/chunk-IR77IXS7.js';
|
|
2
2
|
import '../../dist/chunk-4LWKCEW3.js';
|
|
3
|
-
import '../../dist/chunk-
|
|
3
|
+
import '../../dist/chunk-7SJVR7FZ.js';
|
|
4
4
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -177,10 +177,13 @@ export const useRegisterAndAttemptConfirmedUpdate =
|
|
|
177
177
|
continuityKey,
|
|
178
178
|
`has no optimistic updates to deal with`,
|
|
179
179
|
)
|
|
180
|
-
const continuityEpoch = getEpochNumberOfContinuity(store, continuityKey)
|
|
181
180
|
const isRoot = isRootStore(store)
|
|
181
|
+
let continuityEpoch: number | undefined
|
|
182
|
+
if (isRoot) {
|
|
183
|
+
continuityEpoch = getEpochNumberOfContinuity(store, continuityKey)
|
|
184
|
+
}
|
|
182
185
|
|
|
183
|
-
if (
|
|
186
|
+
if (continuityEpoch === confirmed.epoch - 1) {
|
|
184
187
|
store.logger.info(
|
|
185
188
|
`✅`,
|
|
186
189
|
`continuity`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { RealtimeContext, RealtimeProvider, usePullAtom, usePullAtomFamilyMember, usePullMutable, usePullMutableAtomFamilyMember, usePullSelector, usePullSelectorFamilyMember, usePush, useServerAction, useSyncContinuity } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
1
|
+
export { RealtimeContext, RealtimeProvider, usePullAtom, usePullAtomFamilyMember, usePullMutable, usePullMutableAtomFamilyMember, usePullSelector, usePullSelectorFamilyMember, usePush, useServerAction, useSyncContinuity } from '../../dist/chunk-PXB4YZDI.js';
|
|
2
|
+
import '../../dist/chunk-IR77IXS7.js';
|
|
3
3
|
import '../../dist/chunk-4LWKCEW3.js';
|
|
4
|
-
import '../../dist/chunk-
|
|
5
|
-
import '../../dist/chunk-
|
|
4
|
+
import '../../dist/chunk-TJPLOX7Z.js';
|
|
5
|
+
import '../../dist/chunk-7SJVR7FZ.js';
|
|
6
6
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// @ts-expect-error this is a safe way to check a property on the global object
|
|
4
|
+
const { NODE_ENV } = globalThis[`env`] ?? {}
|
|
4
5
|
const IN_DEV = NODE_ENV === `development`
|
|
5
6
|
|
|
6
7
|
function noop() {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ChildSocket, CustomSocket, ParentSocket, SubjectSocket, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, prepareToExposeRealtimeContinuity, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, redactTransactionUpdateContent, redactorAtoms, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
3
|
-
import '../../dist/chunk-
|
|
1
|
+
export { ChildSocket, CustomSocket, ParentSocket, SubjectSocket, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, prepareToExposeRealtimeContinuity, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, redactTransactionUpdateContent, redactorAtoms, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets } from '../../dist/chunk-PG57JXN4.js';
|
|
2
|
+
import '../../dist/chunk-U4K63VLA.js';
|
|
3
|
+
import '../../dist/chunk-7SJVR7FZ.js';
|
|
4
4
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -49,7 +49,7 @@ export class ChildSocket<
|
|
|
49
49
|
) {
|
|
50
50
|
super((event, ...args) => {
|
|
51
51
|
const stringifiedEvent = JSON.stringify([event, ...args]) + `\x03`
|
|
52
|
-
const errorHandler = (err) => {
|
|
52
|
+
const errorHandler = (err: { code: string }) => {
|
|
53
53
|
if (err.code === `EPIPE`) {
|
|
54
54
|
console.error(`EPIPE error during write`, this.process.stdin)
|
|
55
55
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RealtimeProvider } from '../../dist/chunk-
|
|
2
|
-
import { myUsernameState } from '../../dist/chunk-
|
|
3
|
-
import { socketAtoms, usersOfSockets, userIndex, socketIndex, roomSelectors } from '../../dist/chunk-
|
|
4
|
-
import { roomIndex } from '../../dist/chunk-
|
|
1
|
+
import { RealtimeProvider } from '../../dist/chunk-PXB4YZDI.js';
|
|
2
|
+
import { myUsernameState } from '../../dist/chunk-IR77IXS7.js';
|
|
3
|
+
import { socketAtoms, usersOfSockets, userIndex, socketIndex, roomSelectors } from '../../dist/chunk-PG57JXN4.js';
|
|
4
|
+
import { roomIndex } from '../../dist/chunk-U4K63VLA.js';
|
|
5
5
|
import '../../dist/chunk-4LWKCEW3.js';
|
|
6
|
-
import { StoreProvider } from '../../dist/chunk-
|
|
7
|
-
import { Silo, IMPLICIT, Realm, findInStore, setIntoStore, editRelationsInStore, toEntries, findRelationsInStore, getFromStore, clearStore, AtomIOLogger } from '../../dist/chunk-
|
|
6
|
+
import { StoreProvider } from '../../dist/chunk-TJPLOX7Z.js';
|
|
7
|
+
import { Silo, IMPLICIT, Realm, findInStore, setIntoStore, editRelationsInStore, toEntries, findRelationsInStore, getFromStore, clearStore, AtomIOLogger } from '../../dist/chunk-7SJVR7FZ.js';
|
|
8
8
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
9
9
|
import * as http from 'node:http';
|
|
10
10
|
import { render, prettyDOM } from '@testing-library/react';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SetRTX } from '../../../dist/chunk-
|
|
1
|
+
export { SetRTX } from '../../../dist/chunk-7SJVR7FZ.js';
|
|
2
2
|
import '../../../dist/chunk-XWL6SNVU.js';
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { KeyedStateUpdate, StateUpdate } from "atom.io"
|
|
2
|
-
|
|
3
|
-
import type { Atom } from ".."
|
|
4
|
-
import { newest } from "../lineage"
|
|
5
|
-
import { isTransceiver } from "../mutable"
|
|
6
|
-
import type { Store } from "../store"
|
|
7
|
-
import { isChildStore } from "../transaction/is-root-store"
|
|
8
|
-
|
|
9
|
-
function shouldUpdateBeStowed(key: string, update: StateUpdate<any>): boolean {
|
|
10
|
-
// do not stow updates that aren't json
|
|
11
|
-
if (isTransceiver(update.newValue)) {
|
|
12
|
-
return false
|
|
13
|
-
}
|
|
14
|
-
// do not stow updates where the key contains 🔍
|
|
15
|
-
if (key.includes(`🔍`)) {
|
|
16
|
-
return false
|
|
17
|
-
}
|
|
18
|
-
return true
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const stowUpdate = <T>(
|
|
22
|
-
store: Store,
|
|
23
|
-
state: Atom<T>,
|
|
24
|
-
update: StateUpdate<T>,
|
|
25
|
-
): void => {
|
|
26
|
-
const { key } = state
|
|
27
|
-
const target = newest(store)
|
|
28
|
-
if (!isChildStore(target) || target.transactionMeta.phase !== `building`) {
|
|
29
|
-
store.logger.error(
|
|
30
|
-
`🐞`,
|
|
31
|
-
`atom`,
|
|
32
|
-
key,
|
|
33
|
-
`stowUpdate called outside of a transaction. This is probably a bug.`,
|
|
34
|
-
)
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
const shouldStow = shouldUpdateBeStowed(key, update)
|
|
38
|
-
if (!shouldStow) {
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
const atomUpdate: KeyedStateUpdate<T> = {
|
|
42
|
-
type: `atom_update`,
|
|
43
|
-
key,
|
|
44
|
-
...update,
|
|
45
|
-
}
|
|
46
|
-
if (state.family) {
|
|
47
|
-
atomUpdate.family = state.family
|
|
48
|
-
}
|
|
49
|
-
target.transactionMeta.update.updates.push(atomUpdate)
|
|
50
|
-
store.logger.info(
|
|
51
|
-
`📁`,
|
|
52
|
-
`atom`,
|
|
53
|
-
key,
|
|
54
|
-
`stowed (`,
|
|
55
|
-
update.oldValue,
|
|
56
|
-
`->`,
|
|
57
|
-
update.newValue,
|
|
58
|
-
`)`,
|
|
59
|
-
)
|
|
60
|
-
}
|