@txnlab/use-wallet-solid 3.2.0 → 3.2.1
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/dist/dev.cjs +109 -208
- package/dist/dev.js +109 -208
- package/dist/dev.jsx +107 -174
- package/dist/index.cjs +109 -208
- package/dist/index.js +109 -208
- package/dist/index.jsx +107 -174
- package/package.json +13 -13
package/dist/dev.jsx
CHANGED
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
import { useStore } from "@tanstack/solid-store";
|
|
3
3
|
import algosdk from "algosdk";
|
|
4
4
|
|
|
5
|
-
// ../../node_modules/.pnpm/solid-js@1.8.
|
|
5
|
+
// ../../node_modules/.pnpm/solid-js@1.8.22/node_modules/solid-js/dist/solid.js
|
|
6
6
|
var sharedConfig = {
|
|
7
7
|
context: void 0,
|
|
8
|
-
registry: void 0
|
|
8
|
+
registry: void 0,
|
|
9
|
+
effects: void 0,
|
|
10
|
+
done: false,
|
|
11
|
+
getContextId() {
|
|
12
|
+
return getContextId(this.context.count);
|
|
13
|
+
},
|
|
14
|
+
getNextContextId() {
|
|
15
|
+
return getContextId(this.context.count++);
|
|
16
|
+
}
|
|
9
17
|
};
|
|
18
|
+
function getContextId(count) {
|
|
19
|
+
const num = String(count), len = num.length - 1;
|
|
20
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
21
|
+
}
|
|
10
22
|
function setHydrateContext(context) {
|
|
11
23
|
sharedConfig.context = context;
|
|
12
24
|
}
|
|
@@ -45,10 +57,8 @@ function createSignal(value, options) {
|
|
|
45
57
|
};
|
|
46
58
|
const setter = (value2) => {
|
|
47
59
|
if (typeof value2 === "function") {
|
|
48
|
-
if (Transition && Transition.running && Transition.sources.has(s))
|
|
49
|
-
|
|
50
|
-
else
|
|
51
|
-
value2 = value2(s.value);
|
|
60
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
|
|
61
|
+
else value2 = value2(s.value);
|
|
52
62
|
}
|
|
53
63
|
return writeSignal(s, value2);
|
|
54
64
|
};
|
|
@@ -56,18 +66,14 @@ function createSignal(value, options) {
|
|
|
56
66
|
}
|
|
57
67
|
function createRenderEffect(fn, value, options) {
|
|
58
68
|
const c = createComputation(fn, value, false, STALE);
|
|
59
|
-
if (Scheduler && Transition && Transition.running)
|
|
60
|
-
|
|
61
|
-
else
|
|
62
|
-
updateComputation(c);
|
|
69
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
70
|
+
else updateComputation(c);
|
|
63
71
|
}
|
|
64
72
|
function createEffect(fn, value, options) {
|
|
65
73
|
runEffects = runUserEffects;
|
|
66
74
|
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
|
|
67
|
-
if (s)
|
|
68
|
-
|
|
69
|
-
if (!options || !options.render)
|
|
70
|
-
c.user = true;
|
|
75
|
+
if (s) c.suspense = s;
|
|
76
|
+
if (!options || !options.render) c.user = true;
|
|
71
77
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
72
78
|
}
|
|
73
79
|
function createMemo(fn, value, options) {
|
|
@@ -79,18 +85,15 @@ function createMemo(fn, value, options) {
|
|
|
79
85
|
if (Scheduler && Transition && Transition.running) {
|
|
80
86
|
c.tState = STALE;
|
|
81
87
|
Updates.push(c);
|
|
82
|
-
} else
|
|
83
|
-
updateComputation(c);
|
|
88
|
+
} else updateComputation(c);
|
|
84
89
|
return readSignal.bind(c);
|
|
85
90
|
}
|
|
86
91
|
function untrack(fn) {
|
|
87
|
-
if (!ExternalSourceConfig && Listener === null)
|
|
88
|
-
return fn();
|
|
92
|
+
if (!ExternalSourceConfig && Listener === null) return fn();
|
|
89
93
|
const listener = Listener;
|
|
90
94
|
Listener = null;
|
|
91
95
|
try {
|
|
92
|
-
if (ExternalSourceConfig)
|
|
93
|
-
return ExternalSourceConfig.untrack(fn);
|
|
96
|
+
if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
|
|
94
97
|
return fn();
|
|
95
98
|
} finally {
|
|
96
99
|
Listener = listener;
|
|
@@ -100,12 +103,9 @@ function onMount(fn) {
|
|
|
100
103
|
createEffect(() => untrack(fn));
|
|
101
104
|
}
|
|
102
105
|
function onCleanup(fn) {
|
|
103
|
-
if (Owner === null)
|
|
104
|
-
|
|
105
|
-
else
|
|
106
|
-
Owner.cleanups = [fn];
|
|
107
|
-
else
|
|
108
|
-
Owner.cleanups.push(fn);
|
|
106
|
+
if (Owner === null) ;
|
|
107
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
108
|
+
else Owner.cleanups.push(fn);
|
|
109
109
|
return fn;
|
|
110
110
|
}
|
|
111
111
|
function startTransition(fn) {
|
|
@@ -146,7 +146,8 @@ function createContext(defaultValue, options) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
function useContext(context) {
|
|
149
|
-
|
|
149
|
+
let value;
|
|
150
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
|
|
150
151
|
}
|
|
151
152
|
function children(fn) {
|
|
152
153
|
const children2 = createMemo(fn);
|
|
@@ -161,8 +162,7 @@ var SuspenseContext;
|
|
|
161
162
|
function readSignal() {
|
|
162
163
|
const runningTransition = Transition && Transition.running;
|
|
163
164
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
164
|
-
if ((runningTransition ? this.tState : this.state) === STALE)
|
|
165
|
-
updateComputation(this);
|
|
165
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
166
166
|
else {
|
|
167
167
|
const updates = Updates;
|
|
168
168
|
Updates = null;
|
|
@@ -187,8 +187,7 @@ function readSignal() {
|
|
|
187
187
|
this.observerSlots.push(Listener.sources.length - 1);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
if (runningTransition && Transition.sources.has(this))
|
|
191
|
-
return this.tValue;
|
|
190
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
192
191
|
return this.value;
|
|
193
192
|
}
|
|
194
193
|
function writeSignal(node, value, isComp) {
|
|
@@ -200,34 +199,25 @@ function writeSignal(node, value, isComp) {
|
|
|
200
199
|
Transition.sources.add(node);
|
|
201
200
|
node.tValue = value;
|
|
202
201
|
}
|
|
203
|
-
if (!TransitionRunning)
|
|
204
|
-
|
|
205
|
-
} else
|
|
206
|
-
node.value = value;
|
|
202
|
+
if (!TransitionRunning) node.value = value;
|
|
203
|
+
} else node.value = value;
|
|
207
204
|
if (node.observers && node.observers.length) {
|
|
208
205
|
runUpdates(() => {
|
|
209
206
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
210
207
|
const o = node.observers[i];
|
|
211
208
|
const TransitionRunning = Transition && Transition.running;
|
|
212
|
-
if (TransitionRunning && Transition.disposed.has(o))
|
|
213
|
-
continue;
|
|
209
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
214
210
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
215
|
-
if (o.pure)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
Effects.push(o);
|
|
219
|
-
if (o.observers)
|
|
220
|
-
markDownstream(o);
|
|
211
|
+
if (o.pure) Updates.push(o);
|
|
212
|
+
else Effects.push(o);
|
|
213
|
+
if (o.observers) markDownstream(o);
|
|
221
214
|
}
|
|
222
|
-
if (!TransitionRunning)
|
|
223
|
-
|
|
224
|
-
else
|
|
225
|
-
o.tState = STALE;
|
|
215
|
+
if (!TransitionRunning) o.state = STALE;
|
|
216
|
+
else o.tState = STALE;
|
|
226
217
|
}
|
|
227
218
|
if (Updates.length > 1e6) {
|
|
228
219
|
Updates = [];
|
|
229
|
-
if (false)
|
|
230
|
-
;
|
|
220
|
+
if (false) ;
|
|
231
221
|
throw new Error();
|
|
232
222
|
}
|
|
233
223
|
}, false);
|
|
@@ -236,15 +226,10 @@ function writeSignal(node, value, isComp) {
|
|
|
236
226
|
return value;
|
|
237
227
|
}
|
|
238
228
|
function updateComputation(node) {
|
|
239
|
-
if (!node.fn)
|
|
240
|
-
return;
|
|
229
|
+
if (!node.fn) return;
|
|
241
230
|
cleanNode(node);
|
|
242
231
|
const time = ExecCount;
|
|
243
|
-
runComputation(
|
|
244
|
-
node,
|
|
245
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
246
|
-
time
|
|
247
|
-
);
|
|
232
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
248
233
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
249
234
|
queueMicrotask(() => {
|
|
250
235
|
runUpdates(() => {
|
|
@@ -286,8 +271,7 @@ function runComputation(node, value, time) {
|
|
|
286
271
|
} else if (Transition && Transition.running && node.pure) {
|
|
287
272
|
Transition.sources.add(node);
|
|
288
273
|
node.tValue = nextValue;
|
|
289
|
-
} else
|
|
290
|
-
node.value = nextValue;
|
|
274
|
+
} else node.value = nextValue;
|
|
291
275
|
node.updatedAt = time;
|
|
292
276
|
}
|
|
293
277
|
}
|
|
@@ -309,19 +293,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
309
293
|
c.state = 0;
|
|
310
294
|
c.tState = state;
|
|
311
295
|
}
|
|
312
|
-
if (Owner === null)
|
|
313
|
-
;
|
|
296
|
+
if (Owner === null) ;
|
|
314
297
|
else if (Owner !== UNOWNED) {
|
|
315
298
|
if (Transition && Transition.running && Owner.pure) {
|
|
316
|
-
if (!Owner.tOwned)
|
|
317
|
-
|
|
318
|
-
else
|
|
319
|
-
Owner.tOwned.push(c);
|
|
299
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
300
|
+
else Owner.tOwned.push(c);
|
|
320
301
|
} else {
|
|
321
|
-
if (!Owner.owned)
|
|
322
|
-
|
|
323
|
-
else
|
|
324
|
-
Owner.owned.push(c);
|
|
302
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
303
|
+
else Owner.owned.push(c);
|
|
325
304
|
}
|
|
326
305
|
}
|
|
327
306
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -341,26 +320,20 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
341
320
|
}
|
|
342
321
|
function runTop(node) {
|
|
343
322
|
const runningTransition = Transition && Transition.running;
|
|
344
|
-
if ((runningTransition ? node.tState : node.state) === 0)
|
|
345
|
-
|
|
346
|
-
if (
|
|
347
|
-
return lookUpstream(node);
|
|
348
|
-
if (node.suspense && untrack(node.suspense.inFallback))
|
|
349
|
-
return node.suspense.effects.push(node);
|
|
323
|
+
if ((runningTransition ? node.tState : node.state) === 0) return;
|
|
324
|
+
if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
|
|
325
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
350
326
|
const ancestors = [node];
|
|
351
327
|
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
352
|
-
if (runningTransition && Transition.disposed.has(node))
|
|
353
|
-
|
|
354
|
-
if (runningTransition ? node.tState : node.state)
|
|
355
|
-
ancestors.push(node);
|
|
328
|
+
if (runningTransition && Transition.disposed.has(node)) return;
|
|
329
|
+
if (runningTransition ? node.tState : node.state) ancestors.push(node);
|
|
356
330
|
}
|
|
357
331
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
358
332
|
node = ancestors[i];
|
|
359
333
|
if (runningTransition) {
|
|
360
334
|
let top = node, prev = ancestors[i + 1];
|
|
361
335
|
while ((top = top.owner) && top !== prev) {
|
|
362
|
-
if (Transition.disposed.has(top))
|
|
363
|
-
return;
|
|
336
|
+
if (Transition.disposed.has(top)) return;
|
|
364
337
|
}
|
|
365
338
|
}
|
|
366
339
|
if ((runningTransition ? node.tState : node.state) === STALE) {
|
|
@@ -374,37 +347,29 @@ function runTop(node) {
|
|
|
374
347
|
}
|
|
375
348
|
}
|
|
376
349
|
function runUpdates(fn, init) {
|
|
377
|
-
if (Updates)
|
|
378
|
-
return fn();
|
|
350
|
+
if (Updates) return fn();
|
|
379
351
|
let wait = false;
|
|
380
|
-
if (!init)
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
wait = true;
|
|
384
|
-
else
|
|
385
|
-
Effects = [];
|
|
352
|
+
if (!init) Updates = [];
|
|
353
|
+
if (Effects) wait = true;
|
|
354
|
+
else Effects = [];
|
|
386
355
|
ExecCount++;
|
|
387
356
|
try {
|
|
388
357
|
const res = fn();
|
|
389
358
|
completeUpdates(wait);
|
|
390
359
|
return res;
|
|
391
360
|
} catch (err) {
|
|
392
|
-
if (!wait)
|
|
393
|
-
Effects = null;
|
|
361
|
+
if (!wait) Effects = null;
|
|
394
362
|
Updates = null;
|
|
395
363
|
handleError(err);
|
|
396
364
|
}
|
|
397
365
|
}
|
|
398
366
|
function completeUpdates(wait) {
|
|
399
367
|
if (Updates) {
|
|
400
|
-
if (Scheduler && Transition && Transition.running)
|
|
401
|
-
|
|
402
|
-
else
|
|
403
|
-
runQueue(Updates);
|
|
368
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
369
|
+
else runQueue(Updates);
|
|
404
370
|
Updates = null;
|
|
405
371
|
}
|
|
406
|
-
if (wait)
|
|
407
|
-
return;
|
|
372
|
+
if (wait) return;
|
|
408
373
|
let res;
|
|
409
374
|
if (Transition) {
|
|
410
375
|
if (!Transition.promises.size && !Transition.queue.size) {
|
|
@@ -418,16 +383,13 @@ function completeUpdates(wait) {
|
|
|
418
383
|
}
|
|
419
384
|
Transition = null;
|
|
420
385
|
runUpdates(() => {
|
|
421
|
-
for (const d of disposed)
|
|
422
|
-
cleanNode(d);
|
|
386
|
+
for (const d of disposed) cleanNode(d);
|
|
423
387
|
for (const v of sources) {
|
|
424
388
|
v.value = v.tValue;
|
|
425
389
|
if (v.owned) {
|
|
426
|
-
for (let i = 0, len = v.owned.length; i < len; i++)
|
|
427
|
-
cleanNode(v.owned[i]);
|
|
390
|
+
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
428
391
|
}
|
|
429
|
-
if (v.tOwned)
|
|
430
|
-
v.owned = v.tOwned;
|
|
392
|
+
if (v.tOwned) v.owned = v.tOwned;
|
|
431
393
|
delete v.tValue;
|
|
432
394
|
delete v.tOwned;
|
|
433
395
|
v.tState = 0;
|
|
@@ -444,14 +406,11 @@ function completeUpdates(wait) {
|
|
|
444
406
|
}
|
|
445
407
|
const e = Effects;
|
|
446
408
|
Effects = null;
|
|
447
|
-
if (e.length)
|
|
448
|
-
|
|
449
|
-
if (res)
|
|
450
|
-
res();
|
|
409
|
+
if (e.length) runUpdates(() => runEffects(e), false);
|
|
410
|
+
if (res) res();
|
|
451
411
|
}
|
|
452
412
|
function runQueue(queue) {
|
|
453
|
-
for (let i = 0; i < queue.length; i++)
|
|
454
|
-
runTop(queue[i]);
|
|
413
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
455
414
|
}
|
|
456
415
|
function scheduleQueue(queue) {
|
|
457
416
|
for (let i = 0; i < queue.length; i++) {
|
|
@@ -474,41 +433,35 @@ function runUserEffects(queue) {
|
|
|
474
433
|
let i, userLength = 0;
|
|
475
434
|
for (i = 0; i < queue.length; i++) {
|
|
476
435
|
const e = queue[i];
|
|
477
|
-
if (!e.user)
|
|
478
|
-
|
|
479
|
-
else
|
|
480
|
-
queue[userLength++] = e;
|
|
436
|
+
if (!e.user) runTop(e);
|
|
437
|
+
else queue[userLength++] = e;
|
|
481
438
|
}
|
|
482
439
|
if (sharedConfig.context) {
|
|
483
440
|
if (sharedConfig.count) {
|
|
484
441
|
sharedConfig.effects || (sharedConfig.effects = []);
|
|
485
442
|
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
486
443
|
return;
|
|
487
|
-
} else if (sharedConfig.effects) {
|
|
488
|
-
queue = [...sharedConfig.effects, ...queue];
|
|
489
|
-
userLength += sharedConfig.effects.length;
|
|
490
|
-
delete sharedConfig.effects;
|
|
491
444
|
}
|
|
492
445
|
setHydrateContext();
|
|
493
446
|
}
|
|
494
|
-
|
|
495
|
-
|
|
447
|
+
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
|
|
448
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
449
|
+
userLength += sharedConfig.effects.length;
|
|
450
|
+
delete sharedConfig.effects;
|
|
451
|
+
}
|
|
452
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
496
453
|
}
|
|
497
454
|
function lookUpstream(node, ignore) {
|
|
498
455
|
const runningTransition = Transition && Transition.running;
|
|
499
|
-
if (runningTransition)
|
|
500
|
-
|
|
501
|
-
else
|
|
502
|
-
node.state = 0;
|
|
456
|
+
if (runningTransition) node.tState = 0;
|
|
457
|
+
else node.state = 0;
|
|
503
458
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
504
459
|
const source = node.sources[i];
|
|
505
460
|
if (source.sources) {
|
|
506
461
|
const state = runningTransition ? source.tState : source.state;
|
|
507
462
|
if (state === STALE) {
|
|
508
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
509
|
-
|
|
510
|
-
} else if (state === PENDING)
|
|
511
|
-
lookUpstream(source, ignore);
|
|
463
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
464
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
512
465
|
}
|
|
513
466
|
}
|
|
514
467
|
}
|
|
@@ -517,14 +470,10 @@ function markDownstream(node) {
|
|
|
517
470
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
518
471
|
const o = node.observers[i];
|
|
519
472
|
if (runningTransition ? !o.tState : !o.state) {
|
|
520
|
-
if (runningTransition)
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (o.pure)
|
|
525
|
-
Updates.push(o);
|
|
526
|
-
else
|
|
527
|
-
Effects.push(o);
|
|
473
|
+
if (runningTransition) o.tState = PENDING;
|
|
474
|
+
else o.state = PENDING;
|
|
475
|
+
if (o.pure) Updates.push(o);
|
|
476
|
+
else Effects.push(o);
|
|
528
477
|
o.observers && markDownstream(o);
|
|
529
478
|
}
|
|
530
479
|
}
|
|
@@ -546,25 +495,20 @@ function cleanNode(node) {
|
|
|
546
495
|
}
|
|
547
496
|
if (Transition && Transition.running && node.pure) {
|
|
548
497
|
if (node.tOwned) {
|
|
549
|
-
for (i = node.tOwned.length - 1; i >= 0; i--)
|
|
550
|
-
cleanNode(node.tOwned[i]);
|
|
498
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
551
499
|
delete node.tOwned;
|
|
552
500
|
}
|
|
553
501
|
reset(node, true);
|
|
554
502
|
} else if (node.owned) {
|
|
555
|
-
for (i = node.owned.length - 1; i >= 0; i--)
|
|
556
|
-
cleanNode(node.owned[i]);
|
|
503
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
557
504
|
node.owned = null;
|
|
558
505
|
}
|
|
559
506
|
if (node.cleanups) {
|
|
560
|
-
for (i = node.cleanups.length - 1; i >= 0; i--)
|
|
561
|
-
node.cleanups[i]();
|
|
507
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
562
508
|
node.cleanups = null;
|
|
563
509
|
}
|
|
564
|
-
if (Transition && Transition.running)
|
|
565
|
-
|
|
566
|
-
else
|
|
567
|
-
node.state = 0;
|
|
510
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
511
|
+
else node.state = 0;
|
|
568
512
|
}
|
|
569
513
|
function reset(node, top) {
|
|
570
514
|
if (!top) {
|
|
@@ -572,21 +516,18 @@ function reset(node, top) {
|
|
|
572
516
|
Transition.disposed.add(node);
|
|
573
517
|
}
|
|
574
518
|
if (node.owned) {
|
|
575
|
-
for (let i = 0; i < node.owned.length; i++)
|
|
576
|
-
reset(node.owned[i]);
|
|
519
|
+
for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
|
|
577
520
|
}
|
|
578
521
|
}
|
|
579
522
|
function castError(err) {
|
|
580
|
-
if (err instanceof Error)
|
|
581
|
-
return err;
|
|
523
|
+
if (err instanceof Error) return err;
|
|
582
524
|
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
583
525
|
cause: err
|
|
584
526
|
});
|
|
585
527
|
}
|
|
586
528
|
function runErrors(err, fns, owner) {
|
|
587
529
|
try {
|
|
588
|
-
for (const f of fns)
|
|
589
|
-
f(err);
|
|
530
|
+
for (const f of fns) f(err);
|
|
590
531
|
} catch (e) {
|
|
591
532
|
handleError(e, owner && owner.owner || null);
|
|
592
533
|
}
|
|
@@ -594,21 +535,17 @@ function runErrors(err, fns, owner) {
|
|
|
594
535
|
function handleError(err, owner = Owner) {
|
|
595
536
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
596
537
|
const error = castError(err);
|
|
597
|
-
if (!fns)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
});
|
|
606
|
-
else
|
|
607
|
-
runErrors(error, fns, owner);
|
|
538
|
+
if (!fns) throw error;
|
|
539
|
+
if (Effects) Effects.push({
|
|
540
|
+
fn() {
|
|
541
|
+
runErrors(error, fns, owner);
|
|
542
|
+
},
|
|
543
|
+
state: STALE
|
|
544
|
+
});
|
|
545
|
+
else runErrors(error, fns, owner);
|
|
608
546
|
}
|
|
609
547
|
function resolveChildren(children2) {
|
|
610
|
-
if (typeof children2 === "function" && !children2.length)
|
|
611
|
-
return resolveChildren(children2());
|
|
548
|
+
if (typeof children2 === "function" && !children2.length) return resolveChildren(children2());
|
|
612
549
|
if (Array.isArray(children2)) {
|
|
613
550
|
const results = [];
|
|
614
551
|
for (let i = 0; i < children2.length; i++) {
|
|
@@ -622,21 +559,17 @@ function resolveChildren(children2) {
|
|
|
622
559
|
function createProvider(id, options) {
|
|
623
560
|
return function provider(props) {
|
|
624
561
|
let res;
|
|
625
|
-
createRenderEffect(
|
|
626
|
-
|
|
627
|
-
Owner.context
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}),
|
|
633
|
-
void 0
|
|
634
|
-
);
|
|
562
|
+
createRenderEffect(() => res = untrack(() => {
|
|
563
|
+
Owner.context = {
|
|
564
|
+
...Owner.context,
|
|
565
|
+
[id]: props.value
|
|
566
|
+
};
|
|
567
|
+
return children(() => props.children);
|
|
568
|
+
}), void 0);
|
|
635
569
|
return res;
|
|
636
570
|
};
|
|
637
571
|
}
|
|
638
572
|
var FALLBACK = Symbol("fallback");
|
|
639
|
-
var SuspenseListContext = createContext();
|
|
640
573
|
|
|
641
574
|
// src/index.tsx
|
|
642
575
|
export * from "@txnlab/use-wallet";
|