atom.io 0.33.1 → 0.33.3

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 (116) hide show
  1. package/dist/data/index.d.ts +3 -3
  2. package/dist/data/index.d.ts.map +1 -1
  3. package/dist/data/index.js.map +1 -1
  4. package/dist/eslint-plugin/index.d.ts.map +1 -1
  5. package/dist/internal/index.d.ts +111 -54
  6. package/dist/internal/index.d.ts.map +1 -1
  7. package/dist/internal/index.js +381 -128
  8. package/dist/internal/index.js.map +1 -1
  9. package/dist/introspection/index.d.ts +10 -10
  10. package/dist/introspection/index.d.ts.map +1 -1
  11. package/dist/introspection/index.js +4 -4
  12. package/dist/introspection/index.js.map +1 -1
  13. package/dist/json/index.d.ts +3 -3
  14. package/dist/json/index.d.ts.map +1 -1
  15. package/dist/json/index.js +2 -2
  16. package/dist/json/index.js.map +1 -1
  17. package/dist/main/index.d.ts +155 -36
  18. package/dist/main/index.d.ts.map +1 -1
  19. package/dist/main/index.js +15 -3
  20. package/dist/main/index.js.map +1 -1
  21. package/dist/react/index.d.ts.map +1 -1
  22. package/dist/{devtools-Jyn42mZm.css → react-devtools/index.css} +1 -1
  23. package/dist/react-devtools/index.css.map +1 -0
  24. package/dist/react-devtools/index.d.ts +0 -1
  25. package/dist/react-devtools/index.d.ts.map +1 -1
  26. package/dist/react-devtools/index.js +8 -3
  27. package/dist/react-devtools/index.js.map +1 -1
  28. package/dist/realtime/index.d.ts +2 -2
  29. package/dist/realtime/index.d.ts.map +1 -1
  30. package/dist/realtime/index.js.map +1 -1
  31. package/dist/realtime-client/index.d.ts +1 -1
  32. package/dist/realtime-client/index.d.ts.map +1 -1
  33. package/dist/realtime-client/index.js.map +1 -1
  34. package/dist/realtime-react/index.d.ts.map +1 -1
  35. package/dist/realtime-react/index.js.map +1 -1
  36. package/dist/realtime-server/index.d.ts +2 -2
  37. package/dist/realtime-server/index.d.ts.map +1 -1
  38. package/dist/realtime-server/index.js.map +1 -1
  39. package/dist/realtime-testing/index.d.ts.map +1 -1
  40. package/dist/transceivers/set-rtx/index.d.ts.map +1 -1
  41. package/dist/web/index.d.ts.map +1 -1
  42. package/package.json +21 -21
  43. package/src/data/dict.ts +5 -5
  44. package/src/data/struct-family.ts +2 -2
  45. package/src/data/struct.ts +1 -1
  46. package/src/internal/atom/create-regular-atom.ts +14 -17
  47. package/src/internal/caching.ts +1 -1
  48. package/src/internal/families/create-readonly-held-selector-family.ts +81 -0
  49. package/src/internal/families/{create-readonly-selector-family.ts → create-readonly-pure-selector-family.ts} +26 -23
  50. package/src/internal/families/create-selector-family.ts +39 -16
  51. package/src/internal/families/create-writable-held-selector-family.ts +80 -0
  52. package/src/internal/families/{create-writable-selector-family.ts → create-writable-pure-selector-family.ts} +26 -23
  53. package/src/internal/families/dispose-from-store.ts +4 -2
  54. package/src/internal/families/find-in-store.ts +8 -8
  55. package/src/internal/families/get-family-of-token.ts +8 -8
  56. package/src/internal/families/index.ts +3 -3
  57. package/src/internal/families/init-family-member.ts +12 -10
  58. package/src/internal/families/seek-in-store.ts +13 -11
  59. package/src/internal/get-state/get-from-store.ts +5 -2
  60. package/src/internal/get-state/read-or-compute-value.ts +4 -2
  61. package/src/internal/index.ts +97 -20
  62. package/src/internal/join/join-internal.ts +18 -18
  63. package/src/internal/keys.ts +1 -1
  64. package/src/internal/mutable/create-mutable-atom.ts +17 -15
  65. package/src/internal/mutable/get-json-family.ts +4 -4
  66. package/src/internal/mutable/get-json-token.ts +7 -7
  67. package/src/internal/selector/create-readonly-held-selector.ts +50 -0
  68. package/src/internal/selector/create-readonly-pure-selector.ts +51 -0
  69. package/src/internal/selector/create-standalone-selector.ts +48 -15
  70. package/src/internal/selector/create-writable-held-selector.ts +68 -0
  71. package/src/internal/selector/{create-writable-selector.ts → create-writable-pure-selector.ts} +18 -25
  72. package/src/internal/selector/dispose-selector.ts +37 -7
  73. package/src/internal/selector/get-selector-dependency-keys.ts +1 -1
  74. package/src/internal/selector/index.ts +4 -2
  75. package/src/internal/selector/register-selector.ts +17 -5
  76. package/src/internal/selector/trace-selector-atoms.ts +5 -5
  77. package/src/internal/selector/update-selector-atoms.ts +16 -10
  78. package/src/internal/set-state/emit-update.ts +4 -2
  79. package/src/internal/set-state/set-atom-or-selector.ts +2 -1
  80. package/src/internal/store/counterfeit.ts +13 -11
  81. package/src/internal/store/deposit.ts +18 -14
  82. package/src/internal/store/store.ts +9 -14
  83. package/src/internal/store/withdraw.ts +83 -7
  84. package/src/internal/subscribe/subscribe-in-store.ts +4 -2
  85. package/src/internal/subscribe/subscribe-to-state.ts +2 -1
  86. package/src/internal/timeline/create-timeline.ts +4 -2
  87. package/src/internal/transaction/build-transaction.ts +1 -1
  88. package/src/introspection/attach-atom-index.ts +2 -2
  89. package/src/introspection/attach-introspection-states.ts +9 -9
  90. package/src/introspection/attach-selector-index.ts +3 -3
  91. package/src/introspection/attach-timeline-family.ts +2 -2
  92. package/src/introspection/attach-timeline-index.ts +2 -2
  93. package/src/introspection/attach-transaction-index.ts +2 -2
  94. package/src/introspection/attach-transaction-logs.ts +2 -2
  95. package/src/introspection/attach-type-selectors.ts +5 -5
  96. package/src/introspection/auditor.ts +3 -3
  97. package/src/json/select-json-family.ts +5 -5
  98. package/src/json/select-json.ts +1 -1
  99. package/src/main/find-state.ts +8 -8
  100. package/src/main/index.ts +51 -6
  101. package/src/main/join.ts +13 -13
  102. package/src/main/logger.ts +32 -15
  103. package/src/main/selector.ts +164 -30
  104. package/src/main/transaction.ts +3 -3
  105. package/src/main/validators.ts +16 -12
  106. package/src/react-devtools/StateEditor.tsx +14 -4
  107. package/src/react-devtools/StateIndex.tsx +6 -4
  108. package/src/react-devtools/TimelineIndex.tsx +2 -2
  109. package/src/react-devtools/TransactionIndex.tsx +2 -2
  110. package/src/realtime/shared-room-store.ts +3 -3
  111. package/src/realtime-client/realtime-client-stores/client-main-store.ts +1 -1
  112. package/src/realtime-react/use-pull-selector-family-member.ts +1 -0
  113. package/src/realtime-server/realtime-server-stores/server-room-external-store.ts +2 -2
  114. package/dist/devtools-CAg2k57t.js +0 -0
  115. package/dist/devtools-Jyn42mZm.css.map +0 -1
  116. package/src/internal/selector/create-readonly-selector.ts +0 -55
@@ -0,0 +1,81 @@
1
+ import type {
2
+ FamilyMetadata,
3
+ ReadonlyHeldSelectorFamilyOptions,
4
+ ReadonlyHeldSelectorFamilyToken,
5
+ ReadonlyHeldSelectorToken,
6
+ StateCreation,
7
+ StateDisposal,
8
+ } from "atom.io"
9
+ import type { Canonical } from "atom.io/json"
10
+ import { stringifyJson } from "atom.io/json"
11
+
12
+ import type { ReadonlyHeldSelectorFamily } from ".."
13
+ import { prettyPrintTokenType } from ".."
14
+ import { newest } from "../lineage"
15
+ import { createReadonlyHeldSelector } from "../selector"
16
+ import type { Store } from "../store"
17
+ import { Subject } from "../subject"
18
+
19
+ export function createReadonlyHeldSelectorFamily<
20
+ T extends object,
21
+ K extends Canonical,
22
+ >(
23
+ store: Store,
24
+ options: ReadonlyHeldSelectorFamilyOptions<T, K>,
25
+ internalRoles?: string[],
26
+ ): ReadonlyHeldSelectorFamilyToken<T, K> {
27
+ const familyKey = options.key
28
+ const type = `readonly_held_selector_family`
29
+
30
+ const familyToken = {
31
+ key: familyKey,
32
+ type,
33
+ } as const satisfies ReadonlyHeldSelectorFamilyToken<T, K>
34
+
35
+ const existing = store.families.get(familyKey)
36
+ if (existing) {
37
+ store.logger.error(
38
+ `❗`,
39
+ type,
40
+ familyKey,
41
+ `Overwriting an existing ${prettyPrintTokenType(
42
+ existing,
43
+ )} "${existing.key}" in store "${store.config.name}". You can safely ignore this warning if it is due to hot module replacement.`,
44
+ )
45
+ }
46
+
47
+ const subject = new Subject<
48
+ | StateCreation<ReadonlyHeldSelectorToken<T>>
49
+ | StateDisposal<ReadonlyHeldSelectorToken<T>>
50
+ >()
51
+
52
+ const familyFunction = (key: K): ReadonlyHeldSelectorToken<T> => {
53
+ const subKey = stringifyJson(key)
54
+ const family: FamilyMetadata = { key: familyKey, subKey }
55
+ const fullKey = `${familyKey}(${subKey})`
56
+ const target = newest(store)
57
+
58
+ const token = createReadonlyHeldSelector(
59
+ target,
60
+ {
61
+ key: fullKey,
62
+ const: options.const(key),
63
+ get: options.get(key),
64
+ },
65
+ family,
66
+ )
67
+
68
+ subject.next({ type: `state_creation`, token })
69
+ return token
70
+ }
71
+
72
+ const readonlySelectorFamily = Object.assign(familyFunction, familyToken, {
73
+ internalRoles,
74
+ subject,
75
+ install: (s: Store) => createReadonlyHeldSelectorFamily(s, options),
76
+ default: options.const,
77
+ }) satisfies ReadonlyHeldSelectorFamily<T, K>
78
+
79
+ store.families.set(familyKey, readonlySelectorFamily)
80
+ return familyToken
81
+ }
@@ -2,9 +2,9 @@ import type {
2
2
  FamilyMetadata,
3
3
  findState,
4
4
  getState,
5
- ReadonlySelectorFamilyOptions,
6
- ReadonlySelectorFamilyToken,
7
- ReadonlySelectorToken,
5
+ ReadonlyPureSelectorFamilyOptions,
6
+ ReadonlyPureSelectorFamilyToken,
7
+ ReadonlyPureSelectorToken,
8
8
  StateCreation,
9
9
  StateDisposal,
10
10
  } from "atom.io"
@@ -16,29 +16,32 @@ import {
16
16
  getFromStore,
17
17
  getJsonToken,
18
18
  prettyPrintTokenType,
19
- type ReadonlySelectorFamily,
19
+ type ReadonlyPureSelectorFamily,
20
20
  } from ".."
21
21
  import { newest } from "../lineage"
22
- import { createReadonlySelector } from "../selector"
22
+ import { createReadonlyPureSelector } from "../selector"
23
23
  import type { Store } from "../store"
24
24
  import { Subject } from "../subject"
25
25
 
26
- export function createReadonlySelectorFamily<T, K extends Canonical>(
26
+ export function createReadonlyPureSelectorFamily<T, K extends Canonical>(
27
27
  store: Store,
28
- options: ReadonlySelectorFamilyOptions<T, K>,
28
+ options: ReadonlyPureSelectorFamilyOptions<T, K>,
29
29
  internalRoles?: string[],
30
- ): ReadonlySelectorFamilyToken<T, K> {
30
+ ): ReadonlyPureSelectorFamilyToken<T, K> {
31
+ const familyKey = options.key
32
+ const type = `readonly_pure_selector_family`
33
+
31
34
  const familyToken = {
32
- key: options.key,
33
- type: `readonly_selector_family`,
34
- } as const satisfies ReadonlySelectorFamilyToken<T, K>
35
+ key: familyKey,
36
+ type,
37
+ } as const satisfies ReadonlyPureSelectorFamilyToken<T, K>
35
38
 
36
- const existing = store.families.get(options.key)
39
+ const existing = store.families.get(familyKey)
37
40
  if (existing) {
38
41
  store.logger.error(
39
42
  `❗`,
40
- `readonly_selector_family`,
41
- options.key,
43
+ type,
44
+ familyKey,
42
45
  `Overwriting an existing ${prettyPrintTokenType(
43
46
  existing,
44
47
  )} "${existing.key}" in store "${store.config.name}". You can safely ignore this warning if it is due to hot module replacement.`,
@@ -46,17 +49,17 @@ export function createReadonlySelectorFamily<T, K extends Canonical>(
46
49
  }
47
50
 
48
51
  const subject = new Subject<
49
- | StateCreation<ReadonlySelectorToken<T>>
50
- | StateDisposal<ReadonlySelectorToken<T>>
52
+ | StateCreation<ReadonlyPureSelectorToken<T>>
53
+ | StateDisposal<ReadonlyPureSelectorToken<T>>
51
54
  >()
52
55
 
53
- const familyFunction = (key: K): ReadonlySelectorToken<T> => {
56
+ const familyFunction = (key: K): ReadonlyPureSelectorToken<T> => {
54
57
  const subKey = stringifyJson(key)
55
- const family: FamilyMetadata = { key: options.key, subKey }
56
- const fullKey = `${options.key}(${subKey})`
58
+ const family: FamilyMetadata = { key: familyKey, subKey }
59
+ const fullKey = `${familyKey}(${subKey})`
57
60
  const target = newest(store)
58
61
 
59
- const token = createReadonlySelector(
62
+ const token = createReadonlyPureSelector(
60
63
  target,
61
64
  {
62
65
  key: fullKey,
@@ -72,7 +75,7 @@ export function createReadonlySelectorFamily<T, K extends Canonical>(
72
75
  const readonlySelectorFamily = Object.assign(familyFunction, familyToken, {
73
76
  internalRoles,
74
77
  subject,
75
- install: (s: Store) => createReadonlySelectorFamily(s, options),
78
+ install: (s: Store) => createReadonlyPureSelectorFamily(s, options),
76
79
  default: (key: K) => {
77
80
  const getFn = options.get(key)
78
81
  return getFn({
@@ -83,8 +86,8 @@ export function createReadonlySelectorFamily<T, K extends Canonical>(
83
86
  json: (token) => getJsonToken(store, token),
84
87
  })
85
88
  },
86
- }) satisfies ReadonlySelectorFamily<T, K>
89
+ }) satisfies ReadonlyPureSelectorFamily<T, K>
87
90
 
88
- store.families.set(options.key, readonlySelectorFamily)
91
+ store.families.set(familyKey, readonlySelectorFamily)
89
92
  return familyToken
90
93
  }
@@ -1,34 +1,57 @@
1
1
  import type {
2
- ReadonlySelectorFamilyOptions,
3
- ReadonlySelectorFamilyToken,
2
+ ReadonlyHeldSelectorFamilyOptions,
3
+ ReadonlyHeldSelectorFamilyToken,
4
+ ReadonlyPureSelectorFamilyOptions,
5
+ ReadonlyPureSelectorFamilyToken,
4
6
  SelectorFamilyToken,
5
- WritableSelectorFamilyOptions,
6
- WritableSelectorFamilyToken,
7
+ WritableHeldSelectorFamilyOptions,
8
+ WritableHeldSelectorFamilyToken,
9
+ WritablePureSelectorFamilyOptions,
10
+ WritablePureSelectorFamilyToken,
7
11
  } from "atom.io"
8
12
  import type { Canonical } from "atom.io/json"
9
13
 
10
14
  import type { Store } from "../store"
11
- import { createReadonlySelectorFamily } from "./create-readonly-selector-family"
12
- import { createWritableSelectorFamily } from "./create-writable-selector-family"
15
+ import { createReadonlyHeldSelectorFamily } from "./create-readonly-held-selector-family"
16
+ import { createReadonlyPureSelectorFamily } from "./create-readonly-pure-selector-family"
17
+ import { createWritableHeldSelectorFamily } from "./create-writable-held-selector-family"
18
+ import { createWritablePureSelectorFamily } from "./create-writable-pure-selector-family"
13
19
 
14
- export function createSelectorFamily<T, K extends Canonical>(
20
+ export function createSelectorFamily<T extends object, K extends Canonical>(
21
+ store: Store,
22
+ options: WritableHeldSelectorFamilyOptions<T, K>,
23
+ ): WritableHeldSelectorFamilyToken<T, K>
24
+ export function createSelectorFamily<T extends object, K extends Canonical>(
15
25
  store: Store,
16
- options: WritableSelectorFamilyOptions<T, K>,
17
- ): WritableSelectorFamilyToken<T, K>
26
+ options: ReadonlyHeldSelectorFamilyOptions<T, K>,
27
+ ): ReadonlyHeldSelectorFamilyToken<T, K>
18
28
  export function createSelectorFamily<T, K extends Canonical>(
19
29
  store: Store,
20
- options: ReadonlySelectorFamilyOptions<T, K>,
21
- ): ReadonlySelectorFamilyToken<T, K>
30
+ options: WritablePureSelectorFamilyOptions<T, K>,
31
+ ): WritablePureSelectorFamilyToken<T, K>
22
32
  export function createSelectorFamily<T, K extends Canonical>(
33
+ store: Store,
34
+ options: ReadonlyPureSelectorFamilyOptions<T, K>,
35
+ ): ReadonlyPureSelectorFamilyToken<T, K>
36
+ export function createSelectorFamily(
23
37
  store: Store,
24
38
  options:
25
- | ReadonlySelectorFamilyOptions<T, K>
26
- | WritableSelectorFamilyOptions<T, K>,
27
- ): SelectorFamilyToken<T, K> {
39
+ | ReadonlyHeldSelectorFamilyOptions<any, any>
40
+ | ReadonlyPureSelectorFamilyOptions<any, any>
41
+ | WritableHeldSelectorFamilyOptions<any, any>
42
+ | WritablePureSelectorFamilyOptions<any, any>,
43
+ ): SelectorFamilyToken<any, any> {
28
44
  const isWritable = `set` in options
45
+ const isHeld = `const` in options
29
46
 
47
+ if (isHeld && isWritable) {
48
+ return createWritableHeldSelectorFamily(store, options, undefined)
49
+ }
50
+ if (isHeld) {
51
+ return createReadonlyHeldSelectorFamily(store, options, undefined)
52
+ }
30
53
  if (isWritable) {
31
- return createWritableSelectorFamily(store, options)
54
+ return createWritablePureSelectorFamily(store, options)
32
55
  }
33
- return createReadonlySelectorFamily(store, options)
56
+ return createReadonlyPureSelectorFamily(store, options)
34
57
  }
@@ -0,0 +1,80 @@
1
+ import type {
2
+ FamilyMetadata,
3
+ StateCreation,
4
+ StateDisposal,
5
+ WritableHeldSelectorFamilyOptions,
6
+ WritableHeldSelectorFamilyToken,
7
+ WritableHeldSelectorToken,
8
+ } from "atom.io"
9
+ import type { Canonical } from "atom.io/json"
10
+ import { stringifyJson } from "atom.io/json"
11
+
12
+ import { prettyPrintTokenType, type WritableHeldSelectorFamily } from ".."
13
+ import { newest } from "../lineage"
14
+ import { createWritableHeldSelector } from "../selector"
15
+ import type { Store } from "../store"
16
+ import { Subject } from "../subject"
17
+
18
+ export function createWritableHeldSelectorFamily<
19
+ T extends object,
20
+ K extends Canonical,
21
+ >(
22
+ store: Store,
23
+ options: WritableHeldSelectorFamilyOptions<T, K>,
24
+ internalRoles?: string[],
25
+ ): WritableHeldSelectorFamilyToken<T, K> {
26
+ const familyKey = options.key
27
+ const type = `writable_held_selector_family`
28
+
29
+ const familyToken = {
30
+ key: familyKey,
31
+ type,
32
+ } as const satisfies WritableHeldSelectorFamilyToken<T, K>
33
+
34
+ const existing = store.families.get(familyKey)
35
+ if (existing) {
36
+ store.logger.error(
37
+ `❗`,
38
+ type,
39
+ familyKey,
40
+ `Overwriting an existing ${prettyPrintTokenType(
41
+ existing,
42
+ )} "${existing.key}" in store "${store.config.name}". You can safely ignore this warning if it is due to hot module replacement.`,
43
+ )
44
+ }
45
+ const subject = new Subject<
46
+ | StateCreation<WritableHeldSelectorToken<T>>
47
+ | StateDisposal<WritableHeldSelectorToken<T>>
48
+ >()
49
+
50
+ const familyFunction = (key: K): WritableHeldSelectorToken<T> => {
51
+ const subKey = stringifyJson(key)
52
+ const family: FamilyMetadata = { key: familyKey, subKey }
53
+ const fullKey = `${familyKey}(${subKey})`
54
+ const target = newest(store)
55
+
56
+ const token = createWritableHeldSelector(
57
+ target,
58
+ {
59
+ key: fullKey,
60
+ const: options.const(key),
61
+ get: options.get(key),
62
+ set: options.set(key),
63
+ },
64
+ family,
65
+ )
66
+
67
+ subject.next({ type: `state_creation`, token })
68
+ return token
69
+ }
70
+
71
+ const selectorFamily = Object.assign(familyFunction, familyToken, {
72
+ internalRoles,
73
+ subject,
74
+ install: (s: Store) => createWritableHeldSelectorFamily(s, options),
75
+ default: options.const,
76
+ }) satisfies WritableHeldSelectorFamily<T, K>
77
+
78
+ store.families.set(familyKey, selectorFamily)
79
+ return familyToken
80
+ }
@@ -4,9 +4,9 @@ import type {
4
4
  getState,
5
5
  StateCreation,
6
6
  StateDisposal,
7
- WritableSelectorFamilyOptions,
8
- WritableSelectorFamilyToken,
9
- WritableSelectorToken,
7
+ WritablePureSelectorFamilyOptions,
8
+ WritablePureSelectorFamilyToken,
9
+ WritablePureSelectorToken,
10
10
  } from "atom.io"
11
11
  import type { Canonical } from "atom.io/json"
12
12
  import { stringifyJson } from "atom.io/json"
@@ -16,46 +16,49 @@ import {
16
16
  getFromStore,
17
17
  getJsonToken,
18
18
  prettyPrintTokenType,
19
- type WritableSelectorFamily,
19
+ type WritablePureSelectorFamily,
20
20
  } from ".."
21
21
  import { newest } from "../lineage"
22
- import { createWritableSelector } from "../selector"
22
+ import { createWritablePureSelector } from "../selector"
23
23
  import type { Store } from "../store"
24
24
  import { Subject } from "../subject"
25
25
 
26
- export function createWritableSelectorFamily<T, K extends Canonical>(
26
+ export function createWritablePureSelectorFamily<T, K extends Canonical>(
27
27
  store: Store,
28
- options: WritableSelectorFamilyOptions<T, K>,
28
+ options: WritablePureSelectorFamilyOptions<T, K>,
29
29
  internalRoles?: string[],
30
- ): WritableSelectorFamilyToken<T, K> {
30
+ ): WritablePureSelectorFamilyToken<T, K> {
31
+ const familyKey = options.key
32
+ const type = `writable_pure_selector_family`
33
+
31
34
  const familyToken = {
32
- key: options.key,
33
- type: `selector_family`,
34
- } as const satisfies WritableSelectorFamilyToken<T, K>
35
+ key: familyKey,
36
+ type,
37
+ } as const satisfies WritablePureSelectorFamilyToken<T, K>
35
38
 
36
- const existing = store.families.get(options.key)
39
+ const existing = store.families.get(familyKey)
37
40
  if (existing) {
38
41
  store.logger.error(
39
42
  `❗`,
40
- `selector_family`,
41
- options.key,
43
+ type,
44
+ familyKey,
42
45
  `Overwriting an existing ${prettyPrintTokenType(
43
46
  existing,
44
47
  )} "${existing.key}" in store "${store.config.name}". You can safely ignore this warning if it is due to hot module replacement.`,
45
48
  )
46
49
  }
47
50
  const subject = new Subject<
48
- | StateCreation<WritableSelectorToken<T>>
49
- | StateDisposal<WritableSelectorToken<T>>
51
+ | StateCreation<WritablePureSelectorToken<T>>
52
+ | StateDisposal<WritablePureSelectorToken<T>>
50
53
  >()
51
54
 
52
- const familyFunction = (key: K): WritableSelectorToken<T> => {
55
+ const familyFunction = (key: K): WritablePureSelectorToken<T> => {
53
56
  const subKey = stringifyJson(key)
54
- const family: FamilyMetadata = { key: options.key, subKey }
55
- const fullKey = `${options.key}(${subKey})`
57
+ const family: FamilyMetadata = { key: familyKey, subKey }
58
+ const fullKey = `${familyKey}(${subKey})`
56
59
  const target = newest(store)
57
60
 
58
- const token = createWritableSelector(
61
+ const token = createWritablePureSelector(
59
62
  target,
60
63
  {
61
64
  key: fullKey,
@@ -72,7 +75,7 @@ export function createWritableSelectorFamily<T, K extends Canonical>(
72
75
  const selectorFamily = Object.assign(familyFunction, familyToken, {
73
76
  internalRoles,
74
77
  subject,
75
- install: (s: Store) => createWritableSelectorFamily(s, options),
78
+ install: (s: Store) => createWritablePureSelectorFamily(s, options),
76
79
  default: (key: K) => {
77
80
  const getFn = options.get(key)
78
81
  return getFn({
@@ -83,8 +86,8 @@ export function createWritableSelectorFamily<T, K extends Canonical>(
83
86
  json: (token) => getJsonToken(store, token),
84
87
  })
85
88
  },
86
- }) satisfies WritableSelectorFamily<T, K>
89
+ }) satisfies WritablePureSelectorFamily<T, K>
87
90
 
88
- store.families.set(options.key, selectorFamily)
91
+ store.families.set(familyKey, selectorFamily)
89
92
  return familyToken
90
93
  }
@@ -45,8 +45,10 @@ export function disposeFromStore(
45
45
  case `mutable_atom`:
46
46
  disposeAtom(store, token)
47
47
  break
48
- case `selector`:
49
- case `readonly_selector`:
48
+ case `writable_pure_selector`:
49
+ case `readonly_pure_selector`:
50
+ case `writable_held_selector`:
51
+ case `readonly_held_selector`:
50
52
  disposeSelector(store, token)
51
53
  break
52
54
  }
@@ -5,15 +5,15 @@ import type {
5
5
  MutableAtomToken,
6
6
  ReadableFamilyToken,
7
7
  ReadableToken,
8
- ReadonlySelectorFamilyToken,
9
- ReadonlySelectorToken,
8
+ ReadonlyPureSelectorFamilyToken,
9
+ ReadonlyPureSelectorToken,
10
10
  RegularAtomFamilyToken,
11
11
  RegularAtomToken,
12
12
  SelectorFamilyToken,
13
13
  SelectorToken,
14
14
  WritableFamilyToken,
15
- WritableSelectorFamilyToken,
16
- WritableSelectorToken,
15
+ WritablePureSelectorFamilyToken,
16
+ WritablePureSelectorToken,
17
17
  WritableToken,
18
18
  } from "atom.io"
19
19
  import { type Canonical, type Json, stringifyJson } from "atom.io/json"
@@ -49,15 +49,15 @@ export function findInStore<T, K extends Canonical, Key extends K>(
49
49
 
50
50
  export function findInStore<T, K extends Canonical, Key extends K>(
51
51
  store: Store,
52
- token: WritableSelectorFamilyToken<T, K>,
52
+ token: WritablePureSelectorFamilyToken<T, K>,
53
53
  key: Key,
54
- ): WritableSelectorToken<T, K>
54
+ ): WritablePureSelectorToken<T, K>
55
55
 
56
56
  export function findInStore<T, K extends Canonical, Key extends K>(
57
57
  store: Store,
58
- token: ReadonlySelectorFamilyToken<T, K>,
58
+ token: ReadonlyPureSelectorFamilyToken<T, K>,
59
59
  key: Key,
60
- ): ReadonlySelectorToken<T, K>
60
+ ): ReadonlyPureSelectorToken<T, K>
61
61
 
62
62
  export function findInStore<T, K extends Canonical, Key extends K>(
63
63
  store: Store,
@@ -3,13 +3,13 @@ import type {
3
3
  MutableAtomToken,
4
4
  ReadableFamilyToken,
5
5
  ReadableToken,
6
- ReadonlySelectorFamilyToken,
7
- ReadonlySelectorToken,
6
+ ReadonlyPureSelectorFamilyToken,
7
+ ReadonlyPureSelectorToken,
8
8
  RegularAtomFamilyToken,
9
9
  RegularAtomToken,
10
10
  WritableFamilyToken,
11
- WritableSelectorFamilyToken,
12
- WritableSelectorToken,
11
+ WritablePureSelectorFamilyToken,
12
+ WritablePureSelectorToken,
13
13
  WritableToken,
14
14
  } from "atom.io"
15
15
  import type { Canonical, Json } from "atom.io/json"
@@ -33,13 +33,13 @@ export function getFamilyOfToken<T, K extends Canonical>(
33
33
 
34
34
  export function getFamilyOfToken<T, K extends Canonical>(
35
35
  store: Store,
36
- token: WritableSelectorToken<T, K>,
37
- ): WritableSelectorFamilyToken<T, K> | undefined
36
+ token: WritablePureSelectorToken<T, K>,
37
+ ): WritablePureSelectorFamilyToken<T, K> | undefined
38
38
 
39
39
  export function getFamilyOfToken<T, K extends Canonical>(
40
40
  store: Store,
41
- token: ReadonlySelectorToken<T, K>,
42
- ): ReadonlySelectorFamilyToken<T, K> | undefined
41
+ token: ReadonlyPureSelectorToken<T, K>,
42
+ ): ReadonlyPureSelectorFamilyToken<T, K> | undefined
43
43
 
44
44
  export function getFamilyOfToken<T, K extends Canonical>(
45
45
  store: Store,
@@ -1,9 +1,9 @@
1
1
  export * from "./create-atom-family"
2
- export * from "./create-readonly-selector-family"
3
- export * from "./create-readonly-selector-family"
2
+ export * from "./create-readonly-pure-selector-family"
3
+ export * from "./create-readonly-pure-selector-family"
4
4
  export * from "./create-regular-atom-family"
5
5
  export * from "./create-selector-family"
6
- export * from "./create-writable-selector-family"
6
+ export * from "./create-writable-pure-selector-family"
7
7
  export * from "./dispose-from-store"
8
8
  export * from "./find-in-store"
9
9
  export * from "./init-family-member"
@@ -5,15 +5,15 @@ import type {
5
5
  MutableAtomToken,
6
6
  ReadableFamilyToken,
7
7
  ReadableToken,
8
- ReadonlySelectorFamilyToken,
9
- ReadonlySelectorToken,
8
+ ReadonlyPureSelectorFamilyToken,
9
+ ReadonlyPureSelectorToken,
10
10
  RegularAtomFamilyToken,
11
11
  RegularAtomToken,
12
12
  SelectorFamilyToken,
13
13
  SelectorToken,
14
14
  WritableFamilyToken,
15
- WritableSelectorFamilyToken,
16
- WritableSelectorToken,
15
+ WritablePureSelectorFamilyToken,
16
+ WritablePureSelectorToken,
17
17
  WritableToken,
18
18
  } from "atom.io"
19
19
  import type { Canonical, Json } from "atom.io/json"
@@ -49,15 +49,15 @@ export function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(
49
49
 
50
50
  export function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(
51
51
  store: Store,
52
- token: WritableSelectorFamilyToken<T, K>,
52
+ token: WritablePureSelectorFamilyToken<T, K>,
53
53
  key: Key,
54
- ): WritableSelectorToken<T, K>
54
+ ): WritablePureSelectorToken<T, K>
55
55
 
56
56
  export function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(
57
57
  store: Store,
58
- token: ReadonlySelectorFamilyToken<T, K>,
58
+ token: ReadonlyPureSelectorFamilyToken<T, K>,
59
59
  key: Key,
60
- ): ReadonlySelectorToken<T, K>
60
+ ): ReadonlyPureSelectorToken<T, K>
61
61
 
62
62
  export function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(
63
63
  store: Store,
@@ -95,8 +95,10 @@ export function initFamilyMemberInStore(
95
95
  case `mutable_atom`:
96
96
  store.on.atomCreation.next(state)
97
97
  break
98
- case `selector`:
99
- case `readonly_selector`:
98
+ case `writable_pure_selector`:
99
+ case `readonly_pure_selector`:
100
+ case `writable_held_selector`:
101
+ case `readonly_held_selector`:
100
102
  store.on.selectorCreation.next(state)
101
103
  break
102
104
  }
@@ -5,15 +5,15 @@ import type {
5
5
  MutableAtomToken,
6
6
  ReadableFamilyToken,
7
7
  ReadableToken,
8
- ReadonlySelectorFamilyToken,
9
- ReadonlySelectorToken,
8
+ ReadonlyPureSelectorFamilyToken,
9
+ ReadonlyPureSelectorToken,
10
10
  RegularAtomFamilyToken,
11
11
  RegularAtomToken,
12
12
  SelectorFamilyToken,
13
13
  SelectorToken,
14
14
  WritableFamilyToken,
15
- WritableSelectorFamilyToken,
16
- WritableSelectorToken,
15
+ WritablePureSelectorFamilyToken,
16
+ WritablePureSelectorToken,
17
17
  WritableToken,
18
18
  } from "atom.io"
19
19
  import type { Canonical, Json } from "atom.io/json"
@@ -49,15 +49,15 @@ export function seekInStore<T, K extends Canonical, Key extends K>(
49
49
 
50
50
  export function seekInStore<T, K extends Canonical, Key extends K>(
51
51
  store: Store,
52
- token: WritableSelectorFamilyToken<T, K>,
52
+ token: WritablePureSelectorFamilyToken<T, K>,
53
53
  key: Key,
54
- ): WritableSelectorToken<T, K> | undefined
54
+ ): WritablePureSelectorToken<T, K> | undefined
55
55
 
56
56
  export function seekInStore<T, K extends Canonical, Key extends K>(
57
57
  store: Store,
58
- token: ReadonlySelectorFamilyToken<T, K>,
58
+ token: ReadonlyPureSelectorFamilyToken<T, K>,
59
59
  key: Key,
60
- ): ReadonlySelectorToken<T, K> | undefined
60
+ ): ReadonlyPureSelectorToken<T, K> | undefined
61
61
 
62
62
  export function seekInStore<T, K extends Canonical, Key extends K>(
63
63
  store: Store,
@@ -91,10 +91,12 @@ export function seekInStore(
91
91
  case `mutable_atom_family`:
92
92
  state = target.atoms.get(fullKey)
93
93
  break
94
- case `selector_family`:
95
- state = target.selectors.get(fullKey)
94
+ case `writable_held_selector_family`:
95
+ case `writable_pure_selector_family`:
96
+ state = target.writableSelectors.get(fullKey)
96
97
  break
97
- case `readonly_selector_family`:
98
+ case `readonly_held_selector_family`:
99
+ case `readonly_pure_selector_family`:
98
100
  state = target.readonlySelectors.get(fullKey)
99
101
  break
100
102
  }
@@ -50,11 +50,14 @@ export function getFromStore(
50
50
  case `atom_family`:
51
51
  case `mutable_atom_family`:
52
52
  return store.defaults.get(family.key)
53
- case `selector_family`:
54
- case `readonly_selector_family`: {
53
+ case `readonly_pure_selector_family`:
54
+ case `writable_pure_selector_family`:
55
+ case `readonly_held_selector_family`:
56
+ case `writable_held_selector_family`: {
55
57
  if (store.defaults.has(family.key)) {
56
58
  return store.defaults.get(token.family.key)
57
59
  }
60
+ 3
58
61
  const defaultValue = withdraw(store, family).default(subKey)
59
62
  store.defaults.set(family.key, defaultValue)
60
63
  return defaultValue