@adriansteffan/reactive 0.0.44 → 0.1.1

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
@@ -3,6 +3,8 @@ import { default as default_2 } from 'react';
3
3
  import { JSX as JSX_2 } from 'react/jsx-runtime';
4
4
  import { ReactNode } from 'react';
5
5
 
6
+ export declare function arrayFlattener(item: TrialData): any[];
7
+
6
8
  export declare interface BaseComponentProps {
7
9
  next: (data?: object, actualStartTime?: number, actualStopTime?: number) => void;
8
10
  data: TrialData[];
@@ -53,6 +55,8 @@ export declare function chunk<T>(array: T[], n: number): T[][];
53
55
  declare type ComponentResultData = BaseTrialData & {
54
56
  type: string;
55
57
  name: string;
58
+ /** Per-trial override for which CSV file(s) this trial's data goes into. When set on a timeline item, overrides the component type's default from the flattener registry. */
59
+ csv?: string | string[];
56
60
  responseData?: any;
57
61
  metadata?: Record<string, any>;
58
62
  };
@@ -70,16 +74,10 @@ declare type ComponentsMap_2 = {
70
74
  [key: string]: ComponentType<any>;
71
75
  };
72
76
 
73
- declare type ConditionalFunction = (data?: RefinedTrialData[], store?: Store_2) => boolean;
77
+ declare type ConditionalFunction = (data?: TrialResult[], store?: Store_2) => boolean;
74
78
 
75
79
  declare type ControlFlowItem = MarkerItem | IfGotoItem | UpdateStoreItem | IfBlockItem | WhileBlockItem;
76
80
 
77
- declare type CSVBuilder = {
78
- filename?: string;
79
- trials?: string[];
80
- fun?: (row: Record<string, any>) => Record<string, any>;
81
- };
82
-
83
81
  declare interface DeviceInfo {
84
82
  windowWidth: number;
85
83
  windowHeight: number;
@@ -134,7 +132,7 @@ export declare function getBackendUrl(): string;
134
132
 
135
133
  export declare function getInitialParticipant(): ParticipantState | undefined;
136
134
 
137
- export declare function getParam<T extends ParamType>(name: string, defaultValue: ParamValue<T>, type?: T, description?: string): ParamValue<T>;
135
+ export declare function getParam<T extends ParamType>(name: string, defaultValue: ParamValue<T>, type?: T, description?: string, uiDefault?: string): ParamValue<T>;
138
136
 
139
137
  export declare const getPlatform: () => Platform;
140
138
 
@@ -214,8 +212,6 @@ export declare function Quest({ next, surveyJson, customQuestions, }: {
214
212
  customQuestions?: ComponentsMap;
215
213
  }): JSX_2.Element;
216
214
 
217
- declare type RefinedTrialData = ComponentResultData | CanvasResultData;
218
-
219
215
  /**
220
216
  * Registers array methods on the Array prototype.
221
217
  * Call this function once to make array methods available globally.
@@ -240,11 +236,13 @@ export declare function registerComponentParams(type: string, params: {
240
236
 
241
237
  export declare function registerExperimentParams(experiment: any[]): void;
242
238
 
239
+ export declare function registerFlattener(type: string, csv: string | null, flatten?: (item: TrialData) => any[]): void;
240
+
243
241
  export declare function registerSimulation(type: string, simulate: SimulateFunction, defaultSimulators: Record<string, any>): void;
244
242
 
245
243
  export declare function RequestFilePermission({ next }: BaseComponentProps): JSX_2.Element | null;
246
244
 
247
- export declare function resolveSimulation(content: any, data: RefinedTrialData[], store: Store_2): {
245
+ export declare function resolveSimulation(content: any, data: TrialResult[], store: Store_2): {
248
246
  trialProps: any;
249
247
  simulateFn: any;
250
248
  simulators: any;
@@ -272,11 +270,11 @@ export declare function setBackendUrl(url: string): void;
272
270
  export declare function shuffle<T>(array: T[]): T[];
273
271
 
274
272
  export declare type SimulateFunction = (trialProps: Record<string, any>, experimentState: {
275
- data: RefinedTrialData[];
273
+ data: TrialResult[];
276
274
  store: Store_2;
277
275
  }, simulators: Record<string, any>, participant: ParticipantState) => SimulatorResult | Promise<SimulatorResult>;
278
276
 
279
- export declare function simulateParticipant(timeline: TimelineItem[], participant: ParticipantState): Promise<RefinedTrialData[]>;
277
+ export declare function simulateParticipant(timeline: TimelineItem[], participant: ParticipantState): Promise<TrialResult[]>;
280
278
 
281
279
  export declare type SimulatorResult = {
282
280
  responseData: any;
@@ -291,7 +289,7 @@ export declare interface Store {
291
289
 
292
290
  declare type Store_2 = Record<string, any>;
293
291
 
294
- declare type StoreUpdateFunction = (data?: RefinedTrialData[], store?: Store_2) => Record<string, any>;
292
+ declare type StoreUpdateFunction = (data?: TrialResult[], store?: Store_2) => Record<string, any>;
295
293
 
296
294
  export declare function subsetExperimentByParam(experiment: any[]): any[];
297
295
 
@@ -313,27 +311,27 @@ export declare interface TrialData {
313
311
  trialNumber: number;
314
312
  type: string;
315
313
  name: string;
314
+ /** Populated from the timeline item's csv field. Overrides the component type's default CSV target from the flattener registry. */
315
+ csv?: string | string[];
316
316
  responseData: any;
317
317
  start: number;
318
318
  end: number;
319
319
  duration: number;
320
320
  }
321
321
 
322
+ declare type TrialResult = ComponentResultData | CanvasResultData;
323
+
322
324
  declare interface UpdateStoreItem {
323
325
  type: 'UPDATE_STORE';
324
326
  fun: StoreUpdateFunction;
325
327
  }
326
328
 
327
- export declare function Upload({ data, next, store, sessionID, generateFiles, sessionCSVBuilder, trialCSVBuilder, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
329
+ export declare function Upload({ data, next, store, sessionID, generateFiles, sessionData, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
328
330
  sessionID?: string | null;
329
- generateFiles: (sessionID: string, data: TrialData[], store?: Store) => FileUpload[];
330
- sessionCSVBuilder: CSVBuilder;
331
- trialCSVBuilder: {
332
- flatteners: Record<string, ((item: TrialData) => Record<string, any>[] | Record<string, Record<string, any>[]>)>;
333
- builders: CSVBuilder[];
334
- };
335
- uploadRaw: boolean;
336
- autoUpload: boolean;
331
+ generateFiles?: (sessionID: string, data: TrialData[], store?: Store) => FileUpload[];
332
+ sessionData?: Record<string, any>;
333
+ uploadRaw?: boolean;
334
+ autoUpload?: boolean;
337
335
  androidFolderName?: string;
338
336
  }): JSX_2.Element;
339
337
 
@@ -1,10 +1,10 @@
1
- import { H as e, F as t, G as i, A as n, B as r, C as o, D as l, Y as m, I as c, M as u, P as p, y as P, z as g, Q as x, R as d, J as k, T as C, K as E, U as S, X as T, k as f, c as h, L as v, N as B, u as F, v as I, g as U, e as w, m as y, d as D, i as R, o as q, n as A, x as M, p as Q, r as b, h as j, f as z, l as G, q as H, s as J, t as K, a as L, w as N, j as O, O as V, S as X, V as Y } from "./mod-D6DlS3ur.js";
1
+ import { H as e, C as t, a as r, c as i, d as n, 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 y, p as I, q as U, r as w, 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-Beb0Bz3s.js";
2
2
  export {
3
3
  e as Bounce,
4
4
  t as CanvasBlock,
5
- i as CheckDevice,
6
- n as EnterFullscreen,
7
- r as ExitFullscreen,
5
+ r as CheckDevice,
6
+ i as EnterFullscreen,
7
+ n as ExitFullscreen,
8
8
  o as ExperimentProvider,
9
9
  l as ExperimentRunner,
10
10
  m as Flip,
@@ -18,34 +18,36 @@ export {
18
18
  k as Slide,
19
19
  C as Text,
20
20
  E as ToastContainer,
21
- S as Upload,
22
- T as Zoom,
21
+ F as Upload,
22
+ S as Zoom,
23
+ T as arrayFlattener,
23
24
  f as canvasCountdown,
24
25
  h as chunk,
25
26
  v as collapseToast,
26
27
  B as cssTransition,
27
- F as getBackendUrl,
28
+ y as getBackendUrl,
28
29
  I as getInitialParticipant,
29
30
  U as getParam,
30
31
  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,
32
+ D as getSimulation,
33
+ R as isDesktop,
34
+ q as isFullscreen,
35
+ A as noopSimulate,
36
+ M as now,
37
+ Q as orchestrateSimulation,
38
+ Z as pipe,
38
39
  b as registerArrayExtensions,
39
40
  j as registerComponentParams,
40
41
  z as registerExperimentParams,
41
- G as registerSimulation,
42
- H as resolveSimulation,
43
- J as sample,
44
- K as setBackendUrl,
45
- L as shuffle,
46
- N as simulateParticipant,
47
- O as subsetExperimentByParam,
48
- V as toast,
49
- X as useToast,
50
- Y as useToastContainer
42
+ G as registerFlattener,
43
+ H as registerSimulation,
44
+ J as resolveSimulation,
45
+ K as sample,
46
+ L as setBackendUrl,
47
+ N as shuffle,
48
+ O as simulateParticipant,
49
+ V as subsetExperimentByParam,
50
+ X as toast,
51
+ Y as useToast,
52
+ _ as useToastContainer
51
53
  };