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