@lumiastream/ui 0.3.5 → 0.3.8
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/LSButton.js +1 -1
- package/dist/LSCheckbox.js +1 -1
- package/dist/LSColorPicker.js +1 -1
- package/dist/LSDatePicker.js +1 -1
- package/dist/LSFontPicker.js +1 -1
- package/dist/LSInput.js +1 -1
- package/dist/LSMultiSelect.js +1 -1
- package/dist/LSRadio.js +1 -1
- package/dist/LSSelect.js +1 -1
- package/dist/LSSliderInput.js +1 -1
- package/dist/LSTextField.js +1 -1
- package/dist/LSVariableInputField.js +14 -7
- package/dist/components.js +14 -7
- package/dist/index.js +60 -30
- package/dist/se-import.js +59 -29
- package/package.json +2 -2
package/dist/se-import.js
CHANGED
|
@@ -1527,7 +1527,11 @@ var SOURCE_TO_LUMIA_FIELD_TYPE = {
|
|
|
1527
1527
|
// SE-side trigger buttons → native action button.
|
|
1528
1528
|
button: "actionbutton"
|
|
1529
1529
|
};
|
|
1530
|
-
var RESERVED_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
1530
|
+
var RESERVED_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
1531
|
+
"widgetName",
|
|
1532
|
+
"widgetAuthor",
|
|
1533
|
+
"widgetDuration"
|
|
1534
|
+
]);
|
|
1531
1535
|
function translateConfigs(sourceFields) {
|
|
1532
1536
|
if (!sourceFields) return [];
|
|
1533
1537
|
return Object.entries(sourceFields).filter(([key]) => !RESERVED_FIELD_KEYS.has(key)).map(([key, f]) => {
|
|
@@ -1544,6 +1548,20 @@ function translateConfigs(sourceFields) {
|
|
|
1544
1548
|
options: f.options
|
|
1545
1549
|
};
|
|
1546
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
|
+
}
|
|
1547
1565
|
return base;
|
|
1548
1566
|
});
|
|
1549
1567
|
}
|
|
@@ -1562,28 +1580,33 @@ function mapCustom(widget, ctx) {
|
|
|
1562
1580
|
const fieldData = parse(v.fieldData) ?? v.fieldData;
|
|
1563
1581
|
const widgetProvider = widget.provider;
|
|
1564
1582
|
const provider = widgetProvider === "kick" || widgetProvider === "youtube" || widgetProvider === "twitch" ? widgetProvider : ctx?.provider ?? "twitch";
|
|
1565
|
-
return buildUnit(
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
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
|
+
);
|
|
1587
1610
|
}
|
|
1588
1611
|
|
|
1589
1612
|
// src/se-import/mappers/misc.ts
|
|
@@ -4846,7 +4869,7 @@ var humanizeVariableName = (rawName) => {
|
|
|
4846
4869
|
};
|
|
4847
4870
|
var getVariableColorClass = (variableType, isSuggested) => {
|
|
4848
4871
|
if (isSuggested && variableType !== "func")
|
|
4849
|
-
return "ls-variable-token--
|
|
4872
|
+
return "ls-variable-token--suggested";
|
|
4850
4873
|
if (variableType === "func") return "ls-variable-token--function";
|
|
4851
4874
|
if (variableType === "system") return "ls-variable-token--system";
|
|
4852
4875
|
return "ls-variable-token--custom";
|
|
@@ -4941,24 +4964,27 @@ var LSVariableInputField = forwardRef5((props, ref) => {
|
|
|
4941
4964
|
const [autoExpandPaths, setAutoExpandPaths] = useState4(
|
|
4942
4965
|
() => /* @__PURE__ */ new Set()
|
|
4943
4966
|
);
|
|
4967
|
+
const shouldRenderPicker = !hideVariables && showVariables;
|
|
4944
4968
|
const systemVariableValueTrees = useMemo3(() => {
|
|
4945
4969
|
const map = /* @__PURE__ */ new Map();
|
|
4970
|
+
if (!shouldRenderPicker) return map;
|
|
4946
4971
|
Object.values(variableRecords).forEach((variable) => {
|
|
4947
4972
|
if (variable && isExpandableValue(variable.value)) {
|
|
4948
4973
|
map.set(variable.name, buildValueChildren(variable.value, "", 0));
|
|
4949
4974
|
}
|
|
4950
4975
|
});
|
|
4951
4976
|
return map;
|
|
4952
|
-
}, [variableRecords]);
|
|
4977
|
+
}, [shouldRenderPicker, variableRecords]);
|
|
4953
4978
|
const allowedExampleTrees = useMemo3(() => {
|
|
4954
4979
|
const map = /* @__PURE__ */ new Map();
|
|
4980
|
+
if (!shouldRenderPicker) return map;
|
|
4955
4981
|
allowedVariableDefinitions.forEach((definition) => {
|
|
4956
4982
|
if (isExpandableValue(definition.example)) {
|
|
4957
4983
|
map.set(definition.name, buildValueChildren(definition.example, "", 0));
|
|
4958
4984
|
}
|
|
4959
4985
|
});
|
|
4960
4986
|
return map;
|
|
4961
|
-
}, [allowedVariableDefinitions]);
|
|
4987
|
+
}, [allowedVariableDefinitions, shouldRenderPicker]);
|
|
4962
4988
|
useEffect4(() => {
|
|
4963
4989
|
requestTranslations?.();
|
|
4964
4990
|
}, [requestTranslations]);
|
|
@@ -5174,6 +5200,9 @@ var LSVariableInputField = forwardRef5((props, ref) => {
|
|
|
5174
5200
|
[allowedExampleTrees, getAllowedVariableRecord, systemVariableValueTrees]
|
|
5175
5201
|
);
|
|
5176
5202
|
useEffect4(() => {
|
|
5203
|
+
if (!shouldRenderPicker) {
|
|
5204
|
+
return;
|
|
5205
|
+
}
|
|
5177
5206
|
const query = (searchQuery ?? "").toLowerCase().replace("{{", "").replace("}}", "").trim();
|
|
5178
5207
|
const nextAutoExpand = /* @__PURE__ */ new Set();
|
|
5179
5208
|
const collectNestedAutoExpand = (rootToken, tree) => {
|
|
@@ -5290,6 +5319,7 @@ var LSVariableInputField = forwardRef5((props, ref) => {
|
|
|
5290
5319
|
}
|
|
5291
5320
|
setAutoExpandPaths(nextAutoExpand);
|
|
5292
5321
|
}, [
|
|
5322
|
+
shouldRenderPicker,
|
|
5293
5323
|
searchQuery,
|
|
5294
5324
|
allowedVariableDefinitions,
|
|
5295
5325
|
allowedVariableNames,
|
|
@@ -5470,8 +5500,8 @@ var LSVariableInputField = forwardRef5((props, ref) => {
|
|
|
5470
5500
|
] })
|
|
5471
5501
|
);
|
|
5472
5502
|
};
|
|
5473
|
-
const showSuggestedSection = allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
|
|
5474
|
-
const pickerBody = /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker ls-variable-picker--three-col", children: [
|
|
5503
|
+
const showSuggestedSection = shouldRenderPicker && allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
|
|
5504
|
+
const pickerBody = shouldRenderPicker ? /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker ls-variable-picker--three-col", children: [
|
|
5475
5505
|
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__intro", children: [
|
|
5476
5506
|
/* @__PURE__ */ jsx12("div", { className: "ls-variable-picker__intro-text", children: t(
|
|
5477
5507
|
"overlay-variables.variables-description",
|
|
@@ -5572,7 +5602,7 @@ var LSVariableInputField = forwardRef5((props, ref) => {
|
|
|
5572
5602
|
] }, variable.name);
|
|
5573
5603
|
})
|
|
5574
5604
|
] })
|
|
5575
|
-
] });
|
|
5605
|
+
] }) : null;
|
|
5576
5606
|
const textField = (params = {}) => /* @__PURE__ */ jsx12(
|
|
5577
5607
|
VariableInputTextField,
|
|
5578
5608
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumiastream/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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",
|