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 +4 -4
- data/app/assets/javascripts/turbo.js +10 -17
- data/app/assets/javascripts/turbo.min.js +4 -4
- data/app/assets/javascripts/turbo.min.js.map +1 -1
- data/lib/turbo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ebbd80b386f589e8154d0bb0c5a49cbd38dd43e09ad33a33c6981d0d6518d19
|
4
|
+
data.tar.gz: 94b8d1dcbe102085ddef02c04e3c546d0e96298b7fafce1853875446cb40847a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4851e50f1411ac0544fd2d9f330f82c9453af40e98b92a5a31a117f20e6a2e28ade5298868a1c6786568eb686546db89c213e3c3ad17dffd52c984cbc84a7eb0
|
7
|
+
data.tar.gz: feb01812e76d08c659e0c9ffff7ef9dea553ae126603b94b63fa88821ec80acd1d4a6dc8c3921270657f236b66adc25d68507c0de0743e3e7d6f7a3df3644a07
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
Turbo 8.0.0-beta.
|
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
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
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.
|
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
|
-
|
3785
|
-
for (const element of this.
|
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
|
3842
|
-
return this.oldHeadStylesheetElements.filter((element =>
|
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);
|