@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/.claude/settings.local.json +8 -1
- package/README.md +136 -0
- package/dist/{mod-D6DlS3ur.js → mod-Beb0Bz3s.js} +3483 -3499
- package/dist/mod.d.ts +21 -23
- package/dist/reactive.es.js +26 -24
- package/dist/reactive.umd.js +38 -38
- package/dist/style.css +1 -1
- package/dist/{web-o3I0sgwu.js → web-DOXm98lr.js} +1 -1
- package/dist/{web-D7VcCd-t.js → web-aMUVS_EB.js} +1 -1
- package/package.json +1 -1
- package/src/components/canvasblock.tsx +8 -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 +116 -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
|
@@ -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?:
|
|
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:
|
|
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:
|
|
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<
|
|
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?:
|
|
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,
|
|
329
|
+
export declare function Upload({ data, next, store, sessionID, generateFiles, sessionData, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
|
|
328
330
|
sessionID?: string | null;
|
|
329
|
-
generateFiles
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { H as e,
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
28
|
+
y as getBackendUrl,
|
|
28
29
|
I as getInitialParticipant,
|
|
29
30
|
U as getParam,
|
|
30
31
|
w as getPlatform,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
42
|
-
H as
|
|
43
|
-
J as
|
|
44
|
-
K as
|
|
45
|
-
L as
|
|
46
|
-
N as
|
|
47
|
-
O as
|
|
48
|
-
V as
|
|
49
|
-
X as
|
|
50
|
-
Y as
|
|
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
|
};
|