@radioactive-labs/plutonium 0.4.8 → 0.4.10
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 +1 -1
- package/src/css/flatpickr.css +797 -0
- package/src/css/plutonium.css +1 -0
- package/src/dist/css/plutonium.css +2 -2
- package/src/dist/js/plutonium.js +127 -24
- package/src/dist/js/plutonium.js.map +3 -3
- package/src/dist/js/plutonium.min.js +18 -18
- package/src/dist/js/plutonium.min.js.map +3 -3
- package/src/js/controllers/attachment_input_controller.js +43 -2
- package/src/js/controllers/easymde_controller.js +45 -6
- package/src/js/controllers/flatpickr_controller.js +42 -15
- package/src/js/controllers/intl_tel_input_controller.js +23 -5
- package/src/js/controllers/slim_select_controller.js +27 -12
package/src/dist/js/plutonium.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
|
-
|
|
16304
|
-
this.
|
|
16305
|
-
|
|
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,17 +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;
|
|
16532
|
+
this.modal = document.querySelector("[data-controller=remote-modal]");
|
|
16492
16533
|
this.picker = new flatpickr(this.element, this.#buildOptions());
|
|
16493
|
-
this.element.
|
|
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
|
+
});
|
|
16494
16543
|
}
|
|
16495
16544
|
disconnect() {
|
|
16496
16545
|
if (this.picker) {
|
|
@@ -16498,9 +16547,15 @@ ${text2}</tr>
|
|
|
16498
16547
|
this.picker = null;
|
|
16499
16548
|
}
|
|
16500
16549
|
}
|
|
16501
|
-
|
|
16502
|
-
this.
|
|
16503
|
-
|
|
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());
|
|
16504
16559
|
}
|
|
16505
16560
|
#buildOptions() {
|
|
16506
16561
|
let options2 = { altInput: true };
|
|
@@ -16510,6 +16565,9 @@ ${text2}</tr>
|
|
|
16510
16565
|
options2.enableTime = true;
|
|
16511
16566
|
options2.noCalendar = true;
|
|
16512
16567
|
}
|
|
16568
|
+
if (this.modal) {
|
|
16569
|
+
options2.appendTo = this.modal;
|
|
16570
|
+
}
|
|
16513
16571
|
return options2;
|
|
16514
16572
|
}
|
|
16515
16573
|
};
|
|
@@ -16523,10 +16581,18 @@ ${text2}</tr>
|
|
|
16523
16581
|
this.inputTargetDisconnected();
|
|
16524
16582
|
}
|
|
16525
16583
|
inputTargetConnected() {
|
|
16526
|
-
if (!this.hasInputTarget)
|
|
16584
|
+
if (!this.hasInputTarget || this.iti)
|
|
16527
16585
|
return;
|
|
16528
16586
|
this.iti = window.intlTelInput(this.inputTarget, this.#buildOptions());
|
|
16529
|
-
this.
|
|
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
|
+
});
|
|
16530
16596
|
}
|
|
16531
16597
|
inputTargetDisconnected() {
|
|
16532
16598
|
if (this.iti) {
|
|
@@ -16534,9 +16600,14 @@ ${text2}</tr>
|
|
|
16534
16600
|
this.iti = null;
|
|
16535
16601
|
}
|
|
16536
16602
|
}
|
|
16537
|
-
|
|
16538
|
-
this.
|
|
16539
|
-
|
|
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());
|
|
16540
16611
|
}
|
|
16541
16612
|
#buildOptions() {
|
|
16542
16613
|
return {
|
|
@@ -29297,6 +29368,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
|
|
|
29297
29368
|
var attachment_input_controller_default = class extends Controller {
|
|
29298
29369
|
static values = {
|
|
29299
29370
|
identifier: String,
|
|
29371
|
+
endpoint: String,
|
|
29300
29372
|
maxFileSize: { type: Number, default: null },
|
|
29301
29373
|
minFileSize: { type: Number, default: null },
|
|
29302
29374
|
maxTotalSize: { type: Number, default: null },
|
|
@@ -29308,14 +29380,45 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
|
|
|
29308
29380
|
static outlets = ["attachment-preview", "attachment-preview-container"];
|
|
29309
29381
|
//======= Lifecycle
|
|
29310
29382
|
connect() {
|
|
29383
|
+
if (this.uppy)
|
|
29384
|
+
return;
|
|
29311
29385
|
this.uploadedFiles = [];
|
|
29312
29386
|
this.element.style["display"] = "none";
|
|
29313
29387
|
this.configureUppy();
|
|
29314
29388
|
this.#buildTriggers();
|
|
29315
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
|
+
});
|
|
29316
29399
|
}
|
|
29317
29400
|
disconnect() {
|
|
29318
|
-
this
|
|
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
|
+
}
|
|
29319
29422
|
}
|
|
29320
29423
|
attachmentPreviewOutletConnected(outlet, element) {
|
|
29321
29424
|
this.#onAttachmentsChanged();
|
|
@@ -29341,7 +29444,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
|
|
|
29341
29444
|
}
|
|
29342
29445
|
#configureUploader() {
|
|
29343
29446
|
this.uppy.use(XHRUpload, {
|
|
29344
|
-
endpoint:
|
|
29447
|
+
endpoint: this.endpointValue
|
|
29345
29448
|
// path to the upload endpoint
|
|
29346
29449
|
});
|
|
29347
29450
|
}
|