@types/hotwired__turbo 8.0.8 → 8.0.9

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.
hotwired__turbo/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for @hotwired/turbo (https://turbo.hotwir
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hotwired__turbo.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 02 Mar 2026 00:54:45 GMT
11
+ * Last updated: Mon, 02 Mar 2026 19:15:25 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -109,13 +109,62 @@ export class FetchResponse {
109
109
  succeeded: boolean;
110
110
  }
111
111
 
112
+ export interface Visit {
113
+ readonly action: Action;
114
+ readonly location: URL;
115
+ hasCachedSnapshot(): boolean;
116
+ complete(): void;
117
+ cancel(): void;
118
+ }
119
+
120
+ export interface Adapter {
121
+ visitProposedToLocation(location: URL, options?: VisitOptions): void;
122
+ visitStarted(visit: Visit): void;
123
+ visitCompleted(visit: Visit): void;
124
+ visitFailed(visit: Visit): void;
125
+ visitRequestStarted(visit: Visit): void;
126
+ visitRequestCompleted(visit: Visit): void;
127
+ visitRequestFailedWithStatusCode(visit: Visit, statusCode: number): void;
128
+ visitRequestFinished(visit: Visit): void;
129
+ visitRendered(visit: Visit): void;
130
+ pageInvalidated(reason: { reason: string }): void;
131
+ formSubmissionStarted?(formSubmission: FormSubmission): void;
132
+ formSubmissionFinished?(formSubmission: FormSubmission): void;
133
+ linkPrefetchingIsEnabledForLocation?(location: URL): boolean;
134
+ }
135
+
136
+ export class BrowserAdapter implements Adapter {
137
+ progressBar: ProgressBar;
138
+ visitProposedToLocation(location: URL, options?: VisitOptions): void;
139
+ visitStarted(visit: Visit): void;
140
+ visitCompleted(visit: Visit): void;
141
+ visitFailed(visit: Visit): void;
142
+ visitRequestStarted(visit: Visit): void;
143
+ visitRequestCompleted(visit: Visit): void;
144
+ visitRequestFailedWithStatusCode(visit: Visit, statusCode: number): void;
145
+ visitRequestFinished(visit: Visit): void;
146
+ visitRendered(visit: Visit): void;
147
+ pageInvalidated(reason: { reason: string }): void;
148
+ formSubmissionStarted(formSubmission: FormSubmission): void;
149
+ formSubmissionFinished(formSubmission: FormSubmission): void;
150
+ linkPrefetchingIsEnabledForLocation(location: URL): boolean;
151
+ }
152
+
153
+ export interface ProgressBar {
154
+ hiding: boolean;
155
+ value: number;
156
+ visible: boolean;
157
+ show(): void;
158
+ hide(): void;
159
+ setValue(value: number): void;
160
+ }
161
+
112
162
  /**
113
- * Interface for accessing the browser adapter.
114
- * The adapter handles form submission lifecycle events.
163
+ * The delegate for the Turbo navigator — in practice, the active session.
164
+ * Provides access to the current adapter.
115
165
  */
116
- export interface BrowserAdapter {
117
- formSubmissionStarted(formSubmission?: FormSubmission): void;
118
- formSubmissionFinished(formSubmission?: FormSubmission): void;
166
+ export interface NavigatorDelegate {
167
+ adapter: Adapter;
119
168
  }
120
169
 
121
170
  /**
@@ -123,6 +172,8 @@ export interface BrowserAdapter {
123
172
  * Provides methods for programmatic navigation and form submission.
124
173
  */
125
174
  export interface Navigator {
175
+ /** The delegate for this navigator (the active Turbo session). */
176
+ delegate: NavigatorDelegate;
126
177
  /**
127
178
  * Submits a form programmatically through Turbo Drive.
128
179
  *
@@ -231,7 +282,7 @@ export interface TurboSession {
231
282
  disconnectStreamSource(source: StreamSource): void;
232
283
  renderStreamMessage(message: StreamMessage | string): void;
233
284
  drive: boolean;
234
- adapter: BrowserAdapter;
285
+ adapter: Adapter;
235
286
  }
236
287
 
237
288
  export const StreamActions: {
@@ -256,7 +307,7 @@ export function start(): void;
256
307
  *
257
308
  * @param adapter Adapter to register
258
309
  */
259
- export function registerAdapter(adapter: unknown): void;
310
+ export function registerAdapter(adapter: Adapter): void;
260
311
 
261
312
  /**
262
313
  * Sets the form mode for Turbo Drive.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/hotwired__turbo",
3
- "version": "8.0.8",
3
+ "version": "8.0.9",
4
4
  "description": "TypeScript definitions for @hotwired/turbo",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hotwired__turbo",
6
6
  "license": "MIT",
@@ -31,6 +31,6 @@
31
31
  "scripts": {},
32
32
  "dependencies": {},
33
33
  "peerDependencies": {},
34
- "typesPublisherContentHash": "49235df4baa34fac8dd6000066c66f312478dead406fd7ac4efbb94cabbb34dd",
34
+ "typesPublisherContentHash": "14bee201bf4da78ad189fd43871b0f2fa9cc4a783bc5a02bd11cfcfcfb87ae96",
35
35
  "typeScriptVersion": "5.2"
36
36
  }