@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/.claude/settings.local.json +8 -1
- package/README.md +126 -0
- package/dist/{mod-D6DlS3ur.js → mod-D9lwPIrH.js} +3480 -3498
- package/dist/mod.d.ts +19 -23
- package/dist/reactive.es.js +12 -11
- package/dist/reactive.umd.js +38 -38
- package/dist/style.css +1 -1
- package/dist/{web-D7VcCd-t.js → web-DUIQX1PV.js} +1 -1
- package/dist/{web-o3I0sgwu.js → web-DXP3LAJm.js} +1 -1
- package/package.json +1 -1
- package/src/components/canvasblock.tsx +14 -5
- package/src/components/checkdevice.tsx +3 -0
- package/src/components/enterfullscreen.tsx +2 -0
- package/src/components/exitfullscreen.tsx +2 -0
- package/src/components/experimentrunner.tsx +19 -6
- package/src/components/microphonecheck.tsx +3 -1
- package/src/components/plaininput.tsx +3 -0
- package/src/components/prolificending.tsx +2 -0
- package/src/components/quest.tsx +3 -0
- package/src/components/storeui.tsx +3 -0
- package/src/components/text.tsx +3 -0
- package/src/components/upload.tsx +18 -20
- package/src/index.css +0 -20
- package/src/mod.tsx +1 -0
- package/src/utils/bytecode.ts +13 -11
- package/src/utils/common.ts +4 -1
- package/src/utils/simulation.ts +6 -5
- package/src/utils/upload.ts +106 -204
- package/template/backend/package-lock.json +280 -156
- package/template/package-lock.json +1693 -771
- package/template/src/Experiment.tsx +5 -1
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?:
|
|
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:
|
|
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:
|
|
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<
|
|
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?:
|
|
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,
|
|
327
|
+
export declare function Upload({ data, next, store, sessionID, generateFiles, sessionData, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
|
|
328
328
|
sessionID?: string | null;
|
|
329
|
-
generateFiles
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as e,
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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,
|