@lumiastream/ui 0.4.3 → 0.4.4
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 +90 -64
- package/dist/se-import.js +90 -64
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4554,20 +4554,39 @@ function currentForListener(listener) {
|
|
|
4554
4554
|
return "0";
|
|
4555
4555
|
}
|
|
4556
4556
|
function charityGoalVariables(widgetType) {
|
|
4557
|
-
if (widgetType === "se-widget-tiltify-goal")
|
|
4558
|
-
|
|
4559
|
-
|
|
4557
|
+
if (widgetType === "se-widget-tiltify-goal")
|
|
4558
|
+
return {
|
|
4559
|
+
current: "{{tiltify_total_raised=0}}",
|
|
4560
|
+
targetGoal: "{{tiltify_goal_amount=100}}",
|
|
4561
|
+
source: "tiltify"
|
|
4562
|
+
};
|
|
4563
|
+
if (widgetType === "se-widget-extralife-goal")
|
|
4564
|
+
return {
|
|
4565
|
+
current: "{{extralife_total_raised=0}}",
|
|
4566
|
+
targetGoal: "{{extralife_goal_amount=100}}",
|
|
4567
|
+
source: "extralife"
|
|
4568
|
+
};
|
|
4569
|
+
if (widgetType === "se-widget-donor-drive-goal")
|
|
4570
|
+
return {
|
|
4571
|
+
current: "{{donordrive_total_raised=0}}",
|
|
4572
|
+
targetGoal: "{{donordrive_goal_amount=100}}",
|
|
4573
|
+
source: "donordrive"
|
|
4574
|
+
};
|
|
4560
4575
|
return null;
|
|
4561
4576
|
}
|
|
4562
4577
|
function sourceFromListener(listener) {
|
|
4563
4578
|
if (!listener) return "custom";
|
|
4564
|
-
if (listener === "follower-session" || listener === "follower-week" || listener === "follower-month")
|
|
4579
|
+
if (listener === "follower-session" || listener === "follower-week" || listener === "follower-month")
|
|
4580
|
+
return "twitch_followers_session";
|
|
4565
4581
|
if (listener.startsWith("follower-")) return "twitch_followers_total";
|
|
4566
|
-
if (listener === "subscriber-session" || listener === "subscriber-week" || listener === "subscriber-month")
|
|
4582
|
+
if (listener === "subscriber-session" || listener === "subscriber-week" || listener === "subscriber-month")
|
|
4583
|
+
return "twitch_subscribers_session";
|
|
4567
4584
|
if (listener.startsWith("subscriber-")) return "twitch_subscribers_total";
|
|
4568
|
-
if (listener === "cheer-session" || listener === "cheer-week" || listener === "cheer-month")
|
|
4585
|
+
if (listener === "cheer-session" || listener === "cheer-week" || listener === "cheer-month")
|
|
4586
|
+
return "twitch_bits_session";
|
|
4569
4587
|
if (listener.startsWith("cheer-")) return "twitch_bits_total";
|
|
4570
|
-
if (listener === "tip-session" || listener === "tip-week" || listener === "tip-month")
|
|
4588
|
+
if (listener === "tip-session" || listener === "tip-week" || listener === "tip-month")
|
|
4589
|
+
return "donations_session";
|
|
4571
4590
|
if (listener.startsWith("tip-")) return "donations_total";
|
|
4572
4591
|
if (listener === "merch-goal-orders") return "merch_orders";
|
|
4573
4592
|
if (listener === "merch-goal-items") return "merch_items";
|
|
@@ -4579,64 +4598,71 @@ function mapGoal(widget, ctx) {
|
|
|
4579
4598
|
const v = widget.variables ?? {};
|
|
4580
4599
|
const listener = v.goalListener ?? (typeof widget.listener === "string" ? widget.listener : null);
|
|
4581
4600
|
const charity = charityGoalVariables(widget.type);
|
|
4582
|
-
return buildUnit(
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4601
|
+
return buildUnit(
|
|
4602
|
+
widget,
|
|
4603
|
+
"goal",
|
|
4604
|
+
{
|
|
4605
|
+
content: {
|
|
4606
|
+
version: 1,
|
|
4607
|
+
// `slim` reproduces SE's default goal look. SE `simpleDesign`
|
|
4608
|
+
// is the text-only variant, so import it as Lumia's text layout
|
|
4609
|
+
// instead of carrying the flag as inert metadata.
|
|
4610
|
+
type: v.simpleDesign ? "text" : "slim",
|
|
4611
|
+
// Static label rendered above the goal bar — not an alert context.
|
|
4612
|
+
label: translateSeText(v.title ?? "Goal", null, void 0, void 0, {
|
|
4613
|
+
context: "static"
|
|
4614
|
+
}),
|
|
4615
|
+
subLabel: "",
|
|
4616
|
+
// The Goal module renders this template literal with {{current}} + {{goal}} substituted.
|
|
4617
|
+
// Charity goals track donation amounts — prefix `$` so the rendered bar reads
|
|
4618
|
+
// "$0 / $100" the way SE's charity goals do, instead of bare integers.
|
|
4619
|
+
display: v.dense ? "{{current}}" : charity ? "${{current}} / ${{goal}}" : "{{current}} / {{goal}}",
|
|
4620
|
+
// `current` is a template variable reference (resolved at render time from session variables).
|
|
4621
|
+
// `targetGoal` is the numeric ceiling. Both required by Goal/index.tsx:28-29.
|
|
4622
|
+
current: charity ? charity.current : currentForListener(listener),
|
|
4623
|
+
targetGoal: charity ? charity.targetGoal : String(v.goalAmount ?? 100),
|
|
4624
|
+
// Pre-select the Goal Manager source so opening the modal lands on
|
|
4625
|
+
// the right entry instead of falling through to 'custom'.
|
|
4626
|
+
source: charity ? charity.source : sourceFromListener(listener),
|
|
4627
|
+
image: "",
|
|
4628
|
+
audio: { decrement: "", increment: "", goal: "", goalFailed: "", volume: 1 },
|
|
4629
|
+
// `null` (rather than `''`) is the cleaner contract — `formatEndsIn`
|
|
4630
|
+
// in Goal/index.tsx treats both as "no deadline" so both work at
|
|
4631
|
+
// render time, but `null` survives JSON round-trips without
|
|
4632
|
+
// ambiguity ('' vs unset). The Goal module no longer hides itself
|
|
4633
|
+
// when the date passes; the "Ends in…" sublabel just disappears.
|
|
4634
|
+
endDate: v.endDate ?? null,
|
|
4635
|
+
goalAnimation: "",
|
|
4636
|
+
goalAnimationLoop: true,
|
|
4637
|
+
unfilledColor: v.backgroundColor ?? "#400022",
|
|
4638
|
+
filledColor: v.fillColor ?? "#ff0055",
|
|
4639
|
+
goalTheme: v.simpleDesign ? "text" : v.dense ? "compact" : "slim",
|
|
4640
|
+
condensed: !!v.dense,
|
|
4641
|
+
showPercentComplete: !!v.percent,
|
|
4642
|
+
alignItemsToEdges: false,
|
|
4643
|
+
border: "solid 1px transparent",
|
|
4644
|
+
borderRadius: "0px",
|
|
4645
|
+
highlightColor: "inherit",
|
|
4646
|
+
// Source-side knobs without a native Lumia equivalent live under the
|
|
4647
|
+
// generic `importMeta` envelope (see mappers/importMeta.ts).
|
|
4648
|
+
importMeta: buildImportMeta(widget, {
|
|
4649
|
+
sourceListener: listener,
|
|
4650
|
+
simpleDesign: !!v.simpleDesign
|
|
4651
|
+
})
|
|
4652
|
+
},
|
|
4653
|
+
// `borderRadius` / `borderStyle` / `borderWidth` / `borderColor`
|
|
4654
|
+
// used to be set on `css` too, but the Goal renderer applies its
|
|
4655
|
+
// own border + borderRadius via inline `style={…}` on the .goal-bar
|
|
4656
|
+
// div (see Goal/index.tsx:123,127,155) sourced from
|
|
4657
|
+
// `content.border` and `content.borderRadius`. Writing them to
|
|
4658
|
+
// module.css just plopped useless transparent-0px rules on the
|
|
4659
|
+
// outer .overlay-module wrapper. SE charity goals commonly use
|
|
4660
|
+
// 24-30px Nunito/Roboto — fontSize default of 30 mirrors the
|
|
4661
|
+
// previous hardcoded fallback.
|
|
4662
|
+
css: mapSeTextCssToModuleCss(widget, { fontSize: 30 })
|
|
4628
4663
|
},
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
// own border + borderRadius via inline `style={…}` on the .goal-bar
|
|
4632
|
-
// div (see Goal/index.tsx:123,127,155) sourced from
|
|
4633
|
-
// `content.border` and `content.borderRadius`. Writing them to
|
|
4634
|
-
// module.css just plopped useless transparent-0px rules on the
|
|
4635
|
-
// outer .overlay-module wrapper. SE charity goals commonly use
|
|
4636
|
-
// 24-30px Nunito/Roboto — fontSize default of 30 mirrors the
|
|
4637
|
-
// previous hardcoded fallback.
|
|
4638
|
-
css: mapSeTextCssToModuleCss(widget, { fontSize: 30 })
|
|
4639
|
-
}, ctx);
|
|
4664
|
+
ctx
|
|
4665
|
+
);
|
|
4640
4666
|
}
|
|
4641
4667
|
|
|
4642
4668
|
// src/se-import/mappers/custom.ts
|
package/dist/se-import.js
CHANGED
|
@@ -1420,20 +1420,39 @@ function currentForListener(listener) {
|
|
|
1420
1420
|
return "0";
|
|
1421
1421
|
}
|
|
1422
1422
|
function charityGoalVariables(widgetType) {
|
|
1423
|
-
if (widgetType === "se-widget-tiltify-goal")
|
|
1424
|
-
|
|
1425
|
-
|
|
1423
|
+
if (widgetType === "se-widget-tiltify-goal")
|
|
1424
|
+
return {
|
|
1425
|
+
current: "{{tiltify_total_raised=0}}",
|
|
1426
|
+
targetGoal: "{{tiltify_goal_amount=100}}",
|
|
1427
|
+
source: "tiltify"
|
|
1428
|
+
};
|
|
1429
|
+
if (widgetType === "se-widget-extralife-goal")
|
|
1430
|
+
return {
|
|
1431
|
+
current: "{{extralife_total_raised=0}}",
|
|
1432
|
+
targetGoal: "{{extralife_goal_amount=100}}",
|
|
1433
|
+
source: "extralife"
|
|
1434
|
+
};
|
|
1435
|
+
if (widgetType === "se-widget-donor-drive-goal")
|
|
1436
|
+
return {
|
|
1437
|
+
current: "{{donordrive_total_raised=0}}",
|
|
1438
|
+
targetGoal: "{{donordrive_goal_amount=100}}",
|
|
1439
|
+
source: "donordrive"
|
|
1440
|
+
};
|
|
1426
1441
|
return null;
|
|
1427
1442
|
}
|
|
1428
1443
|
function sourceFromListener(listener) {
|
|
1429
1444
|
if (!listener) return "custom";
|
|
1430
|
-
if (listener === "follower-session" || listener === "follower-week" || listener === "follower-month")
|
|
1445
|
+
if (listener === "follower-session" || listener === "follower-week" || listener === "follower-month")
|
|
1446
|
+
return "twitch_followers_session";
|
|
1431
1447
|
if (listener.startsWith("follower-")) return "twitch_followers_total";
|
|
1432
|
-
if (listener === "subscriber-session" || listener === "subscriber-week" || listener === "subscriber-month")
|
|
1448
|
+
if (listener === "subscriber-session" || listener === "subscriber-week" || listener === "subscriber-month")
|
|
1449
|
+
return "twitch_subscribers_session";
|
|
1433
1450
|
if (listener.startsWith("subscriber-")) return "twitch_subscribers_total";
|
|
1434
|
-
if (listener === "cheer-session" || listener === "cheer-week" || listener === "cheer-month")
|
|
1451
|
+
if (listener === "cheer-session" || listener === "cheer-week" || listener === "cheer-month")
|
|
1452
|
+
return "twitch_bits_session";
|
|
1435
1453
|
if (listener.startsWith("cheer-")) return "twitch_bits_total";
|
|
1436
|
-
if (listener === "tip-session" || listener === "tip-week" || listener === "tip-month")
|
|
1454
|
+
if (listener === "tip-session" || listener === "tip-week" || listener === "tip-month")
|
|
1455
|
+
return "donations_session";
|
|
1437
1456
|
if (listener.startsWith("tip-")) return "donations_total";
|
|
1438
1457
|
if (listener === "merch-goal-orders") return "merch_orders";
|
|
1439
1458
|
if (listener === "merch-goal-items") return "merch_items";
|
|
@@ -1445,64 +1464,71 @@ function mapGoal(widget, ctx) {
|
|
|
1445
1464
|
const v = widget.variables ?? {};
|
|
1446
1465
|
const listener = v.goalListener ?? (typeof widget.listener === "string" ? widget.listener : null);
|
|
1447
1466
|
const charity = charityGoalVariables(widget.type);
|
|
1448
|
-
return buildUnit(
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1467
|
+
return buildUnit(
|
|
1468
|
+
widget,
|
|
1469
|
+
"goal",
|
|
1470
|
+
{
|
|
1471
|
+
content: {
|
|
1472
|
+
version: 1,
|
|
1473
|
+
// `slim` reproduces SE's default goal look. SE `simpleDesign`
|
|
1474
|
+
// is the text-only variant, so import it as Lumia's text layout
|
|
1475
|
+
// instead of carrying the flag as inert metadata.
|
|
1476
|
+
type: v.simpleDesign ? "text" : "slim",
|
|
1477
|
+
// Static label rendered above the goal bar — not an alert context.
|
|
1478
|
+
label: translateSeText(v.title ?? "Goal", null, void 0, void 0, {
|
|
1479
|
+
context: "static"
|
|
1480
|
+
}),
|
|
1481
|
+
subLabel: "",
|
|
1482
|
+
// The Goal module renders this template literal with {{current}} + {{goal}} substituted.
|
|
1483
|
+
// Charity goals track donation amounts — prefix `$` so the rendered bar reads
|
|
1484
|
+
// "$0 / $100" the way SE's charity goals do, instead of bare integers.
|
|
1485
|
+
display: v.dense ? "{{current}}" : charity ? "${{current}} / ${{goal}}" : "{{current}} / {{goal}}",
|
|
1486
|
+
// `current` is a template variable reference (resolved at render time from session variables).
|
|
1487
|
+
// `targetGoal` is the numeric ceiling. Both required by Goal/index.tsx:28-29.
|
|
1488
|
+
current: charity ? charity.current : currentForListener(listener),
|
|
1489
|
+
targetGoal: charity ? charity.targetGoal : String(v.goalAmount ?? 100),
|
|
1490
|
+
// Pre-select the Goal Manager source so opening the modal lands on
|
|
1491
|
+
// the right entry instead of falling through to 'custom'.
|
|
1492
|
+
source: charity ? charity.source : sourceFromListener(listener),
|
|
1493
|
+
image: "",
|
|
1494
|
+
audio: { decrement: "", increment: "", goal: "", goalFailed: "", volume: 1 },
|
|
1495
|
+
// `null` (rather than `''`) is the cleaner contract — `formatEndsIn`
|
|
1496
|
+
// in Goal/index.tsx treats both as "no deadline" so both work at
|
|
1497
|
+
// render time, but `null` survives JSON round-trips without
|
|
1498
|
+
// ambiguity ('' vs unset). The Goal module no longer hides itself
|
|
1499
|
+
// when the date passes; the "Ends in…" sublabel just disappears.
|
|
1500
|
+
endDate: v.endDate ?? null,
|
|
1501
|
+
goalAnimation: "",
|
|
1502
|
+
goalAnimationLoop: true,
|
|
1503
|
+
unfilledColor: v.backgroundColor ?? "#400022",
|
|
1504
|
+
filledColor: v.fillColor ?? "#ff0055",
|
|
1505
|
+
goalTheme: v.simpleDesign ? "text" : v.dense ? "compact" : "slim",
|
|
1506
|
+
condensed: !!v.dense,
|
|
1507
|
+
showPercentComplete: !!v.percent,
|
|
1508
|
+
alignItemsToEdges: false,
|
|
1509
|
+
border: "solid 1px transparent",
|
|
1510
|
+
borderRadius: "0px",
|
|
1511
|
+
highlightColor: "inherit",
|
|
1512
|
+
// Source-side knobs without a native Lumia equivalent live under the
|
|
1513
|
+
// generic `importMeta` envelope (see mappers/importMeta.ts).
|
|
1514
|
+
importMeta: buildImportMeta(widget, {
|
|
1515
|
+
sourceListener: listener,
|
|
1516
|
+
simpleDesign: !!v.simpleDesign
|
|
1517
|
+
})
|
|
1518
|
+
},
|
|
1519
|
+
// `borderRadius` / `borderStyle` / `borderWidth` / `borderColor`
|
|
1520
|
+
// used to be set on `css` too, but the Goal renderer applies its
|
|
1521
|
+
// own border + borderRadius via inline `style={…}` on the .goal-bar
|
|
1522
|
+
// div (see Goal/index.tsx:123,127,155) sourced from
|
|
1523
|
+
// `content.border` and `content.borderRadius`. Writing them to
|
|
1524
|
+
// module.css just plopped useless transparent-0px rules on the
|
|
1525
|
+
// outer .overlay-module wrapper. SE charity goals commonly use
|
|
1526
|
+
// 24-30px Nunito/Roboto — fontSize default of 30 mirrors the
|
|
1527
|
+
// previous hardcoded fallback.
|
|
1528
|
+
css: mapSeTextCssToModuleCss(widget, { fontSize: 30 })
|
|
1494
1529
|
},
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
// own border + borderRadius via inline `style={…}` on the .goal-bar
|
|
1498
|
-
// div (see Goal/index.tsx:123,127,155) sourced from
|
|
1499
|
-
// `content.border` and `content.borderRadius`. Writing them to
|
|
1500
|
-
// module.css just plopped useless transparent-0px rules on the
|
|
1501
|
-
// outer .overlay-module wrapper. SE charity goals commonly use
|
|
1502
|
-
// 24-30px Nunito/Roboto — fontSize default of 30 mirrors the
|
|
1503
|
-
// previous hardcoded fallback.
|
|
1504
|
-
css: mapSeTextCssToModuleCss(widget, { fontSize: 30 })
|
|
1505
|
-
}, ctx);
|
|
1530
|
+
ctx
|
|
1531
|
+
);
|
|
1506
1532
|
}
|
|
1507
1533
|
|
|
1508
1534
|
// src/se-import/mappers/custom.ts
|