@jspsych/plugin-survey-likert 1.1.2 → 2.0.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/index.d.ts CHANGED
@@ -1,156 +1,185 @@
1
- import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
2
- declare const info: {
3
- readonly name: "survey-likert";
4
- readonly parameters: {
5
- /** Array containing one or more objects with parameters for the question(s) that should be shown on the page. */
6
- readonly questions: {
7
- readonly type: ParameterType.COMPLEX;
8
- readonly array: true;
9
- readonly pretty_name: "Questions";
10
- readonly nested: {
11
- /** Question prompt. */
12
- readonly prompt: {
13
- readonly type: ParameterType.HTML_STRING;
14
- readonly pretty_name: "Prompt";
15
- readonly default: any;
16
- };
17
- /** Array of likert labels to display for this question. */
18
- readonly labels: {
19
- readonly type: ParameterType.STRING;
20
- readonly array: true;
21
- readonly pretty_name: "Labels";
22
- readonly default: any;
23
- };
24
- /** Whether or not a response to this question must be given in order to continue. */
25
- readonly required: {
26
- readonly type: ParameterType.BOOL;
27
- readonly pretty_name: "Required";
28
- readonly default: false;
29
- };
30
- /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */
31
- readonly name: {
32
- readonly type: ParameterType.STRING;
33
- readonly pretty_name: "Question Name";
34
- readonly default: "";
35
- };
36
- };
37
- };
38
- /** If true, the order of the questions in the 'questions' array will be randomized. */
39
- readonly randomize_question_order: {
40
- readonly type: ParameterType.BOOL;
41
- readonly pretty_name: "Randomize Question Order";
42
- readonly default: false;
43
- };
44
- /** HTML-formatted string to display at top of the page above all of the questions. */
45
- readonly preamble: {
46
- readonly type: ParameterType.HTML_STRING;
47
- readonly pretty_name: "Preamble";
48
- readonly default: any;
49
- };
50
- /** Width of the likert scales in pixels. */
51
- readonly scale_width: {
52
- readonly type: ParameterType.INT;
53
- readonly pretty_name: "Scale width";
54
- readonly default: any;
55
- };
56
- /** Label of the button to submit responses. */
57
- readonly button_label: {
58
- readonly type: ParameterType.STRING;
59
- readonly pretty_name: "Button label";
60
- readonly default: "Continue";
61
- };
62
- /** Setting this to true will enable browser auto-complete or auto-fill for the form. */
63
- readonly autocomplete: {
64
- readonly type: ParameterType.BOOL;
65
- readonly pretty_name: "Allow autocomplete";
66
- readonly default: false;
67
- };
68
- };
69
- };
70
- declare type Info = typeof info;
71
- /**
72
- * **survey-likert**
73
- *
74
- * jsPsych plugin for gathering responses to questions on a likert scale
75
- *
76
- * @author Josh de Leeuw
77
- * @see {@link https://www.jspsych.org/plugins/jspsych-survey-likert/ survey-likert plugin documentation on jspsych.org}
78
- */
79
- declare class SurveyLikertPlugin implements JsPsychPlugin<Info> {
80
- private jsPsych;
81
- static info: {
82
- readonly name: "survey-likert";
83
- readonly parameters: {
84
- /** Array containing one or more objects with parameters for the question(s) that should be shown on the page. */
85
- readonly questions: {
86
- readonly type: ParameterType.COMPLEX;
87
- readonly array: true;
88
- readonly pretty_name: "Questions";
89
- readonly nested: {
90
- /** Question prompt. */
91
- readonly prompt: {
92
- readonly type: ParameterType.HTML_STRING;
93
- readonly pretty_name: "Prompt";
94
- readonly default: any;
95
- };
96
- /** Array of likert labels to display for this question. */
97
- readonly labels: {
98
- readonly type: ParameterType.STRING;
99
- readonly array: true;
100
- readonly pretty_name: "Labels";
101
- readonly default: any;
102
- };
103
- /** Whether or not a response to this question must be given in order to continue. */
104
- readonly required: {
105
- readonly type: ParameterType.BOOL;
106
- readonly pretty_name: "Required";
107
- readonly default: false;
108
- };
109
- /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */
110
- readonly name: {
111
- readonly type: ParameterType.STRING;
112
- readonly pretty_name: "Question Name";
113
- readonly default: "";
114
- };
115
- };
116
- };
117
- /** If true, the order of the questions in the 'questions' array will be randomized. */
118
- readonly randomize_question_order: {
119
- readonly type: ParameterType.BOOL;
120
- readonly pretty_name: "Randomize Question Order";
121
- readonly default: false;
122
- };
123
- /** HTML-formatted string to display at top of the page above all of the questions. */
124
- readonly preamble: {
125
- readonly type: ParameterType.HTML_STRING;
126
- readonly pretty_name: "Preamble";
127
- readonly default: any;
128
- };
129
- /** Width of the likert scales in pixels. */
130
- readonly scale_width: {
131
- readonly type: ParameterType.INT;
132
- readonly pretty_name: "Scale width";
133
- readonly default: any;
134
- };
135
- /** Label of the button to submit responses. */
136
- readonly button_label: {
137
- readonly type: ParameterType.STRING;
138
- readonly pretty_name: "Button label";
139
- readonly default: "Continue";
140
- };
141
- /** Setting this to true will enable browser auto-complete or auto-fill for the form. */
142
- readonly autocomplete: {
143
- readonly type: ParameterType.BOOL;
144
- readonly pretty_name: "Allow autocomplete";
145
- readonly default: false;
146
- };
147
- };
148
- };
149
- constructor(jsPsych: JsPsych);
150
- trial(display_element: HTMLElement, trial: TrialType<Info>): void;
151
- simulate(trial: TrialType<Info>, simulation_mode: any, simulation_options: any, load_callback: () => void): void;
152
- private create_simulation_data;
153
- private simulate_data_only;
154
- private simulate_visual;
155
- }
156
- export default SurveyLikertPlugin;
1
+ import { JsPsychPlugin, ParameterType, JsPsych, TrialType } from 'jspsych';
2
+
3
+ declare const info: {
4
+ readonly name: "survey-likert";
5
+ readonly version: string;
6
+ readonly parameters: {
7
+ /** Array containing one or more objects with parameters for the question(s) that should be shown on the page. */
8
+ readonly questions: {
9
+ readonly type: ParameterType.COMPLEX;
10
+ readonly array: true;
11
+ readonly nested: {
12
+ /** Question prompt. */
13
+ readonly prompt: {
14
+ readonly type: ParameterType.HTML_STRING;
15
+ readonly default: any;
16
+ };
17
+ /** Array of likert labels to display for this question. */
18
+ readonly labels: {
19
+ readonly type: ParameterType.STRING;
20
+ readonly array: true;
21
+ readonly default: any;
22
+ };
23
+ /** Whether or not a response to this question must be given in order to continue. */
24
+ readonly required: {
25
+ readonly type: ParameterType.BOOL;
26
+ readonly default: false;
27
+ };
28
+ /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */
29
+ readonly name: {
30
+ readonly type: ParameterType.STRING;
31
+ readonly default: "";
32
+ };
33
+ };
34
+ };
35
+ /** If true, the order of the questions in the 'questions' array will be randomized. */
36
+ readonly randomize_question_order: {
37
+ readonly type: ParameterType.BOOL;
38
+ readonly default: false;
39
+ };
40
+ /** HTML-formatted string to display at top of the page above all of the questions. */
41
+ readonly preamble: {
42
+ readonly type: ParameterType.HTML_STRING;
43
+ readonly default: any;
44
+ };
45
+ /** Width of the likert scales in pixels. */
46
+ readonly scale_width: {
47
+ readonly type: ParameterType.INT;
48
+ readonly default: any;
49
+ };
50
+ /** Label of the button to submit responses. */
51
+ readonly button_label: {
52
+ readonly type: ParameterType.STRING;
53
+ readonly default: "Continue";
54
+ };
55
+ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */
56
+ readonly autocomplete: {
57
+ readonly type: ParameterType.BOOL;
58
+ readonly default: false;
59
+ };
60
+ };
61
+ readonly data: {
62
+ /** An object containing the response for each question. The object will have a separate key (variable) for each question, with the first question in the trial being recorded in `Q0`, the second in `Q1`, and so on. The responses are recorded as integers, representing the position selected on the likert scale for that question. If the `name` parameter is defined for the question, then the response object will use the value of `name` as the key for each question. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */
63
+ readonly response: {
64
+ readonly type: ParameterType.COMPLEX;
65
+ readonly nested: {
66
+ readonly identifier: {
67
+ readonly type: ParameterType.STRING;
68
+ };
69
+ readonly response: {
70
+ readonly type: number;
71
+ };
72
+ };
73
+ };
74
+ /** The response time in milliseconds for the participant to make a response. The time is measured from when the questions first appear on the screen until the participant's response(s) are submitted. */
75
+ readonly rt: {
76
+ readonly type: ParameterType.INT;
77
+ };
78
+ /** An array with the order of questions. For example `[2,0,1]` would indicate that the first question was `trial.questions[2]` (the third item in the `questions` parameter), the second question was `trial.questions[0]`, and the final question was `trial.questions[1]`. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */
79
+ readonly question_order: {
80
+ readonly type: ParameterType.INT;
81
+ readonly array: true;
82
+ };
83
+ };
84
+ };
85
+ type Info = typeof info;
86
+ /**
87
+ * The survey-likert plugin displays a set of questions with Likert scale responses. The participant responds
88
+ * by selecting a radio button.
89
+ *
90
+ * @author Josh de Leeuw
91
+ * @see {@link https://www.jspsych.org/latest/plugins/survey-likert/ survey-likert plugin documentation on jspsych.org}
92
+ */
93
+ declare class SurveyLikertPlugin implements JsPsychPlugin<Info> {
94
+ private jsPsych;
95
+ static info: {
96
+ readonly name: "survey-likert";
97
+ readonly version: string;
98
+ readonly parameters: {
99
+ /** Array containing one or more objects with parameters for the question(s) that should be shown on the page. */
100
+ readonly questions: {
101
+ readonly type: ParameterType.COMPLEX;
102
+ readonly array: true;
103
+ readonly nested: {
104
+ /** Question prompt. */
105
+ readonly prompt: {
106
+ readonly type: ParameterType.HTML_STRING;
107
+ readonly default: any;
108
+ };
109
+ /** Array of likert labels to display for this question. */
110
+ readonly labels: {
111
+ readonly type: ParameterType.STRING;
112
+ readonly array: true;
113
+ readonly default: any;
114
+ };
115
+ /** Whether or not a response to this question must be given in order to continue. */
116
+ readonly required: {
117
+ readonly type: ParameterType.BOOL;
118
+ readonly default: false;
119
+ };
120
+ /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */
121
+ readonly name: {
122
+ readonly type: ParameterType.STRING;
123
+ readonly default: "";
124
+ };
125
+ };
126
+ };
127
+ /** If true, the order of the questions in the 'questions' array will be randomized. */
128
+ readonly randomize_question_order: {
129
+ readonly type: ParameterType.BOOL;
130
+ readonly default: false;
131
+ };
132
+ /** HTML-formatted string to display at top of the page above all of the questions. */
133
+ readonly preamble: {
134
+ readonly type: ParameterType.HTML_STRING;
135
+ readonly default: any;
136
+ };
137
+ /** Width of the likert scales in pixels. */
138
+ readonly scale_width: {
139
+ readonly type: ParameterType.INT;
140
+ readonly default: any;
141
+ };
142
+ /** Label of the button to submit responses. */
143
+ readonly button_label: {
144
+ readonly type: ParameterType.STRING;
145
+ readonly default: "Continue";
146
+ };
147
+ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */
148
+ readonly autocomplete: {
149
+ readonly type: ParameterType.BOOL;
150
+ readonly default: false;
151
+ };
152
+ };
153
+ readonly data: {
154
+ /** An object containing the response for each question. The object will have a separate key (variable) for each question, with the first question in the trial being recorded in `Q0`, the second in `Q1`, and so on. The responses are recorded as integers, representing the position selected on the likert scale for that question. If the `name` parameter is defined for the question, then the response object will use the value of `name` as the key for each question. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */
155
+ readonly response: {
156
+ readonly type: ParameterType.COMPLEX;
157
+ readonly nested: {
158
+ readonly identifier: {
159
+ readonly type: ParameterType.STRING;
160
+ };
161
+ readonly response: {
162
+ readonly type: number;
163
+ };
164
+ };
165
+ };
166
+ /** The response time in milliseconds for the participant to make a response. The time is measured from when the questions first appear on the screen until the participant's response(s) are submitted. */
167
+ readonly rt: {
168
+ readonly type: ParameterType.INT;
169
+ };
170
+ /** An array with the order of questions. For example `[2,0,1]` would indicate that the first question was `trial.questions[2]` (the third item in the `questions` parameter), the second question was `trial.questions[0]`, and the final question was `trial.questions[1]`. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */
171
+ readonly question_order: {
172
+ readonly type: ParameterType.INT;
173
+ readonly array: true;
174
+ };
175
+ };
176
+ };
177
+ constructor(jsPsych: JsPsych);
178
+ trial(display_element: HTMLElement, trial: TrialType<Info>): void;
179
+ simulate(trial: TrialType<Info>, simulation_mode: any, simulation_options: any, load_callback: () => void): void;
180
+ private create_simulation_data;
181
+ private simulate_data_only;
182
+ private simulate_visual;
183
+ }
184
+
185
+ export { SurveyLikertPlugin as default };