@media-quest/builder 0.0.40 → 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 +4 -5
- package/dist/public-api.js +35 -30
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
- package/src/Builder-option.ts +1 -2
- package/src/Builder-question.spec.ts +1 -0
- package/src/Builder-question.ts +1 -2
- package/src/page/Builder-page-collection.spec.ts +5 -0
- package/src/theme/IDefault-theme.ts +1 -2
- package/src/theme/default-theme-compiler.ts +10 -5
- package/src/theme/theme2.ts +33 -22
package/dist/public-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PStyle
|
|
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
|
|
@@ -89,19 +89,19 @@ interface BuilderOptionDto {
|
|
|
89
89
|
readonly value: number;
|
|
90
90
|
readonly label: string;
|
|
91
91
|
readonly labelAudio?: AudioFile;
|
|
92
|
-
readonly cssOverride?: PStyle
|
|
92
|
+
readonly cssOverride?: PStyle;
|
|
93
93
|
}
|
|
94
94
|
declare class BuilderOption extends BuilderObject<"builder-question-option", BuilderOptionDto> {
|
|
95
95
|
readonly objectType = "builder-question-option";
|
|
96
96
|
id: OptionID;
|
|
97
97
|
value: number;
|
|
98
98
|
label: string;
|
|
99
|
-
cssOverride: PStyle
|
|
99
|
+
cssOverride: PStyle;
|
|
100
100
|
private _labelAudioFile;
|
|
101
101
|
get labelAudioFile(): AudioFile | false;
|
|
102
102
|
set labelAudioFile(audioFile: AudioFile | false);
|
|
103
103
|
private constructor();
|
|
104
|
-
static create(value: number, label: string, css?: PStyle
|
|
104
|
+
static create(value: number, label: string, css?: PStyle): BuilderOption;
|
|
105
105
|
static fromJson(dto: BuilderOptionDto): BuilderOption;
|
|
106
106
|
toJson(): BuilderOptionDto;
|
|
107
107
|
clone(): BuilderOptionDto;
|
|
@@ -610,7 +610,6 @@ interface CssTheme<S extends Partial<DStyle> = Partial<DStyle>> {
|
|
|
610
610
|
cssDisabled: Partial<DStyle>;
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
type PStyle = Partial<DStyle>;
|
|
614
613
|
interface IDefaultTheme {
|
|
615
614
|
name: string;
|
|
616
615
|
schemaBackgroundColor: string;
|
package/dist/public-api.js
CHANGED
|
@@ -178,8 +178,7 @@ var BuilderOption = class _BuilderOption extends BuilderObject {
|
|
|
178
178
|
return instance;
|
|
179
179
|
}
|
|
180
180
|
static fromJson(dto) {
|
|
181
|
-
|
|
182
|
-
return instance;
|
|
181
|
+
return new _BuilderOption(dto);
|
|
183
182
|
}
|
|
184
183
|
toJson() {
|
|
185
184
|
const dto = {
|
|
@@ -216,8 +215,7 @@ var BuilderQuestion = class _BuilderQuestion extends BuilderObject {
|
|
|
216
215
|
});
|
|
217
216
|
};
|
|
218
217
|
static fromJson(dto) {
|
|
219
|
-
|
|
220
|
-
return question;
|
|
218
|
+
return new _BuilderQuestion(dto);
|
|
221
219
|
}
|
|
222
220
|
constructor(dto) {
|
|
223
221
|
super(dto);
|
|
@@ -1664,6 +1662,9 @@ var THEME_2_ICONS = {
|
|
|
1664
1662
|
};
|
|
1665
1663
|
|
|
1666
1664
|
// src/theme/theme2.ts
|
|
1665
|
+
var deepClone = (obj) => {
|
|
1666
|
+
return JSON.parse(JSON.stringify(obj));
|
|
1667
|
+
};
|
|
1667
1668
|
var translate = (pos) => {
|
|
1668
1669
|
const x = pos.x || 0;
|
|
1669
1670
|
const y = pos.y || 0;
|
|
@@ -1723,20 +1724,21 @@ var PAGE_BACKGROUND_HEIGHT = 100 - PAGE_BACKGROUND_BOTTOM - H_M1;
|
|
|
1723
1724
|
var BUTTON_BAR_WIDTH = Q_AREA_WIDTH - 2 * W_M3;
|
|
1724
1725
|
var MAIN_TEXT_WIDE = Q_AREA_WIDTH - 2 * W_M3;
|
|
1725
1726
|
var MAIN_TEXT_NARROW = MAIN_TEXT_WIDE - AUDIO_ICON_WIDTH - W_M3;
|
|
1726
|
-
var
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
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
|
+
};
|
|
1735
1737
|
};
|
|
1736
|
-
var muteUnmuteText = { ...
|
|
1737
|
-
var playPauseText = { ...
|
|
1738
|
+
var muteUnmuteText = { ...btnTextBaseObj(), right: VIDEO_CONTROLS_RIGHT };
|
|
1739
|
+
var playPauseText = { ...btnTextBaseObj(), left: VIDEO_CONTROLS_LEFT };
|
|
1738
1740
|
var replayText = {
|
|
1739
|
-
...
|
|
1741
|
+
...btnTextBaseObj(),
|
|
1740
1742
|
width: VIDEO_CONTROLS_WIDTH,
|
|
1741
1743
|
left: VIDEO_CONTROLS_LEFT,
|
|
1742
1744
|
// backgroundColor: Colors.yellow,
|
|
@@ -1786,8 +1788,9 @@ var responseButtonBaseCss = () => ({
|
|
|
1786
1788
|
fontWeight: 600,
|
|
1787
1789
|
fontSize: { _unit: "px", value: 28 },
|
|
1788
1790
|
lineHeight: 1.1,
|
|
1789
|
-
// TODO
|
|
1790
|
-
maxWidth: 25,
|
|
1791
|
+
// TODO Skal knappene vokse, med mindre det settes en maksbredde?
|
|
1792
|
+
// maxWidth: 25,
|
|
1793
|
+
// maxWidth: { _unit: "percent", value: 10 },
|
|
1791
1794
|
minWidth: 12,
|
|
1792
1795
|
// width: 20,
|
|
1793
1796
|
// flex: "0 0 auto",
|
|
@@ -1801,7 +1804,6 @@ var responseButtonBaseCss = () => ({
|
|
|
1801
1804
|
position: "relative",
|
|
1802
1805
|
display: "block",
|
|
1803
1806
|
cursor: "pointer"
|
|
1804
|
-
// maxWidth: { _unit: "percent", value: 10 },
|
|
1805
1807
|
},
|
|
1806
1808
|
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1807
1809
|
cssEnabled: { opacity: 1, cursor: "pointer" }
|
|
@@ -1813,8 +1815,8 @@ var primaryButton = (overridesCss) => {
|
|
|
1813
1815
|
normal: {
|
|
1814
1816
|
btn: {
|
|
1815
1817
|
css: {
|
|
1816
|
-
...base.css,
|
|
1817
|
-
...overridesCss,
|
|
1818
|
+
...deepClone(base.css),
|
|
1819
|
+
...deepClone(overridesCss),
|
|
1818
1820
|
backgroundColor: Colors.primary,
|
|
1819
1821
|
borderColor: Colors.primary,
|
|
1820
1822
|
textColor: Colors.white
|
|
@@ -1829,8 +1831,8 @@ var primaryButton = (overridesCss) => {
|
|
|
1829
1831
|
dontKnow: {
|
|
1830
1832
|
btn: {
|
|
1831
1833
|
css: {
|
|
1832
|
-
...base.css,
|
|
1833
|
-
...overridesCss,
|
|
1834
|
+
...deepClone(base.css),
|
|
1835
|
+
...deepClone(overridesCss),
|
|
1834
1836
|
backgroundColor: Colors.secondary,
|
|
1835
1837
|
borderColor: Colors.secondary,
|
|
1836
1838
|
textColor: Colors.primary
|
|
@@ -1998,16 +2000,17 @@ var Theme2 = {
|
|
|
1998
2000
|
bottom: Q_AREA_BOTTOM + H_M3,
|
|
1999
2001
|
left: Q_AREA_LEFT + W_M3,
|
|
2000
2002
|
// backgroundColor: "green",
|
|
2001
|
-
gap: { _unit: "px", value:
|
|
2003
|
+
gap: { _unit: "px", value: 32 },
|
|
2002
2004
|
alignItems: "stretch"
|
|
2003
2005
|
},
|
|
2004
2006
|
whenSingle: { justifyContent: "center" },
|
|
2005
2007
|
whenMany: { justifyContent: "flex-start" }
|
|
2006
2008
|
},
|
|
2007
|
-
nextButtonTheme: primaryButton({}),
|
|
2008
|
-
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 } })
|
|
2009
2011
|
}
|
|
2010
2012
|
};
|
|
2013
|
+
console.log(Theme2);
|
|
2011
2014
|
|
|
2012
2015
|
// src/theme/default-theme-compiler.ts
|
|
2013
2016
|
var DefaultThemeCompiler = class {
|
|
@@ -2511,17 +2514,19 @@ var DefaultThemeCompiler = class {
|
|
|
2511
2514
|
referenceLabel: options.questionText
|
|
2512
2515
|
}
|
|
2513
2516
|
} : { kind: "next-page" };
|
|
2514
|
-
|
|
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);
|
|
2515
2520
|
if (t.buttonBar.vibrateMs) {
|
|
2516
|
-
onclickAction.vibrateMs = t.buttonBar.vibrateMs;
|
|
2517
2521
|
}
|
|
2518
2522
|
if (cssOverride) {
|
|
2519
|
-
|
|
2523
|
+
console.log(cssOverride);
|
|
2524
|
+
css = { ...css, ...cssOverride };
|
|
2520
2525
|
}
|
|
2521
2526
|
const btn = {
|
|
2522
2527
|
_tag: "button",
|
|
2523
2528
|
innerText: label,
|
|
2524
|
-
style: { ...
|
|
2529
|
+
style: { ...css, ...cssEnabled },
|
|
2525
2530
|
onClick: onclickAction
|
|
2526
2531
|
};
|
|
2527
2532
|
return btn;
|