lilact 0.31.11 → 0.31.12

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.
@@ -4390,172 +4390,66 @@ __export(events_exports, {
4390
4390
  releaseSyntheticEvent: () => releaseSyntheticEvent,
4391
4391
  wrapListener: () => wrapListener
4392
4392
  });
4393
- if (typeof Element !== "undefined" && !Element.prototype.matches) {
4394
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) {
4395
- var matches = (this.document || this.ownerDocument).querySelectorAll(s);
4396
- var i2 = matches.length;
4397
- while (--i2 >= 0 && matches.item(i2) !== this) {
4393
+ function createSyntheticEvent(nativeEvent, currentTarget) {
4394
+ let propagationStopped = false;
4395
+ const event = {
4396
+ nativeEvent,
4397
+ type: nativeEvent.type,
4398
+ target: nativeEvent.target || nativeEvent.srcElement || null,
4399
+ currentTarget: currentTarget || nativeEvent.currentTarget || null,
4400
+ timeStamp: nativeEvent.timeStamp ?? Date.now(),
4401
+ defaultPrevented: !!nativeEvent.defaultPrevented,
4402
+ isDefaultPrevented() {
4403
+ return event.defaultPrevented;
4404
+ },
4405
+ isPropagationStopped() {
4406
+ return propagationStopped;
4407
+ },
4408
+ preventDefault() {
4409
+ nativeEvent.preventDefault?.();
4410
+ event.defaultPrevented = true;
4411
+ },
4412
+ stopPropagation() {
4413
+ nativeEvent.stopPropagation?.();
4414
+ propagationStopped = true;
4415
+ },
4416
+ // Like React 17+ web SyntheticEvents: no pooling, persist is a no-op.
4417
+ persist() {
4418
+ },
4419
+ isPersistent() {
4420
+ return true;
4398
4421
  }
4399
- return i2 > -1;
4400
4422
  };
4401
- }
4402
- if (typeof Event !== "undefined" && !Event.prototype.composedPath) {
4403
- Event.prototype.composedPath = function() {
4404
- var path2 = [];
4405
- var el = this.target;
4406
- while (el) {
4407
- path2.push(el);
4408
- el = el.parentElement;
4423
+ return new Proxy(event, {
4424
+ get(target, property, receiver) {
4425
+ if (Reflect.has(target, property)) {
4426
+ return Reflect.get(target, property, receiver);
4427
+ }
4428
+ const value = Reflect.get(nativeEvent, property, nativeEvent);
4429
+ return typeof value === "function" ? value.bind(nativeEvent) : value;
4430
+ },
4431
+ has(target, property) {
4432
+ return Reflect.has(target, property) || property in nativeEvent;
4409
4433
  }
4410
- path2.push(window);
4411
- return path2;
4412
- };
4434
+ });
4413
4435
  }
4414
- var _pool = [];
4415
- var MAX_POOL_SIZE = 10;
4416
- var POINTER_TYPES = ["mouse", "pen", "touch"];
4417
- function createSyntheticEvent(nativeEvent, currentTarget) {
4418
- const e = _pool.length ? _pool.pop() : {};
4419
- e.nativeEvent = nativeEvent;
4420
- e.type = nativeEvent.type;
4421
- e.target = nativeEvent.target || nativeEvent.srcElement || null;
4422
- e.currentTarget = currentTarget || nativeEvent.currentTarget || null;
4423
- e.timeStamp = nativeEvent.timeStamp || Date.now();
4424
- e.defaultPrevented = !!nativeEvent.defaultPrevented;
4425
- e.isPropagationStopped = false;
4426
- e.isPersistent = false;
4427
- e.bubbles = !!nativeEvent.bubbles;
4428
- e.cancelable = !!nativeEvent.cancelable;
4429
- e.composed = !!nativeEvent.composed;
4430
- e.detail = nativeEvent.detail;
4431
- e.relatedTarget = nativeEvent.relatedTarget || (nativeEvent.fromElement ? nativeEvent.fromElement : null) || (nativeEvent.toElement ? nativeEvent.toElement : null) || null;
4432
- e.altKey = !!nativeEvent.altKey;
4433
- e.ctrlKey = !!nativeEvent.ctrlKey;
4434
- e.metaKey = !!nativeEvent.metaKey;
4435
- e.shiftKey = !!nativeEvent.shiftKey;
4436
- e.isDefaultPrevented = () => e.defaultPrevented;
4437
- e.preventDefault = () => {
4438
- if (nativeEvent.preventDefault) nativeEvent.preventDefault();
4439
- e.defaultPrevented = true;
4440
- };
4441
- e.stopPropagation = () => {
4442
- if (nativeEvent.stopPropagation) nativeEvent.stopPropagation();
4443
- e.isPropagationStopped = true;
4444
- };
4445
- e.persist = () => {
4446
- e.isPersistent = true;
4447
- };
4448
- e.key = nativeEvent.key || null;
4449
- e.code = nativeEvent.code || null;
4450
- e.which = nativeEvent.which ?? nativeEvent.keyCode ?? null;
4451
- e.button = nativeEvent.button ?? null;
4452
- e.buttons = nativeEvent.buttons ?? null;
4453
- e.pointerId = nativeEvent.pointerId ?? null;
4454
- e.pointerType = nativeEvent.pointerType ?? null;
4455
- e.isPrimary = nativeEvent.isPrimary ?? null;
4456
- e.clientX = nativeEvent.clientX ?? 0;
4457
- e.clientY = nativeEvent.clientY ?? 0;
4458
- e.screenX = nativeEvent.screenX ?? 0;
4459
- e.screenY = nativeEvent.screenY ?? 0;
4460
- e.pageX = nativeEvent.pageX ?? null;
4461
- e.pageY = nativeEvent.pageY ?? null;
4462
- e.movementX = nativeEvent.movementX ?? 0;
4463
- e.movementY = nativeEvent.movementY ?? 0;
4464
- e.pressure = nativeEvent.pressure ?? null;
4465
- e.tiltX = nativeEvent.tiltX ?? null;
4466
- e.tiltY = nativeEvent.tiltY ?? null;
4467
- e.width = nativeEvent.width ?? null;
4468
- e.height = nativeEvent.height ?? null;
4469
- e.pointerEventsSupported = POINTER_TYPES.includes(e.pointerType);
4470
- try {
4471
- const tgt = e.target;
4472
- e.value = tgt && "value" in tgt ? tgt.value : void 0;
4473
- e.checked = tgt && "checked" in tgt ? tgt.checked : void 0;
4474
- e.selectionStart = tgt && "selectionStart" in tgt ? tgt.selectionStart : void 0;
4475
- e.selectionEnd = tgt && "selectionEnd" in tgt ? tgt.selectionEnd : void 0;
4476
- } catch (err) {
4477
- e.value = void 0;
4478
- e.checked = void 0;
4479
- e.selectionStart = void 0;
4480
- e.selectionEnd = void 0;
4481
- }
4482
- e.touches = nativeEvent.touches || null;
4483
- e.targetTouches = nativeEvent.targetTouches || null;
4484
- e.changedTouches = nativeEvent.changedTouches || null;
4485
- e.path = typeof nativeEvent.composedPath === "function" ? nativeEvent.composedPath() : [e.target];
4486
- e.repeat = nativeEvent.repeat ?? false;
4487
- e.location = nativeEvent.location ?? 0;
4488
- return e;
4489
- }
4490
- function releaseSyntheticEvent(e) {
4491
- if (e && !e.isPersistent) {
4492
- e.nativeEvent = null;
4493
- e.type = null;
4494
- e.target = null;
4495
- e.currentTarget = null;
4496
- e.timeStamp = 0;
4497
- e.defaultPrevented = false;
4498
- e.isPropagationStopped = false;
4499
- e.isPersistent = false;
4500
- e.isDefaultPrevented = null;
4501
- e.preventDefault = null;
4502
- e.stopPropagation = null;
4503
- e.persist = null;
4504
- e.bubbles = false;
4505
- e.cancelable = false;
4506
- e.composed = false;
4507
- e.detail = void 0;
4508
- e.relatedTarget = null;
4509
- e.altKey = false;
4510
- e.ctrlKey = false;
4511
- e.metaKey = false;
4512
- e.shiftKey = false;
4513
- e.key = null;
4514
- e.code = null;
4515
- e.which = null;
4516
- e.button = null;
4517
- e.buttons = null;
4518
- e.pointerId = null;
4519
- e.pointerType = null;
4520
- e.isPrimary = null;
4521
- e.clientX = 0;
4522
- e.clientY = 0;
4523
- e.screenX = 0;
4524
- e.screenY = 0;
4525
- e.pageX = null;
4526
- e.pageY = null;
4527
- e.movementX = 0;
4528
- e.movementY = 0;
4529
- e.pressure = null;
4530
- e.tiltX = null;
4531
- e.tiltY = null;
4532
- e.width = null;
4533
- e.height = null;
4534
- e.value = void 0;
4535
- e.checked = void 0;
4536
- e.selectionStart = void 0;
4537
- e.selectionEnd = void 0;
4538
- e.touches = null;
4539
- e.targetTouches = null;
4540
- e.changedTouches = null;
4541
- e.path = null;
4542
- e.repeat = false;
4543
- e.location = 0;
4544
- if (_pool.length < MAX_POOL_SIZE) _pool.push(e);
4545
- }
4436
+ function releaseSyntheticEvent(event) {
4437
+ if (event) event.currentTarget = null;
4546
4438
  }
4547
4439
  function wrapListener(fn, opts = {}) {
4548
4440
  const { stopPropagationOnTrueReturn = false } = opts;
4549
4441
  return function handler(nativeEvent) {
4550
- const currentTarget = this || nativeEvent.currentTarget || null;
4551
- const sEvent = createSyntheticEvent(nativeEvent, currentTarget);
4442
+ const event = createSyntheticEvent(
4443
+ nativeEvent,
4444
+ this || nativeEvent.currentTarget || null
4445
+ );
4552
4446
  try {
4553
- const result2 = fn(sEvent);
4447
+ const result2 = fn(event);
4554
4448
  if (stopPropagationOnTrueReturn && result2 === true) {
4555
- sEvent.stopPropagation();
4449
+ event.stopPropagation();
4556
4450
  }
4557
4451
  } finally {
4558
- releaseSyntheticEvent(sEvent);
4452
+ releaseSyntheticEvent(event);
4559
4453
  }
4560
4454
  };
4561
4455
  }