@primate/vue 0.12.0 → 0.13.1

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.
@@ -6,8 +6,8 @@ export default class Runtime extends FrontendModule {
6
6
  defaultExtensions = [".vue"];
7
7
  layouts = true;
8
8
  client = true;
9
- render = async (component, props) => {
10
- const app = createSSRApp(component, { p: { ...props } });
9
+ render = async (view, props) => {
10
+ const app = createSSRApp(view, { p: { ...props } });
11
11
  const html = await renderToString(app);
12
12
  return { body: `<div id="app">${html}</div>` };
13
13
  };
@@ -1,11 +1,11 @@
1
1
  import type ClientData from "@primate/core/client/Data";
2
2
  import type Dict from "@rcompat/type/Dict";
3
3
  type Data = ClientData<{
4
- components: string[];
4
+ views: string[];
5
5
  props: Dict[];
6
6
  }>;
7
7
  export default class VueClient {
8
- static mount(_component: string, data: ClientData<Data>): void;
8
+ static mount(_view: string, data: ClientData<Data>): void;
9
9
  }
10
10
  export {};
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import spa from "@primate/core/client/spa";
2
2
  import { createSSRApp } from "vue";
3
- import * as components from "vue:components";
4
3
  import root from "vue:root";
4
+ import * as views from "vue:views";
5
5
  export default class VueClient {
6
- static mount(_component, data) {
7
- const resolve = (names) => names.map((n) => components[n]);
6
+ static mount(_view, data) {
7
+ const resolve = (names) => names.map((n) => views[n]);
8
8
  let app = createSSRApp(root, {
9
9
  p: {
10
- components: resolve(data.components),
10
+ views: resolve(data.views),
11
11
  props: data.props,
12
12
  request: data.request,
13
13
  update: undefined,
@@ -19,7 +19,7 @@ export default class VueClient {
19
19
  app.unmount();
20
20
  app = createSSRApp(root, {
21
21
  p: {
22
- components: resolve(next.components),
22
+ views: resolve(next.views),
23
23
  props: next.props,
24
24
  request: next.request,
25
25
  update,
@@ -1,18 +1,16 @@
1
1
  export default (depth, i18n_active) => {
2
- const n = depth - 1;
3
- // Build the nested component structure more carefully
4
- const buildComponent = (index) => {
5
- if (index === n) {
6
- // Base case: render the deepest component
7
- return `h(p.components[${index}], p.props[${index}] || {})`;
8
- }
2
+ const n = depth;
3
+ const build_view = (index) => {
4
+ // anchor case: render the deepest view
5
+ if (index === n)
6
+ return `h(p.views[${index}], p.props[${index}] || {})`;
9
7
  else {
10
- // Recursive case: render component with child
11
- const child = buildComponent(index + 1);
12
- return `h(p.components[${index}], p.props[${index}] || {}, () => [${child}])`;
8
+ // recursive case: render view with child
9
+ const child = build_view(index + 1);
10
+ return `h(p.views[${index}], p.props[${index}] || {}, () => [${child}])`;
13
11
  }
14
12
  };
15
- const body = depth > 0 ? buildComponent(0) : "h(\"div\")";
13
+ const body = depth > 0 ? build_view(0) : "h(\"div\")";
16
14
  const vueImports = `import {
17
15
  defineComponent, h${i18n_active ? ", ref, onMounted, onUnmounted" : ""}
18
16
  } from "vue";`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/vue",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Primate Vue frontend",
5
5
  "homepage": "https://primate.run/docs/frontend/vue",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -17,11 +17,11 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@rcompat/build": "^0.14.0",
20
- "@primate/core": "^0.2.0"
20
+ "@primate/core": "^0.3.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "vue": "3",
24
- "primate": "^0.33.0"
24
+ "primate": "^0.34.0"
25
25
  },
26
26
  "type": "module",
27
27
  "imports": {