@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/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;
@@ -1,10 +1,10 @@
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";
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
- n as EnterFullscreen,
7
- r as ExitFullscreen,
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
- x as RDKCanvas,
18
- C as RandomDotKinematogram,
17
+ C as RDKCanvas,
18
+ D as RandomDotKinematogram,
19
19
  T as RequestFilePermission,
20
- k as Slide,
21
- E as Text,
22
- F as ToastContainer,
23
- S as Tutorial,
24
- f as Upload,
25
- h as Zoom,
26
- v as arrayFlattener,
27
- B as canvasCountdown,
28
- D as chunk,
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
- y as cssTransition,
31
- I as getBackendUrl,
32
- U as getInitialParticipant,
33
- b as getParam,
34
- w as getPlatform,
35
- K as getSimulation,
36
- q as halton,
37
- A as isDesktop,
38
- M as isFullscreen,
39
- Q as noopSimulate,
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
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
  };