@lumiastream/ui 0.3.1 → 0.3.2
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/index.js +23 -36
- package/dist/se-import.js +22 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4570,31 +4570,7 @@ var SE_LISTENER_TO_LUMIA_CATEGORY = {
|
|
|
4570
4570
|
"superchat-recent": "superchats",
|
|
4571
4571
|
"hypetrain-latest": "hypetrain"
|
|
4572
4572
|
};
|
|
4573
|
-
|
|
4574
|
-
"redemption",
|
|
4575
|
-
"follower",
|
|
4576
|
-
"bits",
|
|
4577
|
-
"kicks",
|
|
4578
|
-
"extension",
|
|
4579
|
-
"points",
|
|
4580
|
-
"donation",
|
|
4581
|
-
"subscribers",
|
|
4582
|
-
"gifts",
|
|
4583
|
-
"hosts",
|
|
4584
|
-
"raids",
|
|
4585
|
-
"hypetrain",
|
|
4586
|
-
"spells",
|
|
4587
|
-
"retweets",
|
|
4588
|
-
"likes",
|
|
4589
|
-
"purchases",
|
|
4590
|
-
"superstickers",
|
|
4591
|
-
"superchats",
|
|
4592
|
-
"stars",
|
|
4593
|
-
"fans",
|
|
4594
|
-
"shares",
|
|
4595
|
-
"raffles"
|
|
4596
|
-
];
|
|
4597
|
-
function computeListenerFilters(seListeners, explicitListener) {
|
|
4573
|
+
function computeAllowedEventsFromSEListeners(seListeners, explicitListener) {
|
|
4598
4574
|
const enabled = [];
|
|
4599
4575
|
if (seListeners && typeof seListeners === "object" && !Array.isArray(seListeners)) {
|
|
4600
4576
|
for (const [k, v] of Object.entries(
|
|
@@ -4608,14 +4584,21 @@ function computeListenerFilters(seListeners, explicitListener) {
|
|
|
4608
4584
|
if (typeof explicitListener === "string" && explicitListener && !enabled.includes(explicitListener)) {
|
|
4609
4585
|
enabled.push(explicitListener);
|
|
4610
4586
|
}
|
|
4611
|
-
if (enabled.length === 0) return
|
|
4612
|
-
const
|
|
4587
|
+
if (enabled.length === 0) return void 0;
|
|
4588
|
+
const allowedCategories = /* @__PURE__ */ new Set();
|
|
4613
4589
|
for (const listener of enabled) {
|
|
4614
4590
|
const category = SE_LISTENER_TO_LUMIA_CATEGORY[listener];
|
|
4615
|
-
if (category)
|
|
4616
|
-
}
|
|
4617
|
-
if (
|
|
4618
|
-
|
|
4591
|
+
if (category) allowedCategories.add(category);
|
|
4592
|
+
}
|
|
4593
|
+
if (allowedCategories.size === 0) return [];
|
|
4594
|
+
const allowedAlerts = [];
|
|
4595
|
+
Object.keys(LumiaMapAlertTypeToEventListType).forEach((alertKey) => {
|
|
4596
|
+
const mappedCategory = LumiaMapAlertTypeToEventListType[alertKey];
|
|
4597
|
+
if (mappedCategory && allowedCategories.has(mappedCategory)) {
|
|
4598
|
+
allowedAlerts.push(alertKey);
|
|
4599
|
+
}
|
|
4600
|
+
});
|
|
4601
|
+
return allowedAlerts;
|
|
4619
4602
|
}
|
|
4620
4603
|
function seScrollSpeedToMarqueeDurationSec(seSpeed) {
|
|
4621
4604
|
const n = typeof seSpeed === "number" && Number.isFinite(seSpeed) ? seSpeed : 6;
|
|
@@ -4629,7 +4612,10 @@ function seTemplateToMarqueeTemplate(seTemplate) {
|
|
|
4629
4612
|
}
|
|
4630
4613
|
function mapEventList(widget, ctx) {
|
|
4631
4614
|
const v = widget.variables ?? {};
|
|
4632
|
-
const
|
|
4615
|
+
const allowedEvents = computeAllowedEventsFromSEListeners(
|
|
4616
|
+
widget.listeners,
|
|
4617
|
+
widget.listener
|
|
4618
|
+
);
|
|
4633
4619
|
const maxItems = v.visibleEvents ?? v.visibleItems ?? 5;
|
|
4634
4620
|
const seText = widget.text;
|
|
4635
4621
|
const scrolling = seText?.scrolling;
|
|
@@ -4653,10 +4639,11 @@ function mapEventList(widget, ctx) {
|
|
|
4653
4639
|
// legacy field name kept for back-compat
|
|
4654
4640
|
themeBgOpacity: v.themeBgOpacity ?? 0,
|
|
4655
4641
|
highlight: v.highlight,
|
|
4656
|
-
// `
|
|
4657
|
-
|
|
4658
|
-
//
|
|
4659
|
-
|
|
4642
|
+
// `allowedEvents` — alertbox-style whitelist of LumiaAlertValues
|
|
4643
|
+
// strings. Computed from SE's enabled listeners; `undefined` means
|
|
4644
|
+
// the importer didn't see any listener config and we defer to the
|
|
4645
|
+
// eventlist's default (show every mapped alert).
|
|
4646
|
+
...allowedEvents !== void 0 ? { allowedEvents } : {},
|
|
4660
4647
|
// Eventlist Manager assumes these objects exist; provide an empty stub so
|
|
4661
4648
|
// imported overlays render without throwing. The marquee theme reads
|
|
4662
4649
|
// `itemTemplate` off either currentThemeConfig or themeConfig — stash
|
package/dist/se-import.js
CHANGED
|
@@ -1455,31 +1455,7 @@ var SE_LISTENER_TO_LUMIA_CATEGORY = {
|
|
|
1455
1455
|
"superchat-recent": "superchats",
|
|
1456
1456
|
"hypetrain-latest": "hypetrain"
|
|
1457
1457
|
};
|
|
1458
|
-
|
|
1459
|
-
"redemption",
|
|
1460
|
-
"follower",
|
|
1461
|
-
"bits",
|
|
1462
|
-
"kicks",
|
|
1463
|
-
"extension",
|
|
1464
|
-
"points",
|
|
1465
|
-
"donation",
|
|
1466
|
-
"subscribers",
|
|
1467
|
-
"gifts",
|
|
1468
|
-
"hosts",
|
|
1469
|
-
"raids",
|
|
1470
|
-
"hypetrain",
|
|
1471
|
-
"spells",
|
|
1472
|
-
"retweets",
|
|
1473
|
-
"likes",
|
|
1474
|
-
"purchases",
|
|
1475
|
-
"superstickers",
|
|
1476
|
-
"superchats",
|
|
1477
|
-
"stars",
|
|
1478
|
-
"fans",
|
|
1479
|
-
"shares",
|
|
1480
|
-
"raffles"
|
|
1481
|
-
];
|
|
1482
|
-
function computeListenerFilters(seListeners, explicitListener) {
|
|
1458
|
+
function computeAllowedEventsFromSEListeners(seListeners, explicitListener) {
|
|
1483
1459
|
const enabled = [];
|
|
1484
1460
|
if (seListeners && typeof seListeners === "object" && !Array.isArray(seListeners)) {
|
|
1485
1461
|
for (const [k, v] of Object.entries(
|
|
@@ -1493,14 +1469,21 @@ function computeListenerFilters(seListeners, explicitListener) {
|
|
|
1493
1469
|
if (typeof explicitListener === "string" && explicitListener && !enabled.includes(explicitListener)) {
|
|
1494
1470
|
enabled.push(explicitListener);
|
|
1495
1471
|
}
|
|
1496
|
-
if (enabled.length === 0) return
|
|
1497
|
-
const
|
|
1472
|
+
if (enabled.length === 0) return void 0;
|
|
1473
|
+
const allowedCategories = /* @__PURE__ */ new Set();
|
|
1498
1474
|
for (const listener of enabled) {
|
|
1499
1475
|
const category = SE_LISTENER_TO_LUMIA_CATEGORY[listener];
|
|
1500
|
-
if (category)
|
|
1476
|
+
if (category) allowedCategories.add(category);
|
|
1501
1477
|
}
|
|
1502
|
-
if (
|
|
1503
|
-
|
|
1478
|
+
if (allowedCategories.size === 0) return [];
|
|
1479
|
+
const allowedAlerts = [];
|
|
1480
|
+
Object.keys(LumiaMapAlertTypeToEventListType).forEach((alertKey) => {
|
|
1481
|
+
const mappedCategory = LumiaMapAlertTypeToEventListType[alertKey];
|
|
1482
|
+
if (mappedCategory && allowedCategories.has(mappedCategory)) {
|
|
1483
|
+
allowedAlerts.push(alertKey);
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
return allowedAlerts;
|
|
1504
1487
|
}
|
|
1505
1488
|
function seScrollSpeedToMarqueeDurationSec(seSpeed) {
|
|
1506
1489
|
const n = typeof seSpeed === "number" && Number.isFinite(seSpeed) ? seSpeed : 6;
|
|
@@ -1514,7 +1497,10 @@ function seTemplateToMarqueeTemplate(seTemplate) {
|
|
|
1514
1497
|
}
|
|
1515
1498
|
function mapEventList(widget, ctx) {
|
|
1516
1499
|
const v = widget.variables ?? {};
|
|
1517
|
-
const
|
|
1500
|
+
const allowedEvents = computeAllowedEventsFromSEListeners(
|
|
1501
|
+
widget.listeners,
|
|
1502
|
+
widget.listener
|
|
1503
|
+
);
|
|
1518
1504
|
const maxItems = v.visibleEvents ?? v.visibleItems ?? 5;
|
|
1519
1505
|
const seText = widget.text;
|
|
1520
1506
|
const scrolling = seText?.scrolling;
|
|
@@ -1538,10 +1524,11 @@ function mapEventList(widget, ctx) {
|
|
|
1538
1524
|
// legacy field name kept for back-compat
|
|
1539
1525
|
themeBgOpacity: v.themeBgOpacity ?? 0,
|
|
1540
1526
|
highlight: v.highlight,
|
|
1541
|
-
// `
|
|
1542
|
-
|
|
1543
|
-
//
|
|
1544
|
-
|
|
1527
|
+
// `allowedEvents` — alertbox-style whitelist of LumiaAlertValues
|
|
1528
|
+
// strings. Computed from SE's enabled listeners; `undefined` means
|
|
1529
|
+
// the importer didn't see any listener config and we defer to the
|
|
1530
|
+
// eventlist's default (show every mapped alert).
|
|
1531
|
+
...allowedEvents !== void 0 ? { allowedEvents } : {},
|
|
1545
1532
|
// Eventlist Manager assumes these objects exist; provide an empty stub so
|
|
1546
1533
|
// imported overlays render without throwing. The marquee theme reads
|
|
1547
1534
|
// `itemTemplate` off either currentThemeConfig or themeConfig — stash
|