@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/react.cjs CHANGED
@@ -8282,33 +8282,73 @@ function placeAvoidingSiblingPaths(args) {
8282
8282
  }
8283
8283
  };
8284
8284
  consider([...wants]);
8285
+ const \u62BC\u3059\u91CF = (idx, side, pos) => {
8286
+ let \u8981\u308B = 0;
8287
+ for (const i of idx) {
8288
+ const box = boxes[i];
8289
+ const rect = { x: box.x, y: pos[i] - box.h / 2, w: box.w, h: box.h };
8290
+ for (const probe of probeSegs[i]) {
8291
+ if (measurePathLabelGapSegs(probe.segs, rect) >= CLEARANCE_PATH_LABEL) continue;
8292
+ let lo = Infinity;
8293
+ let hi = -Infinity;
8294
+ for (const seg of probe.segs) {
8295
+ const c = clipY(seg, box.x, box.x + box.w);
8296
+ if (!c) continue;
8297
+ lo = Math.min(lo, c.lo);
8298
+ hi = Math.max(hi, c.hi);
8299
+ }
8300
+ if (lo > hi) continue;
8301
+ const \u884C\u304D\u5148 = side === "above" ? lo - box.h / 2 - CLEARANCE_PATH_LABEL : hi + box.h / 2 + CLEARANCE_PATH_LABEL;
8302
+ \u8981\u308B = Math.max(\u8981\u308B, side === "above" ? pos[i] - \u884C\u304D\u5148 : \u884C\u304D\u5148 - pos[i]);
8303
+ }
8304
+ }
8305
+ return Math.max(0, \u8981\u308B);
8306
+ };
8285
8307
  if (bands.some((b) => b !== null)) {
8286
8308
  for (let split = 0; split <= order.length; split++) {
8287
8309
  const above = order.slice(0, split);
8288
8310
  const below = order.slice(split);
8289
- const out = new Array(members.length);
8290
- for (const [idx, side] of [
8291
- [above, "above"],
8292
- [below, "below"]
8293
- ]) {
8294
- if (idx.length === 0) continue;
8295
- const ys = spread(idx);
8296
- let shift = 0;
8297
- for (let k = 0; k < idx.length; k++) {
8298
- const band = bands[idx[k]];
8299
- if (!band) continue;
8300
- shift = side === "above" ? Math.min(shift, band.lo - ys[k]) : Math.max(shift, band.hi - ys[k]);
8301
- }
8302
- for (let k = 0; k < idx.length; k++) out[idx[k]] = ys[k] + shift;
8303
- }
8304
- if (above.length > 0 && below.length > 0) {
8311
+ const \u9593\u3092\u7A7A\u3051\u308B = (out) => {
8312
+ if (above.length === 0 || below.length === 0) return;
8305
8313
  const lastIdx = above[above.length - 1];
8306
8314
  const firstIdx = below[0];
8307
8315
  const need = (sizes[lastIdx] + sizes[firstIdx]) / 2 + CLEARANCE_LABEL_LABEL;
8308
8316
  const deficit = need - (out[firstIdx] - out[lastIdx]);
8309
- if (deficit > 0) for (const i of below) out[i] += deficit;
8310
- }
8311
- consider(out);
8317
+ if (deficit > 0) for (const i of below) out[i] = out[i] + deficit;
8318
+ };
8319
+ const \u5E2F\u3092\u8D8A\u3048\u308B = () => {
8320
+ const out = new Array(members.length);
8321
+ for (const [idx, side] of [
8322
+ [above, "above"],
8323
+ [below, "below"]
8324
+ ]) {
8325
+ if (idx.length === 0) continue;
8326
+ const ys = spread(idx);
8327
+ let shift = 0;
8328
+ for (let k = 0; k < idx.length; k++) {
8329
+ const band = bands[idx[k]];
8330
+ if (!band) continue;
8331
+ shift = side === "above" ? Math.min(shift, band.lo - ys[k]) : Math.max(shift, band.hi - ys[k]);
8332
+ }
8333
+ for (let k = 0; k < idx.length; k++) out[idx[k]] = ys[k] + shift;
8334
+ }
8335
+ \u9593\u3092\u7A7A\u3051\u308B(out);
8336
+ return out;
8337
+ };
8338
+ const \u62BC\u3057\u3066\u8D8A\u3048\u308B = () => {
8339
+ const out = \u5E2F\u3092\u8D8A\u3048\u308B();
8340
+ for (let round = 0; round < 4; round += 1) {
8341
+ const a = \u62BC\u3059\u91CF(above, "above", out);
8342
+ const b = \u62BC\u3059\u91CF(below, "below", out);
8343
+ if (a === 0 && b === 0) return out;
8344
+ for (const i of above) out[i] = out[i] - a;
8345
+ for (const i of below) out[i] = out[i] + b;
8346
+ }
8347
+ return \u62BC\u3059\u91CF(above, "above", out) === 0 && \u62BC\u3059\u91CF(below, "below", out) === 0 ? out : null;
8348
+ };
8349
+ consider(\u5E2F\u3092\u8D8A\u3048\u308B());
8350
+ const \u62BC\u3057\u305F = \u62BC\u3057\u3066\u8D8A\u3048\u308B();
8351
+ if (\u62BC\u3057\u305F) consider(\u62BC\u3057\u305F);
8312
8352
  }
8313
8353
  }
8314
8354
  const plain = spread(all);