@adriansteffan/reactive 0.1.3 → 0.1.4
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 +12 -1
- package/README.md +35 -0
- package/dist/{mod-DRCLdWzq.js → mod-DHUjIRfF.js} +6190 -6108
- package/dist/mod.d.ts +64 -0
- package/dist/reactive.es.js +50 -48
- package/dist/reactive.umd.js +624 -624
- package/dist/style.css +1 -1
- package/dist/{web-CWqttxrD.js → web-BGLPXsYu.js} +1 -1
- package/dist/{web-N9H86cSP.js → web-DGGPscOK.js} +1 -1
- package/package.json +1 -1
- package/src/components/randomdotkinetogram.tsx +36 -26
- package/src/mod.tsx +2 -0
- package/src/utils/ddm.test.ts +233 -0
- package/src/utils/ddm.ts +230 -0
package/dist/mod.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ declare type BaseTrialData = {
|
|
|
25
25
|
duration: number;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
export declare type BoundaryDef = number | [number, number];
|
|
29
|
+
|
|
28
30
|
export declare function CanvasBlock({ next, updateStore, timeline, width, height, store, styleCanvas, initCanvas, }: CanvasBlockProps): JSX_2.Element;
|
|
29
31
|
|
|
30
32
|
declare type CanvasBlockProps = {
|
|
@@ -57,6 +59,16 @@ export declare function CheckDevice({ check, content, data, store, updateStore,
|
|
|
57
59
|
*/
|
|
58
60
|
export declare function chunk<T>(array: T[], n: number): T[][];
|
|
59
61
|
|
|
62
|
+
export declare type CollapseDef = {
|
|
63
|
+
rate: number;
|
|
64
|
+
delay?: number;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export declare type CollapseStrategy = {
|
|
68
|
+
type: 'collapse';
|
|
69
|
+
collapseDef: CollapseDef;
|
|
70
|
+
};
|
|
71
|
+
|
|
60
72
|
declare type ComponentResultData = BaseTrialData & {
|
|
61
73
|
type: string;
|
|
62
74
|
name: string;
|
|
@@ -81,8 +93,36 @@ declare type ComponentsMap_2 = {
|
|
|
81
93
|
|
|
82
94
|
declare type ConditionalFunction = (data?: TrialResult[], store?: Store_2) => boolean;
|
|
83
95
|
|
|
96
|
+
export declare type ContinueStrategy = {
|
|
97
|
+
type: 'continue';
|
|
98
|
+
residualDrift?: number;
|
|
99
|
+
noiseMultiplier?: number;
|
|
100
|
+
};
|
|
101
|
+
|
|
84
102
|
declare type ControlFlowItem = MarkerItem | IfGotoItem | UpdateStoreItem | IfBlockItem | WhileBlockItem;
|
|
85
103
|
|
|
104
|
+
export declare interface DDMTrialParams {
|
|
105
|
+
driftRate: ParameterDef;
|
|
106
|
+
boundaries: BoundaryDef;
|
|
107
|
+
startingPoint: ParameterDef;
|
|
108
|
+
noiseLevel: ParameterDef;
|
|
109
|
+
sensoryDelay?: ParameterDef;
|
|
110
|
+
motorDelay?: ParameterDef;
|
|
111
|
+
timeLimit: number;
|
|
112
|
+
stimOffset: number;
|
|
113
|
+
dt?: number;
|
|
114
|
+
contaminationRate?: number;
|
|
115
|
+
stimulusCollapse?: CollapseDef;
|
|
116
|
+
postStimStrategy: PostStimStrategyDef;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export declare interface DDMTrialResult {
|
|
120
|
+
choice: 0 | 1 | null;
|
|
121
|
+
rt: number;
|
|
122
|
+
finalEvidence: number;
|
|
123
|
+
isContaminated: boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
86
126
|
declare interface DeviceInfo {
|
|
87
127
|
windowWidth: number;
|
|
88
128
|
windowHeight: number;
|
|
@@ -163,6 +203,8 @@ export declare function isDesktop(): boolean;
|
|
|
163
203
|
|
|
164
204
|
export declare function isFullscreen(): boolean;
|
|
165
205
|
|
|
206
|
+
export declare function mapDDMChoice(choice: 0 | 1 | null, validKeys: string[], correctResponse?: string | string[]): string | null;
|
|
207
|
+
|
|
166
208
|
declare interface MarkerItem {
|
|
167
209
|
type: 'MARKER';
|
|
168
210
|
id: string;
|
|
@@ -178,6 +220,12 @@ export declare const noopSimulate: SimulateFunction;
|
|
|
178
220
|
|
|
179
221
|
export declare let normal: (mu: number, sigma: number) => number;
|
|
180
222
|
|
|
223
|
+
export declare type NormalDist = {
|
|
224
|
+
type: 'normal';
|
|
225
|
+
mean: number;
|
|
226
|
+
sd: number;
|
|
227
|
+
};
|
|
228
|
+
|
|
181
229
|
export declare type NormalSpec = {
|
|
182
230
|
distribution: 'normal';
|
|
183
231
|
mean: number;
|
|
@@ -196,6 +244,8 @@ export declare class Param {
|
|
|
196
244
|
}[];
|
|
197
245
|
}
|
|
198
246
|
|
|
247
|
+
export declare type ParameterDef = number | NormalDist | UniformDist;
|
|
248
|
+
|
|
199
249
|
declare type ParamType = 'string' | 'number' | 'boolean' | 'array' | 'json';
|
|
200
250
|
|
|
201
251
|
declare type ParamValue<T extends ParamType> = T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'array' | 'json' ? any : string;
|
|
@@ -228,6 +278,8 @@ export declare type PoissonSpec = {
|
|
|
228
278
|
mean: number;
|
|
229
279
|
};
|
|
230
280
|
|
|
281
|
+
export declare type PostStimStrategyDef = ContinueStrategy | CollapseStrategy | SnapshotStrategy;
|
|
282
|
+
|
|
231
283
|
export declare function ProlificEnding({ prolificCode, data, updateStore }: {
|
|
232
284
|
prolificCode?: string;
|
|
233
285
|
} & BaseComponentProps): JSX_2.Element;
|
|
@@ -397,6 +449,8 @@ export declare function setBackendUrl(url: string): void;
|
|
|
397
449
|
*/
|
|
398
450
|
export declare function shuffle<T>(array: T[]): T[];
|
|
399
451
|
|
|
452
|
+
export declare function simulateDDMTrial(params: DDMTrialParams): DDMTrialResult;
|
|
453
|
+
|
|
400
454
|
export declare type SimulateFunction = (trialProps: Record<string, any>, experimentState: {
|
|
401
455
|
data: TrialResult[];
|
|
402
456
|
store: Store_2;
|
|
@@ -411,6 +465,10 @@ export declare type SimulatorResult = {
|
|
|
411
465
|
duration?: number;
|
|
412
466
|
};
|
|
413
467
|
|
|
468
|
+
export declare type SnapshotStrategy = {
|
|
469
|
+
type: 'snapshot';
|
|
470
|
+
};
|
|
471
|
+
|
|
414
472
|
export declare function sobol(count: number, specs: DimensionSpec[]): number[] | number[][];
|
|
415
473
|
|
|
416
474
|
export declare interface Store {
|
|
@@ -469,6 +527,12 @@ export declare interface TutorialProps extends BaseComponentProps {
|
|
|
469
527
|
|
|
470
528
|
export declare let uniform: (min: number, max: number) => number;
|
|
471
529
|
|
|
530
|
+
export declare type UniformDist = {
|
|
531
|
+
type: 'uniform';
|
|
532
|
+
min: number;
|
|
533
|
+
max: number;
|
|
534
|
+
};
|
|
535
|
+
|
|
472
536
|
export declare type UniformSpec = {
|
|
473
537
|
distribution: 'uniform';
|
|
474
538
|
min: number;
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 r, d as n, 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 C, i as D, j as T, F as x, T as h, k, l as E, U as F, X as S, m as f, n as v, o as B, p as R, q as b, r as y, s as I, t as M, u as U, v as w, w as K, x as q, y as A, 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 ra, a7 as na, a8 as oa, a9 as la, aa as ma, ab as ua } from "./mod-DHUjIRfF.js";
|
|
2
2
|
export {
|
|
3
3
|
e as Bounce,
|
|
4
4
|
t as CanvasBlock,
|
|
5
5
|
i as CheckDevice,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
r as EnterFullscreen,
|
|
7
|
+
n as ExitFullscreen,
|
|
8
8
|
o as ExperimentProvider,
|
|
9
9
|
l as ExperimentRunner,
|
|
10
10
|
m as Flip,
|
|
@@ -14,51 +14,53 @@ export {
|
|
|
14
14
|
P as PlainInput,
|
|
15
15
|
g as ProlificEnding,
|
|
16
16
|
d as Quest,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
C as RDKCanvas,
|
|
18
|
+
D as RandomDotKinematogram,
|
|
19
19
|
T as RequestFilePermission,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
x as Slide,
|
|
21
|
+
h as Text,
|
|
22
|
+
k as ToastContainer,
|
|
23
|
+
E as Tutorial,
|
|
24
|
+
F as Upload,
|
|
25
|
+
S as Zoom,
|
|
26
|
+
f as arrayFlattener,
|
|
27
|
+
v as canvasCountdown,
|
|
28
|
+
B as chunk,
|
|
29
29
|
R as collapseToast,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Q as
|
|
40
|
-
Z as
|
|
41
|
-
j as
|
|
42
|
-
z as
|
|
43
|
-
G as
|
|
44
|
-
H as
|
|
45
|
-
J as
|
|
46
|
-
L as
|
|
47
|
-
N as
|
|
48
|
-
O as
|
|
49
|
-
V as
|
|
50
|
-
X as
|
|
51
|
-
Y as
|
|
52
|
-
_ as
|
|
53
|
-
$ as
|
|
54
|
-
W as
|
|
55
|
-
aa as
|
|
56
|
-
sa as
|
|
57
|
-
ea as
|
|
58
|
-
ta as
|
|
59
|
-
ia as
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
oa as
|
|
63
|
-
la as
|
|
30
|
+
b as cssTransition,
|
|
31
|
+
y as getBackendUrl,
|
|
32
|
+
I as getInitialParticipant,
|
|
33
|
+
M as getParam,
|
|
34
|
+
U as getPlatform,
|
|
35
|
+
w as getSimulation,
|
|
36
|
+
K as halton,
|
|
37
|
+
q as isDesktop,
|
|
38
|
+
A as isFullscreen,
|
|
39
|
+
Q as mapDDMChoice,
|
|
40
|
+
Z as noopSimulate,
|
|
41
|
+
j as normal,
|
|
42
|
+
z as now,
|
|
43
|
+
G as orchestrateSimulation,
|
|
44
|
+
H as pipe,
|
|
45
|
+
J as poisson,
|
|
46
|
+
L as registerArrayExtensions,
|
|
47
|
+
N as registerComponentParams,
|
|
48
|
+
O as registerExperimentParams,
|
|
49
|
+
V as registerFlattener,
|
|
50
|
+
X as registerSimulation,
|
|
51
|
+
Y as resolveSimulation,
|
|
52
|
+
_ as sample,
|
|
53
|
+
$ as sampleParticipants,
|
|
54
|
+
W as seedDistributions,
|
|
55
|
+
aa as setBackendUrl,
|
|
56
|
+
sa as shuffle,
|
|
57
|
+
ea as simulateDDMTrial,
|
|
58
|
+
ta as simulateParticipant,
|
|
59
|
+
ia as sobol,
|
|
60
|
+
ra as subsetExperimentByParam,
|
|
61
|
+
na as toast,
|
|
62
|
+
oa as uniform,
|
|
63
|
+
la as useToast,
|
|
64
|
+
ma as useToastContainer,
|
|
65
|
+
ua as useTutorialSlide
|
|
64
66
|
};
|