@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/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;
@@ -1,18 +1,18 @@
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, h as P, 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 v, X as f, m as h, n as B, o as D, p as R, q as y, r as I, s as U, t as w, u as K, v as q, w as A, x as M, y as Q, A as Z, B as b, 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 } from "./mod-Bb_FAy0j.js";
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
- r as EnterFullscreen,
7
- n as ExitFullscreen,
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
- g as PlainInput,
15
- P as ProlificEnding,
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
- v as Upload,
25
- f as Zoom,
26
- h as arrayFlattener,
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
- w as getParam,
34
- K as getPlatform,
35
- q as getSimulation,
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 now,
40
- b as orchestrateSimulation,
41
- j as pipe,
42
- z as registerArrayExtensions,
43
- G as registerComponentParams,
44
- H as registerExperimentParams,
45
- J as registerFlattener,
46
- L as registerSimulation,
47
- N as resolveSimulation,
48
- O as sample,
49
- V as setBackendUrl,
50
- X as shuffle,
51
- Y as simulateParticipant,
52
- _ as subsetExperimentByParam,
53
- $ as toast,
54
- W as useToast,
55
- aa as useToastContainer,
56
- sa as useTutorialSlide
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
  };