plutonium 0.26.3 → 0.26.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 830246436582563860f801e40a5489df4f342a0e6852178eef723df8c5cbe2f4
4
- data.tar.gz: daff78903ff5cbca41bfa33d23a44575c8bfd35cc695840fb6b00775d9d39a0d
3
+ metadata.gz: 4067f97f31d7e0f95dcd1e7eb05462fab42cbdee1dfc708e5aac6f31b897fb49
4
+ data.tar.gz: eaaf4c14ba6b482ae2e28bf02039f0cc3cf75575d503283eb1351ad75f3dcbe5
5
5
  SHA512:
6
- metadata.gz: 83f1eefc759c0cb3989917e1cef3772fb05f1eca9ee70f2d8e25f5b3f911c9dfec4674108e3c9201939bfcc9509c2ffc5a0a16d1a75286967a5edfbbc54e003d
7
- data.tar.gz: 894800a4648645b09e6fe948118518cc57b0e2c1fd49282a27715f94a4da179a4c6fa0023da1cdca15c8e2af0aa0627bc5c13fc453d2b5beffc1a16117af7ee1
6
+ metadata.gz: 2f38ed8c4dfb12ac17576899be686b1b0e65db6c843b0baae7a78b7c2d7d3237a571fa4477a203a654247a33446eab892c4e9690381cf58f6d94dc08daf4671c
7
+ data.tar.gz: 40f8321dad39732fdbc2f47c9757ca39c84c8d9c5438cda6f34a3a979ed09e8329f506b2a7f6fa6614e531f7da813b5f047d19cccbdbeab2bc8e3b5a845ef619
@@ -16290,19 +16290,46 @@ ${text2}</tr>
16290
16290
 
16291
16291
  // src/js/controllers/easymde_controller.js
16292
16292
  var easymde_controller_default = class extends Controller {
16293
+ static targets = ["textarea"];
16293
16294
  connect() {
16295
+ if (this.easyMDE)
16296
+ return;
16297
+ this.originalValue = this.element.value;
16294
16298
  this.easyMDE = new EasyMDE(this.#buildOptions());
16295
- this.element.setAttribute("data-action", "turbo:morph-element->easymde#reconnect");
16299
+ this.element.addEventListener("turbo:before-morph-element", (event) => {
16300
+ if (event.target === this.element && this.easyMDE) {
16301
+ this.storedValue = this.easyMDE.value();
16302
+ }
16303
+ });
16304
+ this.element.addEventListener("turbo:morph-element", (event) => {
16305
+ if (event.target === this.element) {
16306
+ requestAnimationFrame(() => this.#handleMorph());
16307
+ }
16308
+ });
16296
16309
  }
16297
16310
  disconnect() {
16298
16311
  if (this.easyMDE) {
16299
- this.easyMDE.toTextArea();
16312
+ try {
16313
+ if (this.element.isConnected && this.element.parentNode) {
16314
+ this.easyMDE.toTextArea();
16315
+ }
16316
+ } catch (error2) {
16317
+ console.warn("EasyMDE cleanup error:", error2);
16318
+ }
16300
16319
  this.easyMDE = null;
16301
16320
  }
16302
16321
  }
16303
- reconnect() {
16304
- this.disconnect();
16305
- this.connect();
16322
+ #handleMorph() {
16323
+ if (!this.element.isConnected)
16324
+ return;
16325
+ if (this.easyMDE) {
16326
+ this.easyMDE = null;
16327
+ }
16328
+ this.easyMDE = new EasyMDE(this.#buildOptions());
16329
+ if (this.storedValue !== void 0) {
16330
+ this.easyMDE.value(this.storedValue);
16331
+ this.storedValue = void 0;
16332
+ }
16306
16333
  }
16307
16334
  #buildOptions() {
16308
16335
  let options2 = {
@@ -16333,6 +16360,16 @@ ${text2}</tr>
16333
16360
  // src/js/controllers/slim_select_controller.js
16334
16361
  var slim_select_controller_default = class extends Controller {
16335
16362
  connect() {
16363
+ if (this.slimSelect)
16364
+ return;
16365
+ this.#setupSlimSelect();
16366
+ this.element.addEventListener("turbo:morph-element", (event) => {
16367
+ if (event.target === this.element) {
16368
+ requestAnimationFrame(() => this.#handleMorph());
16369
+ }
16370
+ });
16371
+ }
16372
+ #setupSlimSelect() {
16336
16373
  const settings = {};
16337
16374
  const modal = document.querySelector('[data-controller="remote-modal"]');
16338
16375
  if (modal) {
@@ -16362,10 +16399,6 @@ ${text2}</tr>
16362
16399
  this.element.addEventListener("ss:open", this.boundHandleDropdownOpen);
16363
16400
  this.element.addEventListener("ss:close", this.boundHandleDropdownClose);
16364
16401
  this.setupAriaObserver();
16365
- this.element.setAttribute(
16366
- "data-action",
16367
- "turbo:morph-element->slim-select#reconnect"
16368
- );
16369
16402
  }
16370
16403
  handleDropdownPosition() {
16371
16404
  if (this.dropdownContainer) {
@@ -16444,6 +16477,15 @@ ${text2}</tr>
16444
16477
  }
16445
16478
  }
16446
16479
  disconnect() {
16480
+ this.#cleanupSlimSelect();
16481
+ }
16482
+ #handleMorph() {
16483
+ if (!this.element.isConnected)
16484
+ return;
16485
+ this.#cleanupSlimSelect();
16486
+ this.#setupSlimSelect();
16487
+ }
16488
+ #cleanupSlimSelect() {
16447
16489
  if (this.element) {
16448
16490
  if (this.boundHandleDropdownOpen) {
16449
16491
  this.element.removeEventListener(
@@ -16480,21 +16522,24 @@ ${text2}</tr>
16480
16522
  this.modifiedSelectWrapper = null;
16481
16523
  }
16482
16524
  }
16483
- reconnect() {
16484
- this.disconnect();
16485
- setTimeout(() => this.connect(), 10);
16486
- }
16487
16525
  };
16488
16526
 
16489
16527
  // src/js/controllers/flatpickr_controller.js
16490
16528
  var flatpickr_controller_default = class extends Controller {
16491
16529
  connect() {
16530
+ if (this.picker)
16531
+ return;
16492
16532
  this.modal = document.querySelector("[data-controller=remote-modal]");
16493
16533
  this.picker = new flatpickr(this.element, this.#buildOptions());
16494
- this.element.setAttribute(
16495
- "data-action",
16496
- "turbo:morph-element->flatpickr#reconnect"
16497
- );
16534
+ this.element.addEventListener("turbo:morph-element", (event) => {
16535
+ if (event.target === this.element && !this.morphing) {
16536
+ this.morphing = true;
16537
+ requestAnimationFrame(() => {
16538
+ this.#handleMorph();
16539
+ this.morphing = false;
16540
+ });
16541
+ }
16542
+ });
16498
16543
  }
16499
16544
  disconnect() {
16500
16545
  if (this.picker) {
@@ -16502,9 +16547,15 @@ ${text2}</tr>
16502
16547
  this.picker = null;
16503
16548
  }
16504
16549
  }
16505
- reconnect() {
16506
- this.disconnect();
16507
- this.connect();
16550
+ #handleMorph() {
16551
+ if (!this.element.isConnected)
16552
+ return;
16553
+ if (this.picker) {
16554
+ this.picker.destroy();
16555
+ this.picker = null;
16556
+ }
16557
+ this.modal = document.querySelector("[data-controller=remote-modal]");
16558
+ this.picker = new flatpickr(this.element, this.#buildOptions());
16508
16559
  }
16509
16560
  #buildOptions() {
16510
16561
  let options2 = { altInput: true };
@@ -16530,10 +16581,18 @@ ${text2}</tr>
16530
16581
  this.inputTargetDisconnected();
16531
16582
  }
16532
16583
  inputTargetConnected() {
16533
- if (!this.hasInputTarget)
16584
+ if (!this.hasInputTarget || this.iti)
16534
16585
  return;
16535
16586
  this.iti = window.intlTelInput(this.inputTarget, this.#buildOptions());
16536
- this.inputTarget.setAttribute("data-action", "turbo:morph-element->intl-tel-input#reconnect");
16587
+ this.element.addEventListener("turbo:morph-element", (event) => {
16588
+ if (event.target === this.element && !this.morphing) {
16589
+ this.morphing = true;
16590
+ requestAnimationFrame(() => {
16591
+ this.#handleMorph();
16592
+ this.morphing = false;
16593
+ });
16594
+ }
16595
+ });
16537
16596
  }
16538
16597
  inputTargetDisconnected() {
16539
16598
  if (this.iti) {
@@ -16541,9 +16600,14 @@ ${text2}</tr>
16541
16600
  this.iti = null;
16542
16601
  }
16543
16602
  }
16544
- reconnect() {
16545
- this.inputTargetDisconnected();
16546
- this.inputTargetConnected();
16603
+ #handleMorph() {
16604
+ if (!this.inputTarget || !this.inputTarget.isConnected)
16605
+ return;
16606
+ if (this.iti) {
16607
+ this.iti.destroy();
16608
+ this.iti = null;
16609
+ }
16610
+ this.iti = window.intlTelInput(this.inputTarget, this.#buildOptions());
16547
16611
  }
16548
16612
  #buildOptions() {
16549
16613
  return {
@@ -29316,14 +29380,45 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
29316
29380
  static outlets = ["attachment-preview", "attachment-preview-container"];
29317
29381
  //======= Lifecycle
29318
29382
  connect() {
29383
+ if (this.uppy)
29384
+ return;
29319
29385
  this.uploadedFiles = [];
29320
29386
  this.element.style["display"] = "none";
29321
29387
  this.configureUppy();
29322
29388
  this.#buildTriggers();
29323
29389
  this.#onAttachmentsChanged();
29390
+ this.element.addEventListener("turbo:morph-element", (event) => {
29391
+ if (event.target === this.element && !this.morphing) {
29392
+ this.morphing = true;
29393
+ requestAnimationFrame(() => {
29394
+ this.#handleMorph();
29395
+ this.morphing = false;
29396
+ });
29397
+ }
29398
+ });
29324
29399
  }
29325
29400
  disconnect() {
29326
- this.uppy = null;
29401
+ this.#cleanupUppy();
29402
+ }
29403
+ #handleMorph() {
29404
+ if (!this.element.isConnected)
29405
+ return;
29406
+ this.#cleanupUppy();
29407
+ this.uploadedFiles = [];
29408
+ this.element.style["display"] = "none";
29409
+ this.configureUppy();
29410
+ this.#buildTriggers();
29411
+ this.#onAttachmentsChanged();
29412
+ }
29413
+ #cleanupUppy() {
29414
+ if (this.uppy) {
29415
+ this.uppy.destroy();
29416
+ this.uppy = null;
29417
+ }
29418
+ if (this.triggerContainer && this.triggerContainer.parentNode) {
29419
+ this.triggerContainer.parentNode.removeChild(this.triggerContainer);
29420
+ this.triggerContainer = null;
29421
+ }
29327
29422
  }
29328
29423
  attachmentPreviewOutletConnected(outlet, element) {
29329
29424
  this.#onAttachmentsChanged();