@radioactive-labs/plutonium 0.1.11 → 0.1.13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radioactive-labs/plutonium",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Core assets for the Plutonium gem",
5
5
  "type": "module",
6
6
  "main": "src/js/core.js",
@@ -7437,11 +7437,16 @@
7437
7437
  connect() {
7438
7438
  console.log(`easymde connected: ${this.element}`);
7439
7439
  self.easyMDE = new EasyMDE({ element: this.element });
7440
+ this.element.setAttribute("data-action", "turbo:morph-element->easymde#reconnect");
7440
7441
  }
7441
7442
  disconnect() {
7442
7443
  self.easyMDE.toTextArea();
7443
7444
  self.easyMDE = null;
7444
7445
  }
7446
+ reconnect() {
7447
+ this.disconnect();
7448
+ this.connect();
7449
+ }
7445
7450
  };
7446
7451
 
7447
7452
  // src/js/controllers/slim_select_controller.js
@@ -7451,11 +7456,43 @@
7451
7456
  self.slimSelect = new SlimSelect({
7452
7457
  select: this.element
7453
7458
  });
7459
+ this.element.setAttribute("data-action", "turbo:morph-element->slim-select#reconnect");
7454
7460
  }
7455
7461
  disconnect() {
7456
7462
  self.slimSelect.destroy();
7457
7463
  self.slimSelect = null;
7458
7464
  }
7465
+ reconnect() {
7466
+ this.disconnect();
7467
+ this.connect();
7468
+ }
7469
+ };
7470
+
7471
+ // src/js/controllers/flatpickr_controller.js
7472
+ var flatpickr_controller_default = class extends Controller {
7473
+ connect() {
7474
+ console.log(`flatpickr connected: ${this.element}`);
7475
+ self.picker = new flatpickr(this.element, this.#buildOptions());
7476
+ this.element.setAttribute("data-action", "turbo:morph-element->flatpickr#reconnect");
7477
+ }
7478
+ disconnect() {
7479
+ self.picker.destroy();
7480
+ self.picker = null;
7481
+ }
7482
+ reconnect() {
7483
+ this.disconnect();
7484
+ this.connect();
7485
+ }
7486
+ #buildOptions() {
7487
+ let options = { altInput: true };
7488
+ if (this.element.attributes.type.value == "datetime-local") {
7489
+ options.enableTime = true;
7490
+ } else if (this.element.attributes.type.value == "time") {
7491
+ options.enableTime = true;
7492
+ options.noCalendar = true;
7493
+ }
7494
+ return options;
7495
+ }
7459
7496
  };
7460
7497
 
7461
7498
  // src/js/controllers/register_controllers.js
@@ -7484,6 +7521,7 @@
7484
7521
  application2.register("color-mode", color_mode_controller_default);
7485
7522
  application2.register("easymde", easymde_controller_default);
7486
7523
  application2.register("slim-select", slim_select_controller_default);
7524
+ application2.register("flatpickr", flatpickr_controller_default);
7487
7525
  }
7488
7526
 
7489
7527
  // node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js