@sveltejs/kit 1.0.0-next.503 → 1.0.0-next.504
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/package.json +1 -1
- package/src/runtime/app/forms.js +6 -0
- package/types/index.d.ts +24 -0
package/package.json
CHANGED
package/src/runtime/app/forms.js
CHANGED
|
@@ -51,6 +51,12 @@ export function enhance(form, submit = () => {}) {
|
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
const data = new FormData(form);
|
|
54
|
+
|
|
55
|
+
const submitter_name = event.submitter?.getAttribute('name');
|
|
56
|
+
if (submitter_name) {
|
|
57
|
+
data.append(submitter_name, event.submitter?.getAttribute('value') ?? '');
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
const controller = new AbortController();
|
|
55
61
|
|
|
56
62
|
let cancelled = false;
|
package/types/index.d.ts
CHANGED
|
@@ -295,13 +295,37 @@ export interface Navigation {
|
|
|
295
295
|
delta?: number;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
+
/**
|
|
299
|
+
* The shape of the `$page` store
|
|
300
|
+
*/
|
|
298
301
|
export interface Page<Params extends Record<string, string> = Record<string, string>> {
|
|
302
|
+
/**
|
|
303
|
+
* The URL of the current page
|
|
304
|
+
*/
|
|
299
305
|
url: URL;
|
|
306
|
+
/**
|
|
307
|
+
* The parameters of the current page - e.g. for a route like `/blog/[slug]`, the `slug` parameter
|
|
308
|
+
*/
|
|
300
309
|
params: Params;
|
|
310
|
+
/**
|
|
311
|
+
* The route ID of the current page - e.g. for `src/routes/blog/[slug]`, it would be `blog/[slug]`
|
|
312
|
+
*/
|
|
301
313
|
routeId: string | null;
|
|
314
|
+
/**
|
|
315
|
+
* Http status code of the current page
|
|
316
|
+
*/
|
|
302
317
|
status: number;
|
|
318
|
+
/**
|
|
319
|
+
* The error object of the current page, if any. Filled from the `handleError` hooks.
|
|
320
|
+
*/
|
|
303
321
|
error: App.Error | null;
|
|
322
|
+
/**
|
|
323
|
+
* The merged result of all data from all `load` functions on the current page. You can type a common denominator through `App.PageData`.
|
|
324
|
+
*/
|
|
304
325
|
data: App.PageData & Record<string, any>;
|
|
326
|
+
/**
|
|
327
|
+
* Filled only after a form submission. See [form actions](https://kit.svelte.dev/docs/form-actions) for more info.
|
|
328
|
+
*/
|
|
305
329
|
form: any;
|
|
306
330
|
}
|
|
307
331
|
|