@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 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") return { current: "{{tiltify_total_raised=0}}", targetGoal: "{{tiltify_goal_amount=100}}", source: "tiltify" };
4558
- if (widgetType === "se-widget-extralife-goal") return { current: "{{extralife_total_raised=0}}", targetGoal: "{{extralife_goal_amount=100}}", source: "extralife" };
4559
- if (widgetType === "se-widget-donor-drive-goal") return { current: "{{donordrive_total_raised=0}}", targetGoal: "{{donordrive_goal_amount=100}}", source: "donordrive" };
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") return "twitch_followers_session";
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") return "twitch_subscribers_session";
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") return "twitch_bits_session";
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") return "donations_session";
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(widget, "goal", {
4583
- content: {
4584
- version: 1,
4585
- // `slim` reproduces SE's default goal look — label above a thin
4586
- // track, with `0` / `goalAmount` anchoring the bar's edges and the
4587
- // live `current` floating at the percentage position. See
4588
- // components/Modules/Views/Goal/types.ts:GoalTypes.SLIM.
4589
- type: "slim",
4590
- // Static label rendered above the goal bar not an alert context.
4591
- label: translateSeText(v.title ?? "Goal", null, void 0, void 0, { context: "static" }),
4592
- subLabel: "",
4593
- // The Goal module renders this template literal with {{current}} + {{goal}} substituted.
4594
- // Charity goals track donation amounts — prefix `$` so the rendered bar reads
4595
- // "$0 / $100" the way SE's charity goals do, instead of bare integers.
4596
- display: charity ? "${{current}} / ${{goal}}" : "{{current}} / {{goal}}",
4597
- // `current` is a template variable reference (resolved at render time from session variables).
4598
- // `targetGoal` is the numeric ceiling. Both required by Goal/index.tsx:28-29.
4599
- current: charity ? charity.current : currentForListener(listener),
4600
- targetGoal: charity ? charity.targetGoal : String(v.goalAmount ?? 100),
4601
- // Pre-select the Goal Manager source so opening the modal lands on
4602
- // the right entry instead of falling through to 'custom'.
4603
- source: charity ? charity.source : sourceFromListener(listener),
4604
- image: "",
4605
- audio: { decrement: "", increment: "", goal: "", goalFailed: "", volume: 1 },
4606
- // `null` (rather than `''`) is the cleaner contract — `formatEndsIn`
4607
- // in Goal/index.tsx treats both as "no deadline" so both work at
4608
- // render time, but `null` survives JSON round-trips without
4609
- // ambiguity ('' vs unset). The Goal module no longer hides itself
4610
- // when the date passes; the "Ends in…" sublabel just disappears.
4611
- endDate: v.endDate ?? null,
4612
- goalAnimation: "",
4613
- goalAnimationLoop: true,
4614
- unfilledColor: v.backgroundColor ?? "#400022",
4615
- filledColor: v.fillColor ?? "#ff0055",
4616
- condensed: !!v.dense,
4617
- showPercentComplete: !!v.percent,
4618
- alignItemsToEdges: false,
4619
- border: "solid 1px transparent",
4620
- borderRadius: "40px",
4621
- highlightColor: "inherit",
4622
- // Source-side knobs without a native Lumia equivalent live under the
4623
- // generic `importMeta` envelope (see mappers/importMeta.ts).
4624
- importMeta: buildImportMeta(widget, {
4625
- sourceListener: listener,
4626
- simpleDesign: !!v.simpleDesign
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
- // `borderRadius` / `borderStyle` / `borderWidth` / `borderColor`
4630
- // used to be set on `css` too, but the Goal renderer applies its
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") return { current: "{{tiltify_total_raised=0}}", targetGoal: "{{tiltify_goal_amount=100}}", source: "tiltify" };
1424
- if (widgetType === "se-widget-extralife-goal") return { current: "{{extralife_total_raised=0}}", targetGoal: "{{extralife_goal_amount=100}}", source: "extralife" };
1425
- if (widgetType === "se-widget-donor-drive-goal") return { current: "{{donordrive_total_raised=0}}", targetGoal: "{{donordrive_goal_amount=100}}", source: "donordrive" };
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") return "twitch_followers_session";
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") return "twitch_subscribers_session";
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") return "twitch_bits_session";
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") return "donations_session";
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(widget, "goal", {
1449
- content: {
1450
- version: 1,
1451
- // `slim` reproduces SE's default goal look — label above a thin
1452
- // track, with `0` / `goalAmount` anchoring the bar's edges and the
1453
- // live `current` floating at the percentage position. See
1454
- // components/Modules/Views/Goal/types.ts:GoalTypes.SLIM.
1455
- type: "slim",
1456
- // Static label rendered above the goal bar not an alert context.
1457
- label: translateSeText(v.title ?? "Goal", null, void 0, void 0, { context: "static" }),
1458
- subLabel: "",
1459
- // The Goal module renders this template literal with {{current}} + {{goal}} substituted.
1460
- // Charity goals track donation amounts — prefix `$` so the rendered bar reads
1461
- // "$0 / $100" the way SE's charity goals do, instead of bare integers.
1462
- display: charity ? "${{current}} / ${{goal}}" : "{{current}} / {{goal}}",
1463
- // `current` is a template variable reference (resolved at render time from session variables).
1464
- // `targetGoal` is the numeric ceiling. Both required by Goal/index.tsx:28-29.
1465
- current: charity ? charity.current : currentForListener(listener),
1466
- targetGoal: charity ? charity.targetGoal : String(v.goalAmount ?? 100),
1467
- // Pre-select the Goal Manager source so opening the modal lands on
1468
- // the right entry instead of falling through to 'custom'.
1469
- source: charity ? charity.source : sourceFromListener(listener),
1470
- image: "",
1471
- audio: { decrement: "", increment: "", goal: "", goalFailed: "", volume: 1 },
1472
- // `null` (rather than `''`) is the cleaner contract — `formatEndsIn`
1473
- // in Goal/index.tsx treats both as "no deadline" so both work at
1474
- // render time, but `null` survives JSON round-trips without
1475
- // ambiguity ('' vs unset). The Goal module no longer hides itself
1476
- // when the date passes; the "Ends in…" sublabel just disappears.
1477
- endDate: v.endDate ?? null,
1478
- goalAnimation: "",
1479
- goalAnimationLoop: true,
1480
- unfilledColor: v.backgroundColor ?? "#400022",
1481
- filledColor: v.fillColor ?? "#ff0055",
1482
- condensed: !!v.dense,
1483
- showPercentComplete: !!v.percent,
1484
- alignItemsToEdges: false,
1485
- border: "solid 1px transparent",
1486
- borderRadius: "40px",
1487
- highlightColor: "inherit",
1488
- // Source-side knobs without a native Lumia equivalent live under the
1489
- // generic `importMeta` envelope (see mappers/importMeta.ts).
1490
- importMeta: buildImportMeta(widget, {
1491
- sourceListener: listener,
1492
- simpleDesign: !!v.simpleDesign
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
- // `borderRadius` / `borderStyle` / `borderWidth` / `borderColor`
1496
- // used to be set on `css` too, but the Goal renderer applies its
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/ui",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "author": "Lumia Stream",
5
5
  "license": "ISC",
6
6
  "description": "Lumia UI Kit",