@ai-matrx/records-ui 0.116.33 → 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.33
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
@@ -41496,10 +41496,6 @@ function typedFormulaFields(all, rounds = FORMULA_TYPING_ROUNDS) {
41496
41496
  byRounds.set(rounds, cur);
41497
41497
  return cur;
41498
41498
  }
41499
- function formulaTypeOf(targetId, all, rounds = FORMULA_TYPING_ROUNDS) {
41500
- const expr = ownExpression(all.find((f) => f.id === targetId));
41501
- return expr ? formulaResultKind(expr, typedFormulaFields(all, rounds)) : "unknown";
41502
- }
41503
41499
  function formulaResultKind(node, all) {
41504
41500
  if (!node || typeof node !== "object" || Array.isArray(node)) return "unknown";
41505
41501
  const n = node;
@@ -41537,7 +41533,8 @@ function formulaResultKind(node, all) {
41537
41533
  return import_records55.FORMULA_NODE_RESULTS[op2] ?? "unknown";
41538
41534
  }
41539
41535
  function isDateFormula(field2, all) {
41540
- return !!field2 && formulaTypeOf(field2.id, all) === "date";
41536
+ const expr = ownExpression(field2);
41537
+ return !!expr && formulaResultKind(expr, typedFormulaFields(all)) === "date";
41541
41538
  }
41542
41539
  function isComputedField(field2) {
41543
41540
  return field2?.type === "formula";
@@ -45190,6 +45187,20 @@ function planCategoryTicks(slotPx, charPx = TICK_CHAR_PX, minChars = TICK_MIN_CH
45190
45187
  const step2 = Math.max(1, Math.ceil((minChars * charPx + 4) / slot));
45191
45188
  return { step: step2, perLine: Math.max(3, Math.floor((slot * step2 - 4) / charPx)) };
45192
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
+ }
45193
45204
  function lineAxis(width, count) {
45194
45205
  const plan = planCategoryTicks((width - 56) / Math.max(count, 1));
45195
45206
  const pad4 = Math.min(30, Math.ceil(plan.perLine * TICK_CHAR_PX / 2));
@@ -45253,6 +45264,7 @@ function Drawing({
45253
45264
  const pretty2 = usePrettyWith(prettyPlain);
45254
45265
  const compactTick = useCompactWith(compactTickPlain);
45255
45266
  const labelText = (v) => typeof v === "number" ? pretty2(v).length > 7 ? compactTick(v) : pretty2(v) : "";
45267
+ const scatterNames = (0, import_react262.useRef)({ keys: [], boxes: [] });
45256
45268
  const compared = series.length > 1;
45257
45269
  const drawOrder = compared ? [series[1], series[0]] : series;
45258
45270
  const goalLine = (horizontal2) => goal && typeof goal.value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
@@ -45295,7 +45307,7 @@ function Drawing({
45295
45307
  nameKey: "label",
45296
45308
  innerRadius: hole ? dataLabels ? DONUT_LABELLED.inner : 44 : 0,
45297
45309
  outerRadius: dataLabels ? DONUT_LABELLED.outer : 66,
45298
- ...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) : {},
45299
45311
  paddingAngle: donutGap(points.length),
45300
45312
  isAnimationActive: false,
45301
45313
  ...click ? { onClick: click, className: "cursor-pointer" } : {},
@@ -45420,7 +45432,7 @@ function Drawing({
45420
45432
  }
45421
45433
  }
45422
45434
  ),
45423
- /* @__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 })
45424
45436
  ] }) });
45425
45437
  }
45426
45438
  if (kind2 === "line") {
@@ -45535,16 +45547,28 @@ function SpacedLabel(props) {
45535
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 });
45536
45548
  }
45537
45549
  var DONUT_LABELLED = { inner: 30, outer: 46 };
45538
- 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) {
45539
45555
  const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
45540
45556
  if (total <= 0) return values.map(() => "none");
45541
45557
  let acc = 0;
45542
45558
  const lastY = { left: null, right: null };
45559
+ const insideBoxes = [];
45560
+ const rIn = insideLabelRadius(inner2, outer2);
45543
45561
  return values.map((v) => {
45544
45562
  const share = v > 0 ? v / total : 0;
45545
45563
  const mid = (acc + share / 2) * 2 * Math.PI;
45546
45564
  acc += share;
45547
- 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
+ }
45548
45572
  if (share < 0.03) return "none";
45549
45573
  const y = -Math.sin(mid) * (outer2 + 10);
45550
45574
  const side = Math.cos(mid) >= 0 ? "right" : "left";
@@ -45554,8 +45578,9 @@ function donutLabelPlan(values, outer2 = DONUT_LABELLED.outer) {
45554
45578
  return "outside";
45555
45579
  });
45556
45580
  }
45557
- function donutLabelProps(values, asValue) {
45558
- 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);
45559
45584
  const total = values.reduce((a, b) => a + (b > 0 ? b : 0), 0);
45560
45585
  const words2 = (i) => asValue ? asValue(values[i] ?? 0) : `${Math.round((values[i] ?? 0) / (total || 1) * 100)}%`;
45561
45586
  return {
@@ -45572,7 +45597,7 @@ function donutLabelProps(values, asValue) {
45572
45597
  const rad = Math.PI / 180;
45573
45598
  const mid = p.midAngle ?? 0;
45574
45599
  if (where === "inside") {
45575
- const r = ((p.innerRadius ?? 0) + (p.outerRadius ?? 0)) / 2;
45600
+ const r = insideLabelRadius(p.innerRadius ?? 0, p.outerRadius ?? 0);
45576
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) });
45577
45602
  }
45578
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) });