@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/package.json CHANGED
@@ -1,18 +1,15 @@
1
1
  {
2
2
  "name": "@media-quest/builder",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Builder library for Media-quest schemas",
5
- "main": "dist/public-api.js",
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
- "build": "npm run clean && tsup src/public-api.ts --sourcemap inline --format cjs,esm --dts",
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.12"
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
- readonly kind: "main-video";
5
- readonly file: VideoFile;
6
- mode: "autoplay" | "required" | "optional";
7
- preDelay: number;
8
- volume: number;
9
- controls: boolean;
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?: BuilderOptionTheme;
40
+ // dontKnowButtonTheme: BuilderOptionTheme;
41
41
  buttonThemes?: Array<BuilderOptionTheme>;
42
42
  }
43
43
 
44
44
  export interface BuilderOptionTheme {
45
45
  name: string;
46
- div: CssTheme;
46
+ normal: ButtonTheme;
47
+ dontKnow: ButtonTheme;
48
+ }
49
+
50
+ interface ButtonTheme {
51
+ btn: CssTheme;
52
+ divider: PStyle;
47
53
  text1: PStyle;
48
- text2?: CssTheme;
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
- name: "blue-button-theme",
70
- div: {
71
- css: {
72
- backgroundColor: BLUE,
73
- borderColor: BLUE,
74
- textColor: WHITE,
75
- fontSize: { _unit: "px", value: FONT_SIZE },
76
- borderWidth: { _unit: "px", value: BTN_BORDER_WIDTH },
77
- borderStyle: BTN_BORDER_STYLE,
78
- borderRadius: { value: BTN_BORDER_RADIUS, _unit: "px" },
79
- padding: { _unit: "px", value: 40 },
80
- h: BTN_HEIGHT,
81
- w: BTN_WIDTH,
82
- x: 10,
83
- y: 8,
84
- textAlign: "center",
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
- cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
87
- cssEnabled: { opacity: 1, cursor: "pointer" },
88
- },
89
- text1: {
90
- y: 50,
91
- transform: "translate(0%, 50%)",
92
- textColor: WHITE,
93
- fontSize: { _unit: "px", value: FONT_SIZE },
94
- w: 84,
95
- x: 8,
96
- fontWeight: FONT_WEIGHT,
97
- textAlign: "center",
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, div.cssEnabled)],
414
- whenTrue: [...ThemeUtils.disableClickCommands(id, div.cssDisabled)],
414
+ whenFalse: [...ThemeUtils.enableClickCommands(id, btnStyles.btn.cssEnabled)],
415
+ whenTrue: [...ThemeUtils.disableClickCommands(id, btnStyles.btn.cssDisabled)],
415
416
  },
416
417
  ],
417
- style: { ...div.css, ...div.cssEnabled },
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
@@ -9,6 +9,7 @@
9
9
  "skipLibCheck": true,
10
10
  "forceConsistentCasingInFileNames": true,
11
11
  "rootDir": "./src",
12
+ "composite": true,
12
13
  "outDir": "./dist"
13
14
  },
14
15
  }
File without changes