@media-quest/builder 0.0.39 → 0.0.40

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.
Files changed (41) hide show
  1. package/dist/public-api.d.ts +82 -99
  2. package/dist/public-api.js +36 -101
  3. package/dist/public-api.js.map +1 -1
  4. package/package.json +29 -29
  5. package/src/{theme → ARKIV}/button-bar/button-text-utils.ts +233 -233
  6. package/src/{theme → ARKIV}/button-bar/text-utils.spec.ts +105 -105
  7. package/src/Builder-option.ts +78 -62
  8. package/src/Builder-question.ts +98 -98
  9. package/src/Builder-schema.spec.ts +348 -348
  10. package/src/Builder-schema.ts +308 -306
  11. package/src/builder-compiler.ts +14 -20
  12. package/src/code-book/codebook-variable.ts +27 -27
  13. package/src/code-book/codebook.ts +89 -89
  14. package/src/media-files.ts +28 -32
  15. package/src/page/Builder-page-collection.spec.ts +219 -219
  16. package/src/page/Builder-page-collection.ts +129 -129
  17. package/src/page/Builder-page.spec.ts +177 -177
  18. package/src/page/Builder-page.ts +250 -250
  19. package/src/primitives/ID.ts +135 -135
  20. package/src/public-api.ts +29 -30
  21. package/src/rulebuilder/RuleAction.ts +105 -105
  22. package/src/schema-config.ts +25 -26
  23. package/src/sum-score/sum-score-variable-collection.spec.ts +68 -68
  24. package/src/sum-score/sum-score-variable-collection.ts +101 -101
  25. package/src/sum-score/sum-score-variable.ts +0 -1
  26. package/src/sum-score/sum-score.ts +166 -167
  27. package/src/tag/BuilderTag.ts +45 -45
  28. package/src/tag/Tag-Collection.ts +53 -53
  29. package/src/theme/Default-theme.ts +173 -188
  30. package/src/theme/IDefault-theme.ts +125 -125
  31. package/src/theme/ThemeCompiler.ts +10 -11
  32. package/src/theme/default-theme-compiler.spec.ts +31 -31
  33. package/src/theme/default-theme-compiler.ts +655 -652
  34. package/src/theme/icon-urls.ts +29 -29
  35. package/src/theme/icons.ts +117 -117
  36. package/src/theme/theme-utils.spec.ts +52 -52
  37. package/src/theme/theme-utils.ts +56 -56
  38. package/src/theme/theme2.ts +388 -386
  39. package/tsconfig.json +19 -19
  40. package/src/Builder-schema-dto.spec.ts +0 -155
  41. package/src/Builder-schema-dto.ts +0 -86
@@ -1,386 +1,388 @@
1
- // import { IconUrls } from "./icon-urls";
2
- import { BuilderOptionTheme, IDefaultTheme } from "./IDefault-theme";
3
- import { CssTheme } from "./css-theme";
4
- import { PStyle } from "@media-quest/engine";
5
- import { THEME_2_ICONS } from "./icons";
6
-
7
- const translate = (pos: { x?: number; y?: number }) => {
8
- const x = pos.x || 0;
9
- const y = pos.y || 0;
10
- return `translate(${x}%, ${y}%)`;
11
- };
12
- export const translateY50 = translate({ y: 50 });
13
- export const translateX50 = translate({ x: -50 });
14
- const translateX50Y50 = translate({ x: -50, y: 50 });
15
-
16
- const Colors = {
17
- primary: "#164AC4",
18
- secondary: "#E8F0FE",
19
- text: "#0D1E45",
20
- white: "#ffffff",
21
- backgroundGray: "#F0F0F0",
22
- backgroundWhite: "white",
23
- // progressBackGround: "#164AC4",
24
- // progressForGround: "#F5F5F5",
25
-
26
- // red: "red",
27
- // yellow: "yellow",
28
- };
29
-
30
- const MAIN_TEXT_FONT_SIZE = 35;
31
- const MAIN_TEXT_LINE_HEIGHT = 1.2;
32
- const fraction = 472.6 / 600;
33
-
34
- const LAYER_0 = 0;
35
- const LAYER_1 = 1;
36
- const LAYER_2 = 2;
37
- const LAYER_3 = 3;
38
- const LAYER_4 = 4;
39
- const LAYER_5 = 5;
40
- const W_M1 = 6;
41
- const W_M2 = 4.5;
42
- const W_M3 = 3;
43
-
44
- const W_M4 = 1.5;
45
-
46
- const H_M1 = 5;
47
- const H_M2 = 3.75;
48
- const H_M3 = 2.5;
49
-
50
- const H_M4 = 1.25;
51
-
52
- const W_MAX = 100 - W_M1 * 2;
53
-
54
- const PROGRESS_BAR_HEIGHT = 2;
55
-
56
- const AUDIO_ICON_WIDTH = 10;
57
- const AUDIO_ICON_HEIGHT = AUDIO_ICON_WIDTH * fraction;
58
- // const AUDIO_ICON_HEIGHT = AUDIO_ICON_WIDTH * fraction;
59
- const AUDIO_ICON_LEFT = W_M1 + W_M2 + W_M3;
60
-
61
- const Q_AREA_HEIGHT = 32;
62
- const Q_AREA_BOTTOM = 2 * H_M1 + H_M2;
63
- const Q_AREA_LEFT = W_M1 + W_M2;
64
- const Q_AREA_WIDTH = W_MAX - W_M2 - W_M2;
65
- const Q_AREA_TOP = 100 - Q_AREA_HEIGHT - Q_AREA_BOTTOM;
66
-
67
- const MEDIA_HEIGHT = 34;
68
- // const MEDIA_WIDTH = 100 - 2 * W_M1 - 2 * W_M2;
69
- const MEDIA_TOP = H_M1 + H_M2;
70
- const MEDIA_BOTTOM = MEDIA_TOP + MEDIA_HEIGHT;
71
-
72
- const MEDIA_LEFT = W_M1 + W_M2;
73
-
74
- const VIDEO_BUTTONS_WIDTH = 8;
75
- const VIDEO_BUTTONS_HEIGHT = VIDEO_BUTTONS_WIDTH * fraction;
76
- const VIDEO_CONTROLS_WIDTH = VIDEO_BUTTONS_WIDTH * 2 + 4 * W_M4;
77
- const VIDEO_CONTROLS_HEIGHT = VIDEO_BUTTONS_HEIGHT + 2 * H_M4 + 2;
78
- const VIDEO_CONTROLS_LEFT = 50 - VIDEO_CONTROLS_WIDTH / 2;
79
- const VIDEO_CONTROLS_RIGHT = 50 - VIDEO_CONTROLS_WIDTH / 2;
80
- const VIDEO_CONTROLS_TOP = MEDIA_BOTTOM - 1;
81
- const VIDEO_CONTROLS_BOTTOM = 100 - VIDEO_CONTROLS_HEIGHT - VIDEO_CONTROLS_TOP;
82
-
83
- const PAGE_BACKGROUND_BOTTOM = H_M1 + H_M1;
84
- const PAGE_BACKGROUND_HEIGHT = 100 - PAGE_BACKGROUND_BOTTOM - H_M1;
85
- const BUTTON_BAR_WIDTH = Q_AREA_WIDTH - 2 * W_M3;
86
- const MAIN_TEXT_WIDE = Q_AREA_WIDTH - 2 * W_M3;
87
- const MAIN_TEXT_NARROW = MAIN_TEXT_WIDE - AUDIO_ICON_WIDTH - W_M3;
88
-
89
- const btnTextBase: PStyle = {
90
- fontSize: { _unit: "px", value: 25 },
91
- bottom: VIDEO_CONTROLS_BOTTOM + 1.2,
92
- zIndex: LAYER_5,
93
- width: VIDEO_CONTROLS_WIDTH / 2,
94
- textAlign: "center",
95
- visibility: "hidden",
96
- margin: { _unit: "px", value: 0 },
97
- // backgroundColor: Colors.yellow,
98
- };
99
-
100
- const muteUnmuteText: PStyle = { ...btnTextBase, right: VIDEO_CONTROLS_RIGHT };
101
- const playPauseText: PStyle = { ...btnTextBase, left: VIDEO_CONTROLS_LEFT };
102
- const replayText: PStyle = {
103
- ...btnTextBase,
104
- width: VIDEO_CONTROLS_WIDTH,
105
- left: VIDEO_CONTROLS_LEFT,
106
- // backgroundColor: Colors.yellow,
107
- visibility: "hidden",
108
- };
109
-
110
- const playPauseBase: { css: PStyle; cssDisabled: PStyle; cssEnabled: PStyle } = {
111
- css: {
112
- width: VIDEO_BUTTONS_WIDTH,
113
- height: VIDEO_BUTTONS_HEIGHT,
114
- top: MEDIA_BOTTOM,
115
- left: VIDEO_CONTROLS_LEFT + W_M4,
116
- zIndex: LAYER_5,
117
- visibility: "hidden",
118
- },
119
- cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
120
- cssEnabled: { opacity: 0.8, cursor: "pointer" },
121
- };
122
-
123
- const replayButtonStyles: PStyle = {
124
- width: VIDEO_BUTTONS_WIDTH,
125
- height: VIDEO_BUTTONS_HEIGHT,
126
- top: MEDIA_BOTTOM,
127
- // backgroundColor: "red",
128
- left: VIDEO_CONTROLS_LEFT + VIDEO_CONTROLS_WIDTH / 2,
129
- transform: translateX50,
130
- zIndex: LAYER_5,
131
- visibility: "hidden",
132
- cursor: "pointer",
133
- };
134
-
135
- const muteUnMuteStyles: { css: PStyle; cssDisabled: PStyle; cssEnabled: PStyle } = {
136
- css: {
137
- width: VIDEO_BUTTONS_WIDTH,
138
- height: VIDEO_BUTTONS_HEIGHT,
139
- top: MEDIA_BOTTOM,
140
- right: VIDEO_CONTROLS_RIGHT + W_M4,
141
- zIndex: LAYER_5,
142
- cursor: "pointer",
143
- // transform: "translateX: 100%",
144
- },
145
- cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
146
- cssEnabled: { opacity: 0.8, cursor: "pointer" },
147
- };
148
-
149
- const FONT_QUESTION = 20;
150
- const FONT_ = 20;
151
- const responseButtonBaseCss = (): CssTheme => ({
152
- css: {
153
- backgroundColor: Colors.primary,
154
- borderColor: Colors.primary,
155
- textColor: Colors.white,
156
- fontWeight: 600,
157
- fontSize: { _unit: "px", value: 28 },
158
- lineHeight: 1.1,
159
- maxWidth: 25,
160
- // width: 20,
161
- // flex: "0 0 auto",
162
- paddingLeft: { _unit: "px", value: 10 },
163
- paddingTop: { _unit: "px", value: 5 },
164
- paddingBottom: { _unit: "px", value: 5 },
165
- paddingRight: { _unit: "px", value: 10 },
166
- borderRadius: { _unit: "px", value: 20 },
167
- borderStyle: "solid",
168
- boxShadow: "3px 3px gray",
169
- position: "relative",
170
- display: "block",
171
- cursor: "pointer",
172
- // maxWidth: { _unit: "percent", value: 10 },
173
- },
174
- cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
175
- cssEnabled: { opacity: 1, cursor: "pointer" },
176
- });
177
- export const primaryButton = (overridesCss: PStyle): BuilderOptionTheme => {
178
- const base = responseButtonBaseCss();
179
- const optionTheme: BuilderOptionTheme = {
180
- name: "primary-button",
181
- normal: {
182
- btn: {
183
- css: {
184
- ...base.css,
185
- ...overridesCss,
186
- backgroundColor: Colors.primary,
187
- borderColor: Colors.primary,
188
- textColor: Colors.white,
189
- },
190
- cssDisabled: base.cssDisabled,
191
- cssEnabled: base.cssEnabled,
192
- },
193
- divider: {},
194
- text1: {},
195
- text2: {},
196
- },
197
-
198
- dontKnow: {
199
- btn: {
200
- css: {
201
- ...base.css,
202
- ...overridesCss,
203
- backgroundColor: Colors.secondary,
204
- borderColor: Colors.secondary,
205
- textColor: Colors.primary,
206
- },
207
- cssEnabled: base.cssEnabled,
208
- cssDisabled: base.cssDisabled,
209
- },
210
- text1: {},
211
- text2: {},
212
- divider: {},
213
- },
214
- };
215
-
216
- return optionTheme;
217
- };
218
-
219
- export const Theme2: IDefaultTheme = {
220
- name: "theme2",
221
- schemaBackgroundColor: Colors.white,
222
- dimensions: { baseHeight: 1300, baseWidth: 1024 },
223
- pageBackGround: {
224
- style: {
225
- height: PAGE_BACKGROUND_HEIGHT,
226
- width: W_MAX,
227
- bottom: PAGE_BACKGROUND_BOTTOM,
228
- left: W_M1,
229
- backgroundColor: Colors.backgroundGray,
230
- },
231
- },
232
- backGroundArea1: {
233
- style: {
234
- height: Q_AREA_HEIGHT,
235
- width: Q_AREA_WIDTH,
236
- left: Q_AREA_LEFT,
237
- bottom: Q_AREA_BOTTOM,
238
- backgroundColor: Colors.white,
239
- },
240
- },
241
- progressBar: {
242
- width: W_MAX,
243
- height: PROGRESS_BAR_HEIGHT,
244
- bottom: H_M1,
245
- left: W_M1,
246
- backgroundStyles: {
247
- backgroundColor: Colors.backgroundGray,
248
- borderRadius: { _unit: "px", value: 10 },
249
- },
250
- progressStyles: {
251
- backgroundColor: Colors.primary,
252
- borderRadius: { _unit: "px", value: 10 },
253
- },
254
- text: {
255
- textType: "page-progress",
256
- style: { fontSize: { _unit: "px", value: 20 }, x: 81.5, y: 2.5 },
257
- },
258
- },
259
- videoPlayer: {
260
- playButton: {
261
- text: { text: "Spill av", css: { ...playPauseText } },
262
- iconUrl: THEME_2_ICONS.videoPlay.dataUrl,
263
- ...playPauseBase,
264
- },
265
- pauseButton: {
266
- text: { text: "Pause", css: { ...playPauseText } },
267
- iconUrl: THEME_2_ICONS.videoPause.dataUrl,
268
- ...playPauseBase,
269
- },
270
- buttonBar: {
271
- width: VIDEO_CONTROLS_WIDTH,
272
- zIndex: LAYER_4,
273
- top: VIDEO_CONTROLS_TOP,
274
- left: VIDEO_CONTROLS_LEFT,
275
- backgroundColor: Colors.white,
276
- height: VIDEO_CONTROLS_HEIGHT,
277
- borderRadius: { _unit: "px", value: 16 },
278
- },
279
- muteButton: {
280
- text: { text: "Lyd av", css: { ...muteUnmuteText } },
281
- iconUrl: THEME_2_ICONS.mute.dataUrl,
282
- css: muteUnMuteStyles.css,
283
- },
284
-
285
- unMuteButton: {
286
- iconUrl: THEME_2_ICONS.unMute.dataUrl,
287
- css: muteUnMuteStyles.css,
288
- text: { text: "Lyd på", css: { ...muteUnmuteText } },
289
- },
290
-
291
- replayButton: {
292
- css: replayButtonStyles,
293
- cssDisabled: {},
294
- cssEnabled: {},
295
- iconUrl: THEME_2_ICONS.videoReplay.dataUrl,
296
- text: { text: "Spill av på nytt", css: replayText },
297
- },
298
-
299
- videoElement: {
300
- css: {
301
- height: MEDIA_HEIGHT,
302
- top: MEDIA_TOP,
303
- transform: translateX50,
304
- left: 50,
305
- width: 100,
306
- zIndex: LAYER_2,
307
- visibility: "visible",
308
- },
309
- },
310
- },
311
- image: {
312
- style: {
313
- height: MEDIA_HEIGHT,
314
- // Center image, with dynamic width.
315
- left: 50,
316
- transform: translateX50,
317
- top: MEDIA_TOP,
318
- boxShadow: "3px 3px",
319
- },
320
- },
321
-
322
- mainText: {
323
- base: {
324
- text: {
325
- width: MAIN_TEXT_WIDE,
326
- left: W_M1 + W_M2 + W_M3,
327
- top: Q_AREA_TOP + H_M3,
328
- backgroundColor: Colors.white,
329
- textAlign: "left",
330
- textColor: "black",
331
- fontSize: { _unit: "px", value: 35 },
332
- lineHeight: 1.2,
333
- },
334
- audio: {
335
- iconUrl: THEME_2_ICONS.audioPlay.dataUrl,
336
- css: {
337
- height: AUDIO_ICON_HEIGHT,
338
- width: AUDIO_ICON_WIDTH,
339
- top: Q_AREA_TOP + H_M3,
340
- left: W_M1 + W_M2 + W_M3,
341
- cursor: "pointer",
342
- // transform: "translateY(100%)",
343
- opacity: 0.8,
344
- visibility: "visible",
345
- // backgroundColor: "green",
346
- },
347
- cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
348
- cssEnabled: { opacity: 0.8, cursor: "pointer" },
349
- },
350
- },
351
- notMediaHasAudio: {
352
- text: { width: MAIN_TEXT_NARROW, left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3 },
353
- audio: {},
354
- },
355
- hasMediaHasAudio: {
356
- text: {
357
- width: MAIN_TEXT_NARROW,
358
- left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3,
359
- },
360
- audio: {},
361
- },
362
- notMediaNotAudio: { text: {} },
363
- hasMediaNotAudio: { text: {} },
364
- },
365
- buttonBar: {
366
- vibrateMs: 60,
367
- container: {
368
- base: {
369
- display: "flex",
370
- justifyContent: "flex-start",
371
- width: BUTTON_BAR_WIDTH,
372
- height: 6,
373
- bottom: Q_AREA_BOTTOM + H_M3,
374
- left: Q_AREA_LEFT + W_M3,
375
- // backgroundColor: "green",
376
- gap: { _unit: "px", value: 40 },
377
- alignItems: "stretch",
378
- },
379
- whenSingle: { justifyContent: "center" },
380
- whenMany: { justifyContent: "flex-start" },
381
- },
382
-
383
- nextButtonTheme: primaryButton({}),
384
- responseButtons: primaryButton({}),
385
- },
386
- };
1
+ // import { IconUrls } from "./icon-urls";
2
+ import { BuilderOptionTheme, IDefaultTheme } from "./IDefault-theme";
3
+ import { CssTheme } from "./css-theme";
4
+ import { PStyle } from "@media-quest/engine";
5
+ import { THEME_2_ICONS } from "./icons";
6
+
7
+ const translate = (pos: { x?: number; y?: number }) => {
8
+ const x = pos.x || 0;
9
+ const y = pos.y || 0;
10
+ return `translate(${x}%, ${y}%)`;
11
+ };
12
+ export const translateY50 = translate({ y: 50 });
13
+ export const translateX50 = translate({ x: -50 });
14
+ const translateX50Y50 = translate({ x: -50, y: 50 });
15
+
16
+ const Colors = {
17
+ primary: "#164AC4",
18
+ secondary: "#E8F0FE",
19
+ text: "#0D1E45",
20
+ white: "#ffffff",
21
+ backgroundGray: "#F0F0F0",
22
+ backgroundWhite: "white",
23
+ // progressBackGround: "#164AC4",
24
+ // progressForGround: "#F5F5F5",
25
+ // red: "red",
26
+ // yellow: "yellow",
27
+ };
28
+
29
+ const MAIN_TEXT_FONT_SIZE = 35;
30
+ const MAIN_TEXT_LINE_HEIGHT = 1.2;
31
+ const fraction = 472.6 / 600;
32
+
33
+ const LAYER_0 = 0;
34
+ const LAYER_1 = 1;
35
+ const LAYER_2 = 2;
36
+ const LAYER_3 = 3;
37
+ const LAYER_4 = 4;
38
+ const LAYER_5 = 5;
39
+ const W_M1 = 6;
40
+ const W_M2 = 4.5;
41
+ const W_M3 = 3;
42
+
43
+ const W_M4 = 1.5;
44
+
45
+ const H_M1 = 5;
46
+ const H_M2 = 3.75;
47
+ const H_M3 = 2.5;
48
+
49
+ const H_M4 = 1.25;
50
+
51
+ const W_MAX = 100 - W_M1 * 2;
52
+
53
+ const PROGRESS_BAR_HEIGHT = 2;
54
+
55
+ const AUDIO_ICON_WIDTH = 10;
56
+ const AUDIO_ICON_HEIGHT = AUDIO_ICON_WIDTH * fraction;
57
+ // const AUDIO_ICON_HEIGHT = AUDIO_ICON_WIDTH * fraction;
58
+ const AUDIO_ICON_LEFT = W_M1 + W_M2 + W_M3;
59
+
60
+ const Q_AREA_HEIGHT = 32;
61
+ const Q_AREA_BOTTOM = 2 * H_M1 + H_M2;
62
+ const Q_AREA_LEFT = W_M1 + W_M2;
63
+ const Q_AREA_WIDTH = W_MAX - W_M2 - W_M2;
64
+ const Q_AREA_TOP = 100 - Q_AREA_HEIGHT - Q_AREA_BOTTOM;
65
+
66
+ const MEDIA_HEIGHT = 34;
67
+ // const MEDIA_WIDTH = 100 - 2 * W_M1 - 2 * W_M2;
68
+ const MEDIA_TOP = H_M1 + H_M2;
69
+ const MEDIA_BOTTOM = MEDIA_TOP + MEDIA_HEIGHT;
70
+
71
+ const MEDIA_LEFT = W_M1 + W_M2;
72
+
73
+ const VIDEO_BUTTONS_WIDTH = 8;
74
+ const VIDEO_BUTTONS_HEIGHT = VIDEO_BUTTONS_WIDTH * fraction;
75
+ const VIDEO_CONTROLS_WIDTH = VIDEO_BUTTONS_WIDTH * 2 + 4 * W_M4;
76
+ const VIDEO_CONTROLS_HEIGHT = VIDEO_BUTTONS_HEIGHT + 2 * H_M4 + 2;
77
+ const VIDEO_CONTROLS_LEFT = 50 - VIDEO_CONTROLS_WIDTH / 2;
78
+ const VIDEO_CONTROLS_RIGHT = 50 - VIDEO_CONTROLS_WIDTH / 2;
79
+ const VIDEO_CONTROLS_TOP = MEDIA_BOTTOM - 1;
80
+ const VIDEO_CONTROLS_BOTTOM = 100 - VIDEO_CONTROLS_HEIGHT - VIDEO_CONTROLS_TOP;
81
+
82
+ const PAGE_BACKGROUND_BOTTOM = H_M1 + H_M1;
83
+ const PAGE_BACKGROUND_HEIGHT = 100 - PAGE_BACKGROUND_BOTTOM - H_M1;
84
+ const BUTTON_BAR_WIDTH = Q_AREA_WIDTH - 2 * W_M3;
85
+ const MAIN_TEXT_WIDE = Q_AREA_WIDTH - 2 * W_M3;
86
+ const MAIN_TEXT_NARROW = MAIN_TEXT_WIDE - AUDIO_ICON_WIDTH - W_M3;
87
+
88
+ const btnTextBase: PStyle = {
89
+ fontSize: { _unit: "px", value: 25 },
90
+ bottom: VIDEO_CONTROLS_BOTTOM + 1.2,
91
+ zIndex: LAYER_5,
92
+ width: VIDEO_CONTROLS_WIDTH / 2,
93
+ textAlign: "center",
94
+ visibility: "hidden",
95
+ margin: { _unit: "px", value: 0 },
96
+ // backgroundColor: Colors.yellow,
97
+ };
98
+
99
+ const muteUnmuteText: PStyle = { ...btnTextBase, right: VIDEO_CONTROLS_RIGHT };
100
+ const playPauseText: PStyle = { ...btnTextBase, left: VIDEO_CONTROLS_LEFT };
101
+ const replayText: PStyle = {
102
+ ...btnTextBase,
103
+ width: VIDEO_CONTROLS_WIDTH,
104
+ left: VIDEO_CONTROLS_LEFT,
105
+ // backgroundColor: Colors.yellow,
106
+ visibility: "hidden",
107
+ };
108
+
109
+ const playPauseBase: { css: PStyle; cssDisabled: PStyle; cssEnabled: PStyle } = {
110
+ css: {
111
+ width: VIDEO_BUTTONS_WIDTH,
112
+ height: VIDEO_BUTTONS_HEIGHT,
113
+ top: MEDIA_BOTTOM,
114
+ left: VIDEO_CONTROLS_LEFT + W_M4,
115
+ zIndex: LAYER_5,
116
+ visibility: "hidden",
117
+ },
118
+ cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
119
+ cssEnabled: { opacity: 0.8, cursor: "pointer" },
120
+ };
121
+
122
+ const replayButtonStyles: PStyle = {
123
+ width: VIDEO_BUTTONS_WIDTH,
124
+ height: VIDEO_BUTTONS_HEIGHT,
125
+ top: MEDIA_BOTTOM,
126
+ // backgroundColor: "red",
127
+ left: VIDEO_CONTROLS_LEFT + VIDEO_CONTROLS_WIDTH / 2,
128
+ transform: translateX50,
129
+ zIndex: LAYER_5,
130
+ visibility: "hidden",
131
+ cursor: "pointer",
132
+ };
133
+
134
+ const muteUnMuteStyles: { css: PStyle; cssDisabled: PStyle; cssEnabled: PStyle } = {
135
+ css: {
136
+ width: VIDEO_BUTTONS_WIDTH,
137
+ height: VIDEO_BUTTONS_HEIGHT,
138
+ top: MEDIA_BOTTOM,
139
+ right: VIDEO_CONTROLS_RIGHT + W_M4,
140
+ zIndex: LAYER_5,
141
+ cursor: "pointer",
142
+ // transform: "translateX: 100%",
143
+ },
144
+ cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
145
+ cssEnabled: { opacity: 0.8, cursor: "pointer" },
146
+ };
147
+
148
+ const FONT_QUESTION = 20;
149
+ const FONT_ = 20;
150
+ const responseButtonBaseCss = (): CssTheme => ({
151
+ css: {
152
+ backgroundColor: Colors.primary,
153
+ borderColor: Colors.primary,
154
+ textColor: Colors.white,
155
+ fontWeight: 600,
156
+ fontSize: { _unit: "px", value: 28 },
157
+ lineHeight: 1.1,
158
+
159
+ // TODO Denne angir knappens max-bredde. Default bør være 25.
160
+ maxWidth: 25,
161
+ minWidth: 12,
162
+ // width: 20,
163
+ // flex: "0 0 auto",
164
+ paddingLeft: { _unit: "px", value: 10 },
165
+ paddingTop: { _unit: "px", value: 5 },
166
+ paddingBottom: { _unit: "px", value: 5 },
167
+ paddingRight: { _unit: "px", value: 10 },
168
+ borderRadius: { _unit: "px", value: 20 },
169
+ borderStyle: "solid",
170
+ boxShadow: "3px 3px gray",
171
+ position: "relative",
172
+ display: "block",
173
+ cursor: "pointer",
174
+ // maxWidth: { _unit: "percent", value: 10 },
175
+ },
176
+ cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
177
+ cssEnabled: { opacity: 1, cursor: "pointer" },
178
+ });
179
+ export const primaryButton = (overridesCss: PStyle): BuilderOptionTheme => {
180
+ const base = responseButtonBaseCss();
181
+ const optionTheme: BuilderOptionTheme = {
182
+ name: "primary-button",
183
+ normal: {
184
+ btn: {
185
+ css: {
186
+ ...base.css,
187
+ ...overridesCss,
188
+ backgroundColor: Colors.primary,
189
+ borderColor: Colors.primary,
190
+ textColor: Colors.white,
191
+ },
192
+ cssDisabled: base.cssDisabled,
193
+ cssEnabled: base.cssEnabled,
194
+ },
195
+ divider: {},
196
+ text1: {},
197
+ text2: {},
198
+ },
199
+
200
+ dontKnow: {
201
+ btn: {
202
+ css: {
203
+ ...base.css,
204
+ ...overridesCss,
205
+ backgroundColor: Colors.secondary,
206
+ borderColor: Colors.secondary,
207
+ textColor: Colors.primary,
208
+ },
209
+ cssEnabled: base.cssEnabled,
210
+ cssDisabled: base.cssDisabled,
211
+ },
212
+ text1: {},
213
+ text2: {},
214
+ divider: {},
215
+ },
216
+ };
217
+
218
+ return optionTheme;
219
+ };
220
+
221
+ export const Theme2: IDefaultTheme = {
222
+ name: "theme2",
223
+ schemaBackgroundColor: Colors.white,
224
+ dimensions: { baseHeight: 1300, baseWidth: 1024 },
225
+ pageBackGround: {
226
+ style: {
227
+ height: PAGE_BACKGROUND_HEIGHT,
228
+ width: W_MAX,
229
+ bottom: PAGE_BACKGROUND_BOTTOM,
230
+ left: W_M1,
231
+ backgroundColor: Colors.backgroundGray,
232
+ },
233
+ },
234
+ backGroundArea1: {
235
+ style: {
236
+ height: Q_AREA_HEIGHT,
237
+ width: Q_AREA_WIDTH,
238
+ left: Q_AREA_LEFT,
239
+ bottom: Q_AREA_BOTTOM,
240
+ backgroundColor: Colors.white,
241
+ },
242
+ },
243
+ progressBar: {
244
+ width: W_MAX,
245
+ height: PROGRESS_BAR_HEIGHT,
246
+ bottom: H_M1,
247
+ left: W_M1,
248
+ backgroundStyles: {
249
+ backgroundColor: Colors.backgroundGray,
250
+ borderRadius: { _unit: "px", value: 10 },
251
+ },
252
+ progressStyles: {
253
+ backgroundColor: Colors.primary,
254
+ borderRadius: { _unit: "px", value: 10 },
255
+ },
256
+ text: {
257
+ textType: "page-progress",
258
+ style: { fontSize: { _unit: "px", value: 20 }, x: 81.5, y: 2.5 },
259
+ },
260
+ },
261
+ videoPlayer: {
262
+ playButton: {
263
+ text: { text: "Spill av", css: { ...playPauseText } },
264
+ iconUrl: THEME_2_ICONS.videoPlay.dataUrl,
265
+ ...playPauseBase,
266
+ },
267
+ pauseButton: {
268
+ text: { text: "Pause", css: { ...playPauseText } },
269
+ iconUrl: THEME_2_ICONS.videoPause.dataUrl,
270
+ ...playPauseBase,
271
+ },
272
+ buttonBar: {
273
+ width: VIDEO_CONTROLS_WIDTH,
274
+ zIndex: LAYER_4,
275
+ top: VIDEO_CONTROLS_TOP,
276
+ left: VIDEO_CONTROLS_LEFT,
277
+ backgroundColor: Colors.white,
278
+ height: VIDEO_CONTROLS_HEIGHT,
279
+ borderRadius: { _unit: "px", value: 16 },
280
+ },
281
+ muteButton: {
282
+ text: { text: "Lyd av", css: { ...muteUnmuteText } },
283
+ iconUrl: THEME_2_ICONS.mute.dataUrl,
284
+ css: muteUnMuteStyles.css,
285
+ },
286
+
287
+ unMuteButton: {
288
+ iconUrl: THEME_2_ICONS.unMute.dataUrl,
289
+ css: muteUnMuteStyles.css,
290
+ text: { text: "Lyd på", css: { ...muteUnmuteText } },
291
+ },
292
+
293
+ replayButton: {
294
+ css: replayButtonStyles,
295
+ cssDisabled: {},
296
+ cssEnabled: {},
297
+ iconUrl: THEME_2_ICONS.videoReplay.dataUrl,
298
+ text: { text: "Spill av på nytt", css: replayText },
299
+ },
300
+
301
+ videoElement: {
302
+ css: {
303
+ height: MEDIA_HEIGHT,
304
+ top: MEDIA_TOP,
305
+ transform: translateX50,
306
+ left: 50,
307
+ width: 100,
308
+ zIndex: LAYER_2,
309
+ visibility: "visible",
310
+ },
311
+ },
312
+ },
313
+ image: {
314
+ style: {
315
+ height: MEDIA_HEIGHT,
316
+ // Center image, with dynamic width.
317
+ left: 50,
318
+ transform: translateX50,
319
+ top: MEDIA_TOP,
320
+ boxShadow: "3px 3px",
321
+ },
322
+ },
323
+
324
+ mainText: {
325
+ base: {
326
+ text: {
327
+ width: MAIN_TEXT_WIDE,
328
+ left: W_M1 + W_M2 + W_M3,
329
+ top: Q_AREA_TOP + H_M3,
330
+ backgroundColor: Colors.white,
331
+ textAlign: "left",
332
+ textColor: "black",
333
+ fontSize: { _unit: "px", value: 35 },
334
+ lineHeight: 1.2,
335
+ },
336
+ audio: {
337
+ iconUrl: THEME_2_ICONS.audioPlay.dataUrl,
338
+ css: {
339
+ height: AUDIO_ICON_HEIGHT,
340
+ width: AUDIO_ICON_WIDTH,
341
+ top: Q_AREA_TOP + H_M3,
342
+ left: W_M1 + W_M2 + W_M3,
343
+ cursor: "pointer",
344
+ // transform: "translateY(100%)",
345
+ opacity: 0.8,
346
+ visibility: "visible",
347
+ // backgroundColor: "green",
348
+ },
349
+ cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
350
+ cssEnabled: { opacity: 0.8, cursor: "pointer" },
351
+ },
352
+ },
353
+ notMediaHasAudio: {
354
+ text: { width: MAIN_TEXT_NARROW, left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3 },
355
+ audio: {},
356
+ },
357
+ hasMediaHasAudio: {
358
+ text: {
359
+ width: MAIN_TEXT_NARROW,
360
+ left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3,
361
+ },
362
+ audio: {},
363
+ },
364
+ notMediaNotAudio: { text: {} },
365
+ hasMediaNotAudio: { text: {} },
366
+ },
367
+ buttonBar: {
368
+ vibrateMs: 60,
369
+ container: {
370
+ base: {
371
+ display: "flex",
372
+ justifyContent: "flex-start",
373
+ width: BUTTON_BAR_WIDTH,
374
+ height: 6,
375
+ bottom: Q_AREA_BOTTOM + H_M3,
376
+ left: Q_AREA_LEFT + W_M3,
377
+ // backgroundColor: "green",
378
+ gap: { _unit: "px", value: 40 },
379
+ alignItems: "stretch",
380
+ },
381
+ whenSingle: { justifyContent: "center" },
382
+ whenMany: { justifyContent: "flex-start" },
383
+ },
384
+
385
+ nextButtonTheme: primaryButton({}),
386
+ responseButtons: primaryButton({}),
387
+ },
388
+ };