@orunelle/theme-runtime 0.0.0-stage → 2.0.0-alpha.14
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/application.d.ts +7 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +58 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +429 -0
- package/dist/commerce.d.ts +235 -0
- package/dist/commerce.d.ts.map +1 -0
- package/dist/commerce.js +316 -0
- package/dist/credentials.d.ts +11 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +79 -0
- package/dist/fixtures.d.ts +23 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +131 -0
- package/dist/host/package.json +1 -0
- package/dist/host/preview/editor.css +116 -0
- package/dist/host/preview/editor.tsx +193 -0
- package/dist/host/preview/src/bridge.tsx +371 -0
- package/dist/host/preview/src/client.tsx +15 -0
- package/dist/host/preview/src/env.d.ts +5 -0
- package/dist/host/preview/src/preview.css +40 -0
- package/dist/host/preview/src/server.tsx +95 -0
- package/dist/host/preview/src/surface.tsx +264 -0
- package/dist/host/serve-node.mjs +133 -0
- package/dist/host/storefront/public/fonts/9da48a48bf6500f8-s.p.woff2 +0 -0
- package/dist/host/storefront/public/fonts/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/dist/host/storefront/public/fonts/e4efb0298547fad0-s.p.woff2 +0 -0
- package/dist/host/storefront/public/fonts/f022b1629605b85c-s.p.woff2 +0 -0
- package/dist/host/storefront/public/fonts/fb66eb17bf011c3b-s.p.woff2 +0 -0
- package/dist/host/storefront/public/fonts.css +7 -0
- package/dist/host/storefront/public/samples/pouch-navy.svg +4 -0
- package/dist/host/storefront/public/samples/throw-oat.svg +2 -0
- package/dist/host/storefront/public/samples/throw-sage.svg +2 -0
- package/dist/host/storefront/public/samples/tote-charcoal.svg +5 -0
- package/dist/host/storefront/public/samples/tote-detail.svg +1 -0
- package/dist/host/storefront/public/samples/tote-sand.svg +5 -0
- package/dist/host/storefront/src/binding.server.ts +1 -0
- package/dist/host/storefront/src/data.ts +2 -0
- package/dist/host/storefront/src/env.d.ts +5 -0
- package/dist/host/storefront/src/queries.ts +1 -0
- package/dist/host/storefront/src/routeTree.gen.ts +155 -0
- package/dist/host/storefront/src/router.tsx +31 -0
- package/dist/host/storefront/src/routes/$locale.$.tsx +135 -0
- package/dist/host/storefront/src/routes/$locale.index.tsx +19 -0
- package/dist/host/storefront/src/routes/$locale.products.$handle.tsx +57 -0
- package/dist/host/storefront/src/routes/$locale.tsx +36 -0
- package/dist/host/storefront/src/routes/__root.tsx +103 -0
- package/dist/host/storefront/src/routes/index.tsx +6 -0
- package/dist/host/storefront/src/server.ts +1 -0
- package/dist/host.d.ts +45 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +380 -0
- package/dist/local-editor.d.ts +2 -0
- package/dist/local-editor.d.ts.map +1 -0
- package/dist/local-editor.js +111 -0
- package/dist/managed-worker.d.ts +2 -0
- package/dist/managed-worker.d.ts.map +1 -0
- package/dist/managed-worker.js +22 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +98 -0
- package/dist/source.d.ts +19 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +131 -0
- package/dist/tanstack/binding.server.d.ts +4 -0
- package/dist/tanstack/binding.server.d.ts.map +1 -0
- package/dist/tanstack/binding.server.js +9 -0
- package/dist/tanstack/data.d.ts +44 -0
- package/dist/tanstack/data.d.ts.map +1 -0
- package/dist/tanstack/data.js +320 -0
- package/dist/tanstack/index.d.ts +4 -0
- package/dist/tanstack/index.d.ts.map +1 -0
- package/dist/tanstack/index.js +2 -0
- package/dist/tanstack/queries.d.ts +6 -0
- package/dist/tanstack/queries.d.ts.map +1 -0
- package/dist/tanstack/queries.js +5 -0
- package/dist/template/app/client.tsx +3 -0
- package/dist/template/app/env.d.ts +1 -0
- package/dist/template/app/router.tsx +40 -0
- package/dist/template/app/routes/$locale.$.tsx +135 -0
- package/dist/template/app/routes/$locale.index.tsx +19 -0
- package/dist/template/app/routes/$locale.products.$handle.tsx +57 -0
- package/dist/template/app/routes/$locale.tsx +46 -0
- package/dist/template/app/routes/__root.tsx +103 -0
- package/dist/template/app/routes/index.tsx +6 -0
- package/dist/template/app/server.ts +1 -0
- package/dist/template/app/start.ts +2 -0
- package/dist/template/app/theme.ts +12 -0
- package/dist/template/tests/router-isolation.test.ts +14 -0
- package/dist/template/vite.config.ts +5 -0
- package/dist/template/vitest.config.ts +9 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +22 -0
- package/package.json +88 -3
- package/README.md +0 -3
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { createFileRoute, notFound, redirect } from "@tanstack/react-router";
|
|
2
|
+
import { useThemeComponents } from "@orunelle/theme-sdk";
|
|
3
|
+
import {
|
|
4
|
+
DefaultCheckoutPage,
|
|
5
|
+
DefaultPaymentCallback,
|
|
6
|
+
} from "@orunelle/theme-engine";
|
|
7
|
+
import { pageQuery } from "@orunelle/theme-runtime/tanstack";
|
|
8
|
+
import type { PublicInput } from "@orunelle/theme-runtime/tanstack";
|
|
9
|
+
|
|
10
|
+
function match(
|
|
11
|
+
path: string,
|
|
12
|
+
): { kind: "private"; path: string } | Pick<PublicInput, "kind" | "slug"> {
|
|
13
|
+
if (
|
|
14
|
+
[
|
|
15
|
+
"cart",
|
|
16
|
+
"checkout",
|
|
17
|
+
"checkout/paymob-callback",
|
|
18
|
+
"checkout/xpay-callback",
|
|
19
|
+
"login",
|
|
20
|
+
"register",
|
|
21
|
+
"forgot-password",
|
|
22
|
+
"reset-password",
|
|
23
|
+
"verify-email",
|
|
24
|
+
"account",
|
|
25
|
+
"account/addresses",
|
|
26
|
+
"account/orders",
|
|
27
|
+
"account/wishlist",
|
|
28
|
+
"tracking",
|
|
29
|
+
].includes(path) ||
|
|
30
|
+
/^account\/orders\/[^/]+$/.test(path)
|
|
31
|
+
)
|
|
32
|
+
return { kind: "private", path };
|
|
33
|
+
if (path === "products") return { kind: "catalog" };
|
|
34
|
+
if (path === "search") return { kind: "search" };
|
|
35
|
+
if (path === "collections") return { kind: "collections" };
|
|
36
|
+
if (path === "categories") return { kind: "categories" };
|
|
37
|
+
const item = /^(categories|collections|pages)\/([^/]+)$/.exec(path);
|
|
38
|
+
if (item)
|
|
39
|
+
return {
|
|
40
|
+
kind:
|
|
41
|
+
item[1] === "categories"
|
|
42
|
+
? "category"
|
|
43
|
+
: item[1] === "collections"
|
|
44
|
+
? "collection"
|
|
45
|
+
: "content",
|
|
46
|
+
slug: item[2],
|
|
47
|
+
};
|
|
48
|
+
throw notFound();
|
|
49
|
+
}
|
|
50
|
+
export const Route = createFileRoute("/$locale/$")({
|
|
51
|
+
validateSearch: (input: Record<string, unknown>) => {
|
|
52
|
+
const page = input.page === undefined ? 1 : Number(input.page);
|
|
53
|
+
if (
|
|
54
|
+
!Number.isSafeInteger(page) ||
|
|
55
|
+
page < 1 ||
|
|
56
|
+
page > 10000 ||
|
|
57
|
+
(input.q !== undefined &&
|
|
58
|
+
(typeof input.q !== "string" || input.q.length > 200))
|
|
59
|
+
)
|
|
60
|
+
throw notFound();
|
|
61
|
+
return {
|
|
62
|
+
...(input.page !== undefined ? { page } : {}),
|
|
63
|
+
...(typeof input.q === "string" ? { q: input.q } : {}),
|
|
64
|
+
...(typeof input.token === "string" && input.token.length <= 200
|
|
65
|
+
? { token: input.token }
|
|
66
|
+
: {}),
|
|
67
|
+
...(typeof input.order === "string" && input.order.length <= 80
|
|
68
|
+
? { order: input.order }
|
|
69
|
+
: {}),
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
loaderDeps: ({ search }) => ({
|
|
73
|
+
...search,
|
|
74
|
+
page: search.page ?? 1,
|
|
75
|
+
q: search.q ?? "",
|
|
76
|
+
}),
|
|
77
|
+
loader: ({ params, context, deps, location }) => {
|
|
78
|
+
const path = params._splat ?? "";
|
|
79
|
+
const aliases: Record<string, string> = {
|
|
80
|
+
"account/profile": "account",
|
|
81
|
+
"track-order": "tracking",
|
|
82
|
+
"checkout/success": "account/orders",
|
|
83
|
+
"auth/login": "login",
|
|
84
|
+
"auth/register": "register",
|
|
85
|
+
"auth/verify": "verify-email",
|
|
86
|
+
"auth/forgot-password": "forgot-password",
|
|
87
|
+
"auth/reset-password": "reset-password",
|
|
88
|
+
"legal/privacy": "pages/privacy",
|
|
89
|
+
"legal/terms": "pages/terms",
|
|
90
|
+
drops: "collections",
|
|
91
|
+
};
|
|
92
|
+
const target =
|
|
93
|
+
aliases[path] ??
|
|
94
|
+
(path.startsWith("drops/")
|
|
95
|
+
? path.replace(/^drops\//, "collections/")
|
|
96
|
+
: path.startsWith("category/")
|
|
97
|
+
? path.replace(/^category\//, "categories/")
|
|
98
|
+
: undefined);
|
|
99
|
+
if (target)
|
|
100
|
+
throw redirect({
|
|
101
|
+
href: `/${params.locale}/${target}${location.searchStr}`,
|
|
102
|
+
statusCode: 301,
|
|
103
|
+
});
|
|
104
|
+
const route = match(params._splat ?? "");
|
|
105
|
+
if (route.kind === "private") return route;
|
|
106
|
+
return context.queryClient.ensureQueryData(
|
|
107
|
+
pageQuery(context.storefront, {
|
|
108
|
+
...route,
|
|
109
|
+
locale: context.storefront.locale,
|
|
110
|
+
page: deps.page,
|
|
111
|
+
q: deps.q,
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
head: ({ loaderData }) =>
|
|
116
|
+
loaderData && "title" in loaderData
|
|
117
|
+
? { meta: [{ title: loaderData.title }] }
|
|
118
|
+
: {},
|
|
119
|
+
component: Page,
|
|
120
|
+
});
|
|
121
|
+
function Page() {
|
|
122
|
+
const data = Route.useLoaderData();
|
|
123
|
+
const { CatalogPage, CollectionsPage, ContentPage, AccountPage, CartPage } =
|
|
124
|
+
useThemeComponents();
|
|
125
|
+
if (data.kind === "private") {
|
|
126
|
+
if (data.path === "cart") return <CartPage />;
|
|
127
|
+
if (data.path === "checkout") return <DefaultCheckoutPage />;
|
|
128
|
+
if (data.path.startsWith("checkout/")) return <DefaultPaymentCallback />;
|
|
129
|
+
return <AccountPage path={data.path} />;
|
|
130
|
+
}
|
|
131
|
+
if (data.kind === "catalog") return <CatalogPage data={data} />;
|
|
132
|
+
if (data.kind === "collections") return <CollectionsPage data={data} />;
|
|
133
|
+
if (data.kind === "content") return <ContentPage data={data} />;
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useThemeComponents } from "@orunelle/theme-sdk";
|
|
3
|
+
import { pageQuery } from "@orunelle/theme-runtime/tanstack";
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute("/$locale/")({
|
|
6
|
+
loader: ({ context }) =>
|
|
7
|
+
context.queryClient.ensureQueryData(
|
|
8
|
+
pageQuery(context.storefront, {
|
|
9
|
+
kind: "home",
|
|
10
|
+
locale: context.storefront.locale,
|
|
11
|
+
}),
|
|
12
|
+
),
|
|
13
|
+
component: Catalog,
|
|
14
|
+
});
|
|
15
|
+
function Catalog() {
|
|
16
|
+
const { HomePage } = useThemeComponents();
|
|
17
|
+
const data = Route.useLoaderData();
|
|
18
|
+
return data.kind === "catalog" ? <HomePage products={data.products} resources={data.resources} /> : null;
|
|
19
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import {
|
|
3
|
+
useThemeComponents,
|
|
4
|
+
useStorefront,
|
|
5
|
+
ThemePageData,
|
|
6
|
+
ThemeComposition,
|
|
7
|
+
} from "@orunelle/theme-sdk";
|
|
8
|
+
import { pageQuery } from "@orunelle/theme-runtime/tanstack";
|
|
9
|
+
|
|
10
|
+
export const Route = createFileRoute("/$locale/products/$handle")({
|
|
11
|
+
loader: ({ params, context }) =>
|
|
12
|
+
context.queryClient.ensureQueryData(
|
|
13
|
+
pageQuery(context.storefront, {
|
|
14
|
+
kind: "product",
|
|
15
|
+
locale: context.storefront.locale,
|
|
16
|
+
slug: params.handle,
|
|
17
|
+
}),
|
|
18
|
+
),
|
|
19
|
+
head: ({ loaderData, params }) =>
|
|
20
|
+
loaderData
|
|
21
|
+
? {
|
|
22
|
+
meta: [{ title: loaderData.title }],
|
|
23
|
+
}
|
|
24
|
+
: {},
|
|
25
|
+
component: Product,
|
|
26
|
+
});
|
|
27
|
+
function Product() {
|
|
28
|
+
const { configuration } = useStorefront();
|
|
29
|
+
const { ProductPage } = useThemeComponents();
|
|
30
|
+
const data = Route.useLoaderData();
|
|
31
|
+
return data.kind === "product" ? (
|
|
32
|
+
<ThemePageData
|
|
33
|
+
products={[data.product]}
|
|
34
|
+
variants={data.variants}
|
|
35
|
+
related={data.related}
|
|
36
|
+
optionVisuals={data.optionVisuals}
|
|
37
|
+
>
|
|
38
|
+
<ThemeComposition
|
|
39
|
+
scope="template"
|
|
40
|
+
name={
|
|
41
|
+
configuration?.assignments.find(
|
|
42
|
+
(assignment) => assignment.resource.id === data.product.id,
|
|
43
|
+
)?.template ?? "product.default"
|
|
44
|
+
}
|
|
45
|
+
productId={data.product.id}
|
|
46
|
+
fallback={
|
|
47
|
+
<ProductPage
|
|
48
|
+
product={data.product}
|
|
49
|
+
variants={data.variants}
|
|
50
|
+
related={data.related ?? []}
|
|
51
|
+
optionVisuals={data.optionVisuals ?? {}}
|
|
52
|
+
/>
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
</ThemePageData>
|
|
56
|
+
) : null;
|
|
57
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createFileRoute, notFound, Outlet } from "@tanstack/react-router";
|
|
2
|
+
import {
|
|
3
|
+
StorefrontProvider,
|
|
4
|
+
type StorefrontContext,
|
|
5
|
+
} from "@orunelle/theme-sdk";
|
|
6
|
+
import { resolveTheme } from "@orunelle/theme-engine";
|
|
7
|
+
import definition from "../theme";
|
|
8
|
+
|
|
9
|
+
const theme = resolveTheme(definition);
|
|
10
|
+
export const Route = createFileRoute("/$locale")({
|
|
11
|
+
beforeLoad: ({ params, context }) => {
|
|
12
|
+
if (params.locale !== "en" && params.locale !== "ar") throw notFound();
|
|
13
|
+
const storefront: StorefrontContext = {
|
|
14
|
+
...context.storefront,
|
|
15
|
+
locale: params.locale,
|
|
16
|
+
...(context.storefront.commerce === "fixture" &&
|
|
17
|
+
!context.storefront.configuration &&
|
|
18
|
+
theme.defaults
|
|
19
|
+
? {
|
|
20
|
+
configuration: {
|
|
21
|
+
...theme.defaults,
|
|
22
|
+
installationId: "00000000-0000-4000-8000-000000000001",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
: {}),
|
|
26
|
+
};
|
|
27
|
+
return { storefront };
|
|
28
|
+
},
|
|
29
|
+
component: LocalizedStorefront,
|
|
30
|
+
});
|
|
31
|
+
function LocalizedStorefront() {
|
|
32
|
+
const { storefront } = Route.useRouteContext();
|
|
33
|
+
const { Layout } = theme.components;
|
|
34
|
+
return (
|
|
35
|
+
<StorefrontProvider
|
|
36
|
+
theme={theme}
|
|
37
|
+
storefront={storefront}
|
|
38
|
+
configuration={storefront.configuration}
|
|
39
|
+
media={storefront.media}
|
|
40
|
+
>
|
|
41
|
+
<Layout>
|
|
42
|
+
<Outlet />
|
|
43
|
+
</Layout>
|
|
44
|
+
</StorefrontProvider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRootRouteWithContext,
|
|
3
|
+
HeadContent,
|
|
4
|
+
Link,
|
|
5
|
+
Outlet,
|
|
6
|
+
Scripts,
|
|
7
|
+
useRouterState,
|
|
8
|
+
} from "@tanstack/react-router";
|
|
9
|
+
import { getStorefront } from "@orunelle/theme-runtime/tanstack";
|
|
10
|
+
import styles from "@orunelle/theme-engine/styles.css?url";
|
|
11
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
12
|
+
|
|
13
|
+
export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()(
|
|
14
|
+
{
|
|
15
|
+
beforeLoad: async () => ({ storefront: await getStorefront() }),
|
|
16
|
+
head: ({ matches }) => {
|
|
17
|
+
const storefront = matches[0]?.context.storefront;
|
|
18
|
+
const last = matches.at(-1);
|
|
19
|
+
const path = last?.pathname ?? "/";
|
|
20
|
+
const publicPage =
|
|
21
|
+
last?.status === "success" &&
|
|
22
|
+
/^\/(en|ar)(\/?$|\/(products|categories|collections|pages)(\/[^/]+)?\/?$)/.test(
|
|
23
|
+
path,
|
|
24
|
+
);
|
|
25
|
+
return {
|
|
26
|
+
meta: [
|
|
27
|
+
{ charSet: "utf-8" },
|
|
28
|
+
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
|
29
|
+
{ title: "Orunelle reference store" },
|
|
30
|
+
{
|
|
31
|
+
name: "robots",
|
|
32
|
+
content:
|
|
33
|
+
storefront?.indexable && publicPage
|
|
34
|
+
? "index, follow"
|
|
35
|
+
: "noindex, nofollow",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
links: [
|
|
39
|
+
...(storefront?.indexable && publicPage
|
|
40
|
+
? [
|
|
41
|
+
{ rel: "canonical", href: storefront.origin + path },
|
|
42
|
+
...(["en", "ar"] as const).map((locale) => ({
|
|
43
|
+
rel: "alternate",
|
|
44
|
+
hrefLang: locale,
|
|
45
|
+
href:
|
|
46
|
+
storefront.origin +
|
|
47
|
+
path.replace(/^\/(en|ar)/, "/" + locale),
|
|
48
|
+
})),
|
|
49
|
+
]
|
|
50
|
+
: []),
|
|
51
|
+
{ rel: "stylesheet", href: styles },
|
|
52
|
+
{ rel: "stylesheet", href: "/fonts.css" },
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
component: Document,
|
|
57
|
+
notFoundComponent: NotFound,
|
|
58
|
+
errorComponent: () => (
|
|
59
|
+
<section className="error-page">
|
|
60
|
+
<h1>Store unavailable / المتجر غير متاح</h1>
|
|
61
|
+
<p>
|
|
62
|
+
Please refresh to try again. / أعد تحميل الصفحة للمحاولة مرة أخرى.
|
|
63
|
+
</p>
|
|
64
|
+
</section>
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
function Document() {
|
|
69
|
+
const locale = useRouterState({
|
|
70
|
+
select: (state) =>
|
|
71
|
+
state.location.pathname.split("/")[1] === "ar" ? "ar" : "en",
|
|
72
|
+
});
|
|
73
|
+
return (
|
|
74
|
+
<html lang={locale} dir={locale === "ar" ? "rtl" : "ltr"}>
|
|
75
|
+
<head>
|
|
76
|
+
<HeadContent />
|
|
77
|
+
</head>
|
|
78
|
+
<body>
|
|
79
|
+
<Outlet />
|
|
80
|
+
<Scripts />
|
|
81
|
+
</body>
|
|
82
|
+
</html>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function NotFound() {
|
|
86
|
+
const locale = useRouterState({
|
|
87
|
+
select: (state) =>
|
|
88
|
+
state.location.pathname.split("/")[1] === "ar" ? "ar" : "en",
|
|
89
|
+
});
|
|
90
|
+
return (
|
|
91
|
+
<section className="storefront-shell error-page">
|
|
92
|
+
<h1>{locale === "ar" ? "الصفحة غير موجودة" : "Page not found"}</h1>
|
|
93
|
+
<p>
|
|
94
|
+
{locale === "ar"
|
|
95
|
+
? "قد تكون الصفحة نُقلت أو لم تعد متاحة."
|
|
96
|
+
: "This page may have moved or is no longer available."}
|
|
97
|
+
</p>
|
|
98
|
+
<Link to="/$locale" params={{ locale }}>
|
|
99
|
+
{locale === "ar" ? "العودة إلى المنتجات" : "Back to products"}
|
|
100
|
+
</Link>
|
|
101
|
+
</section>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@tanstack/react-start/server-entry";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineTheme } from "@orunelle/theme-sdk";
|
|
2
|
+
import type {
|
|
3
|
+
MerchantManifest,
|
|
4
|
+
ConfigurationTemplate,
|
|
5
|
+
} from "@orunelle/theme-contract";
|
|
6
|
+
import manifest from "../orunelle.theme.json";
|
|
7
|
+
import defaults from "../defaults.json";
|
|
8
|
+
// Edit your route components and override shared presentations here.
|
|
9
|
+
export default defineTheme({
|
|
10
|
+
manifest: manifest as MerchantManifest,
|
|
11
|
+
defaults: defaults as unknown as ConfigurationTemplate,
|
|
12
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, it } from "vitest";
|
|
2
|
+
import { getRouter } from "../app/router";
|
|
3
|
+
|
|
4
|
+
it("isolates query data between server-rendered requests", () => {
|
|
5
|
+
const first = getRouter();
|
|
6
|
+
const second = getRouter();
|
|
7
|
+
first.options.context.queryClient.setQueryData(["private", "customer"], {
|
|
8
|
+
id: "first-request",
|
|
9
|
+
});
|
|
10
|
+
expect(first).not.toBe(second);
|
|
11
|
+
expect(
|
|
12
|
+
second.options.context.queryClient.getQueryData(["private", "customer"]),
|
|
13
|
+
).toBeUndefined();
|
|
14
|
+
});
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
export { orunelleReact } from "./application.js";
|
|
3
|
+
/** Explicit author entry: no filesystem scan or theme-ID branches in the host. */
|
|
4
|
+
export declare function orunelleTheme(options: {
|
|
5
|
+
entry: string;
|
|
6
|
+
}): Plugin;
|
|
7
|
+
//# sourceMappingURL=vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAehE"}
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { access } from "node:fs/promises";
|
|
3
|
+
export { orunelleReact } from "./application.js";
|
|
4
|
+
const moduleId = "virtual:orunelle/theme";
|
|
5
|
+
/** Explicit author entry: no filesystem scan or theme-ID branches in the host. */
|
|
6
|
+
export function orunelleTheme(options) {
|
|
7
|
+
const entry = resolve(options.entry);
|
|
8
|
+
return {
|
|
9
|
+
name: "orunelle-theme-v2",
|
|
10
|
+
async buildStart() {
|
|
11
|
+
await access(entry);
|
|
12
|
+
},
|
|
13
|
+
resolveId(id) {
|
|
14
|
+
if (id === moduleId)
|
|
15
|
+
return `\0${moduleId}`;
|
|
16
|
+
},
|
|
17
|
+
load(id) {
|
|
18
|
+
if (id === `\0${moduleId}`)
|
|
19
|
+
return `export { default } from ${JSON.stringify(entry)};`;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,91 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orunelle/theme-runtime",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
|
+
"description": "Orunelle theme runtime: Vite/TanStack integration, local preview host and the orunelle-theme CLI",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"homepage": "https://orunelle.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Orunelle/frontend.git",
|
|
10
|
+
"directory": "packages/theme-runtime"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"tag": "alpha"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=22.12.0"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
"./vite": {
|
|
25
|
+
"types": "./dist/vite.d.ts",
|
|
26
|
+
"import": "./dist/vite.js"
|
|
27
|
+
},
|
|
28
|
+
"./fixtures": {
|
|
29
|
+
"types": "./dist/fixtures.d.ts",
|
|
30
|
+
"import": "./dist/fixtures.js"
|
|
31
|
+
},
|
|
32
|
+
"./commerce": {
|
|
33
|
+
"types": "./dist/commerce.d.ts",
|
|
34
|
+
"import": "./dist/commerce.js"
|
|
35
|
+
},
|
|
36
|
+
"./source": {
|
|
37
|
+
"types": "./dist/source.d.ts",
|
|
38
|
+
"import": "./dist/source.js"
|
|
39
|
+
},
|
|
40
|
+
"./author": {
|
|
41
|
+
"types": "./dist/host.d.ts",
|
|
42
|
+
"import": "./dist/host.js"
|
|
43
|
+
},
|
|
44
|
+
"./tanstack": {
|
|
45
|
+
"types": "./dist/tanstack/index.d.ts",
|
|
46
|
+
"import": "./dist/tanstack/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./server": {
|
|
49
|
+
"types": "./dist/server.d.ts",
|
|
50
|
+
"import": "./dist/server.js"
|
|
51
|
+
},
|
|
52
|
+
"./bindings": {
|
|
53
|
+
"types": "./dist/tanstack/binding.server.d.ts",
|
|
54
|
+
"import": "./dist/tanstack/binding.server.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"zod": "3.25.76",
|
|
59
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
60
|
+
"@tanstack/react-query": "5.102.0",
|
|
61
|
+
"@tanstack/react-router": "1.170.46",
|
|
62
|
+
"@tanstack/react-router-ssr-query": "1.167.3",
|
|
63
|
+
"react": "19.3.1",
|
|
64
|
+
"react-dom": "19.3.1",
|
|
65
|
+
"@tanstack/router-generator": "1.167.46",
|
|
66
|
+
"sanitize-html": "2.18.2",
|
|
67
|
+
"@orunelle/theme-sdk": "2.0.0-alpha.14",
|
|
68
|
+
"@orunelle/theme-engine": "2.0.0-alpha.14",
|
|
69
|
+
"@orunelle/theme-contract": "2.0.0-alpha.14",
|
|
70
|
+
"@orunelle/theme-editor": "2.0.0-alpha.14"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"vite": "8.3.6",
|
|
74
|
+
"@tanstack/react-start": "1.169.4"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"vite": "8.3.6",
|
|
78
|
+
"@tanstack/react-start": "1.169.4",
|
|
79
|
+
"@types/node": "22.20.5",
|
|
80
|
+
"typescript": "5.9.3",
|
|
81
|
+
"@types/react": "19.3.0",
|
|
82
|
+
"@types/react-dom": "19.3.0"
|
|
83
|
+
},
|
|
84
|
+
"bin": {
|
|
85
|
+
"orunelle-theme": "./dist/cli.js"
|
|
86
|
+
},
|
|
87
|
+
"scripts": {
|
|
88
|
+
"build": "tsc && node tools/prepare-host.mjs",
|
|
89
|
+
"typecheck": "tsc --noEmit"
|
|
90
|
+
}
|
|
6
91
|
}
|
package/README.md
DELETED