turbo-rails 2.0.0.pre.beta.3 → 2.0.0.pre.beta.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b7b21819e793a4171cd5ebdcbd3e9082b1337a3623f5241fccccbca26c70989
4
- data.tar.gz: 69d69e925673a080bfe40e719df3cf3c838c7188cceb30194146be63cbb929ba
3
+ metadata.gz: 1ebbd80b386f589e8154d0bb0c5a49cbd38dd43e09ad33a33c6981d0d6518d19
4
+ data.tar.gz: 94b8d1dcbe102085ddef02c04e3c546d0e96298b7fafce1853875446cb40847a
5
5
  SHA512:
6
- metadata.gz: 81c645877d527bcac7d22acb0d6405bda1d15503008599926882f467d89ad544a1dd923c79b348150679e3cbcc65b7ea6a4835cb4ca0c03bf08a72002a023771
7
- data.tar.gz: 20303a3c019a1f5b8387581b4a29b3bb13b89d8232f58d18efe9de2eb09347eee2964fe78d650b5fb18821cf890092d30025f027f7b530ab53a53e1ee614e189
6
+ metadata.gz: 4851e50f1411ac0544fd2d9f330f82c9453af40e98b92a5a31a117f20e6a2e28ade5298868a1c6786568eb686546db89c213e3c3ad17dffd52c984cbc84a7eb0
7
+ data.tar.gz: feb01812e76d08c659e0c9ffff7ef9dea553ae126603b94b63fa88821ec80acd1d4a6dc8c3921270657f236b66adc25d68507c0de0743e3e7d6f7a3df3644a07
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Turbo 8.0.0-beta.3
2
+ Turbo 8.0.0-beta.4
3
3
  Copyright © 2024 37signals LLC
4
4
  */
5
5
  (function(prototype) {
@@ -1623,8 +1623,6 @@ function readScrollBehavior(value, defaultValue) {
1623
1623
  }
1624
1624
  }
1625
1625
 
1626
- const ProgressBarID = "turbo-progress-bar";
1627
-
1628
1626
  class ProgressBar {
1629
1627
  static animationDuration=300;
1630
1628
  static get defaultCSS() {
@@ -1712,8 +1710,6 @@ class ProgressBar {
1712
1710
  }
1713
1711
  createStylesheetElement() {
1714
1712
  const element = document.createElement("style");
1715
- element.id = ProgressBarID;
1716
- element.setAttribute("data-turbo-permanent", "");
1717
1713
  element.type = "text/css";
1718
1714
  element.textContent = ProgressBar.defaultCSS;
1719
1715
  if (this.cspNonce) {
@@ -2639,13 +2635,10 @@ class LinkPrefetchObserver {
2639
2635
  prepareRequest(request) {
2640
2636
  const link = request.target;
2641
2637
  request.headers["Sec-Purpose"] = "prefetch";
2642
- if (link.dataset.turboFrame && link.dataset.turboFrame !== "_top") {
2643
- request.headers["Turbo-Frame"] = link.dataset.turboFrame;
2644
- } else if (link.dataset.turboFrame !== "_top") {
2645
- const turboFrame = link.closest("turbo-frame");
2646
- if (turboFrame) {
2647
- request.headers["Turbo-Frame"] = turboFrame.id;
2648
- }
2638
+ const turboFrame = link.closest("turbo-frame");
2639
+ const turboFrameTarget = link.getAttribute("data-turbo-frame") || turboFrame?.getAttribute("target") || turboFrame?.id;
2640
+ if (turboFrameTarget && turboFrameTarget !== "_top") {
2641
+ request.headers["Turbo-Frame"] = turboFrameTarget;
2649
2642
  }
2650
2643
  if (link.hasAttribute("data-turbo-stream")) {
2651
2644
  request.acceptResponseType("text/vnd.turbo-stream.html");
@@ -3756,7 +3749,7 @@ class PageRenderer extends Renderer {
3756
3749
  await mergedHeadElements;
3757
3750
  await newStylesheetElements;
3758
3751
  if (this.willRender) {
3759
- this.removeUnusedHeadStylesheetElements();
3752
+ this.removeUnusedDynamicStylesheetElements();
3760
3753
  }
3761
3754
  }
3762
3755
  async replaceBody() {
@@ -3781,8 +3774,8 @@ class PageRenderer extends Renderer {
3781
3774
  document.head.appendChild(activateScriptElement(element));
3782
3775
  }
3783
3776
  }
3784
- removeUnusedHeadStylesheetElements() {
3785
- for (const element of this.unusedHeadStylesheetElements) {
3777
+ removeUnusedDynamicStylesheetElements() {
3778
+ for (const element of this.unusedDynamicStylesheetElements) {
3786
3779
  document.head.removeChild(element);
3787
3780
  }
3788
3781
  }
@@ -3838,8 +3831,8 @@ class PageRenderer extends Renderer {
3838
3831
  async assignNewBody() {
3839
3832
  await this.renderElement(this.currentElement, this.newElement);
3840
3833
  }
3841
- get unusedHeadStylesheetElements() {
3842
- return this.oldHeadStylesheetElements.filter((element => !(element.hasAttribute("data-turbo-permanent") || element.hasAttribute("data-tag-name"))));
3834
+ get unusedDynamicStylesheetElements() {
3835
+ return this.oldHeadStylesheetElements.filter((element => element.getAttribute("data-turbo-track") === "dynamic"));
3843
3836
  }
3844
3837
  get oldHeadStylesheetElements() {
3845
3838
  return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot);