@adriansteffan/reactive 0.1.2 → 0.1.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.
- package/.claude/settings.local.json +13 -1
- package/README.md +184 -5
- package/dist/{mod-Bb_FAy0j.js → mod-DRCLdWzq.js} +31177 -14827
- package/dist/mod.d.ts +40 -1
- package/dist/reactive.es.js +36 -29
- package/dist/reactive.umd.js +10202 -55
- package/dist/style.css +1 -1
- package/dist/{web-DmsP-pmx.js → web-CWqttxrD.js} +1 -1
- package/dist/{web-BfWhpr9p.js → web-N9H86cSP.js} +1 -1
- package/package.json +8 -1
- package/src/components/canvasblock.tsx +4 -3
- package/src/components/plaininput.tsx +2 -1
- package/src/components/quest.tsx +8 -7
- package/src/components/randomdotkinetogram.tsx +3 -2
- package/src/components/text.tsx +2 -1
- package/src/components/upload.tsx +2 -1
- package/src/mod.tsx +2 -0
- package/src/utils/array.ts +4 -2
- package/src/utils/distributions.test.ts +209 -0
- package/src/utils/distributions.ts +191 -0
- package/src/utils/simulation.ts +9 -4
- package/template/simulate.ts +24 -4
- package/template/src/Experiment.tsx +7 -9
package/dist/mod.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ declare interface DeviceInfo {
|
|
|
98
98
|
hasMicrophone: boolean;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
export declare type DimensionSpec = UniformSpec | NormalSpec | PoissonSpec;
|
|
102
|
+
|
|
101
103
|
export declare function EnterFullscreen({ content, buttonText, next, data, updateStore, delayMs, }: {
|
|
102
104
|
prolificCode?: string;
|
|
103
105
|
content?: default_2.ReactNode;
|
|
@@ -143,6 +145,8 @@ export declare const getPlatform: () => Platform;
|
|
|
143
145
|
|
|
144
146
|
export declare function getSimulation(type: string): ComponentSimulation | undefined;
|
|
145
147
|
|
|
148
|
+
export declare function halton(count: number, specs: DimensionSpec[]): number[] | number[][];
|
|
149
|
+
|
|
146
150
|
declare interface IfBlockItem {
|
|
147
151
|
type: 'IF_BLOCK';
|
|
148
152
|
cond: ConditionalFunction;
|
|
@@ -172,6 +176,14 @@ export declare type NoiseMovement = 'randomTeleport' | 'randomWalk' | 'randomDir
|
|
|
172
176
|
|
|
173
177
|
export declare const noopSimulate: SimulateFunction;
|
|
174
178
|
|
|
179
|
+
export declare let normal: (mu: number, sigma: number) => number;
|
|
180
|
+
|
|
181
|
+
export declare type NormalSpec = {
|
|
182
|
+
distribution: 'normal';
|
|
183
|
+
mean: number;
|
|
184
|
+
sd: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
175
187
|
export declare function now(): number;
|
|
176
188
|
|
|
177
189
|
export declare function orchestrateSimulation(config: RunSimulationConfig, scriptPath: string): Promise<void>;
|
|
@@ -209,6 +221,13 @@ export declare function PlainInput({ content, buttonText, className, next, updat
|
|
|
209
221
|
|
|
210
222
|
export declare type Platform = 'desktop' | 'mobile' | 'web';
|
|
211
223
|
|
|
224
|
+
export declare let poisson: (lambda: number) => number;
|
|
225
|
+
|
|
226
|
+
export declare type PoissonSpec = {
|
|
227
|
+
distribution: 'poisson';
|
|
228
|
+
mean: number;
|
|
229
|
+
};
|
|
230
|
+
|
|
212
231
|
export declare function ProlificEnding({ prolificCode, data, updateStore }: {
|
|
213
232
|
prolificCode?: string;
|
|
214
233
|
} & BaseComponentProps): JSX_2.Element;
|
|
@@ -351,7 +370,9 @@ export declare interface RunSimulationConfig {
|
|
|
351
370
|
participants: ParticipantState[] | {
|
|
352
371
|
generator: (index: number) => ParticipantState;
|
|
353
372
|
count: number;
|
|
354
|
-
};
|
|
373
|
+
} | (() => ParticipantState[]);
|
|
374
|
+
/** Seed for reproducible simulations. Each participant gets seed + workerIndex. */
|
|
375
|
+
seed?: number;
|
|
355
376
|
backendPort?: number;
|
|
356
377
|
concurrency?: number;
|
|
357
378
|
}
|
|
@@ -361,6 +382,14 @@ export declare interface RunSimulationConfig {
|
|
|
361
382
|
*/
|
|
362
383
|
export declare function sample<T>(array: T[], n?: number): T[];
|
|
363
384
|
|
|
385
|
+
export declare function sampleParticipants<T extends Record<string, DimensionSpec>>(method: SamplingMethod, count: number, specs: T): Array<{
|
|
386
|
+
[K in keyof T]: number;
|
|
387
|
+
}>;
|
|
388
|
+
|
|
389
|
+
export declare type SamplingMethod = 'sobol' | 'halton' | 'random';
|
|
390
|
+
|
|
391
|
+
export declare function seedDistributions(seed: number): void;
|
|
392
|
+
|
|
364
393
|
export declare function setBackendUrl(url: string): void;
|
|
365
394
|
|
|
366
395
|
/**
|
|
@@ -382,6 +411,8 @@ export declare type SimulatorResult = {
|
|
|
382
411
|
duration?: number;
|
|
383
412
|
};
|
|
384
413
|
|
|
414
|
+
export declare function sobol(count: number, specs: DimensionSpec[]): number[] | number[][];
|
|
415
|
+
|
|
385
416
|
export declare interface Store {
|
|
386
417
|
[key: string]: any;
|
|
387
418
|
}
|
|
@@ -436,6 +467,14 @@ export declare interface TutorialProps extends BaseComponentProps {
|
|
|
436
467
|
theme?: 'light' | 'dark';
|
|
437
468
|
}
|
|
438
469
|
|
|
470
|
+
export declare let uniform: (min: number, max: number) => number;
|
|
471
|
+
|
|
472
|
+
export declare type UniformSpec = {
|
|
473
|
+
distribution: 'uniform';
|
|
474
|
+
min: number;
|
|
475
|
+
max: number;
|
|
476
|
+
};
|
|
477
|
+
|
|
439
478
|
declare interface UpdateStoreItem {
|
|
440
479
|
type: 'UPDATE_STORE';
|
|
441
480
|
fun: StoreUpdateFunction;
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { H as e, C as t, a as i, c as
|
|
1
|
+
import { H as e, C as t, a as i, c as n, d as r, e as o, f as l, Y as m, z as u, M as c, P as p, g as P, h as g, Q as d, R as x, i as C, j as T, F as k, T as E, k as F, l as S, U as f, X as h, m as v, n as B, o as D, p as R, q as y, r as I, s as U, t as b, u as w, v as K, w as q, x as A, y as M, A as Q, B as Z, D as j, G as z, I as G, J as H, K as J, L, N, O, S as V, V as X, Z as Y, _, $, a0 as W, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as na, a7 as ra, a8 as oa, a9 as la } from "./mod-DRCLdWzq.js";
|
|
2
2
|
export {
|
|
3
3
|
e as Bounce,
|
|
4
4
|
t as CanvasBlock,
|
|
5
5
|
i as CheckDevice,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
n as EnterFullscreen,
|
|
7
|
+
r as ExitFullscreen,
|
|
8
8
|
o as ExperimentProvider,
|
|
9
9
|
l as ExperimentRunner,
|
|
10
10
|
m as Flip,
|
|
11
11
|
u as Icons,
|
|
12
12
|
c as MicCheck,
|
|
13
13
|
p as Param,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
P as PlainInput,
|
|
15
|
+
g as ProlificEnding,
|
|
16
16
|
d as Quest,
|
|
17
17
|
x as RDKCanvas,
|
|
18
18
|
C as RandomDotKinematogram,
|
|
@@ -21,37 +21,44 @@ export {
|
|
|
21
21
|
E as Text,
|
|
22
22
|
F as ToastContainer,
|
|
23
23
|
S as Tutorial,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
f as Upload,
|
|
25
|
+
h as Zoom,
|
|
26
|
+
v as arrayFlattener,
|
|
27
27
|
B as canvasCountdown,
|
|
28
28
|
D as chunk,
|
|
29
29
|
R as collapseToast,
|
|
30
30
|
y as cssTransition,
|
|
31
31
|
I as getBackendUrl,
|
|
32
32
|
U as getInitialParticipant,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
b as getParam,
|
|
34
|
+
w as getPlatform,
|
|
35
|
+
K as getSimulation,
|
|
36
|
+
q as halton,
|
|
36
37
|
A as isDesktop,
|
|
37
38
|
M as isFullscreen,
|
|
38
39
|
Q as noopSimulate,
|
|
39
|
-
Z as
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
Z as normal,
|
|
41
|
+
j as now,
|
|
42
|
+
z as orchestrateSimulation,
|
|
43
|
+
G as pipe,
|
|
44
|
+
H as poisson,
|
|
45
|
+
J as registerArrayExtensions,
|
|
46
|
+
L as registerComponentParams,
|
|
47
|
+
N as registerExperimentParams,
|
|
48
|
+
O as registerFlattener,
|
|
49
|
+
V as registerSimulation,
|
|
50
|
+
X as resolveSimulation,
|
|
51
|
+
Y as sample,
|
|
52
|
+
_ as sampleParticipants,
|
|
53
|
+
$ as seedDistributions,
|
|
54
|
+
W as setBackendUrl,
|
|
55
|
+
aa as shuffle,
|
|
56
|
+
sa as simulateParticipant,
|
|
57
|
+
ea as sobol,
|
|
58
|
+
ta as subsetExperimentByParam,
|
|
59
|
+
ia as toast,
|
|
60
|
+
na as uniform,
|
|
61
|
+
ra as useToast,
|
|
62
|
+
oa as useToastContainer,
|
|
63
|
+
la as useTutorialSlide
|
|
57
64
|
};
|