@media-quest/builder 0.0.37 → 0.0.38

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.37",
3
+ "version": "0.0.38",
4
4
  "description": "Builder library for Media-quest schemas",
5
5
  "main": "dist/public-api.js",
6
6
  "types": "dist/public-api.d.js",
@@ -24,6 +24,6 @@
24
24
  "dts": true
25
25
  },
26
26
  "peerDependencies": {
27
- "@media-quest/engine": "0.0.37"
27
+ "@media-quest/engine": "0.0.38"
28
28
  }
29
29
  }
@@ -1,6 +1,6 @@
1
1
  import { SchemaID } from "./primitives/ID";
2
2
  import { SchemaPrefixValue } from "./primitives/schema-prefix";
3
- import { ImageFile } from "./media-files";
3
+ import { AudioFile, ImageFile } from "./media-files";
4
4
  import type { BuilderPageDto } from "./page/Builder-page";
5
5
  import { CodebookPredefinedVariable } from "./code-book/codebook-variable";
6
6
  import { SumScoreVariableDto } from "./sum-score/sum-score-variable";
@@ -34,20 +34,29 @@ const blockAutoplayVideo = (dto: BuilderPageDto): BuilderPageDto => {
34
34
  };
35
35
 
36
36
  const overrideVideoUrl = (dto: BuilderPageDto, baseUrl: string): BuilderPageDto => {
37
- if (dto.mainMedia && dto.mainMedia.kind === "main-video") {
38
- dto.mainMedia.file.downloadUrl = [baseUrl, dto.mainMedia.file.id].join("/");
37
+ const mainMedia = dto.mainMedia;
38
+ if (mainMedia && mainMedia.kind === "main-video") {
39
+ const url = [baseUrl, mainMedia.file.id].join("/");
40
+ const file = { ...mainMedia.file, downloadUrl: url };
41
+ dto.mainMedia = { ...mainMedia, file };
39
42
  }
40
43
  return dto;
41
44
  };
42
45
  const overrideImageUrl = (dto: BuilderPageDto, baseUrl: string): BuilderPageDto => {
43
- if (dto.mainMedia && dto.mainMedia.kind === "main-image") {
44
- dto.mainMedia.file.downloadUrl = [baseUrl, dto.mainMedia.file.id].join("/");
46
+ const mainMedia = dto.mainMedia;
47
+ if (mainMedia && mainMedia.kind === "main-image") {
48
+ const url = [baseUrl, mainMedia.file.id].join("/");
49
+ const file = { ...mainMedia.file, downloadUrl: url };
50
+ dto.mainMedia = { ...mainMedia, file };
45
51
  }
46
52
  return dto;
47
53
  };
48
54
  const overrideAudioUrl = (dto: BuilderPageDto, baseUrl: string): BuilderPageDto => {
49
- if (dto.mainText.audioFile) {
50
- dto.mainText.audioFile.downloadUrl = [baseUrl, dto.mainText.audioFile.id].join("/");
55
+ const newAudioFile = { ...dto };
56
+ const audioFile = newAudioFile.mainText.audioFile;
57
+ if (audioFile) {
58
+ const url = [baseUrl, audioFile.id].join("/");
59
+ dto.mainText.audioFile = { ...audioFile, downloadUrl: url };
51
60
  }
52
61
  return dto;
53
62
  };
@@ -279,6 +279,7 @@ export class BuilderSchema {
279
279
  });
280
280
 
281
281
  let moduleDto = builderSchema.toJson();
282
+ console.log(options.mediaAssets);
282
283
  if (options.mediaAssets) {
283
284
  const { videoFilesBaseUrl, audioFilesBaseUrl, imageFilesBaseUrl } = options.mediaAssets;
284
285
  moduleDto = BuilderSchemaDto.overrideAllMediaUrls(moduleDto, {
@@ -19,8 +19,6 @@ namespace BuilderOptionTheme {
19
19
  const BTN_BORDER_STYLE: DStyle["borderStyle"] = "solid";
20
20
  const FONT_WEIGHT: DStyle["fontWeight"] = 500;
21
21
  const FONT_SIZE: DCss.Px["value"] = 36;
22
- const MAIN_TEXT_FONT_SIZE: DCss.Px = { _unit: "px", value: 36 };
23
- const MAIN_TEXT_WIDTH: DCss.Percent = { _unit: "percent", value: 80 };
24
22
 
25
23
  const BTN_PADDING_LEFT = 10;
26
24
  const BTN_PADDING_TOP = 10;
@@ -91,20 +89,25 @@ namespace BuilderOptionTheme {
91
89
  };
92
90
  }
93
91
 
94
- const textHighTop = 25;
95
- const textLowTop = 55;
96
- const audioHighTop = 20;
97
- const audioLowTop = 55;
92
+ const MAIN_TEXT_FONT_SIZE: DCss.Px = { _unit: "px", value: 40 };
93
+ const MAIN_TEXT_WIDTH: DCss.Percent = { _unit: "percent", value: 76 };
94
+ const textHighTop = 30;
95
+ const textLowTop = 72;
96
+ const audioHighTop = 30;
97
+ const audioLowTop = 72;
98
98
 
99
99
  const textBase: PStyle = {
100
- width: 76,
100
+ width: MAIN_TEXT_WIDTH,
101
101
  // backgroundColor: "red",
102
102
  top: textHighTop,
103
- left: 12,
104
- textAlign: "center",
103
+ left: 14,
104
+ lineHeight: 1.2,
105
+ textAlign: "left",
105
106
  textColor: "black",
106
- fontSize: { _unit: "px", value: 40 },
107
+ transform: "translate(0, -50%)",
108
+ fontSize: MAIN_TEXT_FONT_SIZE,
107
109
  };
110
+
108
111
  const textHigh: PStyle = { ...textBase, top: textHighTop };
109
112
  const textLow: PStyle = { ...textHigh, top: textLowTop };
110
113
 
@@ -115,6 +118,7 @@ const audioBase: PStyle = {
115
118
  top: audioHighTop,
116
119
  cursor: "pointer",
117
120
  opacity: 0.8,
121
+ transform: "translate(0, -50%)",
118
122
  visibility: "visible",
119
123
  };
120
124
  const audioHigh: PStyle = { ...audioBase, top: audioHighTop };