@lumiastream/ui 0.5.6 → 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 CHANGED
@@ -4126,7 +4126,7 @@ function mapText(widget, ctx) {
4126
4126
  fontWeight: seCss["font-weight"] ?? "bold",
4127
4127
  color: seCss["color"] ?? "#ffffff",
4128
4128
  textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
4129
- lineHeight: seCss["line-height"] ?? "normal",
4129
+ lineHeight: seCss["line-height"] ?? 1.5,
4130
4130
  background: "transparent",
4131
4131
  ...seExtraTextCss(seCss, widget.text?.scrolling)
4132
4132
  }
@@ -4245,7 +4245,7 @@ function mapReadout(widget, fallbackVar, ctx) {
4245
4245
  fontWeight: seCss["font-weight"] ?? "bold",
4246
4246
  color: seCss["color"] ?? "#ffffff",
4247
4247
  textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
4248
- lineHeight: seCss["line-height"] ?? "normal",
4248
+ lineHeight: seCss["line-height"] ?? 1.5,
4249
4249
  background: "transparent",
4250
4250
  ...seExtraTextCss(seCss, widget.text?.scrolling)
4251
4251
  }
@@ -5117,15 +5117,6 @@ var EVENTLIST_DEFAULT_MODULE = {
5117
5117
  };
5118
5118
 
5119
5119
  // src/se-import/mappers/misc.ts
5120
- function mapChatboxTheme(seTheme) {
5121
- const t = (seTheme ?? "").toString().toLowerCase();
5122
- if (!t || t === "default") return "simple";
5123
- if (t.includes("flipin") || t.includes("bubble") || t.includes("bubbly")) return "bubbly";
5124
- if (t.includes("glass") || t.includes("transparent")) return "glass";
5125
- if (t.includes("boxy") || t.includes("checker")) return "boxy";
5126
- if (t.includes("basic")) return "basic";
5127
- return "simple";
5128
- }
5129
5120
  function defaultChatboxBackgroundForSeTheme(seTheme) {
5130
5121
  const t = (seTheme ?? "").toString().toLowerCase();
5131
5122
  if (!t || t === "default") return "transparent";
@@ -5138,6 +5129,10 @@ function defaultChatboxBackgroundForSeTheme(seTheme) {
5138
5129
  return "#1e1e1e";
5139
5130
  return "#1e1e1e";
5140
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
+ }
5141
5136
  var KAPPAGEN_EVENT_CATEGORIES = {
5142
5137
  tip: [LumiaEventListTypes.DONATION],
5143
5138
  cheer: [
@@ -5169,96 +5164,59 @@ function kappagenAlertTriggersFor(seEvent, provider) {
5169
5164
  const fallback = kappagenKeyFor(seEvent, provider);
5170
5165
  return fallback ? [fallback] : [];
5171
5166
  }
5172
- function paddingShorthand(message) {
5173
- const pick = (key) => {
5174
- const raw = message?.[key];
5175
- if (raw == null || raw === "") return null;
5176
- const n = typeof raw === "number" ? raw : parseFloat(String(raw));
5177
- return Number.isFinite(n) ? n : null;
5178
- };
5179
- const t = pick("padding-top");
5180
- const r = pick("padding-right");
5181
- const b = pick("padding-bottom");
5182
- const l = pick("padding-left");
5183
- if (t == null && r == null && b == null && l == null) return void 0;
5184
- const px = (n) => `${n ?? 0}px`;
5185
- return `${px(t)} ${px(r)} ${px(b)} ${px(l)}`;
5186
- }
5187
5167
  function mapChatbox(widget, ctx) {
5188
5168
  const chatboxDefaults = CHATBOX_DEFAULT_MODULE.content;
5189
5169
  const chatboxVersion = CHATBOX_DEFAULT_MODULE.version;
5190
5170
  const v = widget.variables ?? {};
5191
5171
  const textCss = widget.text?.css ?? {};
5192
5172
  const messageCss = textCss.message ?? {};
5193
- const isPermanent = v.fadeOut === true || v.permanent === true || v.showMessagesPermanently === true || v.displayPermanent === true || // SE CustomChat uses `hideAfter: 999` as the "never hide" sentinel; also
5194
- // accept any falsy / non-positive value defensively.
5195
- v.hideAfter === false || typeof v.hideAfter === "number" && (v.hideAfter <= 0 || v.hideAfter >= 999);
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);
5196
5180
  const DEFAULT_FADE_SECONDS = 30;
5197
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;
5198
- const messagePadding = paddingShorthand(messageCss);
5199
5182
  const DEFAULT_CHATBOX_FONT_SIZE = 14;
5200
5183
  const moduleCss = {};
5201
- if (textCss["font-family"] != null) moduleCss.fontFamily = textCss["font-family"];
5202
- moduleCss.fontSize = textCss["font-size"] != null ? textCss["font-size"] : DEFAULT_CHATBOX_FONT_SIZE;
5203
- if (textCss["color"] != null) moduleCss.color = textCss["color"];
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;
5204
5201
  if (textCss["font-weight"] != null) moduleCss.fontWeight = textCss["font-weight"];
5205
- if (textCss["text-shadow"] != null) moduleCss.textShadow = textCss["text-shadow"];
5206
- if (textCss["text-align"] != null) moduleCss.textAlign = textCss["text-align"];
5207
5202
  if (textCss["line-height"] != null) moduleCss.lineHeight = textCss["line-height"];
5208
- if (messagePadding) moduleCss.padding = messagePadding;
5209
5203
  const messageBackground = typeof messageCss["background"] === "string" && messageCss["background"].length > 0 ? messageCss["background"] : defaultChatboxBackgroundForSeTheme(v.theme);
5210
5204
  moduleCss.background = messageBackground;
5211
- const messageFontFamily = typeof messageCss["font-family"] === "string" && messageCss["font-family"].length > 0 ? messageCss["font-family"] : void 0;
5212
5205
  const highlightBackground = v.highlight && typeof v.highlight === "object" && typeof v.highlight["background"] === "string" ? v.highlight["background"] : void 0;
5213
5206
  const accentColor = highlightBackground && highlightBackground.length > 0 ? highlightBackground : void 0;
5214
5207
  return buildUnit(
5215
5208
  widget,
5216
5209
  "chatbox",
5217
5210
  {
5218
- // Stamp the module version from the authoritative defaults so
5219
- // Overlay-UI's per-module Settings.tsx migration check
5220
- // (`module?.version !== currentVersion`) treats this import as
5221
- // already-current. Without this, every freshly-imported chatbox
5222
- // would trip the migration toast on first open even though the
5223
- // content is already complete.
5224
5211
  version: chatboxVersion,
5225
- // Visual styling (font / color / padding etc) lives on module.css, not
5226
- // content. Lumia's TextStyle settings panel + the chatbox renderer both
5227
- // read from here.
5228
5212
  css: moduleCss,
5229
5213
  content: {
5230
- // `chatboxDefaults` resolves host-injected first (preferred), then
5231
- // the local snapshot — see the top of this function. Spreading it
5232
- // here guarantees every field the chatbox renderer expects is
5233
- // present (`type`, `sites`, `useAnimatedEmotes`, etc.); the
5234
- // SE-specific override block below wins for the opinions that
5235
- // differ from a fresh-add.
5236
5214
  ...chatboxDefaults,
5237
- // ─── SE-specific overrides ────────────────────────────────────────
5238
- // The fresh-Lumia defaults assume the streamer is creating a new
5239
- // chatbox; SE-imported ones have opinions that differ. Override
5240
- // only those.
5241
- theme: mapChatboxTheme(v.theme),
5215
+ theme: "simple",
5242
5216
  fadeOutAfterDelay: fadeOutSeconds > 0,
5243
5217
  fadeOutDelayTime: fadeOutSeconds,
5244
- ignoredList: Array.isArray(v.ignored) ? v.ignored : [],
5245
- // SE chat widgets default to showing avatars + site icons + tight
5246
- // line wrapping; Lumia's fresh default is the opposite.
5247
5218
  showAvatar: true,
5248
- showSiteIcon: true,
5249
5219
  breakLine: false,
5250
- clickableChatterProfiles: true,
5251
- hideAlertMessage: false,
5252
- // Carry the SE message-level font override and the streamer's
5253
- // accent color across so the imported chatbox looks right at
5254
- // first paint. Background lives on `module.css.background`
5255
- // above — `content.background` was a dead write the renderer
5256
- // never read.
5257
- ...messageFontFamily ? { messageFontFamily } : {},
5258
- // Twitch primary color override — deep-merge into the full
5259
- // chatboxStreamingSite map from the default (otherwise we'd
5260
- // clobber the youtube/kick/facebook/tiktok/discord entries the
5261
- // chatbox renderer reads for per-platform theming).
5262
5220
  ...accentColor ? {
5263
5221
  chatboxStreamingSite: {
5264
5222
  ...chatboxDefaults.chatboxStreamingSite,
@@ -5270,18 +5228,7 @@ function mapChatbox(widget, ctx) {
5270
5228
  }
5271
5229
  }
5272
5230
  }
5273
- } : {},
5274
- // Source-side knobs preserved under the generic importMeta envelope —
5275
- // no native Lumia equivalent today. `messageDelay` is per-message
5276
- // hold, `initialDelay` is the show-after-connect delay, and we
5277
- // stash the raw highlight block + text css for any future feature
5278
- // that wants the fine-grained styling.
5279
- importMeta: buildImportMeta(widget, {
5280
- messageDelay: v.messageDelay,
5281
- initialDelay: v.delay,
5282
- highlightUsers: v.highlight,
5283
- textCss
5284
- })
5231
+ } : {}
5285
5232
  }
5286
5233
  },
5287
5234
  ctx
package/dist/se-import.js CHANGED
@@ -1046,7 +1046,7 @@ function mapText(widget, ctx) {
1046
1046
  fontWeight: seCss["font-weight"] ?? "bold",
1047
1047
  color: seCss["color"] ?? "#ffffff",
1048
1048
  textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
1049
- lineHeight: seCss["line-height"] ?? "normal",
1049
+ lineHeight: seCss["line-height"] ?? 1.5,
1050
1050
  background: "transparent",
1051
1051
  ...seExtraTextCss(seCss, widget.text?.scrolling)
1052
1052
  }
@@ -1165,7 +1165,7 @@ function mapReadout(widget, fallbackVar, ctx) {
1165
1165
  fontWeight: seCss["font-weight"] ?? "bold",
1166
1166
  color: seCss["color"] ?? "#ffffff",
1167
1167
  textShadow: seCss["text-shadow"] ?? "rgb(0, 0, 0) 1px 1px 1px",
1168
- lineHeight: seCss["line-height"] ?? "normal",
1168
+ lineHeight: seCss["line-height"] ?? 1.5,
1169
1169
  background: "transparent",
1170
1170
  ...seExtraTextCss(seCss, widget.text?.scrolling)
1171
1171
  }
@@ -2037,15 +2037,6 @@ var EVENTLIST_DEFAULT_MODULE = {
2037
2037
  };
2038
2038
 
2039
2039
  // src/se-import/mappers/misc.ts
2040
- function mapChatboxTheme(seTheme) {
2041
- const t = (seTheme ?? "").toString().toLowerCase();
2042
- if (!t || t === "default") return "simple";
2043
- if (t.includes("flipin") || t.includes("bubble") || t.includes("bubbly")) return "bubbly";
2044
- if (t.includes("glass") || t.includes("transparent")) return "glass";
2045
- if (t.includes("boxy") || t.includes("checker")) return "boxy";
2046
- if (t.includes("basic")) return "basic";
2047
- return "simple";
2048
- }
2049
2040
  function defaultChatboxBackgroundForSeTheme(seTheme) {
2050
2041
  const t = (seTheme ?? "").toString().toLowerCase();
2051
2042
  if (!t || t === "default") return "transparent";
@@ -2058,6 +2049,10 @@ function defaultChatboxBackgroundForSeTheme(seTheme) {
2058
2049
  return "#1e1e1e";
2059
2050
  return "#1e1e1e";
2060
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
+ }
2061
2056
  var KAPPAGEN_EVENT_CATEGORIES = {
2062
2057
  tip: [LumiaEventListTypes.DONATION],
2063
2058
  cheer: [
@@ -2089,96 +2084,59 @@ function kappagenAlertTriggersFor(seEvent, provider) {
2089
2084
  const fallback = kappagenKeyFor(seEvent, provider);
2090
2085
  return fallback ? [fallback] : [];
2091
2086
  }
2092
- function paddingShorthand(message) {
2093
- const pick = (key) => {
2094
- const raw = message?.[key];
2095
- if (raw == null || raw === "") return null;
2096
- const n = typeof raw === "number" ? raw : parseFloat(String(raw));
2097
- return Number.isFinite(n) ? n : null;
2098
- };
2099
- const t = pick("padding-top");
2100
- const r = pick("padding-right");
2101
- const b = pick("padding-bottom");
2102
- const l = pick("padding-left");
2103
- if (t == null && r == null && b == null && l == null) return void 0;
2104
- const px = (n) => `${n ?? 0}px`;
2105
- return `${px(t)} ${px(r)} ${px(b)} ${px(l)}`;
2106
- }
2107
2087
  function mapChatbox(widget, ctx) {
2108
2088
  const chatboxDefaults = CHATBOX_DEFAULT_MODULE.content;
2109
2089
  const chatboxVersion = CHATBOX_DEFAULT_MODULE.version;
2110
2090
  const v = widget.variables ?? {};
2111
2091
  const textCss = widget.text?.css ?? {};
2112
2092
  const messageCss = textCss.message ?? {};
2113
- const isPermanent = v.fadeOut === true || v.permanent === true || v.showMessagesPermanently === true || v.displayPermanent === true || // SE CustomChat uses `hideAfter: 999` as the "never hide" sentinel; also
2114
- // accept any falsy / non-positive value defensively.
2115
- v.hideAfter === false || typeof v.hideAfter === "number" && (v.hideAfter <= 0 || v.hideAfter >= 999);
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);
2116
2100
  const DEFAULT_FADE_SECONDS = 30;
2117
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;
2118
- const messagePadding = paddingShorthand(messageCss);
2119
2102
  const DEFAULT_CHATBOX_FONT_SIZE = 14;
2120
2103
  const moduleCss = {};
2121
- if (textCss["font-family"] != null) moduleCss.fontFamily = textCss["font-family"];
2122
- moduleCss.fontSize = textCss["font-size"] != null ? textCss["font-size"] : DEFAULT_CHATBOX_FONT_SIZE;
2123
- if (textCss["color"] != null) moduleCss.color = textCss["color"];
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;
2124
2121
  if (textCss["font-weight"] != null) moduleCss.fontWeight = textCss["font-weight"];
2125
- if (textCss["text-shadow"] != null) moduleCss.textShadow = textCss["text-shadow"];
2126
- if (textCss["text-align"] != null) moduleCss.textAlign = textCss["text-align"];
2127
2122
  if (textCss["line-height"] != null) moduleCss.lineHeight = textCss["line-height"];
2128
- if (messagePadding) moduleCss.padding = messagePadding;
2129
2123
  const messageBackground = typeof messageCss["background"] === "string" && messageCss["background"].length > 0 ? messageCss["background"] : defaultChatboxBackgroundForSeTheme(v.theme);
2130
2124
  moduleCss.background = messageBackground;
2131
- const messageFontFamily = typeof messageCss["font-family"] === "string" && messageCss["font-family"].length > 0 ? messageCss["font-family"] : void 0;
2132
2125
  const highlightBackground = v.highlight && typeof v.highlight === "object" && typeof v.highlight["background"] === "string" ? v.highlight["background"] : void 0;
2133
2126
  const accentColor = highlightBackground && highlightBackground.length > 0 ? highlightBackground : void 0;
2134
2127
  return buildUnit(
2135
2128
  widget,
2136
2129
  "chatbox",
2137
2130
  {
2138
- // Stamp the module version from the authoritative defaults so
2139
- // Overlay-UI's per-module Settings.tsx migration check
2140
- // (`module?.version !== currentVersion`) treats this import as
2141
- // already-current. Without this, every freshly-imported chatbox
2142
- // would trip the migration toast on first open even though the
2143
- // content is already complete.
2144
2131
  version: chatboxVersion,
2145
- // Visual styling (font / color / padding etc) lives on module.css, not
2146
- // content. Lumia's TextStyle settings panel + the chatbox renderer both
2147
- // read from here.
2148
2132
  css: moduleCss,
2149
2133
  content: {
2150
- // `chatboxDefaults` resolves host-injected first (preferred), then
2151
- // the local snapshot — see the top of this function. Spreading it
2152
- // here guarantees every field the chatbox renderer expects is
2153
- // present (`type`, `sites`, `useAnimatedEmotes`, etc.); the
2154
- // SE-specific override block below wins for the opinions that
2155
- // differ from a fresh-add.
2156
2134
  ...chatboxDefaults,
2157
- // ─── SE-specific overrides ────────────────────────────────────────
2158
- // The fresh-Lumia defaults assume the streamer is creating a new
2159
- // chatbox; SE-imported ones have opinions that differ. Override
2160
- // only those.
2161
- theme: mapChatboxTheme(v.theme),
2135
+ theme: "simple",
2162
2136
  fadeOutAfterDelay: fadeOutSeconds > 0,
2163
2137
  fadeOutDelayTime: fadeOutSeconds,
2164
- ignoredList: Array.isArray(v.ignored) ? v.ignored : [],
2165
- // SE chat widgets default to showing avatars + site icons + tight
2166
- // line wrapping; Lumia's fresh default is the opposite.
2167
2138
  showAvatar: true,
2168
- showSiteIcon: true,
2169
2139
  breakLine: false,
2170
- clickableChatterProfiles: true,
2171
- hideAlertMessage: false,
2172
- // Carry the SE message-level font override and the streamer's
2173
- // accent color across so the imported chatbox looks right at
2174
- // first paint. Background lives on `module.css.background`
2175
- // above — `content.background` was a dead write the renderer
2176
- // never read.
2177
- ...messageFontFamily ? { messageFontFamily } : {},
2178
- // Twitch primary color override — deep-merge into the full
2179
- // chatboxStreamingSite map from the default (otherwise we'd
2180
- // clobber the youtube/kick/facebook/tiktok/discord entries the
2181
- // chatbox renderer reads for per-platform theming).
2182
2140
  ...accentColor ? {
2183
2141
  chatboxStreamingSite: {
2184
2142
  ...chatboxDefaults.chatboxStreamingSite,
@@ -2190,18 +2148,7 @@ function mapChatbox(widget, ctx) {
2190
2148
  }
2191
2149
  }
2192
2150
  }
2193
- } : {},
2194
- // Source-side knobs preserved under the generic importMeta envelope —
2195
- // no native Lumia equivalent today. `messageDelay` is per-message
2196
- // hold, `initialDelay` is the show-after-connect delay, and we
2197
- // stash the raw highlight block + text css for any future feature
2198
- // that wants the fine-grained styling.
2199
- importMeta: buildImportMeta(widget, {
2200
- messageDelay: v.messageDelay,
2201
- initialDelay: v.delay,
2202
- highlightUsers: v.highlight,
2203
- textCss
2204
- })
2151
+ } : {}
2205
2152
  }
2206
2153
  },
2207
2154
  ctx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/ui",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "author": "Lumia Stream",
5
5
  "license": "ISC",
6
6
  "description": "Lumia UI Kit",