@primate/svelte 0.19.0 → 0.20.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.
package/lib/private/Runtime.js
CHANGED
|
@@ -5,8 +5,8 @@ export default class Runtime extends FrontendModule {
|
|
|
5
5
|
defaultExtensions = [".svelte"];
|
|
6
6
|
layouts = true;
|
|
7
7
|
client = true;
|
|
8
|
-
render = (
|
|
9
|
-
const { head, html } = render(
|
|
8
|
+
render = (view, props) => {
|
|
9
|
+
const { head, html } = render(view, { props: { p: { ...props } } });
|
|
10
10
|
return { body: html, head };
|
|
11
11
|
};
|
|
12
12
|
}
|
|
@@ -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
|
-
|
|
4
|
+
views: string[];
|
|
5
5
|
props: Dict[];
|
|
6
6
|
}>;
|
|
7
7
|
export default class SvelteClient {
|
|
8
|
-
static mount(
|
|
8
|
+
static mount(_view: string, data: ClientData<Data>): void;
|
|
9
9
|
}
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import spa from "@primate/core/client/spa";
|
|
2
2
|
import { hydrate, mount } from "svelte";
|
|
3
|
-
// @ts-expect-error esbuild vfs
|
|
4
|
-
import * as components from "svelte:components";
|
|
5
|
-
// @ts-expect-error esbuild vfs
|
|
6
3
|
import root from "svelte:root";
|
|
4
|
+
import * as views from "svelte:views";
|
|
7
5
|
const make_props = (data) => ({
|
|
8
|
-
|
|
6
|
+
views: data.views.map(name => views[name]),
|
|
9
7
|
props: data.props,
|
|
10
8
|
request: {
|
|
11
9
|
...data.request,
|
|
@@ -14,7 +12,7 @@ const make_props = (data) => ({
|
|
|
14
12
|
update: () => undefined,
|
|
15
13
|
});
|
|
16
14
|
export default class SvelteClient {
|
|
17
|
-
static mount(
|
|
15
|
+
static mount(_view, data) {
|
|
18
16
|
const _root = (data.ssr ? hydrate : mount)(root, {
|
|
19
17
|
props: {
|
|
20
18
|
p: make_props(data),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default (depth, i18n_active) => {
|
|
2
|
-
const n = depth
|
|
2
|
+
const n = depth;
|
|
3
3
|
const body = Array.from({ length: n }, (_, i) => i - 1)
|
|
4
4
|
.reduceRight((child, _, i) => `
|
|
5
|
-
{#if p.
|
|
6
|
-
<svelte:component this={p.
|
|
5
|
+
{#if p.views[${i + 1}]}
|
|
6
|
+
<svelte:component this={p.views[${i}]} request={p.request} {...p.props[${i}]}>
|
|
7
7
|
${child}
|
|
8
8
|
</svelte:component>
|
|
9
9
|
{:else}
|
|
10
|
-
<svelte:component this={p.
|
|
10
|
+
<svelte:component this={p.views[${i}]} request={p.request} {...p.props[${i}]}/>
|
|
11
11
|
{/if}
|
|
12
|
-
`, `<svelte:component this={p.
|
|
12
|
+
`, `<svelte:component this={p.views[${n}]} request={p.request} {...p.props[${n}]}/>`);
|
|
13
13
|
const i18nImports = i18n_active
|
|
14
14
|
? `
|
|
15
15
|
import t from "#i18n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Primate Svelte frontend",
|
|
5
5
|
"homepage": "https://primate.run/docs/frontend/svelte",
|
|
6
6
|
"bugs": "https://github.com/primate-run/primate/issues",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@rcompat/fs": "^0.21.1",
|
|
20
|
-
"@primate/core": "^0.
|
|
20
|
+
"@primate/core": "^0.3.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"svelte": "5",
|
|
24
|
-
"primate": "^0.
|
|
24
|
+
"primate": "^0.34.0"
|
|
25
25
|
},
|
|
26
26
|
"type": "module",
|
|
27
27
|
"imports": {
|