@media-quest/builder 0.0.30 → 0.0.31
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 +178 -2
- package/dist/public-api.js +859 -248
- package/dist/public-api.js.map +1 -1
- package/package.json +2 -2
- package/src/Builder-option.ts +62 -64
- package/src/Builder-schema.ts +4 -2
- package/src/public-api.ts +1 -0
- package/src/theme/Default-theme.ts +173 -0
- package/src/theme/IDefault-theme.ts +125 -0
- package/src/theme/ThemeCompiler.ts +10 -0
- package/src/theme/default-theme-compiler.spec.ts +31 -0
- package/src/theme/default-theme-compiler.ts +407 -114
- package/src/theme/icon-urls.ts +29 -29
- package/src/theme/icons.ts +117 -0
- package/src/theme/{theme1.spec.ts → theme-utils.spec.ts} +52 -52
- package/src/theme/theme-utils.ts +56 -57
- package/src/theme/theme2.ts +372 -0
- package/src/theme/AbstractThemeCompiler.ts +0 -7
- package/src/theme/IDefaultTheme.ts +0 -226
package/dist/public-api.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(public_api_exports, {
|
|
|
32
32
|
BuilderTag: () => BuilderTag,
|
|
33
33
|
BuilderText: () => BuilderText,
|
|
34
34
|
CodeBook: () => CodeBook,
|
|
35
|
+
DefaultTheme: () => DefaultTheme,
|
|
35
36
|
ExcludeByPageIdSelectItem: () => ExcludeByPageIdSelectItem,
|
|
36
37
|
ExcludeByTagSelectItem: () => ExcludeByTagSelectItem,
|
|
37
38
|
JumpToActionManager: () => JumpToActionManager,
|
|
@@ -1389,61 +1390,6 @@ var BuilderPage = class _BuilderPage extends BuilderObject {
|
|
|
1389
1390
|
}
|
|
1390
1391
|
};
|
|
1391
1392
|
|
|
1392
|
-
// src/theme/AbstractThemeCompiler.ts
|
|
1393
|
-
var AbstractThemeCompiler = class {
|
|
1394
|
-
constructor(theme) {
|
|
1395
|
-
this.theme = theme;
|
|
1396
|
-
}
|
|
1397
|
-
};
|
|
1398
|
-
|
|
1399
|
-
// src/theme/theme-utils.ts
|
|
1400
|
-
var ThemeUtils;
|
|
1401
|
-
((ThemeUtils2) => {
|
|
1402
|
-
ThemeUtils2.spaceEvenlyX = (items, options = {
|
|
1403
|
-
startAt: 0,
|
|
1404
|
-
endAt: 100,
|
|
1405
|
-
defaultItemWidth: 5
|
|
1406
|
-
}) => {
|
|
1407
|
-
const startAt = options?.startAt ?? 0;
|
|
1408
|
-
const endAt = options?.endAt ?? 100;
|
|
1409
|
-
const range = Math.abs(endAt - startAt);
|
|
1410
|
-
if (items.length === 0) {
|
|
1411
|
-
return [];
|
|
1412
|
-
}
|
|
1413
|
-
const marginCount = items.length + 1;
|
|
1414
|
-
const defaultWidth = options.defaultItemWidth ?? 150 / marginCount;
|
|
1415
|
-
let totalWidthOfElements = items.reduce((prev, curr) => {
|
|
1416
|
-
const w = curr.style.w ?? defaultWidth;
|
|
1417
|
-
return prev + w;
|
|
1418
|
-
}, 0);
|
|
1419
|
-
let cursor = startAt;
|
|
1420
|
-
const rest = Math.max(range - totalWidthOfElements, 0);
|
|
1421
|
-
const margin = rest / marginCount;
|
|
1422
|
-
items.forEach((item) => {
|
|
1423
|
-
cursor = cursor + margin;
|
|
1424
|
-
const w = item.style.w ?? defaultWidth;
|
|
1425
|
-
const x = cursor;
|
|
1426
|
-
cursor = cursor + w;
|
|
1427
|
-
item.style.w = w;
|
|
1428
|
-
item.style.x = x;
|
|
1429
|
-
});
|
|
1430
|
-
return items;
|
|
1431
|
-
};
|
|
1432
|
-
ThemeUtils2.centerY = () => ({
|
|
1433
|
-
y: 50,
|
|
1434
|
-
transform: "translate(0%, 50%)"
|
|
1435
|
-
});
|
|
1436
|
-
ThemeUtils2.centerX = () => ({
|
|
1437
|
-
x: 50,
|
|
1438
|
-
transform: "translate(-50%, 0%)"
|
|
1439
|
-
});
|
|
1440
|
-
ThemeUtils2.centerXY = () => ({
|
|
1441
|
-
x: 50,
|
|
1442
|
-
y: 50,
|
|
1443
|
-
transform: "translate(-50%, 50%)"
|
|
1444
|
-
});
|
|
1445
|
-
})(ThemeUtils || (ThemeUtils = {}));
|
|
1446
|
-
|
|
1447
1393
|
// src/theme/icon-urls.ts
|
|
1448
1394
|
var IconUrls = {
|
|
1449
1395
|
ispeWhitePng: "https://firebasestorage.googleapis.com/v0/b/ispe-backend-dev.appspot.com/o/public-assets%2Fispe-hvit.png?alt=media&token=f6fe628b-2d99-472d-a2ea-e062873e2e22",
|
|
@@ -1460,7 +1406,7 @@ var IconUrls = {
|
|
|
1460
1406
|
volumeUpSvg: "https://firebasestorage.googleapis.com/v0/b/ispe-backend-dev.appspot.com/o/public-assets%2Fvolume_up-24px.svg?alt=media&token=551bd0a6-a515-4f87-a245-da433f4833f9"
|
|
1461
1407
|
};
|
|
1462
1408
|
|
|
1463
|
-
// src/theme/
|
|
1409
|
+
// src/theme/Default-theme.ts
|
|
1464
1410
|
var BuilderOptionTheme;
|
|
1465
1411
|
((BuilderOptionTheme2) => {
|
|
1466
1412
|
const GREEN = "#70AD47";
|
|
@@ -1470,80 +1416,64 @@ var BuilderOptionTheme;
|
|
|
1470
1416
|
const LIGHT_BLUE = "#42719C";
|
|
1471
1417
|
const WHITE = "#ffffff";
|
|
1472
1418
|
const BLUE = "#2F5597";
|
|
1473
|
-
const BTN_WIDTH = 18.5;
|
|
1474
1419
|
const BTN_BORDER_WIDTH = 3;
|
|
1475
1420
|
const BTN_BORDER_RADIUS = 10;
|
|
1476
1421
|
const BTN_BORDER_STYLE = "solid";
|
|
1477
|
-
const BTN_HEIGHT = 9.2;
|
|
1478
|
-
const BTN_SHORT_WIDTH = 13.7;
|
|
1479
1422
|
const FONT_WEIGHT = 600;
|
|
1480
|
-
const FONT_SIZE =
|
|
1423
|
+
const FONT_SIZE = 50;
|
|
1424
|
+
const BTN_PADDING_LEFT = 40;
|
|
1425
|
+
const BTN_PADDING_TOP = 40;
|
|
1426
|
+
const buttonBaseCss2 = () => ({
|
|
1427
|
+
css: {
|
|
1428
|
+
fontWeight: FONT_WEIGHT,
|
|
1429
|
+
fontSize: { _unit: "px", value: FONT_SIZE },
|
|
1430
|
+
letterSpacing: { _unit: "px", value: 2 },
|
|
1431
|
+
paddingLeft: { _unit: "px", value: BTN_PADDING_LEFT },
|
|
1432
|
+
paddingTop: { _unit: "px", value: BTN_PADDING_TOP },
|
|
1433
|
+
paddingBottom: { _unit: "px", value: BTN_PADDING_TOP },
|
|
1434
|
+
paddingRight: { _unit: "px", value: BTN_PADDING_LEFT },
|
|
1435
|
+
borderRadius: { _unit: "px", value: BTN_BORDER_RADIUS },
|
|
1436
|
+
borderWidth: { _unit: "px", value: BTN_BORDER_WIDTH },
|
|
1437
|
+
borderStyle: BTN_BORDER_STYLE,
|
|
1438
|
+
// boxShadow: "3px 3px gray",
|
|
1439
|
+
position: "relative",
|
|
1440
|
+
display: "block"
|
|
1441
|
+
},
|
|
1442
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1443
|
+
cssEnabled: { opacity: 1, cursor: "pointer" }
|
|
1444
|
+
});
|
|
1481
1445
|
BuilderOptionTheme2.blueButton = () => {
|
|
1446
|
+
const base = buttonBaseCss2();
|
|
1447
|
+
const { css, cssEnabled, cssDisabled } = base;
|
|
1482
1448
|
const optionTheme = {
|
|
1483
1449
|
name: "blue-button-theme",
|
|
1484
1450
|
normal: {
|
|
1485
1451
|
btn: {
|
|
1486
1452
|
css: {
|
|
1453
|
+
...css,
|
|
1487
1454
|
backgroundColor: BLUE,
|
|
1488
1455
|
borderColor: BLUE,
|
|
1489
|
-
textColor: WHITE
|
|
1490
|
-
fontSize: { _unit: "px", value: FONT_SIZE },
|
|
1491
|
-
borderWidth: { _unit: "px", value: BTN_BORDER_WIDTH },
|
|
1492
|
-
borderStyle: BTN_BORDER_STYLE,
|
|
1493
|
-
borderRadius: { value: BTN_BORDER_RADIUS, _unit: "px" },
|
|
1494
|
-
padding: { _unit: "px", value: 40 },
|
|
1495
|
-
h: BTN_HEIGHT,
|
|
1496
|
-
w: BTN_WIDTH,
|
|
1497
|
-
x: 10,
|
|
1498
|
-
y: 8,
|
|
1499
|
-
textAlign: "center"
|
|
1456
|
+
textColor: WHITE
|
|
1500
1457
|
},
|
|
1501
|
-
cssDisabled
|
|
1502
|
-
cssEnabled
|
|
1458
|
+
cssDisabled,
|
|
1459
|
+
cssEnabled
|
|
1503
1460
|
},
|
|
1504
1461
|
divider: {},
|
|
1505
|
-
text1: {
|
|
1506
|
-
y: 50,
|
|
1507
|
-
transform: "translate(0%, 50%)",
|
|
1508
|
-
textColor: WHITE,
|
|
1509
|
-
fontSize: { _unit: "px", value: FONT_SIZE },
|
|
1510
|
-
w: 84,
|
|
1511
|
-
x: 8,
|
|
1512
|
-
fontWeight: FONT_WEIGHT,
|
|
1513
|
-
textAlign: "center"
|
|
1514
|
-
},
|
|
1462
|
+
text1: {},
|
|
1515
1463
|
text2: {}
|
|
1516
1464
|
},
|
|
1517
1465
|
dontKnow: {
|
|
1518
1466
|
btn: {
|
|
1519
1467
|
css: {
|
|
1468
|
+
...css,
|
|
1520
1469
|
backgroundColor: WHITE,
|
|
1521
1470
|
borderColor: LIGHT_BLUE,
|
|
1522
|
-
textColor: BLUE
|
|
1523
|
-
fontSize: { _unit: "px", value: FONT_SIZE },
|
|
1524
|
-
borderWidth: { _unit: "px", value: BTN_BORDER_WIDTH },
|
|
1525
|
-
borderStyle: BTN_BORDER_STYLE,
|
|
1526
|
-
borderRadius: { value: BTN_BORDER_RADIUS, _unit: "px" },
|
|
1527
|
-
padding: { _unit: "px", value: 40 },
|
|
1528
|
-
h: BTN_HEIGHT,
|
|
1529
|
-
w: BTN_SHORT_WIDTH,
|
|
1530
|
-
x: 10,
|
|
1531
|
-
y: 8,
|
|
1532
|
-
textAlign: "center"
|
|
1471
|
+
textColor: BLUE
|
|
1533
1472
|
},
|
|
1534
|
-
cssDisabled
|
|
1535
|
-
cssEnabled
|
|
1536
|
-
},
|
|
1537
|
-
text1: {
|
|
1538
|
-
y: 50,
|
|
1539
|
-
transform: "translate(0%, 50%)",
|
|
1540
|
-
textColor: BLUE,
|
|
1541
|
-
fontSize: { _unit: "px", value: FONT_SIZE },
|
|
1542
|
-
w: 84,
|
|
1543
|
-
x: 8,
|
|
1544
|
-
fontWeight: FONT_WEIGHT,
|
|
1545
|
-
textAlign: "center"
|
|
1473
|
+
cssDisabled,
|
|
1474
|
+
cssEnabled
|
|
1546
1475
|
},
|
|
1476
|
+
text1: {},
|
|
1547
1477
|
text2: {},
|
|
1548
1478
|
divider: {}
|
|
1549
1479
|
}
|
|
@@ -1551,8 +1481,35 @@ var BuilderOptionTheme;
|
|
|
1551
1481
|
return optionTheme;
|
|
1552
1482
|
};
|
|
1553
1483
|
})(BuilderOptionTheme || (BuilderOptionTheme = {}));
|
|
1484
|
+
var textHighTop = 25;
|
|
1485
|
+
var textLowTop = 55;
|
|
1486
|
+
var audioHighTop = 20;
|
|
1487
|
+
var audioLowTop = 55;
|
|
1488
|
+
var textBase = {
|
|
1489
|
+
width: 80,
|
|
1490
|
+
top: textHighTop,
|
|
1491
|
+
left: 10,
|
|
1492
|
+
textAlign: "center",
|
|
1493
|
+
textColor: "black",
|
|
1494
|
+
fontSize: { _unit: "px", value: 40 }
|
|
1495
|
+
};
|
|
1496
|
+
var textHigh = { ...textBase, top: textHighTop };
|
|
1497
|
+
var textLow = { ...textHigh, top: textLowTop };
|
|
1498
|
+
var audioBase = {
|
|
1499
|
+
height: 6,
|
|
1500
|
+
width: 6,
|
|
1501
|
+
left: 4,
|
|
1502
|
+
top: audioHighTop,
|
|
1503
|
+
cursor: "pointer",
|
|
1504
|
+
opacity: 0.8,
|
|
1505
|
+
visibility: "visible"
|
|
1506
|
+
};
|
|
1507
|
+
var audioHigh = { ...audioBase, top: audioHighTop };
|
|
1508
|
+
var audioLow = { ...audioBase, top: audioLowTop };
|
|
1554
1509
|
var DefaultTheme = {
|
|
1555
1510
|
name: "default-theme",
|
|
1511
|
+
schemaBackgroundColor: "white",
|
|
1512
|
+
dimensions: { baseHeight: 1300, baseWidth: 1024 },
|
|
1556
1513
|
videoPlayer: {
|
|
1557
1514
|
playButton: {
|
|
1558
1515
|
iconUrl: IconUrls.playCircleRegular,
|
|
@@ -1566,76 +1523,488 @@ var DefaultTheme = {
|
|
|
1566
1523
|
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1567
1524
|
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1568
1525
|
},
|
|
1569
|
-
videoElement: { css: {
|
|
1526
|
+
videoElement: { css: { height: 41, top: 3, x: 0 } }
|
|
1570
1527
|
},
|
|
1571
1528
|
image: { style: { h: 50, w: 100, x: 0 } },
|
|
1572
1529
|
mainText: {
|
|
1573
|
-
|
|
1574
|
-
text: {
|
|
1575
|
-
css: {
|
|
1576
|
-
w: 80,
|
|
1577
|
-
y: 65,
|
|
1578
|
-
x: 10,
|
|
1579
|
-
textAlign: "center",
|
|
1580
|
-
textColor: "black",
|
|
1581
|
-
fontSize: { _unit: "px", value: 40 }
|
|
1582
|
-
},
|
|
1583
|
-
cssDisabled: {},
|
|
1584
|
-
cssEnabled: {}
|
|
1585
|
-
},
|
|
1530
|
+
base: {
|
|
1531
|
+
text: { ...textBase },
|
|
1586
1532
|
audio: {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
w: 6,
|
|
1590
|
-
x: 4,
|
|
1591
|
-
y: 32,
|
|
1592
|
-
cursor: "pointer",
|
|
1593
|
-
opacity: 0.8,
|
|
1594
|
-
visibility: "visible"
|
|
1595
|
-
},
|
|
1533
|
+
iconUrl: IconUrls.volumeUpSvg,
|
|
1534
|
+
css: { ...audioBase },
|
|
1596
1535
|
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1597
1536
|
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1598
1537
|
}
|
|
1599
1538
|
},
|
|
1600
|
-
|
|
1601
|
-
text: {
|
|
1539
|
+
notMediaHasAudio: {
|
|
1540
|
+
text: { ...textHigh },
|
|
1541
|
+
audio: { ...audioHigh }
|
|
1542
|
+
},
|
|
1543
|
+
hasMediaNotAudio: {
|
|
1544
|
+
text: { ...textHigh }
|
|
1545
|
+
},
|
|
1546
|
+
notMediaNotAudio: { text: { ...textHigh } },
|
|
1547
|
+
hasMediaHasAudio: { text: { ...textLow }, audio: { ...audioLow } }
|
|
1548
|
+
},
|
|
1549
|
+
buttonBar: {
|
|
1550
|
+
vibrateMs: false,
|
|
1551
|
+
container: {
|
|
1552
|
+
base: {
|
|
1553
|
+
display: "flex",
|
|
1554
|
+
justifyContent: "space-evenly",
|
|
1555
|
+
position: "absolute",
|
|
1556
|
+
width: 100,
|
|
1557
|
+
height: 15,
|
|
1558
|
+
bottom: 0,
|
|
1559
|
+
left: 0,
|
|
1560
|
+
// h: 10,
|
|
1561
|
+
alignItems: "center",
|
|
1562
|
+
backgroundColor: "yellow"
|
|
1563
|
+
},
|
|
1564
|
+
whenSingle: { justifyContent: "space-evenly" },
|
|
1565
|
+
whenMany: { justifyContent: "space-evenly" }
|
|
1566
|
+
},
|
|
1567
|
+
nextButtonTheme: BuilderOptionTheme.blueButton(),
|
|
1568
|
+
responseButtons: BuilderOptionTheme.blueButton()
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
// src/theme/default-theme-compiler.ts
|
|
1573
|
+
var import_engine2 = require("@media-quest/engine");
|
|
1574
|
+
|
|
1575
|
+
// src/theme/icons.ts
|
|
1576
|
+
var UN_MUTE = `
|
|
1577
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1578
|
+
<path d="M8 15.5661V23.4339H13.3333L20 29.9903V9.00969L13.3333 15.5661H8ZM26 19.5C26 17.179 24.64 15.1859 22.6667 14.2155V24.7714C24.64 23.8141 26 21.821 26 19.5ZM22.6667 8V10.7013C26.52 11.829 29.3333 15.3432 29.3333 19.5C29.3333 23.6568 26.52 27.171 22.6667 28.2987V31C28.0133 29.8067 32 25.1123 32 19.5C32 13.8877 28.0133 9.19327 22.6667 8Z" fill="#164AC4"/>
|
|
1579
|
+
</svg>`;
|
|
1580
|
+
var MUTE = `
|
|
1581
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1582
|
+
<path d="M26 20C26 17.64 24.64 15.6133 22.6667 14.6267V17.5733L25.9333 20.84C25.9733 20.5733 26 20.2933 26 20ZM29.3333 20C29.3333 21.2533 29.0667 22.4267 28.6133 23.52L30.6267 25.5333C31.5067 23.88 32 22 32 20C32 14.2933 28.0133 9.52 22.6667 8.30667V11.0533C26.52 12.2 29.3333 15.7733 29.3333 20ZM9.69333 8L8 9.69333L14.3067 16H8V24H13.3333L20 30.6667V21.6933L25.6667 27.36C24.7733 28.0533 23.7733 28.6 22.6667 28.9333V31.68C24.5067 31.2667 26.1733 30.4133 27.5867 29.2667L30.3067 32L32 30.3067L20 18.3067L9.69333 8ZM20 9.33333L17.2133 12.12L20 14.9067V9.33333Z" fill="#164AC4"/>
|
|
1583
|
+
</svg>`;
|
|
1584
|
+
var PLAY_SOUND = `
|
|
1585
|
+
|
|
1586
|
+
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1587
|
+
<g clip-path="url(#clip0_1_299)">
|
|
1588
|
+
<path d="M13.5 19.5C16.8137 19.5 19.5 16.8137 19.5 13.5C19.5 10.1863 16.8137 7.5 13.5 7.5C10.1863 7.5 7.5 10.1863 7.5 13.5C7.5 16.8137 10.1863 19.5 13.5 19.5Z" fill="#164AC4"/>
|
|
1589
|
+
<path d="M13.5 22.5C9.495 22.5 1.5 24.51 1.5 28.5V31.5H25.5V28.5C25.5 24.51 17.505 22.5 13.5 22.5ZM25.14 8.04L22.62 10.575C23.88 12.345 23.88 14.64 22.62 16.41L25.14 18.945C28.17 15.915 28.17 11.34 25.14 8.04ZM30.105 3L27.66 5.445C31.815 9.975 31.815 16.785 27.66 21.555L30.105 24C35.955 18.165 35.97 9.075 30.105 3Z" fill="#164AC4"/>
|
|
1590
|
+
</g>
|
|
1591
|
+
<defs>
|
|
1592
|
+
<clipPath id="clip0_1_299">
|
|
1593
|
+
<rect width="36" height="36" fill="white"/>
|
|
1594
|
+
</clipPath>
|
|
1595
|
+
</defs>
|
|
1596
|
+
</svg>`;
|
|
1597
|
+
var CLOSE = `
|
|
1598
|
+
<svg width="40" height="41" viewBox="0 0 40 41" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1599
|
+
<path d="M20 0.799988C8.94 0.799988 0 9.73999 0 20.8C0 31.86 8.94 40.8 20 40.8C31.06 40.8 40 31.86 40 20.8C40 9.73999 31.06 0.799988 20 0.799988ZM30 27.98L27.18 30.8L20 23.62L12.82 30.8L10 27.98L17.18 20.8L10 13.62L12.82 10.8L20 17.98L27.18 10.8L30 13.62L22.82 20.8L30 27.98Z" fill="white"/>
|
|
1600
|
+
</svg>`;
|
|
1601
|
+
var COMPLETED = `
|
|
1602
|
+
<svg width="36" height="27" viewBox="0 0 36 27" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1603
|
+
<path d="M11.2 21.2L2.8 12.8L0 15.6L11.2 26.8L35.2 2.8L32.4 0L11.2 21.2Z" fill="white"/>
|
|
1604
|
+
</svg>`;
|
|
1605
|
+
var VIDEO_PLAY = `
|
|
1606
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1607
|
+
<path d="M16 12V28L29 20L16 12Z" fill="#164AC4"/>
|
|
1608
|
+
</svg>`;
|
|
1609
|
+
var VIDEO_REPLAY = `
|
|
1610
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1611
|
+
<path d="M20 12.8V8L13.75 14L20 20V15.2C24.1375 15.2 27.5 18.428 27.5 22.4C27.5 26.372 24.1375 29.6 20 29.6C15.8625 29.6 12.5 26.372 12.5 22.4H10C10 27.704 14.475 32 20 32C25.525 32 30 27.704 30 22.4C30 17.096 25.525 12.8 20 12.8Z" fill="#164AC4"/>
|
|
1612
|
+
</svg>`;
|
|
1613
|
+
var HELP = `
|
|
1614
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1615
|
+
<path d="M20 0C8.96 0 0 8.96 0 20C0 31.04 8.96 40 20 40C31.04 40 40 31.04 40 20C40 8.96 31.04 0 20 0ZM22 34H18V30H22V34ZM26.14 18.5L24.34 20.34C22.9 21.8 22 23 22 26H18V25C18 22.8 18.9 20.8 20.34 19.34L22.82 16.82C23.56 16.1 24 15.1 24 14C24 11.8 22.2 10 20 10C17.8 10 16 11.8 16 14H12C12 9.58 15.58 6 20 6C24.42 6 28 9.58 28 14C28 15.76 27.28 17.36 26.14 18.5Z" fill="#164AC4"/>
|
|
1616
|
+
</svg>`;
|
|
1617
|
+
var VIDEO_PAUSE = `
|
|
1618
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1619
|
+
<path d="M13 28H17.6667V12H13V28ZM22.3333 12V28H27V12H22.3333Z" fill="#164AC4"/>
|
|
1620
|
+
</svg>`;
|
|
1621
|
+
var THEME_2_ICONS = {
|
|
1622
|
+
unMute: {
|
|
1623
|
+
svg: UN_MUTE,
|
|
1624
|
+
dataUrl: "data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgNDAgNDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTggMTUuNTY2MVYyMy40MzM5SDEzLjMzMzNMMjAgMjkuOTkwM1Y5LjAwOTY5TDEzLjMzMzMgMTUuNTY2MUg4Wk0yNiAxOS41QzI2IDE3LjE3OSAyNC42NCAxNS4xODU5IDIyLjY2NjcgMTQuMjE1NVYyNC43NzE0QzI0LjY0I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NiAyMCA2QzI0LjQyIDYgMjggOS41OCAyOCAxNEMyOCAxNS43NiAyNy4yOCAxNy4zNiAyNi4xNCAxOC41WiIgZmlsbD0iIzE2NEFDNCIvPgo8L3N2Zz4="
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
|
|
1660
|
+
// src/theme/theme2.ts
|
|
1661
|
+
var translate = (pos) => {
|
|
1662
|
+
const x = pos.x || 0;
|
|
1663
|
+
const y = pos.y || 0;
|
|
1664
|
+
return `translate(${x}%, ${y}%)`;
|
|
1665
|
+
};
|
|
1666
|
+
var translateY50 = translate({ y: 50 });
|
|
1667
|
+
var translateX50 = translate({ x: -50 });
|
|
1668
|
+
var translateX50Y50 = translate({ x: -50, y: 50 });
|
|
1669
|
+
var Colors = {
|
|
1670
|
+
primary: "#164AC4",
|
|
1671
|
+
secondary: "#E8F0FE",
|
|
1672
|
+
text: "#0D1E45",
|
|
1673
|
+
white: "#ffffff",
|
|
1674
|
+
backgroundGray: "#F0F0F0",
|
|
1675
|
+
backgroundWhite: "white",
|
|
1676
|
+
progressBackGround: "#164AC4",
|
|
1677
|
+
progressForGround: "#F5F5F5"
|
|
1678
|
+
// red: "red",
|
|
1679
|
+
// yellow: "yellow",
|
|
1680
|
+
};
|
|
1681
|
+
var fraction = 472.6 / 600;
|
|
1682
|
+
var LAYER_2 = 2;
|
|
1683
|
+
var LAYER_4 = 4;
|
|
1684
|
+
var LAYER_5 = 5;
|
|
1685
|
+
var W_M1 = 6;
|
|
1686
|
+
var W_M2 = 4.5;
|
|
1687
|
+
var W_M3 = 3;
|
|
1688
|
+
var W_M4 = 1.5;
|
|
1689
|
+
var H_M1 = 5;
|
|
1690
|
+
var H_M2 = 3.75;
|
|
1691
|
+
var H_M3 = 2.5;
|
|
1692
|
+
var H_M4 = 1.25;
|
|
1693
|
+
var W_MAX = 100 - W_M1 * 2;
|
|
1694
|
+
var PROGRESS_BAR_HEIGHT = 2;
|
|
1695
|
+
var AUDIO_ICON_WIDTH = 10;
|
|
1696
|
+
var AUDIO_ICON_HEIGHT = AUDIO_ICON_WIDTH * fraction;
|
|
1697
|
+
var AUDIO_ICON_LEFT = W_M1 + W_M2 + W_M3;
|
|
1698
|
+
var Q_AREA_HEIGHT = 32;
|
|
1699
|
+
var Q_AREA_BOTTOM = 2 * H_M1 + H_M2;
|
|
1700
|
+
var Q_AREA_LEFT = W_M1 + W_M2;
|
|
1701
|
+
var Q_AREA_WIDTH = W_MAX - W_M2 - W_M2;
|
|
1702
|
+
var Q_AREA_TOP = 100 - Q_AREA_HEIGHT - Q_AREA_BOTTOM;
|
|
1703
|
+
var MEDIA_HEIGHT = 34;
|
|
1704
|
+
var MEDIA_TOP = H_M1 + H_M2;
|
|
1705
|
+
var MEDIA_BOTTOM = MEDIA_TOP + MEDIA_HEIGHT;
|
|
1706
|
+
var MEDIA_LEFT = W_M1 + W_M2;
|
|
1707
|
+
var VIDEO_BUTTONS_WIDTH = 8;
|
|
1708
|
+
var VIDEO_BUTTONS_HEIGHT = VIDEO_BUTTONS_WIDTH * fraction;
|
|
1709
|
+
var VIDEO_CONTROLS_WIDTH = VIDEO_BUTTONS_WIDTH * 2 + 4 * W_M4;
|
|
1710
|
+
var VIDEO_CONTROLS_HEIGHT = VIDEO_BUTTONS_HEIGHT + 2 * H_M4 + 2;
|
|
1711
|
+
var VIDEO_CONTROLS_LEFT = 50 - VIDEO_CONTROLS_WIDTH / 2;
|
|
1712
|
+
var VIDEO_CONTROLS_RIGHT = 50 - VIDEO_CONTROLS_WIDTH / 2;
|
|
1713
|
+
var VIDEO_CONTROLS_TOP = MEDIA_BOTTOM - 1;
|
|
1714
|
+
var VIDEO_CONTROLS_BOTTOM = 100 - VIDEO_CONTROLS_HEIGHT - VIDEO_CONTROLS_TOP;
|
|
1715
|
+
var PAGE_BACKGROUND_BOTTOM = H_M1 + H_M1;
|
|
1716
|
+
var PAGE_BACKGROUND_HEIGHT = 100 - PAGE_BACKGROUND_BOTTOM - H_M1;
|
|
1717
|
+
var BUTTON_BAR_WIDTH = Q_AREA_WIDTH - 2 * W_M3;
|
|
1718
|
+
var MAIN_TEXT_WIDE = Q_AREA_WIDTH - 2 * W_M3;
|
|
1719
|
+
var MAIN_TEXT_NARROW = MAIN_TEXT_WIDE - AUDIO_ICON_WIDTH - W_M3;
|
|
1720
|
+
var btnTextBase = {
|
|
1721
|
+
fontSize: { _unit: "px", value: 25 },
|
|
1722
|
+
bottom: VIDEO_CONTROLS_BOTTOM + 1.2,
|
|
1723
|
+
zIndex: LAYER_5,
|
|
1724
|
+
width: VIDEO_CONTROLS_WIDTH / 2,
|
|
1725
|
+
textAlign: "center",
|
|
1726
|
+
visibility: "hidden"
|
|
1727
|
+
// backgroundColor: Colors.yellow,
|
|
1728
|
+
};
|
|
1729
|
+
var muteUnmuteText = { ...btnTextBase, right: VIDEO_CONTROLS_RIGHT };
|
|
1730
|
+
var playPauseText = { ...btnTextBase, left: VIDEO_CONTROLS_LEFT };
|
|
1731
|
+
var replayText = {
|
|
1732
|
+
...btnTextBase,
|
|
1733
|
+
width: VIDEO_CONTROLS_WIDTH,
|
|
1734
|
+
left: VIDEO_CONTROLS_LEFT,
|
|
1735
|
+
// backgroundColor: Colors.yellow,
|
|
1736
|
+
visibility: "hidden"
|
|
1737
|
+
};
|
|
1738
|
+
var playPauseBase = {
|
|
1739
|
+
css: {
|
|
1740
|
+
width: VIDEO_BUTTONS_WIDTH,
|
|
1741
|
+
height: VIDEO_BUTTONS_HEIGHT,
|
|
1742
|
+
top: MEDIA_BOTTOM,
|
|
1743
|
+
left: VIDEO_CONTROLS_LEFT + W_M4,
|
|
1744
|
+
zIndex: LAYER_5,
|
|
1745
|
+
visibility: "hidden"
|
|
1746
|
+
},
|
|
1747
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1748
|
+
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1749
|
+
};
|
|
1750
|
+
var replayButtonStyles = {
|
|
1751
|
+
width: VIDEO_BUTTONS_WIDTH,
|
|
1752
|
+
height: VIDEO_BUTTONS_HEIGHT,
|
|
1753
|
+
top: MEDIA_BOTTOM,
|
|
1754
|
+
// backgroundColor: "red",
|
|
1755
|
+
left: VIDEO_CONTROLS_LEFT + VIDEO_CONTROLS_WIDTH / 2,
|
|
1756
|
+
transform: translateX50,
|
|
1757
|
+
zIndex: LAYER_5,
|
|
1758
|
+
visibility: "hidden",
|
|
1759
|
+
cursor: "pointer"
|
|
1760
|
+
};
|
|
1761
|
+
var muteUnMuteStyles = {
|
|
1762
|
+
css: {
|
|
1763
|
+
width: VIDEO_BUTTONS_WIDTH,
|
|
1764
|
+
height: VIDEO_BUTTONS_HEIGHT,
|
|
1765
|
+
top: MEDIA_BOTTOM,
|
|
1766
|
+
right: VIDEO_CONTROLS_RIGHT + W_M4,
|
|
1767
|
+
zIndex: LAYER_5,
|
|
1768
|
+
cursor: "pointer"
|
|
1769
|
+
// transform: "translateX: 100%",
|
|
1770
|
+
},
|
|
1771
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1772
|
+
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1773
|
+
};
|
|
1774
|
+
var buttonBaseCss = () => ({
|
|
1775
|
+
css: {
|
|
1776
|
+
backgroundColor: Colors.primary,
|
|
1777
|
+
borderColor: Colors.primary,
|
|
1778
|
+
textColor: Colors.white,
|
|
1779
|
+
fontWeight: 600,
|
|
1780
|
+
fontSize: { _unit: "px", value: 45 },
|
|
1781
|
+
letterSpacing: { _unit: "px", value: 2 },
|
|
1782
|
+
paddingLeft: { _unit: "px", value: 30 },
|
|
1783
|
+
paddingTop: { _unit: "px", value: 10 },
|
|
1784
|
+
paddingBottom: { _unit: "px", value: 10 },
|
|
1785
|
+
paddingRight: { _unit: "px", value: 30 },
|
|
1786
|
+
borderRadius: { _unit: "px", value: 20 },
|
|
1787
|
+
borderStyle: "solid",
|
|
1788
|
+
boxShadow: "3px 3px gray",
|
|
1789
|
+
position: "relative",
|
|
1790
|
+
display: "block",
|
|
1791
|
+
cursor: "pointer"
|
|
1792
|
+
},
|
|
1793
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1794
|
+
cssEnabled: { opacity: 1, cursor: "pointer" }
|
|
1795
|
+
});
|
|
1796
|
+
var primaryButton = (overridesCss) => {
|
|
1797
|
+
const base = buttonBaseCss();
|
|
1798
|
+
const optionTheme = {
|
|
1799
|
+
name: "primary-button",
|
|
1800
|
+
normal: {
|
|
1801
|
+
btn: {
|
|
1802
|
+
css: {
|
|
1803
|
+
...base.css,
|
|
1804
|
+
...overridesCss,
|
|
1805
|
+
backgroundColor: Colors.primary,
|
|
1806
|
+
borderColor: Colors.primary,
|
|
1807
|
+
textColor: Colors.white
|
|
1808
|
+
},
|
|
1809
|
+
cssDisabled: base.cssDisabled,
|
|
1810
|
+
cssEnabled: base.cssEnabled
|
|
1811
|
+
},
|
|
1812
|
+
divider: {},
|
|
1813
|
+
text1: {},
|
|
1814
|
+
text2: {}
|
|
1815
|
+
},
|
|
1816
|
+
dontKnow: {
|
|
1817
|
+
btn: {
|
|
1602
1818
|
css: {
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
textColor: "black",
|
|
1608
|
-
fontSize: { _unit: "px", value: 30 }
|
|
1819
|
+
...base.css,
|
|
1820
|
+
backgroundColor: Colors.secondary,
|
|
1821
|
+
borderColor: Colors.secondary,
|
|
1822
|
+
textColor: Colors.primary
|
|
1609
1823
|
},
|
|
1610
|
-
|
|
1611
|
-
|
|
1824
|
+
cssEnabled: base.cssEnabled,
|
|
1825
|
+
cssDisabled: base.cssDisabled
|
|
1826
|
+
},
|
|
1827
|
+
text1: {},
|
|
1828
|
+
text2: {},
|
|
1829
|
+
divider: {}
|
|
1830
|
+
}
|
|
1831
|
+
};
|
|
1832
|
+
return optionTheme;
|
|
1833
|
+
};
|
|
1834
|
+
var Theme2 = {
|
|
1835
|
+
name: "theme2",
|
|
1836
|
+
schemaBackgroundColor: Colors.white,
|
|
1837
|
+
dimensions: { baseHeight: 1300, baseWidth: 1024 },
|
|
1838
|
+
pageBackGround: {
|
|
1839
|
+
style: {
|
|
1840
|
+
height: PAGE_BACKGROUND_HEIGHT,
|
|
1841
|
+
width: W_MAX,
|
|
1842
|
+
bottom: PAGE_BACKGROUND_BOTTOM,
|
|
1843
|
+
left: W_M1,
|
|
1844
|
+
backgroundColor: Colors.backgroundGray
|
|
1845
|
+
}
|
|
1846
|
+
},
|
|
1847
|
+
backGroundArea1: {
|
|
1848
|
+
style: {
|
|
1849
|
+
height: Q_AREA_HEIGHT,
|
|
1850
|
+
width: Q_AREA_WIDTH,
|
|
1851
|
+
left: Q_AREA_LEFT,
|
|
1852
|
+
bottom: Q_AREA_BOTTOM,
|
|
1853
|
+
backgroundColor: Colors.white
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
progressBar: {
|
|
1857
|
+
width: W_MAX,
|
|
1858
|
+
height: PROGRESS_BAR_HEIGHT,
|
|
1859
|
+
bottom: H_M1,
|
|
1860
|
+
left: W_M1,
|
|
1861
|
+
backgroundStyles: {
|
|
1862
|
+
backgroundColor: Colors.backgroundGray,
|
|
1863
|
+
borderRadius: { _unit: "px", value: 10 }
|
|
1864
|
+
},
|
|
1865
|
+
progressStyles: {
|
|
1866
|
+
backgroundColor: Colors.primary,
|
|
1867
|
+
borderRadius: { _unit: "px", value: 10 }
|
|
1868
|
+
},
|
|
1869
|
+
text: {
|
|
1870
|
+
textType: "page-progress",
|
|
1871
|
+
style: { fontSize: { _unit: "px", value: 20 }, x: 81.5, y: 2.5 }
|
|
1872
|
+
}
|
|
1873
|
+
},
|
|
1874
|
+
videoPlayer: {
|
|
1875
|
+
playButton: {
|
|
1876
|
+
text: { text: "Spill av", css: { ...playPauseText } },
|
|
1877
|
+
iconUrl: THEME_2_ICONS.videoPlay.dataUrl,
|
|
1878
|
+
...playPauseBase
|
|
1879
|
+
},
|
|
1880
|
+
pauseButton: {
|
|
1881
|
+
text: { text: "Pause", css: { ...playPauseText } },
|
|
1882
|
+
iconUrl: THEME_2_ICONS.videoPause.dataUrl,
|
|
1883
|
+
...playPauseBase
|
|
1884
|
+
},
|
|
1885
|
+
buttonBar: {
|
|
1886
|
+
width: VIDEO_CONTROLS_WIDTH,
|
|
1887
|
+
zIndex: LAYER_4,
|
|
1888
|
+
top: VIDEO_CONTROLS_TOP,
|
|
1889
|
+
left: VIDEO_CONTROLS_LEFT,
|
|
1890
|
+
backgroundColor: Colors.white,
|
|
1891
|
+
height: VIDEO_CONTROLS_HEIGHT,
|
|
1892
|
+
borderRadius: { _unit: "px", value: 16 }
|
|
1893
|
+
},
|
|
1894
|
+
muteButton: {
|
|
1895
|
+
text: { text: "Lyd av", css: { ...muteUnmuteText } },
|
|
1896
|
+
iconUrl: THEME_2_ICONS.mute.dataUrl,
|
|
1897
|
+
css: muteUnMuteStyles.css
|
|
1898
|
+
},
|
|
1899
|
+
unMuteButton: {
|
|
1900
|
+
iconUrl: THEME_2_ICONS.unMute.dataUrl,
|
|
1901
|
+
css: muteUnMuteStyles.css,
|
|
1902
|
+
text: { text: "Lyd p\xE5", css: { ...muteUnmuteText } }
|
|
1903
|
+
},
|
|
1904
|
+
replayButton: {
|
|
1905
|
+
css: replayButtonStyles,
|
|
1906
|
+
cssDisabled: {},
|
|
1907
|
+
cssEnabled: {},
|
|
1908
|
+
iconUrl: THEME_2_ICONS.videoReplay.dataUrl,
|
|
1909
|
+
text: { text: "Spill av p\xE5 nytt", css: replayText }
|
|
1910
|
+
},
|
|
1911
|
+
videoElement: {
|
|
1912
|
+
css: {
|
|
1913
|
+
height: MEDIA_HEIGHT,
|
|
1914
|
+
top: MEDIA_TOP,
|
|
1915
|
+
transform: translateX50,
|
|
1916
|
+
left: 50,
|
|
1917
|
+
width: 100,
|
|
1918
|
+
zIndex: LAYER_2,
|
|
1919
|
+
visibility: "visible"
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
},
|
|
1923
|
+
image: {
|
|
1924
|
+
style: {
|
|
1925
|
+
height: MEDIA_HEIGHT,
|
|
1926
|
+
// Center image, with dynamic width.
|
|
1927
|
+
left: 50,
|
|
1928
|
+
transform: translateX50,
|
|
1929
|
+
top: MEDIA_TOP,
|
|
1930
|
+
boxShadow: "3px 3px"
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
mainText: {
|
|
1934
|
+
base: {
|
|
1935
|
+
text: {
|
|
1936
|
+
width: MAIN_TEXT_WIDE,
|
|
1937
|
+
left: W_M1 + W_M2 + W_M3,
|
|
1938
|
+
top: Q_AREA_TOP + H_M3,
|
|
1939
|
+
backgroundColor: Colors.white,
|
|
1940
|
+
textAlign: "left",
|
|
1941
|
+
textColor: "black",
|
|
1942
|
+
fontSize: { _unit: "px", value: 40 }
|
|
1612
1943
|
},
|
|
1613
1944
|
audio: {
|
|
1945
|
+
iconUrl: THEME_2_ICONS.audioPlay.dataUrl,
|
|
1614
1946
|
css: {
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1947
|
+
height: AUDIO_ICON_HEIGHT,
|
|
1948
|
+
width: AUDIO_ICON_WIDTH,
|
|
1949
|
+
top: Q_AREA_TOP + H_M3,
|
|
1950
|
+
left: W_M1 + W_M2 + W_M3,
|
|
1619
1951
|
cursor: "pointer",
|
|
1952
|
+
// transform: "translateY(100%)",
|
|
1620
1953
|
opacity: 0.8,
|
|
1621
1954
|
visibility: "visible"
|
|
1955
|
+
// backgroundColor: "green",
|
|
1622
1956
|
},
|
|
1623
1957
|
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1624
1958
|
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1625
1959
|
}
|
|
1626
|
-
}
|
|
1960
|
+
},
|
|
1961
|
+
notMediaHasAudio: {
|
|
1962
|
+
text: { width: MAIN_TEXT_NARROW, left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3 },
|
|
1963
|
+
audio: {}
|
|
1964
|
+
},
|
|
1965
|
+
hasMediaHasAudio: {
|
|
1966
|
+
text: {
|
|
1967
|
+
width: MAIN_TEXT_NARROW,
|
|
1968
|
+
left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3
|
|
1969
|
+
},
|
|
1970
|
+
audio: {}
|
|
1971
|
+
},
|
|
1972
|
+
notMediaNotAudio: { text: {} },
|
|
1973
|
+
hasMediaNotAudio: { text: {} }
|
|
1627
1974
|
},
|
|
1628
|
-
|
|
1629
|
-
|
|
1975
|
+
buttonBar: {
|
|
1976
|
+
vibrateMs: 60,
|
|
1977
|
+
container: {
|
|
1978
|
+
base: {
|
|
1979
|
+
display: "flex",
|
|
1980
|
+
justifyContent: "space-evenly",
|
|
1981
|
+
width: BUTTON_BAR_WIDTH,
|
|
1982
|
+
bottom: Q_AREA_BOTTOM + H_M3,
|
|
1983
|
+
left: Q_AREA_LEFT + W_M3,
|
|
1984
|
+
// backgroundColor: "green",
|
|
1985
|
+
gap: { _unit: "px", value: 20 },
|
|
1986
|
+
alignItems: "center"
|
|
1987
|
+
},
|
|
1988
|
+
whenSingle: { justifyContent: "space-evenly" },
|
|
1989
|
+
whenMany: { justifyContent: "flex-start" }
|
|
1990
|
+
},
|
|
1991
|
+
nextButtonTheme: primaryButton({}),
|
|
1992
|
+
responseButtons: primaryButton({})
|
|
1993
|
+
}
|
|
1630
1994
|
};
|
|
1631
1995
|
|
|
1632
1996
|
// src/theme/default-theme-compiler.ts
|
|
1633
|
-
var
|
|
1634
|
-
var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
1997
|
+
var DefaultThemeCompiler = class {
|
|
1635
1998
|
name = "Ispe default theme.";
|
|
1999
|
+
defaultTheme = DefaultTheme;
|
|
2000
|
+
theme2 = Theme2;
|
|
2001
|
+
currentTheme = Theme2;
|
|
2002
|
+
allThemes = [DefaultTheme, Theme2];
|
|
1636
2003
|
TAG = "[ DEFAULT_THEME_COMPILER ]: ";
|
|
2004
|
+
setTheme(theme) {
|
|
2005
|
+
this.currentTheme = theme;
|
|
2006
|
+
}
|
|
1637
2007
|
constructor() {
|
|
1638
|
-
super(DefaultTheme);
|
|
1639
2008
|
}
|
|
1640
2009
|
compileRules(source) {
|
|
1641
2010
|
const builderSchema = BuilderSchema.fromJson(source);
|
|
@@ -1652,13 +2021,36 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1652
2021
|
return pageQueRules;
|
|
1653
2022
|
}
|
|
1654
2023
|
compile(source) {
|
|
1655
|
-
const
|
|
2024
|
+
const t = this.currentTheme;
|
|
2025
|
+
const themeName = t.name;
|
|
2026
|
+
const schema = source.name;
|
|
2027
|
+
const tag = schema + "-" + themeName + " compile";
|
|
2028
|
+
const TAG = tag.toUpperCase();
|
|
2029
|
+
const numberOfPages = source.pages.length;
|
|
2030
|
+
const pages = source.pages.map((p, index) => {
|
|
2031
|
+
return this.compilePage(p, index, numberOfPages, source.prefix);
|
|
2032
|
+
});
|
|
2033
|
+
let baseHeight = source.baseHeight;
|
|
2034
|
+
let baseWidth = source.baseWidth;
|
|
2035
|
+
let backgroundColor = source.backgroundColor;
|
|
2036
|
+
if (t.dimensions.baseHeight) {
|
|
2037
|
+
baseHeight = t.dimensions.baseHeight;
|
|
2038
|
+
}
|
|
2039
|
+
if (t.dimensions.baseWidth) {
|
|
2040
|
+
baseWidth = t.dimensions.baseWidth;
|
|
2041
|
+
}
|
|
2042
|
+
if (t.dimensions.baseWidth) {
|
|
2043
|
+
baseWidth = t.dimensions.baseWidth;
|
|
2044
|
+
}
|
|
2045
|
+
if (t.schemaBackgroundColor) {
|
|
2046
|
+
backgroundColor = t.schemaBackgroundColor;
|
|
2047
|
+
}
|
|
1656
2048
|
const rules = this.compileRules(source);
|
|
1657
2049
|
const dto = {
|
|
1658
|
-
backgroundColor: source.backgroundColor,
|
|
1659
|
-
baseHeight: source.baseHeight,
|
|
1660
|
-
baseWidth: source.baseWidth,
|
|
1661
2050
|
id: source.id,
|
|
2051
|
+
backgroundColor,
|
|
2052
|
+
baseHeight,
|
|
2053
|
+
baseWidth,
|
|
1662
2054
|
pageSequences: [],
|
|
1663
2055
|
pages,
|
|
1664
2056
|
predefinedFacts: [],
|
|
@@ -1666,56 +2058,109 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1666
2058
|
};
|
|
1667
2059
|
return dto;
|
|
1668
2060
|
}
|
|
1669
|
-
compilePage(page, modulePrefix) {
|
|
2061
|
+
compilePage(page, pageIndex, totalNumberOfPages, modulePrefix) {
|
|
2062
|
+
const pageNumber = pageIndex + 1;
|
|
1670
2063
|
const tags = page.tags ?? [];
|
|
1671
2064
|
const { nextButton, mainText, id, mainMedia, _type, prefix } = page;
|
|
1672
|
-
const
|
|
2065
|
+
const t = this.currentTheme;
|
|
2066
|
+
const hasMainMedia = !!mainMedia;
|
|
2067
|
+
const hasMainTextAudio = !!mainText.audioFile;
|
|
2068
|
+
const elements = [];
|
|
1673
2069
|
let initialAudioTasks = [];
|
|
1674
2070
|
let initialVideoTaskList = [];
|
|
1675
2071
|
const newPage = {
|
|
1676
2072
|
background: "white",
|
|
1677
|
-
|
|
1678
|
-
staticElements,
|
|
2073
|
+
elements,
|
|
1679
2074
|
id,
|
|
1680
2075
|
prefix,
|
|
1681
2076
|
initialTasks: [],
|
|
1682
2077
|
tags: [...tags]
|
|
1683
2078
|
};
|
|
2079
|
+
const bg = t.pageBackGround;
|
|
2080
|
+
if (bg) {
|
|
2081
|
+
const pageBackGround = {
|
|
2082
|
+
style: bg.style,
|
|
2083
|
+
_tag: "div",
|
|
2084
|
+
children: []
|
|
2085
|
+
};
|
|
2086
|
+
elements.push(pageBackGround);
|
|
2087
|
+
}
|
|
2088
|
+
const bgArea1 = t.backGroundArea1;
|
|
2089
|
+
if (bgArea1) {
|
|
2090
|
+
const backgroundArea1 = {
|
|
2091
|
+
style: bgArea1.style,
|
|
2092
|
+
_tag: "div",
|
|
2093
|
+
children: []
|
|
2094
|
+
};
|
|
2095
|
+
elements.push(backgroundArea1);
|
|
2096
|
+
}
|
|
2097
|
+
if (t.progressBar) {
|
|
2098
|
+
const progressInPercent = pageNumber / totalNumberOfPages;
|
|
2099
|
+
const baseStyles = {
|
|
2100
|
+
bottom: t.progressBar.bottom,
|
|
2101
|
+
left: t.progressBar.left,
|
|
2102
|
+
height: t.progressBar.height,
|
|
2103
|
+
width: t.progressBar.width
|
|
2104
|
+
};
|
|
2105
|
+
const progressBackGround = {
|
|
2106
|
+
style: {
|
|
2107
|
+
...baseStyles,
|
|
2108
|
+
...t.progressBar.backgroundStyles
|
|
2109
|
+
},
|
|
2110
|
+
_tag: "div",
|
|
2111
|
+
children: []
|
|
2112
|
+
};
|
|
2113
|
+
const currentProgress = t.progressBar.width * progressInPercent;
|
|
2114
|
+
const progressIndicator = {
|
|
2115
|
+
style: { ...baseStyles, ...t.progressBar.progressStyles, w: currentProgress },
|
|
2116
|
+
_tag: "div",
|
|
2117
|
+
children: []
|
|
2118
|
+
};
|
|
2119
|
+
const pText = t.progressBar.text;
|
|
2120
|
+
elements.push(progressBackGround);
|
|
2121
|
+
elements.push(progressIndicator);
|
|
2122
|
+
if (pText) {
|
|
2123
|
+
const progressText = {
|
|
2124
|
+
_tag: "p",
|
|
2125
|
+
innerText: "side " + pageNumber + " av " + totalNumberOfPages,
|
|
2126
|
+
style: pText.style
|
|
2127
|
+
};
|
|
2128
|
+
elements.push(progressText);
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
1684
2131
|
if (page.mainText.audioFile) {
|
|
1685
2132
|
const autoPlay = page.mainText.autoplay;
|
|
1686
2133
|
const autoPlayDelay = page.mainText.autoplayDelay;
|
|
1687
|
-
const res = this.compileMainTextAudio(
|
|
2134
|
+
const res = this.compileMainTextAudio(
|
|
2135
|
+
page.mainText.audioFile,
|
|
2136
|
+
autoPlay,
|
|
2137
|
+
autoPlayDelay,
|
|
2138
|
+
hasMainMedia
|
|
2139
|
+
);
|
|
1688
2140
|
initialAudioTasks = [...res.initialTasks];
|
|
1689
|
-
newPage.
|
|
2141
|
+
newPage.elements.push(...res.components);
|
|
1690
2142
|
}
|
|
1691
2143
|
if (_type === "question") {
|
|
1692
2144
|
const variableId = modulePrefix + "_" + page.prefix;
|
|
1693
|
-
const
|
|
1694
|
-
newPage.
|
|
1695
|
-
newPage.staticElements.push(question);
|
|
2145
|
+
const qRes = this.compileQuestion(id, page, variableId, hasMainMedia);
|
|
2146
|
+
newPage.elements.push(qRes.buttonBar, qRes.question);
|
|
1696
2147
|
}
|
|
1697
2148
|
if (_type === "info-page") {
|
|
1698
2149
|
const infoText = mainText.text;
|
|
1699
|
-
const
|
|
1700
|
-
kind: "next-button"
|
|
1701
|
-
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1704
|
-
innerText: infoText,
|
|
1705
|
-
_tag: "p",
|
|
1706
|
-
style: textStyle
|
|
1707
|
-
};
|
|
1708
|
-
newPage.staticElements.push(infoTextElement);
|
|
1709
|
-
newPage.components.push(nextButtonComponent);
|
|
2150
|
+
const nextButtonBar = this.compileButtonBar([
|
|
2151
|
+
this.compileButton(nextButton, { kind: "next-button" })
|
|
2152
|
+
]);
|
|
2153
|
+
const infoTextElement = this.compileMainText(infoText, hasMainTextAudio, hasMainMedia);
|
|
2154
|
+
newPage.elements.push(infoTextElement, nextButtonBar);
|
|
1710
2155
|
}
|
|
1711
2156
|
if (mainMedia && mainMedia.kind === "main-image") {
|
|
1712
2157
|
const mainImageElement = this.compileImage(mainMedia);
|
|
1713
|
-
newPage.
|
|
2158
|
+
newPage.elements.push(mainImageElement);
|
|
1714
2159
|
}
|
|
1715
2160
|
if (mainMedia && mainMedia.kind === "main-video") {
|
|
1716
2161
|
const videoOutput = this.compileVideo(mainMedia);
|
|
1717
2162
|
newPage.videoPlayer = videoOutput.videoPlayer;
|
|
1718
|
-
newPage.
|
|
2163
|
+
newPage.elements.push(...videoOutput.components);
|
|
1719
2164
|
initialVideoTaskList = [...videoOutput.autoPlayTasks];
|
|
1720
2165
|
}
|
|
1721
2166
|
newPage.initialTasks.push(...initialVideoTaskList);
|
|
@@ -1726,20 +2171,36 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1726
2171
|
compileImage(image) {
|
|
1727
2172
|
const img = {
|
|
1728
2173
|
_tag: "img",
|
|
1729
|
-
style: this.
|
|
2174
|
+
style: this.currentTheme.image.style,
|
|
1730
2175
|
url: image.file.downloadUrl
|
|
1731
2176
|
};
|
|
1732
2177
|
return img;
|
|
1733
2178
|
}
|
|
1734
|
-
|
|
1735
|
-
const t = this.
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
style
|
|
2179
|
+
compileMainText(text, hasAudio, hasMainMedia) {
|
|
2180
|
+
const t = this.currentTheme;
|
|
2181
|
+
const { base, hasMediaNotAudio, notMediaHasAudio, notMediaNotAudio, hasMediaHasAudio } = t.mainText;
|
|
2182
|
+
let style = base.text;
|
|
2183
|
+
if (hasMainMedia && hasAudio)
|
|
2184
|
+
style = { ...style, ...hasMediaHasAudio.text };
|
|
2185
|
+
if (!hasMainMedia && hasAudio)
|
|
2186
|
+
style = { ...style, ...notMediaHasAudio.text };
|
|
2187
|
+
if (hasMainMedia && !hasAudio)
|
|
2188
|
+
style = { ...style, ...hasMediaNotAudio.text };
|
|
2189
|
+
if (!hasMainMedia && !hasAudio)
|
|
2190
|
+
style = { ...style, ...notMediaNotAudio.text };
|
|
2191
|
+
return {
|
|
2192
|
+
_tag: "p",
|
|
2193
|
+
innerText: text,
|
|
2194
|
+
style
|
|
1742
2195
|
};
|
|
2196
|
+
}
|
|
2197
|
+
compileMainTextAudio(audioFile, autoPlay, autoPlayDelay, hasMainMedia) {
|
|
2198
|
+
const t = this.currentTheme.mainText;
|
|
2199
|
+
const audioId = audioFile.id;
|
|
2200
|
+
const iconUrl = this.currentTheme.mainText.base.audio.iconUrl;
|
|
2201
|
+
const baseIconStyles = t.base.audio;
|
|
2202
|
+
const addedStyles = hasMainMedia ? t.hasMediaHasAudio.audio : t.notMediaHasAudio.audio;
|
|
2203
|
+
const audioIconStyle = { ...baseIconStyles.css, ...addedStyles };
|
|
1743
2204
|
const task = {
|
|
1744
2205
|
audioId,
|
|
1745
2206
|
blockAudio: false,
|
|
@@ -1750,6 +2211,12 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1750
2211
|
priority: "replace-all",
|
|
1751
2212
|
url: audioFile.downloadUrl
|
|
1752
2213
|
};
|
|
2214
|
+
const playMainTextAudio = {
|
|
2215
|
+
_tag: "img",
|
|
2216
|
+
url: iconUrl,
|
|
2217
|
+
style: { ...audioIconStyle },
|
|
2218
|
+
onClick: { kind: "play-audio", task }
|
|
2219
|
+
};
|
|
1753
2220
|
let initialAudioTasks = [];
|
|
1754
2221
|
if (autoPlay) {
|
|
1755
2222
|
const playAudioTask = { ...task, priority: "follow-queue" };
|
|
@@ -1767,19 +2234,58 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1767
2234
|
initialAudioTasks = [delayTask, playAudioTask];
|
|
1768
2235
|
}
|
|
1769
2236
|
}
|
|
1770
|
-
|
|
1771
|
-
el: playMainTextAudio,
|
|
1772
|
-
onClick: { kind: "play-audio", task }
|
|
1773
|
-
};
|
|
1774
|
-
return { components: [playBtn], initialTasks: [...initialAudioTasks] };
|
|
2237
|
+
return { components: [playMainTextAudio], initialTasks: [...initialAudioTasks] };
|
|
1775
2238
|
}
|
|
1776
2239
|
compileVideo(video) {
|
|
1777
|
-
const t = this.
|
|
2240
|
+
const t = this.currentTheme.videoPlayer;
|
|
2241
|
+
const hasReplayButton = !!t.replayButton;
|
|
1778
2242
|
const mode = video.mode;
|
|
1779
|
-
const components = [];
|
|
1780
2243
|
let autoPlayTasks = [];
|
|
1781
2244
|
let autoplayVideoTask = false;
|
|
1782
2245
|
let autoplayDelayTask = false;
|
|
2246
|
+
let buttonBar = false;
|
|
2247
|
+
let playButton = false;
|
|
2248
|
+
let playButtonText = false;
|
|
2249
|
+
let replayButton = false;
|
|
2250
|
+
let replayButtonText = false;
|
|
2251
|
+
let pauseButton = false;
|
|
2252
|
+
let pauseButtonText = false;
|
|
2253
|
+
let unmuteButton = false;
|
|
2254
|
+
let unmuteButtonText = false;
|
|
2255
|
+
let muteButton = false;
|
|
2256
|
+
let muteButtonText = false;
|
|
2257
|
+
const showWhenEnded = {
|
|
2258
|
+
whenVideoEnded: { visibility: "visible" },
|
|
2259
|
+
whenVideoEndedAndMuted: { visibility: "visible" },
|
|
2260
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2261
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2262
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2263
|
+
whenVideoPausedAndMuted: { visibility: "hidden" }
|
|
2264
|
+
};
|
|
2265
|
+
const showWhenPlayingOrPaused = {
|
|
2266
|
+
whenVideoEnded: { visibility: "visible" },
|
|
2267
|
+
whenVideoEndedAndMuted: { visibility: "visible" },
|
|
2268
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2269
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2270
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2271
|
+
whenVideoPausedAndMuted: { visibility: "hidden" }
|
|
2272
|
+
};
|
|
2273
|
+
const showWhenPlaying = {
|
|
2274
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2275
|
+
whenVideoEndedAndMuted: { visibility: "hidden" },
|
|
2276
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2277
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2278
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2279
|
+
whenVideoPausedAndMuted: { visibility: "hidden" }
|
|
2280
|
+
};
|
|
2281
|
+
const showWhenPaused = {
|
|
2282
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2283
|
+
whenVideoEndedAndMuted: { visibility: "hidden" },
|
|
2284
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2285
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2286
|
+
whenVideoPaused: { visibility: "visible" },
|
|
2287
|
+
whenVideoPausedAndMuted: { visibility: "visible" }
|
|
2288
|
+
};
|
|
1783
2289
|
const playButtonTask = {
|
|
1784
2290
|
kind: "play-video-task",
|
|
1785
2291
|
url: video.file.downloadUrl,
|
|
@@ -1809,47 +2315,148 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1809
2315
|
}
|
|
1810
2316
|
const videoPlayer = {
|
|
1811
2317
|
playUrl: video.file.downloadUrl,
|
|
1812
|
-
style:
|
|
2318
|
+
style: t.videoElement.css
|
|
2319
|
+
// style: { h: 45, w: 100, x: 0, y: 55 },
|
|
1813
2320
|
};
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
_tag: "
|
|
1817
|
-
|
|
1818
|
-
|
|
2321
|
+
if (t.buttonBar) {
|
|
2322
|
+
buttonBar = {
|
|
2323
|
+
_tag: "div",
|
|
2324
|
+
style: { ...t.buttonBar },
|
|
2325
|
+
children: []
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
playButton = {
|
|
2329
|
+
...showWhenPaused,
|
|
2330
|
+
_tag: "img",
|
|
2331
|
+
url: t.playButton.iconUrl,
|
|
2332
|
+
style: { ...t.playButton.css, ...t.playButton.cssEnabled },
|
|
2333
|
+
// },
|
|
2334
|
+
onClick: { kind: "play-video", task: playButtonTask }
|
|
2335
|
+
};
|
|
2336
|
+
if (t.playButton.text) {
|
|
2337
|
+
playButtonText = {
|
|
2338
|
+
...showWhenPaused,
|
|
2339
|
+
_tag: "p",
|
|
2340
|
+
style: t.playButton.text.css,
|
|
2341
|
+
innerText: t.playButton.text.text
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
pauseButton = {
|
|
2345
|
+
...showWhenPlaying,
|
|
2346
|
+
_tag: "img",
|
|
2347
|
+
style: {
|
|
2348
|
+
...t.pauseButton.css,
|
|
2349
|
+
visibility: "hidden",
|
|
2350
|
+
...t.pauseButton.cssEnabled
|
|
1819
2351
|
},
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
whenVideoPaused: { visibility: "visible" }
|
|
2352
|
+
url: t.pauseButton.iconUrl,
|
|
2353
|
+
onClick: { kind: "pause-video" }
|
|
1823
2354
|
};
|
|
1824
|
-
|
|
1825
|
-
|
|
2355
|
+
if (t.pauseButton.text) {
|
|
2356
|
+
pauseButtonText = {
|
|
2357
|
+
...showWhenPlaying,
|
|
2358
|
+
_tag: "p",
|
|
2359
|
+
style: t.pauseButton.text.css,
|
|
2360
|
+
innerText: t.pauseButton.text.text
|
|
2361
|
+
};
|
|
2362
|
+
}
|
|
2363
|
+
if (t.unMuteButton) {
|
|
2364
|
+
unmuteButton = {
|
|
1826
2365
|
_tag: "img",
|
|
1827
|
-
style: {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
},
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
2366
|
+
style: { ...t.unMuteButton.css },
|
|
2367
|
+
url: t.unMuteButton.iconUrl,
|
|
2368
|
+
onClick: { kind: "un-mute-video" },
|
|
2369
|
+
whenVideoPausedAndMuted: { visibility: "visible" },
|
|
2370
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2371
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2372
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2373
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2374
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2375
|
+
};
|
|
2376
|
+
if (t.unMuteButton.text) {
|
|
2377
|
+
unmuteButtonText = {
|
|
2378
|
+
_tag: "p",
|
|
2379
|
+
style: t.unMuteButton.text.css,
|
|
2380
|
+
innerText: t.unMuteButton.text.text,
|
|
2381
|
+
whenVideoPausedAndMuted: { visibility: "visible" },
|
|
2382
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2383
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2384
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2385
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2386
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
if (t.muteButton) {
|
|
2391
|
+
muteButton = {
|
|
2392
|
+
_tag: "img",
|
|
2393
|
+
style: { ...t.muteButton.css },
|
|
2394
|
+
url: t.muteButton.iconUrl,
|
|
2395
|
+
onClick: { kind: "mute-video" },
|
|
2396
|
+
whenVideoPausedAndMuted: { visibility: "hidden" },
|
|
2397
|
+
whenVideoPaused: { visibility: "visible" },
|
|
2398
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2399
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2400
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2401
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2402
|
+
};
|
|
2403
|
+
if (t.muteButton.text) {
|
|
2404
|
+
muteButtonText = {
|
|
2405
|
+
_tag: "p",
|
|
2406
|
+
style: t.muteButton.text.css,
|
|
2407
|
+
innerText: t.muteButton.text.text,
|
|
2408
|
+
whenVideoPausedAndMuted: { visibility: "hidden" },
|
|
2409
|
+
whenVideoPaused: { visibility: "visible" },
|
|
2410
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2411
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2412
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2413
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
if (t.replayButton) {
|
|
2418
|
+
replayButton = {
|
|
2419
|
+
...showWhenEnded,
|
|
2420
|
+
_tag: "img",
|
|
2421
|
+
style: { ...t.replayButton.css },
|
|
2422
|
+
url: t.replayButton.iconUrl,
|
|
2423
|
+
onClick: { kind: "play-video", task: playButtonTask }
|
|
2424
|
+
};
|
|
2425
|
+
if (t.replayButton.text) {
|
|
2426
|
+
replayButtonText = {
|
|
2427
|
+
...showWhenEnded,
|
|
2428
|
+
_tag: "p",
|
|
2429
|
+
style: t.replayButton.text.css,
|
|
2430
|
+
innerText: t.replayButton.text.text
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
const componentsSet = /* @__PURE__ */ new Set();
|
|
2435
|
+
const addComponent = (maybeComponent) => {
|
|
2436
|
+
if (maybeComponent) {
|
|
2437
|
+
componentsSet.add(maybeComponent);
|
|
2438
|
+
}
|
|
1837
2439
|
};
|
|
1838
2440
|
if (mode !== "gif-mode") {
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
2441
|
+
addComponent(buttonBar);
|
|
2442
|
+
addComponent(unmuteButton);
|
|
2443
|
+
addComponent(unmuteButtonText);
|
|
2444
|
+
addComponent(muteButton);
|
|
2445
|
+
addComponent(muteButtonText);
|
|
2446
|
+
addComponent(playButton);
|
|
2447
|
+
addComponent(playButtonText);
|
|
2448
|
+
addComponent(pauseButton);
|
|
2449
|
+
addComponent(pauseButtonText);
|
|
2450
|
+
addComponent(replayButton);
|
|
2451
|
+
addComponent(replayButtonText);
|
|
2452
|
+
}
|
|
2453
|
+
return { videoPlayer, components: [...componentsSet], autoPlayTasks: [...autoPlayTasks] };
|
|
2454
|
+
}
|
|
2455
|
+
compileQuestion(pageId, page, variableId, hasMainMedia) {
|
|
2456
|
+
const t = this.currentTheme;
|
|
1845
2457
|
const q = page.defaultQuestion;
|
|
1846
2458
|
const text = page.mainText.text;
|
|
1847
|
-
const
|
|
1848
|
-
const question = {
|
|
1849
|
-
_tag: "p",
|
|
1850
|
-
innerText: text,
|
|
1851
|
-
style: questionStyle
|
|
1852
|
-
};
|
|
2459
|
+
const questionElement = this.compileMainText(text, !!page.mainText.audioFile, hasMainMedia);
|
|
1853
2460
|
const buttons = q.options.map((o) => {
|
|
1854
2461
|
const btns = this.compileButton(o, {
|
|
1855
2462
|
kind: "response-button",
|
|
@@ -1858,12 +2465,26 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1858
2465
|
});
|
|
1859
2466
|
return btns;
|
|
1860
2467
|
});
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1863
|
-
|
|
2468
|
+
const buttonBar = this.compileButtonBar(buttons);
|
|
2469
|
+
return {
|
|
2470
|
+
question: questionElement,
|
|
2471
|
+
buttonBar
|
|
2472
|
+
};
|
|
2473
|
+
}
|
|
2474
|
+
compileButtonBar(buttons) {
|
|
2475
|
+
const t = this.currentTheme;
|
|
2476
|
+
const isSingle = buttons.length < 2;
|
|
2477
|
+
const style = isSingle ? { ...t.buttonBar.container.base, ...t.buttonBar.container.whenSingle } : { ...t.buttonBar.container.base, ...t.buttonBar.container.whenMany };
|
|
2478
|
+
const buttonBar = {
|
|
2479
|
+
_tag: "div",
|
|
2480
|
+
children: [...buttons],
|
|
2481
|
+
style
|
|
2482
|
+
};
|
|
2483
|
+
return buttonBar;
|
|
1864
2484
|
}
|
|
1865
2485
|
compileButton(buttonDto, options) {
|
|
1866
2486
|
const { id, value, label } = buttonDto;
|
|
2487
|
+
const t = this.currentTheme;
|
|
1867
2488
|
const onclickAction = options.kind === "response-button" ? {
|
|
1868
2489
|
kind: "submit-fact",
|
|
1869
2490
|
fact: {
|
|
@@ -1874,28 +2495,17 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1874
2495
|
referenceLabel: options.questionText
|
|
1875
2496
|
}
|
|
1876
2497
|
} : { kind: "next-page" };
|
|
1877
|
-
const btnStyles = value === 9 ?
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
children: [
|
|
1881
|
-
{
|
|
1882
|
-
_tag: "p",
|
|
1883
|
-
innerText: label,
|
|
1884
|
-
style: btnStyles.text1
|
|
1885
|
-
}
|
|
1886
|
-
],
|
|
1887
|
-
style: { ...btnStyles.btn.css, ...btnStyles.btn.cssEnabled }
|
|
1888
|
-
};
|
|
1889
|
-
if (options.kind === "next-button") {
|
|
1890
|
-
btn.style.x = 50;
|
|
1891
|
-
btn.style.y = 8;
|
|
1892
|
-
btn.style.transform = "translate(-50%, 0%)";
|
|
2498
|
+
const btnStyles = value === 9 ? t.buttonBar.responseButtons.dontKnow : t.buttonBar.responseButtons.normal;
|
|
2499
|
+
if (t.buttonBar.vibrateMs) {
|
|
2500
|
+
onclickAction.vibrateMs = t.buttonBar.vibrateMs;
|
|
1893
2501
|
}
|
|
1894
|
-
const
|
|
1895
|
-
|
|
2502
|
+
const btn = {
|
|
2503
|
+
_tag: "button",
|
|
2504
|
+
innerText: label,
|
|
2505
|
+
style: { ...btnStyles.btn.css, ...btnStyles.btn.cssEnabled },
|
|
1896
2506
|
onClick: onclickAction
|
|
1897
2507
|
};
|
|
1898
|
-
return
|
|
2508
|
+
return btn;
|
|
1899
2509
|
}
|
|
1900
2510
|
};
|
|
1901
2511
|
|
|
@@ -2331,6 +2941,7 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
2331
2941
|
this._pageCollection = BuilderPageCollection.create([]);
|
|
2332
2942
|
}
|
|
2333
2943
|
prefix;
|
|
2944
|
+
compiler = new DefaultThemeCompiler();
|
|
2334
2945
|
baseHeight = 1300;
|
|
2335
2946
|
baseWidth = 1024;
|
|
2336
2947
|
backgroundColor = "#000000";
|
|
@@ -2526,9 +3137,8 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
2526
3137
|
}
|
|
2527
3138
|
});
|
|
2528
3139
|
const moduleDto = builderSchema.toJson();
|
|
2529
|
-
const imp = new DefaultThemeCompiler();
|
|
2530
3140
|
const codebook = CodeBook.fromSchema(moduleDto);
|
|
2531
|
-
const schema =
|
|
3141
|
+
const schema = this.compiler.compile(moduleDto);
|
|
2532
3142
|
const schemaConfig = SchemaConfig.fromSchema(moduleDto);
|
|
2533
3143
|
const output = { codebook, schema, schemaConfig };
|
|
2534
3144
|
return output;
|
|
@@ -2716,6 +3326,7 @@ var SumScore = {
|
|
|
2716
3326
|
BuilderTag,
|
|
2717
3327
|
BuilderText,
|
|
2718
3328
|
CodeBook,
|
|
3329
|
+
DefaultTheme,
|
|
2719
3330
|
ExcludeByPageIdSelectItem,
|
|
2720
3331
|
ExcludeByTagSelectItem,
|
|
2721
3332
|
JumpToActionManager,
|