atom.io 0.8.2 → 0.9.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.
Files changed (41) hide show
  1. package/README.md +33 -28
  2. package/data/dist/index.d.mts +31 -0
  3. package/data/dist/index.d.ts +31 -0
  4. package/data/dist/index.js +77 -0
  5. package/data/dist/index.js.map +1 -0
  6. package/data/dist/index.mjs +73 -0
  7. package/data/dist/index.mjs.map +1 -0
  8. package/data/package.json +15 -0
  9. package/data/src/dict.ts +31 -0
  10. package/data/src/index.ts +3 -0
  11. package/data/src/struct-family.ts +38 -0
  12. package/data/src/struct.ts +45 -0
  13. package/dist/index.js +2 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +2 -2
  16. package/dist/index.mjs.map +1 -1
  17. package/internal/dist/index.js +20 -18
  18. package/internal/dist/index.js.map +1 -1
  19. package/internal/dist/index.mjs +20 -18
  20. package/internal/dist/index.mjs.map +1 -1
  21. package/internal/src/store/store.ts +15 -16
  22. package/package.json +46 -28
  23. package/react-devtools/dist/index.d.mts +4 -4
  24. package/react-devtools/dist/index.d.ts +4 -4
  25. package/react-devtools/dist/index.js +12 -8
  26. package/react-devtools/dist/index.js.map +1 -1
  27. package/react-devtools/dist/index.mjs +12 -8
  28. package/react-devtools/dist/index.mjs.map +1 -1
  29. package/react-devtools/src/StateIndex.tsx +3 -2
  30. package/realtime-server/dist/index.js +30 -18
  31. package/realtime-server/dist/index.js.map +1 -1
  32. package/realtime-server/dist/index.mjs +30 -18
  33. package/realtime-server/dist/index.mjs.map +1 -1
  34. package/realtime-server/src/hook-composition/expose-family.ts +11 -5
  35. package/realtime-server/src/hook-composition/expose-mutable-family.ts +11 -5
  36. package/realtime-testing/dist/index.js +11 -4
  37. package/realtime-testing/dist/index.js.map +1 -1
  38. package/realtime-testing/dist/index.mjs +11 -4
  39. package/realtime-testing/dist/index.mjs.map +1 -1
  40. package/realtime-testing/src/setup-realtime-test.tsx +11 -5
  41. package/src/logger.ts +2 -2
@@ -118,23 +118,22 @@ export class Store {
118
118
  },
119
119
  name,
120
120
  }
121
+ for (const [, atom] of store.atoms) {
122
+ atom.install(this)
123
+ }
124
+ for (const [, selector] of store.readonlySelectors) {
125
+ selector.install(this)
126
+ }
127
+ for (const [, selector] of store.selectors) {
128
+ selector.install(this)
129
+ }
130
+ for (const [, tx] of store.transactions) {
131
+ tx.install(this)
132
+ }
133
+ for (const [, timeline] of store.timelines) {
134
+ timeline.install(this)
135
+ }
121
136
  }
122
-
123
- store?.atoms.forEach((atom) => {
124
- atom.install(this)
125
- })
126
- store?.readonlySelectors.forEach((selector) => {
127
- selector.install(this)
128
- })
129
- store?.selectors.forEach((selector) => {
130
- selector.install(this)
131
- })
132
- store?.transactions.forEach((tx) => {
133
- tx.install(this)
134
- })
135
- store?.timelines.forEach((timeline) => {
136
- timeline.install(this)
137
- })
138
137
  }
139
138
  }
140
139
 
package/package.json CHANGED
@@ -1,7 +1,20 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.8.2",
4
- "description": "Reactive state graph for React, Preact, and vanilla",
3
+ "version": "0.9.0",
4
+ "description": "Composable and testable reactive data library.",
5
+ "homepage": "https://atom.io.fyi",
6
+ "sideEffects": false,
7
+ "license": "MIT",
8
+ "author": "Jeremy Banka",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/jeremybanka/wayforge.git",
15
+ "directory": "packages/atom.io"
16
+ },
17
+ "dependencies": {},
5
18
  "peerDependencies": {
6
19
  "@floating-ui/react": ">=0.25.0",
7
20
  "@floating-ui/react-dom": ">=2.0.0",
@@ -37,18 +50,20 @@
37
50
  "devDependencies": {
38
51
  "@emotion/react": "11.11.1",
39
52
  "@testing-library/react": "14.0.0",
40
- "@types/mock-fs": "4.13.2",
41
- "@types/react": "18.2.28",
42
- "@types/tmp": "0.2.4",
53
+ "@types/mock-fs": "4.13.3",
54
+ "@types/npmlog": "4.1.5",
55
+ "@types/react": "18.2.31",
56
+ "@types/tmp": "0.2.5",
43
57
  "@vitest/coverage-v8": "0.34.6",
44
- "concurrently": "8.2.1",
45
- "eslint": "8.51.0",
58
+ "concurrently": "8.2.2",
59
+ "eslint": "8.52.0",
46
60
  "framer-motion": "10.16.4",
47
61
  "happy-dom": "12.9.1",
62
+ "npmlog": "7.0.1",
48
63
  "preact": "10.18.1",
49
64
  "react": "18.2.0",
50
65
  "react-dom": "18.2.0",
51
- "react-router-dom": "6.16.0",
66
+ "react-router-dom": "6.17.0",
52
67
  "socket.io": "4.7.2",
53
68
  "socket.io-client": "4.7.2",
54
69
  "tmp": "0.2.1",
@@ -63,6 +78,10 @@
63
78
  "module": "dist/index.mjs",
64
79
  "files": [
65
80
  "dist",
81
+ "src",
82
+ "data/dist",
83
+ "data/package.json",
84
+ "data/src",
66
85
  "internal/dist",
67
86
  "internal/package.json",
68
87
  "internal/src",
@@ -81,16 +100,15 @@
81
100
  "realtime-client/dist",
82
101
  "realtime-client/package.json",
83
102
  "realtime-client/src",
84
- "realtime-server/dist",
85
- "realtime-server/package.json",
86
- "realtime-server/src",
87
103
  "realtime-react/dist",
88
104
  "realtime-react/package.json",
89
105
  "realtime-react/src",
106
+ "realtime-server/dist",
107
+ "realtime-server/package.json",
108
+ "realtime-server/src",
90
109
  "realtime-testing/dist",
91
110
  "realtime-testing/package.json",
92
111
  "realtime-testing/src",
93
- "src",
94
112
  "transceivers/set-rtx/dist",
95
113
  "transceivers/set-rtx/package.json",
96
114
  "transceivers/set-rtx/src"
@@ -103,6 +121,13 @@
103
121
  "import": "./dist/index.mjs",
104
122
  "require": "./dist/index.js"
105
123
  },
124
+ "./data/package.json": "./data/package.json",
125
+ "./data": {
126
+ "types": "./data/dist/index.d.ts",
127
+ "browser": "./data/dist/index.mjs",
128
+ "import": "./data/dist/index.mjs",
129
+ "require": "./data/dist/index.js"
130
+ },
106
131
  "./internal/package.json": "./internal/package.json",
107
132
  "./internal": {
108
133
  "types": "./internal/dist/index.d.ts",
@@ -110,12 +135,12 @@
110
135
  "import": "./internal/dist/index.mjs",
111
136
  "require": "./internal/dist/index.js"
112
137
  },
113
- "./introspection/package.json": "./json/package.json",
138
+ "./introspection/package.json": "./introspection/package.json",
114
139
  "./introspection": {
115
- "types": "./json/dist/index.d.ts",
116
- "browser": "./json/dist/index.mjs",
117
- "import": "./json/dist/index.mjs",
118
- "require": "./json/dist/index.js"
140
+ "types": "./introspection/dist/index.d.ts",
141
+ "browser": "./introspection/dist/index.mjs",
142
+ "import": "./introspection/dist/index.mjs",
143
+ "require": "./introspection/dist/index.js"
119
144
  },
120
145
  "./json/package.json": "./json/package.json",
121
146
  "./json": {
@@ -174,19 +199,11 @@
174
199
  "require": "./transceivers/set-rtx/dist/index.js"
175
200
  }
176
201
  },
177
- "repository": {
178
- "type": "git",
179
- "url": "git+https://github.com/jeremybanka/wayforge.git"
180
- },
181
- "license": "MIT",
182
- "sideEffects": false,
183
- "author": "Jeremy Banka",
184
- "publishConfig": {
185
- "access": "public"
186
- },
187
202
  "scripts": {
203
+ "integrity": "tsx __scripts__/integrity-build.node",
188
204
  "build": "concurrently \"npm:build:*\"",
189
205
  "build:main": "tsup",
206
+ "build:data": "cd data && tsup",
190
207
  "build:internal": "cd internal && tsup",
191
208
  "build:introspection": "cd introspection && tsup",
192
209
  "build:json": "cd json && tsup",
@@ -201,6 +218,7 @@
201
218
  "lint:eslint": "eslint .",
202
219
  "lint": "npm run lint:biome && npm run lint:eslint",
203
220
  "test": "vitest",
204
- "test:once": "cross-env IMPORT=dist vitest run"
221
+ "test:once": "npm run test:integrity && cross-env IMPORT=dist vitest run",
222
+ "test:integrity": "tsx __scripts__/integrity-test.node"
205
223
  }
206
224
  }
@@ -271,15 +271,15 @@ declare class Differ<Leaf extends Record<string, any>, Tree extends Record<strin
271
271
  leafRefinery: Refinery<Leaf>;
272
272
  treeRefinery: Refinery<Tree>;
273
273
  leafDiffers: {
274
- [K in keyof Leaf]: Diff<Supported<Leaf[K]>>;
274
+ [KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
275
275
  };
276
276
  treeDiffers: {
277
- [K in keyof Tree]: DiffTree<Supported<Tree[K]>>;
277
+ [KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
278
278
  };
279
279
  constructor(leafRefinery: Refinery<Leaf>, treeRefinery: Refinery<Tree>, diffFunctions: {
280
- [K in keyof Tree]: DiffTree<Supported<Tree[K]>>;
280
+ [KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
281
281
  } & {
282
- [K in keyof Leaf]: Diff<Supported<Leaf[K]>>;
282
+ [KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
283
283
  });
284
284
  diff(a: unknown, b: unknown): Delta;
285
285
  }
@@ -271,15 +271,15 @@ declare class Differ<Leaf extends Record<string, any>, Tree extends Record<strin
271
271
  leafRefinery: Refinery<Leaf>;
272
272
  treeRefinery: Refinery<Tree>;
273
273
  leafDiffers: {
274
- [K in keyof Leaf]: Diff<Supported<Leaf[K]>>;
274
+ [KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
275
275
  };
276
276
  treeDiffers: {
277
- [K in keyof Tree]: DiffTree<Supported<Tree[K]>>;
277
+ [KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
278
278
  };
279
279
  constructor(leafRefinery: Refinery<Leaf>, treeRefinery: Refinery<Tree>, diffFunctions: {
280
- [K in keyof Tree]: DiffTree<Supported<Tree[K]>>;
280
+ [KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
281
281
  } & {
282
- [K in keyof Leaf]: Diff<Supported<Leaf[K]>>;
282
+ [KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
283
283
  });
284
284
  diff(a: unknown, b: unknown): Delta;
285
285
  }
@@ -242,9 +242,11 @@ var sprawl = (tree, inspector) => {
242
242
  var treeShake = (shouldDiscard = isUndefined) => (obj) => {
243
243
  const newObj = {};
244
244
  const entries = Object.entries(obj);
245
- entries.forEach(
246
- ([key, val]) => !shouldDiscard(val, key) ? newObj[key] = val : null
247
- );
245
+ for (const [key, val] of entries) {
246
+ if (!shouldDiscard(val, key)) {
247
+ newObj[key] = val;
248
+ }
249
+ }
248
250
  return newObj;
249
251
  };
250
252
  var delve = (obj, path) => {
@@ -910,7 +912,7 @@ var VALID_NON_NUMBER_INTERPRETATIONS = {
910
912
  ".": 0,
911
913
  "-.": 0
912
914
  };
913
- var isDecimalInProgress = (input) => input === `0` || !isNaN(Number(input)) && input.includes(`.`);
915
+ var isDecimalInProgress = (input) => input === `0` || !Number.isNaN(Number(input)) && input.includes(`.`);
914
916
  var textToValue = (input, allowDecimal) => {
915
917
  if (isValidNonNumber(input))
916
918
  return VALID_NON_NUMBER_INTERPRETATIONS[input];
@@ -984,7 +986,7 @@ var NumberInput = ({
984
986
  return;
985
987
  }
986
988
  setTemporaryEntry(null);
987
- const inputIsNumeric = !isNaN(Number(input)) && !input.includes(` `) || allowDecimal && input === `.` || allowDecimal && input === `-.` || input === `` || input === `-`;
989
+ const inputIsNumeric = !Number.isNaN(Number(input)) && !input.includes(` `) || allowDecimal && input === `.` || allowDecimal && input === `-.` || input === `` || input === `-`;
988
990
  const numericValue = textToValue(input, allowDecimal);
989
991
  if (inputIsNumeric) {
990
992
  set(refine(numericValue));
@@ -1642,7 +1644,9 @@ var makePropertyCreationInterface = (data, set) => (key, type) => (value) => set
1642
1644
  var makePropertySorter = (data, set, sortFn) => () => {
1643
1645
  const sortedKeys = Object.keys(data).sort(sortFn);
1644
1646
  const sortedObj = {};
1645
- sortedKeys.forEach((key) => sortedObj[key] = data[key]);
1647
+ for (const key of sortedKeys) {
1648
+ sortedObj[key] = data[key];
1649
+ }
1646
1650
  set(sortedObj);
1647
1651
  };
1648
1652
  var PropertyAdder = ({
@@ -2430,10 +2434,10 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
2430
2434
  var StateIndexTreeNode = ({ node, isOpenState }) => {
2431
2435
  const setIsOpen = react.useI(isOpenState);
2432
2436
  const isOpen = react.useO(isOpenState);
2433
- Object.entries(node.familyMembers).forEach(([key, childNode]) => {
2437
+ for (const [key, childNode] of recordToEntries(node.familyMembers)) {
2434
2438
  findViewIsOpenState(key);
2435
2439
  findStateTypeState(childNode);
2436
- });
2440
+ }
2437
2441
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2438
2442
  /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
2439
2443
  /* @__PURE__ */ jsxRuntime.jsx(button.OpenClose, { isOpen, setIsOpen }),