@lumiastream/ui 0.2.8-alpha.7 → 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 +130 -13
- 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
|
}
|
|
@@ -3992,13 +4081,38 @@ function mapCredits(widget) {
|
|
|
3992
4081
|
}
|
|
3993
4082
|
});
|
|
3994
4083
|
}
|
|
4084
|
+
function inferSlideshowMediaType(mime, url) {
|
|
4085
|
+
if (typeof mime === "string") {
|
|
4086
|
+
if (mime.startsWith("video/")) return "video";
|
|
4087
|
+
if (mime.startsWith("image/")) return "image";
|
|
4088
|
+
}
|
|
4089
|
+
const ext = url.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() ?? "";
|
|
4090
|
+
if (["mp4", "webm", "mov", "m4v", "ogv"].includes(ext)) return "video";
|
|
4091
|
+
return "image";
|
|
4092
|
+
}
|
|
4093
|
+
function nameFromUrl(url) {
|
|
4094
|
+
try {
|
|
4095
|
+
const path = url.split("?")[0].split("#")[0];
|
|
4096
|
+
return decodeURIComponent(path.split("/").pop() ?? url);
|
|
4097
|
+
} catch {
|
|
4098
|
+
return url;
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
3995
4101
|
function mapSlideshow(widget) {
|
|
3996
4102
|
const v = widget.variables ?? {};
|
|
3997
|
-
const
|
|
4103
|
+
const items = (v.images ?? []).map((raw) => {
|
|
4104
|
+
const url = typeof raw === "string" ? raw : raw.url ?? raw.src ?? "";
|
|
4105
|
+
if (!url) return null;
|
|
4106
|
+
return {
|
|
4107
|
+
type: inferSlideshowMediaType(typeof raw === "object" ? raw?.type : void 0, url),
|
|
4108
|
+
src: url,
|
|
4109
|
+
name: nameFromUrl(url)
|
|
4110
|
+
};
|
|
4111
|
+
}).filter((item) => item !== null);
|
|
3998
4112
|
const seAnim = typeof v.animation === "object" && v.animation !== null ? v.animation : {};
|
|
3999
4113
|
return buildUnit(widget, "slideshow", {
|
|
4000
4114
|
content: {
|
|
4001
|
-
|
|
4115
|
+
src: items,
|
|
4002
4116
|
// `interval` of 0 = "rapid cycle" in SE (no delay between images); Lumia's
|
|
4003
4117
|
// `imageDuration` is the total ms per image. Distinguish three cases:
|
|
4004
4118
|
// - undefined → use 5000ms default
|
|
@@ -4009,7 +4123,10 @@ function mapSlideshow(widget) {
|
|
|
4009
4123
|
loopDelay: 0,
|
|
4010
4124
|
delay: 0,
|
|
4011
4125
|
playAudio: !!v.playAudio,
|
|
4012
|
-
|
|
4126
|
+
// Lumia's renderer reads `content.shuffle` (Slideshow/index.tsx:21);
|
|
4127
|
+
// mirroring SE's `random` to that name keeps "play in random order"
|
|
4128
|
+
// working out of the box.
|
|
4129
|
+
shuffle: !!v.random,
|
|
4013
4130
|
animation: {
|
|
4014
4131
|
enterAnimation: typeof v.animation === "string" ? v.animation : seAnim.in ?? "fadeIn",
|
|
4015
4132
|
exitAnimation: typeof v.animation === "string" ? v.animation : seAnim.out ?? "fadeOut",
|
|
@@ -7090,7 +7207,7 @@ function SEImportWizard({
|
|
|
7090
7207
|
onClose();
|
|
7091
7208
|
},
|
|
7092
7209
|
disabled: loading || importing,
|
|
7093
|
-
label: translate("
|
|
7210
|
+
label: translate("common.cancel", "Cancel")
|
|
7094
7211
|
}
|
|
7095
7212
|
),
|
|
7096
7213
|
step !== "mode" && /* @__PURE__ */ jsx13(
|