@mmstack/primitives 21.10.0 → 21.10.2
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.
|
@@ -3552,7 +3552,7 @@ function createPointerDrag(opt) {
|
|
|
3552
3552
|
return base;
|
|
3553
3553
|
}
|
|
3554
3554
|
const hostRef = inject((ElementRef), { optional: true });
|
|
3555
|
-
const { target = hostRef?.nativeElement, coordinateSpace = 'client', activationThreshold = 3, throttle = 16, handleSelector, buttons = [0], stopPropagation = false, debugName = 'pointerDrag', } = opt ?? {};
|
|
3555
|
+
const { target = hostRef?.nativeElement, coordinateSpace = 'client', activationThreshold = 3, throttle = 16, handleSelector, buttons = [0], stopPropagation = false, capture = false, debugName = 'pointerDrag', } = opt ?? {};
|
|
3556
3556
|
const resolve = (t) => {
|
|
3557
3557
|
if (!t)
|
|
3558
3558
|
return null;
|
|
@@ -3684,6 +3684,7 @@ function createPointerDrag(opt) {
|
|
|
3684
3684
|
const controller = new AbortController();
|
|
3685
3685
|
el.addEventListener('pointerdown', onDown(el), {
|
|
3686
3686
|
signal: controller.signal,
|
|
3687
|
+
capture,
|
|
3687
3688
|
});
|
|
3688
3689
|
return () => {
|
|
3689
3690
|
controller.abort();
|
|
@@ -6873,14 +6874,27 @@ function storeTabSync(sig, opt, bus, injector) {
|
|
|
6873
6874
|
case 'hello': {
|
|
6874
6875
|
if (phase !== 'live' || msg.from === sync.origin)
|
|
6875
6876
|
return;
|
|
6876
|
-
|
|
6877
|
-
const timer = setTimeout(() => {
|
|
6878
|
-
responseTimers.delete(msg.from);
|
|
6877
|
+
const respond = () => {
|
|
6879
6878
|
const snap = sync.snapshot();
|
|
6880
6879
|
const covered = Object.entries(snap.wm).every(([origin, v]) => (msg.wm[origin] ?? 0) >= v);
|
|
6881
6880
|
post(covered
|
|
6882
6881
|
? { t: 'uptodate', proto: OP_PROTO_VERSION, to: msg.from }
|
|
6883
6882
|
: { t: 'state', proto: OP_PROTO_VERSION, to: msg.from, state: snap });
|
|
6883
|
+
};
|
|
6884
|
+
// `jitterMs: 0` answers HERE, in the message handler, with no timer at all. This is the
|
|
6885
|
+
// difference between "as fast as possible" and "possible": a hidden tab's timers are
|
|
6886
|
+
// aligned to ≥1s, so even setTimeout(0) from a backgrounded responder routinely outlives
|
|
6887
|
+
// the joiner's hello window — while message events are not throttled. A channel whose
|
|
6888
|
+
// typical population is one hidden responder (a builder answering its preview tab) opts
|
|
6889
|
+
// in; the jittered path stays the default for many-peer channels.
|
|
6890
|
+
if (jitterMs === 0) {
|
|
6891
|
+
respond();
|
|
6892
|
+
return;
|
|
6893
|
+
}
|
|
6894
|
+
// first responder wins: jittered answer, cancelled when someone else answers first
|
|
6895
|
+
const timer = setTimeout(() => {
|
|
6896
|
+
responseTimers.delete(msg.from);
|
|
6897
|
+
respond();
|
|
6884
6898
|
}, Math.random() * jitterMs);
|
|
6885
6899
|
responseTimers.set(msg.from, timer);
|
|
6886
6900
|
return;
|