@media-quest/builder 0.0.30 → 0.0.32
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 +862 -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 +377 -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,491 @@ 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
|
+
margin: { _unit: "px", value: 0 }
|
|
1728
|
+
// backgroundColor: Colors.yellow,
|
|
1729
|
+
};
|
|
1730
|
+
var muteUnmuteText = { ...btnTextBase, right: VIDEO_CONTROLS_RIGHT };
|
|
1731
|
+
var playPauseText = { ...btnTextBase, left: VIDEO_CONTROLS_LEFT };
|
|
1732
|
+
var replayText = {
|
|
1733
|
+
...btnTextBase,
|
|
1734
|
+
width: VIDEO_CONTROLS_WIDTH,
|
|
1735
|
+
left: VIDEO_CONTROLS_LEFT,
|
|
1736
|
+
// backgroundColor: Colors.yellow,
|
|
1737
|
+
visibility: "hidden"
|
|
1738
|
+
};
|
|
1739
|
+
var playPauseBase = {
|
|
1740
|
+
css: {
|
|
1741
|
+
width: VIDEO_BUTTONS_WIDTH,
|
|
1742
|
+
height: VIDEO_BUTTONS_HEIGHT,
|
|
1743
|
+
top: MEDIA_BOTTOM,
|
|
1744
|
+
left: VIDEO_CONTROLS_LEFT + W_M4,
|
|
1745
|
+
zIndex: LAYER_5,
|
|
1746
|
+
visibility: "hidden"
|
|
1747
|
+
},
|
|
1748
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1749
|
+
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1750
|
+
};
|
|
1751
|
+
var replayButtonStyles = {
|
|
1752
|
+
width: VIDEO_BUTTONS_WIDTH,
|
|
1753
|
+
height: VIDEO_BUTTONS_HEIGHT,
|
|
1754
|
+
top: MEDIA_BOTTOM,
|
|
1755
|
+
// backgroundColor: "red",
|
|
1756
|
+
left: VIDEO_CONTROLS_LEFT + VIDEO_CONTROLS_WIDTH / 2,
|
|
1757
|
+
transform: translateX50,
|
|
1758
|
+
zIndex: LAYER_5,
|
|
1759
|
+
visibility: "hidden",
|
|
1760
|
+
cursor: "pointer"
|
|
1761
|
+
};
|
|
1762
|
+
var muteUnMuteStyles = {
|
|
1763
|
+
css: {
|
|
1764
|
+
width: VIDEO_BUTTONS_WIDTH,
|
|
1765
|
+
height: VIDEO_BUTTONS_HEIGHT,
|
|
1766
|
+
top: MEDIA_BOTTOM,
|
|
1767
|
+
right: VIDEO_CONTROLS_RIGHT + W_M4,
|
|
1768
|
+
zIndex: LAYER_5,
|
|
1769
|
+
cursor: "pointer"
|
|
1770
|
+
// transform: "translateX: 100%",
|
|
1771
|
+
},
|
|
1772
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1773
|
+
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1774
|
+
};
|
|
1775
|
+
var buttonBaseCss = () => ({
|
|
1776
|
+
css: {
|
|
1777
|
+
backgroundColor: Colors.primary,
|
|
1778
|
+
borderColor: Colors.primary,
|
|
1779
|
+
textColor: Colors.white,
|
|
1780
|
+
fontWeight: 600,
|
|
1781
|
+
fontSize: { _unit: "px", value: 35 },
|
|
1782
|
+
lineHeight: 1,
|
|
1783
|
+
// letterSpacing: { _unit: "px", value: 2 },
|
|
1784
|
+
paddingLeft: { _unit: "px", value: 30 },
|
|
1785
|
+
paddingTop: { _unit: "px", value: 10 },
|
|
1786
|
+
paddingBottom: { _unit: "px", value: 10 },
|
|
1787
|
+
paddingRight: { _unit: "px", value: 30 },
|
|
1788
|
+
borderRadius: { _unit: "px", value: 20 },
|
|
1789
|
+
borderStyle: "solid",
|
|
1790
|
+
boxShadow: "3px 3px gray",
|
|
1791
|
+
position: "relative",
|
|
1792
|
+
display: "block",
|
|
1793
|
+
cursor: "pointer"
|
|
1794
|
+
},
|
|
1795
|
+
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1796
|
+
cssEnabled: { opacity: 1, cursor: "pointer" }
|
|
1797
|
+
});
|
|
1798
|
+
var primaryButton = (overridesCss) => {
|
|
1799
|
+
const base = buttonBaseCss();
|
|
1800
|
+
const optionTheme = {
|
|
1801
|
+
name: "primary-button",
|
|
1802
|
+
normal: {
|
|
1803
|
+
btn: {
|
|
1804
|
+
css: {
|
|
1805
|
+
...base.css,
|
|
1806
|
+
...overridesCss,
|
|
1807
|
+
backgroundColor: Colors.primary,
|
|
1808
|
+
borderColor: Colors.primary,
|
|
1809
|
+
textColor: Colors.white
|
|
1810
|
+
},
|
|
1811
|
+
cssDisabled: base.cssDisabled,
|
|
1812
|
+
cssEnabled: base.cssEnabled
|
|
1813
|
+
},
|
|
1814
|
+
divider: {},
|
|
1815
|
+
text1: {},
|
|
1816
|
+
text2: {}
|
|
1817
|
+
},
|
|
1818
|
+
dontKnow: {
|
|
1819
|
+
btn: {
|
|
1602
1820
|
css: {
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
textColor: "black",
|
|
1608
|
-
fontSize: { _unit: "px", value: 30 }
|
|
1821
|
+
...base.css,
|
|
1822
|
+
backgroundColor: Colors.secondary,
|
|
1823
|
+
borderColor: Colors.secondary,
|
|
1824
|
+
textColor: Colors.primary
|
|
1609
1825
|
},
|
|
1610
|
-
|
|
1611
|
-
|
|
1826
|
+
cssEnabled: base.cssEnabled,
|
|
1827
|
+
cssDisabled: base.cssDisabled
|
|
1828
|
+
},
|
|
1829
|
+
text1: {},
|
|
1830
|
+
text2: {},
|
|
1831
|
+
divider: {}
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
return optionTheme;
|
|
1835
|
+
};
|
|
1836
|
+
var Theme2 = {
|
|
1837
|
+
name: "theme2",
|
|
1838
|
+
schemaBackgroundColor: Colors.white,
|
|
1839
|
+
dimensions: { baseHeight: 1300, baseWidth: 1024 },
|
|
1840
|
+
pageBackGround: {
|
|
1841
|
+
style: {
|
|
1842
|
+
height: PAGE_BACKGROUND_HEIGHT,
|
|
1843
|
+
width: W_MAX,
|
|
1844
|
+
bottom: PAGE_BACKGROUND_BOTTOM,
|
|
1845
|
+
left: W_M1,
|
|
1846
|
+
backgroundColor: Colors.backgroundGray
|
|
1847
|
+
}
|
|
1848
|
+
},
|
|
1849
|
+
backGroundArea1: {
|
|
1850
|
+
style: {
|
|
1851
|
+
height: Q_AREA_HEIGHT,
|
|
1852
|
+
width: Q_AREA_WIDTH,
|
|
1853
|
+
left: Q_AREA_LEFT,
|
|
1854
|
+
bottom: Q_AREA_BOTTOM,
|
|
1855
|
+
backgroundColor: Colors.white
|
|
1856
|
+
}
|
|
1857
|
+
},
|
|
1858
|
+
progressBar: {
|
|
1859
|
+
width: W_MAX,
|
|
1860
|
+
height: PROGRESS_BAR_HEIGHT,
|
|
1861
|
+
bottom: H_M1,
|
|
1862
|
+
left: W_M1,
|
|
1863
|
+
backgroundStyles: {
|
|
1864
|
+
backgroundColor: Colors.backgroundGray,
|
|
1865
|
+
borderRadius: { _unit: "px", value: 10 }
|
|
1866
|
+
},
|
|
1867
|
+
progressStyles: {
|
|
1868
|
+
backgroundColor: Colors.primary,
|
|
1869
|
+
borderRadius: { _unit: "px", value: 10 }
|
|
1870
|
+
},
|
|
1871
|
+
text: {
|
|
1872
|
+
textType: "page-progress",
|
|
1873
|
+
style: { fontSize: { _unit: "px", value: 20 }, x: 81.5, y: 2.5 }
|
|
1874
|
+
}
|
|
1875
|
+
},
|
|
1876
|
+
videoPlayer: {
|
|
1877
|
+
playButton: {
|
|
1878
|
+
text: { text: "Spill av", css: { ...playPauseText } },
|
|
1879
|
+
iconUrl: THEME_2_ICONS.videoPlay.dataUrl,
|
|
1880
|
+
...playPauseBase
|
|
1881
|
+
},
|
|
1882
|
+
pauseButton: {
|
|
1883
|
+
text: { text: "Pause", css: { ...playPauseText } },
|
|
1884
|
+
iconUrl: THEME_2_ICONS.videoPause.dataUrl,
|
|
1885
|
+
...playPauseBase
|
|
1886
|
+
},
|
|
1887
|
+
buttonBar: {
|
|
1888
|
+
width: VIDEO_CONTROLS_WIDTH,
|
|
1889
|
+
zIndex: LAYER_4,
|
|
1890
|
+
top: VIDEO_CONTROLS_TOP,
|
|
1891
|
+
left: VIDEO_CONTROLS_LEFT,
|
|
1892
|
+
backgroundColor: Colors.white,
|
|
1893
|
+
height: VIDEO_CONTROLS_HEIGHT,
|
|
1894
|
+
borderRadius: { _unit: "px", value: 16 }
|
|
1895
|
+
},
|
|
1896
|
+
muteButton: {
|
|
1897
|
+
text: { text: "Lyd av", css: { ...muteUnmuteText } },
|
|
1898
|
+
iconUrl: THEME_2_ICONS.mute.dataUrl,
|
|
1899
|
+
css: muteUnMuteStyles.css
|
|
1900
|
+
},
|
|
1901
|
+
unMuteButton: {
|
|
1902
|
+
iconUrl: THEME_2_ICONS.unMute.dataUrl,
|
|
1903
|
+
css: muteUnMuteStyles.css,
|
|
1904
|
+
text: { text: "Lyd p\xE5", css: { ...muteUnmuteText } }
|
|
1905
|
+
},
|
|
1906
|
+
replayButton: {
|
|
1907
|
+
css: replayButtonStyles,
|
|
1908
|
+
cssDisabled: {},
|
|
1909
|
+
cssEnabled: {},
|
|
1910
|
+
iconUrl: THEME_2_ICONS.videoReplay.dataUrl,
|
|
1911
|
+
text: { text: "Spill av p\xE5 nytt", css: replayText }
|
|
1912
|
+
},
|
|
1913
|
+
videoElement: {
|
|
1914
|
+
css: {
|
|
1915
|
+
height: MEDIA_HEIGHT,
|
|
1916
|
+
top: MEDIA_TOP,
|
|
1917
|
+
transform: translateX50,
|
|
1918
|
+
left: 50,
|
|
1919
|
+
width: 100,
|
|
1920
|
+
zIndex: LAYER_2,
|
|
1921
|
+
visibility: "visible"
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
},
|
|
1925
|
+
image: {
|
|
1926
|
+
style: {
|
|
1927
|
+
height: MEDIA_HEIGHT,
|
|
1928
|
+
// Center image, with dynamic width.
|
|
1929
|
+
left: 50,
|
|
1930
|
+
transform: translateX50,
|
|
1931
|
+
top: MEDIA_TOP,
|
|
1932
|
+
boxShadow: "3px 3px"
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
mainText: {
|
|
1936
|
+
base: {
|
|
1937
|
+
text: {
|
|
1938
|
+
width: MAIN_TEXT_WIDE,
|
|
1939
|
+
left: W_M1 + W_M2 + W_M3,
|
|
1940
|
+
top: Q_AREA_TOP + H_M3,
|
|
1941
|
+
backgroundColor: Colors.white,
|
|
1942
|
+
textAlign: "left",
|
|
1943
|
+
textColor: "black",
|
|
1944
|
+
fontSize: { _unit: "px", value: 35 },
|
|
1945
|
+
lineHeight: 1.2
|
|
1612
1946
|
},
|
|
1613
1947
|
audio: {
|
|
1948
|
+
iconUrl: THEME_2_ICONS.audioPlay.dataUrl,
|
|
1614
1949
|
css: {
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1950
|
+
height: AUDIO_ICON_HEIGHT,
|
|
1951
|
+
width: AUDIO_ICON_WIDTH,
|
|
1952
|
+
top: Q_AREA_TOP + H_M3,
|
|
1953
|
+
left: W_M1 + W_M2 + W_M3,
|
|
1619
1954
|
cursor: "pointer",
|
|
1955
|
+
// transform: "translateY(100%)",
|
|
1620
1956
|
opacity: 0.8,
|
|
1621
1957
|
visibility: "visible"
|
|
1958
|
+
// backgroundColor: "green",
|
|
1622
1959
|
},
|
|
1623
1960
|
cssDisabled: { opacity: 0.3, cursor: "not-allowed" },
|
|
1624
1961
|
cssEnabled: { opacity: 0.8, cursor: "pointer" }
|
|
1625
1962
|
}
|
|
1626
|
-
}
|
|
1963
|
+
},
|
|
1964
|
+
notMediaHasAudio: {
|
|
1965
|
+
text: { width: MAIN_TEXT_NARROW, left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3 },
|
|
1966
|
+
audio: {}
|
|
1967
|
+
},
|
|
1968
|
+
hasMediaHasAudio: {
|
|
1969
|
+
text: {
|
|
1970
|
+
width: MAIN_TEXT_NARROW,
|
|
1971
|
+
left: W_M1 + W_M2 + W_M3 + AUDIO_ICON_WIDTH + W_M3
|
|
1972
|
+
},
|
|
1973
|
+
audio: {}
|
|
1974
|
+
},
|
|
1975
|
+
notMediaNotAudio: { text: {} },
|
|
1976
|
+
hasMediaNotAudio: { text: {} }
|
|
1627
1977
|
},
|
|
1628
|
-
|
|
1629
|
-
|
|
1978
|
+
buttonBar: {
|
|
1979
|
+
vibrateMs: 60,
|
|
1980
|
+
container: {
|
|
1981
|
+
base: {
|
|
1982
|
+
display: "flex",
|
|
1983
|
+
justifyContent: "space-evenly",
|
|
1984
|
+
width: BUTTON_BAR_WIDTH,
|
|
1985
|
+
bottom: Q_AREA_BOTTOM + H_M3,
|
|
1986
|
+
left: Q_AREA_LEFT + W_M3,
|
|
1987
|
+
// backgroundColor: "green",
|
|
1988
|
+
gap: { _unit: "px", value: 20 },
|
|
1989
|
+
alignItems: "center"
|
|
1990
|
+
},
|
|
1991
|
+
whenSingle: { justifyContent: "space-evenly" },
|
|
1992
|
+
whenMany: { justifyContent: "flex-start" }
|
|
1993
|
+
},
|
|
1994
|
+
nextButtonTheme: primaryButton({}),
|
|
1995
|
+
responseButtons: primaryButton({})
|
|
1996
|
+
}
|
|
1630
1997
|
};
|
|
1631
1998
|
|
|
1632
1999
|
// src/theme/default-theme-compiler.ts
|
|
1633
|
-
var
|
|
1634
|
-
var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
2000
|
+
var DefaultThemeCompiler = class {
|
|
1635
2001
|
name = "Ispe default theme.";
|
|
2002
|
+
defaultTheme = DefaultTheme;
|
|
2003
|
+
theme2 = Theme2;
|
|
2004
|
+
currentTheme = Theme2;
|
|
2005
|
+
allThemes = [DefaultTheme, Theme2];
|
|
1636
2006
|
TAG = "[ DEFAULT_THEME_COMPILER ]: ";
|
|
2007
|
+
setTheme(theme) {
|
|
2008
|
+
this.currentTheme = theme;
|
|
2009
|
+
}
|
|
1637
2010
|
constructor() {
|
|
1638
|
-
super(DefaultTheme);
|
|
1639
2011
|
}
|
|
1640
2012
|
compileRules(source) {
|
|
1641
2013
|
const builderSchema = BuilderSchema.fromJson(source);
|
|
@@ -1652,13 +2024,36 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1652
2024
|
return pageQueRules;
|
|
1653
2025
|
}
|
|
1654
2026
|
compile(source) {
|
|
1655
|
-
const
|
|
2027
|
+
const t = this.currentTheme;
|
|
2028
|
+
const themeName = t.name;
|
|
2029
|
+
const schema = source.name;
|
|
2030
|
+
const tag = schema + "-" + themeName + " compile";
|
|
2031
|
+
const TAG = tag.toUpperCase();
|
|
2032
|
+
const numberOfPages = source.pages.length;
|
|
2033
|
+
const pages = source.pages.map((p, index) => {
|
|
2034
|
+
return this.compilePage(p, index, numberOfPages, source.prefix);
|
|
2035
|
+
});
|
|
2036
|
+
let baseHeight = source.baseHeight;
|
|
2037
|
+
let baseWidth = source.baseWidth;
|
|
2038
|
+
let backgroundColor = source.backgroundColor;
|
|
2039
|
+
if (t.dimensions.baseHeight) {
|
|
2040
|
+
baseHeight = t.dimensions.baseHeight;
|
|
2041
|
+
}
|
|
2042
|
+
if (t.dimensions.baseWidth) {
|
|
2043
|
+
baseWidth = t.dimensions.baseWidth;
|
|
2044
|
+
}
|
|
2045
|
+
if (t.dimensions.baseWidth) {
|
|
2046
|
+
baseWidth = t.dimensions.baseWidth;
|
|
2047
|
+
}
|
|
2048
|
+
if (t.schemaBackgroundColor) {
|
|
2049
|
+
backgroundColor = t.schemaBackgroundColor;
|
|
2050
|
+
}
|
|
1656
2051
|
const rules = this.compileRules(source);
|
|
1657
2052
|
const dto = {
|
|
1658
|
-
backgroundColor: source.backgroundColor,
|
|
1659
|
-
baseHeight: source.baseHeight,
|
|
1660
|
-
baseWidth: source.baseWidth,
|
|
1661
2053
|
id: source.id,
|
|
2054
|
+
backgroundColor,
|
|
2055
|
+
baseHeight,
|
|
2056
|
+
baseWidth,
|
|
1662
2057
|
pageSequences: [],
|
|
1663
2058
|
pages,
|
|
1664
2059
|
predefinedFacts: [],
|
|
@@ -1666,56 +2061,109 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1666
2061
|
};
|
|
1667
2062
|
return dto;
|
|
1668
2063
|
}
|
|
1669
|
-
compilePage(page, modulePrefix) {
|
|
2064
|
+
compilePage(page, pageIndex, totalNumberOfPages, modulePrefix) {
|
|
2065
|
+
const pageNumber = pageIndex + 1;
|
|
1670
2066
|
const tags = page.tags ?? [];
|
|
1671
2067
|
const { nextButton, mainText, id, mainMedia, _type, prefix } = page;
|
|
1672
|
-
const
|
|
2068
|
+
const t = this.currentTheme;
|
|
2069
|
+
const hasMainMedia = !!mainMedia;
|
|
2070
|
+
const hasMainTextAudio = !!mainText.audioFile;
|
|
2071
|
+
const elements = [];
|
|
1673
2072
|
let initialAudioTasks = [];
|
|
1674
2073
|
let initialVideoTaskList = [];
|
|
1675
2074
|
const newPage = {
|
|
1676
2075
|
background: "white",
|
|
1677
|
-
|
|
1678
|
-
staticElements,
|
|
2076
|
+
elements,
|
|
1679
2077
|
id,
|
|
1680
2078
|
prefix,
|
|
1681
2079
|
initialTasks: [],
|
|
1682
2080
|
tags: [...tags]
|
|
1683
2081
|
};
|
|
2082
|
+
const bg = t.pageBackGround;
|
|
2083
|
+
if (bg) {
|
|
2084
|
+
const pageBackGround = {
|
|
2085
|
+
style: bg.style,
|
|
2086
|
+
_tag: "div",
|
|
2087
|
+
children: []
|
|
2088
|
+
};
|
|
2089
|
+
elements.push(pageBackGround);
|
|
2090
|
+
}
|
|
2091
|
+
const bgArea1 = t.backGroundArea1;
|
|
2092
|
+
if (bgArea1) {
|
|
2093
|
+
const backgroundArea1 = {
|
|
2094
|
+
style: bgArea1.style,
|
|
2095
|
+
_tag: "div",
|
|
2096
|
+
children: []
|
|
2097
|
+
};
|
|
2098
|
+
elements.push(backgroundArea1);
|
|
2099
|
+
}
|
|
2100
|
+
if (t.progressBar) {
|
|
2101
|
+
const progressInPercent = pageNumber / totalNumberOfPages;
|
|
2102
|
+
const baseStyles = {
|
|
2103
|
+
bottom: t.progressBar.bottom,
|
|
2104
|
+
left: t.progressBar.left,
|
|
2105
|
+
height: t.progressBar.height,
|
|
2106
|
+
width: t.progressBar.width
|
|
2107
|
+
};
|
|
2108
|
+
const progressBackGround = {
|
|
2109
|
+
style: {
|
|
2110
|
+
...baseStyles,
|
|
2111
|
+
...t.progressBar.backgroundStyles
|
|
2112
|
+
},
|
|
2113
|
+
_tag: "div",
|
|
2114
|
+
children: []
|
|
2115
|
+
};
|
|
2116
|
+
const currentProgress = t.progressBar.width * progressInPercent;
|
|
2117
|
+
const progressIndicator = {
|
|
2118
|
+
style: { ...baseStyles, ...t.progressBar.progressStyles, w: currentProgress },
|
|
2119
|
+
_tag: "div",
|
|
2120
|
+
children: []
|
|
2121
|
+
};
|
|
2122
|
+
const pText = t.progressBar.text;
|
|
2123
|
+
elements.push(progressBackGround);
|
|
2124
|
+
elements.push(progressIndicator);
|
|
2125
|
+
if (pText) {
|
|
2126
|
+
const progressText = {
|
|
2127
|
+
_tag: "p",
|
|
2128
|
+
innerText: "side " + pageNumber + " av " + totalNumberOfPages,
|
|
2129
|
+
style: pText.style
|
|
2130
|
+
};
|
|
2131
|
+
elements.push(progressText);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
1684
2134
|
if (page.mainText.audioFile) {
|
|
1685
2135
|
const autoPlay = page.mainText.autoplay;
|
|
1686
2136
|
const autoPlayDelay = page.mainText.autoplayDelay;
|
|
1687
|
-
const res = this.compileMainTextAudio(
|
|
2137
|
+
const res = this.compileMainTextAudio(
|
|
2138
|
+
page.mainText.audioFile,
|
|
2139
|
+
autoPlay,
|
|
2140
|
+
autoPlayDelay,
|
|
2141
|
+
hasMainMedia
|
|
2142
|
+
);
|
|
1688
2143
|
initialAudioTasks = [...res.initialTasks];
|
|
1689
|
-
newPage.
|
|
2144
|
+
newPage.elements.push(...res.components);
|
|
1690
2145
|
}
|
|
1691
2146
|
if (_type === "question") {
|
|
1692
2147
|
const variableId = modulePrefix + "_" + page.prefix;
|
|
1693
|
-
const
|
|
1694
|
-
newPage.
|
|
1695
|
-
newPage.staticElements.push(question);
|
|
2148
|
+
const qRes = this.compileQuestion(id, page, variableId, hasMainMedia);
|
|
2149
|
+
newPage.elements.push(qRes.buttonBar, qRes.question);
|
|
1696
2150
|
}
|
|
1697
2151
|
if (_type === "info-page") {
|
|
1698
2152
|
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);
|
|
2153
|
+
const nextButtonBar = this.compileButtonBar([
|
|
2154
|
+
this.compileButton(nextButton, { kind: "next-button" })
|
|
2155
|
+
]);
|
|
2156
|
+
const infoTextElement = this.compileMainText(infoText, hasMainTextAudio, hasMainMedia);
|
|
2157
|
+
newPage.elements.push(infoTextElement, nextButtonBar);
|
|
1710
2158
|
}
|
|
1711
2159
|
if (mainMedia && mainMedia.kind === "main-image") {
|
|
1712
2160
|
const mainImageElement = this.compileImage(mainMedia);
|
|
1713
|
-
newPage.
|
|
2161
|
+
newPage.elements.push(mainImageElement);
|
|
1714
2162
|
}
|
|
1715
2163
|
if (mainMedia && mainMedia.kind === "main-video") {
|
|
1716
2164
|
const videoOutput = this.compileVideo(mainMedia);
|
|
1717
2165
|
newPage.videoPlayer = videoOutput.videoPlayer;
|
|
1718
|
-
newPage.
|
|
2166
|
+
newPage.elements.push(...videoOutput.components);
|
|
1719
2167
|
initialVideoTaskList = [...videoOutput.autoPlayTasks];
|
|
1720
2168
|
}
|
|
1721
2169
|
newPage.initialTasks.push(...initialVideoTaskList);
|
|
@@ -1726,20 +2174,36 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1726
2174
|
compileImage(image) {
|
|
1727
2175
|
const img = {
|
|
1728
2176
|
_tag: "img",
|
|
1729
|
-
style: this.
|
|
2177
|
+
style: this.currentTheme.image.style,
|
|
1730
2178
|
url: image.file.downloadUrl
|
|
1731
2179
|
};
|
|
1732
2180
|
return img;
|
|
1733
2181
|
}
|
|
1734
|
-
|
|
1735
|
-
const t = this.
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
style
|
|
2182
|
+
compileMainText(text, hasAudio, hasMainMedia) {
|
|
2183
|
+
const t = this.currentTheme;
|
|
2184
|
+
const { base, hasMediaNotAudio, notMediaHasAudio, notMediaNotAudio, hasMediaHasAudio } = t.mainText;
|
|
2185
|
+
let style = base.text;
|
|
2186
|
+
if (hasMainMedia && hasAudio)
|
|
2187
|
+
style = { ...style, ...hasMediaHasAudio.text };
|
|
2188
|
+
if (!hasMainMedia && hasAudio)
|
|
2189
|
+
style = { ...style, ...notMediaHasAudio.text };
|
|
2190
|
+
if (hasMainMedia && !hasAudio)
|
|
2191
|
+
style = { ...style, ...hasMediaNotAudio.text };
|
|
2192
|
+
if (!hasMainMedia && !hasAudio)
|
|
2193
|
+
style = { ...style, ...notMediaNotAudio.text };
|
|
2194
|
+
return {
|
|
2195
|
+
_tag: "p",
|
|
2196
|
+
innerText: text,
|
|
2197
|
+
style
|
|
1742
2198
|
};
|
|
2199
|
+
}
|
|
2200
|
+
compileMainTextAudio(audioFile, autoPlay, autoPlayDelay, hasMainMedia) {
|
|
2201
|
+
const t = this.currentTheme.mainText;
|
|
2202
|
+
const audioId = audioFile.id;
|
|
2203
|
+
const iconUrl = this.currentTheme.mainText.base.audio.iconUrl;
|
|
2204
|
+
const baseIconStyles = t.base.audio;
|
|
2205
|
+
const addedStyles = hasMainMedia ? t.hasMediaHasAudio.audio : t.notMediaHasAudio.audio;
|
|
2206
|
+
const audioIconStyle = { ...baseIconStyles.css, ...addedStyles };
|
|
1743
2207
|
const task = {
|
|
1744
2208
|
audioId,
|
|
1745
2209
|
blockAudio: false,
|
|
@@ -1750,6 +2214,12 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1750
2214
|
priority: "replace-all",
|
|
1751
2215
|
url: audioFile.downloadUrl
|
|
1752
2216
|
};
|
|
2217
|
+
const playMainTextAudio = {
|
|
2218
|
+
_tag: "img",
|
|
2219
|
+
url: iconUrl,
|
|
2220
|
+
style: { ...audioIconStyle },
|
|
2221
|
+
onClick: { kind: "play-audio", task }
|
|
2222
|
+
};
|
|
1753
2223
|
let initialAudioTasks = [];
|
|
1754
2224
|
if (autoPlay) {
|
|
1755
2225
|
const playAudioTask = { ...task, priority: "follow-queue" };
|
|
@@ -1767,19 +2237,58 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1767
2237
|
initialAudioTasks = [delayTask, playAudioTask];
|
|
1768
2238
|
}
|
|
1769
2239
|
}
|
|
1770
|
-
|
|
1771
|
-
el: playMainTextAudio,
|
|
1772
|
-
onClick: { kind: "play-audio", task }
|
|
1773
|
-
};
|
|
1774
|
-
return { components: [playBtn], initialTasks: [...initialAudioTasks] };
|
|
2240
|
+
return { components: [playMainTextAudio], initialTasks: [...initialAudioTasks] };
|
|
1775
2241
|
}
|
|
1776
2242
|
compileVideo(video) {
|
|
1777
|
-
const t = this.
|
|
2243
|
+
const t = this.currentTheme.videoPlayer;
|
|
2244
|
+
const hasReplayButton = !!t.replayButton;
|
|
1778
2245
|
const mode = video.mode;
|
|
1779
|
-
const components = [];
|
|
1780
2246
|
let autoPlayTasks = [];
|
|
1781
2247
|
let autoplayVideoTask = false;
|
|
1782
2248
|
let autoplayDelayTask = false;
|
|
2249
|
+
let buttonBar = false;
|
|
2250
|
+
let playButton = false;
|
|
2251
|
+
let playButtonText = false;
|
|
2252
|
+
let replayButton = false;
|
|
2253
|
+
let replayButtonText = false;
|
|
2254
|
+
let pauseButton = false;
|
|
2255
|
+
let pauseButtonText = false;
|
|
2256
|
+
let unmuteButton = false;
|
|
2257
|
+
let unmuteButtonText = false;
|
|
2258
|
+
let muteButton = false;
|
|
2259
|
+
let muteButtonText = false;
|
|
2260
|
+
const showWhenEnded = {
|
|
2261
|
+
whenVideoEnded: { visibility: "visible" },
|
|
2262
|
+
whenVideoEndedAndMuted: { visibility: "visible" },
|
|
2263
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2264
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2265
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2266
|
+
whenVideoPausedAndMuted: { visibility: "hidden" }
|
|
2267
|
+
};
|
|
2268
|
+
const showWhenPlayingOrPaused = {
|
|
2269
|
+
whenVideoEnded: { visibility: "visible" },
|
|
2270
|
+
whenVideoEndedAndMuted: { visibility: "visible" },
|
|
2271
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2272
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2273
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2274
|
+
whenVideoPausedAndMuted: { visibility: "hidden" }
|
|
2275
|
+
};
|
|
2276
|
+
const showWhenPlaying = {
|
|
2277
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2278
|
+
whenVideoEndedAndMuted: { visibility: "hidden" },
|
|
2279
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2280
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2281
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2282
|
+
whenVideoPausedAndMuted: { visibility: "hidden" }
|
|
2283
|
+
};
|
|
2284
|
+
const showWhenPaused = {
|
|
2285
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2286
|
+
whenVideoEndedAndMuted: { visibility: "hidden" },
|
|
2287
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2288
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2289
|
+
whenVideoPaused: { visibility: "visible" },
|
|
2290
|
+
whenVideoPausedAndMuted: { visibility: "visible" }
|
|
2291
|
+
};
|
|
1783
2292
|
const playButtonTask = {
|
|
1784
2293
|
kind: "play-video-task",
|
|
1785
2294
|
url: video.file.downloadUrl,
|
|
@@ -1809,47 +2318,148 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1809
2318
|
}
|
|
1810
2319
|
const videoPlayer = {
|
|
1811
2320
|
playUrl: video.file.downloadUrl,
|
|
1812
|
-
style:
|
|
2321
|
+
style: t.videoElement.css
|
|
2322
|
+
// style: { h: 45, w: 100, x: 0, y: 55 },
|
|
1813
2323
|
};
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
_tag: "
|
|
1817
|
-
|
|
1818
|
-
|
|
2324
|
+
if (t.buttonBar) {
|
|
2325
|
+
buttonBar = {
|
|
2326
|
+
_tag: "div",
|
|
2327
|
+
style: { ...t.buttonBar },
|
|
2328
|
+
children: []
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
playButton = {
|
|
2332
|
+
...showWhenPaused,
|
|
2333
|
+
_tag: "img",
|
|
2334
|
+
url: t.playButton.iconUrl,
|
|
2335
|
+
style: { ...t.playButton.css, ...t.playButton.cssEnabled },
|
|
2336
|
+
// },
|
|
2337
|
+
onClick: { kind: "play-video", task: playButtonTask }
|
|
2338
|
+
};
|
|
2339
|
+
if (t.playButton.text) {
|
|
2340
|
+
playButtonText = {
|
|
2341
|
+
...showWhenPaused,
|
|
2342
|
+
_tag: "p",
|
|
2343
|
+
style: t.playButton.text.css,
|
|
2344
|
+
innerText: t.playButton.text.text
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2347
|
+
pauseButton = {
|
|
2348
|
+
...showWhenPlaying,
|
|
2349
|
+
_tag: "img",
|
|
2350
|
+
style: {
|
|
2351
|
+
...t.pauseButton.css,
|
|
2352
|
+
visibility: "hidden",
|
|
2353
|
+
...t.pauseButton.cssEnabled
|
|
1819
2354
|
},
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
whenVideoPaused: { visibility: "visible" }
|
|
2355
|
+
url: t.pauseButton.iconUrl,
|
|
2356
|
+
onClick: { kind: "pause-video" }
|
|
1823
2357
|
};
|
|
1824
|
-
|
|
1825
|
-
|
|
2358
|
+
if (t.pauseButton.text) {
|
|
2359
|
+
pauseButtonText = {
|
|
2360
|
+
...showWhenPlaying,
|
|
2361
|
+
_tag: "p",
|
|
2362
|
+
style: t.pauseButton.text.css,
|
|
2363
|
+
innerText: t.pauseButton.text.text
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
if (t.unMuteButton) {
|
|
2367
|
+
unmuteButton = {
|
|
1826
2368
|
_tag: "img",
|
|
1827
|
-
style: {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
},
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
2369
|
+
style: { ...t.unMuteButton.css },
|
|
2370
|
+
url: t.unMuteButton.iconUrl,
|
|
2371
|
+
onClick: { kind: "un-mute-video" },
|
|
2372
|
+
whenVideoPausedAndMuted: { visibility: "visible" },
|
|
2373
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2374
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2375
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2376
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2377
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2378
|
+
};
|
|
2379
|
+
if (t.unMuteButton.text) {
|
|
2380
|
+
unmuteButtonText = {
|
|
2381
|
+
_tag: "p",
|
|
2382
|
+
style: t.unMuteButton.text.css,
|
|
2383
|
+
innerText: t.unMuteButton.text.text,
|
|
2384
|
+
whenVideoPausedAndMuted: { visibility: "visible" },
|
|
2385
|
+
whenVideoPaused: { visibility: "hidden" },
|
|
2386
|
+
whenVideoPlayingAndMuted: { visibility: "visible" },
|
|
2387
|
+
whenVideoPlaying: { visibility: "hidden" },
|
|
2388
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2389
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2390
|
+
};
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
if (t.muteButton) {
|
|
2394
|
+
muteButton = {
|
|
2395
|
+
_tag: "img",
|
|
2396
|
+
style: { ...t.muteButton.css },
|
|
2397
|
+
url: t.muteButton.iconUrl,
|
|
2398
|
+
onClick: { kind: "mute-video" },
|
|
2399
|
+
whenVideoPausedAndMuted: { visibility: "hidden" },
|
|
2400
|
+
whenVideoPaused: { visibility: "visible" },
|
|
2401
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2402
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2403
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2404
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2405
|
+
};
|
|
2406
|
+
if (t.muteButton.text) {
|
|
2407
|
+
muteButtonText = {
|
|
2408
|
+
_tag: "p",
|
|
2409
|
+
style: t.muteButton.text.css,
|
|
2410
|
+
innerText: t.muteButton.text.text,
|
|
2411
|
+
whenVideoPausedAndMuted: { visibility: "hidden" },
|
|
2412
|
+
whenVideoPaused: { visibility: "visible" },
|
|
2413
|
+
whenVideoPlayingAndMuted: { visibility: "hidden" },
|
|
2414
|
+
whenVideoPlaying: { visibility: "visible" },
|
|
2415
|
+
whenVideoEnded: { visibility: "hidden" },
|
|
2416
|
+
whenVideoEndedAndMuted: { visibility: "hidden" }
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
if (t.replayButton) {
|
|
2421
|
+
replayButton = {
|
|
2422
|
+
...showWhenEnded,
|
|
2423
|
+
_tag: "img",
|
|
2424
|
+
style: { ...t.replayButton.css },
|
|
2425
|
+
url: t.replayButton.iconUrl,
|
|
2426
|
+
onClick: { kind: "play-video", task: playButtonTask }
|
|
2427
|
+
};
|
|
2428
|
+
if (t.replayButton.text) {
|
|
2429
|
+
replayButtonText = {
|
|
2430
|
+
...showWhenEnded,
|
|
2431
|
+
_tag: "p",
|
|
2432
|
+
style: t.replayButton.text.css,
|
|
2433
|
+
innerText: t.replayButton.text.text
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
const componentsSet = /* @__PURE__ */ new Set();
|
|
2438
|
+
const addComponent = (maybeComponent) => {
|
|
2439
|
+
if (maybeComponent) {
|
|
2440
|
+
componentsSet.add(maybeComponent);
|
|
2441
|
+
}
|
|
1837
2442
|
};
|
|
1838
2443
|
if (mode !== "gif-mode") {
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
2444
|
+
addComponent(buttonBar);
|
|
2445
|
+
addComponent(unmuteButton);
|
|
2446
|
+
addComponent(unmuteButtonText);
|
|
2447
|
+
addComponent(muteButton);
|
|
2448
|
+
addComponent(muteButtonText);
|
|
2449
|
+
addComponent(playButton);
|
|
2450
|
+
addComponent(playButtonText);
|
|
2451
|
+
addComponent(pauseButton);
|
|
2452
|
+
addComponent(pauseButtonText);
|
|
2453
|
+
addComponent(replayButton);
|
|
2454
|
+
addComponent(replayButtonText);
|
|
2455
|
+
}
|
|
2456
|
+
return { videoPlayer, components: [...componentsSet], autoPlayTasks: [...autoPlayTasks] };
|
|
2457
|
+
}
|
|
2458
|
+
compileQuestion(pageId, page, variableId, hasMainMedia) {
|
|
2459
|
+
const t = this.currentTheme;
|
|
1845
2460
|
const q = page.defaultQuestion;
|
|
1846
2461
|
const text = page.mainText.text;
|
|
1847
|
-
const
|
|
1848
|
-
const question = {
|
|
1849
|
-
_tag: "p",
|
|
1850
|
-
innerText: text,
|
|
1851
|
-
style: questionStyle
|
|
1852
|
-
};
|
|
2462
|
+
const questionElement = this.compileMainText(text, !!page.mainText.audioFile, hasMainMedia);
|
|
1853
2463
|
const buttons = q.options.map((o) => {
|
|
1854
2464
|
const btns = this.compileButton(o, {
|
|
1855
2465
|
kind: "response-button",
|
|
@@ -1858,12 +2468,26 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1858
2468
|
});
|
|
1859
2469
|
return btns;
|
|
1860
2470
|
});
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1863
|
-
|
|
2471
|
+
const buttonBar = this.compileButtonBar(buttons);
|
|
2472
|
+
return {
|
|
2473
|
+
question: questionElement,
|
|
2474
|
+
buttonBar
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
compileButtonBar(buttons) {
|
|
2478
|
+
const t = this.currentTheme;
|
|
2479
|
+
const isSingle = buttons.length < 2;
|
|
2480
|
+
const style = isSingle ? { ...t.buttonBar.container.base, ...t.buttonBar.container.whenSingle } : { ...t.buttonBar.container.base, ...t.buttonBar.container.whenMany };
|
|
2481
|
+
const buttonBar = {
|
|
2482
|
+
_tag: "div",
|
|
2483
|
+
children: [...buttons],
|
|
2484
|
+
style
|
|
2485
|
+
};
|
|
2486
|
+
return buttonBar;
|
|
1864
2487
|
}
|
|
1865
2488
|
compileButton(buttonDto, options) {
|
|
1866
2489
|
const { id, value, label } = buttonDto;
|
|
2490
|
+
const t = this.currentTheme;
|
|
1867
2491
|
const onclickAction = options.kind === "response-button" ? {
|
|
1868
2492
|
kind: "submit-fact",
|
|
1869
2493
|
fact: {
|
|
@@ -1874,28 +2498,17 @@ var DefaultThemeCompiler = class extends AbstractThemeCompiler {
|
|
|
1874
2498
|
referenceLabel: options.questionText
|
|
1875
2499
|
}
|
|
1876
2500
|
} : { 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%)";
|
|
2501
|
+
const btnStyles = value === 9 ? t.buttonBar.responseButtons.dontKnow : t.buttonBar.responseButtons.normal;
|
|
2502
|
+
if (t.buttonBar.vibrateMs) {
|
|
2503
|
+
onclickAction.vibrateMs = t.buttonBar.vibrateMs;
|
|
1893
2504
|
}
|
|
1894
|
-
const
|
|
1895
|
-
|
|
2505
|
+
const btn = {
|
|
2506
|
+
_tag: "button",
|
|
2507
|
+
innerText: label,
|
|
2508
|
+
style: { ...btnStyles.btn.css, ...btnStyles.btn.cssEnabled },
|
|
1896
2509
|
onClick: onclickAction
|
|
1897
2510
|
};
|
|
1898
|
-
return
|
|
2511
|
+
return btn;
|
|
1899
2512
|
}
|
|
1900
2513
|
};
|
|
1901
2514
|
|
|
@@ -2331,6 +2944,7 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
2331
2944
|
this._pageCollection = BuilderPageCollection.create([]);
|
|
2332
2945
|
}
|
|
2333
2946
|
prefix;
|
|
2947
|
+
compiler = new DefaultThemeCompiler();
|
|
2334
2948
|
baseHeight = 1300;
|
|
2335
2949
|
baseWidth = 1024;
|
|
2336
2950
|
backgroundColor = "#000000";
|
|
@@ -2526,9 +3140,8 @@ var BuilderSchema = class _BuilderSchema {
|
|
|
2526
3140
|
}
|
|
2527
3141
|
});
|
|
2528
3142
|
const moduleDto = builderSchema.toJson();
|
|
2529
|
-
const imp = new DefaultThemeCompiler();
|
|
2530
3143
|
const codebook = CodeBook.fromSchema(moduleDto);
|
|
2531
|
-
const schema =
|
|
3144
|
+
const schema = this.compiler.compile(moduleDto);
|
|
2532
3145
|
const schemaConfig = SchemaConfig.fromSchema(moduleDto);
|
|
2533
3146
|
const output = { codebook, schema, schemaConfig };
|
|
2534
3147
|
return output;
|
|
@@ -2716,6 +3329,7 @@ var SumScore = {
|
|
|
2716
3329
|
BuilderTag,
|
|
2717
3330
|
BuilderText,
|
|
2718
3331
|
CodeBook,
|
|
3332
|
+
DefaultTheme,
|
|
2719
3333
|
ExcludeByPageIdSelectItem,
|
|
2720
3334
|
ExcludeByTagSelectItem,
|
|
2721
3335
|
JumpToActionManager,
|