@panomc/theme-core 1.0.0-dev.60 → 1.0.0-dev.62
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 +8 -9
- 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 +79 -21
- package/src/kit/route-map.js +300 -0
- package/src/kit/specifiers.js +3 -62
- 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
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
</style>
|
|
84
84
|
|
|
85
85
|
<!-- Navbar -->
|
|
86
|
-
<div class:container={themeSettings.navbarWidthOption !== "FULL_SIZE"}>
|
|
86
|
+
<div class="pano-navbar" class:container={themeSettings.navbarWidthOption !== "FULL_SIZE"}>
|
|
87
87
|
<nav
|
|
88
88
|
data-bs-theme={getContrast(effectiveNavbarBgColor)}
|
|
89
89
|
class="navbar navbar-expand-lg rounded rounded-{themeSettings.navRoundLevel
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
{#if $session.user && $session.user.panelAccess}
|
|
111
111
|
<li class="nav-item position-relative">
|
|
112
112
|
<a
|
|
113
|
-
class="nav-link"
|
|
113
|
+
class="pano-navbar__link nav-link"
|
|
114
114
|
href={PANEL_URL}
|
|
115
115
|
target="_blank"
|
|
116
116
|
rel="noreferrer"
|
|
@@ -143,51 +143,51 @@
|
|
|
143
143
|
<li class="nav-item dropdown position-relative">
|
|
144
144
|
<button
|
|
145
145
|
type="button"
|
|
146
|
-
class="nav-link position-relative d-flex align-items-center"
|
|
146
|
+
class="pano-navbar__link-2 nav-link position-relative d-flex align-items-center"
|
|
147
147
|
data-bs-toggle="dropdown"
|
|
148
148
|
aria-expanded="false">
|
|
149
149
|
<span class="me-2 d-none d-lg-inline"
|
|
150
150
|
>{$session.user.username}</span>
|
|
151
151
|
<img
|
|
152
152
|
alt={$session.user.username}
|
|
153
|
-
class="rounded"
|
|
154
|
-
src="/api/profile/picture/{$session.user
|
|
153
|
+
class="pano-navbar__image rounded"
|
|
154
|
+
src="/api/v1/profile/picture/{$session.user
|
|
155
155
|
.username}?{$avatarVersion}"
|
|
156
156
|
width="24"
|
|
157
157
|
height="24" />
|
|
158
158
|
{#if $notificationsCount !== 0}
|
|
159
159
|
<span
|
|
160
|
-
class="position-absolute top-0 end-0 badge rounded-pill bg-danger px-2 py-1">
|
|
160
|
+
class="pano-navbar__badge position-absolute top-0 end-0 badge rounded-pill bg-danger px-2 py-1">
|
|
161
161
|
{$notificationsCount}
|
|
162
162
|
</span>
|
|
163
163
|
{/if}
|
|
164
164
|
</button>
|
|
165
|
-
<ul class="dropdown-menu dropdown-menu-end position-absolute">
|
|
166
|
-
<h6 class="dropdown-header">{$session.user.username}</h6>
|
|
165
|
+
<ul class="pano-navbar__menu dropdown-menu dropdown-menu-end position-absolute">
|
|
166
|
+
<h6 class="pano-navbar__title dropdown-header">{$session.user.username}</h6>
|
|
167
167
|
{#each $profileDropdownItems as item (item.id)}
|
|
168
168
|
{#if item.id === "profile"}
|
|
169
169
|
<li>
|
|
170
170
|
<a
|
|
171
171
|
class:active={matching(
|
|
172
172
|
$page.url.pathname,
|
|
173
|
-
"/profile",
|
|
173
|
+
route("/profile"),
|
|
174
174
|
)}
|
|
175
|
-
class="dropdown-item focus-ring"
|
|
176
|
-
href="/profile">{$_("buttons.profile")}</a>
|
|
175
|
+
class="pano-navbar__menu-item dropdown-item focus-ring"
|
|
176
|
+
href={route("/profile")}>{$_("buttons.profile")}</a>
|
|
177
177
|
</li>
|
|
178
178
|
{:else if item.id === "notifications"}
|
|
179
179
|
<li>
|
|
180
180
|
<a
|
|
181
181
|
class:active={matching(
|
|
182
182
|
$page.url.pathname,
|
|
183
|
-
"/notifications",
|
|
183
|
+
route("/notifications"),
|
|
184
184
|
)}
|
|
185
|
-
class="dropdown-item focus-ring position-relative"
|
|
186
|
-
href="/notifications"
|
|
185
|
+
class="pano-navbar__notifications dropdown-item focus-ring position-relative"
|
|
186
|
+
href={route("/notifications")}
|
|
187
187
|
>{$_("buttons.notifications")}
|
|
188
188
|
{#if $notificationsCount !== 0}
|
|
189
189
|
<span
|
|
190
|
-
class="position-absolute top-0 badge rounded-pill bg-danger p-1 d-inline">
|
|
190
|
+
class="pano-navbar__badge-2 position-absolute top-0 badge rounded-pill bg-danger p-1 d-inline">
|
|
191
191
|
</span>
|
|
192
192
|
{/if}</a>
|
|
193
193
|
</li>
|
|
@@ -196,26 +196,26 @@
|
|
|
196
196
|
<a
|
|
197
197
|
class:active={matching(
|
|
198
198
|
$page.url.pathname,
|
|
199
|
-
"/tickets",
|
|
199
|
+
route("/tickets"),
|
|
200
200
|
)}
|
|
201
|
-
class="dropdown-item focus-ring"
|
|
202
|
-
href="/tickets">{$_("buttons.tickets")}</a>
|
|
201
|
+
class="pano-navbar__tickets dropdown-item focus-ring"
|
|
202
|
+
href={route("/tickets")}>{$_("buttons.tickets")}</a>
|
|
203
203
|
</li>
|
|
204
204
|
{:else if item.id === "settings"}
|
|
205
205
|
<li>
|
|
206
206
|
<a
|
|
207
207
|
class:active={matching(
|
|
208
208
|
$page.url.pathname,
|
|
209
|
-
"/profile/settings",
|
|
209
|
+
route("/profile/settings"),
|
|
210
210
|
)}
|
|
211
|
-
class="dropdown-item focus-ring"
|
|
212
|
-
href="/profile/settings">{$_("buttons.settings")}</a>
|
|
211
|
+
class="pano-navbar__settings dropdown-item focus-ring"
|
|
212
|
+
href={route("/profile/settings")}>{$_("buttons.settings")}</a>
|
|
213
213
|
</li>
|
|
214
214
|
{:else if item.id === "logout"}
|
|
215
215
|
<li>
|
|
216
216
|
<button
|
|
217
217
|
type="button"
|
|
218
|
-
class="dropdown-item focus-ring link-danger"
|
|
218
|
+
class="pano-navbar__logout dropdown-item focus-ring link-danger"
|
|
219
219
|
on:click={() => logout(session)}
|
|
220
220
|
>{$_("buttons.logout")}</button>
|
|
221
221
|
</li>
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
<!-- Custom plugin item -->
|
|
224
224
|
<li>
|
|
225
225
|
<a
|
|
226
|
-
class="dropdown-item focus-ring"
|
|
226
|
+
class="pano-navbar__menu-item-2 dropdown-item focus-ring"
|
|
227
227
|
href={item.props.href}>
|
|
228
228
|
{#if item.props.icon}
|
|
229
229
|
<i class="{item.props.icon} me-2"></i>
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
{:else if component.id === "auth-buttons"}
|
|
242
242
|
{#if !$session.user}
|
|
243
243
|
<li class="nav-item position-relative me-lg-2">
|
|
244
|
-
<a href="/login" class="nav-link">
|
|
244
|
+
<a href={route("/login")} class="pano-navbar__login nav-link">
|
|
245
245
|
{$_("buttons.login")}
|
|
246
246
|
</a>
|
|
247
247
|
{#if showLoginBubble}
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
{/if}
|
|
261
261
|
</li>
|
|
262
262
|
<li class="nav-item">
|
|
263
|
-
<a href="/register" class="btn btn-secondary rounded-pill">
|
|
263
|
+
<a href={route("/register")} class="pano-navbar__action btn btn-secondary rounded-pill">
|
|
264
264
|
{$_("buttons.register")}
|
|
265
265
|
</a>
|
|
266
266
|
</li>
|
|
@@ -282,7 +282,7 @@
|
|
|
282
282
|
<a
|
|
283
283
|
href={link.href}
|
|
284
284
|
target={link.target}
|
|
285
|
-
class="nav-link"
|
|
285
|
+
class="pano-navbar__link-3 nav-link"
|
|
286
286
|
class:active={matching(
|
|
287
287
|
$page.url.pathname,
|
|
288
288
|
link.href,
|
|
@@ -315,6 +315,7 @@
|
|
|
315
315
|
import { page } from "$app/stores";
|
|
316
316
|
import { browser } from "$app/environment";
|
|
317
317
|
import { PANEL_URL } from "$pano/lib/variables.js";
|
|
318
|
+
import { route } from "$pano/registry/routes.js";
|
|
318
319
|
|
|
319
320
|
import { avatarVersion, logout, notificationsCount } from "$pano/lib/Store";
|
|
320
321
|
import { panoApiClient } from "$pano/lib/PluginAPI.js";
|
|
@@ -407,12 +408,12 @@
|
|
|
407
408
|
$: navbarWidthOption = themeSettings.navbarWidthOption || "BY_CONTENT";
|
|
408
409
|
|
|
409
410
|
$: nativeLinks = [
|
|
410
|
-
{ id: "home", text: "nav-links.homepage", href: "/" },
|
|
411
|
-
{ id: "support", text: "nav-links.support", href: "/support" },
|
|
411
|
+
{ id: "home", text: "nav-links.homepage", href: route("/") },
|
|
412
|
+
{ id: "support", text: "nav-links.support", href: route("/support") },
|
|
412
413
|
{
|
|
413
414
|
id: "rules",
|
|
414
415
|
text: "nav-links.rules",
|
|
415
|
-
href: "/rules",
|
|
416
|
+
href: route("/rules"),
|
|
416
417
|
condition: !!$session.siteInfo?.hasRegisterAgreement
|
|
417
418
|
},
|
|
418
419
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<div class="card opacity-50 bg-transparent border-none">
|
|
2
|
-
<div class="card-body vstack gap-3 text-center">
|
|
1
|
+
<div class="pano-no-content card opacity-50 bg-transparent border-none">
|
|
2
|
+
<div class="pano-no-content__body card-body vstack gap-3 text-center">
|
|
3
3
|
<span class={icon}></span>
|
|
4
4
|
<p class="mb-0">{text}</p>
|
|
5
5
|
<slot />
|
|
@@ -1,78 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</small>
|
|
20
|
-
|
|
21
|
-
<button
|
|
22
|
-
type="button"
|
|
23
|
-
class="btn-close btn-close-white position-relative z-3"
|
|
24
|
-
aria-label="{$_('buttons.close')}"
|
|
25
|
-
data-bs-dismiss="toast"
|
|
26
|
-
on:click|stopPropagation>
|
|
27
|
-
</button>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="toast-body">
|
|
31
|
-
<div
|
|
32
|
-
class="fw-normal list-group-item list-group-item-action d-flex align-items-center gap-3 text-wrap">
|
|
33
|
-
<button
|
|
34
|
-
type="button"
|
|
35
|
-
title={$_("buttons.view")}
|
|
36
|
-
on:click={() => onNotificationClick(notification)}
|
|
37
|
-
class="text-start border-0 bg-transparent p-0 d-flex align-items-center gap-3">
|
|
38
|
-
|
|
39
|
-
<span class="d-flex align-items-center">
|
|
40
|
-
{#if notification.details.faIcon}
|
|
41
|
-
<i class="{notification.details.faIcon} fa-fw"></i>
|
|
42
|
-
{:else if notification.details.image || notification.details.username}
|
|
43
|
-
<img
|
|
44
|
-
src="{notification.details.image || `/api/profile/picture/${notification.details.username}?${$avatarVersion}`}"
|
|
45
|
-
alt="{$_('buttons.view')}"
|
|
46
|
-
width="48"
|
|
47
|
-
height="48"
|
|
48
|
-
class="rounded" />
|
|
49
|
-
{:else}
|
|
50
|
-
<i class="fa fa-fw fa-bolt"></i>
|
|
51
|
-
{/if}
|
|
52
|
-
</span>
|
|
53
|
-
|
|
54
|
-
<span class="text-start">
|
|
55
|
-
<span class="text-wrap markdown-renderer text-break">
|
|
56
|
-
{@html $_('notifications.' + notification.type, {
|
|
57
|
-
values: { ...sanitizeObject(notification.details || {}) }
|
|
58
|
-
})}
|
|
59
|
-
</span>
|
|
60
|
-
</span>
|
|
61
|
-
</button>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<!-- Invisible button covering whole area without creating spacing -->
|
|
66
|
-
<button
|
|
67
|
-
type="button"
|
|
68
|
-
class="stretched-link p-0 border-0 bg-transparent position-absolute top-0 start-0 w-100 h-100"
|
|
69
|
-
aria-label={$_("buttons.view")}
|
|
70
|
-
on:click={() => onClick(notification)}>
|
|
71
|
-
</button>
|
|
72
|
-
</article>
|
|
73
|
-
|
|
74
|
-
{/each}
|
|
75
|
-
</div>
|
|
1
|
+
<!--
|
|
2
|
+
Controller of the engine's <NotificationContainer>. The markup lives in views/parts/NotificationContainer.svelte; a
|
|
3
|
+
theme may replace it with the "NotificationContainer" entry of theme.config.js views (see skin-contract.json for the
|
|
4
|
+
props). The module API (show, hide) and the realtime / polling logic stay here.
|
|
5
|
+
-->
|
|
6
|
+
<svelte:component
|
|
7
|
+
this={getOverride("NotificationContainer") ?? NotificationContainerView}
|
|
8
|
+
{notifications}
|
|
9
|
+
{checkTime}
|
|
10
|
+
{currentLanguage}
|
|
11
|
+
{locales}
|
|
12
|
+
{avatarVersion}
|
|
13
|
+
{getTime}
|
|
14
|
+
{onNotificationClick}
|
|
15
|
+
{navigate}
|
|
16
|
+
{notificationTextKey}
|
|
17
|
+
{sanitizeObject}
|
|
18
|
+
{onClick} />
|
|
76
19
|
|
|
77
20
|
<script context="module">
|
|
78
21
|
import { tick } from "svelte";
|
|
@@ -140,16 +83,19 @@
|
|
|
140
83
|
import { getContext, onDestroy, onMount } from "svelte";
|
|
141
84
|
import { formatDistanceToNow } from "date-fns";
|
|
142
85
|
import { sanitize } from "@jill64/universal-sanitizer";
|
|
143
|
-
import { _ } from "svelte-i18n";
|
|
144
86
|
|
|
145
87
|
import { browser } from "$app/environment";
|
|
88
|
+
import { goto } from "$app/navigation";
|
|
89
|
+
import { base } from "$app/paths";
|
|
146
90
|
|
|
147
91
|
import { notificationsCount, quickNotifications, avatarVersion } from "$pano/lib/Store";
|
|
148
92
|
import { onNotificationRefresh, setSiteNotificationsSubscription } from "$pano/lib/siteRealtime.js";
|
|
149
93
|
import ApiUtil from "$pano/lib/api.util";
|
|
150
|
-
import { onNotificationClick } from "$pano/lib/NotificationManager.js";
|
|
94
|
+
import { onNotificationClick, notificationTextKey } from "$pano/lib/NotificationManager.js";
|
|
151
95
|
import * as locales from "date-fns/locale";
|
|
152
96
|
import { currentLanguage } from "$pano/lib/language.util.js";
|
|
97
|
+
import { getOverride } from "$pano/registry/index.js";
|
|
98
|
+
import NotificationContainerView from "$pano/lib/views/parts/NotificationContainer.svelte";
|
|
153
99
|
|
|
154
100
|
let quickNotificationProcessID = 0;
|
|
155
101
|
|
|
@@ -226,11 +172,11 @@
|
|
|
226
172
|
await delay();
|
|
227
173
|
|
|
228
174
|
ApiUtil.get({
|
|
229
|
-
path: "/
|
|
175
|
+
path: "/notifications/quick",
|
|
230
176
|
}).then((body) => {
|
|
231
177
|
if (quickNotificationProcessID === id) {
|
|
232
|
-
if (body.
|
|
233
|
-
setNotifications(body.
|
|
178
|
+
if (!body.error) {
|
|
179
|
+
setNotifications(body.items);
|
|
234
180
|
|
|
235
181
|
notificationsCount.set(body.notificationCount);
|
|
236
182
|
}
|
|
@@ -260,15 +206,18 @@
|
|
|
260
206
|
onDestroy(sessionSubscription);
|
|
261
207
|
}
|
|
262
208
|
|
|
209
|
+
// Notifications without a click listener navigate to their safe `details.href`.
|
|
210
|
+
const navigate = (path) => goto(base + path);
|
|
211
|
+
|
|
263
212
|
function markRead(id) {
|
|
264
213
|
ApiUtil.post({
|
|
265
|
-
path: `/
|
|
214
|
+
path: `/notifications/${id}/read`,
|
|
266
215
|
});
|
|
267
216
|
}
|
|
268
217
|
|
|
269
218
|
function onClick(notification) {
|
|
270
219
|
markRead(notification.id);
|
|
271
|
-
onNotificationClick(notification);
|
|
220
|
+
onNotificationClick(notification, navigate);
|
|
272
221
|
hide(notification.id);
|
|
273
222
|
}
|
|
274
223
|
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
{#each onlineAdmins as onlineAdmin, index (onlineAdmin)}
|
|
14
14
|
<div class="col-auto">
|
|
15
15
|
<a
|
|
16
|
-
href=
|
|
16
|
+
href={route(`/player/${onlineAdmin}`)}
|
|
17
17
|
class="online-admin-link focus-ring rounded position-relative d-inline-block">
|
|
18
18
|
<img
|
|
19
|
-
src="/api/profile/picture/{onlineAdmin}?{$avatarVersion}"
|
|
19
|
+
src="/api/v1/profile/picture/{onlineAdmin}?{$avatarVersion}"
|
|
20
20
|
class="online-admin-avatar rounded border border-3 border-success"
|
|
21
21
|
alt={onlineAdmin}
|
|
22
22
|
use:tooltip={[
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
<script>
|
|
38
38
|
import { _ } from "svelte-i18n";
|
|
39
39
|
import { avatarVersion } from "$pano/lib/Store";
|
|
40
|
+
import { route } from "$pano/registry/routes.js";
|
|
40
41
|
import tooltip from "$pano/lib/tooltip.util";
|
|
41
42
|
import { getContext } from "svelte";
|
|
42
43
|
import NoContent from "./NoContent.svelte";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</style>
|
|
9
9
|
|
|
10
10
|
<div
|
|
11
|
-
class="row d-flex align-items-center gy-3 justify-content-lg-between justify-content-center">
|
|
11
|
+
class="pano-page-actions row d-flex align-items-center gy-3 justify-content-lg-between justify-content-center">
|
|
12
12
|
{#if (leftClasses !== null && $$slots.left) || (leftClasses !== null && leftClasses !== undefined)}
|
|
13
13
|
<div
|
|
14
14
|
class="col-lg-auto col-12 d-flex justify-content-lg-start overflow-x-auto scroll-center {leftClasses ||
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Engine component (not overridable): the page head metadata of a page.
|
|
3
|
+
Fed by AppLayout with the page's `meta` load result, the site info, the page URL and the
|
|
4
|
+
resolved page title (no site suffix). Every tag is emitted only when its value is non-null.
|
|
5
|
+
-->
|
|
6
|
+
<svelte:head>
|
|
7
|
+
{#if head.description}
|
|
8
|
+
<meta name="description" content={head.description} />
|
|
9
|
+
{/if}
|
|
10
|
+
{#if head.ogTitle}
|
|
11
|
+
<meta property="og:title" content={head.ogTitle} />
|
|
12
|
+
{/if}
|
|
13
|
+
{#if head.ogDescription}
|
|
14
|
+
<meta property="og:description" content={head.ogDescription} />
|
|
15
|
+
{/if}
|
|
16
|
+
<meta property="og:type" content={head.ogType} />
|
|
17
|
+
{#if head.ogUrl}
|
|
18
|
+
<meta property="og:url" content={head.ogUrl} />
|
|
19
|
+
{/if}
|
|
20
|
+
{#if head.siteName}
|
|
21
|
+
<meta property="og:site_name" content={head.siteName} />
|
|
22
|
+
{/if}
|
|
23
|
+
{#if head.ogImage}
|
|
24
|
+
<meta property="og:image" content={head.ogImage} />
|
|
25
|
+
{#if head.ogImageAlt}
|
|
26
|
+
<meta property="og:image:alt" content={head.ogImageAlt} />
|
|
27
|
+
{/if}
|
|
28
|
+
{/if}
|
|
29
|
+
<meta name="twitter:card" content={head.twitterCard} />
|
|
30
|
+
{#if head.canonical}
|
|
31
|
+
<link rel="canonical" href={head.canonical} />
|
|
32
|
+
{/if}
|
|
33
|
+
{#if head.robots}
|
|
34
|
+
<meta name="robots" content={head.robots} />
|
|
35
|
+
{/if}
|
|
36
|
+
{#if head.referrer}
|
|
37
|
+
<meta name="referrer" content={head.referrer} />
|
|
38
|
+
{/if}
|
|
39
|
+
{#if head.jsonLd}
|
|
40
|
+
{@html '<script type="application/ld+json">' + head.jsonLd + '</' + 'script>'}
|
|
41
|
+
{/if}
|
|
42
|
+
</svelte:head>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import { normalizePageMeta } from "$pano/lib/pageMeta.util.js";
|
|
46
|
+
|
|
47
|
+
let { meta = undefined, siteInfo = undefined, url = undefined, title = undefined } = $props();
|
|
48
|
+
|
|
49
|
+
const head = $derived(normalizePageMeta(meta, { siteInfo, url, title }));
|
|
50
|
+
</script>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
{#if title || subtitle}
|
|
13
|
-
<div class="text-center animate__animated animate__fadeIn">
|
|
14
|
-
<h1 class="fs-3 mb-0 text-break word-break">
|
|
13
|
+
<div class="pano-page-title text-center animate__animated animate__fadeIn">
|
|
14
|
+
<h1 class="pano-page-title__title fs-3 mb-0 text-break word-break">
|
|
15
15
|
<slot name="title">
|
|
16
16
|
{#if title}
|
|
17
17
|
{#if html}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<nav>
|
|
2
|
-
<ul class="pagination pagination-sm mb-0 justify-content-start flex-wrap">
|
|
1
|
+
<nav class="pano-pagination">
|
|
2
|
+
<ul class="pano-pagination__pager pagination pagination-sm mb-0 justify-content-start flex-wrap">
|
|
3
3
|
<li class="page-item" class:disabled={parseInt(page) === 1}>
|
|
4
4
|
<button
|
|
5
5
|
type="button"
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
</li>
|
|
27
27
|
{/each}
|
|
28
28
|
|
|
29
|
-
<li class="page-item" class:disabled={parseInt(page) ===
|
|
29
|
+
<li class="page-item" class:disabled={parseInt(page) === totalPages}>
|
|
30
30
|
<button
|
|
31
31
|
type="button"
|
|
32
32
|
class="page-link"
|
|
33
33
|
title={$_("components.pagination.next-page")}
|
|
34
34
|
onclick={onLastPageClick}
|
|
35
|
-
aria-hidden={parseInt(page) ===
|
|
35
|
+
aria-hidden={parseInt(page) === totalPages}>
|
|
36
36
|
<i class="fa-solid fa-caret-right"></i>
|
|
37
37
|
</button>
|
|
38
38
|
</li>
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
|
|
46
46
|
const dispatch = createEventDispatcher();
|
|
47
47
|
|
|
48
|
-
let { page = 1,
|
|
48
|
+
let { page = 1, totalPages = 1 } = $props();
|
|
49
49
|
|
|
50
|
-
const pages = $derived(Array.from({ length:
|
|
50
|
+
const pages = $derived(Array.from({ length: totalPages }, (_, i) => i + 1));
|
|
51
51
|
|
|
52
52
|
function onFirstPageClick() {
|
|
53
53
|
dispatch("firstPageClick", {});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{#if lastActivityTime}
|
|
2
2
|
<img
|
|
3
|
-
src="/api/profile/picture/{username}?{$avatarVersion}"
|
|
4
|
-
class="img-thumbnail rounded d-block m-auto"
|
|
3
|
+
src="/api/v1/profile/picture/{username}?{$avatarVersion}"
|
|
4
|
+
class="pano-player-head img-thumbnail rounded d-block m-auto"
|
|
5
5
|
width="{width}"
|
|
6
6
|
height="{height}"
|
|
7
7
|
alt="{username}"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
]}" />
|
|
18
18
|
{:else}
|
|
19
19
|
<img
|
|
20
|
-
src="/api/profile/picture/{username}?{$avatarVersion}"
|
|
21
|
-
class="rounded d-block m-auto"
|
|
20
|
+
src="/api/v1/profile/picture/{username}?{$avatarVersion}"
|
|
21
|
+
class="pano-player-head rounded d-block m-auto"
|
|
22
22
|
width="{width}"
|
|
23
23
|
height="{height}"
|
|
24
24
|
alt="{username}"
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
{#if Component}
|
|
2
|
+
<Component {...data} {...rest} />
|
|
3
|
+
{:else if fallback}
|
|
4
|
+
{@render fallback()}
|
|
5
|
+
{/if}
|
|
6
|
+
|
|
7
|
+
<script module>
|
|
8
|
+
const warned = new Set();
|
|
9
|
+
|
|
10
|
+
function warnNotBlock(blockId) {
|
|
11
|
+
if (warned.has(blockId)) return;
|
|
12
|
+
|
|
13
|
+
warned.add(blockId);
|
|
14
|
+
console.warn(`[theme-core] <PluginBlock id="${blockId}"> load not called, the view is not a block (set block: true in its view record)`);
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
// `<PluginBlock id="market:ProductGrid" limit={8} category="vip" />` (doc 01 section 5).
|
|
20
|
+
//
|
|
21
|
+
// Renders the theme's override of the view `id`, else the plugin's default, with `{...data, ...rest}`.
|
|
22
|
+
// `data` is per placement: `loadView` ran the view's `load(event, props)` once per distinct `blockKey`
|
|
23
|
+
// and returned it under that key, so the block reads `$page.data[blockKey(id, rest)]`. Two grids with
|
|
24
|
+
// different props get two data sets.
|
|
25
|
+
//
|
|
26
|
+
// - key missing from `$page.data` (a prop was not a literal, or the id is dynamic): the block calls the
|
|
27
|
+
// view's `load` in the browser after mount (the theme-core check warns about it, C7);
|
|
28
|
+
// - view not preloaded (client navigation to a page that places it): it is resolved after mount;
|
|
29
|
+
// - unknown id / plugin not installed: nothing, or the `fallback` snippet.
|
|
30
|
+
import { untrack } from "svelte";
|
|
31
|
+
import { page } from "$app/stores";
|
|
32
|
+
import { browser, dev } from "$app/environment";
|
|
33
|
+
import { getPanoContext } from "@panomc/sdk/internal";
|
|
34
|
+
import {
|
|
35
|
+
getDefault,
|
|
36
|
+
describeView,
|
|
37
|
+
getOverride,
|
|
38
|
+
hasView,
|
|
39
|
+
preloadViews,
|
|
40
|
+
resolveViewModule,
|
|
41
|
+
} from "$pano/registry/index.js";
|
|
42
|
+
import { blockKey, stableJson } from "$pano/registry/view.js";
|
|
43
|
+
|
|
44
|
+
let { id, fallback, ...rest } = $props();
|
|
45
|
+
|
|
46
|
+
// Bumped when a view that was not preloaded has been resolved after mount.
|
|
47
|
+
let resolvedAt = $state(0);
|
|
48
|
+
/** @type {{ key: string, data: object } | null} */
|
|
49
|
+
let loaded = $state(null);
|
|
50
|
+
|
|
51
|
+
const key = $derived(blockKey(id, rest));
|
|
52
|
+
const fromPage = $derived($page.data?.[key]);
|
|
53
|
+
const data = $derived(fromPage ?? (loaded && loaded.key === key ? loaded.data : undefined));
|
|
54
|
+
|
|
55
|
+
const Component = $derived.by(() => {
|
|
56
|
+
// read so a late preload re-evaluates the lookup below
|
|
57
|
+
resolvedAt;
|
|
58
|
+
|
|
59
|
+
const override = getOverride(id);
|
|
60
|
+
const Chosen = override ?? getDefault(id);
|
|
61
|
+
|
|
62
|
+
if (!Chosen) return null;
|
|
63
|
+
|
|
64
|
+
// `views.wrap` is the fallback-style hook of doc 03 (identity in a Bootstrap theme)
|
|
65
|
+
const wrap = getPanoContext().context?.views?.wrap;
|
|
66
|
+
|
|
67
|
+
return wrap?.(id, Chosen, override ? "override" : "default") ?? Chosen;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/** The little a block's `load(event, props)` needs in the browser (there is no SvelteKit event outside a load). */
|
|
71
|
+
function browserEvent(current) {
|
|
72
|
+
return {
|
|
73
|
+
url: current.url,
|
|
74
|
+
params: current.params,
|
|
75
|
+
route: current.route,
|
|
76
|
+
data: current.data,
|
|
77
|
+
fetch: (...args) => globalThis.fetch(...args),
|
|
78
|
+
parent: async () => current.data,
|
|
79
|
+
depends() {},
|
|
80
|
+
setHeaders() {},
|
|
81
|
+
untrack: (fn) => fn(),
|
|
82
|
+
isDataRequest: false,
|
|
83
|
+
isSubRequest: false,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
$effect(() => {
|
|
88
|
+
if (!browser) return;
|
|
89
|
+
|
|
90
|
+
const blockId = id;
|
|
91
|
+
const blockProps = untrack(() => JSON.parse(stableJson(rest)));
|
|
92
|
+
const blockKeyNow = key;
|
|
93
|
+
const hasData = fromPage !== undefined;
|
|
94
|
+
const current = untrack(() => $page);
|
|
95
|
+
let cancelled = false;
|
|
96
|
+
|
|
97
|
+
(async () => {
|
|
98
|
+
if (!getOverride(blockId) && !getDefault(blockId) && hasView(blockId)) {
|
|
99
|
+
await preloadViews([blockId]);
|
|
100
|
+
if (cancelled) return;
|
|
101
|
+
resolvedAt++;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (hasData) return;
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
const result = await resolveViewModule(blockId);
|
|
108
|
+
const load = result?.module?.load ?? result?.module?.default?.load;
|
|
109
|
+
|
|
110
|
+
if (typeof load !== "function") return;
|
|
111
|
+
|
|
112
|
+
// `load` runs only for a view that declares `block: true` (as `loadView` does on the server); any
|
|
113
|
+
// other view is still placed and rendered with its props, without data.
|
|
114
|
+
if (!describeView(blockId)?.block) {
|
|
115
|
+
if (dev) warnNotBlock(blockId);
|
|
116
|
+
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const output = await load(browserEvent(current), blockProps);
|
|
121
|
+
|
|
122
|
+
if (!cancelled) loaded = { key: blockKeyNow, data: output ?? {} };
|
|
123
|
+
} catch (e) {
|
|
124
|
+
console.warn(`[theme-core] load of block '${blockId}' failed`, e);
|
|
125
|
+
}
|
|
126
|
+
})();
|
|
127
|
+
|
|
128
|
+
return () => {
|
|
129
|
+
cancelled = true;
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{#each items as item (item.id)}
|
|
2
|
+
{@const Injected = injected(item)}
|
|
3
|
+
{#if Injected}
|
|
4
|
+
<Injected {...item.props} {...props} />
|
|
5
|
+
{/if}
|
|
6
|
+
{/each}
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
// `<PluginSlot id="market:checkout:payment" props={{ order }} filter={(item) => item.id === method} />`
|
|
10
|
+
// (doc 01 section 6): a slot a plugin view opens. Renders the views other plugins injected into it
|
|
11
|
+
// (`export const view = { slot: "market:checkout:payment" }`), in priority order. Items the theme
|
|
12
|
+
// claims or hides are already left out by `panoApi.ui.view.get`. An empty slot renders nothing.
|
|
13
|
+
//
|
|
14
|
+
// An injected view is a plugin view like any other: a default one gets the fallback scope of its plugin in a theme
|
|
15
|
+
// without Bootstrap, an override one gets a stop scope inside such a scope (`views.wrap`, doc 03 section 4.4).
|
|
16
|
+
import { panoApi } from "$pano/lib/PluginAPI.js";
|
|
17
|
+
import { getPanoContext } from "@panomc/sdk/internal";
|
|
18
|
+
|
|
19
|
+
let { id, props = {}, filter } = $props();
|
|
20
|
+
|
|
21
|
+
const store = $derived(panoApi.ui.view.get(id));
|
|
22
|
+
const items = $derived(typeof filter === "function" ? ($store ?? []).filter(filter) : ($store ?? []));
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The component of a resolved item (its `component` is the view module once the slot's load ran; a thunk that has
|
|
26
|
+
* not run yet renders nothing), wrapped by `views.wrap` when it names a view.
|
|
27
|
+
*/
|
|
28
|
+
function injected(item) {
|
|
29
|
+
const module = item.component;
|
|
30
|
+
|
|
31
|
+
if (!module || typeof module === "function") return null;
|
|
32
|
+
|
|
33
|
+
const Component = module.default || module;
|
|
34
|
+
const views = getPanoContext().context?.views;
|
|
35
|
+
|
|
36
|
+
if (typeof item.view !== "string" || !item.view || typeof views?.wrap !== "function") return Component;
|
|
37
|
+
|
|
38
|
+
return views.wrap(item.view, Component, views.getOverride?.(item.view) ? "override" : "default") ?? Component;
|
|
39
|
+
}
|
|
40
|
+
</script>
|