@leavepulse/ui 0.28.2 → 0.28.3

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.
@@ -379,6 +379,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
379
379
  { deep: true }
380
380
  );
381
381
  const clipId = `lp-chart-${Math.random().toString(36).slice(2, 9)}`;
382
+ const gradientId = (name, index) => `${clipId}-g-${index}-${name.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
382
383
  return (_ctx, _cache) => {
383
384
  return openBlock(), createElementBlock("div", {
384
385
  ref_key: "root",
@@ -435,9 +436,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
435
436
  onContextmenu: onContextMenu
436
437
  }, [
437
438
  createElementVNode("defs", null, [
438
- (openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (s) => {
439
+ (openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (s, i) => {
439
440
  return openBlock(), createElementBlock("linearGradient", {
440
- id: `${clipId}-g-${s.name}`,
441
+ id: gradientId(s.name, i),
441
442
  key: s.name,
442
443
  x1: "0",
443
444
  y1: "0",
@@ -543,11 +544,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
543
544
  opacity: active.value < 0 || active.value === b.index ? 1 : 0.45
544
545
  }, null, 8, _hoisted_25);
545
546
  }), 128)),
546
- (openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (s) => {
547
+ (openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (s, i) => {
547
548
  return withDirectives((openBlock(), createElementBlock("path", {
548
549
  key: `f-${s.name}`,
549
550
  d: s.fill,
550
- fill: `url(#${clipId}-g-${s.name})`
551
+ fill: `url(#${gradientId(s.name, i)})`
551
552
  }, null, 8, _hoisted_26)), [
552
553
  [vShow, __props.type === "area"]
553
554
  ]);
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpChart-tNXs1ttr.js";
1
+ import { _ as _sfc_main } from "../chunks/LpChart-UiU4RhXP.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { _ as _9 } from "./chunks/LpBreadcrumbs-5uvViCXi.js";
11
11
  import { _ as _10 } from "./chunks/LpButton-5VXXCjwF.js";
12
12
  import { _ as _11 } from "./chunks/LpCalendar-B7ZL0ty3.js";
13
13
  import { _ as _12 } from "./chunks/LpCard-gu11ZmSt.js";
14
- import { _ as _13 } from "./chunks/LpChart-tNXs1ttr.js";
14
+ import { _ as _13 } from "./chunks/LpChart-UiU4RhXP.js";
15
15
  import { CHART_PALETTE, axisTicks, formatTick, niceScale, resolveSlices } from "./components/chart.js";
16
16
  import { _ as _14 } from "./chunks/LpCheckbox-BO0zuuPh.js";
17
17
  import { _ as _15 } from "./chunks/LpCodeBlock-rS_6mO3D.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavepulse/ui",
3
- "version": "0.28.2",
3
+ "version": "0.28.3",
4
4
  "type": "module",
5
5
  "description": "LeavePulse token-driven Vue component kit.",
6
6
  "repository": {
@@ -553,6 +553,25 @@ watch(
553
553
  )
554
554
 
555
555
  const clipId = `lp-chart-${Math.random().toString(36).slice(2, 9)}`
556
+
557
+ /*
558
+ * The gradient id for a series, with the series NAME reduced to id-safe
559
+ * characters.
560
+ *
561
+ * A name is a label — "used %", "in eth0", "read sda" — and putting it verbatim
562
+ * into an id produced `url(#lp-chart-x-g-used %)`, which is not a valid
563
+ * reference: the browser fails to resolve it and falls back to painting the
564
+ * shape black. The gradient was there, correct, and simply never reached, so an
565
+ * area chart of any series whose name held a space or a percent sign rendered
566
+ * as a solid black block under its line — while "cpu" and "memory" on the same
567
+ * page kept their colour, which is what made it look like a data problem rather
568
+ * than an escaping one.
569
+ *
570
+ * Index-suffixed so two names that differ only in punctuation ("in eth0" and
571
+ * "in-eth0") cannot collapse onto one id and share a colour.
572
+ */
573
+ const gradientId = (name: string, index: number) =>
574
+ `${clipId}-g-${index}-${name.replace(/[^a-zA-Z0-9_-]/g, "-")}`
556
575
  </script>
557
576
 
558
577
  <template>
@@ -618,8 +637,8 @@ const clipId = `lp-chart-${Math.random().toString(36).slice(2, 9)}`
618
637
  >
619
638
  <defs>
620
639
  <linearGradient
621
- v-for="s in lines"
622
- :id="`${clipId}-g-${s.name}`"
640
+ v-for="(s, i) in lines"
641
+ :id="gradientId(s.name, i)"
623
642
  :key="s.name"
624
643
  x1="0"
625
644
  y1="0"
@@ -728,11 +747,11 @@ const clipId = `lp-chart-${Math.random().toString(36).slice(2, 9)}`
728
747
 
729
748
  <!-- area fills -->
730
749
  <path
731
- v-for="s in lines"
750
+ v-for="(s, i) in lines"
732
751
  v-show="type === 'area'"
733
752
  :key="`f-${s.name}`"
734
753
  :d="s.fill"
735
- :fill="`url(#${clipId}-g-${s.name})`"
754
+ :fill="`url(#${gradientId(s.name, i)})`"
736
755
  />
737
756
 
738
757
  <!-- lines -->