@adriansteffan/reactive 0.0.21 → 0.0.22
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-jEw82wE_.js → mod-DgcCRxWo.js} +6218 -6060
- package/dist/mod.d.ts +70 -19
- package/dist/reactive.es.js +14 -12
- package/dist/reactive.umd.js +32 -31
- package/dist/style.css +1 -1
- package/dist/{web-Ct-fywza.js → web-Dtpv_Ihb.js} +1 -1
- package/package.json +1 -1
- package/src/components/experiment.tsx +242 -33
- package/src/components/plaininput.tsx +72 -0
- package/src/components/text.tsx +1 -1
- package/src/components/upload.tsx +10 -24
- package/src/mod.tsx +2 -1
- package/src/utils/common.ts +25 -5
package/dist/mod.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
|
|
5
5
|
export declare interface BaseComponentProps {
|
|
6
6
|
next: (data: object) => void;
|
|
7
|
-
data
|
|
8
|
-
|
|
7
|
+
data: TrialData[];
|
|
8
|
+
store?: Store;
|
|
9
|
+
updateStore: (mergeIn: Store) => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
declare type ComponentsMap = {
|
|
@@ -16,6 +17,12 @@ declare type ComponentsMap_2 = {
|
|
|
16
17
|
[key: string]: ComponentType<any>;
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
declare interface ComponentTrial {
|
|
21
|
+
name: string;
|
|
22
|
+
type: string;
|
|
23
|
+
props?: Record<string, any> | ((store: Store, data: TrialData[]) => Record<string, any>);
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
export declare function EnterFullscreen({ content, buttonText, next, }: {
|
|
20
27
|
prolificCode?: string;
|
|
21
28
|
content?: React.ReactNode;
|
|
@@ -39,11 +46,7 @@ export declare function ExperimentProvider({ children }: {
|
|
|
39
46
|
children: ReactNode;
|
|
40
47
|
}): JSX_2.Element;
|
|
41
48
|
|
|
42
|
-
declare
|
|
43
|
-
name: string;
|
|
44
|
-
type: string;
|
|
45
|
-
props?: Record<string, any>;
|
|
46
|
-
}
|
|
49
|
+
declare type ExperimentTrial = MarkerTrial | IfGotoTrial | UpdateStoreTrial | IfBlockTrial | WhileBlockTrial | ComponentTrial;
|
|
47
50
|
|
|
48
51
|
export declare interface FileUpload {
|
|
49
52
|
filename: string;
|
|
@@ -53,8 +56,27 @@ export declare interface FileUpload {
|
|
|
53
56
|
|
|
54
57
|
export declare function getParam<T extends ParamType>(name: string, defaultValue: ParamValue<T> | undefined, type?: T): ParamValue<T> | undefined;
|
|
55
58
|
|
|
59
|
+
export declare const getPlatform: () => Platform;
|
|
60
|
+
|
|
61
|
+
declare interface IfBlockTrial {
|
|
62
|
+
type: 'IF_BLOCK' | string;
|
|
63
|
+
cond: (store: Store, data: TrialData[]) => boolean;
|
|
64
|
+
timeline: ExperimentTrial[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare interface IfGotoTrial {
|
|
68
|
+
type: 'IF_GOTO' | string;
|
|
69
|
+
cond: (store: Store, data: TrialData[]) => boolean;
|
|
70
|
+
marker: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
export declare function isDesktop(): boolean;
|
|
57
74
|
|
|
75
|
+
declare interface MarkerTrial {
|
|
76
|
+
type: 'MARKER' | string;
|
|
77
|
+
id: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
58
80
|
export declare const MicCheck: ({ next }: {
|
|
59
81
|
next: (data: object) => void;
|
|
60
82
|
}) => JSX_2.Element;
|
|
@@ -65,6 +87,21 @@ declare type ParamType = 'string' | 'number' | 'boolean' | 'array' | 'json';
|
|
|
65
87
|
|
|
66
88
|
declare type ParamValue<T extends ParamType> = T extends 'number' ? number | undefined : T extends 'boolean' ? boolean | undefined : T extends 'array' | 'json' ? any | undefined : string | undefined;
|
|
67
89
|
|
|
90
|
+
export declare function PlainInput({ content, buttonText, className, next, updateStore, animate, storeupdate, // user defined function
|
|
91
|
+
placeholder, }: BaseComponentProps & {
|
|
92
|
+
content: React.ReactNode;
|
|
93
|
+
buttonText?: string;
|
|
94
|
+
onButtonClick?: () => void;
|
|
95
|
+
className?: string;
|
|
96
|
+
animate?: boolean;
|
|
97
|
+
storeupdate?: (entry: string) => {
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
};
|
|
100
|
+
placeholder?: string;
|
|
101
|
+
}): JSX_2.Element;
|
|
102
|
+
|
|
103
|
+
export declare type Platform = 'desktop' | 'mobile' | 'web';
|
|
104
|
+
|
|
68
105
|
export declare function ProlificEnding({ prolificCode, }: {
|
|
69
106
|
prolificCode?: string;
|
|
70
107
|
} & BaseComponentProps): JSX_2.Element;
|
|
@@ -77,14 +114,8 @@ export declare function Quest({ next, surveyJson, customQuestions }: {
|
|
|
77
114
|
|
|
78
115
|
export declare function shuffle(array: any[]): any[];
|
|
79
116
|
|
|
80
|
-
export declare interface
|
|
81
|
-
|
|
82
|
-
type: string;
|
|
83
|
-
name: string;
|
|
84
|
-
data: any;
|
|
85
|
-
start: number;
|
|
86
|
-
end: number;
|
|
87
|
-
duration: number;
|
|
117
|
+
export declare interface Store {
|
|
118
|
+
[key: string]: any;
|
|
88
119
|
}
|
|
89
120
|
|
|
90
121
|
declare function Text_2({ content, buttonText, className, next, animate, }: {
|
|
@@ -97,14 +128,34 @@ declare function Text_2({ content, buttonText, className, next, animate, }: {
|
|
|
97
128
|
}): JSX_2.Element;
|
|
98
129
|
export { Text_2 as Text }
|
|
99
130
|
|
|
100
|
-
export declare
|
|
101
|
-
|
|
102
|
-
|
|
131
|
+
export declare interface TrialData {
|
|
132
|
+
index: number;
|
|
133
|
+
trialNumber: number;
|
|
134
|
+
type: string;
|
|
135
|
+
name: string;
|
|
136
|
+
data: any;
|
|
137
|
+
start: number;
|
|
138
|
+
end: number;
|
|
139
|
+
duration: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
declare interface UpdateStoreTrial {
|
|
143
|
+
type: 'UPDATE_STORE' | string;
|
|
144
|
+
fun: (store: Store, data: TrialData[]) => Store;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export declare function Upload({ data, next, store, sessionID, generateFiles, uploadRaw, autoUpload, androidFolderName, }: BaseComponentProps & {
|
|
103
148
|
sessionID?: string | null;
|
|
104
|
-
generateFiles: (sessionID: string, data:
|
|
149
|
+
generateFiles: (sessionID: string, data: TrialData[], store?: Store) => FileUpload[];
|
|
105
150
|
uploadRaw: boolean;
|
|
106
151
|
autoUpload: boolean;
|
|
107
152
|
androidFolderName?: string;
|
|
108
153
|
}): JSX_2.Element;
|
|
109
154
|
|
|
155
|
+
declare interface WhileBlockTrial {
|
|
156
|
+
type: 'WHILE_BLOCK' | string;
|
|
157
|
+
cond: (store: Store, data: TrialData[]) => boolean;
|
|
158
|
+
timeline: ExperimentTrial[];
|
|
159
|
+
}
|
|
160
|
+
|
|
110
161
|
export { }
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { a, c as r, d as
|
|
1
|
+
import { a as e, c as r, d as t, e as i, M as n, f as l, P as o, Q as c, T as f, U as p, g as P, h as m, i as u, n as x, s as E } from "./mod-DgcCRxWo.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
e as EnterFullscreen,
|
|
4
4
|
r as ExitFullscreen,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
l as
|
|
9
|
-
o as
|
|
10
|
-
c as
|
|
5
|
+
t as Experiment,
|
|
6
|
+
i as ExperimentProvider,
|
|
7
|
+
n as MicCheck,
|
|
8
|
+
l as PlainInput,
|
|
9
|
+
o as ProlificEnding,
|
|
10
|
+
c as Quest,
|
|
11
|
+
f as Text,
|
|
11
12
|
p as Upload,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
P as getParam,
|
|
14
|
+
m as getPlatform,
|
|
15
|
+
u as isDesktop,
|
|
16
|
+
x as now,
|
|
17
|
+
E as shuffle
|
|
16
18
|
};
|