@lumiastream/ui 0.5.5 → 0.5.7
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 +48 -92
- package/dist/se-import.js +48 -92
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4091,13 +4091,15 @@ function seExtraTextCss(seCss, scrolling) {
|
|
|
4091
4091
|
extra.WebkitTextStrokeWidth = seCss["-webkit-text-stroke-width"];
|
|
4092
4092
|
if (seCss["letter-spacing"] != null) extra.letterSpacing = seCss["letter-spacing"];
|
|
4093
4093
|
if (seCss["word-spacing"] != null) extra.wordSpacing = seCss["word-spacing"];
|
|
4094
|
-
if (scrolling?.enabled)
|
|
4095
|
-
extra.scroll = true;
|
|
4096
|
-
const speed = Number(scrolling.speed);
|
|
4097
|
-
if (Number.isFinite(speed) && speed > 0) extra.scrollSpeed = speed * 600;
|
|
4098
|
-
}
|
|
4094
|
+
if (scrolling?.enabled) extra.scroll = true;
|
|
4099
4095
|
return extra;
|
|
4100
4096
|
}
|
|
4097
|
+
function seMarqueeSpeedPxPerSec(scrolling) {
|
|
4098
|
+
if (!scrolling?.enabled) return void 0;
|
|
4099
|
+
const speed = Number(scrolling.speed);
|
|
4100
|
+
if (!Number.isFinite(speed) || speed <= 0) return void 0;
|
|
4101
|
+
return speed * 12;
|
|
4102
|
+
}
|
|
4101
4103
|
function mapText(widget, ctx) {
|
|
4102
4104
|
const value = translateSeText(
|
|
4103
4105
|
widget.text?.value ?? "",
|
|
@@ -4107,13 +4109,15 @@ function mapText(widget, ctx) {
|
|
|
4107
4109
|
{ context: "static" }
|
|
4108
4110
|
);
|
|
4109
4111
|
const seCss = widget.text?.css ?? {};
|
|
4112
|
+
const marqueeSpeed = seMarqueeSpeedPxPerSec(widget.text?.scrolling);
|
|
4110
4113
|
return buildUnit(
|
|
4111
4114
|
widget,
|
|
4112
4115
|
"text",
|
|
4113
4116
|
{
|
|
4114
4117
|
content: {
|
|
4115
4118
|
value,
|
|
4116
|
-
highlightColor: "inherit"
|
|
4119
|
+
highlightColor: "inherit",
|
|
4120
|
+
...marqueeSpeed != null ? { marqueeSpeed } : {}
|
|
4117
4121
|
},
|
|
4118
4122
|
css: {
|
|
4119
4123
|
fontSize: seCss["font-size"] ?? 24,
|
|
@@ -4122,7 +4126,7 @@ function mapText(widget, ctx) {
|
|
|
4122
4126
|
fontWeight: seCss["font-weight"] ?? "bold",
|
|
4123
4127
|
color: seCss["color"] ?? "#ffffff",
|
|
4124
4128
|
textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
|
|
4125
|
-
lineHeight: seCss["line-height"] ??
|
|
4129
|
+
lineHeight: seCss["line-height"] ?? 1.5,
|
|
4126
4130
|
background: "transparent",
|
|
4127
4131
|
...seExtraTextCss(seCss, widget.text?.scrolling)
|
|
4128
4132
|
}
|
|
@@ -4224,11 +4228,16 @@ function mapReadout(widget, fallbackVar, ctx) {
|
|
|
4224
4228
|
context: "static"
|
|
4225
4229
|
}) : `{{${variable}}}`;
|
|
4226
4230
|
const seCss = widget.text?.css ?? {};
|
|
4231
|
+
const marqueeSpeed = seMarqueeSpeedPxPerSec(widget.text?.scrolling);
|
|
4227
4232
|
return buildUnit(
|
|
4228
4233
|
widget,
|
|
4229
4234
|
"text",
|
|
4230
4235
|
{
|
|
4231
|
-
content: {
|
|
4236
|
+
content: {
|
|
4237
|
+
value,
|
|
4238
|
+
highlightColor: "inherit",
|
|
4239
|
+
...marqueeSpeed != null ? { marqueeSpeed } : {}
|
|
4240
|
+
},
|
|
4232
4241
|
css: {
|
|
4233
4242
|
fontSize: seCss["font-size"] ?? 28,
|
|
4234
4243
|
textAlign: seCss["text-align"] ?? "center",
|
|
@@ -4236,7 +4245,7 @@ function mapReadout(widget, fallbackVar, ctx) {
|
|
|
4236
4245
|
fontWeight: seCss["font-weight"] ?? "bold",
|
|
4237
4246
|
color: seCss["color"] ?? "#ffffff",
|
|
4238
4247
|
textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
|
|
4239
|
-
lineHeight: seCss["line-height"] ??
|
|
4248
|
+
lineHeight: seCss["line-height"] ?? 1.5,
|
|
4240
4249
|
background: "transparent",
|
|
4241
4250
|
...seExtraTextCss(seCss, widget.text?.scrolling)
|
|
4242
4251
|
}
|
|
@@ -5108,15 +5117,6 @@ var EVENTLIST_DEFAULT_MODULE = {
|
|
|
5108
5117
|
};
|
|
5109
5118
|
|
|
5110
5119
|
// src/se-import/mappers/misc.ts
|
|
5111
|
-
function mapChatboxTheme(seTheme) {
|
|
5112
|
-
const t = (seTheme ?? "").toString().toLowerCase();
|
|
5113
|
-
if (!t || t === "default") return "simple";
|
|
5114
|
-
if (t.includes("flipin") || t.includes("bubble") || t.includes("bubbly")) return "bubbly";
|
|
5115
|
-
if (t.includes("glass") || t.includes("transparent")) return "glass";
|
|
5116
|
-
if (t.includes("boxy") || t.includes("checker")) return "boxy";
|
|
5117
|
-
if (t.includes("basic")) return "basic";
|
|
5118
|
-
return "simple";
|
|
5119
|
-
}
|
|
5120
5120
|
function defaultChatboxBackgroundForSeTheme(seTheme) {
|
|
5121
5121
|
const t = (seTheme ?? "").toString().toLowerCase();
|
|
5122
5122
|
if (!t || t === "default") return "transparent";
|
|
@@ -5129,6 +5129,10 @@ function defaultChatboxBackgroundForSeTheme(seTheme) {
|
|
|
5129
5129
|
return "#1e1e1e";
|
|
5130
5130
|
return "#1e1e1e";
|
|
5131
5131
|
}
|
|
5132
|
+
function isDarkSurfaceSeTheme(seTheme) {
|
|
5133
|
+
const t = (seTheme ?? "").toString().toLowerCase();
|
|
5134
|
+
return t.includes("dark") || t.includes("boxy") || t.includes("checker") || t.includes("black");
|
|
5135
|
+
}
|
|
5132
5136
|
var KAPPAGEN_EVENT_CATEGORIES = {
|
|
5133
5137
|
tip: [LumiaEventListTypes.DONATION],
|
|
5134
5138
|
cheer: [
|
|
@@ -5160,96 +5164,59 @@ function kappagenAlertTriggersFor(seEvent, provider) {
|
|
|
5160
5164
|
const fallback = kappagenKeyFor(seEvent, provider);
|
|
5161
5165
|
return fallback ? [fallback] : [];
|
|
5162
5166
|
}
|
|
5163
|
-
function paddingShorthand(message) {
|
|
5164
|
-
const pick = (key) => {
|
|
5165
|
-
const raw = message?.[key];
|
|
5166
|
-
if (raw == null || raw === "") return null;
|
|
5167
|
-
const n = typeof raw === "number" ? raw : parseFloat(String(raw));
|
|
5168
|
-
return Number.isFinite(n) ? n : null;
|
|
5169
|
-
};
|
|
5170
|
-
const t = pick("padding-top");
|
|
5171
|
-
const r = pick("padding-right");
|
|
5172
|
-
const b = pick("padding-bottom");
|
|
5173
|
-
const l = pick("padding-left");
|
|
5174
|
-
if (t == null && r == null && b == null && l == null) return void 0;
|
|
5175
|
-
const px = (n) => `${n ?? 0}px`;
|
|
5176
|
-
return `${px(t)} ${px(r)} ${px(b)} ${px(l)}`;
|
|
5177
|
-
}
|
|
5178
5167
|
function mapChatbox(widget, ctx) {
|
|
5179
5168
|
const chatboxDefaults = CHATBOX_DEFAULT_MODULE.content;
|
|
5180
5169
|
const chatboxVersion = CHATBOX_DEFAULT_MODULE.version;
|
|
5181
5170
|
const v = widget.variables ?? {};
|
|
5182
5171
|
const textCss = widget.text?.css ?? {};
|
|
5183
5172
|
const messageCss = textCss.message ?? {};
|
|
5184
|
-
const
|
|
5185
|
-
|
|
5186
|
-
|
|
5173
|
+
const messageWins = (key) => {
|
|
5174
|
+
const m = messageCss[key];
|
|
5175
|
+
if (typeof m === "string" && m.length > 0) return m;
|
|
5176
|
+
if (typeof m === "number" && m > 0) return m;
|
|
5177
|
+
return textCss[key];
|
|
5178
|
+
};
|
|
5179
|
+
const isPermanent = v.fadeOut === true || v.permanent === true || v.showMessagesPermanently === true || v.displayPermanent === true || v.hideAfter === false || typeof v.hideAfter === "number" && (v.hideAfter <= 0 || v.hideAfter >= 999);
|
|
5187
5180
|
const DEFAULT_FADE_SECONDS = 30;
|
|
5188
5181
|
const fadeOutSeconds = isPermanent ? 0 : typeof v.fadeOut === "number" && v.fadeOut > 0 ? v.fadeOut : typeof v.delay === "number" && v.delay > 0 ? v.delay : DEFAULT_FADE_SECONDS;
|
|
5189
|
-
const messagePadding = paddingShorthand(messageCss);
|
|
5190
5182
|
const DEFAULT_CHATBOX_FONT_SIZE = 14;
|
|
5191
5183
|
const moduleCss = {};
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5184
|
+
const fontFamily = messageWins("font-family");
|
|
5185
|
+
if (fontFamily != null) moduleCss.fontFamily = fontFamily;
|
|
5186
|
+
const fontSize = messageWins("font-size");
|
|
5187
|
+
moduleCss.fontSize = fontSize != null ? fontSize : DEFAULT_CHATBOX_FONT_SIZE;
|
|
5188
|
+
const rawColor = messageWins("color");
|
|
5189
|
+
const isSeDefaultColor = rawColor == null || typeof rawColor === "string" && (rawColor === "" || rawColor.toLowerCase() === "#fff" || rawColor.toLowerCase() === "#ffffff");
|
|
5190
|
+
if (!isSeDefaultColor) {
|
|
5191
|
+
moduleCss.color = rawColor;
|
|
5192
|
+
} else if (!isDarkSurfaceSeTheme(v.theme)) {
|
|
5193
|
+
moduleCss.color = "rgba(0, 0, 0, 0.9)";
|
|
5194
|
+
} else if (rawColor != null) {
|
|
5195
|
+
moduleCss.color = rawColor;
|
|
5196
|
+
}
|
|
5197
|
+
const textShadow = messageWins("text-shadow");
|
|
5198
|
+
if (textShadow != null) moduleCss.textShadow = textShadow;
|
|
5199
|
+
const textAlign = messageWins("text-align");
|
|
5200
|
+
if (textAlign != null) moduleCss.textAlign = textAlign;
|
|
5195
5201
|
if (textCss["font-weight"] != null) moduleCss.fontWeight = textCss["font-weight"];
|
|
5196
|
-
if (textCss["text-shadow"] != null) moduleCss.textShadow = textCss["text-shadow"];
|
|
5197
|
-
if (textCss["text-align"] != null) moduleCss.textAlign = textCss["text-align"];
|
|
5198
5202
|
if (textCss["line-height"] != null) moduleCss.lineHeight = textCss["line-height"];
|
|
5199
|
-
if (messagePadding) moduleCss.padding = messagePadding;
|
|
5200
5203
|
const messageBackground = typeof messageCss["background"] === "string" && messageCss["background"].length > 0 ? messageCss["background"] : defaultChatboxBackgroundForSeTheme(v.theme);
|
|
5201
5204
|
moduleCss.background = messageBackground;
|
|
5202
|
-
const messageFontFamily = typeof messageCss["font-family"] === "string" && messageCss["font-family"].length > 0 ? messageCss["font-family"] : void 0;
|
|
5203
5205
|
const highlightBackground = v.highlight && typeof v.highlight === "object" && typeof v.highlight["background"] === "string" ? v.highlight["background"] : void 0;
|
|
5204
5206
|
const accentColor = highlightBackground && highlightBackground.length > 0 ? highlightBackground : void 0;
|
|
5205
5207
|
return buildUnit(
|
|
5206
5208
|
widget,
|
|
5207
5209
|
"chatbox",
|
|
5208
5210
|
{
|
|
5209
|
-
// Stamp the module version from the authoritative defaults so
|
|
5210
|
-
// Overlay-UI's per-module Settings.tsx migration check
|
|
5211
|
-
// (`module?.version !== currentVersion`) treats this import as
|
|
5212
|
-
// already-current. Without this, every freshly-imported chatbox
|
|
5213
|
-
// would trip the migration toast on first open even though the
|
|
5214
|
-
// content is already complete.
|
|
5215
5211
|
version: chatboxVersion,
|
|
5216
|
-
// Visual styling (font / color / padding etc) lives on module.css, not
|
|
5217
|
-
// content. Lumia's TextStyle settings panel + the chatbox renderer both
|
|
5218
|
-
// read from here.
|
|
5219
5212
|
css: moduleCss,
|
|
5220
5213
|
content: {
|
|
5221
|
-
// `chatboxDefaults` resolves host-injected first (preferred), then
|
|
5222
|
-
// the local snapshot — see the top of this function. Spreading it
|
|
5223
|
-
// here guarantees every field the chatbox renderer expects is
|
|
5224
|
-
// present (`type`, `sites`, `useAnimatedEmotes`, etc.); the
|
|
5225
|
-
// SE-specific override block below wins for the opinions that
|
|
5226
|
-
// differ from a fresh-add.
|
|
5227
5214
|
...chatboxDefaults,
|
|
5228
|
-
|
|
5229
|
-
// The fresh-Lumia defaults assume the streamer is creating a new
|
|
5230
|
-
// chatbox; SE-imported ones have opinions that differ. Override
|
|
5231
|
-
// only those.
|
|
5232
|
-
theme: mapChatboxTheme(v.theme),
|
|
5215
|
+
theme: "simple",
|
|
5233
5216
|
fadeOutAfterDelay: fadeOutSeconds > 0,
|
|
5234
5217
|
fadeOutDelayTime: fadeOutSeconds,
|
|
5235
|
-
ignoredList: Array.isArray(v.ignored) ? v.ignored : [],
|
|
5236
|
-
// SE chat widgets default to showing avatars + site icons + tight
|
|
5237
|
-
// line wrapping; Lumia's fresh default is the opposite.
|
|
5238
5218
|
showAvatar: true,
|
|
5239
|
-
showSiteIcon: true,
|
|
5240
5219
|
breakLine: false,
|
|
5241
|
-
clickableChatterProfiles: true,
|
|
5242
|
-
hideAlertMessage: false,
|
|
5243
|
-
// Carry the SE message-level font override and the streamer's
|
|
5244
|
-
// accent color across so the imported chatbox looks right at
|
|
5245
|
-
// first paint. Background lives on `module.css.background`
|
|
5246
|
-
// above — `content.background` was a dead write the renderer
|
|
5247
|
-
// never read.
|
|
5248
|
-
...messageFontFamily ? { messageFontFamily } : {},
|
|
5249
|
-
// Twitch primary color override — deep-merge into the full
|
|
5250
|
-
// chatboxStreamingSite map from the default (otherwise we'd
|
|
5251
|
-
// clobber the youtube/kick/facebook/tiktok/discord entries the
|
|
5252
|
-
// chatbox renderer reads for per-platform theming).
|
|
5253
5220
|
...accentColor ? {
|
|
5254
5221
|
chatboxStreamingSite: {
|
|
5255
5222
|
...chatboxDefaults.chatboxStreamingSite,
|
|
@@ -5261,18 +5228,7 @@ function mapChatbox(widget, ctx) {
|
|
|
5261
5228
|
}
|
|
5262
5229
|
}
|
|
5263
5230
|
}
|
|
5264
|
-
} : {}
|
|
5265
|
-
// Source-side knobs preserved under the generic importMeta envelope —
|
|
5266
|
-
// no native Lumia equivalent today. `messageDelay` is per-message
|
|
5267
|
-
// hold, `initialDelay` is the show-after-connect delay, and we
|
|
5268
|
-
// stash the raw highlight block + text css for any future feature
|
|
5269
|
-
// that wants the fine-grained styling.
|
|
5270
|
-
importMeta: buildImportMeta(widget, {
|
|
5271
|
-
messageDelay: v.messageDelay,
|
|
5272
|
-
initialDelay: v.delay,
|
|
5273
|
-
highlightUsers: v.highlight,
|
|
5274
|
-
textCss
|
|
5275
|
-
})
|
|
5231
|
+
} : {}
|
|
5276
5232
|
}
|
|
5277
5233
|
},
|
|
5278
5234
|
ctx
|
package/dist/se-import.js
CHANGED
|
@@ -1011,13 +1011,15 @@ function seExtraTextCss(seCss, scrolling) {
|
|
|
1011
1011
|
extra.WebkitTextStrokeWidth = seCss["-webkit-text-stroke-width"];
|
|
1012
1012
|
if (seCss["letter-spacing"] != null) extra.letterSpacing = seCss["letter-spacing"];
|
|
1013
1013
|
if (seCss["word-spacing"] != null) extra.wordSpacing = seCss["word-spacing"];
|
|
1014
|
-
if (scrolling?.enabled)
|
|
1015
|
-
extra.scroll = true;
|
|
1016
|
-
const speed = Number(scrolling.speed);
|
|
1017
|
-
if (Number.isFinite(speed) && speed > 0) extra.scrollSpeed = speed * 600;
|
|
1018
|
-
}
|
|
1014
|
+
if (scrolling?.enabled) extra.scroll = true;
|
|
1019
1015
|
return extra;
|
|
1020
1016
|
}
|
|
1017
|
+
function seMarqueeSpeedPxPerSec(scrolling) {
|
|
1018
|
+
if (!scrolling?.enabled) return void 0;
|
|
1019
|
+
const speed = Number(scrolling.speed);
|
|
1020
|
+
if (!Number.isFinite(speed) || speed <= 0) return void 0;
|
|
1021
|
+
return speed * 12;
|
|
1022
|
+
}
|
|
1021
1023
|
function mapText(widget, ctx) {
|
|
1022
1024
|
const value = translateSeText(
|
|
1023
1025
|
widget.text?.value ?? "",
|
|
@@ -1027,13 +1029,15 @@ function mapText(widget, ctx) {
|
|
|
1027
1029
|
{ context: "static" }
|
|
1028
1030
|
);
|
|
1029
1031
|
const seCss = widget.text?.css ?? {};
|
|
1032
|
+
const marqueeSpeed = seMarqueeSpeedPxPerSec(widget.text?.scrolling);
|
|
1030
1033
|
return buildUnit(
|
|
1031
1034
|
widget,
|
|
1032
1035
|
"text",
|
|
1033
1036
|
{
|
|
1034
1037
|
content: {
|
|
1035
1038
|
value,
|
|
1036
|
-
highlightColor: "inherit"
|
|
1039
|
+
highlightColor: "inherit",
|
|
1040
|
+
...marqueeSpeed != null ? { marqueeSpeed } : {}
|
|
1037
1041
|
},
|
|
1038
1042
|
css: {
|
|
1039
1043
|
fontSize: seCss["font-size"] ?? 24,
|
|
@@ -1042,7 +1046,7 @@ function mapText(widget, ctx) {
|
|
|
1042
1046
|
fontWeight: seCss["font-weight"] ?? "bold",
|
|
1043
1047
|
color: seCss["color"] ?? "#ffffff",
|
|
1044
1048
|
textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
|
|
1045
|
-
lineHeight: seCss["line-height"] ??
|
|
1049
|
+
lineHeight: seCss["line-height"] ?? 1.5,
|
|
1046
1050
|
background: "transparent",
|
|
1047
1051
|
...seExtraTextCss(seCss, widget.text?.scrolling)
|
|
1048
1052
|
}
|
|
@@ -1144,11 +1148,16 @@ function mapReadout(widget, fallbackVar, ctx) {
|
|
|
1144
1148
|
context: "static"
|
|
1145
1149
|
}) : `{{${variable}}}`;
|
|
1146
1150
|
const seCss = widget.text?.css ?? {};
|
|
1151
|
+
const marqueeSpeed = seMarqueeSpeedPxPerSec(widget.text?.scrolling);
|
|
1147
1152
|
return buildUnit(
|
|
1148
1153
|
widget,
|
|
1149
1154
|
"text",
|
|
1150
1155
|
{
|
|
1151
|
-
content: {
|
|
1156
|
+
content: {
|
|
1157
|
+
value,
|
|
1158
|
+
highlightColor: "inherit",
|
|
1159
|
+
...marqueeSpeed != null ? { marqueeSpeed } : {}
|
|
1160
|
+
},
|
|
1152
1161
|
css: {
|
|
1153
1162
|
fontSize: seCss["font-size"] ?? 28,
|
|
1154
1163
|
textAlign: seCss["text-align"] ?? "center",
|
|
@@ -1156,7 +1165,7 @@ function mapReadout(widget, fallbackVar, ctx) {
|
|
|
1156
1165
|
fontWeight: seCss["font-weight"] ?? "bold",
|
|
1157
1166
|
color: seCss["color"] ?? "#ffffff",
|
|
1158
1167
|
textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
|
|
1159
|
-
lineHeight: seCss["line-height"] ??
|
|
1168
|
+
lineHeight: seCss["line-height"] ?? 1.5,
|
|
1160
1169
|
background: "transparent",
|
|
1161
1170
|
...seExtraTextCss(seCss, widget.text?.scrolling)
|
|
1162
1171
|
}
|
|
@@ -2028,15 +2037,6 @@ var EVENTLIST_DEFAULT_MODULE = {
|
|
|
2028
2037
|
};
|
|
2029
2038
|
|
|
2030
2039
|
// src/se-import/mappers/misc.ts
|
|
2031
|
-
function mapChatboxTheme(seTheme) {
|
|
2032
|
-
const t = (seTheme ?? "").toString().toLowerCase();
|
|
2033
|
-
if (!t || t === "default") return "simple";
|
|
2034
|
-
if (t.includes("flipin") || t.includes("bubble") || t.includes("bubbly")) return "bubbly";
|
|
2035
|
-
if (t.includes("glass") || t.includes("transparent")) return "glass";
|
|
2036
|
-
if (t.includes("boxy") || t.includes("checker")) return "boxy";
|
|
2037
|
-
if (t.includes("basic")) return "basic";
|
|
2038
|
-
return "simple";
|
|
2039
|
-
}
|
|
2040
2040
|
function defaultChatboxBackgroundForSeTheme(seTheme) {
|
|
2041
2041
|
const t = (seTheme ?? "").toString().toLowerCase();
|
|
2042
2042
|
if (!t || t === "default") return "transparent";
|
|
@@ -2049,6 +2049,10 @@ function defaultChatboxBackgroundForSeTheme(seTheme) {
|
|
|
2049
2049
|
return "#1e1e1e";
|
|
2050
2050
|
return "#1e1e1e";
|
|
2051
2051
|
}
|
|
2052
|
+
function isDarkSurfaceSeTheme(seTheme) {
|
|
2053
|
+
const t = (seTheme ?? "").toString().toLowerCase();
|
|
2054
|
+
return t.includes("dark") || t.includes("boxy") || t.includes("checker") || t.includes("black");
|
|
2055
|
+
}
|
|
2052
2056
|
var KAPPAGEN_EVENT_CATEGORIES = {
|
|
2053
2057
|
tip: [LumiaEventListTypes.DONATION],
|
|
2054
2058
|
cheer: [
|
|
@@ -2080,96 +2084,59 @@ function kappagenAlertTriggersFor(seEvent, provider) {
|
|
|
2080
2084
|
const fallback = kappagenKeyFor(seEvent, provider);
|
|
2081
2085
|
return fallback ? [fallback] : [];
|
|
2082
2086
|
}
|
|
2083
|
-
function paddingShorthand(message) {
|
|
2084
|
-
const pick = (key) => {
|
|
2085
|
-
const raw = message?.[key];
|
|
2086
|
-
if (raw == null || raw === "") return null;
|
|
2087
|
-
const n = typeof raw === "number" ? raw : parseFloat(String(raw));
|
|
2088
|
-
return Number.isFinite(n) ? n : null;
|
|
2089
|
-
};
|
|
2090
|
-
const t = pick("padding-top");
|
|
2091
|
-
const r = pick("padding-right");
|
|
2092
|
-
const b = pick("padding-bottom");
|
|
2093
|
-
const l = pick("padding-left");
|
|
2094
|
-
if (t == null && r == null && b == null && l == null) return void 0;
|
|
2095
|
-
const px = (n) => `${n ?? 0}px`;
|
|
2096
|
-
return `${px(t)} ${px(r)} ${px(b)} ${px(l)}`;
|
|
2097
|
-
}
|
|
2098
2087
|
function mapChatbox(widget, ctx) {
|
|
2099
2088
|
const chatboxDefaults = CHATBOX_DEFAULT_MODULE.content;
|
|
2100
2089
|
const chatboxVersion = CHATBOX_DEFAULT_MODULE.version;
|
|
2101
2090
|
const v = widget.variables ?? {};
|
|
2102
2091
|
const textCss = widget.text?.css ?? {};
|
|
2103
2092
|
const messageCss = textCss.message ?? {};
|
|
2104
|
-
const
|
|
2105
|
-
|
|
2106
|
-
|
|
2093
|
+
const messageWins = (key) => {
|
|
2094
|
+
const m = messageCss[key];
|
|
2095
|
+
if (typeof m === "string" && m.length > 0) return m;
|
|
2096
|
+
if (typeof m === "number" && m > 0) return m;
|
|
2097
|
+
return textCss[key];
|
|
2098
|
+
};
|
|
2099
|
+
const isPermanent = v.fadeOut === true || v.permanent === true || v.showMessagesPermanently === true || v.displayPermanent === true || v.hideAfter === false || typeof v.hideAfter === "number" && (v.hideAfter <= 0 || v.hideAfter >= 999);
|
|
2107
2100
|
const DEFAULT_FADE_SECONDS = 30;
|
|
2108
2101
|
const fadeOutSeconds = isPermanent ? 0 : typeof v.fadeOut === "number" && v.fadeOut > 0 ? v.fadeOut : typeof v.delay === "number" && v.delay > 0 ? v.delay : DEFAULT_FADE_SECONDS;
|
|
2109
|
-
const messagePadding = paddingShorthand(messageCss);
|
|
2110
2102
|
const DEFAULT_CHATBOX_FONT_SIZE = 14;
|
|
2111
2103
|
const moduleCss = {};
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2104
|
+
const fontFamily = messageWins("font-family");
|
|
2105
|
+
if (fontFamily != null) moduleCss.fontFamily = fontFamily;
|
|
2106
|
+
const fontSize = messageWins("font-size");
|
|
2107
|
+
moduleCss.fontSize = fontSize != null ? fontSize : DEFAULT_CHATBOX_FONT_SIZE;
|
|
2108
|
+
const rawColor = messageWins("color");
|
|
2109
|
+
const isSeDefaultColor = rawColor == null || typeof rawColor === "string" && (rawColor === "" || rawColor.toLowerCase() === "#fff" || rawColor.toLowerCase() === "#ffffff");
|
|
2110
|
+
if (!isSeDefaultColor) {
|
|
2111
|
+
moduleCss.color = rawColor;
|
|
2112
|
+
} else if (!isDarkSurfaceSeTheme(v.theme)) {
|
|
2113
|
+
moduleCss.color = "rgba(0, 0, 0, 0.9)";
|
|
2114
|
+
} else if (rawColor != null) {
|
|
2115
|
+
moduleCss.color = rawColor;
|
|
2116
|
+
}
|
|
2117
|
+
const textShadow = messageWins("text-shadow");
|
|
2118
|
+
if (textShadow != null) moduleCss.textShadow = textShadow;
|
|
2119
|
+
const textAlign = messageWins("text-align");
|
|
2120
|
+
if (textAlign != null) moduleCss.textAlign = textAlign;
|
|
2115
2121
|
if (textCss["font-weight"] != null) moduleCss.fontWeight = textCss["font-weight"];
|
|
2116
|
-
if (textCss["text-shadow"] != null) moduleCss.textShadow = textCss["text-shadow"];
|
|
2117
|
-
if (textCss["text-align"] != null) moduleCss.textAlign = textCss["text-align"];
|
|
2118
2122
|
if (textCss["line-height"] != null) moduleCss.lineHeight = textCss["line-height"];
|
|
2119
|
-
if (messagePadding) moduleCss.padding = messagePadding;
|
|
2120
2123
|
const messageBackground = typeof messageCss["background"] === "string" && messageCss["background"].length > 0 ? messageCss["background"] : defaultChatboxBackgroundForSeTheme(v.theme);
|
|
2121
2124
|
moduleCss.background = messageBackground;
|
|
2122
|
-
const messageFontFamily = typeof messageCss["font-family"] === "string" && messageCss["font-family"].length > 0 ? messageCss["font-family"] : void 0;
|
|
2123
2125
|
const highlightBackground = v.highlight && typeof v.highlight === "object" && typeof v.highlight["background"] === "string" ? v.highlight["background"] : void 0;
|
|
2124
2126
|
const accentColor = highlightBackground && highlightBackground.length > 0 ? highlightBackground : void 0;
|
|
2125
2127
|
return buildUnit(
|
|
2126
2128
|
widget,
|
|
2127
2129
|
"chatbox",
|
|
2128
2130
|
{
|
|
2129
|
-
// Stamp the module version from the authoritative defaults so
|
|
2130
|
-
// Overlay-UI's per-module Settings.tsx migration check
|
|
2131
|
-
// (`module?.version !== currentVersion`) treats this import as
|
|
2132
|
-
// already-current. Without this, every freshly-imported chatbox
|
|
2133
|
-
// would trip the migration toast on first open even though the
|
|
2134
|
-
// content is already complete.
|
|
2135
2131
|
version: chatboxVersion,
|
|
2136
|
-
// Visual styling (font / color / padding etc) lives on module.css, not
|
|
2137
|
-
// content. Lumia's TextStyle settings panel + the chatbox renderer both
|
|
2138
|
-
// read from here.
|
|
2139
2132
|
css: moduleCss,
|
|
2140
2133
|
content: {
|
|
2141
|
-
// `chatboxDefaults` resolves host-injected first (preferred), then
|
|
2142
|
-
// the local snapshot — see the top of this function. Spreading it
|
|
2143
|
-
// here guarantees every field the chatbox renderer expects is
|
|
2144
|
-
// present (`type`, `sites`, `useAnimatedEmotes`, etc.); the
|
|
2145
|
-
// SE-specific override block below wins for the opinions that
|
|
2146
|
-
// differ from a fresh-add.
|
|
2147
2134
|
...chatboxDefaults,
|
|
2148
|
-
|
|
2149
|
-
// The fresh-Lumia defaults assume the streamer is creating a new
|
|
2150
|
-
// chatbox; SE-imported ones have opinions that differ. Override
|
|
2151
|
-
// only those.
|
|
2152
|
-
theme: mapChatboxTheme(v.theme),
|
|
2135
|
+
theme: "simple",
|
|
2153
2136
|
fadeOutAfterDelay: fadeOutSeconds > 0,
|
|
2154
2137
|
fadeOutDelayTime: fadeOutSeconds,
|
|
2155
|
-
ignoredList: Array.isArray(v.ignored) ? v.ignored : [],
|
|
2156
|
-
// SE chat widgets default to showing avatars + site icons + tight
|
|
2157
|
-
// line wrapping; Lumia's fresh default is the opposite.
|
|
2158
2138
|
showAvatar: true,
|
|
2159
|
-
showSiteIcon: true,
|
|
2160
2139
|
breakLine: false,
|
|
2161
|
-
clickableChatterProfiles: true,
|
|
2162
|
-
hideAlertMessage: false,
|
|
2163
|
-
// Carry the SE message-level font override and the streamer's
|
|
2164
|
-
// accent color across so the imported chatbox looks right at
|
|
2165
|
-
// first paint. Background lives on `module.css.background`
|
|
2166
|
-
// above — `content.background` was a dead write the renderer
|
|
2167
|
-
// never read.
|
|
2168
|
-
...messageFontFamily ? { messageFontFamily } : {},
|
|
2169
|
-
// Twitch primary color override — deep-merge into the full
|
|
2170
|
-
// chatboxStreamingSite map from the default (otherwise we'd
|
|
2171
|
-
// clobber the youtube/kick/facebook/tiktok/discord entries the
|
|
2172
|
-
// chatbox renderer reads for per-platform theming).
|
|
2173
2140
|
...accentColor ? {
|
|
2174
2141
|
chatboxStreamingSite: {
|
|
2175
2142
|
...chatboxDefaults.chatboxStreamingSite,
|
|
@@ -2181,18 +2148,7 @@ function mapChatbox(widget, ctx) {
|
|
|
2181
2148
|
}
|
|
2182
2149
|
}
|
|
2183
2150
|
}
|
|
2184
|
-
} : {}
|
|
2185
|
-
// Source-side knobs preserved under the generic importMeta envelope —
|
|
2186
|
-
// no native Lumia equivalent today. `messageDelay` is per-message
|
|
2187
|
-
// hold, `initialDelay` is the show-after-connect delay, and we
|
|
2188
|
-
// stash the raw highlight block + text css for any future feature
|
|
2189
|
-
// that wants the fine-grained styling.
|
|
2190
|
-
importMeta: buildImportMeta(widget, {
|
|
2191
|
-
messageDelay: v.messageDelay,
|
|
2192
|
-
initialDelay: v.delay,
|
|
2193
|
-
highlightUsers: v.highlight,
|
|
2194
|
-
textCss
|
|
2195
|
-
})
|
|
2151
|
+
} : {}
|
|
2196
2152
|
}
|
|
2197
2153
|
},
|
|
2198
2154
|
ctx
|