@ai-matrx/records-ui 0.116.34 → 0.116.35

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/CHANGELOG.md CHANGED
@@ -25,11 +25,30 @@
25
25
  - Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
26
26
  - **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
27
27
 
28
- ## 0.116.34
28
+ ## 0.116.35
29
29
 
30
30
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
31
31
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
32
32
 
33
+ ## 0.116.34
34
+
35
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
36
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
37
+ Diff: `git diff a1eec5401e f36c92c906 -- apps/shared/records-ui/src`
38
+
39
+ Changed shipped source files (1):
40
+ - `apps/shared/records-ui/src/workedOutDate.ts`
41
+
42
+ ## 0.116.33
43
+
44
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
45
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
46
+ Diff: `git diff 373441d144 a1eec5401e -- apps/shared/records-ui/src`
47
+
48
+ Changed shipped source files (2):
49
+ - `apps/shared/records-ui/src/htmlFrameEntry.ts`
50
+ - `apps/shared/records-ui/src/looks/htmlFrame.tsx`
51
+
33
52
  ## 0.116.32
34
53
 
35
54
  SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
package/dist/index.cjs CHANGED
@@ -45187,6 +45187,20 @@ function planCategoryTicks(slotPx, charPx = TICK_CHAR_PX, minChars = TICK_MIN_CH
45187
45187
  const step2 = Math.max(1, Math.ceil((minChars * charPx + 4) / slot));
45188
45188
  return { step: step2, perLine: Math.max(3, Math.floor((slot * step2 - 4) / charPx)) };
45189
45189
  }
45190
+ function ScatterName(props) {
45191
+ const { placed } = props;
45192
+ const text = String(props.value ?? "");
45193
+ const x = Number(props.x ?? 0);
45194
+ const y = Number(props.y ?? 0) - 8;
45195
+ const key = `${x}|${y}|${text}`;
45196
+ if (placed.current.keys.includes(key)) placed.current = { keys: [], boxes: [] };
45197
+ placed.current.keys.push(key);
45198
+ const w = text.length * 6.4;
45199
+ const box = { l: x - w / 2, r: x + w / 2, t: y - 7, b: y + 7 };
45200
+ if (placed.current.boxes.some((o) => box.l < o.r + 4 && o.l < box.r + 4 && box.t < o.b && o.t < box.b)) return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("g", {});
45201
+ placed.current.boxes.push(box);
45202
+ return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("text", { x, y, textAnchor: "middle", fontSize: 10, className: "fill-muted-foreground", "data-records-chart-label": "", children: text });
45203
+ }
45190
45204
  function lineAxis(width, count) {
45191
45205
  const plan = planCategoryTicks((width - 56) / Math.max(count, 1));
45192
45206
  const pad4 = Math.min(30, Math.ceil(plan.perLine * TICK_CHAR_PX / 2));
@@ -45250,6 +45264,7 @@ function Drawing({
45250
45264
  const pretty2 = usePrettyWith(prettyPlain);
45251
45265
  const compactTick = useCompactWith(compactTickPlain);
45252
45266
  const labelText = (v) => typeof v === "number" ? pretty2(v).length > 7 ? compactTick(v) : pretty2(v) : "";
45267
+ const scatterNames = (0, import_react262.useRef)({ keys: [], boxes: [] });
45253
45268
  const compared = series.length > 1;
45254
45269
  const drawOrder = compared ? [series[1], series[0]] : series;
45255
45270
  const goalLine = (horizontal2) => goal && typeof goal.value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
@@ -45292,7 +45307,7 @@ function Drawing({
45292
45307
  nameKey: "label",
45293
45308
  innerRadius: hole ? dataLabels ? DONUT_LABELLED.inner : 44 : 0,
45294
45309
  outerRadius: dataLabels ? DONUT_LABELLED.outer : 66,
45295
- ...dataLabels ? donutLabelProps(points.map((p) => p.values[series[0]] ?? 0), dataLabels === "value" ? (v) => labelText(v) : null) : {},
45310
+ ...dataLabels ? donutLabelProps(points.map((p) => p.values[series[0]] ?? 0), dataLabels === "value" ? (v) => labelText(v) : null, hole) : {},
45296
45311
  paddingAngle: donutGap(points.length),
45297
45312
  isAnimationActive: false,
45298
45313
  ...click ? { onClick: click, className: "cursor-pointer" } : {},
@@ -45417,7 +45432,7 @@ function Drawing({
45417
45432
  }
45418
45433
  }
45419
45434
  ),
45420
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(import_recharts.Scatter, { data: dots, fill: SERIES_COLORS[0], isAnimationActive: false, ...click ? { onClick: (_e, index) => click(null, index), className: "cursor-pointer" } : {}, children: dataLabels && dots.length <= 12 ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(import_recharts.LabelList, { dataKey: "label", position: "top", fontSize: 10, className: "fill-muted-foreground", "data-records-chart-label": "" }) : null })
45435
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(import_recharts.Scatter, { data: dots, fill: SERIES_COLORS[0], isAnimationActive: false, ...click ? { onClick: (_e, index) => click(null, index), className: "cursor-pointer" } : {}, children: dataLabels && dots.length <= 12 ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(import_recharts.LabelList, { dataKey: "label", content: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(ScatterName, { placed: scatterNames }) }) : null })
45421
45436
  ] }) });
45422
45437
  }
45423
45438
  if (kind2 === "line") {
@@ -45532,16 +45547,28 @@ function SpacedLabel(props) {
45532
45547
  return placement === "end" ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("text", { x: x + w + 4, y: y + h / 2, dominantBaseline: "central", fontSize: 10, className: "fill-muted-foreground tabular-nums", "data-records-chart-label": "", children: words2 }) : /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("text", { x: x + w / 2, y: y - 5, textAnchor: "middle", fontSize: 10, className: "fill-muted-foreground tabular-nums", "data-records-chart-label": "", children: words2 });
45533
45548
  }
45534
45549
  var DONUT_LABELLED = { inner: 30, outer: 46 };
45535
- function donutLabelPlan(values, outer2 = DONUT_LABELLED.outer) {
45550
+ function insideLabelRadius(inner2, outer2) {
45551
+ return inner2 <= 0 ? outer2 * 0.62 : (inner2 + outer2) / 2;
45552
+ }
45553
+ var INSIDE_LABEL_BOX = { w: 24, h: 11 };
45554
+ function donutLabelPlan(values, outer2 = DONUT_LABELLED.outer, inner2 = DONUT_LABELLED.inner) {
45536
45555
  const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
45537
45556
  if (total <= 0) return values.map(() => "none");
45538
45557
  let acc = 0;
45539
45558
  const lastY = { left: null, right: null };
45559
+ const insideBoxes = [];
45560
+ const rIn = insideLabelRadius(inner2, outer2);
45540
45561
  return values.map((v) => {
45541
45562
  const share = v > 0 ? v / total : 0;
45542
45563
  const mid = (acc + share / 2) * 2 * Math.PI;
45543
45564
  acc += share;
45544
- if (share >= 0.09) return "inside";
45565
+ if (share >= 0.09) {
45566
+ const at = { x: Math.cos(mid) * rIn, y: -Math.sin(mid) * rIn };
45567
+ if (!insideBoxes.some((b) => Math.abs(b.x - at.x) < INSIDE_LABEL_BOX.w && Math.abs(b.y - at.y) < INSIDE_LABEL_BOX.h)) {
45568
+ insideBoxes.push(at);
45569
+ return "inside";
45570
+ }
45571
+ }
45545
45572
  if (share < 0.03) return "none";
45546
45573
  const y = -Math.sin(mid) * (outer2 + 10);
45547
45574
  const side = Math.cos(mid) >= 0 ? "right" : "left";
@@ -45551,8 +45578,9 @@ function donutLabelPlan(values, outer2 = DONUT_LABELLED.outer) {
45551
45578
  return "outside";
45552
45579
  });
45553
45580
  }
45554
- function donutLabelProps(values, asValue) {
45555
- const plan = donutLabelPlan(values);
45581
+ function donutLabelProps(values, asValue, hole = true) {
45582
+ const innerR = hole ? DONUT_LABELLED.inner : 0;
45583
+ const plan = donutLabelPlan(values, DONUT_LABELLED.outer, innerR);
45556
45584
  const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
45557
45585
  const words2 = (i) => asValue ? asValue(values[i] ?? 0) : `${Math.round((values[i] ?? 0) / (total || 1) * 100)}%`;
45558
45586
  return {
@@ -45569,7 +45597,7 @@ function donutLabelProps(values, asValue) {
45569
45597
  const rad = Math.PI / 180;
45570
45598
  const mid = p.midAngle ?? 0;
45571
45599
  if (where === "inside") {
45572
- const r = ((p.innerRadius ?? 0) + (p.outerRadius ?? 0)) / 2;
45600
+ const r = insideLabelRadius(p.innerRadius ?? 0, p.outerRadius ?? 0);
45573
45601
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("text", { x: (p.cx ?? 0) + r * Math.cos(-mid * rad), y: (p.cy ?? 0) + r * Math.sin(-mid * rad), textAnchor: "middle", dominantBaseline: "central", fontSize: 9, className: "fill-background font-medium tabular-nums", "data-records-chart-label": "", children: words2(at) });
45574
45602
  }
45575
45603
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("text", { x: p.x ?? 0, y: p.y ?? 0, textAnchor: Math.cos(-mid * rad) >= 0 ? "start" : "end", dominantBaseline: "central", fontSize: 9, className: "fill-muted-foreground tabular-nums", "data-records-chart-label": "", children: words2(at) });