@cardenelabs/cdl 0.47.0 → 0.48.0

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
@@ -19576,33 +19576,73 @@ function placeAvoidingSiblingPaths(args) {
19576
19576
  }
19577
19577
  };
19578
19578
  consider([...wants]);
19579
+ const \u62BC\u3059\u91CF = (idx, side, pos) => {
19580
+ let \u8981\u308B = 0;
19581
+ for (const i of idx) {
19582
+ const box = boxes[i];
19583
+ const rect = { x: box.x, y: pos[i] - box.h / 2, w: box.w, h: box.h };
19584
+ for (const probe of probeSegs[i]) {
19585
+ if (measurePathLabelGapSegs(probe.segs, rect) >= CLEARANCE_PATH_LABEL) continue;
19586
+ let lo = Infinity;
19587
+ let hi = -Infinity;
19588
+ for (const seg of probe.segs) {
19589
+ const c = clipY(seg, box.x, box.x + box.w);
19590
+ if (!c) continue;
19591
+ lo = Math.min(lo, c.lo);
19592
+ hi = Math.max(hi, c.hi);
19593
+ }
19594
+ if (lo > hi) continue;
19595
+ const \u884C\u304D\u5148 = side === "above" ? lo - box.h / 2 - CLEARANCE_PATH_LABEL : hi + box.h / 2 + CLEARANCE_PATH_LABEL;
19596
+ \u8981\u308B = Math.max(\u8981\u308B, side === "above" ? pos[i] - \u884C\u304D\u5148 : \u884C\u304D\u5148 - pos[i]);
19597
+ }
19598
+ }
19599
+ return Math.max(0, \u8981\u308B);
19600
+ };
19579
19601
  if (bands.some((b) => b !== null)) {
19580
19602
  for (let split = 0; split <= order.length; split++) {
19581
19603
  const above = order.slice(0, split);
19582
19604
  const below = order.slice(split);
19583
- const out = new Array(members.length);
19584
- for (const [idx, side] of [
19585
- [above, "above"],
19586
- [below, "below"]
19587
- ]) {
19588
- if (idx.length === 0) continue;
19589
- const ys = spread(idx);
19590
- let shift = 0;
19591
- for (let k = 0; k < idx.length; k++) {
19592
- const band = bands[idx[k]];
19593
- if (!band) continue;
19594
- shift = side === "above" ? Math.min(shift, band.lo - ys[k]) : Math.max(shift, band.hi - ys[k]);
19595
- }
19596
- for (let k = 0; k < idx.length; k++) out[idx[k]] = ys[k] + shift;
19597
- }
19598
- if (above.length > 0 && below.length > 0) {
19605
+ const \u9593\u3092\u7A7A\u3051\u308B = (out) => {
19606
+ if (above.length === 0 || below.length === 0) return;
19599
19607
  const lastIdx = above[above.length - 1];
19600
19608
  const firstIdx = below[0];
19601
19609
  const need = (sizes[lastIdx] + sizes[firstIdx]) / 2 + CLEARANCE_LABEL_LABEL;
19602
19610
  const deficit = need - (out[firstIdx] - out[lastIdx]);
19603
- if (deficit > 0) for (const i of below) out[i] += deficit;
19604
- }
19605
- consider(out);
19611
+ if (deficit > 0) for (const i of below) out[i] = out[i] + deficit;
19612
+ };
19613
+ const \u5E2F\u3092\u8D8A\u3048\u308B = () => {
19614
+ const out = new Array(members.length);
19615
+ for (const [idx, side] of [
19616
+ [above, "above"],
19617
+ [below, "below"]
19618
+ ]) {
19619
+ if (idx.length === 0) continue;
19620
+ const ys = spread(idx);
19621
+ let shift = 0;
19622
+ for (let k = 0; k < idx.length; k++) {
19623
+ const band = bands[idx[k]];
19624
+ if (!band) continue;
19625
+ shift = side === "above" ? Math.min(shift, band.lo - ys[k]) : Math.max(shift, band.hi - ys[k]);
19626
+ }
19627
+ for (let k = 0; k < idx.length; k++) out[idx[k]] = ys[k] + shift;
19628
+ }
19629
+ \u9593\u3092\u7A7A\u3051\u308B(out);
19630
+ return out;
19631
+ };
19632
+ const \u62BC\u3057\u3066\u8D8A\u3048\u308B = () => {
19633
+ const out = \u5E2F\u3092\u8D8A\u3048\u308B();
19634
+ for (let round = 0; round < 4; round += 1) {
19635
+ const a = \u62BC\u3059\u91CF(above, "above", out);
19636
+ const b = \u62BC\u3059\u91CF(below, "below", out);
19637
+ if (a === 0 && b === 0) return out;
19638
+ for (const i of above) out[i] = out[i] - a;
19639
+ for (const i of below) out[i] = out[i] + b;
19640
+ }
19641
+ return \u62BC\u3059\u91CF(above, "above", out) === 0 && \u62BC\u3059\u91CF(below, "below", out) === 0 ? out : null;
19642
+ };
19643
+ consider(\u5E2F\u3092\u8D8A\u3048\u308B());
19644
+ const \u62BC\u3057\u305F = \u62BC\u3057\u3066\u8D8A\u3048\u308B();
19645
+ if (\u62BC\u3057\u305F) consider(\u62BC\u3057\u305F);
19606
19646
  }
19607
19647
  }
19608
19648
  const plain = spread(all);