@radioactive-labs/plutonium 0.41.1 → 0.43.0

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.
@@ -27683,17 +27683,28 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
27683
27683
  var remote_modal_controller_default = class extends Controller {
27684
27684
  connect() {
27685
27685
  this.originalScrollPosition = window.scrollY;
27686
+ this.originalOverflow = document.body.style.overflow;
27687
+ this.bodyStateRestored = false;
27688
+ document.body.style.overflow = "hidden";
27686
27689
  this.element.showModal();
27687
27690
  this.element.addEventListener("close", this.handleClose.bind(this));
27688
27691
  }
27689
27692
  close() {
27690
27693
  this.element.close();
27691
- window.scrollTo(0, this.originalScrollPosition);
27694
+ this.restoreBodyState();
27692
27695
  }
27693
27696
  disconnect() {
27694
27697
  this.element.removeEventListener("close", this.handleClose);
27698
+ this.restoreBodyState();
27695
27699
  }
27696
27700
  handleClose() {
27701
+ this.restoreBodyState();
27702
+ }
27703
+ restoreBodyState() {
27704
+ if (this.bodyStateRestored)
27705
+ return;
27706
+ this.bodyStateRestored = true;
27707
+ document.body.style.overflow = this.originalOverflow || "";
27697
27708
  window.scrollTo(0, this.originalScrollPosition);
27698
27709
  }
27699
27710
  };
@@ -27941,6 +27952,39 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
27941
27952
  }
27942
27953
  };
27943
27954
 
27955
+ // src/js/controllers/clipboard_controller.js
27956
+ var clipboard_controller_default = class extends Controller {
27957
+ static targets = ["source"];
27958
+ copy(event) {
27959
+ const text2 = this.sourceTarget.value || this.sourceTarget.textContent;
27960
+ const button = event.currentTarget;
27961
+ const originalText = button.textContent;
27962
+ navigator.clipboard.writeText(text2).then(() => {
27963
+ button.textContent = "Copied!";
27964
+ setTimeout(() => {
27965
+ button.textContent = originalText;
27966
+ }, 2e3);
27967
+ }).catch((err) => {
27968
+ console.warn("Clipboard API failed, using fallback:", err);
27969
+ this.fallbackCopy(text2);
27970
+ button.textContent = "Copied!";
27971
+ setTimeout(() => {
27972
+ button.textContent = originalText;
27973
+ }, 2e3);
27974
+ });
27975
+ }
27976
+ fallbackCopy(text2) {
27977
+ const textarea = document.createElement("textarea");
27978
+ textarea.value = text2;
27979
+ textarea.style.position = "fixed";
27980
+ textarea.style.opacity = "0";
27981
+ document.body.appendChild(textarea);
27982
+ textarea.select();
27983
+ document.execCommand("copy");
27984
+ document.body.removeChild(textarea);
27985
+ }
27986
+ };
27987
+
27944
27988
  // src/js/controllers/register_controllers.js
27945
27989
  function register_controllers_default(application2) {
27946
27990
  application2.register("password-visibility", password_visibility_controller_default);
@@ -27967,6 +28011,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
27967
28011
  application2.register("bulk-actions", bulk_actions_controller_default);
27968
28012
  application2.register("filter-panel", filter_panel_controller_default);
27969
28013
  application2.register("textarea-autogrow", textarea_autogrow_controller_default);
28014
+ application2.register("clipboard", clipboard_controller_default);
27970
28015
  }
27971
28016
 
27972
28017
  // src/js/turbo/turbo_actions.js