@media-quest/builder 0.0.5 → 0.0.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@media-quest/builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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.7"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -122,11 +122,11 @@ export const DefaultTheme: IDefaultTheme = {
|
|
|
122
122
|
text: {
|
|
123
123
|
css: {
|
|
124
124
|
w: 80,
|
|
125
|
-
y:
|
|
125
|
+
y: 65,
|
|
126
126
|
x: 10,
|
|
127
127
|
textAlign: "center",
|
|
128
128
|
textColor: "black",
|
|
129
|
-
fontSize: { _unit: "px", value:
|
|
129
|
+
fontSize: { _unit: "px", value: 40 },
|
|
130
130
|
},
|
|
131
131
|
cssDisabled: {},
|
|
132
132
|
cssEnabled: {},
|
|
@@ -56,6 +56,8 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
56
56
|
compile(source: BuilderSchemaDto): SchemaDto {
|
|
57
57
|
const pages = source.pages.map((p) => this.compilePage(p, source.prefix));
|
|
58
58
|
const rules = this.compileRules(source);
|
|
59
|
+
console.log(pages.map((p) => p.tags));
|
|
60
|
+
|
|
59
61
|
const dto: SchemaDto = {
|
|
60
62
|
backgroundColor: source.backgroundColor,
|
|
61
63
|
baseHeight: source.baseHeight,
|
|
@@ -119,6 +121,7 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
119
121
|
private compilePage(page: BuilderPageDto, modulePrefix: string): PageDto {
|
|
120
122
|
// console.log(_moduleId);
|
|
121
123
|
// const textElement
|
|
124
|
+
const tags = page.tags ?? [];
|
|
122
125
|
const { nextButton, mainText, id, mainMedia, _type } = page;
|
|
123
126
|
const elements: DElementDto[] = [];
|
|
124
127
|
const audioResourcesDto: DAudioDto[] = [];
|
|
@@ -145,11 +148,12 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
145
148
|
const nextBtnElement: DElementDto = this.compileButton(id, nextButton, {
|
|
146
149
|
kind: "next-button",
|
|
147
150
|
});
|
|
151
|
+
const textStyle = mainMedia ? DefaultTheme.mainText.withMedia.text.css : DefaultTheme.mainText.noMedia.text.css;
|
|
148
152
|
const element: DElementDto = {
|
|
149
153
|
text: infoText,
|
|
150
154
|
_tag: "p",
|
|
151
155
|
id: generateElementId(),
|
|
152
|
-
style:
|
|
156
|
+
style: textStyle,
|
|
153
157
|
};
|
|
154
158
|
elements.push(element);
|
|
155
159
|
elements.push(nextBtnElement);
|
|
@@ -158,6 +162,7 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
158
162
|
const mainImageElement = this.compileImage(mainMedia);
|
|
159
163
|
elements.push(mainImageElement);
|
|
160
164
|
}
|
|
165
|
+
|
|
161
166
|
if (mainMedia && mainMedia.kind === "main-video") {
|
|
162
167
|
const videoOutput = this.compileVideo(mainMedia);
|
|
163
168
|
mainVideo = videoOutput.videoDto;
|
|
@@ -200,7 +205,7 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
200
205
|
elements,
|
|
201
206
|
id,
|
|
202
207
|
mainVideoId,
|
|
203
|
-
tags: [],
|
|
208
|
+
tags: [...tags],
|
|
204
209
|
video: videoResources,
|
|
205
210
|
};
|
|
206
211
|
return pageDto;
|
|
@@ -340,7 +345,9 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
340
345
|
// console.log(page);
|
|
341
346
|
const q = page.defaultQuestion;
|
|
342
347
|
const text = page.mainText.text;
|
|
343
|
-
|
|
348
|
+
const questionStyle = page.mainMedia
|
|
349
|
+
? DefaultTheme.mainText.withMedia.text.css
|
|
350
|
+
: DefaultTheme.mainText.noMedia.text.css;
|
|
344
351
|
const question: DTextDto = {
|
|
345
352
|
_tag: "p",
|
|
346
353
|
text,
|
|
@@ -348,7 +355,7 @@ export class DefaultThemeCompiler extends AbstractThemeCompiler<IDefaultTheme> {
|
|
|
348
355
|
id: U.randomString(30),
|
|
349
356
|
onClick: [],
|
|
350
357
|
onStateChange: [],
|
|
351
|
-
style:
|
|
358
|
+
style: questionStyle,
|
|
352
359
|
};
|
|
353
360
|
const buttons = q.options.map((o) => {
|
|
354
361
|
const btns = this.compileButton(pageId, o, {
|