@media-quest/builder 0.0.12 → 0.0.14
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.mts +7 -2
- package/dist/public-api.d.ts +7 -2
- package/dist/public-api.js +78 -37
- package/dist/public-api.mjs +78 -37
- package/package.json +4 -7
- package/src/BuilderMainVideoDto.ts +6 -6
- package/src/theme/IDefaultTheme.ts +82 -34
- package/src/theme/default-theme-compiler.ts +6 -5
- package/tsconfig.json +1 -0
- package/src/primitives/prefix.ts +0 -0
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@media-quest/builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Builder library for Media-quest schemas",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "dist/public-api.mjs",
|
|
7
|
-
"types": "dist/public-api.d.ts",
|
|
5
|
+
"main": "src/public-api.ts",
|
|
8
6
|
"license": "MIT",
|
|
9
7
|
"scripts": {
|
|
10
8
|
"tsc:check:builder": "tsc --watch --noEmit",
|
|
11
9
|
"clean": "rimraf dist",
|
|
12
|
-
"
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
10
|
+
"buildXXX": "npm run clean && tsup src/public-api.ts --sourcemap inline --format cjs,esm --dts"
|
|
14
11
|
},
|
|
15
12
|
"dependencies": {
|
|
16
|
-
"@media-quest/engine": "0.0.
|
|
13
|
+
"@media-quest/engine": "0.0.14"
|
|
17
14
|
}
|
|
18
15
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { VideoFile } from "./media-files";
|
|
2
2
|
|
|
3
3
|
export interface BuilderMainVideoDto {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
readonly kind: "main-video";
|
|
5
|
+
readonly file: VideoFile;
|
|
6
|
+
mode: "autoplay" | "required" | "optional" | "gif-mode";
|
|
7
|
+
preDelay: number;
|
|
8
|
+
volume: number;
|
|
9
|
+
controls: boolean;
|
|
10
10
|
}
|
|
@@ -37,15 +37,21 @@ export interface IDefaultTheme {
|
|
|
37
37
|
responseButtons: BuilderOptionTheme;
|
|
38
38
|
nextButtonTheme: BuilderOptionTheme;
|
|
39
39
|
// mainQuestionText: BuilderTextTheme;
|
|
40
|
-
dontKnowButtonTheme
|
|
40
|
+
// dontKnowButtonTheme: BuilderOptionTheme;
|
|
41
41
|
buttonThemes?: Array<BuilderOptionTheme>;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export interface BuilderOptionTheme {
|
|
45
45
|
name: string;
|
|
46
|
-
|
|
46
|
+
normal: ButtonTheme;
|
|
47
|
+
dontKnow: ButtonTheme;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ButtonTheme {
|
|
51
|
+
btn: CssTheme;
|
|
52
|
+
divider: PStyle;
|
|
47
53
|
text1: PStyle;
|
|
48
|
-
text2
|
|
54
|
+
text2: PStyle;
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
namespace BuilderOptionTheme {
|
|
@@ -65,38 +71,80 @@ namespace BuilderOptionTheme {
|
|
|
65
71
|
const FONT_WEIGHT: DStyle["fontWeight"] = 600;
|
|
66
72
|
const FONT_SIZE: DCss.Px["value"] = 35;
|
|
67
73
|
|
|
68
|
-
export const blueButton = (): BuilderOptionTheme =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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: {},
|
|
85
109
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
+
};
|
|
100
148
|
}
|
|
101
149
|
|
|
102
150
|
export const DefaultTheme: IDefaultTheme = {
|
|
@@ -375,7 +375,7 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
375
375
|
const factsCollected: Fact[] = [];
|
|
376
376
|
const { id, value, label } = buttonDto;
|
|
377
377
|
|
|
378
|
-
const { div, text1 } = DefaultTheme.responseButtons;
|
|
378
|
+
// const { div, text1, dontKnow } = DefaultTheme.responseButtons;
|
|
379
379
|
if (options.kind === "response-button") {
|
|
380
380
|
const fact: Fact = {
|
|
381
381
|
kind: "numeric-fact",
|
|
@@ -396,6 +396,7 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
396
396
|
factsCollected,
|
|
397
397
|
},
|
|
398
398
|
};
|
|
399
|
+
const btnStyles = value === 9 ? DefaultTheme.responseButtons.dontKnow : DefaultTheme.responseButtons.normal;
|
|
399
400
|
const btn: DDivDto = {
|
|
400
401
|
id,
|
|
401
402
|
_tag: "div",
|
|
@@ -404,17 +405,17 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
404
405
|
_tag: "p",
|
|
405
406
|
id: U.randomString(30),
|
|
406
407
|
text: label,
|
|
407
|
-
style: text1,
|
|
408
|
+
style: btnStyles.text1,
|
|
408
409
|
},
|
|
409
410
|
],
|
|
410
411
|
onStateChange: [
|
|
411
412
|
{
|
|
412
413
|
queryName: DStateProps._Queries.disableUserInputQuery.name,
|
|
413
|
-
whenFalse: [...ThemeUtils.enableClickCommands(id,
|
|
414
|
-
whenTrue: [...ThemeUtils.disableClickCommands(id,
|
|
414
|
+
whenFalse: [...ThemeUtils.enableClickCommands(id, btnStyles.btn.cssEnabled)],
|
|
415
|
+
whenTrue: [...ThemeUtils.disableClickCommands(id, btnStyles.btn.cssDisabled)],
|
|
415
416
|
},
|
|
416
417
|
],
|
|
417
|
-
style: { ...
|
|
418
|
+
style: { ...btnStyles.btn.css, ...btnStyles.btn.cssEnabled },
|
|
418
419
|
onClick: [onClickHandler],
|
|
419
420
|
};
|
|
420
421
|
if (options.kind === "next-button") {
|
package/tsconfig.json
CHANGED
package/src/primitives/prefix.ts
DELETED
|
File without changes
|