Skip to content

Commit

Permalink
Turbo 8.0.0-beta.4
Browse files Browse the repository at this point in the history
  • Loading branch information
afcapel committed Jan 25, 2024
1 parent 0e0491e commit 4cd82fd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
27 changes: 10 additions & 17 deletions app/assets/javascripts/turbo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Turbo 8.0.0-beta.3
Turbo 8.0.0-beta.4
Copyright © 2024 37signals LLC
*/
(function(prototype) {
Expand Down Expand Up @@ -1623,8 +1623,6 @@ function readScrollBehavior(value, defaultValue) {
}
}

const ProgressBarID = "turbo-progress-bar";

class ProgressBar {
static animationDuration=300;
static get defaultCSS() {
Expand Down Expand Up @@ -1712,8 +1710,6 @@ class ProgressBar {
}
createStylesheetElement() {
const element = document.createElement("style");
element.id = ProgressBarID;
element.setAttribute("data-turbo-permanent", "");
element.type = "text/css";
element.textContent = ProgressBar.defaultCSS;
if (this.cspNonce) {
Expand Down Expand Up @@ -2639,13 +2635,10 @@ class LinkPrefetchObserver {
prepareRequest(request) {
const link = request.target;
request.headers["Sec-Purpose"] = "prefetch";
if (link.dataset.turboFrame && link.dataset.turboFrame !== "_top") {
request.headers["Turbo-Frame"] = link.dataset.turboFrame;
} else if (link.dataset.turboFrame !== "_top") {
const turboFrame = link.closest("turbo-frame");
if (turboFrame) {
request.headers["Turbo-Frame"] = turboFrame.id;
}
const turboFrame = link.closest("turbo-frame");
const turboFrameTarget = link.getAttribute("data-turbo-frame") || turboFrame?.getAttribute("target") || turboFrame?.id;
if (turboFrameTarget && turboFrameTarget !== "_top") {
request.headers["Turbo-Frame"] = turboFrameTarget;
}
if (link.hasAttribute("data-turbo-stream")) {
request.acceptResponseType("text/vnd.turbo-stream.html");
Expand Down Expand Up @@ -3756,7 +3749,7 @@ class PageRenderer extends Renderer {
await mergedHeadElements;
await newStylesheetElements;
if (this.willRender) {
this.removeUnusedHeadStylesheetElements();
this.removeUnusedDynamicStylesheetElements();
}
}
async replaceBody() {
Expand All @@ -3781,8 +3774,8 @@ class PageRenderer extends Renderer {
document.head.appendChild(activateScriptElement(element));
}
}
removeUnusedHeadStylesheetElements() {
for (const element of this.unusedHeadStylesheetElements) {
removeUnusedDynamicStylesheetElements() {
for (const element of this.unusedDynamicStylesheetElements) {
document.head.removeChild(element);
}
}
Expand Down Expand Up @@ -3838,8 +3831,8 @@ class PageRenderer extends Renderer {
async assignNewBody() {
await this.renderElement(this.currentElement, this.newElement);
}
get unusedHeadStylesheetElements() {
return this.oldHeadStylesheetElements.filter((element => !(element.hasAttribute("data-turbo-permanent") || element.hasAttribute("data-tag-name"))));
get unusedDynamicStylesheetElements() {
return this.oldHeadStylesheetElements.filter((element => element.getAttribute("data-turbo-track") === "dynamic"));
}
get oldHeadStylesheetElements() {
return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot);
Expand Down
8 changes: 4 additions & 4 deletions app/assets/javascripts/turbo.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/turbo.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hotwired/turbo-rails",
"version": "8.0.0-beta.3",
"version": "8.0.0-beta.4",
"description": "The speed of a single-page web application without having to write any JavaScript",
"module": "app/javascript/turbo/index.js",
"main": "app/assets/javascripts/turbo.js",
Expand All @@ -13,7 +13,7 @@
"release": "npm publish && git commit -am \"$npm_package_name v$npm_package_version\" && git push"
},
"dependencies": {
"@hotwired/turbo": "^8.0.0-beta.3",
"@hotwired/turbo": "^8.0.0-beta.4",
"@rails/actioncable": "^7.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
chalk "^2.4.2"
js-tokens "^4.0.0"

"@hotwired/turbo@^8.0.0-beta.3":
version "8.0.0-beta.3"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.0-beta.3.tgz#df27e6901643bc4dda0e1474b398b8062dd4f520"
integrity sha512-/jH2cEU6TQF13coMJl9GUSbrRO+CT8bF713sXqWpzOMdyh9PiOHNkgrT4lQIHxKE54g9mjKPoSIlXx0S2XwS2Q==
"@hotwired/turbo@^8.0.0-beta.4":
version "8.0.0-beta.4"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.0-beta.4.tgz#7f5b5df871a9faaa75d135439b26c6d224779a82"
integrity sha512-TumUvbUCofb/Ep3BH0p0SIRiWxvKIY1BFQlVnwxAs896dnwkmWYAhNQtVihg32PrhoeYdyYQarsurROnp1r+CA==

"@jridgewell/gen-mapping@^0.3.0":
version "0.3.3"
Expand Down

0 comments on commit 4cd82fd

Please sign in to comment.