@media-quest/builder 0.0.39 → 0.0.41
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.ts +82 -100
- package/dist/public-api.js +68 -128
- package/dist/public-api.js.map +1 -1
- package/package.json +29 -29
- package/src/{theme → ARKIV}/button-bar/button-text-utils.ts +233 -233
- package/src/{theme → ARKIV}/button-bar/text-utils.spec.ts +105 -105
- package/src/Builder-option.ts +77 -62
- package/src/Builder-question.spec.ts +1 -0
- package/src/Builder-question.ts +97 -98
- package/src/Builder-schema.spec.ts +348 -348
- package/src/Builder-schema.ts +308 -306
- package/src/builder-compiler.ts +14 -20
- package/src/code-book/codebook-variable.ts +27 -27
- package/src/code-book/codebook.ts +89 -89
- package/src/media-files.ts +28 -32
- package/src/page/Builder-page-collection.spec.ts +224 -219
- package/src/page/Builder-page-collection.ts +129 -129
- package/src/page/Builder-page.spec.ts +177 -177
- package/src/page/Builder-page.ts +250 -250
- package/src/primitives/ID.ts +135 -135
- package/src/public-api.ts +29 -30
- package/src/rulebuilder/RuleAction.ts +105 -105
- package/src/schema-config.ts +25 -26
- package/src/sum-score/sum-score-variable-collection.spec.ts +68 -68
- package/src/sum-score/sum-score-variable-collection.ts +101 -101
- package/src/sum-score/sum-score-variable.ts +0 -1
- package/src/sum-score/sum-score.ts +166 -167
- package/src/tag/BuilderTag.ts +45 -45
- package/src/tag/Tag-Collection.ts +53 -53
- package/src/theme/Default-theme.ts +173 -188
- package/src/theme/IDefault-theme.ts +124 -125
- package/src/theme/ThemeCompiler.ts +10 -11
- package/src/theme/default-theme-compiler.spec.ts +31 -31
- package/src/theme/default-theme-compiler.ts +660 -652
- package/src/theme/icon-urls.ts +29 -29
- package/src/theme/icons.ts +117 -117
- package/src/theme/theme-utils.spec.ts +52 -52
- package/src/theme/theme-utils.ts +56 -56
- package/src/theme/theme2.ts +399 -386
- package/tsconfig.json +19 -19
- package/src/Builder-schema-dto.spec.ts +0 -155
- package/src/Builder-schema-dto.ts +0 -86
package/dist/public-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Condition, PageQueRules, SchemaDto, DStyle } from '@media-quest/engine';
|
|
1
|
+
import { PStyle, Condition, PageQueRules, SchemaDto, DStyle } from '@media-quest/engine';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Builder objects are complex objects that are embedded inside
|
|
@@ -17,33 +17,29 @@ declare abstract class BuilderObject<T extends BuilderObjectType, Dto extends {}
|
|
|
17
17
|
interface AudioFile {
|
|
18
18
|
readonly kind: "audio-file";
|
|
19
19
|
readonly id: string;
|
|
20
|
-
downloadUrl: string;
|
|
20
|
+
readonly downloadUrl: string;
|
|
21
21
|
readonly duration: number;
|
|
22
22
|
readonly originalFileName: string;
|
|
23
23
|
readonly name: string;
|
|
24
24
|
readonly size: number;
|
|
25
|
-
readonly relativePath?: string;
|
|
26
25
|
}
|
|
27
26
|
interface VideoFile {
|
|
28
27
|
readonly kind: "video-file";
|
|
29
28
|
readonly id: string;
|
|
30
|
-
downloadUrl: string;
|
|
29
|
+
readonly downloadUrl: string;
|
|
31
30
|
readonly duration: number;
|
|
32
31
|
readonly name: string;
|
|
33
32
|
readonly size: number;
|
|
34
33
|
readonly type: string;
|
|
35
34
|
readonly originalFileName: string;
|
|
36
|
-
readonly relativePath?: string;
|
|
37
35
|
}
|
|
38
36
|
interface ImageFile {
|
|
39
37
|
readonly kind: "image-file";
|
|
40
38
|
readonly id: string;
|
|
41
|
-
downloadUrl: string;
|
|
39
|
+
readonly downloadUrl: string;
|
|
42
40
|
readonly name: string;
|
|
43
41
|
readonly size: number;
|
|
44
42
|
readonly type: string;
|
|
45
|
-
readonly originalFileName?: string;
|
|
46
|
-
readonly relativePath?: string;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
type ID<B extends string> = string & {
|
|
@@ -93,17 +89,19 @@ interface BuilderOptionDto {
|
|
|
93
89
|
readonly value: number;
|
|
94
90
|
readonly label: string;
|
|
95
91
|
readonly labelAudio?: AudioFile;
|
|
92
|
+
readonly cssOverride?: PStyle;
|
|
96
93
|
}
|
|
97
94
|
declare class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
|
|
98
95
|
readonly objectType = "builder-question-option";
|
|
99
96
|
id: OptionID;
|
|
100
97
|
value: number;
|
|
101
98
|
label: string;
|
|
99
|
+
cssOverride: PStyle;
|
|
102
100
|
private _labelAudioFile;
|
|
103
101
|
get labelAudioFile(): AudioFile | false;
|
|
104
102
|
set labelAudioFile(audioFile: AudioFile | false);
|
|
105
103
|
private constructor();
|
|
106
|
-
static create(value: number, label: string): BuilderOption;
|
|
104
|
+
static create(value: number, label: string, css?: PStyle): BuilderOption;
|
|
107
105
|
static fromJson(dto: BuilderOptionDto): BuilderOption;
|
|
108
106
|
toJson(): BuilderOptionDto;
|
|
109
107
|
clone(): BuilderOptionDto;
|
|
@@ -599,89 +597,6 @@ declare class BuilderTag extends BuilderObject<"builder-tag", BuilderTagDto> {
|
|
|
599
597
|
toJson(): BuilderTagDto;
|
|
600
598
|
}
|
|
601
599
|
|
|
602
|
-
interface SumScoreVariableDto {
|
|
603
|
-
id: SumScoreVariableID;
|
|
604
|
-
name: string;
|
|
605
|
-
description: string;
|
|
606
|
-
useAvg: boolean;
|
|
607
|
-
}
|
|
608
|
-
declare class SumScoreVariable extends BuilderObject<"builder-sum-score-variable", SumScoreVariableDto> {
|
|
609
|
-
readonly objectType = "builder-sum-score-variable";
|
|
610
|
-
readonly id: SumScoreVariableID;
|
|
611
|
-
private _useAvg;
|
|
612
|
-
private _name;
|
|
613
|
-
private _description;
|
|
614
|
-
private _error;
|
|
615
|
-
private _usedIn;
|
|
616
|
-
get usedIn(): BuilderPage[];
|
|
617
|
-
static readonly create: (data: {
|
|
618
|
-
name: string;
|
|
619
|
-
description: string;
|
|
620
|
-
useAvg: boolean;
|
|
621
|
-
}) => SumScoreVariable;
|
|
622
|
-
get hasErrors(): boolean;
|
|
623
|
-
static fromDto: (dto: SumScoreVariableDto) => SumScoreVariable;
|
|
624
|
-
private constructor();
|
|
625
|
-
toJson(): SumScoreVariableDto;
|
|
626
|
-
clone(): SumScoreVariableDto;
|
|
627
|
-
get name(): string;
|
|
628
|
-
get description(): string;
|
|
629
|
-
get useAvg(): boolean;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Interface representing a code book question sum-score.
|
|
634
|
-
*
|
|
635
|
-
* @interface
|
|
636
|
-
*/
|
|
637
|
-
interface CodeBookQuestionVariable {
|
|
638
|
-
readonly kind: "codebook-question-variable";
|
|
639
|
-
readonly label: string;
|
|
640
|
-
readonly varId: string;
|
|
641
|
-
readonly pageId: PageID;
|
|
642
|
-
readonly pagePrefix: string;
|
|
643
|
-
readonly modulePrefix: string;
|
|
644
|
-
readonly pagePosition: number;
|
|
645
|
-
readonly options: ReadonlyArray<{
|
|
646
|
-
label: string;
|
|
647
|
-
value: number;
|
|
648
|
-
}>;
|
|
649
|
-
readonly includedInSumScores: ReadonlyArray<SumScoreVariableDto>;
|
|
650
|
-
}
|
|
651
|
-
interface CodebookPredefinedVariable {
|
|
652
|
-
readonly kind: "codebook-predefined-variable";
|
|
653
|
-
readonly modulePrefix: string;
|
|
654
|
-
readonly moduleID: string;
|
|
655
|
-
defaultValue: number;
|
|
656
|
-
options: Array<{
|
|
657
|
-
label: string;
|
|
658
|
-
value: number;
|
|
659
|
-
}>;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
interface BuilderSchemaDto {
|
|
663
|
-
readonly id: SchemaID;
|
|
664
|
-
readonly prefix: SchemaPrefixValue;
|
|
665
|
-
readonly mainImage: ImageFile | false;
|
|
666
|
-
readonly backgroundColor: string;
|
|
667
|
-
readonly name: string;
|
|
668
|
-
readonly pages: ReadonlyArray<BuilderPageDto>;
|
|
669
|
-
readonly baseHeight: number;
|
|
670
|
-
readonly baseWidth: number;
|
|
671
|
-
readonly predefinedVariables?: Array<CodebookPredefinedVariable>;
|
|
672
|
-
readonly sumScoreVariables?: ReadonlyArray<SumScoreVariableDto>;
|
|
673
|
-
readonly rules: ReadonlyArray<BuilderRuleDto>;
|
|
674
|
-
readonly tags: ReadonlyArray<BuilderTagDto>;
|
|
675
|
-
}
|
|
676
|
-
declare const BuilderSchemaDto: {
|
|
677
|
-
blockAutoplayVideo: (dto: BuilderPageDto) => BuilderPageDto;
|
|
678
|
-
overrideAllMediaUrls: (schema: BuilderSchemaDto, options: {
|
|
679
|
-
videoFilesBaseUrl: string;
|
|
680
|
-
audioFilesBaseUrl: string;
|
|
681
|
-
imageFilesBaseUrl: string;
|
|
682
|
-
}) => BuilderSchemaDto;
|
|
683
|
-
};
|
|
684
|
-
|
|
685
600
|
interface ThemeCompiler<ThemeSchema> {
|
|
686
601
|
currentTheme: ThemeSchema;
|
|
687
602
|
allThemes: ThemeSchema[];
|
|
@@ -695,7 +610,6 @@ interface CssTheme<S extends Partial<DStyle> = Partial<DStyle>> {
|
|
|
695
610
|
cssDisabled: Partial<DStyle>;
|
|
696
611
|
}
|
|
697
612
|
|
|
698
|
-
type PStyle = Partial<DStyle>;
|
|
699
613
|
interface IDefaultTheme {
|
|
700
614
|
name: string;
|
|
701
615
|
schemaBackgroundColor: string;
|
|
@@ -855,6 +769,66 @@ declare class DefaultThemeCompiler implements ThemeCompiler<IDefaultTheme> {
|
|
|
855
769
|
private compileButton;
|
|
856
770
|
}
|
|
857
771
|
|
|
772
|
+
interface SumScoreVariableDto {
|
|
773
|
+
id: SumScoreVariableID;
|
|
774
|
+
name: string;
|
|
775
|
+
description: string;
|
|
776
|
+
useAvg: boolean;
|
|
777
|
+
}
|
|
778
|
+
declare class SumScoreVariable extends BuilderObject<"builder-sum-score-variable", SumScoreVariableDto> {
|
|
779
|
+
readonly objectType = "builder-sum-score-variable";
|
|
780
|
+
readonly id: SumScoreVariableID;
|
|
781
|
+
private _useAvg;
|
|
782
|
+
private _name;
|
|
783
|
+
private _description;
|
|
784
|
+
private _error;
|
|
785
|
+
private _usedIn;
|
|
786
|
+
get usedIn(): BuilderPage[];
|
|
787
|
+
static readonly create: (data: {
|
|
788
|
+
name: string;
|
|
789
|
+
description: string;
|
|
790
|
+
useAvg: boolean;
|
|
791
|
+
}) => SumScoreVariable;
|
|
792
|
+
get hasErrors(): boolean;
|
|
793
|
+
static fromDto: (dto: SumScoreVariableDto) => SumScoreVariable;
|
|
794
|
+
private constructor();
|
|
795
|
+
toJson(): SumScoreVariableDto;
|
|
796
|
+
clone(): SumScoreVariableDto;
|
|
797
|
+
get name(): string;
|
|
798
|
+
get description(): string;
|
|
799
|
+
get useAvg(): boolean;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Interface representing a code book question sum-score.
|
|
804
|
+
*
|
|
805
|
+
* @interface
|
|
806
|
+
*/
|
|
807
|
+
interface CodeBookQuestionVariable {
|
|
808
|
+
readonly kind: "codebook-question-variable";
|
|
809
|
+
readonly label: string;
|
|
810
|
+
readonly varId: string;
|
|
811
|
+
readonly pageId: PageID;
|
|
812
|
+
readonly pagePrefix: string;
|
|
813
|
+
readonly modulePrefix: string;
|
|
814
|
+
readonly pagePosition: number;
|
|
815
|
+
readonly options: ReadonlyArray<{
|
|
816
|
+
label: string;
|
|
817
|
+
value: number;
|
|
818
|
+
}>;
|
|
819
|
+
readonly includedInSumScores: ReadonlyArray<SumScoreVariableDto>;
|
|
820
|
+
}
|
|
821
|
+
interface CodebookPredefinedVariable {
|
|
822
|
+
readonly kind: "codebook-predefined-variable";
|
|
823
|
+
readonly modulePrefix: string;
|
|
824
|
+
readonly moduleID: string;
|
|
825
|
+
defaultValue: number;
|
|
826
|
+
options: Array<{
|
|
827
|
+
label: string;
|
|
828
|
+
value: number;
|
|
829
|
+
}>;
|
|
830
|
+
}
|
|
831
|
+
|
|
858
832
|
interface Codebook {
|
|
859
833
|
readonly predefinedVariables: ReadonlyArray<CodebookPredefinedVariable>;
|
|
860
834
|
readonly pageVariables: ReadonlyArray<CodeBookQuestionVariable>;
|
|
@@ -888,14 +862,22 @@ interface CompilerOutput {
|
|
|
888
862
|
interface CompilerOption {
|
|
889
863
|
blockAutoplayQuestion: boolean;
|
|
890
864
|
blockAutoplayVideo: boolean;
|
|
891
|
-
mediaAssets: {
|
|
892
|
-
audioFilesBaseUrl: string;
|
|
893
|
-
videoFilesBaseUrl: string;
|
|
894
|
-
imageFilesBaseUrl: string;
|
|
895
|
-
fileNameStrategy: "id" | "newFileName" | "originalFileName" | "relativePath";
|
|
896
|
-
} | null;
|
|
897
865
|
}
|
|
898
866
|
|
|
867
|
+
interface BuilderSchemaDto {
|
|
868
|
+
readonly id: SchemaID;
|
|
869
|
+
readonly prefix: SchemaPrefixValue;
|
|
870
|
+
readonly mainImage: ImageFile | false;
|
|
871
|
+
readonly backgroundColor: string;
|
|
872
|
+
readonly name: string;
|
|
873
|
+
readonly pages: ReadonlyArray<BuilderPageDto>;
|
|
874
|
+
readonly baseHeight: number;
|
|
875
|
+
readonly baseWidth: number;
|
|
876
|
+
readonly predefinedVariables?: Array<CodebookPredefinedVariable>;
|
|
877
|
+
readonly sumScoreVariables?: ReadonlyArray<SumScoreVariableDto>;
|
|
878
|
+
readonly rules: ReadonlyArray<BuilderRuleDto>;
|
|
879
|
+
readonly tags: ReadonlyArray<BuilderTagDto>;
|
|
880
|
+
}
|
|
899
881
|
declare class BuilderSchema {
|
|
900
882
|
readonly id: SchemaID;
|
|
901
883
|
name: string;
|
|
@@ -1015,4 +997,4 @@ declare class TagCollection implements Iterable<BuilderTag> {
|
|
|
1015
997
|
|
|
1016
998
|
declare const DefaultTheme: IDefaultTheme;
|
|
1017
999
|
|
|
1018
|
-
export { type AudioFile, BuilderCondition, type BuilderConditionDto, BuilderConditionGroup, type BuilderConditionGroupDto, type BuilderMainImageDto, BuilderMainText, type BuilderMainTextDto, type BuilderMainVideoDto, BuilderOperator, BuilderOption, type BuilderOptionDto, BuilderPage, type BuilderPageDto, type BuilderPageType, BuilderQuestion, type BuilderQuestionDto, type BuilderQuestionType, BuilderRule, type BuilderRuleDto, BuilderSchema, BuilderSchemaDto, BuilderTag, type BuilderTagDto, BuilderText, type BuilderTextDto, CodeBook, type CodeBookQuestionVariable, type Codebook, type CodebookPredefinedVariable, type CompilerOption, type CompilerOutput, ConditionGroupType, DefaultTheme, type ExcludeByPageAction, ExcludeByPageIdSelectItem, type ExcludeByTagAction, ExcludeByTagSelectItem, type ID, type ImageFile, JumpToActionManager, type JumpToPageAction, JumpToPageSelectItem, MultiSelectItem, OperatorSelectItem, OptionID, PageActionManager, PageID, PagePrefix, type PagePrefixValue, QuestionID, RuleCustomVariable, RuleInput, RuleOptionSelectItem, RuleQuestionVariable, type RuleVariable, RuleVariableOption, RuleVariableSelectItem, SchemaConfig, SchemaID, SchemaPrefix, type SchemaPrefixValue, SingleSelectItem, SumScore, type SumScoreAnswer, SumScoreVariable, type SumScoreVariableDto, SumScoreVariableID, TagActionManager, TagCollection, TagID, TextID, VarID, type VideoFile, _CodeBook, createTypedIdSingleton };
|
|
1000
|
+
export { type AudioFile, BuilderCondition, type BuilderConditionDto, BuilderConditionGroup, type BuilderConditionGroupDto, type BuilderMainImageDto, BuilderMainText, type BuilderMainTextDto, type BuilderMainVideoDto, BuilderOperator, BuilderOption, type BuilderOptionDto, BuilderPage, type BuilderPageDto, type BuilderPageType, BuilderQuestion, type BuilderQuestionDto, type BuilderQuestionType, BuilderRule, type BuilderRuleDto, BuilderSchema, type BuilderSchemaDto, BuilderTag, type BuilderTagDto, BuilderText, type BuilderTextDto, CodeBook, type CodeBookQuestionVariable, type Codebook, type CodebookPredefinedVariable, type CompilerOption, type CompilerOutput, ConditionGroupType, DefaultTheme, type ExcludeByPageAction, ExcludeByPageIdSelectItem, type ExcludeByTagAction, ExcludeByTagSelectItem, type ID, type ImageFile, JumpToActionManager, type JumpToPageAction, JumpToPageSelectItem, MultiSelectItem, OperatorSelectItem, OptionID, PageActionManager, PageID, PagePrefix, type PagePrefixValue, QuestionID, RuleCustomVariable, RuleInput, RuleOptionSelectItem, RuleQuestionVariable, type RuleVariable, RuleVariableOption, RuleVariableSelectItem, SchemaConfig, SchemaID, SchemaPrefix, type SchemaPrefixValue, SingleSelectItem, SumScore, type SumScoreAnswer, SumScoreVariable, type SumScoreVariableDto, SumScoreVariableID, TagActionManager, TagCollection, TagID, TextID, VarID, type VideoFile, _CodeBook, createTypedIdSingleton };
|
package/dist/public-api.js
CHANGED
|
@@ -29,7 +29,6 @@ __export(public_api_exports, {
|
|
|
29
29
|
BuilderQuestion: () => BuilderQuestion,
|
|
30
30
|
BuilderRule: () => BuilderRule,
|
|
31
31
|
BuilderSchema: () => BuilderSchema,
|
|
32
|
-
BuilderSchemaDto: () => BuilderSchemaDto,
|
|
33
32
|
BuilderTag: () => BuilderTag,
|
|
34
33
|
BuilderText: () => BuilderText,
|
|
35
34
|
CodeBook: () => CodeBook,
|
|
@@ -150,6 +149,7 @@ var BuilderOption = class _BuilderOption extends BuilderObject {
|
|
|
150
149
|
id;
|
|
151
150
|
value;
|
|
152
151
|
label = "";
|
|
152
|
+
cssOverride = {};
|
|
153
153
|
_labelAudioFile = false;
|
|
154
154
|
get labelAudioFile() {
|
|
155
155
|
return this._labelAudioFile;
|
|
@@ -162,26 +162,30 @@ var BuilderOption = class _BuilderOption extends BuilderObject {
|
|
|
162
162
|
this.id = dto.id;
|
|
163
163
|
this.value = dto.value;
|
|
164
164
|
this.label = dto.label;
|
|
165
|
+
if (dto.cssOverride) {
|
|
166
|
+
this.cssOverride = { ...dto.cssOverride };
|
|
167
|
+
}
|
|
165
168
|
}
|
|
166
|
-
static create(value, label) {
|
|
169
|
+
static create(value, label, css = {}) {
|
|
167
170
|
const id = OptionID.create();
|
|
168
171
|
const dto = {
|
|
169
172
|
id,
|
|
170
173
|
value,
|
|
171
|
-
label
|
|
174
|
+
label,
|
|
175
|
+
cssOverride: css
|
|
172
176
|
};
|
|
173
177
|
const instance = new _BuilderOption(dto);
|
|
174
178
|
return instance;
|
|
175
179
|
}
|
|
176
180
|
static fromJson(dto) {
|
|
177
|
-
|
|
178
|
-
return instance;
|
|
181
|
+
return new _BuilderOption(dto);
|
|
179
182
|
}
|
|
180
183
|
toJson() {
|
|
181
184
|
const dto = {
|
|
182
185
|
id: this.id,
|
|
183
186
|
value: this.value,
|
|
184
|
-
label: this.label
|
|
187
|
+
label: this.label,
|
|
188
|
+
cssOverride: { ...this.cssOverride }
|
|
185
189
|
};
|
|
186
190
|
return dto;
|
|
187
191
|
}
|
|
@@ -211,8 +215,7 @@ var BuilderQuestion = class _BuilderQuestion extends BuilderObject {
|
|
|
211
215
|
});
|
|
212
216
|
};
|
|
213
217
|
static fromJson(dto) {
|
|
214
|
-
|
|
215
|
-
return question;
|
|
218
|
+
return new _BuilderQuestion(dto);
|
|
216
219
|
}
|
|
217
220
|
constructor(dto) {
|
|
218
221
|
super(dto);
|
|
@@ -223,7 +226,7 @@ var BuilderQuestion = class _BuilderQuestion extends BuilderObject {
|
|
|
223
226
|
this.options = dto.options.map((o) => BuilderOption.fromJson(o));
|
|
224
227
|
}
|
|
225
228
|
addOption(label, value, atIndex = -1) {
|
|
226
|
-
const option = BuilderOption.create(value, label);
|
|
229
|
+
const option = BuilderOption.create(value, label, {});
|
|
227
230
|
if (atIndex >= 0 && atIndex < this.options.length) {
|
|
228
231
|
this.options.splice(atIndex, 0, option);
|
|
229
232
|
} else {
|
|
@@ -1419,14 +1422,11 @@ var BuilderOptionTheme;
|
|
|
1419
1422
|
const BLUE = "#2F5597";
|
|
1420
1423
|
const BTN_BORDER_WIDTH = 3;
|
|
1421
1424
|
const BTN_BORDER_RADIUS = 10;
|
|
1422
|
-
const BTN_HEIGHT = 130;
|
|
1423
|
-
const BTN_WIDTH_LONG = { _unit: "percent", value: 19 };
|
|
1424
|
-
const BTN_WIDTH_SHORT = { _unit: "percent", value: 15 };
|
|
1425
1425
|
const BTN_BORDER_STYLE = "solid";
|
|
1426
|
-
const FONT_WEIGHT =
|
|
1427
|
-
const FONT_SIZE =
|
|
1428
|
-
const BTN_PADDING_LEFT =
|
|
1429
|
-
const BTN_PADDING_TOP =
|
|
1426
|
+
const FONT_WEIGHT = 600;
|
|
1427
|
+
const FONT_SIZE = 50;
|
|
1428
|
+
const BTN_PADDING_LEFT = 40;
|
|
1429
|
+
const BTN_PADDING_TOP = 40;
|
|
1430
1430
|
const buttonBaseCss = () => ({
|
|
1431
1431
|
css: {
|
|
1432
1432
|
fontWeight: FONT_WEIGHT,
|
|
@@ -1438,8 +1438,6 @@ var BuilderOptionTheme;
|
|
|
1438
1438
|
paddingRight: { _unit: "px", value: BTN_PADDING_LEFT },
|
|
1439
1439
|
borderRadius: { _unit: "px", value: BTN_BORDER_RADIUS },
|
|
1440
1440
|
borderWidth: { _unit: "px", value: BTN_BORDER_WIDTH },
|
|
1441
|
-
width: BTN_WIDTH_LONG,
|
|
1442
|
-
height: { _unit: "px", value: BTN_HEIGHT },
|
|
1443
1441
|
borderStyle: BTN_BORDER_STYLE,
|
|
1444
1442
|
// boxShadow: "3px 3px gray",
|
|
1445
1443
|
position: "relative",
|
|
@@ -1474,8 +1472,7 @@ var BuilderOptionTheme;
|
|
|
1474
1472
|
...css,
|
|
1475
1473
|
backgroundColor: WHITE,
|
|
1476
1474
|
borderColor: LIGHT_BLUE,
|
|
1477
|
-
textColor: BLUE
|
|
1478
|
-
width: BTN_WIDTH_SHORT
|
|
1475
|
+
textColor: BLUE
|
|
1479
1476
|
},
|
|
1480
1477
|
cssDisabled,
|
|
1481
1478
|
cssEnabled
|
|
@@ -1488,22 +1485,17 @@ var BuilderOptionTheme;
|
|
|
1488
1485
|
return optionTheme;
|
|
1489
1486
|
};
|
|
1490
1487
|
})(BuilderOptionTheme || (BuilderOptionTheme = {}));
|
|
1491
|
-
var
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
1495
|
-
var audioHighTop = 30;
|
|
1496
|
-
var audioLowTop = 72;
|
|
1488
|
+
var textHighTop = 25;
|
|
1489
|
+
var textLowTop = 55;
|
|
1490
|
+
var audioHighTop = 20;
|
|
1491
|
+
var audioLowTop = 55;
|
|
1497
1492
|
var textBase = {
|
|
1498
|
-
width:
|
|
1499
|
-
// backgroundColor: "red",
|
|
1493
|
+
width: 80,
|
|
1500
1494
|
top: textHighTop,
|
|
1501
|
-
left:
|
|
1502
|
-
|
|
1503
|
-
textAlign: "left",
|
|
1495
|
+
left: 10,
|
|
1496
|
+
textAlign: "center",
|
|
1504
1497
|
textColor: "black",
|
|
1505
|
-
|
|
1506
|
-
fontSize: MAIN_TEXT_FONT_SIZE
|
|
1498
|
+
fontSize: { _unit: "px", value: 40 }
|
|
1507
1499
|
};
|
|
1508
1500
|
var textHigh = { ...textBase, top: textHighTop };
|
|
1509
1501
|
var textLow = { ...textHigh, top: textLowTop };
|
|
@@ -1514,7 +1506,6 @@ var audioBase = {
|
|
|
1514
1506
|
top: audioHighTop,
|
|
1515
1507
|
cursor: "pointer",
|
|
1516
1508
|
opacity: 0.8,
|
|
1517
|
-
transform: "translate(0, -50%)",
|
|
1518
1509
|
visibility: "visible"
|
|
1519
1510
|
};
|
|
1520
1511
|
var audioHigh = { ...audioBase, top: audioHighTop };
|
|
@@ -1571,8 +1562,8 @@ var DefaultTheme = {
|
|
|
1571
1562
|
bottom: 0,
|
|
1572
1563
|
left: 0,
|
|
1573
1564
|
// h: 10,
|
|
1574
|
-
alignItems: "center"
|
|
1575
|
-
|
|
1565
|
+
alignItems: "center",
|
|
1566
|
+
backgroundColor: "yellow"
|
|
1576
1567
|
},
|
|
1577
1568
|
whenSingle: { justifyContent: "space-evenly" },
|
|
1578
1569
|
whenMany: { justifyContent: "space-evenly" }
|
|
@@ -1671,6 +1662,9 @@ var THEME_2_ICONS = {
|
|
|
1671
1662
|
};
|
|
1672
1663
|
|
|
1673
1664
|
// src/theme/theme2.ts
|
|
1665
|
+
var deepClone = (obj) => {
|
|
1666
|
+
return JSON.parse(JSON.stringify(obj));
|
|
1667
|
+
};
|
|
1674
1668
|
var translate = (pos) => {
|
|
1675
1669
|
const x = pos.x || 0;
|
|
1676
1670
|
const y = pos.y || 0;
|
|
@@ -1730,20 +1724,21 @@ var PAGE_BACKGROUND_HEIGHT = 100 - PAGE_BACKGROUND_BOTTOM - H_M1;
|
|
|
1730
1724
|
var BUTTON_BAR_WIDTH = Q_AREA_WIDTH - 2 * W_M3;
|
|
1731
1725
|
var MAIN_TEXT_WIDE = Q_AREA_WIDTH - 2 * W_M3;
|
|
1732
1726
|
var MAIN_TEXT_NARROW = MAIN_TEXT_WIDE - AUDIO_ICON_WIDTH - W_M3;
|
|
1733
|
-
var
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1727
|
+
var btnTextBaseObj = () => {
|
|
1728
|
+
return {
|
|
1729
|
+
fontSize: { _unit: "px", value: 25 },
|
|
1730
|
+
bottom: VIDEO_CONTROLS_BOTTOM + 1.2,
|
|
1731
|
+
zIndex: LAYER_5,
|
|
1732
|
+
width: VIDEO_CONTROLS_WIDTH / 2,
|
|
1733
|
+
textAlign: "center",
|
|
1734
|
+
visibility: "hidden",
|
|
1735
|
+
margin: { _unit: "px", value: 0 }
|
|
1736
|
+
};
|
|
1742
1737
|
};
|
|
1743
|
-
var muteUnmuteText = { ...
|
|
1744
|
-
var playPauseText = { ...
|
|
1738
|
+
var muteUnmuteText = { ...btnTextBaseObj(), right: VIDEO_CONTROLS_RIGHT };
|
|
1739
|
+
var playPauseText = { ...btnTextBaseObj(), left: VIDEO_CONTROLS_LEFT };
|
|
1745
1740
|
var replayText = {
|
|
1746
|
-
...
|
|
1741
|
+
...btnTextBaseObj(),
|
|
1747
1742
|
width: VIDEO_CONTROLS_WIDTH,
|
|
1748
1743
|
left: VIDEO_CONTROLS_LEFT,
|
|
1749
1744
|
// backgroundColor: Colors.yellow,
|
|
@@ -1793,7 +1788,10 @@ var responseButtonBaseCss = () => ({
|
|
|
1793
1788
|
fontWeight: 600,
|
|
1794
1789
|
fontSize: { _unit: "px", value: 28 },
|
|
1795
1790
|
lineHeight: 1.1,
|
|
1796
|
-
|
|
1791
|
+
// TODO Skal knappene vokse, med mindre det settes en maksbredde?
|
|
1792
|
+
// maxWidth: 25,
|
|
1793
|
+
// maxWidth: { _unit: "percent", value: 10 },
|
|
1794
|
+
minWidth: 12,
|
|
1797
1795
|
// width: 20,
|
|
1798
1796
|
// flex: "0 0 auto",
|
|
1799
1797
|
paddingLeft: { _unit: "px", value: 10 },
|
|
@@ -1806,7 +1804,6 @@ var responseButtonBaseCss = () => ({
|
|
|
1806
1804
|
position: "relative",
|
|
1807
1805
|
display: "block",
|
|
1808
1806
|
cursor: "pointer"
|
|
1809
|
-
// maxWidth: { _unit: "percent", value: 10 },
|
|
1810
1807
|
},
|
|
1811
1808
|
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1812
1809
|
cssEnabled: { opacity: 1, cursor: "pointer" }
|
|
@@ -1818,8 +1815,8 @@ var primaryButton = (overridesCss) => {
|
|
|
1818
1815
|
normal: {
|
|
1819
1816
|
btn: {
|
|
1820
1817
|
css: {
|
|
1821
|
-
...base.css,
|
|
1822
|
-
...overridesCss,
|
|
1818
|
+
...deepClone(base.css),
|
|
1819
|
+
...deepClone(overridesCss),
|
|
1823
1820
|
backgroundColor: Colors.primary,
|
|
1824
1821
|
borderColor: Colors.primary,
|
|
1825
1822
|
textColor: Colors.white
|
|
@@ -1834,8 +1831,8 @@ var primaryButton = (overridesCss) => {
|
|
|
1834
1831
|
dontKnow: {
|
|
1835
1832
|
btn: {
|
|
1836
1833
|
css: {
|
|
1837
|
-
...base.css,
|
|
1838
|
-
...overridesCss,
|
|
1834
|
+
...deepClone(base.css),
|
|
1835
|
+
...deepClone(overridesCss),
|
|
1839
1836
|
backgroundColor: Colors.secondary,
|
|
1840
1837
|
borderColor: Colors.secondary,
|
|
1841
1838
|
textColor: Colors.primary
|
|
@@ -2003,23 +2000,24 @@ var Theme2 = {
|
|
|
2003
2000
|
bottom: Q_AREA_BOTTOM + H_M3,
|
|
2004
2001
|
left: Q_AREA_LEFT + W_M3,
|
|
2005
2002
|
// backgroundColor: "green",
|
|
2006
|
-
gap: { _unit: "px", value:
|
|
2003
|
+
gap: { _unit: "px", value: 32 },
|
|
2007
2004
|
alignItems: "stretch"
|
|
2008
2005
|
},
|
|
2009
2006
|
whenSingle: { justifyContent: "center" },
|
|
2010
2007
|
whenMany: { justifyContent: "flex-start" }
|
|
2011
2008
|
},
|
|
2012
|
-
nextButtonTheme: primaryButton({}),
|
|
2013
|
-
responseButtons: primaryButton({})
|
|
2009
|
+
nextButtonTheme: primaryButton({ fontSize: { _unit: "px", value: 28 }, maxWidth: { _unit: "percent", value: 25 } }),
|
|
2010
|
+
responseButtons: primaryButton({ fontSize: { _unit: "px", value: 28 }, maxWidth: { _unit: "percent", value: 25 } })
|
|
2014
2011
|
}
|
|
2015
2012
|
};
|
|
2013
|
+
console.log(Theme2);
|
|
2016
2014
|
|
|
2017
2015
|
// src/theme/default-theme-compiler.ts
|
|
2018
2016
|
var DefaultThemeCompiler = class {
|
|
2019
2017
|
name = "Ispe default theme.";
|
|
2020
2018
|
defaultTheme = DefaultTheme;
|
|
2021
2019
|
theme2 = Theme2;
|
|
2022
|
-
currentTheme =
|
|
2020
|
+
currentTheme = Theme2;
|
|
2023
2021
|
allThemes = [DefaultTheme, Theme2];
|
|
2024
2022
|
TAG = "[ DEFAULT_THEME_COMPILER ]: ";
|
|
2025
2023
|
setTheme(theme) {
|
|
@@ -2091,7 +2089,6 @@ var DefaultThemeCompiler = class {
|
|
|
2091
2089
|
let initialVideoTaskList = [];
|
|
2092
2090
|
const newPage = {
|
|
2093
2091
|
background: "white",
|
|
2094
|
-
pageNumber,
|
|
2095
2092
|
elements,
|
|
2096
2093
|
id,
|
|
2097
2094
|
prefix,
|
|
@@ -2505,7 +2502,7 @@ var DefaultThemeCompiler = class {
|
|
|
2505
2502
|
return buttonBar;
|
|
2506
2503
|
}
|
|
2507
2504
|
compileButton(buttonDto, options) {
|
|
2508
|
-
const { id, value, label } = buttonDto;
|
|
2505
|
+
const { id, value, label, cssOverride } = buttonDto;
|
|
2509
2506
|
const t = this.currentTheme;
|
|
2510
2507
|
const onclickAction = options.kind === "response-button" ? {
|
|
2511
2508
|
kind: "submit-fact",
|
|
@@ -2517,14 +2514,19 @@ var DefaultThemeCompiler = class {
|
|
|
2517
2514
|
referenceLabel: options.questionText
|
|
2518
2515
|
}
|
|
2519
2516
|
} : { kind: "next-page" };
|
|
2520
|
-
const
|
|
2517
|
+
const _btnStyles = value === 9 ? t.buttonBar.responseButtons.dontKnow : t.buttonBar.responseButtons.normal;
|
|
2518
|
+
let css = import_engine2.DStyle.clone(_btnStyles.btn.css);
|
|
2519
|
+
const cssEnabled = import_engine2.DStyle.clone(_btnStyles.btn.cssEnabled);
|
|
2521
2520
|
if (t.buttonBar.vibrateMs) {
|
|
2522
|
-
|
|
2521
|
+
}
|
|
2522
|
+
if (cssOverride) {
|
|
2523
|
+
console.log(cssOverride);
|
|
2524
|
+
css = { ...css, ...cssOverride };
|
|
2523
2525
|
}
|
|
2524
2526
|
const btn = {
|
|
2525
2527
|
_tag: "button",
|
|
2526
2528
|
innerText: label,
|
|
2527
|
-
style: { ...
|
|
2529
|
+
style: { ...css, ...cssEnabled },
|
|
2528
2530
|
onClick: onclickAction
|
|
2529
2531
|
};
|
|
2530
2532
|
return btn;
|
|
@@ -2953,54 +2955,6 @@ var BuilderPageCollection = class _BuilderPageCollection {
|
|
|
2953
2955
|
}
|
|
2954
2956
|
};
|
|
2955
2957
|
|
|
2956
|
-
// src/Builder-schema-dto.ts
|
|
2957
|
-
var blockAutoplayVideo = (dto) => {
|
|
2958
|
-
if (dto.mainMedia && dto.mainMedia.kind === "main-video") {
|
|
2959
|
-
dto.mainMedia.mode = "optional";
|
|
2960
|
-
}
|
|
2961
|
-
return dto;
|
|
2962
|
-
};
|
|
2963
|
-
var overrideVideoUrl = (dto, baseUrl) => {
|
|
2964
|
-
const mainMedia = dto.mainMedia;
|
|
2965
|
-
if (mainMedia && mainMedia.kind === "main-video") {
|
|
2966
|
-
const url = [baseUrl, mainMedia.file.id].join("/");
|
|
2967
|
-
const file = { ...mainMedia.file, downloadUrl: url };
|
|
2968
|
-
dto.mainMedia = { ...mainMedia, file };
|
|
2969
|
-
}
|
|
2970
|
-
return dto;
|
|
2971
|
-
};
|
|
2972
|
-
var overrideImageUrl = (dto, baseUrl) => {
|
|
2973
|
-
const mainMedia = dto.mainMedia;
|
|
2974
|
-
if (mainMedia && mainMedia.kind === "main-image") {
|
|
2975
|
-
const url = [baseUrl, mainMedia.file.id].join("/");
|
|
2976
|
-
const file = { ...mainMedia.file, downloadUrl: url };
|
|
2977
|
-
dto.mainMedia = { ...mainMedia, file };
|
|
2978
|
-
}
|
|
2979
|
-
return dto;
|
|
2980
|
-
};
|
|
2981
|
-
var overrideAudioUrl = (dto, baseUrl) => {
|
|
2982
|
-
const newAudioFile = { ...dto };
|
|
2983
|
-
const audioFile = newAudioFile.mainText.audioFile;
|
|
2984
|
-
if (audioFile) {
|
|
2985
|
-
const url = [baseUrl, audioFile.id].join("/");
|
|
2986
|
-
dto.mainText.audioFile = { ...audioFile, downloadUrl: url };
|
|
2987
|
-
}
|
|
2988
|
-
return dto;
|
|
2989
|
-
};
|
|
2990
|
-
var overrideAllMediaUrls = (schema, options) => {
|
|
2991
|
-
const pages = schema.pages.map((page) => {
|
|
2992
|
-
page = overrideVideoUrl(page, options.videoFilesBaseUrl);
|
|
2993
|
-
page = overrideImageUrl(page, options.imageFilesBaseUrl);
|
|
2994
|
-
page = overrideAudioUrl(page, options.audioFilesBaseUrl);
|
|
2995
|
-
return page;
|
|
2996
|
-
});
|
|
2997
|
-
return { ...schema, pages };
|
|
2998
|
-
};
|
|
2999
|
-
var BuilderSchemaDto = {
|
|
3000
|
-
blockAutoplayVideo,
|
|
3001
|
-
overrideAllMediaUrls
|
|
3002
|
-
};
|
|
3003
|
-
|
|
3004
2958
|
// src/Builder-schema.ts
|
|
3005
2959
|
var BuilderSchema = class _BuilderSchema {
|
|
3006
2960
|
constructor(id, name, prefix) {
|
|
@@ -3194,12 +3148,8 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
3194
3148
|
addTag(builderTag) {
|
|
3195
3149
|
this._tagCollection.add(builderTag);
|
|
3196
3150
|
}
|
|
3197
|
-
compile(options = {
|
|
3198
|
-
|
|
3199
|
-
blockAutoplayVideo: false,
|
|
3200
|
-
mediaAssets: null
|
|
3201
|
-
}) {
|
|
3202
|
-
let builderSchema = _BuilderSchema.fromJson(this.toJson());
|
|
3151
|
+
compile(options = { blockAutoplayQuestion: false, blockAutoplayVideo: false }) {
|
|
3152
|
+
const builderSchema = _BuilderSchema.fromJson(this.toJson());
|
|
3203
3153
|
builderSchema._pageCollection.pages.forEach((p) => {
|
|
3204
3154
|
if (options.blockAutoplayQuestion) {
|
|
3205
3155
|
p.mainText.autoplay = false;
|
|
@@ -3210,16 +3160,7 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
3210
3160
|
}
|
|
3211
3161
|
}
|
|
3212
3162
|
});
|
|
3213
|
-
|
|
3214
|
-
console.log(options.mediaAssets);
|
|
3215
|
-
if (options.mediaAssets) {
|
|
3216
|
-
const { videoFilesBaseUrl, audioFilesBaseUrl, imageFilesBaseUrl } = options.mediaAssets;
|
|
3217
|
-
moduleDto = BuilderSchemaDto.overrideAllMediaUrls(moduleDto, {
|
|
3218
|
-
videoFilesBaseUrl,
|
|
3219
|
-
audioFilesBaseUrl,
|
|
3220
|
-
imageFilesBaseUrl
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3163
|
+
const moduleDto = builderSchema.toJson();
|
|
3223
3164
|
const codebook = CodeBook.fromSchema(moduleDto);
|
|
3224
3165
|
const schema = this.compiler.compile(moduleDto);
|
|
3225
3166
|
const schemaConfig = SchemaConfig.fromSchema(moduleDto);
|
|
@@ -3406,7 +3347,6 @@ var SumScore = {
|
|
|
3406
3347
|
BuilderQuestion,
|
|
3407
3348
|
BuilderRule,
|
|
3408
3349
|
BuilderSchema,
|
|
3409
|
-
BuilderSchemaDto,
|
|
3410
3350
|
BuilderTag,
|
|
3411
3351
|
BuilderText,
|
|
3412
3352
|
CodeBook,
|