@types/hotwired__turbo 8.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
@@ -0,0 +1,15 @@
1
+ # Installation
2
+ > `npm install --save @types/hotwired__turbo`
3
+
4
+ # Summary
5
+ This package contains type definitions for @hotwired/turbo (https://turbo.hotwired.dev).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hotwired__turbo.
9
+
10
+ ### Additional Details
11
+ * Last updated: Mon, 26 Feb 2024 17:35:19 GMT
12
+ * Dependencies: none
13
+
14
+ # Credits
15
+ These definitions were written by [Gareth Jones](https://github.com/G-Rath), and [Luke Davia](https://github.com/lukeify).
@@ -0,0 +1,111 @@
1
+ export class FrameElement extends HTMLElement {
2
+ src: string;
3
+ disabled: boolean;
4
+ loading: "eager" | "lazy";
5
+ loaded: Promise<void>;
6
+ autoscroll: boolean;
7
+
8
+ readonly complete: boolean;
9
+ readonly isActive: boolean;
10
+ readonly isPreview: boolean;
11
+
12
+ reload(): Promise<void>;
13
+ }
14
+
15
+ export class StreamElement extends HTMLElement {
16
+ connectedCallback(): Promise<void>;
17
+ render(): Promise<void>;
18
+ disconnect(): void;
19
+ removeDuplicateTargetChildren(): void;
20
+
21
+ /**
22
+ * The current action.
23
+ */
24
+ readonly action: string;
25
+
26
+ /**
27
+ * The current target (an element ID) to which the result will
28
+ * be rendered.
29
+ */
30
+ readonly target: string;
31
+
32
+ /**
33
+ * The current "targets" selector (a CSS selector)
34
+ */
35
+ readonly targets: string;
36
+
37
+ /**
38
+ * Reads the request-id attribute
39
+ */
40
+ readonly requestId: string;
41
+ }
42
+
43
+ export class FetchRequest {}
44
+ export class FetchResponse {}
45
+
46
+ /**
47
+ * Connects a stream source to the main session.
48
+ *
49
+ * @param source Stream source to connect
50
+ */
51
+ export function connectStreamSource(source: unknown): void;
52
+
53
+ /**
54
+ * Disconnects a stream source from the main session.
55
+ *
56
+ * @param source Stream source to disconnect
57
+ */
58
+ export function disconnectStreamSource(source: unknown): void;
59
+
60
+ /**
61
+ * Renders a stream message to the main session by appending it to the
62
+ * current document.
63
+ *
64
+ * @param message Message to render
65
+ */
66
+ export function renderStreamMessage(message: unknown): void;
67
+
68
+ export interface TurboSession {
69
+ connectStreamSource(source: unknown): void;
70
+ disconnectStreamSource(source: unknown): void;
71
+ renderStreamMessage(message: unknown): void;
72
+ }
73
+
74
+ export function visit(
75
+ location: string,
76
+ options?: { action?: "advance" | "replace"; frame?: string },
77
+ ): void;
78
+
79
+ export interface TurboGlobal {
80
+ /**
81
+ * Sets the delay after which the {@link https://turbo.hotwired.dev/handbook/drive#displaying-progress progress bar} will appear during navigation, in milliseconds.
82
+ * The progress bar appears after 500ms by default.
83
+ *
84
+ * Note that this method has no effect when used with the iOS or Android adapters.
85
+ *
86
+ * @param delayInMilliseconds
87
+ */
88
+ setProgressBarDelay(delayInMilliseconds: number): void;
89
+
90
+ /**
91
+ * Sets the method that is called by links decorated with {@link https://turbo.hotwired.dev/handbook/drive#requiring-confirmation-for-a-visit data-turbo-confirm}.
92
+ **
93
+ * The default is the browser’s built in confirm.
94
+ *
95
+ * The method should return true if the visit can proceed.
96
+ *
97
+ * @param confirmMethod
98
+ */
99
+ setConfirmMethod(confirmMethod: () => boolean): void;
100
+
101
+ visit(
102
+ location: string,
103
+ options?: { action?: "advance" | "replace"; frame?: string },
104
+ ): void;
105
+
106
+ session: TurboSession;
107
+ }
108
+
109
+ declare global {
110
+ const Turbo: TurboGlobal;
111
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@types/hotwired__turbo",
3
+ "version": "8.0.0",
4
+ "description": "TypeScript definitions for @hotwired/turbo",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hotwired__turbo",
6
+ "license": "MIT",
7
+ "contributors": [
8
+ {
9
+ "name": "Gareth Jones",
10
+ "githubUsername": "G-Rath",
11
+ "url": "https://github.com/G-Rath"
12
+ },
13
+ {
14
+ "name": "Luke Davia",
15
+ "githubUsername": "lukeify",
16
+ "url": "https://github.com/lukeify"
17
+ }
18
+ ],
19
+ "main": "",
20
+ "types": "index.d.ts",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24
+ "directory": "types/hotwired__turbo"
25
+ },
26
+ "scripts": {},
27
+ "dependencies": {},
28
+ "typesPublisherContentHash": "9add7020f634e3f37398181fbfad8008e17daa39c05964888b0aec96ed2642a6",
29
+ "typeScriptVersion": "4.6"
30
+ }