@lumiastream/ui 0.5.2 → 0.5.3
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 +36 -14
- package/dist/se-import.js +36 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7675,13 +7675,7 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
7675
7675
|
const fontWeight = getField(settings, prefix, "font_weight") ?? 600;
|
|
7676
7676
|
const fontColor = getField(settings, prefix, "font_color") ?? "#FFFFFF";
|
|
7677
7677
|
const highlightColor = getField(settings, prefix, "font_color2") ?? "#32C3A6";
|
|
7678
|
-
const
|
|
7679
|
-
getField(settings, prefix, "message_font_size"),
|
|
7680
|
-
20
|
|
7681
|
-
);
|
|
7682
|
-
const messageFontFamily = getField(settings, prefix, "message_font") ?? fontFamily;
|
|
7683
|
-
const messageFontWeight = getField(settings, prefix, "message_font_weight") ?? 400;
|
|
7684
|
-
const messageFontColor = getField(settings, prefix, "message_font_color") ?? "#FFFFFF";
|
|
7678
|
+
const secondaryMessage = readSecondaryMessageConfig(settings, prefix, fontFamily);
|
|
7685
7679
|
const imageHref = absolutizeSLUrl(getField(settings, prefix, "image_href"));
|
|
7686
7680
|
const soundHref = absolutizeSLUrl(getField(settings, prefix, "sound_href"));
|
|
7687
7681
|
const soundVolume = getField(settings, prefix, "sound_volume") ?? 50;
|
|
@@ -7700,7 +7694,7 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
7700
7694
|
accentColor: null,
|
|
7701
7695
|
highlightColor,
|
|
7702
7696
|
firstMessageTemplate: translateSeText(messageTemplate),
|
|
7703
|
-
secondMessageTemplate: "",
|
|
7697
|
+
secondMessageTemplate: secondaryMessage?.template ?? "",
|
|
7704
7698
|
thirdMessageTemplate: "",
|
|
7705
7699
|
showAvatar: false,
|
|
7706
7700
|
showAmount: true,
|
|
@@ -7723,12 +7717,10 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
7723
7717
|
textShadow: "rgba(0, 0, 0, 0.8) 1px 1px 1px",
|
|
7724
7718
|
textAlign: "center"
|
|
7725
7719
|
},
|
|
7726
|
-
messageCss
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
fontWeight: messageFontWeight
|
|
7731
|
-
},
|
|
7720
|
+
// `messageCss` only matters when secondMessageTemplate is set;
|
|
7721
|
+
// leave it empty when SL didn't ship a secondary-message block
|
|
7722
|
+
// so Lumia's renderer falls back to its own default styling.
|
|
7723
|
+
messageCss: secondaryMessage?.css ?? {},
|
|
7732
7724
|
content: { value: translateSeText(messageTemplate) }
|
|
7733
7725
|
},
|
|
7734
7726
|
media: {
|
|
@@ -7771,6 +7763,36 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
7771
7763
|
variations: []
|
|
7772
7764
|
};
|
|
7773
7765
|
}
|
|
7766
|
+
var SECONDARY_MESSAGE_PREFIX_OVERRIDE = {
|
|
7767
|
+
sub: "resub"
|
|
7768
|
+
};
|
|
7769
|
+
function readSecondaryMessageConfig(settings, prefix, primaryFontFamily) {
|
|
7770
|
+
const secondaryPrefix = SECONDARY_MESSAGE_PREFIX_OVERRIDE[prefix] ?? prefix;
|
|
7771
|
+
const showKey = `show_${secondaryPrefix}_message`;
|
|
7772
|
+
const enabled = settings[showKey];
|
|
7773
|
+
if (enabled !== true) return null;
|
|
7774
|
+
const fontFamily = getField(settings, secondaryPrefix, "message_font") ?? primaryFontFamily;
|
|
7775
|
+
const fontSize = pxToNumber(
|
|
7776
|
+
getField(settings, secondaryPrefix, "message_font_size"),
|
|
7777
|
+
20
|
|
7778
|
+
);
|
|
7779
|
+
const fontWeight = getField(settings, secondaryPrefix, "message_font_weight") ?? 400;
|
|
7780
|
+
const fontColor = getField(settings, secondaryPrefix, "message_font_color") ?? "#FFFFFF";
|
|
7781
|
+
return {
|
|
7782
|
+
// `{message}` is the SE/SL chat-message token (mapped to Lumia's
|
|
7783
|
+
// `{{message}}` in translate.ts). It resolves at render time from
|
|
7784
|
+
// the alert payload's `message` field — populated for every event
|
|
7785
|
+
// where SL ships a secondary-message line (donations, resubs,
|
|
7786
|
+
// cheers, charity, merch, etc.).
|
|
7787
|
+
template: translateSeText("{message}"),
|
|
7788
|
+
css: {
|
|
7789
|
+
fontFamily,
|
|
7790
|
+
fontSize,
|
|
7791
|
+
color: fontColor,
|
|
7792
|
+
fontWeight
|
|
7793
|
+
}
|
|
7794
|
+
};
|
|
7795
|
+
}
|
|
7774
7796
|
function clampVolume(slVolume) {
|
|
7775
7797
|
if (typeof slVolume !== "number" || !Number.isFinite(slVolume)) return 0.5;
|
|
7776
7798
|
return Math.max(0, Math.min(1, slVolume / 100));
|
package/dist/se-import.js
CHANGED
|
@@ -6523,13 +6523,7 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
6523
6523
|
const fontWeight = getField(settings, prefix, "font_weight") ?? 600;
|
|
6524
6524
|
const fontColor = getField(settings, prefix, "font_color") ?? "#FFFFFF";
|
|
6525
6525
|
const highlightColor = getField(settings, prefix, "font_color2") ?? "#32C3A6";
|
|
6526
|
-
const
|
|
6527
|
-
getField(settings, prefix, "message_font_size"),
|
|
6528
|
-
20
|
|
6529
|
-
);
|
|
6530
|
-
const messageFontFamily = getField(settings, prefix, "message_font") ?? fontFamily;
|
|
6531
|
-
const messageFontWeight = getField(settings, prefix, "message_font_weight") ?? 400;
|
|
6532
|
-
const messageFontColor = getField(settings, prefix, "message_font_color") ?? "#FFFFFF";
|
|
6526
|
+
const secondaryMessage = readSecondaryMessageConfig(settings, prefix, fontFamily);
|
|
6533
6527
|
const imageHref = absolutizeSLUrl(getField(settings, prefix, "image_href"));
|
|
6534
6528
|
const soundHref = absolutizeSLUrl(getField(settings, prefix, "sound_href"));
|
|
6535
6529
|
const soundVolume = getField(settings, prefix, "sound_volume") ?? 50;
|
|
@@ -6548,7 +6542,7 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
6548
6542
|
accentColor: null,
|
|
6549
6543
|
highlightColor,
|
|
6550
6544
|
firstMessageTemplate: translateSeText(messageTemplate),
|
|
6551
|
-
secondMessageTemplate: "",
|
|
6545
|
+
secondMessageTemplate: secondaryMessage?.template ?? "",
|
|
6552
6546
|
thirdMessageTemplate: "",
|
|
6553
6547
|
showAvatar: false,
|
|
6554
6548
|
showAmount: true,
|
|
@@ -6571,12 +6565,10 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
6571
6565
|
textShadow: "rgba(0, 0, 0, 0.8) 1px 1px 1px",
|
|
6572
6566
|
textAlign: "center"
|
|
6573
6567
|
},
|
|
6574
|
-
messageCss
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
fontWeight: messageFontWeight
|
|
6579
|
-
},
|
|
6568
|
+
// `messageCss` only matters when secondMessageTemplate is set;
|
|
6569
|
+
// leave it empty when SL didn't ship a secondary-message block
|
|
6570
|
+
// so Lumia's renderer falls back to its own default styling.
|
|
6571
|
+
messageCss: secondaryMessage?.css ?? {},
|
|
6580
6572
|
content: { value: translateSeText(messageTemplate) }
|
|
6581
6573
|
},
|
|
6582
6574
|
media: {
|
|
@@ -6619,6 +6611,36 @@ function buildBaseAlertEvent(settings, prefix, defaultMessage) {
|
|
|
6619
6611
|
variations: []
|
|
6620
6612
|
};
|
|
6621
6613
|
}
|
|
6614
|
+
var SECONDARY_MESSAGE_PREFIX_OVERRIDE = {
|
|
6615
|
+
sub: "resub"
|
|
6616
|
+
};
|
|
6617
|
+
function readSecondaryMessageConfig(settings, prefix, primaryFontFamily) {
|
|
6618
|
+
const secondaryPrefix = SECONDARY_MESSAGE_PREFIX_OVERRIDE[prefix] ?? prefix;
|
|
6619
|
+
const showKey = `show_${secondaryPrefix}_message`;
|
|
6620
|
+
const enabled = settings[showKey];
|
|
6621
|
+
if (enabled !== true) return null;
|
|
6622
|
+
const fontFamily = getField(settings, secondaryPrefix, "message_font") ?? primaryFontFamily;
|
|
6623
|
+
const fontSize = pxToNumber(
|
|
6624
|
+
getField(settings, secondaryPrefix, "message_font_size"),
|
|
6625
|
+
20
|
|
6626
|
+
);
|
|
6627
|
+
const fontWeight = getField(settings, secondaryPrefix, "message_font_weight") ?? 400;
|
|
6628
|
+
const fontColor = getField(settings, secondaryPrefix, "message_font_color") ?? "#FFFFFF";
|
|
6629
|
+
return {
|
|
6630
|
+
// `{message}` is the SE/SL chat-message token (mapped to Lumia's
|
|
6631
|
+
// `{{message}}` in translate.ts). It resolves at render time from
|
|
6632
|
+
// the alert payload's `message` field — populated for every event
|
|
6633
|
+
// where SL ships a secondary-message line (donations, resubs,
|
|
6634
|
+
// cheers, charity, merch, etc.).
|
|
6635
|
+
template: translateSeText("{message}"),
|
|
6636
|
+
css: {
|
|
6637
|
+
fontFamily,
|
|
6638
|
+
fontSize,
|
|
6639
|
+
color: fontColor,
|
|
6640
|
+
fontWeight
|
|
6641
|
+
}
|
|
6642
|
+
};
|
|
6643
|
+
}
|
|
6622
6644
|
function clampVolume(slVolume) {
|
|
6623
6645
|
if (typeof slVolume !== "number" || !Number.isFinite(slVolume)) return 0.5;
|
|
6624
6646
|
return Math.max(0, Math.min(1, slVolume / 100));
|