@panomc/theme-core 1.0.0-dev.59 → 1.0.0-dev.61
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/assets/css/pano-fallback-legacy.css +12381 -0
- package/assets/css/pano-fallback.css +3222 -0
- package/bin/__tests__/check/fixtures/plugin-contracts/market/controllers.json +4 -0
- package/bin/__tests__/check/fixtures/plugin-contracts/market/views.json +67 -0
- package/bin/__tests__/check/fixtures/routes.json +5 -0
- package/bin/__tests__/check/helpers.js +55 -0
- package/bin/__tests__/check/overrides.test.js +287 -0
- package/bin/__tests__/check/theme.test.js +332 -0
- package/bin/__tests__/cli/accept-and-list.test.js +159 -0
- package/bin/__tests__/cli/config-edit.test.js +213 -0
- package/bin/__tests__/cli/contracts-pull.test.js +187 -0
- package/bin/__tests__/cli/core-meta.test.js +305 -0
- package/bin/__tests__/cli/eject-view.test.js +356 -0
- package/bin/__tests__/cli/helpers.js +258 -0
- package/bin/__tests__/scaffold/scaffold.test.js +84 -0
- package/bin/bundle-internal-libs.js +14 -2
- package/bin/check.js +1150 -213
- package/bin/contracts.js +1643 -0
- package/bin/generate-contract.js +378 -0
- package/bin/generate-licenses.js +14 -2
- package/bin/generate-runtime-shims.js +27 -9
- package/bin/new.js +101 -2
- package/bin/package-zip.js +16 -2
- package/bin/sync.js +360 -7
- package/bin/theme-core.js +65 -107
- package/lang/en-US.json +1 -0
- package/lang/ru.json +1 -0
- package/lang/tr.json +1 -0
- package/package.json +7 -3
- package/skin-contract.json +864 -19
- package/src/kit/__tests__/hooks-server-fetch.test.js +56 -0
- package/src/kit/__tests__/route-map.test.js +154 -0
- package/src/kit/__tests__/theme-meta.test.js +249 -0
- package/src/kit/hooks-client.js +3 -0
- package/src/kit/hooks-server.js +91 -7
- package/src/kit/route-map.js +300 -0
- package/src/kit/specifiers.js +3 -0
- package/src/kit/svelte-config.js +3 -0
- package/src/kit/theme-meta.js +405 -0
- package/src/kit/vite-config.js +156 -12
- package/src/lib/NotificationManager.js +18 -0
- package/src/lib/PluginAPI.js +313 -9
- package/src/lib/Store.js +18 -5
- package/src/lib/__tests__/avatarVersion.test.js +25 -0
- package/src/lib/__tests__/check.test.js +201 -0
- package/src/lib/__tests__/controllerHost.test.js +363 -0
- package/src/lib/__tests__/cx03.test.js +245 -0
- package/src/lib/__tests__/engineBoot.test.js +151 -0
- package/src/lib/__tests__/engineParts.helper.js +284 -0
- package/src/lib/__tests__/engineParts.test.js +179 -0
- package/src/lib/__tests__/engineSidebars.helper.js +353 -0
- package/src/lib/__tests__/engineSidebars.test.js +273 -0
- package/src/lib/__tests__/engineStyles.test.js +227 -0
- package/src/lib/__tests__/engineWiring.test.js +1000 -0
- package/src/lib/__tests__/fallbackStyles.test.js +1254 -0
- package/src/lib/__tests__/fixtures/Probe.svelte +5 -0
- package/src/lib/__tests__/fixtures/engine-parts.ssr.json +29 -0
- package/src/lib/__tests__/fixtures/engine-sidebars.ssr.json +16 -0
- package/src/lib/__tests__/home.test.js +563 -0
- package/src/lib/__tests__/injectedScope.test.js +490 -0
- package/src/lib/__tests__/languageConcurrency.test.js +55 -0
- package/src/lib/__tests__/languageLayers.test.js +286 -0
- package/src/lib/__tests__/pageHead.test.js +167 -0
- package/src/lib/__tests__/pageMeta.util.test.js +216 -0
- package/src/lib/__tests__/pageTitle.util.test.js +96 -0
- package/src/lib/__tests__/pluginApiViews.test.js +529 -0
- package/src/lib/__tests__/plugins.test.js +53 -0
- package/src/lib/__tests__/profileNav.util.test.js +145 -0
- package/src/lib/__tests__/registryReady.test.js +26 -0
- package/src/lib/__tests__/returnTo.util.test.js +294 -0
- package/src/lib/__tests__/routeConfig.test.js +361 -0
- package/src/lib/__tests__/sidebarSpec.util.test.js +152 -0
- package/src/lib/__tests__/skinContract.test.js +558 -0
- package/src/lib/__tests__/svelteSsr.helper.js +68 -0
- package/src/lib/__tests__/tc03.test.js +427 -0
- package/src/lib/__tests__/tc11.test.js +184 -0
- package/src/lib/__tests__/translationLayers.test.js +161 -0
- package/src/lib/avatarVersion.js +39 -0
- package/src/lib/components/Breadcrumb.svelte +9 -40
- package/src/lib/components/Date.svelte +1 -1
- package/src/lib/components/DefaultToast.svelte +13 -3
- package/src/lib/components/FallbackLinks.svelte +28 -0
- package/src/lib/components/FallbackScope.svelte +24 -0
- package/src/lib/components/Footer.svelte +8 -8
- package/src/lib/components/Header.svelte +3 -3
- package/src/lib/components/Hook.svelte +12 -1
- package/src/lib/components/LoginFormBody.svelte +5 -5
- package/src/lib/components/Main.svelte +22 -47
- package/src/lib/components/Navbar.svelte +30 -29
- package/src/lib/components/NoContent.svelte +2 -2
- package/src/lib/components/NotificationContainer.svelte +31 -82
- package/src/lib/components/OnlineAdmins.svelte +3 -2
- package/src/lib/components/PageActions.svelte +1 -1
- package/src/lib/components/PageHead.svelte +50 -0
- package/src/lib/components/PageTitle.svelte +2 -2
- package/src/lib/components/Pagination.svelte +6 -6
- package/src/lib/components/PlayerHead.svelte +4 -4
- package/src/lib/components/PluginBlock.svelte +132 -0
- package/src/lib/components/PluginSlot.svelte +40 -0
- package/src/lib/components/Post.svelte +13 -230
- package/src/lib/components/Posts.svelte +7 -14
- package/src/lib/components/RegisterForm.svelte +12 -11
- package/src/lib/components/Sidebar.svelte +9 -7
- package/src/lib/components/TicketRow.svelte +8 -48
- package/src/lib/components/TicketStatus.svelte +10 -16
- package/src/lib/components/Tickets.svelte +8 -30
- package/src/lib/components/Toast.svelte +16 -14
- package/src/lib/components/ToastContainer.svelte +16 -9
- package/src/lib/components/ViewComponent.svelte +13 -1
- package/src/lib/components/modals/CloseTicketConfirmModal.svelte +15 -46
- package/src/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte +17 -39
- package/src/lib/components/modals/LogoutSessionConfirmModal.svelte +12 -30
- package/src/lib/components/sidebars/HomeSidebar.svelte +33 -284
- package/src/lib/components/sidebars/PlayerDetailSidebar.svelte +14 -63
- package/src/lib/components/sidebars/PluginSidebar.svelte +21 -0
- package/src/lib/components/sidebars/ProfileNavCard.svelte +24 -0
- package/src/lib/components/sidebars/ProfileSidebar.svelte +44 -84
- package/src/lib/components/sidebars/SupportSidebar.svelte +19 -22
- package/src/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte +23 -35
- package/src/lib/components/sidebars/profileNav.util.js +105 -0
- package/src/lib/components/sidebars/sidebarSpec.util.js +92 -0
- package/src/lib/controllerHost.js +261 -0
- package/src/lib/fallbackStyles.js +317 -0
- package/src/lib/home.js +202 -0
- package/src/lib/language.util.js +70 -37
- package/src/lib/layouts/AppLayout.svelte +16 -8
- package/src/lib/layouts/AuthLayout.svelte +6 -4
- package/src/lib/layouts/MainLayout.svelte +17 -12
- package/src/lib/layouts/ProfileLayout.svelte +6 -4
- package/src/lib/layouts/ThemeSettingsLayout.svelte +6 -4
- package/src/lib/layouts/TicketsLayout.svelte +6 -5
- package/src/lib/pageMeta.util.js +212 -0
- package/src/lib/pageShape.js +33 -0
- package/src/lib/pageTitle.util.js +32 -0
- package/src/lib/pages/ActivateEmailPage.svelte +2 -7
- package/src/lib/pages/ConfirmNewEmailPage.svelte +2 -7
- package/src/lib/pages/ErrorPage.svelte +5 -2
- package/src/lib/pages/HomePage.svelte +31 -8
- package/src/lib/pages/LoginPage.svelte +38 -41
- package/src/lib/pages/NotificationsPage.svelte +2 -7
- package/src/lib/pages/PlayerDetailPage.svelte +2 -7
- package/src/lib/pages/PostDetailPage.svelte +2 -7
- package/src/lib/pages/PreviewPostPage.svelte +2 -7
- package/src/lib/pages/RegisterPage.svelte +10 -13
- package/src/lib/pages/RenewPasswordPage.svelte +2 -7
- package/src/lib/pages/ResetPasswordPage.svelte +2 -7
- package/src/lib/pages/RulesPage.svelte +3 -8
- package/src/lib/pages/SupportPage.svelte +2 -7
- package/src/lib/pages/ThemeSettingsPage.svelte +2 -7
- package/src/lib/pages/profile/ProfilePage.svelte +2 -7
- package/src/lib/pages/profile/SettingsPage.svelte +2 -7
- package/src/lib/pages/profile/TicketsPage.svelte +2 -7
- package/src/lib/pages/ticket/CreateTicketPage.svelte +2 -7
- package/src/lib/pages/ticket/TicketDetailPage.svelte +2 -7
- package/src/lib/plugins.js +61 -0
- package/src/lib/returnTo.util.js +116 -0
- package/src/lib/services/auth.js +11 -11
- package/src/lib/services/posts.js +21 -10
- package/src/lib/services/profile.js +5 -5
- package/src/lib/services/theme-setting.js +1 -1
- package/src/lib/services/tickets.js +36 -15
- package/src/lib/siteRealtime.js +55 -8
- package/src/lib/themePageLoad.js +38 -0
- package/src/lib/translationLayers.js +144 -0
- package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +160 -6
- package/src/lib/ui-logics/layout-logics/AuthLayoutLogics.js +3 -2
- package/src/lib/ui-logics/layout-logics/ProfileLayoutLogics.js +3 -2
- package/src/lib/ui-logics/layout-logics/TicketsLayoutLogics.js +3 -2
- package/src/lib/ui-logics/page-logics/ActiveEmailPageLogics.js +4 -4
- package/src/lib/ui-logics/page-logics/ConfirmNewEmailPageLogics.js +4 -4
- package/src/lib/ui-logics/page-logics/CreateTicketPageLogics.js +5 -5
- package/src/lib/ui-logics/page-logics/HomePageLogics.js +5 -3
- package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +40 -16
- package/src/lib/ui-logics/page-logics/PlayerDetailPageLogics.js +3 -3
- package/src/lib/ui-logics/page-logics/PostDetailPageLogics.js +3 -3
- package/src/lib/ui-logics/page-logics/PreviewPostPageLogics.js +1 -1
- package/src/lib/ui-logics/page-logics/RenewPasswordPageLogics.js +4 -4
- package/src/lib/ui-logics/page-logics/ResetPasswordPageLogics.js +6 -6
- package/src/lib/ui-logics/page-logics/SettingsPageLogics.js +8 -8
- package/src/lib/ui-logics/page-logics/TicketDetailPageLogics.js +3 -3
- package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +5 -3
- package/src/lib/views/ActivateEmailView.samples.js +22 -0
- package/src/lib/views/ActivateEmailView.svelte +4 -4
- package/src/lib/views/AppLayoutView.samples.js +17 -0
- package/src/lib/views/AppLayoutView.svelte +1 -1
- package/src/lib/views/AuthLayoutView.samples.js +4 -0
- package/src/lib/views/AuthLayoutView.svelte +1 -1
- package/src/lib/views/Breadcrumb.samples.js +15 -0
- package/src/lib/views/CloseTicketConfirmModal.samples.js +12 -0
- package/src/lib/views/ConfirmNewEmailView.samples.js +22 -0
- package/src/lib/views/ConfirmNewEmailView.svelte +4 -4
- package/src/lib/views/ConfirmRemoveAllNotificationsModal.samples.js +9 -0
- package/src/lib/views/CreateTicketView.samples.js +21 -0
- package/src/lib/views/CreateTicketView.svelte +5 -5
- package/src/lib/views/Date.samples.js +9 -0
- package/src/lib/views/DefaultToast.samples.js +7 -0
- package/src/lib/views/ErrorView.samples.js +8 -0
- package/src/lib/views/ErrorView.svelte +4 -2
- package/src/lib/views/Footer.samples.js +8 -0
- package/src/lib/views/Header.samples.js +8 -0
- package/src/lib/views/HomeSidebar.samples.js +59 -0
- package/src/lib/views/HomeView.samples.js +34 -0
- package/src/lib/views/HomeView.svelte +14 -6
- package/src/lib/views/LoginFormBody.samples.js +8 -0
- package/src/lib/views/LoginView.samples.js +50 -0
- package/src/lib/views/LoginView.svelte +24 -22
- package/src/lib/views/LogoutSessionConfirmModal.samples.js +8 -0
- package/src/lib/views/Main.samples.js +23 -0
- package/src/lib/views/MainLayoutView.svelte +3 -4
- package/src/lib/views/Navbar.samples.js +8 -0
- package/src/lib/views/NoContent.samples.js +7 -0
- package/src/lib/views/NotificationContainer.samples.js +25 -0
- package/src/lib/views/NotificationsView.samples.js +36 -0
- package/src/lib/views/NotificationsView.svelte +21 -12
- package/src/lib/views/PageActions.samples.js +7 -0
- package/src/lib/views/PageTitle.samples.js +8 -0
- package/src/lib/views/Pagination.samples.js +7 -0
- package/src/lib/views/PlayerDetailSidebar.samples.js +35 -0
- package/src/lib/views/PlayerDetailView.samples.js +8 -0
- package/src/lib/views/PlayerDetailView.svelte +3 -3
- package/src/lib/views/PlayerHead.samples.js +8 -0
- package/src/lib/views/Post.samples.js +10 -0
- package/src/lib/views/PostDetailView.samples.js +28 -0
- package/src/lib/views/PostDetailView.svelte +24 -16
- package/src/lib/views/Posts.samples.js +9 -0
- package/src/lib/views/PreviewPostView.samples.js +20 -0
- package/src/lib/views/PreviewPostView.svelte +10 -10
- package/src/lib/views/ProfileLayoutView.samples.js +4 -0
- package/src/lib/views/ProfileSidebar.samples.js +33 -0
- package/src/lib/views/ProfileView.samples.js +29 -0
- package/src/lib/views/ProfileView.svelte +2 -2
- package/src/lib/views/RegisterForm.samples.js +7 -0
- package/src/lib/views/RegisterView.samples.js +28 -0
- package/src/lib/views/RegisterView.svelte +5 -3
- package/src/lib/views/RenewPasswordView.samples.js +24 -0
- package/src/lib/views/RenewPasswordView.svelte +6 -6
- package/src/lib/views/ResetPasswordView.samples.js +24 -0
- package/src/lib/views/ResetPasswordView.svelte +3 -3
- package/src/lib/views/RulesView.samples.js +14 -0
- package/src/lib/views/RulesView.svelte +3 -3
- package/src/lib/views/SettingsView.svelte +48 -17
- package/src/lib/views/Sidebar.samples.js +7 -0
- package/src/lib/views/SupportSidebar.samples.js +24 -0
- package/src/lib/views/SupportView.samples.js +16 -0
- package/src/lib/views/SupportView.svelte +8 -6
- package/src/lib/views/ThemeSettingsLayoutView.samples.js +9 -0
- package/src/lib/views/ThemeSettingsLayoutView.svelte +1 -1
- package/src/lib/views/ThemeSettingsView.svelte +89 -89
- package/src/lib/views/TicketCreateAndDetailSidebar.samples.js +33 -0
- package/src/lib/views/TicketDetailView.samples.js +34 -0
- package/src/lib/views/TicketDetailView.svelte +17 -15
- package/src/lib/views/TicketRow.samples.js +10 -0
- package/src/lib/views/TicketStatus.samples.js +8 -0
- package/src/lib/views/Tickets.samples.js +9 -0
- package/src/lib/views/TicketsLayoutView.samples.js +4 -0
- package/src/lib/views/TicketsView.samples.js +23 -0
- package/src/lib/views/TicketsView.svelte +11 -9
- package/src/lib/views/Toast.samples.js +9 -0
- package/src/lib/views/ToastContainer.samples.js +8 -0
- package/src/lib/views/parts/Breadcrumb.svelte +53 -0
- package/src/lib/views/parts/CloseTicketConfirmModal.svelte +63 -0
- package/src/lib/views/parts/ConfirmRemoveAllNotificationsModal.svelte +55 -0
- package/src/lib/views/parts/DefaultToast.svelte +22 -0
- package/src/lib/views/parts/HomeSidebar.svelte +334 -0
- package/src/lib/views/parts/LogoutSessionConfirmModal.svelte +46 -0
- package/src/lib/views/parts/Main.svelte +71 -0
- package/src/lib/views/parts/NotificationContainer.svelte +109 -0
- package/src/lib/views/parts/PlayerDetailSidebar.svelte +81 -0
- package/src/lib/views/parts/Post.svelte +255 -0
- package/src/lib/views/parts/Posts.svelte +25 -0
- package/src/lib/views/parts/ProfileSidebar.svelte +115 -0
- package/src/lib/views/parts/Sidebar.svelte +19 -0
- package/src/lib/views/parts/SupportSidebar.svelte +34 -0
- package/src/lib/views/parts/TicketCreateAndDetailSidebar.svelte +51 -0
- package/src/lib/views/parts/TicketRow.svelte +63 -0
- package/src/lib/views/parts/TicketStatus.svelte +24 -0
- package/src/lib/views/parts/Tickets.svelte +45 -0
- package/src/lib/views/parts/Toast.svelte +27 -0
- package/src/lib/views/parts/ToastContainer.svelte +17 -0
- package/src/lib/views/parts/engine-views.generated.js +63 -0
- package/src/lib/views/parts/publicHref.js +18 -0
- package/src/lib/views/parts/ticketStatuses.js +7 -0
- package/src/plugin-engine/__tests__/engine.test.js +161 -0
- package/src/plugin-engine/engine.js +80 -12
- package/src/registry/__tests__/registry.test.js +510 -0
- package/src/registry/__tests__/view.test.js +52 -0
- package/src/registry/index.js +700 -51
- package/src/registry/routes.js +62 -0
- package/src/registry/view.js +69 -0
- package/src/routes/RootLayout.svelte +24 -1
- package/src/routes/catalogue/List.svelte +163 -0
- package/src/routes/catalogue/Stage.svelte +355 -0
- package/src/routes/catalogue/__tests__/browserSafe.test.js +13 -0
- package/src/routes/catalogue/__tests__/catalogue.test.js +539 -0
- package/src/routes/catalogue/catalogue.js +129 -0
- package/src/routes/catalogue/deps.js +147 -0
- package/src/routes/catalogue/engineSamples.js +63 -0
- package/src/routes/catalogue/fixtures.js +77 -0
- package/src/routes/catalogue/list.js +37 -0
- package/src/routes/catalogue/model.js +286 -0
- package/src/routes/catalogue/stage.js +69 -0
- package/src/routes/catalogue/views-json.js +24 -0
- package/src/routes/plugin-ui/Layout.svelte +29 -4
- package/src/routes/plugin-ui/Page.svelte +86 -31
- package/src/routes/plugin-ui/load.js +173 -0
- package/src/routes/plugins-client-file.js +8 -3
- package/src/routes/plugins-ui-file.js +60 -0
- package/src/routes/root-layout-load.js +59 -2
package/src/lib/home.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// The home page (doc 01 section 9, decisions 6 and 33).
|
|
2
|
+
//
|
|
3
|
+
// The admin picks the home page of the active theme; the choice reaches the theme as `siteInfo.homePage`
|
|
4
|
+
// (`"store"` = an option of the theme, `"custom:/rules"` = a path the admin typed, `null` = the theme's
|
|
5
|
+
// default). `resolveHome` turns the choice, the theme's `home` config and the registered plugin pages into
|
|
6
|
+
// what `/` renders:
|
|
7
|
+
//
|
|
8
|
+
// { kind: "posts" } the posts feed (today's page)
|
|
9
|
+
// { kind: "page", id } a page of the theme (`home.options.<id>.page`)
|
|
10
|
+
// { kind: "path", path } the plugin page registered at a concrete canonical path
|
|
11
|
+
//
|
|
12
|
+
// A choice that cannot be shown falls back to `home.default`, then to the posts feed, with one
|
|
13
|
+
// console.warn each. The posts feed is always served at `/posts` as well.
|
|
14
|
+
import { findMatch } from "@panomc/sdk/core/js/RouteMatcher.js";
|
|
15
|
+
|
|
16
|
+
import { getThemeConfig, getThemeMeta } from "../registry/index.js";
|
|
17
|
+
import { route } from "../registry/routes.js";
|
|
18
|
+
|
|
19
|
+
/** @typedef {{ kind: "posts" } | { kind: "page", id: string } | { kind: "path", path: string }} Home */
|
|
20
|
+
|
|
21
|
+
const POSTS_PATH = "/posts";
|
|
22
|
+
const CUSTOM_PREFIX = "custom:";
|
|
23
|
+
const PREFIX = "[theme-core] home page:";
|
|
24
|
+
|
|
25
|
+
/** @param {string} reason */
|
|
26
|
+
const problem = (reason) => ({ problem: reason });
|
|
27
|
+
/** @param {Home} home */
|
|
28
|
+
const found = (home) => ({ home });
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {any} themeConfig the default export of theme.config.js
|
|
32
|
+
* @param {string | null | undefined} homePage `siteInfo.homePage`
|
|
33
|
+
* @param {Record<string, any> | null | undefined} registeredPages the plugin pages by path; `null` / `undefined`
|
|
34
|
+
* = not known here: a path is then taken as it is, without looking for the page
|
|
35
|
+
* @param {{ homePages?: Record<string, unknown>, warn?: (message: string) => void }} [options]
|
|
36
|
+
* `homePages` = the page options the build found (a `page` option without a file is refused);
|
|
37
|
+
* `warn` = how a fallback is reported (default `console.warn`)
|
|
38
|
+
* @returns {Home}
|
|
39
|
+
*/
|
|
40
|
+
export function resolveHome(themeConfig, homePage, registeredPages, options = {}) {
|
|
41
|
+
const { homePages, warn = console.warn } = options;
|
|
42
|
+
const home = themeConfig?.home && typeof themeConfig.home === "object" ? themeConfig.home : null;
|
|
43
|
+
const configured = home !== null;
|
|
44
|
+
const themeOptions = configured && home.options && typeof home.options === "object" ? home.options : {};
|
|
45
|
+
|
|
46
|
+
/** @param {unknown} path */
|
|
47
|
+
function checkPath(path) {
|
|
48
|
+
if (typeof path !== "string" || !path.startsWith("/") || path.startsWith("//")) {
|
|
49
|
+
return problem(`"${path}" is not a path of this site`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const clean = path.split(/[?#]/)[0];
|
|
53
|
+
|
|
54
|
+
if (/\[[^\]]*\]/.test(clean)) {
|
|
55
|
+
return problem(`"${clean}" is a route pattern, give a concrete path (for example /store/vip)`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (clean === POSTS_PATH) {
|
|
59
|
+
return found({ kind: "posts" });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (registeredPages === null || registeredPages === undefined) {
|
|
63
|
+
return found({ kind: "path", path: clean });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const page = findMatch(registeredPages, clean);
|
|
67
|
+
|
|
68
|
+
if (!page) {
|
|
69
|
+
return problem(`no page is registered at "${clean}" (is its plugin installed and on?)`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (page.systemLayout) {
|
|
73
|
+
return problem(`"${clean}" is rendered inside a system layout and cannot be the home page`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (page.layout) {
|
|
77
|
+
return problem(`"${clean}" brings its own layout and cannot be the home page`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return found({ kind: "path", path: clean });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** @param {string} value */
|
|
84
|
+
function resolveValue(value) {
|
|
85
|
+
if (value === "posts") {
|
|
86
|
+
return found({ kind: "posts" });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (value.startsWith(CUSTOM_PREFIX)) {
|
|
90
|
+
const offered = !configured || Object.values(themeOptions).some((option) => /** @type {any} */ (option)?.path === "*");
|
|
91
|
+
|
|
92
|
+
return offered ? checkPath(value.slice(CUSTOM_PREFIX.length)) : problem(`this theme does not offer a custom path`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (configured) {
|
|
96
|
+
const option = themeOptions[value];
|
|
97
|
+
|
|
98
|
+
if (!option || typeof option !== "object") {
|
|
99
|
+
return problem(`"${value}" is not one of the options of the theme`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (typeof option.page === "string") {
|
|
103
|
+
return homePages && !homePages[value] ? problem(`option "${value}" has no page file`) : found({ kind: "page", id: value });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (option.path === "*") {
|
|
107
|
+
return problem(`option "${value}" needs a path from the admin (use custom:/path)`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return typeof option.path === "string" ? checkPath(option.path) : problem(`option "${value}" has neither a page nor a path`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// No `home` in the theme config: a plugin page offers itself with `view.home`, the option id is its view id.
|
|
114
|
+
if (registeredPages === null || registeredPages === undefined) {
|
|
115
|
+
return found({ kind: "path", path: "/" });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const entry = Object.entries(registeredPages).find(([, page]) => page?.home && page.view === value);
|
|
119
|
+
|
|
120
|
+
return entry ? checkPath(entry[0]) : problem(`"${value}" is not a home page option (is its plugin installed and on?)`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (typeof homePage === "string" && homePage !== "") {
|
|
124
|
+
const result = resolveValue(homePage);
|
|
125
|
+
|
|
126
|
+
if ("home" in result) {
|
|
127
|
+
return result.home;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
warn(`${PREFIX} "${homePage}" is not available (${result.problem}); using the default of the theme`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const defaultId = configured && typeof home.default === "string" && home.default !== "" ? home.default : "posts";
|
|
134
|
+
|
|
135
|
+
if (defaultId !== "posts") {
|
|
136
|
+
const result = resolveValue(defaultId);
|
|
137
|
+
|
|
138
|
+
if ("home" in result) {
|
|
139
|
+
return result.home;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
warn(`${PREFIX} home.default "${defaultId}" is not available (${result.problem}); showing the posts`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return { kind: "posts" };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* True for the route of the posts feed (`/posts`, whatever the theme renamed it to): `route.id` is
|
|
150
|
+
* `/(theme)/posts`, SvelteKit's id of the route that matched after `reroute`.
|
|
151
|
+
* @param {any} event SvelteKit load event
|
|
152
|
+
* @returns {boolean}
|
|
153
|
+
*/
|
|
154
|
+
export function isPostsRoute(event) {
|
|
155
|
+
const id = event?.route?.id;
|
|
156
|
+
|
|
157
|
+
return typeof id === "string" && id.replace(/\/\([^/)]*\)/g, "") === POSTS_PATH;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* What the home route renders for this request. `/posts` is always the feed; `/` follows the setting.
|
|
162
|
+
* Waits for the layout first: the plugin pages are registered by then.
|
|
163
|
+
* @param {any} event SvelteKit load event
|
|
164
|
+
* @param {() => Record<string, any>} getRegisteredPages the current plugin pages (the table is replaced on a rebuild)
|
|
165
|
+
* @returns {Promise<Home>}
|
|
166
|
+
*/
|
|
167
|
+
export async function resolveHomeFor(event, getRegisteredPages) {
|
|
168
|
+
if (isPostsRoute(event)) {
|
|
169
|
+
return { kind: "posts" };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const parentData = await event.parent();
|
|
173
|
+
|
|
174
|
+
return resolveHome(getThemeConfig(), parentData?.session?.siteInfo?.homePage ?? null, getRegisteredPages(), {
|
|
175
|
+
homePages: getThemeMeta()?.homePages,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* True while `/` shows the posts feed. Cheap, safe to call while rendering: the choice is read as it is
|
|
181
|
+
* (the pages a plugin registered are not looked at, so a choice whose plugin is off still counts as "not
|
|
182
|
+
* posts" here and the feed links then point at `/posts`, which always works).
|
|
183
|
+
* @param {{ homePage?: string | null } | null | undefined} siteInfo
|
|
184
|
+
* @returns {boolean}
|
|
185
|
+
*/
|
|
186
|
+
export function homeIsPosts(siteInfo) {
|
|
187
|
+
try {
|
|
188
|
+
return resolveHome(getThemeConfig(), siteInfo?.homePage ?? null, null, { warn: () => {} }).kind === "posts";
|
|
189
|
+
} catch {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The link to the posts feed (and so to its categories and pages): `/` while it is the home page,
|
|
196
|
+
* `/posts` otherwise, through `route()`.
|
|
197
|
+
* @param {{ homePage?: string | null } | null | undefined} siteInfo
|
|
198
|
+
* @returns {string}
|
|
199
|
+
*/
|
|
200
|
+
export function postsPath(siteInfo) {
|
|
201
|
+
return route(homeIsPosts(siteInfo) ? "/" : POSTS_PATH);
|
|
202
|
+
}
|
package/src/lib/language.util.js
CHANGED
|
@@ -5,6 +5,7 @@ import { browser } from "$app/environment";
|
|
|
5
5
|
|
|
6
6
|
import { base } from "$app/paths";
|
|
7
7
|
import ApiUtil from "$pano/lib/api.util.js";
|
|
8
|
+
import { mergeTranslationLayers } from "./translationLayers.js";
|
|
8
9
|
|
|
9
10
|
export const languageLoading = writable(false);
|
|
10
11
|
export const currentLanguage = writable(null);
|
|
@@ -12,10 +13,10 @@ export const Languages = writable({});
|
|
|
12
13
|
|
|
13
14
|
async function fetchLanguages(event) {
|
|
14
15
|
const response = await ApiUtil.get({
|
|
15
|
-
path: `/
|
|
16
|
+
path: `/locales`,
|
|
16
17
|
request: event
|
|
17
18
|
});
|
|
18
|
-
const locales = response.data;
|
|
19
|
+
const locales = response.items ?? response.data;
|
|
19
20
|
|
|
20
21
|
Languages.set(Object.fromEntries(locales.map(item => [item.code, item])));
|
|
21
22
|
}
|
|
@@ -54,6 +55,20 @@ export async function init(initialLocale, event) {
|
|
|
54
55
|
fallbackLocale: "en-US",
|
|
55
56
|
initialLocale: languageToLoad.code
|
|
56
57
|
});
|
|
58
|
+
|
|
59
|
+
return languageToLoad;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Re-applies a resolved language synchronously. On the server the stores above are process-wide,
|
|
63
|
+
// so concurrent requests with different locales overwrite each other between `init` (awaits) and
|
|
64
|
+
// the render. Call this at the top of the root layout's component init (render is synchronous).
|
|
65
|
+
export function activateLanguage(language) {
|
|
66
|
+
if (!language) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
locale.set(language.code);
|
|
71
|
+
currentLanguage.set(language);
|
|
57
72
|
}
|
|
58
73
|
|
|
59
74
|
export function getAcceptedLanguage(headers) {
|
|
@@ -67,21 +82,68 @@ export function getAcceptedLanguage(headers) {
|
|
|
67
82
|
return headers.get("accept-language").split(",")[0];
|
|
68
83
|
}
|
|
69
84
|
|
|
85
|
+
/**
|
|
86
|
+
* `lang/<locale>.plugins.json` is optional: any failure (missing file, non-200, bad JSON) is `{}`.
|
|
87
|
+
* @param {(url: string) => Promise<any>} useFetch
|
|
88
|
+
* @param {string} code
|
|
89
|
+
*/
|
|
90
|
+
async function fetchThemePluginTexts(useFetch, code) {
|
|
91
|
+
try {
|
|
92
|
+
const response = await useFetch(base + `/theme-api/languages/${code}.plugins.json`);
|
|
93
|
+
|
|
94
|
+
if (!response || response.ok === false || (response.status != null && response.status !== 200)) {
|
|
95
|
+
return {};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const body = await response.json();
|
|
99
|
+
|
|
100
|
+
return body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
101
|
+
} catch {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The installed plugins behind the `plugins.<id>` keys of the translations API: the namespace of
|
|
108
|
+
* an id is the id without a leading `pano-plugin-` (doc 01 section 1).
|
|
109
|
+
* @param {Record<string, any>} apiData
|
|
110
|
+
* @returns {{ id: string, namespace: string }[]}
|
|
111
|
+
*/
|
|
112
|
+
function pluginsOf(apiData) {
|
|
113
|
+
const tree = apiData?.plugins;
|
|
114
|
+
|
|
115
|
+
if (!tree || typeof tree !== "object") {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return Object.keys(tree).map((id) => ({ id, namespace: id.replace(/^pano-plugin-/, "") }));
|
|
120
|
+
}
|
|
121
|
+
|
|
70
122
|
export async function loadLanguage(language, event) {
|
|
71
123
|
const useFetch = event ? event.fetch : fetch;
|
|
72
124
|
|
|
73
|
-
const [localTranslationsResponse, translationsResponse] = await Promise.all([
|
|
125
|
+
const [localTranslationsResponse, translationsResponse, themePlugins] = await Promise.all([
|
|
74
126
|
useFetch(base + `/theme-api/languages/${language.code}.json`),
|
|
75
127
|
ApiUtil.get({
|
|
76
|
-
path: `/
|
|
128
|
+
path: `/locales/${language.code}/translations/types/THEME`,
|
|
77
129
|
request: event
|
|
78
|
-
})
|
|
130
|
+
}),
|
|
131
|
+
fetchThemePluginTexts(useFetch, language.code)
|
|
79
132
|
]);
|
|
80
133
|
|
|
81
134
|
const languageFile = await localTranslationsResponse.json();
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
135
|
+
const ok = !translationsResponse.error;
|
|
136
|
+
const api = ok ? translationsResponse.data ?? {} : {};
|
|
137
|
+
|
|
138
|
+
// Plugin default < theme file < theme's plugin overrides < admin edit (doc 03 section 5.3).
|
|
139
|
+
// The merged dictionary is flat: svelte-i18n resolves a flat key first, so dotted plugin ids work.
|
|
140
|
+
const translations = mergeTranslationLayers({
|
|
141
|
+
theme: languageFile,
|
|
142
|
+
themePlugins,
|
|
143
|
+
api,
|
|
144
|
+
pluginAdminKeys: ok ? translationsResponse.meta?.pluginAdminKeys : undefined,
|
|
145
|
+
plugins: pluginsOf(api)
|
|
146
|
+
});
|
|
85
147
|
|
|
86
148
|
register(language.code, async () => translations);
|
|
87
149
|
|
|
@@ -123,32 +185,3 @@ export function getLanguageByLocale(locale) {
|
|
|
123
185
|
|
|
124
186
|
return foundLanguage;
|
|
125
187
|
}
|
|
126
|
-
|
|
127
|
-
function flattenObject(obj, prefix = "", result = {}) {
|
|
128
|
-
for (const key in obj) {
|
|
129
|
-
const value = obj[key];
|
|
130
|
-
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
131
|
-
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
132
|
-
flattenObject(value, newKey, result);
|
|
133
|
-
} else {
|
|
134
|
-
result[newKey] = value;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function unflattenObject(flatObj) {
|
|
141
|
-
const result = {};
|
|
142
|
-
for (const flatKey in flatObj) {
|
|
143
|
-
const keys = flatKey.split(".");
|
|
144
|
-
keys.reduce((acc, key, idx) => {
|
|
145
|
-
if (idx === keys.length - 1) {
|
|
146
|
-
acc[key] = flatObj[flatKey];
|
|
147
|
-
} else {
|
|
148
|
-
acc[key] = acc[key] || {};
|
|
149
|
-
}
|
|
150
|
-
return acc[key];
|
|
151
|
-
}, result);
|
|
152
|
-
}
|
|
153
|
-
return result;
|
|
154
|
-
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
<PageHead
|
|
2
|
+
meta={$page.data?.meta}
|
|
3
|
+
siteInfo={$session.siteInfo}
|
|
4
|
+
url={$page.url}
|
|
5
|
+
title={resolvePageTitle($pageTitle, $_).title} />
|
|
6
|
+
|
|
1
7
|
<svelte:component this={layoutView} data={viewData} {session} {pageTitle} {getTitle}>
|
|
2
8
|
<slot />
|
|
3
9
|
</svelte:component>
|
|
4
10
|
|
|
5
11
|
<script context="module">
|
|
6
12
|
import { processLoad, processServerLoad } from "$pano/lib/ui-logics/layout-logics/AppLayoutLogics";
|
|
7
|
-
import {
|
|
13
|
+
import { loadView } from "$pano/registry/index.js";
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* @type {import("@sveltejs/kit").LayoutServerLoad}
|
|
@@ -20,14 +26,15 @@
|
|
|
20
26
|
// Resolved in load (not {#await} in markup): universal load data is not
|
|
21
27
|
// serialized, so the component class can travel in it, and SSR renders the
|
|
22
28
|
// view instead of an await-pending branch.
|
|
23
|
-
const
|
|
29
|
+
const data = await processLoad(event);
|
|
30
|
+
|
|
31
|
+
const { View, ...blocks } = await loadView(
|
|
32
|
+
event,
|
|
24
33
|
"AppLayoutView",
|
|
25
34
|
() => import("../views/AppLayoutView.svelte"),
|
|
26
35
|
);
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return { ...data, appLayoutView: await viewPromise };
|
|
37
|
+
return { ...data, ...blocks, appLayoutView: View };
|
|
31
38
|
}
|
|
32
39
|
</script>
|
|
33
40
|
|
|
@@ -38,6 +45,8 @@
|
|
|
38
45
|
import { onMount } from "svelte";
|
|
39
46
|
import { get } from "svelte/store";
|
|
40
47
|
import { avatarVersion } from "$pano/lib/Store.js";
|
|
48
|
+
import PageHead from "$pano/lib/components/PageHead.svelte";
|
|
49
|
+
import { resolvePageTitle } from "$pano/lib/pageTitle.util.js";
|
|
41
50
|
|
|
42
51
|
export let data = undefined;
|
|
43
52
|
|
|
@@ -45,9 +54,8 @@
|
|
|
45
54
|
|
|
46
55
|
function getTitle(pt, siteName) {
|
|
47
56
|
if (!pt) return siteName;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
: (pt.title ? $_(pt.title, { values: pt.titleValues || {} }) : "");
|
|
57
|
+
// `raw` titles are used verbatim; `hidden` only affects the visible <PageTitle>.
|
|
58
|
+
const { title: titleStr } = resolvePageTitle(pt, $_);
|
|
51
59
|
return `${titleStr} \u2014 ${siteName}`;
|
|
52
60
|
}
|
|
53
61
|
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
<script context="module">
|
|
4
4
|
import { processLoad } from "$pano/lib/ui-logics/layout-logics/AuthLayoutLogics";
|
|
5
|
-
import {
|
|
5
|
+
import { loadView } from "$pano/registry/index.js";
|
|
6
6
|
|
|
7
7
|
export async function load(event) {
|
|
8
8
|
// Resolved in load (not {#await} in markup): universal load data is not
|
|
9
9
|
// serialized, so the component class can travel in it, and SSR renders the
|
|
10
10
|
// view instead of an await-pending branch.
|
|
11
|
-
const
|
|
11
|
+
const data = await processLoad(event);
|
|
12
|
+
const { View, ...blocks } = await loadView(
|
|
13
|
+
event,
|
|
12
14
|
"AuthLayoutView",
|
|
13
15
|
() => import("../views/AuthLayoutView.svelte"),
|
|
14
16
|
);
|
|
15
|
-
|
|
16
|
-
return { ...data, authLayoutView:
|
|
17
|
+
|
|
18
|
+
return { ...data, ...blocks, authLayoutView: View };
|
|
17
19
|
}
|
|
18
20
|
</script>
|
|
19
21
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<script context="module">
|
|
6
6
|
import { processLoad } from "$pano/lib/ui-logics/layout-logics/MainLayoutLogics";
|
|
7
|
-
import {
|
|
7
|
+
import { loadView } from "$pano/registry/index.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @type {import("@sveltejs/kit").LayoutLoad}
|
|
@@ -13,21 +13,22 @@
|
|
|
13
13
|
// Resolved in load (not {#await} in markup): universal load data is not
|
|
14
14
|
// serialized, so the component class can travel in it, and SSR renders the
|
|
15
15
|
// view instead of an await-pending branch.
|
|
16
|
-
const viewPromise = resolveView(
|
|
17
|
-
"MainLayoutView",
|
|
18
|
-
() => import("../views/MainLayoutView.svelte"),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
16
|
const data = await processLoad(event);
|
|
22
17
|
|
|
23
18
|
// Chrome components resolve through the registry too: forks restyle the
|
|
24
19
|
// navbar/header/footer far more often than whole layouts, so overriding
|
|
25
|
-
// just `Navbar` must not require ejecting MainLayoutView.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
// just `Navbar` must not require ejecting MainLayoutView. loadView also
|
|
21
|
+
// returns the `block:` data of every <PluginBlock> placed in each of them.
|
|
22
|
+
const [
|
|
23
|
+
{ View, ...layoutBlocks },
|
|
24
|
+
{ View: NavbarC, ...navbarBlocks },
|
|
25
|
+
{ View: HeaderC, ...headerBlocks },
|
|
26
|
+
{ View: FooterC, ...footerBlocks },
|
|
27
|
+
] = await Promise.all([
|
|
28
|
+
loadView(event, "MainLayoutView", () => import("../views/MainLayoutView.svelte")),
|
|
29
|
+
loadView(event, "Navbar", () => import("../components/Navbar.svelte")),
|
|
30
|
+
loadView(event, "Header", () => import("../components/Header.svelte")),
|
|
31
|
+
loadView(event, "Footer", () => import("../components/Footer.svelte")),
|
|
31
32
|
]);
|
|
32
33
|
|
|
33
34
|
// `mainLayoutView` alias: this load's result is merged into the ROOT
|
|
@@ -37,6 +38,10 @@
|
|
|
37
38
|
// page's own view. The unique key survives that merge.
|
|
38
39
|
return {
|
|
39
40
|
...data,
|
|
41
|
+
...layoutBlocks,
|
|
42
|
+
...navbarBlocks,
|
|
43
|
+
...headerBlocks,
|
|
44
|
+
...footerBlocks,
|
|
40
45
|
mainLayoutView: View,
|
|
41
46
|
mainLayoutChrome: { Navbar: NavbarC, Header: HeaderC, Footer: FooterC },
|
|
42
47
|
};
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
<script context="module">
|
|
4
4
|
import { processLoad } from "$pano/lib/ui-logics/layout-logics/ProfileLayoutLogics";
|
|
5
|
-
import {
|
|
5
|
+
import { loadView } from "$pano/registry/index.js";
|
|
6
6
|
|
|
7
7
|
export async function load(event) {
|
|
8
8
|
// Resolved in load (not {#await} in markup): universal load data is not
|
|
9
9
|
// serialized, so the component class can travel in it, and SSR renders the
|
|
10
10
|
// view instead of an await-pending branch.
|
|
11
|
-
const
|
|
11
|
+
const data = await processLoad(event);
|
|
12
|
+
const { View, ...blocks } = await loadView(
|
|
13
|
+
event,
|
|
12
14
|
"ProfileLayoutView",
|
|
13
15
|
() => import("../views/ProfileLayoutView.svelte"),
|
|
14
16
|
);
|
|
15
|
-
|
|
16
|
-
return { ...data, profileLayoutView:
|
|
17
|
+
|
|
18
|
+
return { ...data, ...blocks, profileLayoutView: View };
|
|
17
19
|
}
|
|
18
20
|
</script>
|
|
19
21
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<script context="module">
|
|
4
4
|
import { processLoadServer, processLoad } from "$pano/lib/ui-logics/layout-logics/ThemeSettingsLayoutLogics";
|
|
5
|
-
import {
|
|
5
|
+
import { loadView } from "$pano/registry/index.js";
|
|
6
6
|
|
|
7
7
|
export async function loadServer(event) {
|
|
8
8
|
return await processLoadServer(event);
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
// Resolved in load (not {#await} in markup): universal load data is not
|
|
13
13
|
// serialized, so the component class can travel in it, and SSR renders the
|
|
14
14
|
// view instead of an await-pending branch.
|
|
15
|
-
const
|
|
15
|
+
const data = await processLoad(event);
|
|
16
|
+
const { View, ...blocks } = await loadView(
|
|
17
|
+
event,
|
|
16
18
|
"ThemeSettingsLayoutView",
|
|
17
19
|
() => import("../views/ThemeSettingsLayoutView.svelte"),
|
|
18
20
|
);
|
|
19
|
-
|
|
20
|
-
return { ...data, themeSettingsLayoutView:
|
|
21
|
+
|
|
22
|
+
return { ...data, ...blocks, themeSettingsLayoutView: View };
|
|
21
23
|
}
|
|
22
24
|
</script>
|
|
23
25
|
|
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
<script context="module">
|
|
4
4
|
import { processLoad } from "$pano/lib/ui-logics/layout-logics/TicketsLayoutLogics";
|
|
5
|
-
import {
|
|
5
|
+
import { loadView } from "$pano/registry/index.js";
|
|
6
6
|
|
|
7
7
|
export async function load(event) {
|
|
8
8
|
// Resolved in load (not {#await} in markup): universal load data is not
|
|
9
9
|
// serialized, so the component class can travel in it, and SSR renders the
|
|
10
10
|
// view instead of an await-pending branch.
|
|
11
|
-
const
|
|
11
|
+
const loadData = await processLoad(event);
|
|
12
|
+
|
|
13
|
+
const { View, ...blocks } = await loadView(
|
|
14
|
+
event,
|
|
12
15
|
"TicketsLayoutView",
|
|
13
16
|
() => import("../views/TicketsLayoutView.svelte"),
|
|
14
17
|
);
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return { ...loadData, ticketsLayoutView: await viewPromise };
|
|
19
|
+
return { ...loadData, ...blocks, ticketsLayoutView: View };
|
|
19
20
|
}
|
|
20
21
|
</script>
|
|
21
22
|
|