atom.io 0.29.1 → 0.29.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.
@@ -14,6 +14,7 @@ var Future = class extends Promise {
14
14
  fate;
15
15
  resolve;
16
16
  reject;
17
+ done = false;
17
18
  constructor(executor) {
18
19
  let superResolve;
19
20
  let superReject;
@@ -28,11 +29,13 @@ var Future = class extends Promise {
28
29
  pass(promise, value) {
29
30
  if (promise === this.fate) {
30
31
  this.resolve(value);
32
+ this.done = true;
31
33
  }
32
34
  }
33
35
  fail(promise, reason) {
34
36
  if (promise === this.fate) {
35
37
  this.reject(reason);
38
+ this.done = true;
36
39
  }
37
40
  }
38
41
  use(value) {
@@ -426,6 +426,7 @@ declare class Future<T> extends Promise<T> {
426
426
  private fate;
427
427
  private resolve;
428
428
  private reject;
429
+ done: boolean;
429
430
  constructor(executor: Promise<T> | ((resolve: (value: T) => void, reject: (reason?: any) => void) => void));
430
431
  private pass;
431
432
  private fail;
@@ -1,3 +1,3 @@
1
- export { FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, LazyMap, Molecule, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateFamily, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw } from '../../dist/chunk-4WXELLFT.js';
1
+ export { FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, LazyMap, Molecule, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateFamily, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw } from '../../dist/chunk-J4B56MM5.js';
2
2
  import '../../dist/chunk-IBTHB2PI.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
@@ -49,7 +49,7 @@ export function disposeFromStore(
49
49
  const key = params[1]
50
50
  const maybeToken =
51
51
  family.type === `molecule_family`
52
- ? seekInStore(store, family, key) ?? counterfeit(family, key)
52
+ ? (seekInStore(store, family, key) ?? counterfeit(family, key))
53
53
  : findInStore(store, family, key)
54
54
  token = maybeToken
55
55
  }
@@ -12,6 +12,8 @@ export class Future<T> extends Promise<T> {
12
12
  private resolve: (value: T) => void
13
13
  private reject: (reason?: any) => void
14
14
 
15
+ public done = false
16
+
15
17
  public constructor(
16
18
  executor:
17
19
  | Promise<T>
@@ -31,11 +33,13 @@ export class Future<T> extends Promise<T> {
31
33
  private pass(promise: Promise<T>, value: T) {
32
34
  if (promise === this.fate) {
33
35
  this.resolve(value)
36
+ this.done = true
34
37
  }
35
38
  }
36
39
  private fail(promise: Promise<T>, reason: any) {
37
40
  if (promise === this.fate) {
38
41
  this.reject(reason)
42
+ this.done = true
39
43
  }
40
44
  }
41
45
 
@@ -7,7 +7,6 @@ import type {
7
7
  ReadableToken,
8
8
  } from "atom.io"
9
9
  import { type Canonical, parseJson } from "atom.io/json"
10
- import { M } from "vitest/dist/chunks/environment.0M5R1SX_.js"
11
10
 
12
11
  import { findInStore, seekInStore } from "../families"
13
12
  import { getFamilyOfToken } from "../families/get-family-of-token"
@@ -1,4 +1,4 @@
1
- import { createWritableSelectorFamily } from '../../dist/chunk-4WXELLFT.js';
1
+ import { createWritableSelectorFamily } from '../../dist/chunk-J4B56MM5.js';
2
2
  import '../../dist/chunk-IBTHB2PI.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
4
4
  import { createStandaloneSelector, IMPLICIT, growMoleculeInStore, initFamilyMemberInStore, withdraw, seekInStore } from 'atom.io/internal';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.29.1",
3
+ "version": "0.29.2",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -61,8 +61,8 @@
61
61
  "@types/tmp": "0.2.6",
62
62
  "@typescript-eslint/parser": "8.5.0",
63
63
  "@typescript-eslint/rule-tester": "8.5.0",
64
- "@vitest/coverage-v8": "2.0.5",
65
- "@vitest/ui": "2.0.5",
64
+ "@vitest/coverage-v8": "2.1.1",
65
+ "@vitest/ui": "2.1.1",
66
66
  "concurrently": "9.0.1",
67
67
  "drizzle-kit": "0.24.2",
68
68
  "drizzle-orm": "0.33.0",
@@ -72,7 +72,7 @@
72
72
  "http-proxy": "1.18.1",
73
73
  "npmlog": "7.0.1",
74
74
  "postgres": "3.4.4",
75
- "preact": "10.23.2",
75
+ "preact": "10.24.0",
76
76
  "react": "18.3.1",
77
77
  "react-dom": "18.3.1",
78
78
  "react-router-dom": "6.26.2",
@@ -82,9 +82,9 @@
82
82
  "tsup": "8.2.4",
83
83
  "tsx": "4.19.1",
84
84
  "typescript": "5.6.2",
85
- "vite": "5.4.4",
85
+ "vite": "5.4.5",
86
86
  "vite-tsconfig-paths": "5.0.1",
87
- "vitest": "2.0.5"
87
+ "vitest": "2.1.1"
88
88
  },
89
89
  "main": "dist/index.js",
90
90
  "types": "dist/index.d.ts",
@@ -108,7 +108,7 @@ main.atom_io_devtools {
108
108
  cursor: default;
109
109
  }
110
110
  }
111
- label {
111
+ > main {
112
112
  display: flex;
113
113
  flex-flow: row;
114
114
  gap: 5px;
@@ -186,7 +186,7 @@ main.atom_io_devtools {
186
186
  section.timeline_log {
187
187
  header {
188
188
  display: flex;
189
- label {
189
+ > main {
190
190
  display: flex;
191
191
  width: 100%;
192
192
  flex-grow: 1;
@@ -150,7 +150,7 @@ var NumberInput = ({
150
150
  testid,
151
151
  value = null
152
152
  }) => {
153
- const id = useId();
153
+ const htmlId = useId();
154
154
  const [temporaryEntry, setTemporaryEntry] = useState(null);
155
155
  const userHasMadeDeliberateChange = useRef(false);
156
156
  const refine = initRefinery({ max, min, decimalPlaces, nullable: true });
@@ -183,7 +183,7 @@ var NumberInput = ({
183
183
  };
184
184
  const displayValue = temporaryEntry ?? valueToText(value ? refine(value) : value);
185
185
  return /* @__PURE__ */ jsxs("span", { children: [
186
- label && /* @__PURE__ */ jsx("label", { htmlFor: id, children: label }),
186
+ label ? /* @__PURE__ */ jsx("label", { htmlFor: htmlId, children: label }) : null,
187
187
  autoSize ? /* @__PURE__ */ jsx(
188
188
  ElasticInput,
189
189
  {
@@ -193,8 +193,8 @@ var NumberInput = ({
193
193
  onChange: handleChange,
194
194
  onBlur: handleBlur,
195
195
  disabled,
196
- name: name ?? id,
197
- id,
196
+ name: name ?? htmlId,
197
+ id: htmlId,
198
198
  onClick,
199
199
  "data-testid": testid
200
200
  }
@@ -207,8 +207,8 @@ var NumberInput = ({
207
207
  onChange: handleChange,
208
208
  onBlur: handleBlur,
209
209
  disabled,
210
- name: name ?? id,
211
- id,
210
+ name: name ?? htmlId,
211
+ id: htmlId,
212
212
  onClick,
213
213
  "data-testid": testid
214
214
  }
@@ -223,11 +223,13 @@ var TextInput = ({
223
223
  autoSize = false,
224
224
  testid
225
225
  }) => {
226
+ const htmlId = useId();
226
227
  return /* @__PURE__ */ jsxs("span", { children: [
227
- /* @__PURE__ */ jsx("label", { children: label }),
228
+ label ? /* @__PURE__ */ jsx("label", { htmlFor: htmlId, children: label }) : null,
228
229
  autoSize ? /* @__PURE__ */ jsx(
229
230
  ElasticInput,
230
231
  {
232
+ id: htmlId,
231
233
  type: "text",
232
234
  value,
233
235
  onChange: (e) => set?.(e.target.value),
@@ -238,6 +240,7 @@ var TextInput = ({
238
240
  ) : /* @__PURE__ */ jsx(
239
241
  "input",
240
242
  {
243
+ id: htmlId,
241
244
  type: "text",
242
245
  value,
243
246
  onChange: (e) => set?.(e.target.value),
@@ -980,7 +983,7 @@ var StateIndexLeafNode = ({ node, isOpenState, typeState }) => {
980
983
  }
981
984
  ),
982
985
  /* @__PURE__ */ jsxs(
983
- "label",
986
+ "main",
984
987
  {
985
988
  onClick: () => {
986
989
  console.log(node, getState(node));
@@ -1021,7 +1024,7 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
1021
1024
  setIsOpen
1022
1025
  }
1023
1026
  ),
1024
- /* @__PURE__ */ jsxs("label", { children: [
1027
+ /* @__PURE__ */ jsxs("main", { children: [
1025
1028
  /* @__PURE__ */ jsx("h2", { children: node.key }),
1026
1029
  /* @__PURE__ */ jsx("span", { className: "type detail", children: " (family)" })
1027
1030
  ] })
@@ -1236,7 +1239,7 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
1236
1239
  setIsOpen
1237
1240
  }
1238
1241
  ),
1239
- /* @__PURE__ */ jsxs("label", { children: [
1242
+ /* @__PURE__ */ jsxs("main", { children: [
1240
1243
  /* @__PURE__ */ jsx("h2", { children: token.key }),
1241
1244
  /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
1242
1245
  "(",
@@ -1321,7 +1324,7 @@ var TransactionLog = ({ token, isOpenState, logState }) => {
1321
1324
  setIsOpen
1322
1325
  }
1323
1326
  ),
1324
- /* @__PURE__ */ jsxs("label", { children: [
1327
+ /* @__PURE__ */ jsxs("main", { children: [
1325
1328
  /* @__PURE__ */ jsx("h2", { children: token.key }),
1326
1329
  /* @__PURE__ */ jsxs("span", { className: "detail length", children: [
1327
1330
  "(",
@@ -38,7 +38,7 @@ export const StateIndexLeafNode: FC<{
38
38
  setIsOpen={setIsOpen}
39
39
  disabled={isPrimitive}
40
40
  />
41
- <label
41
+ <main
42
42
  onClick={() => {
43
43
  console.log(node, getState(node))
44
44
  }}
@@ -48,7 +48,7 @@ export const StateIndexLeafNode: FC<{
48
48
  >
49
49
  <h2>{node.family?.subKey ?? node.key}</h2>
50
50
  <span className="type detail">({stateType})</span>
51
- </label>
51
+ </main>
52
52
  <StoreEditor token={node} />
53
53
  </header>
54
54
  {isOpen && !isPrimitive ? (
@@ -80,10 +80,10 @@ export const StateIndexTreeNode: FC<{
80
80
  testid={`open-close-state-family-${node.key}`}
81
81
  setIsOpen={setIsOpen}
82
82
  />
83
- <label>
83
+ <main>
84
84
  <h2>{node.key}</h2>
85
85
  <span className="type detail"> (family)</span>
86
- </label>
86
+ </main>
87
87
  </header>
88
88
  {isOpen
89
89
  ? [...node.familyMembers.entries()].map(([key, childNode]) => (
@@ -33,7 +33,7 @@ export const TimelineLog: FC<{
33
33
  testid={`open-close-timeline-${token.key}`}
34
34
  setIsOpen={setIsOpen}
35
35
  />
36
- <label>
36
+ <main>
37
37
  <h2>{token.key}</h2>
38
38
  <span className="detail length">
39
39
  ({timeline.at}/{timeline.history.length})
@@ -59,7 +59,7 @@ export const TimelineLog: FC<{
59
59
  redo
60
60
  </button>
61
61
  </nav>
62
- </label>
62
+ </main>
63
63
  </header>
64
64
  {isOpen ? (
65
65
  <main>
@@ -32,10 +32,10 @@ export const TransactionLog: FC<{
32
32
  testid={`open-close-transaction-${token.key}`}
33
33
  setIsOpen={setIsOpen}
34
34
  />
35
- <label>
35
+ <main>
36
36
  <h2>{token.key}</h2>
37
37
  <span className="detail length">({log.length})</span>
38
- </label>
38
+ </main>
39
39
  </header>
40
40
  {isOpen ? (
41
41
  <main>
@@ -107,7 +107,7 @@ main.atom_io_devtools {
107
107
  cursor: default;
108
108
  }
109
109
  }
110
- label {
110
+ > main {
111
111
  display: flex;
112
112
  flex-flow: row;
113
113
  gap: 5px;
@@ -185,7 +185,7 @@ main.atom_io_devtools {
185
185
  section.timeline_log {
186
186
  header {
187
187
  display: flex;
188
- label {
188
+ > main {
189
189
  display: flex;
190
190
  width: 100%;
191
191
  flex-grow: 1;
@@ -115,7 +115,7 @@ export const NumberInput: FC<NumberInputProps> = ({
115
115
  testid,
116
116
  value = null,
117
117
  }) => {
118
- const id = useId()
118
+ const htmlId = useId()
119
119
  const [temporaryEntry, setTemporaryEntry] = useState<
120
120
  DecimalInProgress | ValidNonNumber | null
121
121
  >(null)
@@ -142,7 +142,7 @@ export const NumberInput: FC<NumberInputProps> = ({
142
142
  setTemporaryEntry(input)
143
143
  const textInterpretation = isDecimalInProgress(input)
144
144
  ? input
145
- : min?.toString() ?? `0`
145
+ : (min?.toString() ?? `0`)
146
146
  const newValue = textToValue(textInterpretation, allowDecimal)
147
147
  set(refine(newValue))
148
148
  return
@@ -166,7 +166,8 @@ export const NumberInput: FC<NumberInputProps> = ({
166
166
 
167
167
  return (
168
168
  <span>
169
- {label && <label htmlFor={id}>{label}</label>}
169
+ {/* biome-ignore lint/a11y/noLabelWithoutControl: it's associated via htmlFor */}
170
+ {label ? <label htmlFor={htmlId}>{label}</label> : null}
170
171
  {autoSize ? (
171
172
  <ElasticInput
172
173
  type="text"
@@ -175,8 +176,8 @@ export const NumberInput: FC<NumberInputProps> = ({
175
176
  onChange={handleChange}
176
177
  onBlur={handleBlur}
177
178
  disabled={disabled}
178
- name={name ?? id}
179
- id={id}
179
+ name={name ?? htmlId}
180
+ id={htmlId}
180
181
  onClick={onClick}
181
182
  data-testid={testid}
182
183
  />
@@ -188,8 +189,8 @@ export const NumberInput: FC<NumberInputProps> = ({
188
189
  onChange={handleChange}
189
190
  onBlur={handleBlur}
190
191
  disabled={disabled}
191
- name={name ?? id}
192
- id={id}
192
+ name={name ?? htmlId}
193
+ id={htmlId}
193
194
  onClick={onClick}
194
195
  data-testid={testid}
195
196
  />
@@ -1,4 +1,4 @@
1
- import type { FC } from "react"
1
+ import { type FC, useId } from "react"
2
2
 
3
3
  import { ElasticInput } from "."
4
4
 
@@ -20,11 +20,14 @@ export const TextInput: FC<TextInputProps> = ({
20
20
  autoSize = false,
21
21
  testid,
22
22
  }) => {
23
+ const htmlId = useId()
23
24
  return (
24
25
  <span>
25
- <label>{label}</label>
26
+ {/* biome-ignore lint/a11y/noLabelWithoutControl: it's associated via htmlFor */}
27
+ {label ? <label htmlFor={htmlId}>{label}</label> : null}
26
28
  {autoSize ? (
27
29
  <ElasticInput
30
+ id={htmlId}
28
31
  type="text"
29
32
  value={value}
30
33
  onChange={(e) => set?.(e.target.value)}
@@ -34,6 +37,7 @@ export const TextInput: FC<TextInputProps> = ({
34
37
  />
35
38
  ) : (
36
39
  <input
40
+ id={htmlId}
37
41
  type="text"
38
42
  value={value}
39
43
  onChange={(e) => set?.(e.target.value)}
@@ -174,7 +174,7 @@ export function realtimeContinuitySynchronizer({
174
174
  }
175
175
 
176
176
  const epoch = isRootStore(store)
177
- ? store.transactionMeta.epoch.get(continuityKey) ?? null
177
+ ? (store.transactionMeta.epoch.get(continuityKey) ?? null)
178
178
  : null
179
179
 
180
180
  socket?.emit(`continuity-init:${continuityKey}`, epoch, initialPayload)