ctx-core 5.9.0 → 5.11.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.
@@ -15,25 +15,29 @@ export declare function lock_memosig_<val_T>(
15
15
  def:memo_def_T<val_T>,
16
16
  ...subscriber_a:memo_subscriber_T<val_T>[]
17
17
  ):sig_T<val_T>
18
- export declare function on(rmemo:rmemo_T<unknown>):void
19
- export declare function off(rmemo:rmemo_T<unknown>):void
18
+ export declare function rmemo__on(rmemo:rmemo_T<unknown>):void
19
+ export declare function rmemo__off(rmemo:rmemo_T<unknown>):void
20
20
  export declare function rmemo__subscribe(rmemo:rmemo_T<unknown>, listener:()=>unknown):()=>void
21
21
  export type rmemo_T<val_T> = memo_T<val_T>|sig_T<val_T>|lock_memosig_T<val_T>
22
+ export type circular_rmemo_T = circular_memo_T|circular_sig_T|circular_lock_memosig_T
22
23
  export type memo_T<val_T> = (()=>val_T)&{
23
24
  readonly _:val_T
24
25
  readonly val:val_T
25
26
  r?:WeakRef<()=>val_T>
26
27
  memor:WeakRef<()=>val_T>[]
27
28
  }
29
+ export interface circular_memo_T extends memo_T<circular_memo_T> {}
28
30
  export type sig_T<val_T> = (()=>val_T)&{
29
31
  _:val_T
30
32
  readonly val:val_T
31
33
  r?:WeakRef<()=>val_T>
32
34
  memor:WeakRef<()=>val_T>[]
33
35
  }
36
+ export interface circular_sig_T extends sig_T<circular_sig_T> {}
34
37
  export type lock_memosig_T<val_T> = sig_T<val_T>&{
35
38
  lock?:0|1
36
39
  }
40
+ export interface circular_lock_memosig_T extends lock_memosig_T<circular_lock_memosig_T> {}
37
41
  export type rmemo_val_T<sig_T> = sig_T extends { ():infer val_T }
38
42
  ? val_T
39
43
  : unknown
@@ -118,7 +118,7 @@ export function sig_(init_val, ...subscriber_a) {
118
118
  * Call the rmemo & enable updates from it's parents.
119
119
  * @param {rmemo_T}rmemo
120
120
  */
121
- export function on(rmemo) {
121
+ export function rmemo__on(rmemo) {
122
122
  if (rmemo.r?.d) {
123
123
  rmemo.r.deref = rmemo.r.d
124
124
  }
@@ -128,7 +128,7 @@ export function on(rmemo) {
128
128
  * Disable updates from the rmemo's parents.
129
129
  * @param {rmemo_T}rmemo
130
130
  */
131
- export function off(rmemo) {
131
+ export function rmemo__off(rmemo) {
132
132
  if (rmemo.r) {
133
133
  rmemo.r.d ||= rmemo.r.deref
134
134
  rmemo.r.deref = ()=>{
@@ -149,7 +149,7 @@ export function rmemo__subscribe(memo, listener) {
149
149
  memo.b ??= []
150
150
  memo.b.push(listener_memo)
151
151
  return ()=>{
152
- off(listener_memo)
152
+ rmemo__off(listener_memo)
153
153
  memo.b.splice(memo.b.indexOf(listener_memo), 1)
154
154
  }
155
155
  }
@@ -4,7 +4,7 @@ import { deepStrictEqual } from 'node:assert'
4
4
  import { test } from 'uvu'
5
5
  import { equal } from 'uvu/assert'
6
6
  import { sleep } from '../sleep/index.js'
7
- import { lock_memosig_, memo_, type memo_T, memosig_, off, on, rmemo__subscribe, sig_ } from './index.js'
7
+ import { lock_memosig_, memo_, type memo_T, memosig_, rmemo__off, rmemo__on, rmemo__subscribe, sig_ } from './index.js'
8
8
  test('memo_|static value', ()=>{
9
9
  let count = 0
10
10
  const memo = memo_(()=>{
@@ -428,7 +428,7 @@ test('computes initial value when argument is undefined', ()=>{
428
428
  equal(one$(), undefined)
429
429
  equal(two$(), false)
430
430
  })
431
- test('.on + .off', ()=>{
431
+ test('.rmemo__on + .rmemo__off', ()=>{
432
432
  const base$ = sig_(1)
433
433
  let count = 0
434
434
  const memo$ = memo_(()=>{
@@ -440,15 +440,15 @@ test('.on + .off', ()=>{
440
440
  base$._ = 2
441
441
  equal(memo$(), 12)
442
442
  equal(count, 2)
443
- off(memo$)
443
+ rmemo__off(memo$)
444
444
  base$._ = 3
445
445
  equal(memo$(), 12)
446
446
  equal(count, 2)
447
- on(memo$)
447
+ rmemo__on(memo$)
448
448
  equal(memo$(), 13)
449
449
  equal(count, 3)
450
- off(memo$)
451
- on(memo$)
450
+ rmemo__off(memo$)
451
+ rmemo__on(memo$)
452
452
  equal(count, 4)
453
453
  base$._ = 4
454
454
  equal(memo$(), 14)
package/package.json CHANGED
@@ -1,241 +1,240 @@
1
1
  {
2
- "name": "ctx-core",
3
- "version": "5.9.0",
4
- "description": "ctx-core core library",
5
- "keywords": [
6
- "ctx-core",
7
- "array",
8
- "combinators",
9
- "function",
10
- "object",
11
- "set"
12
- ],
13
- "homepage": "https://github.com/ctx-core/ctx-core#readme",
14
- "bugs": {
15
- "url": "https://github.com/ctx-core/ctx-core/issues"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/ctx-core/ctx-core.git"
20
- },
21
- "license": "Apache-2.0",
22
- "author": "Brian Takita",
23
- "type": "module",
24
- "files": [
25
- "*.d.ts",
26
- "*.js",
27
- "*.json",
28
- "all",
29
- "array",
30
- "atob",
31
- "base16",
32
- "be",
33
- "btoa",
34
- "buffer",
35
- "chain",
36
- "class",
37
- "cli-args",
38
- "color",
39
- "combinators",
40
- "crypto",
41
- "currency",
42
- "data",
43
- "date",
44
- "debounce",
45
- "deep_equal",
46
- "env",
47
- "error",
48
- "fetch",
49
- "fibonacci",
50
- "fs",
51
- "function",
52
- "functional",
53
- "html",
54
- "http",
55
- "math",
56
- "matrix",
57
- "number",
58
- "object",
59
- "queue",
60
- "random",
61
- "regex",
62
- "rmemo",
63
- "set",
64
- "sleep",
65
- "string",
66
- "tempfile",
67
- "test",
68
- "time",
69
- "types",
70
- "uri",
71
- "uuid",
72
- "package.json"
73
- ],
74
- "types": "./src/index.d.ts",
75
- "exports": {
76
- ".": "./index.js",
77
- "./all": "./all/index.js",
78
- "./array": "./array/index.js",
79
- "./atob": "./atob/index.js",
80
- "./base16": "./base16/index.js",
81
- "./be": "./be/index.js",
82
- "./btoa": "./btoa/index.js",
83
- "./buffer": "./buffer/index.js",
84
- "./chain": "./chain/index.js",
85
- "./class": "./class/index.js",
86
- "./cli-args": "./cli-args/index.js",
87
- "./color": "./color/index.js",
88
- "./combinators": "./combinators/index.js",
89
- "./crypto": "./crypto/index.js",
90
- "./currency": "./currency/index.js",
91
- "./data": "./data/index.js",
92
- "./date": "./date/index.js",
93
- "./debounce": "./debounce/index.js",
94
- "./deep_equal": "./deep_equal/index.js",
95
- "./env": "./env/index.js",
96
- "./error": "./error/index.js",
97
- "./fetch": "./fetch/index.js",
98
- "./fibonacci": "./fibonacci/index.js",
99
- "./fs": "./fs/index.js",
100
- "./function": "./function/index.js",
101
- "./functional": "./functional/index.js",
102
- "./html": "./html/index.js",
103
- "./http": "./http/index.js",
104
- "./math": "./math/index.js",
105
- "./matrix": "./matrix/index.js",
106
- "./number": "./number/index.js",
107
- "./object": "./object/index.js",
108
- "./queue": "./queue/index.js",
109
- "./random": "./random/index.js",
110
- "./regex": "./regex/index.js",
111
- "./rmemo": "./rmemo/index.js",
112
- "./set": "./set/index.js",
113
- "./sleep": "./sleep/index.js",
114
- "./string": "./string/index.js",
115
- "./tempfile": "./tempfile/index.js",
116
- "./test": "./test/index.js",
117
- "./time": "./time/index.js",
118
- "./types": "./types/index.js",
119
- "./uri": "./uri/index.js",
120
- "./uuid": "./uuid/index.js",
121
- "./package.json": "./package.json"
122
- },
123
- "scripts": {
124
- "build": ":",
125
- "clean": ":",
126
- "exec": "$@",
127
- "prepublishOnly": "pnpm clean && pnpm build && pnpm test",
128
- "test": "pnpm run /^test:/",
129
- "test:size": "size-limit",
130
- "test:type": "check-dts",
131
- "test:unit": "NODE_OPTIONS=--loader=esmock tsx node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
132
- "disable:test:coverage": "c8 pnpm test:unit"
133
- },
134
- "devDependencies": {
135
- "@arethetypeswrong/cli": "^0.13.5",
136
- "@ctx-core/preprocess": "^0.1.0",
137
- "@size-limit/preset-small-lib": "^11.0.1",
138
- "@types/node": "^20.10.6",
139
- "@types/sinon": "^17.0.2",
140
- "c8": "^8.0.1",
141
- "check-dts": "^0.7.2",
142
- "esbuild": "^0.19.11",
143
- "esmock": "^2.6.0",
144
- "sinon": "^17.0.1",
145
- "size-limit": "^11.0.1",
146
- "tsx": "^4.7.0",
147
- "typescript": "next",
148
- "uvu": "^0.5.6"
149
- },
150
- "publishConfig": {
151
- "access": "public",
152
- "cache": "~/.npm"
153
- },
154
- "sideEffects": false,
155
- "size-limit": [
156
- {
157
- "name": "ctx_",
158
- "import": {
159
- "./be": "{ ctx_ }"
160
- },
161
- "limit": "33 B"
162
- },
163
- {
164
- "name": "ns_ctx_",
165
- "import": {
166
- "./be": "{ ns_ctx_ }"
167
- },
168
- "limit": "85 B"
169
- },
170
- {
171
- "name": "be_",
172
- "import": {
173
- "./be": "{ be_ }"
174
- },
175
- "limit": "99 B"
176
- },
177
- {
178
- "name": "be_ ctx_",
179
- "import": {
180
- "./be": "{ be_, ctx_ }"
181
- },
182
- "limit": "131 B"
183
- },
184
- {
185
- "name": "be_ ns_ctx_",
186
- "import": {
187
- "./be": "{ be_, ctx_, ns_ctx_ }"
188
- },
189
- "limit": "190 B"
190
- },
191
- {
192
- "name": "be_ ctx_ ns_ctx_",
193
- "import": {
194
- "./be": "{ be_, ctx_, ns_ctx_ }"
195
- },
196
- "limit": "190 B"
197
- },
198
- {
199
- "name": "memo_",
200
- "import": {
201
- "./rmemo": "{ memo_ }"
202
- },
203
- "limit": "336 B"
204
- },
205
- {
206
- "name": "memo_ sig_",
207
- "import": {
208
- "./rmemo": "{ sig_, memo_ }"
209
- },
210
- "limit": "352 B"
211
- },
212
- {
213
- "name": "memo_ sig_ be_ ctx_",
214
- "import": {
215
- "./rmemo": "{ sig_, memo_, be_, ctx_ }"
216
- },
217
- "limit": "458 B"
218
- },
219
- {
220
- "name": "memo_ sig_ be_ ctx_ be_memo_pair_ be_sig_triple_",
221
- "import": {
222
- "./rmemo": "{ sig_, memo_, be_, ctx_, be_memo_pair_, be_sig_triple_ }"
223
- },
224
- "limit": "552 B"
225
- },
226
- {
227
- "name": "uuid",
228
- "import": {
229
- "./uuid": "{ uuid_ }"
230
- },
231
- "limit": "39 B"
232
- },
233
- {
234
- "name": "short uuid",
235
- "import": {
236
- "./uuid": "{ short_uuid_ }"
237
- },
238
- "limit": "116 B"
239
- }
240
- ]
2
+ "name": "ctx-core",
3
+ "version": "5.11.0",
4
+ "description": "ctx-core core library",
5
+ "keywords": [
6
+ "ctx-core",
7
+ "array",
8
+ "combinators",
9
+ "function",
10
+ "object",
11
+ "set"
12
+ ],
13
+ "homepage": "https://github.com/ctx-core/ctx-core#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/ctx-core/ctx-core/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/ctx-core/ctx-core.git"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "author": "Brian Takita",
23
+ "type": "module",
24
+ "files": [
25
+ "*.d.ts",
26
+ "*.js",
27
+ "*.json",
28
+ "all",
29
+ "array",
30
+ "atob",
31
+ "base16",
32
+ "be",
33
+ "btoa",
34
+ "buffer",
35
+ "chain",
36
+ "class",
37
+ "cli-args",
38
+ "color",
39
+ "combinators",
40
+ "crypto",
41
+ "currency",
42
+ "data",
43
+ "date",
44
+ "debounce",
45
+ "deep_equal",
46
+ "env",
47
+ "error",
48
+ "fetch",
49
+ "fibonacci",
50
+ "fs",
51
+ "function",
52
+ "functional",
53
+ "html",
54
+ "http",
55
+ "math",
56
+ "matrix",
57
+ "number",
58
+ "object",
59
+ "queue",
60
+ "random",
61
+ "regex",
62
+ "rmemo",
63
+ "set",
64
+ "sleep",
65
+ "string",
66
+ "tempfile",
67
+ "test",
68
+ "time",
69
+ "types",
70
+ "uri",
71
+ "uuid",
72
+ "package.json"
73
+ ],
74
+ "types": "./src/index.d.ts",
75
+ "exports": {
76
+ ".": "./index.js",
77
+ "./all": "./all/index.js",
78
+ "./array": "./array/index.js",
79
+ "./atob": "./atob/index.js",
80
+ "./base16": "./base16/index.js",
81
+ "./be": "./be/index.js",
82
+ "./btoa": "./btoa/index.js",
83
+ "./buffer": "./buffer/index.js",
84
+ "./chain": "./chain/index.js",
85
+ "./class": "./class/index.js",
86
+ "./cli-args": "./cli-args/index.js",
87
+ "./color": "./color/index.js",
88
+ "./combinators": "./combinators/index.js",
89
+ "./crypto": "./crypto/index.js",
90
+ "./currency": "./currency/index.js",
91
+ "./data": "./data/index.js",
92
+ "./date": "./date/index.js",
93
+ "./debounce": "./debounce/index.js",
94
+ "./deep_equal": "./deep_equal/index.js",
95
+ "./env": "./env/index.js",
96
+ "./error": "./error/index.js",
97
+ "./fetch": "./fetch/index.js",
98
+ "./fibonacci": "./fibonacci/index.js",
99
+ "./fs": "./fs/index.js",
100
+ "./function": "./function/index.js",
101
+ "./functional": "./functional/index.js",
102
+ "./html": "./html/index.js",
103
+ "./http": "./http/index.js",
104
+ "./math": "./math/index.js",
105
+ "./matrix": "./matrix/index.js",
106
+ "./number": "./number/index.js",
107
+ "./object": "./object/index.js",
108
+ "./queue": "./queue/index.js",
109
+ "./random": "./random/index.js",
110
+ "./regex": "./regex/index.js",
111
+ "./rmemo": "./rmemo/index.js",
112
+ "./set": "./set/index.js",
113
+ "./sleep": "./sleep/index.js",
114
+ "./string": "./string/index.js",
115
+ "./tempfile": "./tempfile/index.js",
116
+ "./test": "./test/index.js",
117
+ "./time": "./time/index.js",
118
+ "./types": "./types/index.js",
119
+ "./uri": "./uri/index.js",
120
+ "./uuid": "./uuid/index.js",
121
+ "./package.json": "./package.json"
122
+ },
123
+ "devDependencies": {
124
+ "@arethetypeswrong/cli": "^0.13.5",
125
+ "@ctx-core/preprocess": "^0.1.0",
126
+ "@size-limit/preset-small-lib": "^11.0.1",
127
+ "@types/node": "^20.10.6",
128
+ "@types/sinon": "^17.0.2",
129
+ "c8": "^8.0.1",
130
+ "check-dts": "^0.7.2",
131
+ "esbuild": "^0.19.11",
132
+ "esmock": "^2.6.0",
133
+ "sinon": "^17.0.1",
134
+ "size-limit": "^11.0.1",
135
+ "tsx": "^4.7.0",
136
+ "typescript": "next",
137
+ "uvu": "^0.5.6"
138
+ },
139
+ "publishConfig": {
140
+ "access": "public",
141
+ "cache": "~/.npm"
142
+ },
143
+ "sideEffects": false,
144
+ "size-limit": [
145
+ {
146
+ "name": "ctx_",
147
+ "import": {
148
+ "./be": "{ ctx_ }"
149
+ },
150
+ "limit": "33 B"
151
+ },
152
+ {
153
+ "name": "ns_ctx_",
154
+ "import": {
155
+ "./be": "{ ns_ctx_ }"
156
+ },
157
+ "limit": "85 B"
158
+ },
159
+ {
160
+ "name": "be_",
161
+ "import": {
162
+ "./be": "{ be_ }"
163
+ },
164
+ "limit": "99 B"
165
+ },
166
+ {
167
+ "name": "be_ ctx_",
168
+ "import": {
169
+ "./be": "{ be_, ctx_ }"
170
+ },
171
+ "limit": "131 B"
172
+ },
173
+ {
174
+ "name": "be_ ns_ctx_",
175
+ "import": {
176
+ "./be": "{ be_, ctx_, ns_ctx_ }"
177
+ },
178
+ "limit": "190 B"
179
+ },
180
+ {
181
+ "name": "be_ ctx_ ns_ctx_",
182
+ "import": {
183
+ "./be": "{ be_, ctx_, ns_ctx_ }"
184
+ },
185
+ "limit": "190 B"
186
+ },
187
+ {
188
+ "name": "memo_",
189
+ "import": {
190
+ "./rmemo": "{ memo_ }"
191
+ },
192
+ "limit": "336 B"
193
+ },
194
+ {
195
+ "name": "memo_ sig_",
196
+ "import": {
197
+ "./rmemo": "{ sig_, memo_ }"
198
+ },
199
+ "limit": "352 B"
200
+ },
201
+ {
202
+ "name": "memo_ sig_ be_ ctx_",
203
+ "import": {
204
+ "./rmemo": "{ sig_, memo_, be_, ctx_ }"
205
+ },
206
+ "limit": "459 B"
207
+ },
208
+ {
209
+ "name": "memo_ sig_ be_ ctx_ be_memo_pair_ be_sig_triple_",
210
+ "import": {
211
+ "./rmemo": "{ sig_, memo_, be_, ctx_, be_memo_pair_, be_sig_triple_ }"
212
+ },
213
+ "limit": "549 B"
214
+ },
215
+ {
216
+ "name": "uuid",
217
+ "import": {
218
+ "./uuid": "{ uuid_ }"
219
+ },
220
+ "limit": "39 B"
221
+ },
222
+ {
223
+ "name": "short uuid",
224
+ "import": {
225
+ "./uuid": "{ short_uuid_ }"
226
+ },
227
+ "limit": "116 B"
228
+ }
229
+ ],
230
+ "scripts": {
231
+ "build": ":",
232
+ "clean": ":",
233
+ "exec": "$@",
234
+ "test": "pnpm run /^test:/",
235
+ "test:size": "size-limit",
236
+ "test:type": "check-dts",
237
+ "test:unit": "NODE_OPTIONS=--loader=esmock tsx node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
238
+ "disable:test:coverage": "c8 pnpm test:unit"
239
+ }
241
240
  }
package/rmemo/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { rmemo__subscribe } from '../rmemo/index.js'
2
- export { rmemo__subscribe as subscribe }
1
+ import { rmemo__off, rmemo__on, rmemo__subscribe } from '../rmemo/index.js'
2
+ export { rmemo__off as off, rmemo__on as on, rmemo__subscribe as subscribe }
3
3
  export * from '../all/be/index.js'
4
4
  export * from '../all/be_/index.js'
5
5
  export * from '../all/be_lock_memosig_triple/index.js'
package/rmemo/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { rmemo__subscribe } from '../rmemo/index.js'
2
- export { rmemo__subscribe as subscribe }
1
+ import { rmemo__off, rmemo__on, rmemo__subscribe } from '../rmemo/index.js'
2
+ export { rmemo__off as off, rmemo__on as on, rmemo__subscribe as subscribe }
3
3
  export * from '../all/be/index.js'
4
4
  export * from '../all/be_/index.js'
5
5
  export * from '../all/be_lock_memosig_triple/index.js'