@media-quest/builder 0.0.11 → 0.0.13
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 +8 -4
- package/dist/public-api.d.ts +8 -4
- package/dist/public-api.js +82 -41
- package/dist/public-api.mjs +80 -39
- package/package.json +2 -2
- package/src/public-api.ts +2 -3
- package/src/theme/IDefaultTheme.ts +82 -34
- package/src/theme/default-theme-compiler.ts +7 -5
- package/src/primitives/prefix.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@media-quest/builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Builder library for Media-quest schemas",
|
|
5
5
|
"main": "dist/public-api.js",
|
|
6
6
|
"module": "dist/public-api.mjs",
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"prepublishOnly": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@media-quest/engine": "0.0.
|
|
16
|
+
"@media-quest/engine": "0.0.13"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/src/public-api.ts
CHANGED
|
@@ -10,7 +10,6 @@ export { type BuilderTagDto, BuilderTag, TagCollection } from "./BuilderTag";
|
|
|
10
10
|
export { type AudioFile, type ImageFile, type VideoFile } from "./media-files";
|
|
11
11
|
// Public Api of rule-builder
|
|
12
12
|
export * from "./rulebuilder";
|
|
13
|
-
export { PagePrefix } from "./primitives/page-prefix";
|
|
14
|
-
export {
|
|
15
|
-
export { PagePrefixValue } from "./primitives/page-prefix";
|
|
13
|
+
export { PagePrefix, PagePrefixValue } from "./primitives/page-prefix";
|
|
14
|
+
export { SchemaPrefix, SchemaPrefixValue } from "./primitives/schema-prefix";
|
|
16
15
|
export { VarID } from "./primitives/varID";
|
|
@@ -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,8 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
396
396
|
factsCollected,
|
|
397
397
|
},
|
|
398
398
|
};
|
|
399
|
+
const btnStyles = value === 9 ? DefaultTheme.responseButtons.dontKnow : DefaultTheme.responseButtons.normal;
|
|
400
|
+
console.log(btnStyles);
|
|
399
401
|
const btn: DDivDto = {
|
|
400
402
|
id,
|
|
401
403
|
_tag: "div",
|
|
@@ -404,17 +406,17 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
404
406
|
_tag: "p",
|
|
405
407
|
id: U.randomString(30),
|
|
406
408
|
text: label,
|
|
407
|
-
style: text1,
|
|
409
|
+
style: btnStyles.text1,
|
|
408
410
|
},
|
|
409
411
|
],
|
|
410
412
|
onStateChange: [
|
|
411
413
|
{
|
|
412
414
|
queryName: DStateProps._Queries.disableUserInputQuery.name,
|
|
413
|
-
whenFalse: [...ThemeUtils.enableClickCommands(id,
|
|
414
|
-
whenTrue: [...ThemeUtils.disableClickCommands(id,
|
|
415
|
+
whenFalse: [...ThemeUtils.enableClickCommands(id, btnStyles.btn.cssEnabled)],
|
|
416
|
+
whenTrue: [...ThemeUtils.disableClickCommands(id, btnStyles.btn.cssDisabled)],
|
|
415
417
|
},
|
|
416
418
|
],
|
|
417
|
-
style: { ...
|
|
419
|
+
style: { ...btnStyles.btn.css, ...btnStyles.btn.cssEnabled },
|
|
418
420
|
onClick: [onClickHandler],
|
|
419
421
|
};
|
|
420
422
|
if (options.kind === "next-button") {
|
package/src/primitives/prefix.ts
DELETED
|
File without changes
|