@media-quest/builder 0.0.22 → 0.0.24

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.
Files changed (56) hide show
  1. package/package.json +1 -1
  2. package/src/Builder-option.ts +66 -66
  3. package/src/Builder-page.spec.ts +320 -320
  4. package/src/Builder-page.ts +257 -257
  5. package/src/Builder-question.spec.ts +68 -68
  6. package/src/Builder-question.ts +101 -101
  7. package/src/Builder-schema.spec.ts +51 -0
  8. package/src/Builder-schema.ts +47 -15
  9. package/src/Builder-text.spec.ts +24 -24
  10. package/src/Builder-text.ts +57 -57
  11. package/src/BuilderMainImageDto.ts +7 -7
  12. package/src/BuilderMainText.ts +81 -81
  13. package/src/BuilderMainVideoDto.ts +10 -10
  14. package/src/BuilderObject.ts +61 -61
  15. package/src/BuilderTag.ts +97 -97
  16. package/src/builder-compiler.ts +14 -0
  17. package/src/codebook.ts +72 -72
  18. package/src/media-files.ts +28 -28
  19. package/src/primitives/page-prefix.ts +58 -58
  20. package/src/primitives/prefix.spec.ts +5 -5
  21. package/src/primitives/schema-prefix.ts +52 -52
  22. package/src/primitives/varID.ts +11 -11
  23. package/src/public-api.ts +3 -1
  24. package/src/rulebuilder/Builder-rule.spec.ts +322 -322
  25. package/src/rulebuilder/Builder-rule.ts +190 -190
  26. package/src/rulebuilder/RuleAction.ts +106 -106
  27. package/src/rulebuilder/RuleBuilder-test-utils.ts +316 -316
  28. package/src/rulebuilder/RuleInput.ts +44 -44
  29. package/src/rulebuilder/RuleVariable.ts +49 -49
  30. package/src/rulebuilder/SingleSelectItem.ts +135 -135
  31. package/src/rulebuilder/condition/Builder-condition-group.spec.ts +47 -47
  32. package/src/rulebuilder/condition/Builder-condition-group.ts +118 -118
  33. package/src/rulebuilder/condition/Builder-condition.spec.ts +195 -195
  34. package/src/rulebuilder/condition/Builder-condition.ts +208 -208
  35. package/src/rulebuilder/condition/Builder-operator.spec.ts +9 -9
  36. package/src/rulebuilder/condition/Builder-operator.ts +31 -31
  37. package/src/rulebuilder/index.ts +22 -22
  38. package/src/rulebuilder/jump-to-action-manager.ts +33 -33
  39. package/src/rulebuilder/multi-select-item.ts +73 -73
  40. package/src/rulebuilder/page-action-manager.ts +31 -31
  41. package/src/rulebuilder/rule2/Rule2.ts +211 -211
  42. package/src/rulebuilder/tag-action-manager.spec.ts +44 -44
  43. package/src/rulebuilder/tag-action-manager.ts +28 -28
  44. package/src/schema-config.ts +25 -25
  45. package/src/theme/AbstractThemeCompiler.ts +7 -7
  46. package/src/theme/IDefaultTheme.ts +226 -226
  47. package/src/theme/css-theme.ts +7 -7
  48. package/src/theme/default-theme-compiler.ts +358 -358
  49. package/src/theme/icon-urls.ts +29 -29
  50. package/src/theme/theme-utils.ts +57 -57
  51. package/src/theme/theme1.spec.ts +52 -52
  52. package/src/variable/mq-variable.spec.ts +146 -0
  53. package/src/{mq-variable.ts → variable/mq-variable.ts} +8 -1
  54. package/src/variable/sum-score.ts +138 -0
  55. package/tsconfig.json +15 -15
  56. package/tsconfig.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@media-quest/builder",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "Builder library for Media-quest schemas",
5
5
  "main": "src/public-api.ts",
6
6
  "license": "MIT",
@@ -1,66 +1,66 @@
1
- import { BuilderObjectId, BuilderObject } from "./BuilderObject";
2
- import type { BuilderOptionTheme } from "./theme/IDefaultTheme";
3
- import { DefaultTheme } from "./theme/IDefaultTheme";
4
- import { AudioFile } from "./media-files";
5
-
6
- export interface BuilderOptionDto {
7
- readonly id: BuilderObjectId.QuestionOptionID;
8
- readonly value: number;
9
- readonly label: string;
10
- readonly labelAudio?: AudioFile;
11
- }
12
-
13
- export class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
14
- readonly objectType = "builder-question-option";
15
- theme: BuilderOptionTheme = DefaultTheme.responseButtons;
16
-
17
- id: BuilderObjectId.QuestionOptionID;
18
- value: number;
19
- label = "";
20
- private _labelAudioFile: AudioFile | false = false;
21
- get labelAudioFile() {
22
- return this._labelAudioFile;
23
- }
24
- set labelAudioFile(audioFile: AudioFile | false) {
25
- this._labelAudioFile = audioFile;
26
- }
27
-
28
- private constructor(dto: BuilderOptionDto) {
29
- super(dto);
30
- this.id = dto.id;
31
- this.value = dto.value;
32
- this.label = dto.label;
33
- // this.theme = dto.theme;
34
- }
35
- public static create(value: number, label: string) {
36
- const id = BuilderObjectId.questionOptionId();
37
- const dto: BuilderOptionDto = {
38
- id,
39
- value,
40
- label,
41
- };
42
- const instance = new BuilderOption(dto);
43
- return instance;
44
- }
45
-
46
- public static fromJson(dto: BuilderOptionDto) {
47
- const instance = new BuilderOption(dto);
48
- return instance;
49
- }
50
-
51
- toJson(): BuilderOptionDto {
52
- const dto: BuilderOptionDto = {
53
- id: this.id,
54
- value: this.value,
55
- label: this.label,
56
- };
57
- return dto;
58
- }
59
-
60
- clone(): BuilderOptionDto {
61
- const cloneId = BuilderObjectId.questionOptionId();
62
- const dto = this.toJson();
63
- const cloneDto: BuilderOptionDto = { ...dto, id: cloneId };
64
- return cloneDto;
65
- }
66
- }
1
+ import { BuilderObjectId, BuilderObject } from "./BuilderObject";
2
+ import type { BuilderOptionTheme } from "./theme/IDefaultTheme";
3
+ import { DefaultTheme } from "./theme/IDefaultTheme";
4
+ import { AudioFile } from "./media-files";
5
+
6
+ export interface BuilderOptionDto {
7
+ readonly id: BuilderObjectId.QuestionOptionID;
8
+ readonly value: number;
9
+ readonly label: string;
10
+ readonly labelAudio?: AudioFile;
11
+ }
12
+
13
+ export class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
14
+ readonly objectType = "builder-question-option";
15
+ theme: BuilderOptionTheme = DefaultTheme.responseButtons;
16
+
17
+ id: BuilderObjectId.QuestionOptionID;
18
+ value: number;
19
+ label = "";
20
+ private _labelAudioFile: AudioFile | false = false;
21
+ get labelAudioFile() {
22
+ return this._labelAudioFile;
23
+ }
24
+ set labelAudioFile(audioFile: AudioFile | false) {
25
+ this._labelAudioFile = audioFile;
26
+ }
27
+
28
+ private constructor(dto: BuilderOptionDto) {
29
+ super(dto);
30
+ this.id = dto.id;
31
+ this.value = dto.value;
32
+ this.label = dto.label;
33
+ // this.theme = dto.theme;
34
+ }
35
+ public static create(value: number, label: string) {
36
+ const id = BuilderObjectId.questionOptionId();
37
+ const dto: BuilderOptionDto = {
38
+ id,
39
+ value,
40
+ label,
41
+ };
42
+ const instance = new BuilderOption(dto);
43
+ return instance;
44
+ }
45
+
46
+ public static fromJson(dto: BuilderOptionDto) {
47
+ const instance = new BuilderOption(dto);
48
+ return instance;
49
+ }
50
+
51
+ toJson(): BuilderOptionDto {
52
+ const dto: BuilderOptionDto = {
53
+ id: this.id,
54
+ value: this.value,
55
+ label: this.label,
56
+ };
57
+ return dto;
58
+ }
59
+
60
+ clone(): BuilderOptionDto {
61
+ const cloneId = BuilderObjectId.questionOptionId();
62
+ const dto = this.toJson();
63
+ const cloneDto: BuilderOptionDto = { ...dto, id: cloneId };
64
+ return cloneDto;
65
+ }
66
+ }