@hotwired/turbo 7.0.0 → 7.0.1
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/README.md
CHANGED
|
@@ -11,6 +11,4 @@ It's all done by sending HTML over the wire. And for those instances when that's
|
|
|
11
11
|
|
|
12
12
|
Read more on [turbo.hotwired.dev](https://turbo.hotwired.dev).
|
|
13
13
|
|
|
14
|
-
_Note: Turbo is currently in beta. We're using it in production with [HEY](https://hey.com), but expect that significant changes might be made in response to early feedback ✌️❤️_
|
|
15
|
-
|
|
16
14
|
© 2021 Basecamp, LLC.
|
package/dist/turbo.es2017-esm.js
CHANGED
|
@@ -33,12 +33,20 @@ function clickCaptured(event) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
(function () {
|
|
36
|
-
if ("SubmitEvent" in window)
|
|
37
|
-
return;
|
|
38
36
|
if ("submitter" in Event.prototype)
|
|
39
37
|
return;
|
|
38
|
+
let prototype;
|
|
39
|
+
if ("SubmitEvent" in window && /Apple Computer/.test(navigator.vendor)) {
|
|
40
|
+
prototype = window.SubmitEvent.prototype;
|
|
41
|
+
}
|
|
42
|
+
else if ("SubmitEvent" in window) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
prototype = window.Event.prototype;
|
|
47
|
+
}
|
|
40
48
|
addEventListener("click", clickCaptured, true);
|
|
41
|
-
Object.defineProperty(
|
|
49
|
+
Object.defineProperty(prototype, "submitter", {
|
|
42
50
|
get() {
|
|
43
51
|
if (this.type == "submit" && this.target instanceof HTMLFormElement) {
|
|
44
52
|
return submittersByForm.get(this.target);
|
|
@@ -682,8 +690,8 @@ class Snapshot {
|
|
|
682
690
|
class FormInterceptor {
|
|
683
691
|
constructor(delegate, element) {
|
|
684
692
|
this.submitBubbled = ((event) => {
|
|
685
|
-
|
|
686
|
-
|
|
693
|
+
const form = event.target;
|
|
694
|
+
if (form instanceof HTMLFormElement && form.closest("turbo-frame, html") == this.element) {
|
|
687
695
|
const submitter = event.submitter || undefined;
|
|
688
696
|
if (this.delegate.shouldInterceptFormSubmission(form, submitter)) {
|
|
689
697
|
event.preventDefault();
|
|
@@ -2522,7 +2530,7 @@ class Session {
|
|
|
2522
2530
|
this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL);
|
|
2523
2531
|
}
|
|
2524
2532
|
willSubmitForm(form, submitter) {
|
|
2525
|
-
return this.elementDriveEnabled(form) && this.elementDriveEnabled(submitter);
|
|
2533
|
+
return this.elementDriveEnabled(form) && (!submitter || this.elementDriveEnabled(submitter));
|
|
2526
2534
|
}
|
|
2527
2535
|
formSubmitted(form, submitter) {
|
|
2528
2536
|
this.navigator.submitForm(form, submitter);
|
|
@@ -2643,7 +2651,7 @@ const deprecatedLocationPropertyDescriptors = {
|
|
|
2643
2651
|
};
|
|
2644
2652
|
|
|
2645
2653
|
const session = new Session;
|
|
2646
|
-
const { navigator } = session;
|
|
2654
|
+
const { navigator: navigator$1 } = session;
|
|
2647
2655
|
function start() {
|
|
2648
2656
|
session.start();
|
|
2649
2657
|
}
|
|
@@ -2671,7 +2679,7 @@ function setProgressBarDelay(delay) {
|
|
|
2671
2679
|
|
|
2672
2680
|
var Turbo = /*#__PURE__*/Object.freeze({
|
|
2673
2681
|
__proto__: null,
|
|
2674
|
-
navigator: navigator,
|
|
2682
|
+
navigator: navigator$1,
|
|
2675
2683
|
session: session,
|
|
2676
2684
|
PageRenderer: PageRenderer,
|
|
2677
2685
|
PageSnapshot: PageSnapshot,
|
|
@@ -3144,4 +3152,4 @@ customElements.define("turbo-stream", StreamElement);
|
|
|
3144
3152
|
window.Turbo = Turbo;
|
|
3145
3153
|
start();
|
|
3146
3154
|
|
|
3147
|
-
export { PageRenderer, PageSnapshot, clearCache, connectStreamSource, disconnectStreamSource, navigator, registerAdapter, renderStreamMessage, session, setProgressBarDelay, start, visit };
|
|
3155
|
+
export { PageRenderer, PageSnapshot, clearCache, connectStreamSource, disconnectStreamSource, navigator$1 as navigator, registerAdapter, renderStreamMessage, session, setProgressBarDelay, start, visit };
|
package/dist/turbo.es2017-umd.js
CHANGED
|
@@ -39,12 +39,20 @@ Copyright © 2021 Basecamp, LLC
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
(function () {
|
|
42
|
-
if ("SubmitEvent" in window)
|
|
43
|
-
return;
|
|
44
42
|
if ("submitter" in Event.prototype)
|
|
45
43
|
return;
|
|
44
|
+
let prototype;
|
|
45
|
+
if ("SubmitEvent" in window && /Apple Computer/.test(navigator.vendor)) {
|
|
46
|
+
prototype = window.SubmitEvent.prototype;
|
|
47
|
+
}
|
|
48
|
+
else if ("SubmitEvent" in window) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
prototype = window.Event.prototype;
|
|
53
|
+
}
|
|
46
54
|
addEventListener("click", clickCaptured, true);
|
|
47
|
-
Object.defineProperty(
|
|
55
|
+
Object.defineProperty(prototype, "submitter", {
|
|
48
56
|
get() {
|
|
49
57
|
if (this.type == "submit" && this.target instanceof HTMLFormElement) {
|
|
50
58
|
return submittersByForm.get(this.target);
|
|
@@ -688,8 +696,8 @@ Copyright © 2021 Basecamp, LLC
|
|
|
688
696
|
class FormInterceptor {
|
|
689
697
|
constructor(delegate, element) {
|
|
690
698
|
this.submitBubbled = ((event) => {
|
|
691
|
-
|
|
692
|
-
|
|
699
|
+
const form = event.target;
|
|
700
|
+
if (form instanceof HTMLFormElement && form.closest("turbo-frame, html") == this.element) {
|
|
693
701
|
const submitter = event.submitter || undefined;
|
|
694
702
|
if (this.delegate.shouldInterceptFormSubmission(form, submitter)) {
|
|
695
703
|
event.preventDefault();
|
|
@@ -2528,7 +2536,7 @@ Copyright © 2021 Basecamp, LLC
|
|
|
2528
2536
|
this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL);
|
|
2529
2537
|
}
|
|
2530
2538
|
willSubmitForm(form, submitter) {
|
|
2531
|
-
return this.elementDriveEnabled(form) && this.elementDriveEnabled(submitter);
|
|
2539
|
+
return this.elementDriveEnabled(form) && (!submitter || this.elementDriveEnabled(submitter));
|
|
2532
2540
|
}
|
|
2533
2541
|
formSubmitted(form, submitter) {
|
|
2534
2542
|
this.navigator.submitForm(form, submitter);
|
|
@@ -2649,7 +2657,7 @@ Copyright © 2021 Basecamp, LLC
|
|
|
2649
2657
|
};
|
|
2650
2658
|
|
|
2651
2659
|
const session = new Session;
|
|
2652
|
-
const { navigator } = session;
|
|
2660
|
+
const { navigator: navigator$1 } = session;
|
|
2653
2661
|
function start() {
|
|
2654
2662
|
session.start();
|
|
2655
2663
|
}
|
|
@@ -2677,7 +2685,7 @@ Copyright © 2021 Basecamp, LLC
|
|
|
2677
2685
|
|
|
2678
2686
|
var Turbo = /*#__PURE__*/Object.freeze({
|
|
2679
2687
|
__proto__: null,
|
|
2680
|
-
navigator: navigator,
|
|
2688
|
+
navigator: navigator$1,
|
|
2681
2689
|
session: session,
|
|
2682
2690
|
PageRenderer: PageRenderer,
|
|
2683
2691
|
PageSnapshot: PageSnapshot,
|
|
@@ -3155,7 +3163,7 @@ Copyright © 2021 Basecamp, LLC
|
|
|
3155
3163
|
exports.clearCache = clearCache;
|
|
3156
3164
|
exports.connectStreamSource = connectStreamSource;
|
|
3157
3165
|
exports.disconnectStreamSource = disconnectStreamSource;
|
|
3158
|
-
exports.navigator = navigator;
|
|
3166
|
+
exports.navigator = navigator$1;
|
|
3159
3167
|
exports.registerAdapter = registerAdapter;
|
|
3160
3168
|
exports.renderStreamMessage = renderStreamMessage;
|
|
3161
3169
|
exports.session = session;
|
|
@@ -4,4 +4,6 @@ export declare class DriveDisabledTests extends TurboDriveTestCase {
|
|
|
4
4
|
setup(): Promise<void>;
|
|
5
5
|
"test drive disabled by default; click normal link"(): Promise<void>;
|
|
6
6
|
"test drive disabled by default; click link inside data-turbo='true'"(): Promise<void>;
|
|
7
|
+
"test drive disabled by default; submit form inside data-turbo='true'"(): Promise<void>;
|
|
8
|
+
get formSubmitted(): Promise<boolean>;
|
|
7
9
|
}
|
|
@@ -8,6 +8,8 @@ export declare class FrameTests extends TurboDriveTestCase {
|
|
|
8
8
|
"test following a link within a frame with a target set navigates the target frame"(): Promise<void>;
|
|
9
9
|
"test following a link within a descendant frame whose ancestor declares a target set navigates the descendant frame"(): Promise<void>;
|
|
10
10
|
"test following a link that declares data-turbo-frame within a frame whose ancestor respects the override"(): Promise<void>;
|
|
11
|
+
"test following a form within a nested frame with form target top"(): Promise<void>;
|
|
12
|
+
"test following a form within a nested frame with child frame target top"(): Promise<void>;
|
|
11
13
|
"test following a link within a frame with target=_top navigates the page"(): Promise<void>;
|
|
12
14
|
"test following a link that declares data-turbo-frame='_self' within a frame with target=_top navigates the frame itself"(): Promise<void>;
|
|
13
15
|
"test following a link to a page with a <turbo-frame recurse> which lazily loads a matching frame"(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotwired/turbo",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "The speed of a single-page web application without having to write any JavaScript",
|
|
5
5
|
"module": "dist/turbo.es2017-esm.js",
|
|
6
6
|
"main": "dist/turbo.es2017-umd.js",
|
|
@@ -20,7 +20,12 @@
|
|
|
20
20
|
"browser",
|
|
21
21
|
"pushstate"
|
|
22
22
|
],
|
|
23
|
-
"author": "
|
|
23
|
+
"author": "Basecamp, LLC",
|
|
24
|
+
"contributors": [
|
|
25
|
+
"Jeffrey Hardy <jeff@basecamp.com>",
|
|
26
|
+
"Javan Makhmali <javan@javan.us>",
|
|
27
|
+
"Sam Stephenson <sstephenson@gmail.com>"
|
|
28
|
+
],
|
|
24
29
|
"license": "MIT",
|
|
25
30
|
"bugs": {
|
|
26
31
|
"url": "https://github.com/hotwired/turbo/issues"
|