ctx-core 4.19.0 → 5.0.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.
- package/all/a_in_idx_a_map/index.d.ts +1 -3
- package/all/a_item/index.d.ts +3 -9
- package/all/a_length/index.d.ts +4 -7
- package/all/a_nowrap/index.d.ts +1 -3
- package/all/a_present/index.d.ts +4 -7
- package/all/a_some/index.d.ts +1 -3
- package/all/and/index.d.ts +3 -9
- package/all/and_call/index.d.ts +4 -8
- package/all/andand/index.d.ts +4 -11
- package/all/andand_or/index.d.ts +6 -8
- package/all/andandfn/index.d.ts +3 -12
- package/all/apply/index.d.ts +2 -2
- package/all/arg_i0_a/index.d.ts +1 -1
- package/all/array_types/index.d.ts +21 -28
- package/all/assign_fn_key_a/index.d.ts +1 -3
- package/all/be/index.d.ts +5 -3
- package/all/be_/index.d.ts +69 -48
- package/all/be_/index.js +39 -76
- package/all/be_/index.test.ts +244 -121
- package/all/be_lock_memosig_triple/index.d.ts +16 -22
- package/all/be_lock_memosig_triple/index.test.ts +47 -36
- package/all/be_memo_pair/index.d.ts +14 -11
- package/all/be_memo_pair/index.js +1 -2
- package/all/be_memo_pair/index.test.ts +47 -31
- package/all/be_memosig_triple/index.d.ts +16 -22
- package/all/be_memosig_triple/index.test.ts +48 -34
- package/all/be_sig_triple/index.d.ts +16 -13
- package/all/be_sig_triple/index.js +2 -3
- package/all/be_sig_triple/index.test.ts +42 -29
- package/all/bind_apply/index.d.ts +3 -3
- package/all/bind_call/index.d.ts +10 -11
- package/all/bind_map_apply/index.d.ts +2 -2
- package/all/bind_map_call/index.d.ts +2 -2
- package/all/call/index.d.ts +3 -3
- package/all/call_assign/index.d.ts +2 -6
- package/all/call_fn_a/index.d.ts +4 -3
- package/all/call_or_fn/index.d.ts +1 -4
- package/all/chain/index.d.ts +4 -8
- package/all/chunk_aa/index.d.ts +3 -5
- package/all/clear_ctx/index.d.ts +1 -3
- package/all/combinators/index.d.ts +12 -49
- package/all/compact/index.d.ts +4 -7
- package/all/compact_a_ctx/index.d.ts +1 -3
- package/all/compare/index.d.ts +1 -3
- package/all/compose/index.d.ts +3 -3
- package/all/concat/index.d.ts +2 -6
- package/all/concat_truthy_a/index.d.ts +3 -4
- package/all/ctx/index.d.ts +18 -2
- package/all/ctx/index.js +20 -8
- package/all/ctx/index.test.ts +33 -7
- package/all/curry/index.d.ts +5 -7
- package/all/curry/index.js +6 -3
- package/all/debounce/index.d.ts +12 -12
- package/all/difference_a/index.d.ts +1 -3
- package/all/difference_by/index.d.ts +3 -4
- package/all/difference_set/index.d.ts +1 -5
- package/all/each/index.d.ts +5 -9
- package/all/ensure/index.d.ts +1 -3
- package/all/ensure__refresh/index.d.ts +1 -3
- package/all/eq/index.d.ts +4 -10
- package/all/eql/index.d.ts +3 -9
- package/all/eql_a/index.d.ts +1 -3
- package/all/eql_fn_a/index.d.ts +1 -3
- package/all/every/index.d.ts +3 -9
- package/all/exclude/index.d.ts +1 -4
- package/all/falsy_async_guard/index.d.ts +3 -4
- package/all/falsy_guard/index.d.ts +4 -3
- package/all/fetch__template_pair/index.test.ts +5 -5
- package/all/filter/index.d.ts +4 -12
- package/all/find/index.d.ts +6 -10
- package/all/first/index.d.ts +2 -7
- package/all/flatten/index.d.ts +2 -6
- package/all/flip/index.d.ts +3 -3
- package/all/hasOwnProperty_pick/index.d.ts +4 -4
- package/all/head_arg_a/index.d.ts +4 -3
- package/all/idx/index.d.ts +1 -3
- package/all/idx_reject/index.d.ts +3 -9
- package/all/idx_sort_a/index.d.ts +1 -3
- package/all/idx_sort_a__sort_idx_o/index.d.ts +1 -3
- package/all/idx_sort_r_a/index.d.ts +1 -3
- package/all/if_null_set_false/index.d.ts +1 -3
- package/all/ifelse/index.d.ts +5 -3
- package/all/iife/index.d.ts +3 -3
- package/all/index.d.ts +1 -0
- package/all/index.js +1 -0
- package/all/intersection_a/index.d.ts +5 -6
- package/all/intersection_by/index.d.ts +3 -4
- package/all/intersection_set/index.d.ts +1 -3
- package/all/isArray/index.d.ts +2 -2
- package/all/last/index.d.ts +2 -7
- package/all/left_and/index.d.ts +1 -3
- package/all/left_or/index.d.ts +1 -3
- package/all/many_andand/index.d.ts +7 -6
- package/all/many_andand_or/index.d.ts +2 -8
- package/all/map/index.d.ts +4 -18
- package/all/map_andand/index.d.ts +3 -9
- package/all/map_andand_or/index.d.ts +1 -3
- package/all/map_andandfn/index.d.ts +2 -6
- package/all/map_apply/index.d.ts +5 -8
- package/all/map_call/index.d.ts +5 -8
- package/all/map_find/index.d.ts +3 -11
- package/all/map_fn/index.d.ts +1 -4
- package/all/map_obj/index.d.ts +3 -12
- package/all/map_obj_andand/index.d.ts +2 -8
- package/all/merge/index.d.ts +1 -4
- package/all/mixin/index.d.ts +1 -4
- package/all/neq/index.d.ts +2 -6
- package/all/neql/index.d.ts +2 -6
- package/all/noinit/index.d.ts +5 -8
- package/all/not/index.d.ts +3 -9
- package/all/notnot/index.d.ts +2 -4
- package/all/nullish__guard/index.d.ts +3 -4
- package/all/nullish__guard__async/index.d.ts +3 -4
- package/all/nullish__none/index.d.ts +1 -3
- package/all/o_a_present/index.d.ts +2 -6
- package/all/o_some/index.d.ts +1 -3
- package/all/offset_destructure_aa/index.d.ts +1 -3
- package/all/offset_i_slice/index.d.ts +2 -6
- package/all/one_andand/index.d.ts +3 -3
- package/all/one_andand_or/index.d.ts +3 -5
- package/all/or/index.d.ts +6 -17
- package/all/or_property/index.d.ts +1 -5
- package/all/promise_timeout/index.d.ts +4 -4
- package/all/prototype_mixin/index.d.ts +4 -3
- package/all/prototype_mixin/index.js +3 -3
- package/all/push/index.d.ts +2 -6
- package/all/r_val_a/index.d.ts +2 -6
- package/all/rank/index.d.ts +3 -4
- package/all/reduce/index.d.ts +10 -23
- package/all/reject/index.d.ts +7 -14
- package/all/remove/index.d.ts +2 -6
- package/all/remove_idx/index.d.ts +4 -4
- package/all/resolver_curry/index.d.ts +2 -2
- package/all/reverse/index.d.ts +2 -10
- package/all/right_and/index.d.ts +1 -3
- package/all/right_or/index.d.ts +1 -3
- package/all/rmemo/index.js +3 -3
- package/all/rmemo__wait/index.test.ts +1 -1
- package/all/run/index.d.ts +1 -4
- package/all/selector_splice/index.d.ts +1 -3
- package/all/slice/index.d.ts +5 -15
- package/all/slice_arg_a/index.d.ts +3 -12
- package/all/slice_arg_spread_a/index.d.ts +3 -11
- package/all/sort/index.d.ts +4 -14
- package/all/sort_a/index.d.ts +2 -6
- package/all/sort_idx_a/index.d.ts +2 -6
- package/all/sort_idx_o/index.d.ts +2 -6
- package/all/sort_val_a/index.d.ts +2 -6
- package/all/sort_val_a__transition_idx_a/index.d.ts +4 -12
- package/all/sort_val_a__transition_idx_a/index.js +4 -2
- package/all/sparse_a/index.d.ts +1 -3
- package/all/splice/index.d.ts +2 -6
- package/all/spread/index.d.ts +2 -6
- package/all/tap/index.d.ts +1 -3
- package/all/test/index.d.ts +12 -0
- package/all/test/index.js +1 -0
- package/all/throttle/index.d.ts +2 -2
- package/all/throttle/index.js +8 -7
- package/all/tick/index.d.ts +1 -5
- package/all/timeout_promise/index.d.ts +1 -5
- package/all/times/index.d.ts +1 -5
- package/all/tup/index.d.ts +22 -6
- package/all/union_a/index.d.ts +1 -3
- package/all/union_set/index.d.ts +1 -5
- package/all/val/index.d.ts +1 -3
- package/all/value_r/index.d.ts +2 -6
- package/all/weak_r/index.d.ts +3 -3
- package/all/wrap_a/index.d.ts +4 -12
- package/all/wrap_a_item/index.d.ts +4 -3
- package/all/wrap_aa/index.d.ts +2 -8
- package/all/wrap_aa_item/index.d.ts +4 -3
- package/all/wrap_concat/index.d.ts +1 -5
- package/package.json +33 -10
- package/test/index.d.ts +1 -0
- package/test/index.js +1 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { test } from 'uvu'
|
|
2
2
|
import { equal } from 'uvu/assert'
|
|
3
|
-
import { be_ } from '../be_/index.js'
|
|
3
|
+
import { be_, type Ctx_wide_T } from '../be_/index.js'
|
|
4
4
|
import { be_sig_triple_ } from '../be_sig_triple/index.js'
|
|
5
|
-
import { ctx__new } from '../ctx/index.js'
|
|
5
|
+
import { ctx__new, ns_ctx__new } from '../ctx/index.js'
|
|
6
6
|
import { memosig_, type sig_T } from '../rmemo/index.js'
|
|
7
|
+
import type { Equal, Expect } from '../test/index.js'
|
|
7
8
|
import { be_lock_memosig_triple_ } from './index.js'
|
|
8
9
|
test('be_lock_memosig_triple_', ()=>{
|
|
9
10
|
const [
|
|
@@ -15,9 +16,12 @@ test('be_lock_memosig_triple_', ()=>{
|
|
|
15
16
|
foobar$_,
|
|
16
17
|
foobar_,
|
|
17
18
|
foobar__set,
|
|
18
|
-
] = be_lock_memosig_triple_<number, sig_T<number>&{
|
|
19
|
+
] = be_lock_memosig_triple_<number, '', sig_T<number>&{
|
|
19
20
|
count:number
|
|
20
|
-
}>((
|
|
21
|
+
}>((
|
|
22
|
+
_ctx,
|
|
23
|
+
foobar$
|
|
24
|
+
)=>{
|
|
21
25
|
equal(_ctx, ctx)
|
|
22
26
|
foobar$.count = (foobar$.count ||= 0) + 1
|
|
23
27
|
return base_(ctx) + 1
|
|
@@ -36,8 +40,8 @@ test('be_lock_memosig_triple_', ()=>{
|
|
|
36
40
|
equal(foobar_(ctx), 5)
|
|
37
41
|
equal(foobar$_(ctx).count, 1)
|
|
38
42
|
})
|
|
39
|
-
test('be_lock_memosig_triple_|+id|+
|
|
40
|
-
const ctx =
|
|
43
|
+
test('be_lock_memosig_triple_|+id|+ns', ()=>{
|
|
44
|
+
const ctx = ns_ctx__new('test_ns')
|
|
41
45
|
let subscriber_count = 0
|
|
42
46
|
const [
|
|
43
47
|
,
|
|
@@ -45,65 +49,72 @@ test('be_lock_memosig_triple_|+id|+is_source_', ()=>{
|
|
|
45
49
|
base__set,
|
|
46
50
|
] = be_sig_triple_(
|
|
47
51
|
()=>1,
|
|
48
|
-
{
|
|
52
|
+
{ ns: 'test_ns' })
|
|
49
53
|
const [
|
|
50
54
|
,
|
|
51
55
|
subscriber_dep_,
|
|
52
56
|
subscriber_dep__set
|
|
53
57
|
] = be_sig_triple_(()=>1,
|
|
54
|
-
{
|
|
58
|
+
{ ns: 'test_ns' })
|
|
55
59
|
const [
|
|
56
60
|
foobar$_,
|
|
57
61
|
foobar_,
|
|
58
62
|
foobar__set,
|
|
59
|
-
] = be_lock_memosig_triple_(
|
|
60
|
-
ctx=>
|
|
61
|
-
|
|
63
|
+
] = be_lock_memosig_triple_<number, 'test_ns'>(
|
|
64
|
+
ctx=>{
|
|
65
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
66
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<'test_ns'>>>
|
|
67
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
68
|
+
return base_(ctx) + 1
|
|
69
|
+
},
|
|
62
70
|
(ctx, foobar$)=>{
|
|
63
71
|
subscriber_count++
|
|
64
72
|
subscriber_dep__set(ctx, subscriber_count + foobar$())
|
|
65
73
|
},
|
|
66
|
-
{ id: 'foobar',
|
|
74
|
+
{ id: 'foobar', ns: 'test_ns' })
|
|
67
75
|
equal(subscriber_count, 0)
|
|
68
|
-
equal(foobar$_(
|
|
69
|
-
equal(foobar_(
|
|
76
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
77
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
70
78
|
equal(foobar$_(ctx)._, 2)
|
|
71
79
|
equal(foobar_(ctx), 2)
|
|
72
80
|
equal(subscriber_count, 1)
|
|
73
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 2)
|
|
81
|
+
equal((ctx.s['test_ns'].get('foobar') as sig_T<number>)._, 2)
|
|
74
82
|
equal(subscriber_dep_(ctx), 3)
|
|
75
|
-
foobar__set(
|
|
76
|
-
equal(foobar$_(
|
|
77
|
-
equal(foobar_(
|
|
83
|
+
foobar__set(ns_ctx__new(ctx__new(), ctx), 5)
|
|
84
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
85
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
78
86
|
equal(foobar$_(ctx)._, 5)
|
|
79
87
|
equal(foobar_(ctx), 5)
|
|
80
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 5)
|
|
88
|
+
equal((ctx.s['test_ns'].get('foobar') as sig_T<number>)._, 5)
|
|
81
89
|
equal(subscriber_count, 2)
|
|
82
90
|
equal(subscriber_dep_(ctx), 7)
|
|
83
91
|
base__set(ctx, 2)
|
|
84
|
-
equal(foobar$_(
|
|
85
|
-
equal(foobar_(
|
|
92
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
93
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
86
94
|
equal(foobar$_(ctx)._, 5)
|
|
87
95
|
equal(foobar_(ctx), 5)
|
|
88
96
|
equal(subscriber_count, 2)
|
|
89
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 5)
|
|
97
|
+
equal((ctx.s['test_ns'].get('foobar') as sig_T<number>)._, 5)
|
|
90
98
|
equal(subscriber_dep_(ctx), 7)
|
|
91
99
|
})
|
|
92
100
|
test('be_lock_memosig_triple_|+be', ()=>{
|
|
93
|
-
const ctx =
|
|
101
|
+
const ctx = ns_ctx__new('test_ns')
|
|
94
102
|
let subscriber_count = 0
|
|
95
103
|
const [
|
|
96
104
|
,
|
|
97
105
|
base_,
|
|
98
106
|
base__set,
|
|
99
107
|
] = be_sig_triple_(()=>1,
|
|
100
|
-
{
|
|
108
|
+
{ ns: 'test_ns' })
|
|
101
109
|
const [
|
|
102
110
|
foobar$_,
|
|
103
111
|
foobar_,
|
|
104
112
|
foobar__set,
|
|
105
|
-
] = be_lock_memosig_triple_<number, custom_sig_T>(
|
|
113
|
+
] = be_lock_memosig_triple_<number, 'test_ns', custom_sig_T>(
|
|
106
114
|
be_(ctx=>{
|
|
115
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
116
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<'test_ns'>>>
|
|
117
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
107
118
|
const foobar$ =
|
|
108
119
|
memosig_(()=>base_(ctx) + 1,
|
|
109
120
|
foobar$=>{
|
|
@@ -112,29 +123,29 @@ test('be_lock_memosig_triple_|+be', ()=>{
|
|
|
112
123
|
}) as custom_sig_T
|
|
113
124
|
foobar$.custom = 'custom-val'
|
|
114
125
|
return foobar$
|
|
115
|
-
}, { id: 'foobar',
|
|
126
|
+
}, { id: 'foobar', ns: 'test_ns' }))
|
|
116
127
|
equal(subscriber_count, 0)
|
|
117
|
-
equal(foobar$_(
|
|
118
|
-
equal(foobar_(
|
|
128
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
129
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
119
130
|
equal(foobar$_(ctx)._, 2)
|
|
120
131
|
equal(foobar_(ctx), 2)
|
|
121
132
|
equal(subscriber_count, 1)
|
|
122
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 2)
|
|
133
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
123
134
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
124
135
|
foobar__set(ctx, 5)
|
|
125
|
-
equal(foobar$_(
|
|
126
|
-
equal(foobar_(
|
|
136
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
137
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
127
138
|
equal(foobar$_(ctx)._, 5)
|
|
128
139
|
equal(foobar_(ctx), 5)
|
|
129
140
|
equal(subscriber_count, 2)
|
|
130
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 5)
|
|
141
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 5)
|
|
131
142
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
132
|
-
base__set(
|
|
133
|
-
equal(foobar$_(
|
|
134
|
-
equal(foobar_(
|
|
143
|
+
base__set(ns_ctx__new(ctx__new(), ctx), 2)
|
|
144
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
145
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
135
146
|
equal(foobar$_(ctx)._, 3)
|
|
136
147
|
equal(foobar_(ctx), 3)
|
|
137
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 3)
|
|
148
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 3)
|
|
138
149
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
139
150
|
equal(subscriber_count, 3)
|
|
140
151
|
})
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import type { Be, be_config_T, Ctx } from '../be_/index.js'
|
|
1
|
+
import type { Be, be_config_T, Ctx, ctx__be_T, ctx__get_T, Ctx_wide_T } from '../be_/index.js'
|
|
2
2
|
import type { memo_T, sig_T } from '../rmemo/index.js'
|
|
3
3
|
export declare function be_memo_pair_<
|
|
4
4
|
val_T,
|
|
5
|
+
ns_T extends string = '',
|
|
5
6
|
_memo_T extends memo_T<val_T> = memo_T<val_T>,
|
|
6
|
-
ctx_T extends Ctx =
|
|
7
|
-
>(be:Be<_memo_T, ctx_T>):be_memo_pair_T<val_T, _memo_T, ctx_T>
|
|
7
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>,
|
|
8
|
+
>(be:Be<_memo_T, ns_T, ctx_T>):be_memo_pair_T<val_T, ns_T, _memo_T, ctx_T>
|
|
8
9
|
export declare function be_memo_pair_<
|
|
9
10
|
val_T,
|
|
11
|
+
ns_T extends string = '',
|
|
10
12
|
_memo_T extends memo_T<val_T> = memo_T<val_T>,
|
|
11
|
-
ctx_T extends Ctx =
|
|
13
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>
|
|
12
14
|
>(
|
|
13
|
-
rmemo__new:(ctx:
|
|
15
|
+
rmemo__new:(ctx:ctx_T, memo:_memo_T&{ _:val_T })=>val_T,
|
|
14
16
|
...subscriber_a_THEN_config:
|
|
15
|
-
|[...((ctx:
|
|
16
|
-
|[...((ctx:
|
|
17
|
-
):be_memo_pair_T<val_T, _memo_T, ctx_T>
|
|
17
|
+
|[...((ctx:ctx_T, memosig:sig_T<val_T>)=>unknown)[]]
|
|
18
|
+
|[...((ctx:ctx_T, memosig:sig_T<val_T>)=>unknown)[], config:be_config_T]
|
|
19
|
+
):be_memo_pair_T<val_T, ns_T, _memo_T, ctx_T>
|
|
18
20
|
export type be_memo_pair_T<
|
|
19
21
|
val_T,
|
|
22
|
+
ns_T extends string = '',
|
|
20
23
|
_memo_T extends memo_T<val_T> = memo_T<val_T>,
|
|
21
|
-
ctx_T extends Ctx =
|
|
24
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>
|
|
22
25
|
> = [
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
ctx__be_T<ctx_T, _memo_T, ns_T>,
|
|
27
|
+
ctx__get_T<ctx_T, val_T>,
|
|
25
28
|
]
|
|
@@ -15,8 +15,7 @@ export function be_memo_pair_(
|
|
|
15
15
|
) {
|
|
16
16
|
let config =
|
|
17
17
|
typeof subscriber_a_THEN_config[subscriber_a_THEN_config.length - 1] === 'object'
|
|
18
|
-
|
|
19
|
-
: 0
|
|
18
|
+
&& subscriber_a_THEN_config.pop()
|
|
20
19
|
/** @type {Be} */
|
|
21
20
|
let be =
|
|
22
21
|
be_OR_val__new.is_be
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { test } from 'uvu'
|
|
2
2
|
import { equal } from 'uvu/assert'
|
|
3
|
-
import { be_ } from '../be_/index.js'
|
|
3
|
+
import { be_, type Ctx_wide_T } from '../be_/index.js'
|
|
4
4
|
import { be_sig_triple_ } from '../be_sig_triple/index.js'
|
|
5
|
-
import { ctx__new } from '../ctx/index.js'
|
|
5
|
+
import { ctx__new, ns_ctx__new } from '../ctx/index.js'
|
|
6
6
|
import type { memo_T, sig_T } from '../rmemo/index.js'
|
|
7
7
|
import { memo_ } from '../rmemo/index.js'
|
|
8
|
+
import type { Equal, Expect } from '../test/index.js'
|
|
8
9
|
import { be_memo_pair_ } from './index.js'
|
|
9
10
|
test('be_memo_pair_', ()=>{
|
|
10
11
|
const [
|
|
@@ -15,7 +16,13 @@ test('be_memo_pair_', ()=>{
|
|
|
15
16
|
const [
|
|
16
17
|
foobar$_,
|
|
17
18
|
foobar_,
|
|
18
|
-
] = be_memo_pair_<number, sig_T<number>&{ count:number }>((
|
|
19
|
+
] = be_memo_pair_<number, '', sig_T<number>&{ count:number }>((
|
|
20
|
+
_ctx,
|
|
21
|
+
foobar$
|
|
22
|
+
)=>{
|
|
23
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
24
|
+
type test__ctx = Expect<Equal<typeof _ctx, Ctx_wide_T<''>>>
|
|
25
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
19
26
|
equal(_ctx, ctx)
|
|
20
27
|
foobar$.count = (foobar$.count ||= 0) + 1
|
|
21
28
|
return base_(ctx) + 1
|
|
@@ -30,44 +37,47 @@ test('be_memo_pair_', ()=>{
|
|
|
30
37
|
equal(foobar_(ctx), 3)
|
|
31
38
|
equal(foobar$_(ctx).count, 2)
|
|
32
39
|
})
|
|
33
|
-
test('be_memo_pair_|+id|+
|
|
34
|
-
const ctx =
|
|
40
|
+
test('be_memo_pair_|+id|+ns|+oninit|+subscriber_a', ()=>{
|
|
41
|
+
const ctx = ns_ctx__new('test_ns')
|
|
35
42
|
let subscriber_count = 0
|
|
36
43
|
const [
|
|
37
44
|
,
|
|
38
45
|
subscriber_dep_,
|
|
39
46
|
subscriber_dep__set
|
|
40
47
|
] = be_sig_triple_(()=>1,
|
|
41
|
-
{
|
|
48
|
+
{ ns: 'test_ns' })
|
|
42
49
|
const [
|
|
43
50
|
,
|
|
44
51
|
base_,
|
|
45
52
|
base__set,
|
|
46
53
|
] = be_sig_triple_(()=>1,
|
|
47
|
-
{
|
|
54
|
+
{ ns: 'test_ns' })
|
|
48
55
|
const [
|
|
49
56
|
foobar$_,
|
|
50
57
|
foobar_,
|
|
51
|
-
] = be_memo_pair_(ctx=>base_(ctx) + 1,
|
|
58
|
+
] = be_memo_pair_<number, 'test_ns'>(ctx=>base_(ctx) + 1,
|
|
52
59
|
(ctx, foobar$)=>{
|
|
60
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
61
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<'test_ns'>>>
|
|
62
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
53
63
|
subscriber_count++
|
|
54
64
|
subscriber_dep__set(ctx, subscriber_count + foobar$())
|
|
55
65
|
},
|
|
56
|
-
{ id: 'foobar',
|
|
66
|
+
{ id: 'foobar', ns: 'test_ns' })
|
|
57
67
|
equal(subscriber_count, 0)
|
|
58
|
-
equal(foobar$_(
|
|
59
|
-
equal(foobar_(
|
|
68
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
69
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
60
70
|
equal(foobar$_(ctx)._, 2)
|
|
61
71
|
equal(foobar_(ctx), 2)
|
|
62
|
-
equal((ctx.get('foobar') as memo_T<number>)._, 2)
|
|
72
|
+
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 2)
|
|
63
73
|
equal(subscriber_count, 1)
|
|
64
74
|
equal(subscriber_dep_(ctx), 3)
|
|
65
75
|
base__set(ctx, 2)
|
|
66
|
-
equal(foobar$_(
|
|
67
|
-
equal(foobar_(
|
|
76
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
77
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
68
78
|
equal(foobar$_(ctx)._, 3)
|
|
69
79
|
equal(foobar_(ctx), 3)
|
|
70
|
-
equal((ctx.get('foobar') as memo_T<number>)._, 3)
|
|
80
|
+
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 3)
|
|
71
81
|
equal(subscriber_count, 2)
|
|
72
82
|
equal(subscriber_dep_(ctx), 5)
|
|
73
83
|
})
|
|
@@ -81,10 +91,14 @@ test('be_memo_pair_|subscriber|receives a memosig to set the value of the memo',
|
|
|
81
91
|
const [
|
|
82
92
|
foobar$_,
|
|
83
93
|
foobar_,
|
|
84
|
-
] = be_memo_pair_(ctx=>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
] = be_memo_pair_(ctx=>{
|
|
95
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
96
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<''>>>
|
|
97
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
98
|
+
return 1
|
|
99
|
+
}, (ctx, foobar$)=>{
|
|
100
|
+
foobar$._ = base_(ctx) + 1
|
|
101
|
+
})
|
|
88
102
|
equal(foobar$_(ctx)._, 2)
|
|
89
103
|
equal(foobar_(ctx), 2)
|
|
90
104
|
base__set(ctx, 2)
|
|
@@ -92,45 +106,47 @@ test('be_memo_pair_|subscriber|receives a memosig to set the value of the memo',
|
|
|
92
106
|
equal(foobar_(ctx), 3)
|
|
93
107
|
})
|
|
94
108
|
test('be_memo_pair_|be', ()=>{
|
|
95
|
-
const ctx =
|
|
109
|
+
const ctx = ns_ctx__new('test_ns')
|
|
96
110
|
let subscriber_count = 0
|
|
97
111
|
const [
|
|
98
112
|
,
|
|
99
113
|
base_,
|
|
100
114
|
base__set,
|
|
101
115
|
] = be_sig_triple_(()=>1,
|
|
102
|
-
{
|
|
116
|
+
{ ns: 'test_ns' })
|
|
103
117
|
const [
|
|
104
118
|
foobar$_,
|
|
105
119
|
foobar_,
|
|
106
|
-
] = be_memo_pair_<number, custom_memo_T>(
|
|
120
|
+
] = be_memo_pair_<number, 'test_ns', custom_memo_T>(
|
|
107
121
|
be_(_ctx=>{
|
|
122
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
123
|
+
type test__ctx = Expect<Equal<typeof _ctx, Ctx_wide_T<'test_ns'>>>
|
|
124
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
108
125
|
const foobar$ = memo_(
|
|
109
126
|
()=>base_(ctx) + 1,
|
|
110
127
|
()=>subscriber_count++
|
|
111
128
|
) as custom_memo_T
|
|
112
|
-
|
|
113
|
-
else equal(_ctx, ctx)
|
|
129
|
+
equal(_ctx.s.test_ns, ctx.s.test_ns)
|
|
114
130
|
foobar$.custom = 'custom-val'
|
|
115
131
|
return foobar$
|
|
116
132
|
}, {
|
|
117
133
|
id: 'foobar',
|
|
118
|
-
|
|
134
|
+
ns: 'test_ns',
|
|
119
135
|
}))
|
|
120
136
|
equal(subscriber_count, 0)
|
|
121
|
-
equal(foobar$_(
|
|
122
|
-
equal(foobar_(
|
|
137
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
138
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
123
139
|
equal(foobar$_(ctx)._, 2)
|
|
124
140
|
equal(foobar_(ctx), 2)
|
|
125
|
-
equal((ctx.get('foobar') as memo_T<number>)._, 2)
|
|
141
|
+
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 2)
|
|
126
142
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
127
143
|
equal(subscriber_count, 1)
|
|
128
144
|
base__set(ctx, 2)
|
|
129
|
-
equal(foobar$_(
|
|
130
|
-
equal(foobar_(
|
|
145
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
146
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
131
147
|
equal(foobar$_(ctx)._, 3)
|
|
132
148
|
equal(foobar_(ctx), 3)
|
|
133
|
-
equal((ctx.get('foobar') as memo_T<number>)._, 3)
|
|
149
|
+
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 3)
|
|
134
150
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
135
151
|
equal(subscriber_count, 1)
|
|
136
152
|
})
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import type { Be, be_config_T, Ctx } from '../be_/index.js'
|
|
2
|
-
import type {
|
|
1
|
+
import type { Be, be_config_T, Ctx, ctx__be_T, ctx__get_T, ctx__set_T, Ctx_wide_T } from '../be_/index.js'
|
|
2
|
+
import type { sig_T } from '../rmemo/index.js'
|
|
3
3
|
export declare function be_memosig_triple_<
|
|
4
4
|
val_T,
|
|
5
|
+
ns_T extends string = '',
|
|
5
6
|
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
6
|
-
ctx_T extends Ctx =
|
|
7
|
-
>(be:Be<_sig_T, ctx_T>):be_memosig_triple_T<val_T, _sig_T, ctx_T>
|
|
7
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>,
|
|
8
|
+
>(be:Be<_sig_T, ns_T, ctx_T>):be_memosig_triple_T<val_T, ns_T, _sig_T, ctx_T>
|
|
8
9
|
export declare function be_memosig_triple_<
|
|
9
10
|
val_T,
|
|
11
|
+
ns_T extends string = '',
|
|
10
12
|
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
11
|
-
ctx_T extends Ctx =
|
|
13
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>
|
|
12
14
|
>(
|
|
13
|
-
rmemo__new:(ctx:
|
|
15
|
+
rmemo__new:(ctx:ctx_T, memosig:_sig_T)=>val_T,
|
|
14
16
|
...subscriber_a_THEN_config:
|
|
15
|
-
|[...((ctx:
|
|
16
|
-
|[...((ctx:
|
|
17
|
-
):be_memosig_triple_T<val_T, _sig_T, ctx_T>
|
|
18
|
-
export declare function globalThis__be_memosig_triple_<
|
|
19
|
-
val_T,
|
|
20
|
-
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
21
|
-
ctx_T extends Ctx = Ctx
|
|
22
|
-
>(
|
|
23
|
-
rmemo__new:(ctx:Ctx, memosig:_sig_T)=>val_T,
|
|
24
|
-
...subscriber_a_THEN_config:
|
|
25
|
-
|[...((ctx:Ctx, sig:_sig_T)=>unknown)[], config:be_config_T&{ id:string }]
|
|
26
|
-
):be_memosig_triple_T<val_T, _sig_T, ctx_T>
|
|
17
|
+
|[...((ctx:ctx_T, sig:_sig_T)=>unknown)[]]
|
|
18
|
+
|[...((ctx:ctx_T, sig:_sig_T)=>unknown)[], config:be_config_T<ns_T>]
|
|
19
|
+
):be_memosig_triple_T<val_T, ns_T, _sig_T, ctx_T>
|
|
27
20
|
export type be_memosig_triple_T<
|
|
28
21
|
val_T,
|
|
22
|
+
ns_T extends string = '',
|
|
29
23
|
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
30
|
-
ctx_T extends Ctx =
|
|
24
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>
|
|
31
25
|
> = [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
ctx__be_T<ctx_T, _sig_T, ns_T>,
|
|
27
|
+
ctx__get_T<ctx_T, val_T>,
|
|
28
|
+
ctx__set_T<ctx_T, val_T>,
|
|
35
29
|
]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { test } from 'uvu'
|
|
2
2
|
import { equal } from 'uvu/assert'
|
|
3
|
-
import { be_ } from '../be_/index.js'
|
|
3
|
+
import { be_, type Ctx_wide_T } from '../be_/index.js'
|
|
4
4
|
import { be_sig_triple_ } from '../be_sig_triple/index.js'
|
|
5
|
-
import { ctx__new } from '../ctx/index.js'
|
|
5
|
+
import { ctx__new, ns_ctx__new } from '../ctx/index.js'
|
|
6
6
|
import { memosig_, type sig_T } from '../rmemo/index.js'
|
|
7
|
+
import type { Equal, Expect } from '../test/index.js'
|
|
7
8
|
import { be_memosig_triple_ } from './index.js'
|
|
8
9
|
test('be_memosig_triple_', ()=>{
|
|
9
10
|
const [
|
|
@@ -15,9 +16,12 @@ test('be_memosig_triple_', ()=>{
|
|
|
15
16
|
foobar$_,
|
|
16
17
|
foobar_,
|
|
17
18
|
foobar__set,
|
|
18
|
-
] = be_memosig_triple_<number, sig_T<number>&{
|
|
19
|
+
] = be_memosig_triple_<number, '', sig_T<number>&{
|
|
19
20
|
count:number
|
|
20
21
|
}>((_ctx, foobar$)=>{
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
23
|
+
type test__ctx = Expect<Equal<typeof _ctx, Ctx_wide_T<''>>>
|
|
24
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
21
25
|
equal(_ctx, ctx)
|
|
22
26
|
foobar$.count = (foobar$.count ||= 0) + 1
|
|
23
27
|
return base_(ctx) + 1
|
|
@@ -36,8 +40,8 @@ test('be_memosig_triple_', ()=>{
|
|
|
36
40
|
equal(foobar_(ctx), 3)
|
|
37
41
|
equal(foobar$_(ctx).count, 2)
|
|
38
42
|
})
|
|
39
|
-
test('be_memosig_triple_|+id|+
|
|
40
|
-
const ctx =
|
|
43
|
+
test('be_memosig_triple_|+id|+ns', ()=>{
|
|
44
|
+
const ctx = ns_ctx__new('test_ns')
|
|
41
45
|
let subscriber_count = 0
|
|
42
46
|
const [
|
|
43
47
|
,
|
|
@@ -45,65 +49,75 @@ test('be_memosig_triple_|+id|+is_source_', ()=>{
|
|
|
45
49
|
base__set,
|
|
46
50
|
] = be_sig_triple_(
|
|
47
51
|
()=>1,
|
|
48
|
-
{
|
|
52
|
+
{ ns: 'test_ns' })
|
|
49
53
|
const [
|
|
50
54
|
,
|
|
51
55
|
subscriber_dep_,
|
|
52
56
|
subscriber_dep__set
|
|
53
57
|
] = be_sig_triple_(()=>1,
|
|
54
|
-
{
|
|
58
|
+
{ ns: 'test_ns' })
|
|
55
59
|
const [
|
|
56
60
|
foobar$_,
|
|
57
61
|
foobar_,
|
|
58
62
|
foobar__set,
|
|
59
63
|
] = be_memosig_triple_(
|
|
60
|
-
ctx=>
|
|
61
|
-
|
|
64
|
+
ctx=>{
|
|
65
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
66
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<'test_ns'>>>
|
|
67
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
68
|
+
return base_(ctx) + 1
|
|
69
|
+
},
|
|
62
70
|
(ctx, foobar$)=>{
|
|
71
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
72
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<'test_ns'>>>
|
|
73
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
63
74
|
subscriber_count++
|
|
64
75
|
subscriber_dep__set(ctx, subscriber_count + foobar$())
|
|
65
76
|
},
|
|
66
|
-
{ id: 'foobar',
|
|
77
|
+
{ id: 'foobar', ns: 'test_ns' })
|
|
67
78
|
equal(subscriber_count, 0)
|
|
68
|
-
equal(foobar$_(
|
|
69
|
-
equal(foobar_(
|
|
79
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
80
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
70
81
|
equal(foobar$_(ctx)._, 2)
|
|
71
82
|
equal(foobar_(ctx), 2)
|
|
72
83
|
equal(subscriber_count, 1)
|
|
73
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 2)
|
|
84
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
74
85
|
equal(subscriber_dep_(ctx), 3)
|
|
75
|
-
foobar__set(
|
|
76
|
-
equal(foobar$_(
|
|
77
|
-
equal(foobar_(
|
|
86
|
+
foobar__set(ns_ctx__new(ctx__new(), ctx), 5)
|
|
87
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
88
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
78
89
|
equal(foobar$_(ctx)._, 5)
|
|
79
90
|
equal(foobar_(ctx), 5)
|
|
80
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 5)
|
|
91
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 5)
|
|
81
92
|
equal(subscriber_count, 2)
|
|
82
93
|
equal(subscriber_dep_(ctx), 7)
|
|
83
94
|
base__set(ctx, 2)
|
|
84
|
-
equal(foobar$_(
|
|
85
|
-
equal(foobar_(
|
|
95
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
96
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
86
97
|
equal(foobar$_(ctx)._, 3)
|
|
87
98
|
equal(foobar_(ctx), 3)
|
|
88
99
|
equal(subscriber_count, 3)
|
|
89
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 3)
|
|
100
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 3)
|
|
90
101
|
equal(subscriber_dep_(ctx), 6)
|
|
91
102
|
})
|
|
92
103
|
test('be_memosig_triple_|+be', ()=>{
|
|
93
|
-
const ctx =
|
|
104
|
+
const ctx = ns_ctx__new('test_ns')
|
|
94
105
|
let subscriber_count = 0
|
|
95
106
|
const [
|
|
96
107
|
,
|
|
97
108
|
base_,
|
|
98
109
|
base__set,
|
|
99
110
|
] = be_sig_triple_(()=>1,
|
|
100
|
-
{
|
|
111
|
+
{ ns: 'test_ns' })
|
|
101
112
|
const [
|
|
102
113
|
foobar$_,
|
|
103
114
|
foobar_,
|
|
104
115
|
foobar__set,
|
|
105
|
-
] = be_memosig_triple_<number, custom_sig_T>(
|
|
116
|
+
] = be_memosig_triple_<number, 'test_ns', custom_sig_T>(
|
|
106
117
|
be_(ctx=>{
|
|
118
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
119
|
+
type test_ctx = Expect<Equal<typeof ctx, Ctx_wide_T<'test_ns'>>>
|
|
120
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
107
121
|
const foobar$ =
|
|
108
122
|
memosig_(()=>base_(ctx) + 1,
|
|
109
123
|
foobar$=>{
|
|
@@ -112,29 +126,29 @@ test('be_memosig_triple_|+be', ()=>{
|
|
|
112
126
|
}) as custom_sig_T
|
|
113
127
|
foobar$.custom = 'custom-val'
|
|
114
128
|
return foobar$
|
|
115
|
-
}, { id: 'foobar',
|
|
129
|
+
}, { id: 'foobar', ns: 'test_ns' }))
|
|
116
130
|
equal(subscriber_count, 0)
|
|
117
|
-
equal(foobar$_(
|
|
118
|
-
equal(foobar_(
|
|
131
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
132
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
119
133
|
equal(foobar$_(ctx)._, 2)
|
|
120
134
|
equal(foobar_(ctx), 2)
|
|
121
135
|
equal(subscriber_count, 1)
|
|
122
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 2)
|
|
136
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
123
137
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
124
138
|
foobar__set(ctx, 5)
|
|
125
|
-
equal(foobar$_(
|
|
126
|
-
equal(foobar_(
|
|
139
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
140
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
127
141
|
equal(foobar$_(ctx)._, 5)
|
|
128
142
|
equal(foobar_(ctx), 5)
|
|
129
143
|
equal(subscriber_count, 2)
|
|
130
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 5)
|
|
144
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 5)
|
|
131
145
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
132
|
-
base__set(
|
|
133
|
-
equal(foobar$_(
|
|
134
|
-
equal(foobar_(
|
|
146
|
+
base__set(ns_ctx__new(ctx__new(), ctx), 2)
|
|
147
|
+
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
148
|
+
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
135
149
|
equal(foobar$_(ctx)._, 3)
|
|
136
150
|
equal(foobar_(ctx), 3)
|
|
137
|
-
equal((ctx.get('foobar') as sig_T<number>)._, 3)
|
|
151
|
+
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 3)
|
|
138
152
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
139
153
|
equal(subscriber_count, 3)
|
|
140
154
|
})
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import type { Be, be_config_T, Ctx } from '../be_/index.js'
|
|
2
|
-
import type {
|
|
1
|
+
import type { Be, be_config_T, Ctx, ctx__be_T, ctx__get_T, ctx__set_T, Ctx_wide_T } from '../be_/index.js'
|
|
2
|
+
import type { sig_T } from '../rmemo/index.js'
|
|
3
3
|
export declare function be_sig_triple_<
|
|
4
4
|
val_T,
|
|
5
|
+
ns_T extends string = '',
|
|
5
6
|
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
6
|
-
ctx_T extends Ctx =
|
|
7
|
-
>(be:Be<_sig_T, ctx_T>):be_sig_triple_T<val_T, _sig_T, ctx_T>
|
|
7
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>,
|
|
8
|
+
>(be:Be<_sig_T, ns_T, ctx_T>):be_sig_triple_T<val_T, ns_T, _sig_T, ctx_T>
|
|
8
9
|
export declare function be_sig_triple_<
|
|
9
10
|
val_T,
|
|
11
|
+
ns_T extends string = '',
|
|
10
12
|
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
11
|
-
ctx_T extends Ctx =
|
|
13
|
+
ctx_T extends Ctx = Ctx_wide_T<ns_T>,
|
|
12
14
|
>(
|
|
13
|
-
val__new:(ctx:
|
|
15
|
+
val__new:(ctx:ctx_T)=>val_T,
|
|
14
16
|
...subscriber_a_THEN_config:
|
|
15
|
-
|[...((ctx:
|
|
16
|
-
|[...((ctx:
|
|
17
|
-
):be_sig_triple_T<val_T, _sig_T, ctx_T>
|
|
17
|
+
|[...((ctx:ctx_T, sig:_sig_T)=>unknown)[]]
|
|
18
|
+
|[...((ctx:ctx_T, sig:_sig_T)=>unknown)[], config:be_config_T<ns_T>]
|
|
19
|
+
):be_sig_triple_T<val_T, ns_T, _sig_T, ctx_T>
|
|
18
20
|
export type be_sig_triple_T<
|
|
19
21
|
val_T,
|
|
22
|
+
source extends string = '',
|
|
20
23
|
_sig_T extends sig_T<val_T> = sig_T<val_T>,
|
|
21
|
-
ctx_T extends Ctx =
|
|
24
|
+
ctx_T extends Ctx = Ctx_wide_T<source>
|
|
22
25
|
> = [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
ctx__be_T<ctx_T, _sig_T, source>,
|
|
27
|
+
ctx__get_T<ctx_T, val_T>,
|
|
28
|
+
ctx__set_T<ctx_T, val_T>
|
|
26
29
|
]
|