@void/vue 0.10.12 → 0.20.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.
- package/LICENSE +21 -0
- package/README.md +10 -3
- package/dist/{index-CsYmObm4.d.mts → index-CD3rUeKP.d.mts} +3 -4
- package/dist/index.d.mts +1 -1
- package/dist/plugin.d.mts +3 -5
- package/dist/plugin.mjs +8 -5
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/use-deferred.d.mts +5 -6
- package/package.json +10 -18
- package/dist/runtime/prefetch.d.mts +0 -2
- package/dist/runtime/prefetch.mjs +0 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, Cloudflare, Inc.
|
|
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.
|
package/README.md
CHANGED
|
@@ -63,6 +63,11 @@ state, `errors` for field validation, and `error` for non-validation call-site
|
|
|
63
63
|
failures. The submit helpers return promises so boundary-class failures can
|
|
64
64
|
propagate through Vue async error handling or explicit `catch` handlers.
|
|
65
65
|
|
|
66
|
+
GET navigation creates a fresh page instance, so forms receive the destination
|
|
67
|
+
record's URL and defaults. Layouts remain mounted. Mutations and
|
|
68
|
+
`router.refresh()` preserve page state by default; use `preserveState` to override
|
|
69
|
+
this behavior when navigating within the same record.
|
|
70
|
+
|
|
66
71
|
```vue
|
|
67
72
|
<script setup lang="ts">
|
|
68
73
|
import { useForm } from '@void/vue';
|
|
@@ -111,8 +116,10 @@ request.
|
|
|
111
116
|
|
|
112
117
|
## Tests
|
|
113
118
|
|
|
114
|
-
- `test/unit/
|
|
115
|
-
|
|
119
|
+
Shared prefetch-cache tests live in `packages/void/test/unit/prefetch.test.ts`.
|
|
120
|
+
|
|
116
121
|
- `test/integration/vue-pages-client.test.ts`
|
|
117
122
|
|
|
118
|
-
Cross-package SSR/protocol coverage for Vue pages mode also lives in `
|
|
123
|
+
Cross-package SSR/protocol coverage for Vue pages mode also lives in `packages/void/test/integration/*`.
|
|
124
|
+
|
|
125
|
+
The [shared client](../../test/pages-client-contract.ts) and [island](../../test/pages-island-contract.ts) contracts run against this adapter in both dev and preview. Shared form equality is tested directly in [Void](../void/test/unit/form-value-equality.test.ts); tests do not copy the hook implementation.
|
|
@@ -2,7 +2,6 @@ import { Component } from "vue";
|
|
|
2
2
|
import { ActionResult, NavigationState, VisitOptions, VoidActionError, VoidRouter } from "void/pages-client";
|
|
3
3
|
import { CloudContextVariables, DeferredState as Deferred, InferProps } from "void";
|
|
4
4
|
import { ActionFormOptions, ActionUrl, ResolveActionBody, ResolveActionParams } from "void/routes";
|
|
5
|
-
|
|
6
5
|
//#region src/runtime/link.d.ts
|
|
7
6
|
declare const Link: Component;
|
|
8
7
|
//#endregion
|
|
@@ -58,9 +57,9 @@ type IslandFormReturn<T extends Record<string, unknown>> = Readonly<{
|
|
|
58
57
|
clearError(): void;
|
|
59
58
|
}>;
|
|
60
59
|
/**
|
|
61
|
-
* Form composable for island pages. Uses fetch + page reload instead of the
|
|
62
|
-
* Void Router (which is not available in island mode).
|
|
63
|
-
*/
|
|
60
|
+
* Form composable for island pages. Uses fetch + page reload instead of the
|
|
61
|
+
* Void Router (which is not available in island mode).
|
|
62
|
+
*/
|
|
64
63
|
declare function useIslandForm<T extends Record<string, unknown>>(defaults: T): IslandFormReturn<T>;
|
|
65
64
|
//#endregion
|
|
66
65
|
//#region src/runtime/action.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as useIslandForm, c as useShared, d as Link, i as setActionRouter, l as useParams, n as InferProps, o as useNavigation, r as action, s as useForm, t as Deferred, u as useRouter } from "./index-
|
|
1
|
+
import { a as useIslandForm, c as useShared, d as Link, i as setActionRouter, l as useParams, n as InferProps, o as useNavigation, r as action, s as useForm, t as Deferred, u as useRouter } from "./index-CD3rUeKP.mjs";
|
|
2
2
|
export { type Deferred, type InferProps, Link, action, setActionRouter, useForm, useIslandForm, useNavigation, useParams, useRouter, useShared };
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import vue from "@vitejs/plugin-vue";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
|
|
4
3
|
//#region src/plugin.d.ts
|
|
5
|
-
type VoidVueOptions = Readonly<{
|
|
4
|
+
export type VoidVueOptions = Readonly<{
|
|
6
5
|
vue?: Parameters<typeof vue>[0];
|
|
7
6
|
viewTransitions?: boolean;
|
|
8
7
|
}>;
|
|
9
|
-
declare function voidVue(options?: VoidVueOptions): Array<Plugin>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { VoidVueOptions, voidVue };
|
|
8
|
+
export declare function voidVue(options?: VoidVueOptions): Array<Plugin>;
|
|
9
|
+
//#endregion
|
package/dist/plugin.mjs
CHANGED
|
@@ -344,6 +344,7 @@ initIslands(islands, hydrateIsland);
|
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/plugin-pages.ts
|
|
347
|
+
const RENDERER_ID = "virtual:void-pages-renderer";
|
|
347
348
|
const CLIENT_ENTRY_ID = "virtual:void-pages-client";
|
|
348
349
|
function isVuePageFile(id, pagesDir) {
|
|
349
350
|
if (!id.startsWith(pagesDir + "/")) return false;
|
|
@@ -406,7 +407,7 @@ function pagesPlugin(pagesDir, options) {
|
|
|
406
407
|
return pendingRescan;
|
|
407
408
|
};
|
|
408
409
|
const invalidatePageModules = (server) => {
|
|
409
|
-
for (const env of Object.values(server.environments)) for (const id of ["\
|
|
410
|
+
for (const env of Object.values(server.environments)) for (const id of ["\0" + RENDERER_ID, "\0" + CLIENT_ENTRY_ID]) {
|
|
410
411
|
const mod = env.moduleGraph.getModuleById(id);
|
|
411
412
|
if (mod) env.moduleGraph.invalidateModule(mod);
|
|
412
413
|
}
|
|
@@ -453,11 +454,11 @@ function pagesPlugin(pagesDir, options) {
|
|
|
453
454
|
async handler(id) {
|
|
454
455
|
if (isDev && pendingRescan) await pendingRescan;
|
|
455
456
|
if (!pageScan && existsSync(pagesDir)) await runRescan();
|
|
456
|
-
if (id === "\
|
|
457
|
+
if (id === "\0" + RENDERER_ID) {
|
|
457
458
|
if (!pageScan) return "export function renderPage() { throw new Error('No pages found'); }";
|
|
458
459
|
return generateRendererModule(pageScan, pagesDir);
|
|
459
460
|
}
|
|
460
|
-
if (id === "\
|
|
461
|
+
if (id === "\0" + CLIENT_ENTRY_ID) {
|
|
461
462
|
if (!pageScan) return "";
|
|
462
463
|
return generateClientEntry(pageScan, pagesDir, options?.viewTransitions, options?.prefetch, resolveStaticPageDataBuildOptions(root, { publicDir: viteConfig?.publicDir }));
|
|
463
464
|
}
|
|
@@ -568,6 +569,7 @@ const params = reactive({});
|
|
|
568
569
|
const currentComponent = shallowRef(null);
|
|
569
570
|
const currentLayouts = shallowRef([]);
|
|
570
571
|
const currentProps = shallowRef({});
|
|
572
|
+
const currentPageKey = ref(0);
|
|
571
573
|
const routeUrl = ref(window.location.pathname + window.location.search + window.location.hash);
|
|
572
574
|
const navigation = reactive(idleNavigationState());
|
|
573
575
|
|
|
@@ -589,7 +591,8 @@ const { router, initialPageData, initialComponent, initialLayouts, start } =
|
|
|
589
591
|
resolveDeferred(ref, value) { resolveDeferred(ref, value); return ref; },
|
|
590
592
|
rejectDeferred(ref, error) { rejectDeferred(ref, error); return ref; },
|
|
591
593
|
isLoading: (ref) => ref.loading,
|
|
592
|
-
applyUpdate(pageData, comp, layouts) {
|
|
594
|
+
applyUpdate(pageData, comp, layouts, options) {
|
|
595
|
+
if (!options?.preserveState) currentPageKey.value++;
|
|
593
596
|
Object.assign(shared, pageData.shared || {});
|
|
594
597
|
replaceRecord(errors, pageData.errors || {});
|
|
595
598
|
replaceRecord(params, pageData.params || {});
|
|
@@ -640,7 +643,7 @@ const app = createVoidApp({
|
|
|
640
643
|
return () => {
|
|
641
644
|
if (!currentComponent.value) return null;
|
|
642
645
|
patchProps(currentComponent.value, currentProps.value);
|
|
643
|
-
let vnode = h(currentComponent.value, currentProps.value);
|
|
646
|
+
let vnode = h(currentComponent.value, { ...currentProps.value, key: currentPageKey.value });
|
|
644
647
|
for (let i = currentLayouts.value.length - 1; i >= 0; i--) {
|
|
645
648
|
const inner = vnode;
|
|
646
649
|
vnode = h(currentLayouts.value[i], null, { default: () => inner });
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as useIslandForm, c as useShared, d as Link, i as setActionRouter, l as useParams, n as InferProps, o as useNavigation, r as action, s as useForm, t as Deferred, u as useRouter } from "../index-
|
|
1
|
+
import { a as useIslandForm, c as useShared, d as Link, i as setActionRouter, l as useParams, n as InferProps, o as useNavigation, r as action, s as useForm, t as Deferred, u as useRouter } from "../index-CD3rUeKP.mjs";
|
|
2
2
|
export { type Deferred, type InferProps, Link, action, setActionRouter, useForm, useIslandForm, useNavigation, useParams, useRouter, useShared };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/runtime/use-deferred.d.ts
|
|
2
|
-
type DeferredRef<T = unknown> = {
|
|
2
|
+
export type DeferredRef<T = unknown> = {
|
|
3
3
|
value: null;
|
|
4
4
|
loading: true;
|
|
5
5
|
error: null;
|
|
@@ -12,8 +12,7 @@ type DeferredRef<T = unknown> = {
|
|
|
12
12
|
loading: false;
|
|
13
13
|
error: Error;
|
|
14
14
|
};
|
|
15
|
-
declare function createDeferred<T = unknown>(): DeferredRef<T>;
|
|
16
|
-
declare function resolveDeferred(ref: DeferredRef, data: unknown): void;
|
|
17
|
-
declare function rejectDeferred(ref: DeferredRef, error: string): void;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { DeferredRef, createDeferred, rejectDeferred, resolveDeferred };
|
|
15
|
+
export declare function createDeferred<T = unknown>(): DeferredRef<T>;
|
|
16
|
+
export declare function resolveDeferred(ref: DeferredRef, data: unknown): void;
|
|
17
|
+
export declare function rejectDeferred(ref: DeferredRef, error: string): void;
|
|
18
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -19,41 +19,33 @@
|
|
|
19
19
|
"types": "./dist/plugin.d.mts",
|
|
20
20
|
"import": "./dist/plugin.mjs"
|
|
21
21
|
},
|
|
22
|
-
"./runtime": {
|
|
23
|
-
"types": "./dist/runtime/index.d.mts",
|
|
24
|
-
"import": "./dist/runtime/index.mjs"
|
|
25
|
-
},
|
|
26
22
|
"./deferred": {
|
|
27
23
|
"types": "./dist/runtime/use-deferred.d.mts",
|
|
28
24
|
"import": "./dist/runtime/use-deferred.mjs"
|
|
29
|
-
},
|
|
30
|
-
"./prefetch": {
|
|
31
|
-
"types": "./dist/runtime/prefetch.d.mts",
|
|
32
|
-
"import": "./dist/runtime/prefetch.mjs"
|
|
33
25
|
}
|
|
34
26
|
},
|
|
35
27
|
"publishConfig": {
|
|
36
28
|
"access": "public"
|
|
37
29
|
},
|
|
38
30
|
"dependencies": {
|
|
39
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
31
|
+
"@vitejs/plugin-vue": "^6.0.8"
|
|
40
32
|
},
|
|
41
33
|
"devDependencies": {
|
|
42
|
-
"@types/node": "^26.1
|
|
34
|
+
"@types/node": "^26.5.1",
|
|
43
35
|
"pathslash": "^0.1.0",
|
|
44
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
45
|
-
"vite-plus": "
|
|
46
|
-
"
|
|
47
|
-
"
|
|
36
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
|
|
37
|
+
"vite-plus": "0.3.1",
|
|
38
|
+
"void": "0.20.0",
|
|
39
|
+
"vue": "^3.5.42"
|
|
48
40
|
},
|
|
49
41
|
"peerDependencies": {
|
|
50
42
|
"vite": "^8.0.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
43
|
+
"void": "0.20.0",
|
|
44
|
+
"vue": "^3.5.0"
|
|
53
45
|
},
|
|
54
46
|
"scripts": {
|
|
55
47
|
"build": "vp pack",
|
|
56
48
|
"dev": "vp pack --watch",
|
|
57
|
-
"typecheck": "
|
|
49
|
+
"typecheck": "tsc --noEmit --rootDir ../.."
|
|
58
50
|
}
|
|
59
51
|
}
|