@adriansteffan/reactive 0.0.44 → 0.1.0

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
@@ -53,6 +53,8 @@ export declare function chunk<T>(array: T[], n: number): T[][];
53
53
  declare type ComponentResultData = BaseTrialData & {
54
54
  type: string;
55
55
  name: string;
56
+ /** 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. */
57
+ csv?: string | string[];
56
58
  responseData?: any;
57
59
  metadata?: Record<string, any>;
58
60
  };
@@ -70,16 +72,10 @@ declare type ComponentsMap_2 = {
70
72
  [key: string]: ComponentType<any>;
71
73
  };
72
74
 
73
- declare type ConditionalFunction = (data?: RefinedTrialData[], store?: Store_2) => boolean;
75
+ declare type ConditionalFunction = (data?: TrialResult[], store?: Store_2) => boolean;
74
76
 
75
77
  declare type ControlFlowItem = MarkerItem | IfGotoItem | UpdateStoreItem | IfBlockItem | WhileBlockItem;
76
78
 
77
- declare type CSVBuilder = {
78
- filename?: string;
79
- trials?: string[];
80
- fun?: (row: Record<string, any>) => Record<string, any>;
81
- };
82
-
83
79
  declare interface DeviceInfo {
84
80
  windowWidth: number;
85
81
  windowHeight: number;
@@ -134,7 +130,7 @@ export declare function getBackendUrl(): string;
134
130
 
135
131
  export declare function getInitialParticipant(): ParticipantState | undefined;
136
132
 
137
- export declare function getParam<T extends ParamType>(name: string, defaultValue: ParamValue<T>, type?: T, description?: string): ParamValue<T>;
133
+ export declare function getParam<T extends ParamType>(name: string, defaultValue: ParamValue<T>, type?: T, description?: string, uiDefault?: string): ParamValue<T>;
138
134
 
139
135
  export declare const getPlatform: () => Platform;
140
136
 
@@ -214,8 +210,6 @@ export declare function Quest({ next, surveyJson, customQuestions, }: {
214
210
  customQuestions?: ComponentsMap;
215
211
  }): JSX_2.Element;
216
212
 
217
- declare type RefinedTrialData = ComponentResultData | CanvasResultData;
218
-
219
213
  /**
220
214
  * Registers array methods on the Array prototype.
221
215
  * Call this function once to make array methods available globally.
@@ -240,11 +234,13 @@ export declare function registerComponentParams(type: string, params: {
240
234
 
241
235
  export declare function registerExperimentParams(experiment: any[]): void;
242
236
 
237
+ export declare function registerFlattener(type: string, csv: string | null, flatten?: (item: TrialData) => any[]): void;
238
+
243
239
  export declare function registerSimulation(type: string, simulate: SimulateFunction, defaultSimulators: Record<string, any>): void;
244
240
 
245
241
  export declare function RequestFilePermission({ next }: BaseComponentProps): JSX_2.Element | null;
246
242
 
247
- export declare function resolveSimulation(content: any, data: RefinedTrialData[], store: Store_2): {
243
+ export declare function resolveSimulation(content: any, data: TrialResult[], store: Store_2): {
248
244
  trialProps: any;
249
245
  simulateFn: any;
250
246
  simulators: any;
@@ -272,11 +268,11 @@ export declare function setBackendUrl(url: string): void;
272
268
  export declare function shuffle<T>(array: T[]): T[];
273
269
 
274
270
  export declare type SimulateFunction = (trialProps: Record<string, any>, experimentState: {
275
- data: RefinedTrialData[];
271
+ data: TrialResult[];
276
272
  store: Store_2;
277
273
  }, simulators: Record<string, any>, participant: ParticipantState) => SimulatorResult | Promise<SimulatorResult>;
278
274
 
279
- export declare function simulateParticipant(timeline: TimelineItem[], participant: ParticipantState): Promise<RefinedTrialData[]>;
275
+ export declare function simulateParticipant(timeline: TimelineItem[], participant: ParticipantState): Promise<TrialResult[]>;
280
276
 
281
277
  export declare type SimulatorResult = {
282
278
  responseData: any;
@@ -291,7 +287,7 @@ export declare interface Store {
291
287
 
292
288
  declare type Store_2 = Record<string, any>;
293
289
 
294
- declare type StoreUpdateFunction = (data?: RefinedTrialData[], store?: Store_2) => Record<string, any>;
290
+ declare type StoreUpdateFunction = (data?: TrialResult[], store?: Store_2) => Record<string, any>;
295
291
 
296
292
  export declare function subsetExperimentByParam(experiment: any[]): any[];
297
293
 
@@ -313,27 +309,27 @@ export declare interface TrialData {
313
309
  trialNumber: number;
314
310
  type: string;
315
311
  name: string;
312
+ /** Populated from the timeline item's csv field. Overrides the component type's default CSV target from the flattener registry. */
313
+ csv?: string | string[];
316
314
  responseData: any;
317
315
  start: number;
318
316
  end: number;
319
317
  duration: number;
320
318
  }
321
319
 
320
+ declare type TrialResult = ComponentResultData | CanvasResultData;
321
+
322
322
  declare interface UpdateStoreItem {
323
323
  type: 'UPDATE_STORE';
324
324
  fun: StoreUpdateFunction;
325
325
  }
326
326
 
327
- export declare function Upload({ data, next, store, sessionID, generateFiles, sessionCSVBuilder, trialCSVBuilder, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
327
+ export declare function Upload({ data, next, store, sessionID, generateFiles, sessionData, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
328
328
  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;
329
+ generateFiles?: (sessionID: string, data: TrialData[], store?: Store) => FileUpload[];
330
+ sessionData?: Record<string, any>;
331
+ uploadRaw?: boolean;
332
+ autoUpload?: boolean;
337
333
  androidFolderName?: string;
338
334
  }): JSX_2.Element;
339
335
 
@@ -1,4 +1,4 @@
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 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";
2
2
  export {
3
3
  e as Bounce,
4
4
  t as CanvasBlock,
@@ -18,13 +18,13 @@ export {
18
18
  k as Slide,
19
19
  C as Text,
20
20
  E as ToastContainer,
21
- S as Upload,
22
- T as Zoom,
23
- f as canvasCountdown,
24
- h as chunk,
25
- v as collapseToast,
26
- B as cssTransition,
27
- F as getBackendUrl,
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
28
  I as getInitialParticipant,
29
29
  U as getParam,
30
30
  w as getPlatform,
@@ -35,9 +35,10 @@ export {
35
35
  A as now,
36
36
  M as orchestrateSimulation,
37
37
  Q as pipe,
38
- b as registerArrayExtensions,
39
- j as registerComponentParams,
40
- z as registerExperimentParams,
38
+ Z as registerArrayExtensions,
39
+ b as registerComponentParams,
40
+ j as registerExperimentParams,
41
+ z as registerFlattener,
41
42
  G as registerSimulation,
42
43
  H as resolveSimulation,
43
44
  J as sample,