lilact 0.31.10 → 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.
@@ -2652,7 +2652,7 @@ var ComponentCore = class {
2652
2652
  this.component.componentWillUpdate(next_props, next_state);
2653
2653
  }
2654
2654
  const prev_state = this.state, prev_props = this.props;
2655
- if (this.element) {
2655
+ if (this.element && !(this?.component instanceof RootComponent)) {
2656
2656
  this.updateElementProps(next_props);
2657
2657
  }
2658
2658
  this.props = next_props;
@@ -2789,7 +2789,7 @@ var ComponentCore = class {
2789
2789
  }
2790
2790
  for (let a in this.props) {
2791
2791
  const al = a.toLowerCase();
2792
- if (!patch.hasOwnProperty(a)) {
2792
+ if (!patch.hasOwnProperty(a) || !a.startsWith("data-") && !a.startsWith("aria-") && (patch[a] === void 0 || patch[a] === null || patch[a] === "" || patch[a] === false)) {
2793
2793
  if (events_set.has(al)) {
2794
2794
  this.event_detachers[al]();
2795
2795
  } else {
@@ -2856,25 +2856,23 @@ var ComponentCore = class {
2856
2856
  this.updateElementClass(patch);
2857
2857
  }
2858
2858
  updateElementClass(patch = this.props) {
2859
- let cn = patch?.className;
2860
- cn ?? (cn = patch?.class ? patch.class : "");
2859
+ let cn = patch?.className ?? patch?.class ?? "";
2861
2860
  if (this?.parent?.[CHILD_CLASS_ADDENDUM]) {
2862
- cn += " " + this?.parent?.[CHILD_CLASS_ADDENDUM];
2861
+ cn += " " + this.parent[CHILD_CLASS_ADDENDUM];
2862
+ }
2863
+ cn = cn.trim();
2864
+ for (const n of Array.from(this.element.classList)) {
2865
+ if (cn.indexOf(n) === -1) {
2866
+ this.element.classList.remove(n);
2867
+ }
2863
2868
  }
2864
2869
  if (cn.length > 0) {
2865
2870
  cn = cn.split(/\s+/g);
2866
- for (const n of Array.from(this.element.classList)) {
2867
- if (cn.indexOf(n) === -1) {
2868
- this.element.classList.remove(n);
2869
- }
2870
- }
2871
2871
  for (const n of cn) {
2872
2872
  if (n.length > 0) {
2873
2873
  this.element.classList.add(n);
2874
2874
  }
2875
2875
  }
2876
- } else {
2877
- delete this.element.className;
2878
2876
  }
2879
2877
  }
2880
2878
  scanZombies(container2, next_element) {
@@ -4392,172 +4390,66 @@ __export(events_exports, {
4392
4390
  releaseSyntheticEvent: () => releaseSyntheticEvent,
4393
4391
  wrapListener: () => wrapListener
4394
4392
  });
4395
- if (typeof Element !== "undefined" && !Element.prototype.matches) {
4396
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) {
4397
- var matches = (this.document || this.ownerDocument).querySelectorAll(s);
4398
- var i2 = matches.length;
4399
- 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;
4400
4421
  }
4401
- return i2 > -1;
4402
4422
  };
4403
- }
4404
- if (typeof Event !== "undefined" && !Event.prototype.composedPath) {
4405
- Event.prototype.composedPath = function() {
4406
- var path2 = [];
4407
- var el = this.target;
4408
- while (el) {
4409
- path2.push(el);
4410
- 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;
4411
4433
  }
4412
- path2.push(window);
4413
- return path2;
4414
- };
4434
+ });
4415
4435
  }
4416
- var _pool = [];
4417
- var MAX_POOL_SIZE = 10;
4418
- var POINTER_TYPES = ["mouse", "pen", "touch"];
4419
- function createSyntheticEvent(nativeEvent, currentTarget) {
4420
- const e = _pool.length ? _pool.pop() : {};
4421
- e.nativeEvent = nativeEvent;
4422
- e.type = nativeEvent.type;
4423
- e.target = nativeEvent.target || nativeEvent.srcElement || null;
4424
- e.currentTarget = currentTarget || nativeEvent.currentTarget || null;
4425
- e.timeStamp = nativeEvent.timeStamp || Date.now();
4426
- e.defaultPrevented = !!nativeEvent.defaultPrevented;
4427
- e.isPropagationStopped = false;
4428
- e.isPersistent = false;
4429
- e.bubbles = !!nativeEvent.bubbles;
4430
- e.cancelable = !!nativeEvent.cancelable;
4431
- e.composed = !!nativeEvent.composed;
4432
- e.detail = nativeEvent.detail;
4433
- e.relatedTarget = nativeEvent.relatedTarget || (nativeEvent.fromElement ? nativeEvent.fromElement : null) || (nativeEvent.toElement ? nativeEvent.toElement : null) || null;
4434
- e.altKey = !!nativeEvent.altKey;
4435
- e.ctrlKey = !!nativeEvent.ctrlKey;
4436
- e.metaKey = !!nativeEvent.metaKey;
4437
- e.shiftKey = !!nativeEvent.shiftKey;
4438
- e.isDefaultPrevented = () => e.defaultPrevented;
4439
- e.preventDefault = () => {
4440
- if (nativeEvent.preventDefault) nativeEvent.preventDefault();
4441
- e.defaultPrevented = true;
4442
- };
4443
- e.stopPropagation = () => {
4444
- if (nativeEvent.stopPropagation) nativeEvent.stopPropagation();
4445
- e.isPropagationStopped = true;
4446
- };
4447
- e.persist = () => {
4448
- e.isPersistent = true;
4449
- };
4450
- e.key = nativeEvent.key || null;
4451
- e.code = nativeEvent.code || null;
4452
- e.which = nativeEvent.which ?? nativeEvent.keyCode ?? null;
4453
- e.button = nativeEvent.button ?? null;
4454
- e.buttons = nativeEvent.buttons ?? null;
4455
- e.pointerId = nativeEvent.pointerId ?? null;
4456
- e.pointerType = nativeEvent.pointerType ?? null;
4457
- e.isPrimary = nativeEvent.isPrimary ?? null;
4458
- e.clientX = nativeEvent.clientX ?? 0;
4459
- e.clientY = nativeEvent.clientY ?? 0;
4460
- e.screenX = nativeEvent.screenX ?? 0;
4461
- e.screenY = nativeEvent.screenY ?? 0;
4462
- e.pageX = nativeEvent.pageX ?? null;
4463
- e.pageY = nativeEvent.pageY ?? null;
4464
- e.movementX = nativeEvent.movementX ?? 0;
4465
- e.movementY = nativeEvent.movementY ?? 0;
4466
- e.pressure = nativeEvent.pressure ?? null;
4467
- e.tiltX = nativeEvent.tiltX ?? null;
4468
- e.tiltY = nativeEvent.tiltY ?? null;
4469
- e.width = nativeEvent.width ?? null;
4470
- e.height = nativeEvent.height ?? null;
4471
- e.pointerEventsSupported = POINTER_TYPES.includes(e.pointerType);
4472
- try {
4473
- const tgt = e.target;
4474
- e.value = tgt && "value" in tgt ? tgt.value : void 0;
4475
- e.checked = tgt && "checked" in tgt ? tgt.checked : void 0;
4476
- e.selectionStart = tgt && "selectionStart" in tgt ? tgt.selectionStart : void 0;
4477
- e.selectionEnd = tgt && "selectionEnd" in tgt ? tgt.selectionEnd : void 0;
4478
- } catch (err) {
4479
- e.value = void 0;
4480
- e.checked = void 0;
4481
- e.selectionStart = void 0;
4482
- e.selectionEnd = void 0;
4483
- }
4484
- e.touches = nativeEvent.touches || null;
4485
- e.targetTouches = nativeEvent.targetTouches || null;
4486
- e.changedTouches = nativeEvent.changedTouches || null;
4487
- e.path = typeof nativeEvent.composedPath === "function" ? nativeEvent.composedPath() : [e.target];
4488
- e.repeat = nativeEvent.repeat ?? false;
4489
- e.location = nativeEvent.location ?? 0;
4490
- return e;
4491
- }
4492
- function releaseSyntheticEvent(e) {
4493
- if (e && !e.isPersistent) {
4494
- e.nativeEvent = null;
4495
- e.type = null;
4496
- e.target = null;
4497
- e.currentTarget = null;
4498
- e.timeStamp = 0;
4499
- e.defaultPrevented = false;
4500
- e.isPropagationStopped = false;
4501
- e.isPersistent = false;
4502
- e.isDefaultPrevented = null;
4503
- e.preventDefault = null;
4504
- e.stopPropagation = null;
4505
- e.persist = null;
4506
- e.bubbles = false;
4507
- e.cancelable = false;
4508
- e.composed = false;
4509
- e.detail = void 0;
4510
- e.relatedTarget = null;
4511
- e.altKey = false;
4512
- e.ctrlKey = false;
4513
- e.metaKey = false;
4514
- e.shiftKey = false;
4515
- e.key = null;
4516
- e.code = null;
4517
- e.which = null;
4518
- e.button = null;
4519
- e.buttons = null;
4520
- e.pointerId = null;
4521
- e.pointerType = null;
4522
- e.isPrimary = null;
4523
- e.clientX = 0;
4524
- e.clientY = 0;
4525
- e.screenX = 0;
4526
- e.screenY = 0;
4527
- e.pageX = null;
4528
- e.pageY = null;
4529
- e.movementX = 0;
4530
- e.movementY = 0;
4531
- e.pressure = null;
4532
- e.tiltX = null;
4533
- e.tiltY = null;
4534
- e.width = null;
4535
- e.height = null;
4536
- e.value = void 0;
4537
- e.checked = void 0;
4538
- e.selectionStart = void 0;
4539
- e.selectionEnd = void 0;
4540
- e.touches = null;
4541
- e.targetTouches = null;
4542
- e.changedTouches = null;
4543
- e.path = null;
4544
- e.repeat = false;
4545
- e.location = 0;
4546
- if (_pool.length < MAX_POOL_SIZE) _pool.push(e);
4547
- }
4436
+ function releaseSyntheticEvent(event) {
4437
+ if (event) event.currentTarget = null;
4548
4438
  }
4549
4439
  function wrapListener(fn, opts = {}) {
4550
4440
  const { stopPropagationOnTrueReturn = false } = opts;
4551
4441
  return function handler(nativeEvent) {
4552
- const currentTarget = this || nativeEvent.currentTarget || null;
4553
- const sEvent = createSyntheticEvent(nativeEvent, currentTarget);
4442
+ const event = createSyntheticEvent(
4443
+ nativeEvent,
4444
+ this || nativeEvent.currentTarget || null
4445
+ );
4554
4446
  try {
4555
- const result2 = fn(sEvent);
4447
+ const result2 = fn(event);
4556
4448
  if (stopPropagationOnTrueReturn && result2 === true) {
4557
- sEvent.stopPropagation();
4449
+ event.stopPropagation();
4558
4450
  }
4559
4451
  } finally {
4560
- releaseSyntheticEvent(sEvent);
4452
+ releaseSyntheticEvent(event);
4561
4453
  }
4562
4454
  };
4563
4455
  }