@lumiastream/ui 0.3.4 → 0.3.6
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 +60 -26
- package/dist/se-import.js +60 -26
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3927,7 +3927,7 @@ function mapSeTextCssToModuleCss(widget, defaults = {}) {
|
|
|
3927
3927
|
if (typeof v === "string" && v.length > 0) return v;
|
|
3928
3928
|
return fallback;
|
|
3929
3929
|
};
|
|
3930
|
-
|
|
3930
|
+
const out = {
|
|
3931
3931
|
lineHeight: asNumOrStr(
|
|
3932
3932
|
seTextCss["line-height"],
|
|
3933
3933
|
defaults.lineHeight ?? "normal"
|
|
@@ -3951,6 +3951,15 @@ function mapSeTextCssToModuleCss(widget, defaults = {}) {
|
|
|
3951
3951
|
),
|
|
3952
3952
|
background: defaults.background ?? "transparent"
|
|
3953
3953
|
};
|
|
3954
|
+
const ls = seTextCss["letter-spacing"];
|
|
3955
|
+
if (typeof ls === "number" || typeof ls === "string" && ls.length > 0) out.letterSpacing = ls;
|
|
3956
|
+
const ws = seTextCss["word-spacing"];
|
|
3957
|
+
if (typeof ws === "number" || typeof ws === "string" && ws.length > 0) out.wordSpacing = ws;
|
|
3958
|
+
const sw = seTextCss["-webkit-text-stroke-width"];
|
|
3959
|
+
if (typeof sw === "number" || typeof sw === "string" && sw.length > 0) out.WebkitTextStrokeWidth = sw;
|
|
3960
|
+
const sc = seTextCss["-webkit-text-stroke-color"];
|
|
3961
|
+
if (typeof sc === "string" && sc.length > 0) out.WebkitTextStrokeColor = sc;
|
|
3962
|
+
return out;
|
|
3954
3963
|
}
|
|
3955
3964
|
var READOUT_AUTO_FALLBACK_SIZE = { width: 400, height: 50 };
|
|
3956
3965
|
function buildUnit(widget, lumiaType, moduleExtras, ctx, sizeOverride) {
|
|
@@ -4004,9 +4013,11 @@ function seExtraTextCss(seCss, scrolling) {
|
|
|
4004
4013
|
if (typeof seCss["font-style"] === "string")
|
|
4005
4014
|
extra.fontStyle = seCss["font-style"];
|
|
4006
4015
|
if (seCss["-webkit-text-stroke-color"])
|
|
4007
|
-
extra
|
|
4016
|
+
extra.WebkitTextStrokeColor = seCss["-webkit-text-stroke-color"];
|
|
4008
4017
|
if (seCss["-webkit-text-stroke-width"] != null)
|
|
4009
|
-
extra
|
|
4018
|
+
extra.WebkitTextStrokeWidth = seCss["-webkit-text-stroke-width"];
|
|
4019
|
+
if (seCss["letter-spacing"] != null) extra.letterSpacing = seCss["letter-spacing"];
|
|
4020
|
+
if (seCss["word-spacing"] != null) extra.wordSpacing = seCss["word-spacing"];
|
|
4010
4021
|
if (scrolling?.enabled) {
|
|
4011
4022
|
extra.scroll = true;
|
|
4012
4023
|
const speed = Number(scrolling.speed);
|
|
@@ -4643,7 +4654,11 @@ var SOURCE_TO_LUMIA_FIELD_TYPE = {
|
|
|
4643
4654
|
// SE-side trigger buttons → native action button.
|
|
4644
4655
|
button: "actionbutton"
|
|
4645
4656
|
};
|
|
4646
|
-
var RESERVED_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
4657
|
+
var RESERVED_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
4658
|
+
"widgetName",
|
|
4659
|
+
"widgetAuthor",
|
|
4660
|
+
"widgetDuration"
|
|
4661
|
+
]);
|
|
4647
4662
|
function translateConfigs(sourceFields) {
|
|
4648
4663
|
if (!sourceFields) return [];
|
|
4649
4664
|
return Object.entries(sourceFields).filter(([key]) => !RESERVED_FIELD_KEYS.has(key)).map(([key, f]) => {
|
|
@@ -4660,6 +4675,20 @@ function translateConfigs(sourceFields) {
|
|
|
4660
4675
|
options: f.options
|
|
4661
4676
|
};
|
|
4662
4677
|
if (sourceType === "hidden") base.hidden = true;
|
|
4678
|
+
if (sourceType === "slider") {
|
|
4679
|
+
const sliderOptions = { ...f.options ?? {} };
|
|
4680
|
+
if (f.min != null && sliderOptions.min == null)
|
|
4681
|
+
sliderOptions.min = f.min;
|
|
4682
|
+
if (f.max != null && sliderOptions.max == null)
|
|
4683
|
+
sliderOptions.max = f.max;
|
|
4684
|
+
if (f.step != null && sliderOptions.step == null)
|
|
4685
|
+
sliderOptions.step = f.step;
|
|
4686
|
+
if (f.prefix != null && sliderOptions.prefix == null)
|
|
4687
|
+
sliderOptions.prefix = f.prefix;
|
|
4688
|
+
if (f.suffix != null && sliderOptions.suffix == null)
|
|
4689
|
+
sliderOptions.suffix = f.suffix;
|
|
4690
|
+
base.options = sliderOptions;
|
|
4691
|
+
}
|
|
4663
4692
|
return base;
|
|
4664
4693
|
});
|
|
4665
4694
|
}
|
|
@@ -4678,28 +4707,33 @@ function mapCustom(widget, ctx) {
|
|
|
4678
4707
|
const fieldData = parse(v.fieldData) ?? v.fieldData;
|
|
4679
4708
|
const widgetProvider = widget.provider;
|
|
4680
4709
|
const provider = widgetProvider === "kick" || widgetProvider === "youtube" || widgetProvider === "twitch" ? widgetProvider : ctx?.provider ?? "twitch";
|
|
4681
|
-
return buildUnit(
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4710
|
+
return buildUnit(
|
|
4711
|
+
widget,
|
|
4712
|
+
"custom",
|
|
4713
|
+
{
|
|
4714
|
+
content: {
|
|
4715
|
+
// SE widget ids are integers unique only within a single SE overlay
|
|
4716
|
+
// (1, 2, 3…). Using them as Lumia codeIds would collide across
|
|
4717
|
+
// imports — codeId is the scoping key for variables, storage, and
|
|
4718
|
+
// event listeners. Mint a fresh nanoid so every imported widget
|
|
4719
|
+
// has its own scope.
|
|
4720
|
+
codeId: nanoid2(),
|
|
4721
|
+
html: v.html ?? "",
|
|
4722
|
+
css: v.css ?? "",
|
|
4723
|
+
js: v.js ?? "",
|
|
4724
|
+
configs: translateConfigs(fields),
|
|
4725
|
+
data: fieldData ?? {},
|
|
4726
|
+
flavor: "streamelements",
|
|
4727
|
+
// Native field on the Custom module content. The compatibility
|
|
4728
|
+
// shim in Embed.tsx reads this to pick the right listener-name
|
|
4729
|
+
// mapping table when forwarding Lumia events into the iframe as
|
|
4730
|
+
// `onEventReceived` payloads. Default 'twitch' matches the shim's
|
|
4731
|
+
// historical default so legacy imports keep working.
|
|
4732
|
+
sourceProvider: provider
|
|
4733
|
+
}
|
|
4734
|
+
},
|
|
4735
|
+
ctx
|
|
4736
|
+
);
|
|
4703
4737
|
}
|
|
4704
4738
|
|
|
4705
4739
|
// src/se-import/mappers/misc.ts
|
package/dist/se-import.js
CHANGED
|
@@ -800,7 +800,7 @@ function mapSeTextCssToModuleCss(widget, defaults = {}) {
|
|
|
800
800
|
if (typeof v === "string" && v.length > 0) return v;
|
|
801
801
|
return fallback;
|
|
802
802
|
};
|
|
803
|
-
|
|
803
|
+
const out = {
|
|
804
804
|
lineHeight: asNumOrStr(
|
|
805
805
|
seTextCss["line-height"],
|
|
806
806
|
defaults.lineHeight ?? "normal"
|
|
@@ -824,6 +824,15 @@ function mapSeTextCssToModuleCss(widget, defaults = {}) {
|
|
|
824
824
|
),
|
|
825
825
|
background: defaults.background ?? "transparent"
|
|
826
826
|
};
|
|
827
|
+
const ls = seTextCss["letter-spacing"];
|
|
828
|
+
if (typeof ls === "number" || typeof ls === "string" && ls.length > 0) out.letterSpacing = ls;
|
|
829
|
+
const ws = seTextCss["word-spacing"];
|
|
830
|
+
if (typeof ws === "number" || typeof ws === "string" && ws.length > 0) out.wordSpacing = ws;
|
|
831
|
+
const sw = seTextCss["-webkit-text-stroke-width"];
|
|
832
|
+
if (typeof sw === "number" || typeof sw === "string" && sw.length > 0) out.WebkitTextStrokeWidth = sw;
|
|
833
|
+
const sc = seTextCss["-webkit-text-stroke-color"];
|
|
834
|
+
if (typeof sc === "string" && sc.length > 0) out.WebkitTextStrokeColor = sc;
|
|
835
|
+
return out;
|
|
827
836
|
}
|
|
828
837
|
var READOUT_AUTO_FALLBACK_SIZE = { width: 400, height: 50 };
|
|
829
838
|
function buildUnit(widget, lumiaType, moduleExtras, ctx, sizeOverride) {
|
|
@@ -877,9 +886,11 @@ function seExtraTextCss(seCss, scrolling) {
|
|
|
877
886
|
if (typeof seCss["font-style"] === "string")
|
|
878
887
|
extra.fontStyle = seCss["font-style"];
|
|
879
888
|
if (seCss["-webkit-text-stroke-color"])
|
|
880
|
-
extra
|
|
889
|
+
extra.WebkitTextStrokeColor = seCss["-webkit-text-stroke-color"];
|
|
881
890
|
if (seCss["-webkit-text-stroke-width"] != null)
|
|
882
|
-
extra
|
|
891
|
+
extra.WebkitTextStrokeWidth = seCss["-webkit-text-stroke-width"];
|
|
892
|
+
if (seCss["letter-spacing"] != null) extra.letterSpacing = seCss["letter-spacing"];
|
|
893
|
+
if (seCss["word-spacing"] != null) extra.wordSpacing = seCss["word-spacing"];
|
|
883
894
|
if (scrolling?.enabled) {
|
|
884
895
|
extra.scroll = true;
|
|
885
896
|
const speed = Number(scrolling.speed);
|
|
@@ -1516,7 +1527,11 @@ var SOURCE_TO_LUMIA_FIELD_TYPE = {
|
|
|
1516
1527
|
// SE-side trigger buttons → native action button.
|
|
1517
1528
|
button: "actionbutton"
|
|
1518
1529
|
};
|
|
1519
|
-
var RESERVED_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
1530
|
+
var RESERVED_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
1531
|
+
"widgetName",
|
|
1532
|
+
"widgetAuthor",
|
|
1533
|
+
"widgetDuration"
|
|
1534
|
+
]);
|
|
1520
1535
|
function translateConfigs(sourceFields) {
|
|
1521
1536
|
if (!sourceFields) return [];
|
|
1522
1537
|
return Object.entries(sourceFields).filter(([key]) => !RESERVED_FIELD_KEYS.has(key)).map(([key, f]) => {
|
|
@@ -1533,6 +1548,20 @@ function translateConfigs(sourceFields) {
|
|
|
1533
1548
|
options: f.options
|
|
1534
1549
|
};
|
|
1535
1550
|
if (sourceType === "hidden") base.hidden = true;
|
|
1551
|
+
if (sourceType === "slider") {
|
|
1552
|
+
const sliderOptions = { ...f.options ?? {} };
|
|
1553
|
+
if (f.min != null && sliderOptions.min == null)
|
|
1554
|
+
sliderOptions.min = f.min;
|
|
1555
|
+
if (f.max != null && sliderOptions.max == null)
|
|
1556
|
+
sliderOptions.max = f.max;
|
|
1557
|
+
if (f.step != null && sliderOptions.step == null)
|
|
1558
|
+
sliderOptions.step = f.step;
|
|
1559
|
+
if (f.prefix != null && sliderOptions.prefix == null)
|
|
1560
|
+
sliderOptions.prefix = f.prefix;
|
|
1561
|
+
if (f.suffix != null && sliderOptions.suffix == null)
|
|
1562
|
+
sliderOptions.suffix = f.suffix;
|
|
1563
|
+
base.options = sliderOptions;
|
|
1564
|
+
}
|
|
1536
1565
|
return base;
|
|
1537
1566
|
});
|
|
1538
1567
|
}
|
|
@@ -1551,28 +1580,33 @@ function mapCustom(widget, ctx) {
|
|
|
1551
1580
|
const fieldData = parse(v.fieldData) ?? v.fieldData;
|
|
1552
1581
|
const widgetProvider = widget.provider;
|
|
1553
1582
|
const provider = widgetProvider === "kick" || widgetProvider === "youtube" || widgetProvider === "twitch" ? widgetProvider : ctx?.provider ?? "twitch";
|
|
1554
|
-
return buildUnit(
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1583
|
+
return buildUnit(
|
|
1584
|
+
widget,
|
|
1585
|
+
"custom",
|
|
1586
|
+
{
|
|
1587
|
+
content: {
|
|
1588
|
+
// SE widget ids are integers unique only within a single SE overlay
|
|
1589
|
+
// (1, 2, 3…). Using them as Lumia codeIds would collide across
|
|
1590
|
+
// imports — codeId is the scoping key for variables, storage, and
|
|
1591
|
+
// event listeners. Mint a fresh nanoid so every imported widget
|
|
1592
|
+
// has its own scope.
|
|
1593
|
+
codeId: nanoid2(),
|
|
1594
|
+
html: v.html ?? "",
|
|
1595
|
+
css: v.css ?? "",
|
|
1596
|
+
js: v.js ?? "",
|
|
1597
|
+
configs: translateConfigs(fields),
|
|
1598
|
+
data: fieldData ?? {},
|
|
1599
|
+
flavor: "streamelements",
|
|
1600
|
+
// Native field on the Custom module content. The compatibility
|
|
1601
|
+
// shim in Embed.tsx reads this to pick the right listener-name
|
|
1602
|
+
// mapping table when forwarding Lumia events into the iframe as
|
|
1603
|
+
// `onEventReceived` payloads. Default 'twitch' matches the shim's
|
|
1604
|
+
// historical default so legacy imports keep working.
|
|
1605
|
+
sourceProvider: provider
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
ctx
|
|
1609
|
+
);
|
|
1576
1610
|
}
|
|
1577
1611
|
|
|
1578
1612
|
// src/se-import/mappers/misc.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumiastream/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"author": "Lumia Stream",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Lumia UI Kit",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"vitest": "^4.1.6"
|
|
129
129
|
},
|
|
130
130
|
"dependencies": {
|
|
131
|
-
"@lumiastream/lumia-translations": "1.
|
|
131
|
+
"@lumiastream/lumia-translations": "1.16.0",
|
|
132
132
|
"@lumiastream/lumia-types": "^3.3.7-alpha.2",
|
|
133
133
|
"classnames": "^2.5.1",
|
|
134
134
|
"globals": "^17.4.0",
|