@adriansteffan/reactive 0.1.0 → 0.1.2

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
@@ -1,7 +1,14 @@
1
1
  import { ComponentType } from 'react';
2
+ import { CSSProperties } from 'react';
2
3
  import { default as default_2 } from 'react';
4
+ import { ForwardRefExoticComponent } from 'react';
3
5
  import { JSX as JSX_2 } from 'react/jsx-runtime';
4
6
  import { ReactNode } from 'react';
7
+ import { RefAttributes } from 'react';
8
+
9
+ declare type ApertureShape = 'circle' | 'ellipse' | 'square' | 'rectangle';
10
+
11
+ export declare function arrayFlattener(item: TrialData): any[];
5
12
 
6
13
  export declare interface BaseComponentProps {
7
14
  next: (data?: object, actualStartTime?: number, actualStopTime?: number) => void;
@@ -161,6 +168,8 @@ export declare const MicCheck: ({ next }: {
161
168
  next: (data: object) => void;
162
169
  }) => JSX_2.Element;
163
170
 
171
+ export declare type NoiseMovement = 'randomTeleport' | 'randomWalk' | 'randomDirection';
172
+
164
173
  export declare const noopSimulate: SimulateFunction;
165
174
 
166
175
  export declare function now(): number;
@@ -210,6 +219,96 @@ export declare function Quest({ next, surveyJson, customQuestions, }: {
210
219
  customQuestions?: ComponentsMap;
211
220
  }): JSX_2.Element;
212
221
 
222
+ export declare const RandomDotKinematogram: (rawProps: RDKProps) => JSX_2.Element;
223
+
224
+ export declare const RDKCanvas: ForwardRefExoticComponent<RDKCanvasProps & RefAttributes<RDKCanvasHandle>>;
225
+
226
+ export declare interface RDKCanvasHandle {
227
+ getStats: () => {
228
+ framesDisplayed: number;
229
+ measuredRefreshRate: number | null;
230
+ };
231
+ }
232
+
233
+ export declare interface RDKCanvasProps {
234
+ width: number;
235
+ height: number;
236
+ dotCount?: number;
237
+ dotSetCount?: number;
238
+ direction?: number;
239
+ coherence?: number;
240
+ opposite?: number;
241
+ speed?: number;
242
+ dotLifetime?: number;
243
+ updateRate?: number;
244
+ dotRadius?: number;
245
+ dotCharacter?: string;
246
+ dotColor?: string;
247
+ coherentDotColor?: string;
248
+ backgroundColor?: string;
249
+ apertureShape?: ApertureShape;
250
+ apertureWidth?: number;
251
+ apertureHeight?: number;
252
+ apertureCenterX?: number;
253
+ apertureCenterY?: number;
254
+ reinsertMode?: ReinsertType;
255
+ noiseMovement?: NoiseMovement;
256
+ reassignEveryMs?: number;
257
+ showFixation?: boolean;
258
+ fixationWidth?: number;
259
+ fixationHeight?: number;
260
+ fixationColor?: string;
261
+ fixationThickness?: number;
262
+ showBorder?: boolean;
263
+ borderWidth?: number;
264
+ borderColor?: string;
265
+ /** When true (default), dots are animated and visible. When false, only background (+ fixation if enabled) is shown. */
266
+ active?: boolean;
267
+ /** Seed the refresh-rate estimator (e.g. from a prior calibration). */
268
+ initialRefreshRate?: number;
269
+ style?: CSSProperties;
270
+ className?: string;
271
+ }
272
+
273
+ export declare interface RDKProps extends BaseComponentProps {
274
+ validKeys?: string[];
275
+ correctResponse?: string | string[];
276
+ duration?: number;
277
+ stimulusDuration?: number;
278
+ responseEndsTrial?: boolean;
279
+ dotCount?: number;
280
+ dotSetCount?: number;
281
+ direction?: number;
282
+ coherence?: number;
283
+ opposite?: number;
284
+ speed?: number;
285
+ dotLifetime?: number;
286
+ updateRate?: number;
287
+ dotRadius?: number;
288
+ dotCharacter?: string;
289
+ dotColor?: string;
290
+ coherentDotColor?: string;
291
+ backgroundColor?: string;
292
+ apertureShape?: ApertureShape;
293
+ apertureWidth?: number;
294
+ apertureHeight?: number;
295
+ apertureCenterX?: number;
296
+ apertureCenterY?: number;
297
+ reinsertMode?: ReinsertType;
298
+ noiseMovement?: NoiseMovement;
299
+ reassignEveryMs?: number;
300
+ showFixation?: boolean;
301
+ fixationTime?: number;
302
+ fixationWidth?: number;
303
+ fixationHeight?: number;
304
+ fixationColor?: string;
305
+ fixationThickness?: number;
306
+ showBorder?: boolean;
307
+ borderWidth?: number;
308
+ borderColor?: string;
309
+ responseHint?: string;
310
+ }
311
+
213
312
  /**
214
313
  * Registers array methods on the Array prototype.
215
314
  * Call this function once to make array methods available globally.
@@ -238,6 +337,8 @@ export declare function registerFlattener(type: string, csv: string | null, flat
238
337
 
239
338
  export declare function registerSimulation(type: string, simulate: SimulateFunction, defaultSimulators: Record<string, any>): void;
240
339
 
340
+ declare type ReinsertType = 'random' | 'opposite' | 'oppositeSimple' | 'wrap';
341
+
241
342
  export declare function RequestFilePermission({ next }: BaseComponentProps): JSX_2.Element | null;
242
343
 
243
344
  export declare function resolveSimulation(content: any, data: TrialResult[], store: Store_2): {
@@ -319,6 +420,22 @@ export declare interface TrialData {
319
420
 
320
421
  declare type TrialResult = ComponentResultData | CanvasResultData;
321
422
 
423
+ export declare const Tutorial: ({ next, slides, fadeDuration, finishText, containerClass, nextKey, backKey, theme, }: TutorialProps) => JSX_2.Element;
424
+
425
+ export declare interface TutorialProps extends BaseComponentProps {
426
+ slides: ReactNode[];
427
+ /** Fade duration in seconds (default: 0.3) */
428
+ fadeDuration?: number;
429
+ finishText?: string;
430
+ containerClass?: string;
431
+ /** Key to go forward (default: 'ArrowRight', set to false to disable) */
432
+ nextKey?: string | false;
433
+ /** Key to go back (default: 'ArrowLeft', set to false to disable) */
434
+ backKey?: string | false;
435
+ /** Color mode for dot indicators (default: 'light') */
436
+ theme?: 'light' | 'dark';
437
+ }
438
+
322
439
  declare interface UpdateStoreItem {
323
440
  type: 'UPDATE_STORE';
324
441
  fun: StoreUpdateFunction;
@@ -333,6 +450,21 @@ export declare function Upload({ data, next, store, sessionID, generateFiles, se
333
450
  androidFolderName?: string;
334
451
  }): JSX_2.Element;
335
452
 
453
+ /**
454
+ * Hook for interactive slide components.
455
+ * Call with `{ locked: true }` to start with the next button disabled.
456
+ * Then call `unlock()` when the interaction is complete.
457
+ * Call `unlock({ autoAdvanceMs: 1000 })` to auto-advance after a delay.
458
+ */
459
+ export declare const useTutorialSlide: ({ locked }?: {
460
+ locked?: boolean | undefined;
461
+ }) => {
462
+ setData: (data: Record<string, unknown>) => void;
463
+ unlock: ({ autoAdvanceMs }?: {
464
+ autoAdvanceMs?: number;
465
+ }) => void;
466
+ };
467
+
336
468
  declare interface WhileBlockItem {
337
469
  type: 'WHILE_BLOCK';
338
470
  cond: ConditionalFunction;
@@ -1,52 +1,57 @@
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 c, M as u, P as p, g as P, h as g, Q as x, R as d, F as k, T as C, i as E, U as F, X as S, j as T, k as f, l as h, m as v, n as B, o as I, p as U, q as w, r as y, s as D, t as R, u as q, v as A, w as M, x as Q, y as Z, A as b, B as j, D as z, G, I as H, J, K, L, N, O, S as V, V as X, Z as Y } from "./mod-D9lwPIrH.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, 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";
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,
11
- c as Icons,
12
- u as MicCheck,
11
+ u as Icons,
12
+ c as MicCheck,
13
13
  p as Param,
14
- P as PlainInput,
15
- g as ProlificEnding,
16
- x as Quest,
17
- d as RequestFilePermission,
14
+ g as PlainInput,
15
+ P as ProlificEnding,
16
+ d as Quest,
17
+ x as RDKCanvas,
18
+ C as RandomDotKinematogram,
19
+ T as RequestFilePermission,
18
20
  k as Slide,
19
- C as Text,
20
- E as ToastContainer,
21
- F as Upload,
22
- S as Zoom,
23
- T as canvasCountdown,
24
- f as chunk,
25
- h as collapseToast,
26
- v as cssTransition,
27
- B as getBackendUrl,
28
- I as getInitialParticipant,
29
- U as getParam,
30
- w as getPlatform,
31
- y as getSimulation,
32
- D as isDesktop,
33
- R as isFullscreen,
34
- q as noopSimulate,
35
- A as now,
36
- M as orchestrateSimulation,
37
- Q as pipe,
38
- Z as registerArrayExtensions,
39
- b as registerComponentParams,
40
- j as registerExperimentParams,
41
- z as registerFlattener,
42
- G as registerSimulation,
43
- H as resolveSimulation,
44
- J as sample,
45
- K as setBackendUrl,
46
- L as shuffle,
47
- N as simulateParticipant,
48
- O as subsetExperimentByParam,
49
- V as toast,
50
- X as useToast,
51
- Y as useToastContainer
21
+ E as Text,
22
+ F as ToastContainer,
23
+ S as Tutorial,
24
+ v as Upload,
25
+ f as Zoom,
26
+ h as arrayFlattener,
27
+ B as canvasCountdown,
28
+ D as chunk,
29
+ R as collapseToast,
30
+ y as cssTransition,
31
+ I as getBackendUrl,
32
+ U as getInitialParticipant,
33
+ w as getParam,
34
+ K as getPlatform,
35
+ q as getSimulation,
36
+ A as isDesktop,
37
+ M as isFullscreen,
38
+ 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
52
57
  };