@n-uf/motion 26.11.54 → 26.11.56

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.
@@ -273,151 +273,6 @@ function createDragIntent(options) {
273
273
  };
274
274
  }
275
275
 
276
- // src/drag/guide-rects.ts
277
- var MIN_BOX_LENGTH = 8;
278
- var LINE_THICKNESS = 2;
279
- var EPS = 1e-6;
280
- function guideRects(guides, options) {
281
- const inset = Number.isFinite(options.inset) ? Math.max(0, options.inset) : 2;
282
- const min = Number.isFinite(options.minThickness) ? Math.max(0, options.minThickness) : 2;
283
- const lineThickness = Number.isFinite(options.lineThickness) ? Math.max(0, options.lineThickness) : LINE_THICKNESS;
284
- const minLength = Number.isFinite(options.minLength) ? Math.max(0, options.minLength) : MIN_BOX_LENGTH;
285
- const same = (a, b) => Math.abs(a.x - b.x) < EPS && Math.abs(a.y - b.y) < EPS && Math.abs(a.width - b.width) < EPS && Math.abs(a.height - b.height) < EPS;
286
- const place = (g, rect) => same(g.rect, rect) ? g : { ...g, rect };
287
- const x0 = options.inside.x + inset;
288
- const y0 = options.inside.y + inset;
289
- const x1 = options.inside.x + options.inside.width - inset;
290
- const y1 = options.inside.y + options.inside.height - inset;
291
- const gap = Number.isFinite(options.clearance) ? Math.max(0, options.clearance) : 2;
292
- const finite = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.width) && Number.isFinite(r.height);
293
- const allClear = (options.clear ?? []).map(
294
- (c) => "rect" in c ? { k: c.rect, gap: Number.isFinite(c.clearance) ? Math.max(0, c.clearance) : gap, ...c.kinds ? { kinds: c.kinds } : {} } : { k: c, gap }
295
- ).filter((c) => finite(c.k));
296
- const out = [];
297
- for (const g of guides) {
298
- const r = g.rect;
299
- const clear = allClear.filter((c) => !c.kinds || c.kinds.includes(g.kind));
300
- if (g.kind === "box") {
301
- const box = { a: Math.max(r.x, x0), b: Math.max(r.y, y0), c: Math.min(r.x + r.width, x1), d: Math.min(r.y + r.height, y1) };
302
- if (!(box.c - box.a > EPS) || !(box.d - box.b > EPS)) continue;
303
- const w = box.c - box.a;
304
- const h = box.d - box.b;
305
- const alongX = w > h || w === h && g.axis !== "y";
306
- const s02 = alongX ? box.a : box.b;
307
- const s12 = alongX ? box.c : box.d;
308
- const t0 = alongX ? box.b : box.a;
309
- const t1 = alongX ? box.d : box.c;
310
- const toBox = (p0, p1, q0, q1) => alongX ? { a: p0, b: q0, c: p1, d: q1 } : { a: q0, b: p0, c: q1, d: p1 };
311
- const over = clear.map(({ k: k2, gap: gap2 }) => ({
312
- x0: k2.x - gap2,
313
- x1: k2.x + k2.width + gap2,
314
- y0: k2.y - gap2,
315
- y1: k2.y + k2.height + gap2,
316
- s0: (alongX ? k2.x : k2.y) - gap2,
317
- s1: (alongX ? k2.x + k2.width : k2.y + k2.height) + gap2,
318
- t0: (alongX ? k2.y : k2.x) - gap2,
319
- t1: (alongX ? k2.y + k2.height : k2.x + k2.width) + gap2
320
- })).filter((k2) => k2.s1 > s02 + EPS && k2.s0 < s12 - EPS && k2.t1 > t0 + EPS && k2.t0 < t1 - EPS);
321
- let v0 = t0;
322
- let v1 = t1;
323
- const half = (t1 - t0) / 2 + EPS;
324
- for (const k2 of over) {
325
- if (k2.t0 <= t0 + EPS && k2.t1 >= t1 - EPS) continue;
326
- const along = Math.min(k2.s1, s12) - Math.max(k2.s0, s02);
327
- if (k2.t0 <= t0 + EPS) {
328
- if (k2.t1 - t0 < along - EPS && k2.t1 - t0 <= half) v0 = Math.max(v0, k2.t1);
329
- } else if (k2.t1 >= t1 - EPS) {
330
- if (t1 - k2.t0 < along - EPS && t1 - k2.t0 <= half) v1 = Math.min(v1, k2.t0);
331
- }
332
- }
333
- if ((v0 > t0 || v1 < t1) && v1 - v0 < Math.max(EPS, min)) continue;
334
- const rest = over.filter((k2) => k2.t1 > v0 + EPS && k2.t0 < v1 - EPS);
335
- const kept = toBox(s02, s12, v0, v1);
336
- const full = rest.filter((k2) => k2.t0 <= v0 + EPS && k2.t1 >= v1 - EPS).map((k2) => [Math.max(k2.s0, s02), Math.min(k2.s1, s12)]).sort((p, q) => p[0] - q[0] || p[1] - q[1]);
337
- const cuts = [];
338
- for (const [lo2, hi2] of full) {
339
- const last = cuts[cuts.length - 1];
340
- if (last && lo2 <= last[1] + EPS) last[1] = Math.max(last[1], hi2);
341
- else cuts.push([lo2, hi2]);
342
- }
343
- const spans = [];
344
- let at = s02;
345
- let k = 0;
346
- for (const [lo2, hi2] of cuts) {
347
- if (lo2 - at > EPS) spans.push({ lo: at, hi: lo2, k });
348
- if (lo2 > s02 + EPS && hi2 < s12 - EPS) k++;
349
- at = hi2;
350
- }
351
- if (s12 - at > EPS) spans.push({ lo: at, hi: s12, k });
352
- const corners = rest.filter((k2) => !(k2.t0 <= v0 + EPS && k2.t1 >= v1 - EPS)).sort((p, q) => p.s0 - q.s0 || p.s1 - q.s1 || p.t0 - q.t0 || p.t1 - q.t1);
353
- const longEnough = Math.max(EPS, minLength - EPS);
354
- for (const span of spans) {
355
- let p = toBox(span.lo, span.hi, v0, v1);
356
- for (const k2 of corners) {
357
- const { a, b, c, d } = p;
358
- if (k2.x1 <= a + EPS || k2.x0 >= c - EPS || k2.y1 <= b + EPS || k2.y0 >= d - EPS) continue;
359
- const cut = [
360
- { a, b, c: Math.min(c, k2.x0), d },
361
- { a: Math.max(a, k2.x1), b, c, d },
362
- { a, b, c, d: Math.min(d, k2.y0) },
363
- { a, b: Math.max(b, k2.y1), c, d }
364
- ].filter((q) => q.c - q.a > EPS && q.d - q.b > EPS);
365
- p = cut.length === 0 ? null : cut.reduce((q, s) => (s.c - s.a) * (s.d - s.b) > (q.c - q.a) * (q.d - q.b) ? s : q);
366
- if (!p) break;
367
- }
368
- if (!p) continue;
369
- const touched = Math.abs(p.a - kept.a) > EPS || Math.abs(p.b - kept.b) > EPS || Math.abs(p.c - kept.c) > EPS || Math.abs(p.d - kept.d) > EPS;
370
- if (touched && (alongX ? p.c - p.a : p.d - p.b) < longEnough) continue;
371
- const placed = place(g, { x: p.a, y: p.b, width: p.c - p.a, height: p.d - p.b });
372
- const id = g.id;
373
- out.push(span.k === 0 || typeof id !== "string" ? placed : { ...placed, id: `${id}#${span.k + 1}` });
374
- }
375
- continue;
376
- }
377
- const thinX = r.width <= r.height;
378
- const own = thinX ? r.width : r.height;
379
- const widen = g.kind === "line" && own < lineThickness;
380
- const t = widen ? lineThickness : own;
381
- let lo = (thinX ? r.x : r.y) - (widen ? (lineThickness - own) / 2 : 0);
382
- const lim0 = thinX ? x0 : y0;
383
- const lim1 = thinX ? x1 : y1;
384
- if (lo + t > lim1) lo = lim1 - t;
385
- if (lo < lim0) lo = lim0;
386
- let hi = Math.min(lo + t, lim1);
387
- const l0 = Math.max(thinX ? r.y : r.x, thinX ? y0 : x0);
388
- const l1 = Math.min(thinX ? r.y + r.height : r.x + r.width, thinX ? y1 : x1);
389
- if (l1 - l0 <= EPS) continue;
390
- const around = clear.map(({ k: c, gap: gap2 }) => ({
391
- a: (thinX ? c.y : c.x) - gap2,
392
- b: (thinX ? c.y + c.height : c.x + c.width) + gap2,
393
- c0: (thinX ? c.x : c.y) - gap2,
394
- c1: (thinX ? c.x + c.width : c.y + c.height) + gap2
395
- }));
396
- let s0 = l0;
397
- let s1 = l1;
398
- let shortened = false;
399
- for (const k of around) {
400
- if (k.b <= l0 + EPS || k.a >= l1 - EPS || k.c1 <= lo + EPS || k.c0 >= hi - EPS) continue;
401
- const atStart = k.a <= l0 + EPS;
402
- const atEnd = k.b >= l1 - EPS;
403
- if (atStart === atEnd) continue;
404
- if (atStart) s0 = Math.max(s0, k.b);
405
- else s1 = Math.min(s1, k.a);
406
- shortened = true;
407
- }
408
- if (s1 - s0 <= EPS || shortened && s1 - s0 < Math.max(EPS, minLength - EPS)) continue;
409
- for (const k of around) {
410
- if (k.b <= s0 + EPS || k.a >= s1 - EPS || k.c1 <= lo + EPS || k.c0 >= hi - EPS) continue;
411
- if (k.a <= l0 + EPS !== k.b >= l1 - EPS) continue;
412
- if ((k.c0 + k.c1) / 2 >= (lo + hi) / 2) hi = Math.min(hi, k.c0);
413
- else lo = Math.max(lo, k.c1);
414
- }
415
- if (hi - lo < Math.max(EPS, min)) continue;
416
- out.push(place(g, thinX ? { x: lo, y: s0, width: hi - lo, height: s1 - s0 } : { x: s0, y: lo, width: s1 - s0, height: hi - lo }));
417
- }
418
- return out;
419
- }
420
-
421
276
  // src/drag/hand-speed.ts
422
277
  var HAND_SLOW_STEP = 3;
423
278
  var HAND_SPEED = { span: 48, steps: 5, gap: 40, slowStep: HAND_SLOW_STEP, accelerating: 1.5, gathering: 1.25 };
@@ -472,13 +327,35 @@ function createHandSpeed(options = {}) {
472
327
  };
473
328
  }
474
329
 
330
+ // src/drag/preview.ts
331
+ var DRAG_PREVIEW_DEFAULT = { mode: "glide" };
332
+ var PLACE_GUIDES_DEFAULT = { outline: "off", placeholder: "near", glide: "off", snap: "near" };
333
+ function guidesOf(preview) {
334
+ const p = typeof preview === "string" ? { mode: preview } : preview;
335
+ return p.placeGuides ?? PLACE_GUIDES_DEFAULT[p.mode];
336
+ }
337
+ function previewPlan(frame, preview, slotted) {
338
+ const p = typeof preview === "string" ? { mode: preview } : preview;
339
+ const landing = "region" in frame;
340
+ const shown = landing ? frame.landing !== null : !!frame.shown;
341
+ const slots = slotted ?? (landing ? frame.region === "lane" : !!frame.shown && !frame.shown.free);
342
+ const plan = planOf(p.mode, shown, frame.room, slots);
343
+ const drawn = plan.showIndicator || plan.makeRoom || plan.snapItem;
344
+ return { ...plan, guides: drawn ? "off" : guidesOf(p) };
345
+ }
346
+ function planOf(mode, shown, room, slotted) {
347
+ if (mode === "outline") return { showIndicator: shown, makeRoom: false, snapItem: false };
348
+ if (mode === "placeholder") return { showIndicator: shown, makeRoom: room, snapItem: false };
349
+ if (mode === "snap") return { showIndicator: false, makeRoom: room, snapItem: room && shown && slotted };
350
+ return { showIndicator: shown && !slotted, makeRoom: room, snapItem: room && shown && slotted };
351
+ }
352
+
475
353
  // src/drag/landing.ts
476
- var SLIDE_STEP = 1;
477
- var SNAP_DISTANCE = 8;
478
354
  var LANDING_MARGINS = { exit: 12, spot: 6, edge: 48, lift: 16 };
479
355
  var LANDING_TOUCH_MARGINS = { exit: 16, spot: 8, edge: 48, lift: 16 };
480
356
  var LANDING_GATES = { path: 40, depth: 8, stillSpeed: 0.1875, stepSpeed: 0.375, trail: 40, rest: 22, pause: 60, slideSpeed: 2 };
481
357
  var LANDING_APPROACH = { reach: LANDING_MARGINS.exit, keep: LANDING_MARGINS.exit, nearer: 16 };
358
+ var LANDING_MODIFIERS = { on: DRAG_DEFAULTS.modifiers.on, floatKey: DRAG_DEFAULTS.modifiers.floatKey };
482
359
  var inside = (r, p, grow = 0) => p.x >= r.x - grow && p.x <= r.x + r.width + grow && p.y >= r.y - grow && p.y <= r.y + r.height + grow;
483
360
  var strictlyIn = (r, p) => p.x >= r.x && p.x <= r.x + r.width && p.y >= r.y && p.y <= r.y + r.height;
484
361
  function depthIn(lane, p, stage) {
@@ -500,14 +377,17 @@ function createLandingModel(options) {
500
377
  const margins = { ...LANDING_MARGINS, ...options.margins };
501
378
  const gates = { ...LANDING_GATES, ...options.gates };
502
379
  const approach = { ...LANDING_APPROACH, ...options.approach };
503
- const guidesLevel = options.placeGuides ?? "off";
380
+ const modifiers = { ...LANDING_MODIFIERS, ...options.modifiers };
381
+ const guidesLevel = guidesOf(options.preview ?? DRAG_PREVIEW_DEFAULT);
504
382
  let base = options.regions;
505
- let regionsFor = options.regionsFor;
383
+ let landingOf = options.landingOf;
384
+ let spotsOf = options.spotsOf;
506
385
  const cache = /* @__PURE__ */ new Map();
507
- const heldRegions = (spot) => {
508
- if (!spot || !regionsFor) return base;
509
- if (!cache.has(spot)) cache.set(spot, regionsFor(spot));
510
- return cache.get(spot) ?? base;
386
+ const heldLaneOf = (lane, spot) => {
387
+ if (!spot || !spotsOf) return lane;
388
+ if (!cache.has(spot)) cache.set(spot, spotsOf(spot));
389
+ const spots = cache.get(spot);
390
+ return spots ? { ...lane, spots } : lane;
511
391
  };
512
392
  let laneId = options.home?.lane ?? null;
513
393
  let spotId = options.home?.spot ?? null;
@@ -515,6 +395,8 @@ function createLandingModel(options) {
515
395
  let moved = null;
516
396
  let liftAt = options.lift ?? null;
517
397
  let inLiftZone = true;
398
+ const floatLift = !options.home && !options.regions.lanes.some((l) => l.spots.some((s) => s.home));
399
+ let floatLeft = false;
518
400
  let farHeld = false;
519
401
  let flung = false;
520
402
  let slowFrom = null;
@@ -532,7 +414,7 @@ function createLandingModel(options) {
532
414
  return kept && depthIn(deepest, p, stage) <= depthIn(kept, p, stage) + margins.spot ? kept.id : deepest.id;
533
415
  };
534
416
  let previous = laneId ? "lane" : "open";
535
- let frame = { region: previous, lane: laneId, spot: spotId, landing: null, room: !!spotId, guides: [], shift: false };
417
+ let frame = { region: previous, lane: laneId, spot: spotId, held: null, landing: null, room: !!spotId, guides: [], shift: false };
536
418
  let landedOn = null;
537
419
  const laneIn = (regions, id) => id ? regions.lanes.find((l) => l.id === id) : void 0;
538
420
  const spotIn = (lane, id) => lane && id ? lane.spots.find((s) => s.id === id) : void 0;
@@ -551,35 +433,8 @@ function createLandingModel(options) {
551
433
  }
552
434
  return best;
553
435
  }
554
- function landingAt(lane, spot, p, item) {
555
- const s = spot.slide;
556
- if (!s) return spot.landing;
557
- const ax = lane.axis;
558
- const long = item.width >= item.height ? "x" : "y";
559
- const size = long === "x" ? item.width : item.height;
560
- const g = options.grab ? long === "x" ? options.grab.x : options.grab.y : size / 2;
561
- const share = ax === long && size > 0 && Number.isFinite(g) ? Math.min(1, Math.max(0, g / size)) : 0.5;
562
- const length = ax === "x" ? spot.landing.width : spot.landing.height;
563
- const lo = Math.min(s.from, s.to);
564
- const hi = Math.max(s.from, s.to);
565
- const free = Math.min(hi, Math.max(lo, alongOf(lane, p) - share * length));
566
- const reach = s.snapDistance ?? SNAP_DISTANCE;
567
- let at = free;
568
- let best = Infinity;
569
- for (const q of s.snaps) {
570
- const d = Math.abs(q - free);
571
- if (d <= reach && d < best) {
572
- best = d;
573
- at = q;
574
- }
575
- }
576
- const step = s.step ?? SLIDE_STEP;
577
- if (best === Infinity && step > 0) at = Math.min(hi, Math.max(lo, Math.round(free / step) * step));
578
- return ax === "x" ? { ...spot.landing, x: at } : { ...spot.landing, y: at };
579
- }
580
436
  function along(lane, p, step) {
581
- const regions = heldRegions(spotId);
582
- const held = laneIn(regions, lane.id) ?? lane;
437
+ const held = heldLaneOf(lane, spotId);
583
438
  const a = alongOf(held, p);
584
439
  const now = spotIn(held, spotId);
585
440
  const cand = pick(held, a);
@@ -588,117 +443,34 @@ function createLandingModel(options) {
588
443
  const past = a < now.along[0] - margins.spot || a > now.along[1] + margins.spot;
589
444
  const reflows = now.others === void 0 || now.others !== cand.others;
590
445
  if (!past) return now;
591
- if (reflows && step > gates.stepSpeed && distanceTo2(now.landing, p) <= gates.trail) return now;
592
- if (regionsFor && reflows) {
593
- const theirs = heldRegions(cand.id);
594
- const lane2 = laneIn(theirs, lane.id);
595
- if (lane2 && pick(lane2, alongOf(lane2, p))?.id !== cand.id) return now;
446
+ if (reflows && step > gates.stepSpeed && distanceTo2(landingOf({ kind: "spot", lane: lane.id, spot: now.id, point: p }) ?? now.landing, p) <= gates.trail) return now;
447
+ if (spotsOf && reflows) {
448
+ const lane2 = heldLaneOf(lane, cand.id);
449
+ if (pick(lane2, alongOf(lane2, p))?.id !== cand.id) return now;
596
450
  }
597
451
  return cand;
598
452
  }
599
- function guidesFor(p, region, shift, pending, landing) {
453
+ function guidesFor(p, region, shift, pending, held) {
600
454
  if (guidesLevel === "off" || shift) return [];
601
- const regions = heldRegions(spotId);
602
- const all = (l, near2 = false) => {
603
- if (near2 && l.entry) return view(l, true);
604
- return l.marks ? l.marks.map((m, i) => ({ id: m.id ?? `${l.id}#${i}`, lane: l.id, kind: m.kind, rect: m.rect })) : view(l);
605
- };
606
- function view(l, near2 = false) {
607
- const marks = near2 && l.entry ? l.entry : l.marks;
608
- if (!marks) return l.spots.map((s) => ({ id: `${l.id}/${s.id}`, lane: l.id, kind: "box", rect: s.landing }));
609
- const box = l.rect;
610
- return marks.flatMap((m, i) => {
611
- const left = Math.max(m.rect.x, box.x);
612
- const top = Math.max(m.rect.y, box.y);
613
- const width = Math.min(m.rect.x + m.rect.width, box.x + box.width) - left;
614
- const height = Math.min(m.rect.y + m.rect.height, box.y + box.height) - top;
615
- const kept2 = width > m.rect.width - 1e-6 && height > m.rect.height - 1e-6;
616
- if (!kept2 && (m.kind === "line" || width <= 1e-6 || height <= 1e-6)) return [];
617
- return [{ id: m.id ?? `${l.id}#${i}`, lane: l.id, kind: m.kind, rect: kept2 ? m.rect : { x: left, y: top, width, height } }];
618
- });
619
- }
620
- const area2 = (a, c) => Math.min(a.x + a.width, c.x + c.width) - Math.max(a.x, c.x) > 1e-6 && Math.min(a.y + a.height, c.y + c.height) - Math.max(a.y, c.y) > 1e-6;
621
- const drawn = (g) => {
622
- const r = g.rect;
623
- const vertical = r.width <= r.height;
624
- const own = vertical ? r.width : r.height;
625
- if (g.kind !== "line" || own >= LINE_THICKNESS) return r;
626
- const d = (LINE_THICKNESS - own) / 2;
627
- return vertical ? { x: r.x - d, y: r.y, width: LINE_THICKNESS, height: r.height } : { x: r.x, y: r.y - d, width: r.width, height: LINE_THICKNESS };
628
- };
629
- const less = (gs, cs, thick = false) => {
630
- if (cs.length === 0) return [...gs];
631
- const clear = cs.map((rect) => ({ rect, clearance: 0 }));
632
- return gs.flatMap((g) => cs.some((c) => area2(thick ? drawn(g) : g.rect, c)) ? guideRects([g], { inside: g.rect, inset: 0, clear, minLength: 0, minThickness: 0 }) : [g]);
633
- };
634
- const near = nearLane(p, region, pending, regions);
455
+ const near = nearLane(p, region, pending, base);
635
456
  const wouldLand = (l) => {
636
- if (l.id === laneId) return region === "lane" ? landing : null;
457
+ if (l.id === laneId) return held;
637
458
  const s = pick(l, alongOf(l, p));
638
- return s ? landingAt(l, s, p, regions.item) : null;
459
+ return s ? { kind: "spot", lane: l.id, spot: s.id, point: p } : held;
639
460
  };
640
- const nearGuides = (l) => {
641
- const at2 = l.marks || l.entry ? wouldLand(l) : null;
642
- if (!at2) return all(l, true);
643
- const longEnough = (g) => g.kind !== "box" || (l.axis === "x" ? g.rect.width : g.rect.height) > MIN_BOX_LENGTH;
644
- const whole = all(l, true);
645
- return less(whole, [at2]).filter((g) => longEnough(g) || whole.some((w) => w.id === g.id && w.rect === g.rect));
646
- };
647
- if (guidesLevel === "near") return near ? nearGuides(near) : [];
648
- const owns = (l) => !!l && !!l.entry && !!l.corners?.length;
649
- let owner = owns(near) ? near : null;
650
- if (!owner && !near) {
461
+ if (guidesLevel === "near") return near ? [{ lane: near.id, held: wouldLand(near) }] : [];
462
+ let owner = near;
463
+ if (!owner) {
651
464
  let d = approach.reach;
652
- for (const l of regions.lanes) {
465
+ for (const l of base.lanes) {
653
466
  const dl = distanceTo2(l.rect, p);
654
- if (owns(l) && dl <= d) {
467
+ if (dl <= d) {
655
468
  owner = l;
656
469
  d = dl;
657
470
  }
658
471
  }
659
472
  }
660
- const ownerMarks = owner ? nearGuides(owner) : [];
661
- const cutBy = ownerMarks.map(drawn);
662
- const takes = (l) => {
663
- const across = (r) => l.axis === "x" ? [r.y, r.y + r.height] : [r.x, r.x + r.width];
664
- return view(l).every((g) => {
665
- const mine = drawn(g);
666
- return cutBy.every((c) => !area2(mine, c) || across(c)[0] <= across(mine)[0] + 1e-6 && across(c)[1] >= across(mine)[1] - 1e-6);
667
- });
668
- };
669
- const named = owner ? owner.corners.map((id) => regions.lanes.find((x) => x.id === id)).filter((x) => !!x) : [];
670
- const handed = new Set(named.filter(takes).map((x) => x.id));
671
- const kept = named.filter((x) => !handed.has(x.id)).flatMap((x) => view(x).map(drawn));
672
- const at = owner && (owner.marks || owner.entry) ? wouldLand(owner) : null;
673
- const without = (gs, r) => gs.flatMap((g) => {
674
- if (!r || !area2(drawn(g), r)) return [g];
675
- const a = g.rect;
676
- if (g.kind === "line") {
677
- const vertical = a.width <= a.height;
678
- const from = vertical ? a.y : a.x;
679
- const to = from + (vertical ? a.height : a.width);
680
- const c0 = vertical ? r.y : r.x;
681
- const c1 = c0 + (vertical ? r.height : r.width);
682
- const spans = [];
683
- if (c0 > from + 1e-6) spans.push([from, Math.min(to, c0)]);
684
- if (c1 < to - 1e-6) spans.push([Math.max(from, c1), to]);
685
- return spans.map(([s, e], k) => ({ ...g, id: k ? `${g.id}~l${k}` : g.id, rect: vertical ? { x: a.x, y: s, width: a.width, height: e - s } : { x: s, y: a.y, width: e - s, height: a.height } }));
686
- }
687
- const x0 = Math.max(a.x, r.x);
688
- const x1 = Math.min(a.x + a.width, r.x + r.width);
689
- const pieces = [];
690
- if (r.x > a.x) pieces.push({ x: a.x, y: a.y, width: r.x - a.x, height: a.height });
691
- if (r.x + r.width < a.x + a.width) pieces.push({ x: r.x + r.width, y: a.y, width: a.x + a.width - r.x - r.width, height: a.height });
692
- if (r.y > a.y) pieces.push({ x: x0, y: a.y, width: x1 - x0, height: r.y - a.y });
693
- if (r.y + r.height < a.y + a.height) pieces.push({ x: x0, y: r.y + r.height, width: x1 - x0, height: a.y + a.height - r.y - r.height });
694
- return pieces.map((rect, k) => ({ ...g, id: k ? `${g.id}~l${k}` : g.id, rect }));
695
- });
696
- return regions.lanes.flatMap((l) => {
697
- if (owner && l.id === owner.id) return less(ownerMarks, kept, true);
698
- if (near && l.id === near.id) return nearGuides(l);
699
- if (!named.some((x) => x.id === l.id)) return all(l);
700
- return without(handed.has(l.id) ? less(view(l), cutBy, true) : all(l), at);
701
- });
473
+ return base.lanes.map((l) => ({ lane: l.id, held: owner && l.id === owner.id ? wouldLand(l) : held }));
702
474
  }
703
475
  function nearLane(p, region, pending, regions) {
704
476
  if ((region === "lane" || region === "refused") && laneId) {
@@ -733,7 +505,7 @@ function createLandingModel(options) {
733
505
  }
734
506
  function update(raw, t, keys) {
735
507
  lastKeys = keys;
736
- const p = ontoStage(heldRegions(spotId).stage, raw, margins.edge) ?? raw;
508
+ const p = ontoStage(base.stage, raw, margins.edge) ?? raw;
737
509
  let step = 0;
738
510
  if (moved && (raw.x !== moved.raw.x || raw.y !== moved.raw.y)) {
739
511
  const before = moved.t;
@@ -749,7 +521,7 @@ function createLandingModel(options) {
749
521
  } else if (!Number.isFinite(sp) || sp > gates.stepSpeed) slowFrom = null;
750
522
  else slowFrom ??= before;
751
523
  } else if (moved) {
752
- const stage = heldRegions(spotId).stage;
524
+ const stage = base.stage;
753
525
  const onEdge = p.x <= stage.x || p.y <= stage.y || p.x >= stage.x + stage.width || p.y >= stage.y + stage.height;
754
526
  const since = t - moved.t;
755
527
  step = since >= gates.pause || since >= gates.rest && (lastStep <= gates.stepSpeed || onEdge) ? 0 : lastStep;
@@ -762,13 +534,15 @@ function createLandingModel(options) {
762
534
  step = lastStep = Infinity;
763
535
  }
764
536
  if (flung && slowFrom !== null && t - slowFrom >= gates.pause) flung = false;
765
- const edgeStage = heldRegions(spotId).stage;
537
+ const edgeStage = base.stage;
766
538
  const settled = !flung || p.x <= edgeStage.x || p.y <= edgeStage.y || p.x >= edgeStage.x + edgeStage.width || p.y >= edgeStage.y + edgeStage.height;
767
539
  const from = last?.p ?? null;
768
540
  const fromRaw = last?.raw ?? null;
769
541
  last = { p, raw, t };
770
- const shift = !!keys?.shift;
771
- const regions = heldRegions(spotId);
542
+ const shift = modifiers.on && isHeld(keys, modifiers.floatKey);
543
+ if (floatLift && liftAt && Math.hypot(p.x - liftAt.x, p.y - liftAt.y) > (margins.lift ?? 16)) floatLeft = true;
544
+ const floatZone = floatLift && !floatLeft && !!liftAt;
545
+ const regions = floatZone ? { ...base, lanes: [] } : base;
772
546
  const slow = Number.isFinite(hand.speed) ? hand.speed <= gates.stepSpeed : step <= gates.stepSpeed;
773
547
  for (const l of regions.lanes) {
774
548
  const was = from && strictlyIn(l.rect, from);
@@ -787,9 +561,9 @@ function createLandingModel(options) {
787
561
  region = "nowhere";
788
562
  laneId = spotId = null;
789
563
  } else {
790
- const held = laneIn(regions, laneId);
564
+ const held2 = laneIn(regions, laneId);
791
565
  const gate = (l) => (pathIn.get(l.id) ?? 0) >= gates.path || depthIn(l, p, regions.stage) >= gates.depth && step <= gates.stillSpeed && settled;
792
- const touching = held ? regions.lanes.find((l) => l.id !== held.id && strictlyIn(l.rect, p) && touches(l.rect, held.rect) && !inside(held.rect, p, margins.exit)) : void 0;
566
+ const touching = held2 ? regions.lanes.find((l) => l.id !== held2.id && strictlyIn(l.rect, p) && touches(l.rect, held2.rect) && !inside(held2.rect, p, margins.exit)) : void 0;
793
567
  const sl = touching ? slide.get(touching.id) : void 0;
794
568
  const slid = !!sl && sl.along >= gates.path && sl.across * 3 <= sl.along && hand.speed <= gates.slideSpeed;
795
569
  const liftR = margins.lift ?? 16;
@@ -798,29 +572,29 @@ function createLandingModel(options) {
798
572
  inLiftZone = far <= (inLiftZone ? liftR : Math.max(0, liftR - margins.spot));
799
573
  }
800
574
  const nearLift = !!liftAt && inLiftZone;
801
- const owner = nearLift ? void 0 : regions.lanes.find((l) => l.owns && l.id !== held?.id && cameIn.has(l.id) && strictlyIn(l.rect, p) && gate(l));
575
+ const owner = nearLift ? void 0 : regions.lanes.find((l) => l.owns && l.id !== held2?.id && cameIn.has(l.id) && strictlyIn(l.rect, p) && gate(l));
802
576
  const ownLane = nearLift && options.home ? laneIn(regions, options.home.lane) : void 0;
803
577
  const homeHere = ownLane && strictlyIn(ownLane.rect, p) ? ownLane : void 0;
804
578
  const lanesHere = regions.lanes.filter((l) => strictlyIn(l.rect, p) && !(l.owns && nearLift));
805
579
  const within2 = (b, l) => b.x >= l.rect.x - 1 && b.y >= l.rect.y - 1 && b.x + b.width <= l.rect.x + l.rect.width + 1 && b.y + b.height <= l.rect.y + l.rect.height + 1;
806
580
  const overRefused = (l) => Number.isFinite(step) && step <= gates.stepSpeed && settled && lanesHere.length === 1 && [...regions.blocked, ...regions.refused].some((b) => strictlyIn(b, p) && !within2(b, l));
807
581
  const next = homeHere ? void 0 : owner ?? (touching && (gate(touching) || slid || overRefused(touching)) ? touching : void 0);
808
- if (!(held && !homeHere && !next && (touching || inside(held.rect, p, margins.exit)))) farHeld = false;
582
+ if (!(held2 && !homeHere && !next && (touching || inside(held2.rect, p, margins.exit)))) farHeld = false;
809
583
  if (homeHere) {
810
584
  const s = spotIn(homeHere, options.home.spot) ?? pick(homeHere, alongOf(homeHere, p));
811
585
  laneId = homeHere.id;
812
586
  spotId = s?.id ?? null;
813
587
  region = s ? "lane" : "refused";
814
- } else if (held && !next && (touching || inside(held.rect, p, margins.exit))) {
815
- const d = distanceTo2(held.rect, p);
588
+ } else if (held2 && !next && (touching || inside(held2.rect, p, margins.exit))) {
589
+ const d = distanceTo2(held2.rect, p);
816
590
  farHeld = farHeld ? d > margins.exit + gates.path - margins.spot : d > margins.exit + gates.path;
817
591
  const far = farHeld;
818
- const s = far ? null : along(held, p, step);
592
+ const s = far ? null : along(held2, p, step);
819
593
  spotId = s?.id ?? spotId;
820
594
  region = s ? "lane" : "refused";
821
595
  if (!s) spotId = null;
822
- if (!s && !far && !strictlyIn(held.rect, p)) {
823
- const others = regions.lanes.filter((l) => l.id !== held.id && strictlyIn(l.rect, p));
596
+ if (!s && !far && !strictlyIn(held2.rect, p)) {
597
+ const others = regions.lanes.filter((l) => l.id !== held2.id && strictlyIn(l.rect, p));
824
598
  if (others.length > 0) pending = pendingIn(others, p, regions.stage);
825
599
  }
826
600
  } else {
@@ -843,21 +617,23 @@ function createLandingModel(options) {
843
617
  else region = "refused";
844
618
  }
845
619
  }
846
- previous = region;
620
+ previous = floatZone && base.lanes.some((l) => strictlyIn(l.rect, p)) ? previous : region;
847
621
  lastPending = pending;
848
622
  const shown = shift && (region === "lane" || region === "open") ? "open" : region;
849
- const r2 = heldRegions(spotId);
850
- const heldLane = laneIn(r2, laneId);
623
+ const lane0 = laneIn(base, laneId);
624
+ const heldLane = lane0 ? heldLaneOf(lane0, spotId) : void 0;
851
625
  const spot = spotIn(heldLane, spotId);
852
- landedOn = shown === "lane" && spot && heldLane ? { spot, axis: heldLane.axis } : null;
853
- const landing = shown === "lane" ? spot && heldLane ? landingAt(heldLane, spot, p, r2.item) : null : shown === "open" ? options.floatLanding?.(p) ?? null : null;
626
+ landedOn = shown === "lane" && spot ? spot : null;
627
+ const held = shown === "lane" ? spot && laneId ? { kind: "spot", lane: laneId, spot: spot.id, point: p } : null : shown === "open" ? { kind: "float", point: p } : null;
628
+ const landing = held ? landingOf(held) : null;
854
629
  frame = {
855
630
  region: shown,
856
631
  lane: laneId,
857
632
  spot: shown === "lane" ? spotId : null,
633
+ held: held && (held.kind === "spot" || landing) ? held : null,
858
634
  landing,
859
635
  room: shown === "lane" && !!spot,
860
- guides: guidesFor(p, shown, shift, pending && shown !== "lane" ? pending : null, landing),
636
+ guides: guidesFor(p, shown, shift, pending && shown !== "lane" ? pending : null, held && (held.kind === "spot" || landing) ? held : null),
861
637
  shift,
862
638
  ...pending && shown !== "lane" ? { pending } : {}
863
639
  };
@@ -867,22 +643,20 @@ function createLandingModel(options) {
867
643
  update,
868
644
  release(point, time, keys) {
869
645
  if (!last || last.raw.x !== point.x || last.raw.y !== point.y) update(point, time, keys ?? lastKeys);
870
- if (frame.region === "lane" && frame.lane && frame.spot) {
871
- const ownSpot = !!options.home && options.home.spot === frame.spot && options.home.lane === frame.lane;
872
- const on = landedOn;
873
- if (on?.spot.slide && frame.landing) {
874
- const start = (r) => on.axis === "x" ? r.x : r.y;
875
- const at = start(frame.landing);
876
- return { kind: "spot", lane: frame.lane, spot: frame.spot, home: ownSpot && Math.abs(at - start(on.spot.landing)) < 1e-6, at };
877
- }
878
- return { kind: "spot", lane: frame.lane, spot: frame.spot, home: ownSpot };
646
+ const s = frame.held;
647
+ if (s?.kind === "spot" && frame.region === "lane") {
648
+ const ownSpot = !!options.home && options.home.spot === s.spot && options.home.lane === s.lane;
649
+ const at = frame.landing;
650
+ const home = ownSpot && !!landedOn && !!at && Math.max(Math.abs(at.x - landedOn.landing.x), Math.abs(at.y - landedOn.landing.y), Math.abs(at.width - landedOn.landing.width), Math.abs(at.height - landedOn.landing.height)) < 1e-6;
651
+ return { kind: "spot", lane: s.lane, spot: s.spot, point: s.point, home };
879
652
  }
880
- if (frame.region === "open" && frame.landing) return { kind: "float", rect: frame.landing };
653
+ if (s?.kind === "float" && frame.region === "open" && frame.landing) return { kind: "float", point: s.point };
881
654
  return null;
882
655
  },
883
- setRegions(regions, nextRegionsFor) {
884
- base = regions;
885
- if (nextRegionsFor) regionsFor = nextRegionsFor;
656
+ setGeometry(geometry) {
657
+ base = geometry.regions;
658
+ landingOf = geometry.landingOf;
659
+ spotsOf = geometry.spotsOf;
886
660
  cache.clear();
887
661
  const l = laneIn(base, laneId);
888
662
  if (laneId && !l) laneId = spotId = null;
@@ -907,25 +681,6 @@ function createLandingModel(options) {
907
681
  };
908
682
  }
909
683
 
910
- // src/drag/preview.ts
911
- var DRAG_PREVIEW_DEFAULT = { mode: "glide" };
912
- var PLACE_GUIDES_DEFAULT = { outline: "off", placeholder: "near", glide: "off", snap: "near" };
913
- function previewPlan(frame, preview, slotted) {
914
- const p = typeof preview === "string" ? { mode: preview } : preview;
915
- const landing = "region" in frame;
916
- const shown = landing ? frame.landing !== null : !!frame.shown;
917
- const slots = slotted ?? (landing ? frame.region === "lane" : !!frame.shown && !frame.shown.free);
918
- const plan = planOf(p.mode, shown, frame.room, slots);
919
- const drawn = plan.showIndicator || plan.makeRoom || plan.snapItem;
920
- return { ...plan, guides: drawn ? "off" : p.placeGuides ?? PLACE_GUIDES_DEFAULT[p.mode] };
921
- }
922
- function planOf(mode, shown, room, slotted) {
923
- if (mode === "outline") return { showIndicator: shown, makeRoom: false, snapItem: false };
924
- if (mode === "placeholder") return { showIndicator: shown, makeRoom: room, snapItem: false };
925
- if (mode === "snap") return { showIndicator: false, makeRoom: room, snapItem: room && shown && slotted };
926
- return { showIndicator: shown && !slotted, makeRoom: room, snapItem: room && shown && slotted };
927
- }
928
-
929
684
  // src/drag/grip.ts
930
685
  function createGripPress(options = {}) {
931
686
  const tuning = options.tuning ?? {};
@@ -965,6 +720,151 @@ function createGripPress(options = {}) {
965
720
  };
966
721
  }
967
722
 
723
+ // src/drag/guide-rects.ts
724
+ var MIN_BOX_LENGTH = 8;
725
+ var LINE_THICKNESS = 2;
726
+ var EPS = 1e-6;
727
+ function guideRects(guides, options) {
728
+ const inset = Number.isFinite(options.inset) ? Math.max(0, options.inset) : 2;
729
+ const min = Number.isFinite(options.minThickness) ? Math.max(0, options.minThickness) : 2;
730
+ const lineThickness = Number.isFinite(options.lineThickness) ? Math.max(0, options.lineThickness) : LINE_THICKNESS;
731
+ const minLength = Number.isFinite(options.minLength) ? Math.max(0, options.minLength) : MIN_BOX_LENGTH;
732
+ const same = (a, b) => Math.abs(a.x - b.x) < EPS && Math.abs(a.y - b.y) < EPS && Math.abs(a.width - b.width) < EPS && Math.abs(a.height - b.height) < EPS;
733
+ const place = (g, rect) => same(g.rect, rect) ? g : { ...g, rect };
734
+ const x0 = options.inside.x + inset;
735
+ const y0 = options.inside.y + inset;
736
+ const x1 = options.inside.x + options.inside.width - inset;
737
+ const y1 = options.inside.y + options.inside.height - inset;
738
+ const gap = Number.isFinite(options.clearance) ? Math.max(0, options.clearance) : 2;
739
+ const finite = (r) => Number.isFinite(r.x) && Number.isFinite(r.y) && Number.isFinite(r.width) && Number.isFinite(r.height);
740
+ const allClear = (options.clear ?? []).map(
741
+ (c) => "rect" in c ? { k: c.rect, gap: Number.isFinite(c.clearance) ? Math.max(0, c.clearance) : gap, ...c.kinds ? { kinds: c.kinds } : {} } : { k: c, gap }
742
+ ).filter((c) => finite(c.k));
743
+ const out = [];
744
+ for (const g of guides) {
745
+ const r = g.rect;
746
+ const clear = allClear.filter((c) => !c.kinds || c.kinds.includes(g.kind));
747
+ if (g.kind === "box") {
748
+ const box = { a: Math.max(r.x, x0), b: Math.max(r.y, y0), c: Math.min(r.x + r.width, x1), d: Math.min(r.y + r.height, y1) };
749
+ if (!(box.c - box.a > EPS) || !(box.d - box.b > EPS)) continue;
750
+ const w = box.c - box.a;
751
+ const h = box.d - box.b;
752
+ const alongX = w > h || w === h && g.axis !== "y";
753
+ const s02 = alongX ? box.a : box.b;
754
+ const s12 = alongX ? box.c : box.d;
755
+ const t0 = alongX ? box.b : box.a;
756
+ const t1 = alongX ? box.d : box.c;
757
+ const toBox = (p0, p1, q0, q1) => alongX ? { a: p0, b: q0, c: p1, d: q1 } : { a: q0, b: p0, c: q1, d: p1 };
758
+ const over = clear.map(({ k: k2, gap: gap2 }) => ({
759
+ x0: k2.x - gap2,
760
+ x1: k2.x + k2.width + gap2,
761
+ y0: k2.y - gap2,
762
+ y1: k2.y + k2.height + gap2,
763
+ s0: (alongX ? k2.x : k2.y) - gap2,
764
+ s1: (alongX ? k2.x + k2.width : k2.y + k2.height) + gap2,
765
+ t0: (alongX ? k2.y : k2.x) - gap2,
766
+ t1: (alongX ? k2.y + k2.height : k2.x + k2.width) + gap2
767
+ })).filter((k2) => k2.s1 > s02 + EPS && k2.s0 < s12 - EPS && k2.t1 > t0 + EPS && k2.t0 < t1 - EPS);
768
+ let v0 = t0;
769
+ let v1 = t1;
770
+ const half = (t1 - t0) / 2 + EPS;
771
+ for (const k2 of over) {
772
+ if (k2.t0 <= t0 + EPS && k2.t1 >= t1 - EPS) continue;
773
+ const along = Math.min(k2.s1, s12) - Math.max(k2.s0, s02);
774
+ if (k2.t0 <= t0 + EPS) {
775
+ if (k2.t1 - t0 < along - EPS && k2.t1 - t0 <= half) v0 = Math.max(v0, k2.t1);
776
+ } else if (k2.t1 >= t1 - EPS) {
777
+ if (t1 - k2.t0 < along - EPS && t1 - k2.t0 <= half) v1 = Math.min(v1, k2.t0);
778
+ }
779
+ }
780
+ if ((v0 > t0 || v1 < t1) && v1 - v0 < Math.max(EPS, min)) continue;
781
+ const rest = over.filter((k2) => k2.t1 > v0 + EPS && k2.t0 < v1 - EPS);
782
+ const kept = toBox(s02, s12, v0, v1);
783
+ const full = rest.filter((k2) => k2.t0 <= v0 + EPS && k2.t1 >= v1 - EPS).map((k2) => [Math.max(k2.s0, s02), Math.min(k2.s1, s12)]).sort((p, q) => p[0] - q[0] || p[1] - q[1]);
784
+ const cuts = [];
785
+ for (const [lo2, hi2] of full) {
786
+ const last = cuts[cuts.length - 1];
787
+ if (last && lo2 <= last[1] + EPS) last[1] = Math.max(last[1], hi2);
788
+ else cuts.push([lo2, hi2]);
789
+ }
790
+ const spans = [];
791
+ let at = s02;
792
+ let k = 0;
793
+ for (const [lo2, hi2] of cuts) {
794
+ if (lo2 - at > EPS) spans.push({ lo: at, hi: lo2, k });
795
+ if (lo2 > s02 + EPS && hi2 < s12 - EPS) k++;
796
+ at = hi2;
797
+ }
798
+ if (s12 - at > EPS) spans.push({ lo: at, hi: s12, k });
799
+ const corners = rest.filter((k2) => !(k2.t0 <= v0 + EPS && k2.t1 >= v1 - EPS)).sort((p, q) => p.s0 - q.s0 || p.s1 - q.s1 || p.t0 - q.t0 || p.t1 - q.t1);
800
+ const longEnough = Math.max(EPS, minLength - EPS);
801
+ for (const span of spans) {
802
+ let p = toBox(span.lo, span.hi, v0, v1);
803
+ for (const k2 of corners) {
804
+ const { a, b, c, d } = p;
805
+ if (k2.x1 <= a + EPS || k2.x0 >= c - EPS || k2.y1 <= b + EPS || k2.y0 >= d - EPS) continue;
806
+ const cut = [
807
+ { a, b, c: Math.min(c, k2.x0), d },
808
+ { a: Math.max(a, k2.x1), b, c, d },
809
+ { a, b, c, d: Math.min(d, k2.y0) },
810
+ { a, b: Math.max(b, k2.y1), c, d }
811
+ ].filter((q) => q.c - q.a > EPS && q.d - q.b > EPS);
812
+ p = cut.length === 0 ? null : cut.reduce((q, s) => (s.c - s.a) * (s.d - s.b) > (q.c - q.a) * (q.d - q.b) ? s : q);
813
+ if (!p) break;
814
+ }
815
+ if (!p) continue;
816
+ const touched = Math.abs(p.a - kept.a) > EPS || Math.abs(p.b - kept.b) > EPS || Math.abs(p.c - kept.c) > EPS || Math.abs(p.d - kept.d) > EPS;
817
+ if (touched && (alongX ? p.c - p.a : p.d - p.b) < longEnough) continue;
818
+ const placed = place(g, { x: p.a, y: p.b, width: p.c - p.a, height: p.d - p.b });
819
+ const id = g.id;
820
+ out.push(span.k === 0 || typeof id !== "string" ? placed : { ...placed, id: `${id}#${span.k + 1}` });
821
+ }
822
+ continue;
823
+ }
824
+ const thinX = r.width <= r.height;
825
+ const own = thinX ? r.width : r.height;
826
+ const widen = g.kind === "line" && own < lineThickness;
827
+ const t = widen ? lineThickness : own;
828
+ let lo = (thinX ? r.x : r.y) - (widen ? (lineThickness - own) / 2 : 0);
829
+ const lim0 = thinX ? x0 : y0;
830
+ const lim1 = thinX ? x1 : y1;
831
+ if (lo + t > lim1) lo = lim1 - t;
832
+ if (lo < lim0) lo = lim0;
833
+ let hi = Math.min(lo + t, lim1);
834
+ const l0 = Math.max(thinX ? r.y : r.x, thinX ? y0 : x0);
835
+ const l1 = Math.min(thinX ? r.y + r.height : r.x + r.width, thinX ? y1 : x1);
836
+ if (l1 - l0 <= EPS) continue;
837
+ const around = clear.map(({ k: c, gap: gap2 }) => ({
838
+ a: (thinX ? c.y : c.x) - gap2,
839
+ b: (thinX ? c.y + c.height : c.x + c.width) + gap2,
840
+ c0: (thinX ? c.x : c.y) - gap2,
841
+ c1: (thinX ? c.x + c.width : c.y + c.height) + gap2
842
+ }));
843
+ let s0 = l0;
844
+ let s1 = l1;
845
+ let shortened = false;
846
+ for (const k of around) {
847
+ if (k.b <= l0 + EPS || k.a >= l1 - EPS || k.c1 <= lo + EPS || k.c0 >= hi - EPS) continue;
848
+ const atStart = k.a <= l0 + EPS;
849
+ const atEnd = k.b >= l1 - EPS;
850
+ if (atStart === atEnd) continue;
851
+ if (atStart) s0 = Math.max(s0, k.b);
852
+ else s1 = Math.min(s1, k.a);
853
+ shortened = true;
854
+ }
855
+ if (s1 - s0 <= EPS || shortened && s1 - s0 < Math.max(EPS, minLength - EPS)) continue;
856
+ for (const k of around) {
857
+ if (k.b <= s0 + EPS || k.a >= s1 - EPS || k.c1 <= lo + EPS || k.c0 >= hi - EPS) continue;
858
+ if (k.a <= l0 + EPS !== k.b >= l1 - EPS) continue;
859
+ if ((k.c0 + k.c1) / 2 >= (lo + hi) / 2) hi = Math.min(hi, k.c0);
860
+ else lo = Math.max(lo, k.c1);
861
+ }
862
+ if (hi - lo < Math.max(EPS, min)) continue;
863
+ out.push(place(g, thinX ? { x: lo, y: s0, width: hi - lo, height: s1 - s0 } : { x: s0, y: lo, width: s1 - s0, height: hi - lo }));
864
+ }
865
+ return out;
866
+ }
867
+
968
868
  export {
969
869
  DRAG_DEFAULTS,
970
870
  REFUSAL_RANK,
@@ -973,17 +873,18 @@ export {
973
873
  targetAt,
974
874
  liftDecision,
975
875
  createDragIntent,
976
- MIN_BOX_LENGTH,
977
- guideRects,
978
- SNAP_DISTANCE,
876
+ DRAG_PREVIEW_DEFAULT,
877
+ PLACE_GUIDES_DEFAULT,
878
+ guidesOf,
879
+ previewPlan,
979
880
  LANDING_MARGINS,
980
881
  LANDING_TOUCH_MARGINS,
981
882
  LANDING_GATES,
982
883
  LANDING_APPROACH,
884
+ LANDING_MODIFIERS,
983
885
  createLandingModel,
984
- DRAG_PREVIEW_DEFAULT,
985
- PLACE_GUIDES_DEFAULT,
986
- previewPlan,
987
- createGripPress
886
+ createGripPress,
887
+ MIN_BOX_LENGTH,
888
+ guideRects
988
889
  };
989
- //# sourceMappingURL=chunk-IT2FMZOM.js.map
890
+ //# sourceMappingURL=chunk-WSW2DNRW.js.map