@web-widget/vue 0.0.2 → 0.0.4
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/dist/vue.client.d.ts +3 -2
- package/dist/vue.client.js +8 -7
- package/dist/vue.server.d.ts +3 -2
- package/dist/vue.server.js +3 -2
- package/package.json +2 -2
package/dist/vue.client.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _web_widget_schema from '@web-widget/schema';
|
|
2
|
-
import { App } from 'vue';
|
|
2
|
+
import { App, Component } from 'vue';
|
|
3
|
+
import { RenderContext, ComponentProps } from '@web-widget/schema/client-helpers';
|
|
3
4
|
export * from '@web-widget/schema/client-helpers';
|
|
4
5
|
|
|
5
6
|
interface DefineVueRenderOptions {
|
|
6
|
-
onCreatedApp?: (app: App) => void;
|
|
7
|
+
onCreatedApp?: (app: App, context: RenderContext, component: Component, props: ComponentProps) => void;
|
|
7
8
|
}
|
|
8
9
|
declare const defineVueRender: ({ onCreatedApp, }?: DefineVueRenderOptions) => (context: _web_widget_schema.ClientWidgetRenderContext<unknown> | _web_widget_schema.ClientRouteRenderContext<unknown, Record<string, string>>) => Promise<void | {
|
|
9
10
|
mount?: (() => void | Promise<void>) | undefined;
|
package/dist/vue.client.js
CHANGED
|
@@ -6,20 +6,21 @@ var defineVueRender = ({
|
|
|
6
6
|
onCreatedApp = () => {
|
|
7
7
|
}
|
|
8
8
|
} = {}) => {
|
|
9
|
-
return defineRender(async (
|
|
10
|
-
if (!container) {
|
|
9
|
+
return defineRender(async (context, component, props) => {
|
|
10
|
+
if (!context.container) {
|
|
11
11
|
throw new Error(`Container required.`);
|
|
12
12
|
}
|
|
13
13
|
let app;
|
|
14
14
|
return {
|
|
15
15
|
async mount() {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const rootProps = props;
|
|
17
|
+
if (context.recovering) {
|
|
18
|
+
app = createSSRApp(component, rootProps);
|
|
18
19
|
} else {
|
|
19
|
-
app = createApp(component,
|
|
20
|
+
app = createApp(component, rootProps);
|
|
20
21
|
}
|
|
21
|
-
onCreatedApp(app);
|
|
22
|
-
app.mount(container);
|
|
22
|
+
onCreatedApp(app, context, component, props);
|
|
23
|
+
app.mount(context.container);
|
|
23
24
|
},
|
|
24
25
|
async unmount() {
|
|
25
26
|
app == null ? void 0 : app.unmount();
|
package/dist/vue.server.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _web_widget_schema from '@web-widget/schema';
|
|
2
|
-
import { App } from 'vue';
|
|
2
|
+
import { App, Component } from 'vue';
|
|
3
|
+
import { RenderContext, ComponentProps } from '@web-widget/schema/server-helpers';
|
|
3
4
|
export * from '@web-widget/schema/server-helpers';
|
|
4
5
|
|
|
5
6
|
interface DefineVueRenderOptions {
|
|
6
|
-
onCreatedApp?: (app: App) => void;
|
|
7
|
+
onCreatedApp?: (app: App, context: RenderContext, component: Component, props: ComponentProps) => void;
|
|
7
8
|
}
|
|
8
9
|
declare const defineVueRender: ({ onCreatedApp, }?: DefineVueRenderOptions) => (context: _web_widget_schema.ServerWidgetRenderContext<unknown> | _web_widget_schema.ServerRouteRenderContext<unknown, Record<string, string>>) => Promise<string | ReadableStream<any>>;
|
|
9
10
|
declare const render: (context: _web_widget_schema.ServerWidgetRenderContext<unknown> | _web_widget_schema.ServerRouteRenderContext<unknown, Record<string, string>>) => Promise<string | ReadableStream<any>>;
|
package/dist/vue.server.js
CHANGED
|
@@ -8,8 +8,9 @@ var defineVueRender = ({
|
|
|
8
8
|
}
|
|
9
9
|
} = {}) => {
|
|
10
10
|
return defineRender(async (context, component, props) => {
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const rootProps = props;
|
|
12
|
+
const app = createSSRApp(component, rootProps);
|
|
13
|
+
onCreatedApp(app, context, component, props);
|
|
13
14
|
return renderToWebStream(app);
|
|
14
15
|
});
|
|
15
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-widget/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@web-widget/schema": "0.0.
|
|
25
|
+
"@web-widget/schema": "0.0.7"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"vue": "^3.3.4"
|