@lumiastream/ui 0.2.8-alpha.8 → 0.2.8-alpha.9
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 +99 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3825,24 +3825,113 @@ function mapCustom(widget) {
|
|
|
3825
3825
|
}
|
|
3826
3826
|
|
|
3827
3827
|
// src/se-import/mappers/misc.ts
|
|
3828
|
+
function mapChatboxTheme(seTheme) {
|
|
3829
|
+
const t = (seTheme ?? "").toString().toLowerCase();
|
|
3830
|
+
if (!t || t === "default") return "simple";
|
|
3831
|
+
if (t.includes("flipin") || t.includes("bubble") || t.includes("bubbly")) return "bubbly";
|
|
3832
|
+
if (t.includes("glass") || t.includes("transparent")) return "glass";
|
|
3833
|
+
if (t.includes("boxy") || t.includes("checker")) return "boxy";
|
|
3834
|
+
if (t.includes("basic")) return "basic";
|
|
3835
|
+
return "simple";
|
|
3836
|
+
}
|
|
3837
|
+
function paddingShorthand(message) {
|
|
3838
|
+
const pick = (key) => {
|
|
3839
|
+
const raw = message?.[key];
|
|
3840
|
+
if (raw == null || raw === "") return null;
|
|
3841
|
+
const n = typeof raw === "number" ? raw : parseFloat(String(raw));
|
|
3842
|
+
return Number.isFinite(n) ? n : null;
|
|
3843
|
+
};
|
|
3844
|
+
const t = pick("padding-top");
|
|
3845
|
+
const r = pick("padding-right");
|
|
3846
|
+
const b = pick("padding-bottom");
|
|
3847
|
+
const l = pick("padding-left");
|
|
3848
|
+
if (t == null && r == null && b == null && l == null) return void 0;
|
|
3849
|
+
const px = (n) => `${n ?? 0}px`;
|
|
3850
|
+
return `${px(t)} ${px(r)} ${px(b)} ${px(l)}`;
|
|
3851
|
+
}
|
|
3828
3852
|
function mapChatbox(widget) {
|
|
3829
3853
|
const v = widget.variables ?? {};
|
|
3830
|
-
const
|
|
3854
|
+
const textCss = widget.text?.css ?? {};
|
|
3855
|
+
const messageCss = textCss.message ?? {};
|
|
3856
|
+
const fadeOutSeconds = typeof v.fadeOut === "number" ? v.fadeOut : v.fadeOut === true ? 30 : 0;
|
|
3857
|
+
const messagePadding = paddingShorthand(messageCss);
|
|
3858
|
+
const DEFAULT_CHATBOX_FONT_SIZE = 14;
|
|
3859
|
+
const moduleCss = {};
|
|
3860
|
+
if (textCss["font-family"] != null) moduleCss.fontFamily = textCss["font-family"];
|
|
3861
|
+
moduleCss.fontSize = textCss["font-size"] != null ? textCss["font-size"] : DEFAULT_CHATBOX_FONT_SIZE;
|
|
3862
|
+
if (textCss["color"] != null) moduleCss.color = textCss["color"];
|
|
3863
|
+
if (textCss["font-weight"] != null) moduleCss.fontWeight = textCss["font-weight"];
|
|
3864
|
+
if (textCss["text-shadow"] != null) moduleCss.textShadow = textCss["text-shadow"];
|
|
3865
|
+
if (textCss["text-align"] != null) moduleCss.textAlign = textCss["text-align"];
|
|
3866
|
+
if (textCss["line-height"] != null) moduleCss.lineHeight = textCss["line-height"];
|
|
3867
|
+
if (messagePadding) moduleCss.padding = messagePadding;
|
|
3868
|
+
const DEFAULT_CHATBOX_BG = "#1e1e1e";
|
|
3869
|
+
const messageBackground = typeof messageCss["background"] === "string" && messageCss["background"].length > 0 ? messageCss["background"] : DEFAULT_CHATBOX_BG;
|
|
3870
|
+
moduleCss.background = messageBackground;
|
|
3871
|
+
const messageFontFamily = typeof messageCss["font-family"] === "string" && messageCss["font-family"].length > 0 ? messageCss["font-family"] : void 0;
|
|
3872
|
+
const highlightBackground = v.highlight && typeof v.highlight === "object" && typeof v.highlight["background"] === "string" ? v.highlight["background"] : void 0;
|
|
3873
|
+
const accentColor = highlightBackground && highlightBackground.length > 0 ? highlightBackground : void 0;
|
|
3831
3874
|
return buildUnit(widget, "chatbox", {
|
|
3875
|
+
// Visual styling (font / color / padding etc) lives on module.css, not
|
|
3876
|
+
// content. Lumia's TextStyle settings panel + the chatbox renderer both
|
|
3877
|
+
// read from here.
|
|
3878
|
+
css: moduleCss,
|
|
3832
3879
|
content: {
|
|
3833
|
-
theme: v.theme
|
|
3880
|
+
theme: mapChatboxTheme(v.theme),
|
|
3834
3881
|
fadeOutAfterDelay: fadeOutSeconds > 0,
|
|
3835
3882
|
fadeOutDelayTime: fadeOutSeconds,
|
|
3883
|
+
// Defaults Lumia's chatbox renderer + UI expect on every module.
|
|
3884
|
+
// Without these the chatbox silently dropped messages (the
|
|
3885
|
+
// `ignoredStreamingSites` truthy gate), rendered in the wrong
|
|
3886
|
+
// theme (no theme → blank list), or showed missing controls in
|
|
3887
|
+
// settings. `ignoredList` carries SE's per-user ignore list across.
|
|
3888
|
+
ignoredList: Array.isArray(v.ignored) ? v.ignored : [],
|
|
3889
|
+
ignoredStreamingSites: [],
|
|
3890
|
+
horizontal: false,
|
|
3891
|
+
reverseFlow: false,
|
|
3892
|
+
hideAlerts: false,
|
|
3893
|
+
hideAlertMessage: false,
|
|
3836
3894
|
showAvatar: true,
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3895
|
+
showBadges: true,
|
|
3896
|
+
showEmotes: true,
|
|
3897
|
+
showSiteIcon: true,
|
|
3898
|
+
showTimestamp: false,
|
|
3899
|
+
breakLine: false,
|
|
3900
|
+
hyperClickableLinks: true,
|
|
3901
|
+
clickableChatterProfiles: true,
|
|
3902
|
+
previewMediaInChat: true,
|
|
3903
|
+
maxItemsToShow: 20,
|
|
3904
|
+
removeAfter: 3e4,
|
|
3905
|
+
itemGap: 8,
|
|
3906
|
+
borderRadius: "10px",
|
|
3907
|
+
bgOpacity: 0.4,
|
|
3908
|
+
animations: {
|
|
3909
|
+
enterAnimation: "fadeIn",
|
|
3910
|
+
exitAnimation: "fadeOut",
|
|
3911
|
+
enterAnimationDuration: 1e3,
|
|
3912
|
+
exitAnimationDuration: 1e3,
|
|
3913
|
+
enterAnimationDelay: 0,
|
|
3914
|
+
exitAnimationDelay: 0
|
|
3915
|
+
},
|
|
3916
|
+
// Carry the SE message-level font override and the streamer's
|
|
3917
|
+
// accent color across so the imported chatbox looks right at
|
|
3918
|
+
// first paint. Background lives on `module.css.background`
|
|
3919
|
+
// above — `content.background` was a dead write the renderer
|
|
3920
|
+
// never read.
|
|
3921
|
+
...messageFontFamily ? { messageFontFamily } : {},
|
|
3922
|
+
...accentColor ? {
|
|
3923
|
+
chatboxStreamingSite: {
|
|
3924
|
+
twitch: { themeConfig: { primaryColor: accentColor, showUsernameColors: true } }
|
|
3925
|
+
}
|
|
3926
|
+
} : {},
|
|
3927
|
+
// SE-only fields preserved as provenance — no native Lumia equivalent.
|
|
3928
|
+
// `delay` / `messageDelay` (initial + per-message hold), and the
|
|
3929
|
+
// raw highlight block in case a future Lumia feature wants the
|
|
3930
|
+
// fine-grained styling.
|
|
3840
3931
|
se_message_delay: v.messageDelay,
|
|
3841
3932
|
se_initial_delay: v.delay,
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
se_ignored_users: v.ignored,
|
|
3845
|
-
se_highlight_users: v.highlight
|
|
3933
|
+
se_highlight_users: v.highlight,
|
|
3934
|
+
se_text_css: textCss
|
|
3846
3935
|
}
|
|
3847
3936
|
});
|
|
3848
3937
|
}
|
|
@@ -7118,7 +7207,7 @@ function SEImportWizard({
|
|
|
7118
7207
|
onClose();
|
|
7119
7208
|
},
|
|
7120
7209
|
disabled: loading || importing,
|
|
7121
|
-
label: translate("
|
|
7210
|
+
label: translate("common.cancel", "Cancel")
|
|
7122
7211
|
}
|
|
7123
7212
|
),
|
|
7124
7213
|
step !== "mode" && /* @__PURE__ */ jsx13(
|