@adriansteffan/reactive 0.0.20 → 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.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?: object;
8
- metaData?: object;
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 interface ExperimentTrial {
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 StudyEvent {
81
- index: number;
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 function Upload({ data, next, sessionID, generateFiles, uploadRaw, autoUpload, androidFolderName, }: {
101
- data: StudyEvent[];
102
- next: () => void;
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: StudyEvent[]) => FileUpload[];
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 { }
@@ -1,16 +1,18 @@
1
- import { a, c as r, d as i, e as n, M as t, P as l, Q as o, T as c, U as p, g as x, i as E, n as d, s as f } from "./mod-BlYvqdtq.js";
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
- a as EnterFullscreen,
3
+ e as EnterFullscreen,
4
4
  r as ExitFullscreen,
5
- i as Experiment,
6
- n as ExperimentProvider,
7
- t as MicCheck,
8
- l as ProlificEnding,
9
- o as Quest,
10
- c as Text,
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
- x as getParam,
13
- E as isDesktop,
14
- d as now,
15
- f as shuffle
13
+ P as getParam,
14
+ m as getPlatform,
15
+ u as isDesktop,
16
+ x as now,
17
+ E as shuffle
16
18
  };