@panomc/theme-core 1.0.0-dev.60 → 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.
Files changed (308) hide show
  1. package/assets/css/pano-fallback-legacy.css +12381 -0
  2. package/assets/css/pano-fallback.css +3222 -0
  3. package/bin/__tests__/check/fixtures/plugin-contracts/market/controllers.json +4 -0
  4. package/bin/__tests__/check/fixtures/plugin-contracts/market/views.json +67 -0
  5. package/bin/__tests__/check/fixtures/routes.json +5 -0
  6. package/bin/__tests__/check/helpers.js +55 -0
  7. package/bin/__tests__/check/overrides.test.js +287 -0
  8. package/bin/__tests__/check/theme.test.js +332 -0
  9. package/bin/__tests__/cli/accept-and-list.test.js +159 -0
  10. package/bin/__tests__/cli/config-edit.test.js +213 -0
  11. package/bin/__tests__/cli/contracts-pull.test.js +187 -0
  12. package/bin/__tests__/cli/core-meta.test.js +305 -0
  13. package/bin/__tests__/cli/eject-view.test.js +356 -0
  14. package/bin/__tests__/cli/helpers.js +258 -0
  15. package/bin/__tests__/scaffold/scaffold.test.js +84 -0
  16. package/bin/bundle-internal-libs.js +14 -2
  17. package/bin/check.js +1150 -213
  18. package/bin/contracts.js +1643 -0
  19. package/bin/generate-contract.js +378 -0
  20. package/bin/generate-licenses.js +14 -2
  21. package/bin/generate-runtime-shims.js +27 -9
  22. package/bin/new.js +101 -2
  23. package/bin/package-zip.js +16 -2
  24. package/bin/sync.js +360 -7
  25. package/bin/theme-core.js +65 -107
  26. package/lang/en-US.json +1 -0
  27. package/lang/ru.json +1 -0
  28. package/lang/tr.json +1 -0
  29. package/package.json +7 -3
  30. package/skin-contract.json +864 -19
  31. package/src/kit/__tests__/hooks-server-fetch.test.js +56 -0
  32. package/src/kit/__tests__/route-map.test.js +154 -0
  33. package/src/kit/__tests__/theme-meta.test.js +249 -0
  34. package/src/kit/hooks-client.js +3 -0
  35. package/src/kit/hooks-server.js +79 -21
  36. package/src/kit/route-map.js +300 -0
  37. package/src/kit/specifiers.js +3 -0
  38. package/src/kit/svelte-config.js +3 -0
  39. package/src/kit/theme-meta.js +405 -0
  40. package/src/kit/vite-config.js +156 -12
  41. package/src/lib/NotificationManager.js +18 -0
  42. package/src/lib/PluginAPI.js +313 -9
  43. package/src/lib/Store.js +18 -5
  44. package/src/lib/__tests__/avatarVersion.test.js +25 -0
  45. package/src/lib/__tests__/check.test.js +201 -0
  46. package/src/lib/__tests__/controllerHost.test.js +363 -0
  47. package/src/lib/__tests__/cx03.test.js +245 -0
  48. package/src/lib/__tests__/engineBoot.test.js +151 -0
  49. package/src/lib/__tests__/engineParts.helper.js +284 -0
  50. package/src/lib/__tests__/engineParts.test.js +179 -0
  51. package/src/lib/__tests__/engineSidebars.helper.js +353 -0
  52. package/src/lib/__tests__/engineSidebars.test.js +273 -0
  53. package/src/lib/__tests__/engineStyles.test.js +227 -0
  54. package/src/lib/__tests__/engineWiring.test.js +1000 -0
  55. package/src/lib/__tests__/fallbackStyles.test.js +1254 -0
  56. package/src/lib/__tests__/fixtures/Probe.svelte +5 -0
  57. package/src/lib/__tests__/fixtures/engine-parts.ssr.json +29 -0
  58. package/src/lib/__tests__/fixtures/engine-sidebars.ssr.json +16 -0
  59. package/src/lib/__tests__/home.test.js +563 -0
  60. package/src/lib/__tests__/injectedScope.test.js +490 -0
  61. package/src/lib/__tests__/languageConcurrency.test.js +55 -0
  62. package/src/lib/__tests__/languageLayers.test.js +286 -0
  63. package/src/lib/__tests__/pageHead.test.js +167 -0
  64. package/src/lib/__tests__/pageMeta.util.test.js +216 -0
  65. package/src/lib/__tests__/pageTitle.util.test.js +96 -0
  66. package/src/lib/__tests__/pluginApiViews.test.js +529 -0
  67. package/src/lib/__tests__/plugins.test.js +53 -0
  68. package/src/lib/__tests__/profileNav.util.test.js +145 -0
  69. package/src/lib/__tests__/registryReady.test.js +26 -0
  70. package/src/lib/__tests__/returnTo.util.test.js +294 -0
  71. package/src/lib/__tests__/routeConfig.test.js +361 -0
  72. package/src/lib/__tests__/sidebarSpec.util.test.js +152 -0
  73. package/src/lib/__tests__/skinContract.test.js +558 -0
  74. package/src/lib/__tests__/svelteSsr.helper.js +68 -0
  75. package/src/lib/__tests__/tc03.test.js +427 -0
  76. package/src/lib/__tests__/tc11.test.js +184 -0
  77. package/src/lib/__tests__/translationLayers.test.js +161 -0
  78. package/src/lib/avatarVersion.js +39 -0
  79. package/src/lib/components/Breadcrumb.svelte +9 -40
  80. package/src/lib/components/Date.svelte +1 -1
  81. package/src/lib/components/DefaultToast.svelte +13 -3
  82. package/src/lib/components/FallbackLinks.svelte +28 -0
  83. package/src/lib/components/FallbackScope.svelte +24 -0
  84. package/src/lib/components/Footer.svelte +8 -8
  85. package/src/lib/components/Header.svelte +3 -3
  86. package/src/lib/components/Hook.svelte +12 -1
  87. package/src/lib/components/LoginFormBody.svelte +5 -5
  88. package/src/lib/components/Main.svelte +22 -47
  89. package/src/lib/components/Navbar.svelte +30 -29
  90. package/src/lib/components/NoContent.svelte +2 -2
  91. package/src/lib/components/NotificationContainer.svelte +31 -82
  92. package/src/lib/components/OnlineAdmins.svelte +3 -2
  93. package/src/lib/components/PageActions.svelte +1 -1
  94. package/src/lib/components/PageHead.svelte +50 -0
  95. package/src/lib/components/PageTitle.svelte +2 -2
  96. package/src/lib/components/Pagination.svelte +6 -6
  97. package/src/lib/components/PlayerHead.svelte +4 -4
  98. package/src/lib/components/PluginBlock.svelte +132 -0
  99. package/src/lib/components/PluginSlot.svelte +40 -0
  100. package/src/lib/components/Post.svelte +13 -230
  101. package/src/lib/components/Posts.svelte +7 -14
  102. package/src/lib/components/RegisterForm.svelte +12 -11
  103. package/src/lib/components/Sidebar.svelte +9 -7
  104. package/src/lib/components/TicketRow.svelte +8 -48
  105. package/src/lib/components/TicketStatus.svelte +10 -16
  106. package/src/lib/components/Tickets.svelte +8 -30
  107. package/src/lib/components/Toast.svelte +16 -14
  108. package/src/lib/components/ToastContainer.svelte +16 -9
  109. package/src/lib/components/ViewComponent.svelte +13 -1
  110. package/src/lib/components/modals/CloseTicketConfirmModal.svelte +15 -46
  111. package/src/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte +17 -39
  112. package/src/lib/components/modals/LogoutSessionConfirmModal.svelte +12 -30
  113. package/src/lib/components/sidebars/HomeSidebar.svelte +33 -284
  114. package/src/lib/components/sidebars/PlayerDetailSidebar.svelte +14 -63
  115. package/src/lib/components/sidebars/PluginSidebar.svelte +21 -0
  116. package/src/lib/components/sidebars/ProfileNavCard.svelte +24 -0
  117. package/src/lib/components/sidebars/ProfileSidebar.svelte +44 -84
  118. package/src/lib/components/sidebars/SupportSidebar.svelte +19 -22
  119. package/src/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte +23 -35
  120. package/src/lib/components/sidebars/profileNav.util.js +105 -0
  121. package/src/lib/components/sidebars/sidebarSpec.util.js +92 -0
  122. package/src/lib/controllerHost.js +261 -0
  123. package/src/lib/fallbackStyles.js +317 -0
  124. package/src/lib/home.js +202 -0
  125. package/src/lib/language.util.js +70 -37
  126. package/src/lib/layouts/AppLayout.svelte +16 -8
  127. package/src/lib/layouts/AuthLayout.svelte +6 -4
  128. package/src/lib/layouts/MainLayout.svelte +17 -12
  129. package/src/lib/layouts/ProfileLayout.svelte +6 -4
  130. package/src/lib/layouts/ThemeSettingsLayout.svelte +6 -4
  131. package/src/lib/layouts/TicketsLayout.svelte +6 -5
  132. package/src/lib/pageMeta.util.js +212 -0
  133. package/src/lib/pageShape.js +33 -0
  134. package/src/lib/pageTitle.util.js +32 -0
  135. package/src/lib/pages/ActivateEmailPage.svelte +2 -7
  136. package/src/lib/pages/ConfirmNewEmailPage.svelte +2 -7
  137. package/src/lib/pages/ErrorPage.svelte +5 -2
  138. package/src/lib/pages/HomePage.svelte +31 -8
  139. package/src/lib/pages/LoginPage.svelte +38 -41
  140. package/src/lib/pages/NotificationsPage.svelte +2 -7
  141. package/src/lib/pages/PlayerDetailPage.svelte +2 -7
  142. package/src/lib/pages/PostDetailPage.svelte +2 -7
  143. package/src/lib/pages/PreviewPostPage.svelte +2 -7
  144. package/src/lib/pages/RegisterPage.svelte +10 -13
  145. package/src/lib/pages/RenewPasswordPage.svelte +2 -7
  146. package/src/lib/pages/ResetPasswordPage.svelte +2 -7
  147. package/src/lib/pages/RulesPage.svelte +3 -8
  148. package/src/lib/pages/SupportPage.svelte +2 -7
  149. package/src/lib/pages/ThemeSettingsPage.svelte +2 -7
  150. package/src/lib/pages/profile/ProfilePage.svelte +2 -7
  151. package/src/lib/pages/profile/SettingsPage.svelte +2 -7
  152. package/src/lib/pages/profile/TicketsPage.svelte +2 -7
  153. package/src/lib/pages/ticket/CreateTicketPage.svelte +2 -7
  154. package/src/lib/pages/ticket/TicketDetailPage.svelte +2 -7
  155. package/src/lib/plugins.js +61 -0
  156. package/src/lib/returnTo.util.js +116 -0
  157. package/src/lib/services/auth.js +11 -11
  158. package/src/lib/services/posts.js +21 -10
  159. package/src/lib/services/profile.js +5 -5
  160. package/src/lib/services/theme-setting.js +1 -1
  161. package/src/lib/services/tickets.js +36 -15
  162. package/src/lib/siteRealtime.js +55 -8
  163. package/src/lib/themePageLoad.js +38 -0
  164. package/src/lib/translationLayers.js +144 -0
  165. package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +160 -6
  166. package/src/lib/ui-logics/layout-logics/AuthLayoutLogics.js +3 -2
  167. package/src/lib/ui-logics/layout-logics/ProfileLayoutLogics.js +3 -2
  168. package/src/lib/ui-logics/layout-logics/TicketsLayoutLogics.js +3 -2
  169. package/src/lib/ui-logics/page-logics/ActiveEmailPageLogics.js +4 -4
  170. package/src/lib/ui-logics/page-logics/ConfirmNewEmailPageLogics.js +4 -4
  171. package/src/lib/ui-logics/page-logics/CreateTicketPageLogics.js +5 -5
  172. package/src/lib/ui-logics/page-logics/HomePageLogics.js +5 -3
  173. package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +40 -16
  174. package/src/lib/ui-logics/page-logics/PlayerDetailPageLogics.js +3 -3
  175. package/src/lib/ui-logics/page-logics/PostDetailPageLogics.js +3 -3
  176. package/src/lib/ui-logics/page-logics/PreviewPostPageLogics.js +1 -1
  177. package/src/lib/ui-logics/page-logics/RenewPasswordPageLogics.js +4 -4
  178. package/src/lib/ui-logics/page-logics/ResetPasswordPageLogics.js +6 -6
  179. package/src/lib/ui-logics/page-logics/SettingsPageLogics.js +8 -8
  180. package/src/lib/ui-logics/page-logics/TicketDetailPageLogics.js +3 -3
  181. package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +5 -3
  182. package/src/lib/views/ActivateEmailView.samples.js +22 -0
  183. package/src/lib/views/ActivateEmailView.svelte +4 -4
  184. package/src/lib/views/AppLayoutView.samples.js +17 -0
  185. package/src/lib/views/AppLayoutView.svelte +1 -1
  186. package/src/lib/views/AuthLayoutView.samples.js +4 -0
  187. package/src/lib/views/AuthLayoutView.svelte +1 -1
  188. package/src/lib/views/Breadcrumb.samples.js +15 -0
  189. package/src/lib/views/CloseTicketConfirmModal.samples.js +12 -0
  190. package/src/lib/views/ConfirmNewEmailView.samples.js +22 -0
  191. package/src/lib/views/ConfirmNewEmailView.svelte +4 -4
  192. package/src/lib/views/ConfirmRemoveAllNotificationsModal.samples.js +9 -0
  193. package/src/lib/views/CreateTicketView.samples.js +21 -0
  194. package/src/lib/views/CreateTicketView.svelte +5 -5
  195. package/src/lib/views/Date.samples.js +9 -0
  196. package/src/lib/views/DefaultToast.samples.js +7 -0
  197. package/src/lib/views/ErrorView.samples.js +8 -0
  198. package/src/lib/views/ErrorView.svelte +4 -2
  199. package/src/lib/views/Footer.samples.js +8 -0
  200. package/src/lib/views/Header.samples.js +8 -0
  201. package/src/lib/views/HomeSidebar.samples.js +59 -0
  202. package/src/lib/views/HomeView.samples.js +34 -0
  203. package/src/lib/views/HomeView.svelte +14 -6
  204. package/src/lib/views/LoginFormBody.samples.js +8 -0
  205. package/src/lib/views/LoginView.samples.js +50 -0
  206. package/src/lib/views/LoginView.svelte +24 -22
  207. package/src/lib/views/LogoutSessionConfirmModal.samples.js +8 -0
  208. package/src/lib/views/Main.samples.js +23 -0
  209. package/src/lib/views/MainLayoutView.svelte +3 -4
  210. package/src/lib/views/Navbar.samples.js +8 -0
  211. package/src/lib/views/NoContent.samples.js +7 -0
  212. package/src/lib/views/NotificationContainer.samples.js +25 -0
  213. package/src/lib/views/NotificationsView.samples.js +36 -0
  214. package/src/lib/views/NotificationsView.svelte +21 -12
  215. package/src/lib/views/PageActions.samples.js +7 -0
  216. package/src/lib/views/PageTitle.samples.js +8 -0
  217. package/src/lib/views/Pagination.samples.js +7 -0
  218. package/src/lib/views/PlayerDetailSidebar.samples.js +35 -0
  219. package/src/lib/views/PlayerDetailView.samples.js +8 -0
  220. package/src/lib/views/PlayerDetailView.svelte +3 -3
  221. package/src/lib/views/PlayerHead.samples.js +8 -0
  222. package/src/lib/views/Post.samples.js +10 -0
  223. package/src/lib/views/PostDetailView.samples.js +28 -0
  224. package/src/lib/views/PostDetailView.svelte +24 -16
  225. package/src/lib/views/Posts.samples.js +9 -0
  226. package/src/lib/views/PreviewPostView.samples.js +20 -0
  227. package/src/lib/views/PreviewPostView.svelte +10 -10
  228. package/src/lib/views/ProfileLayoutView.samples.js +4 -0
  229. package/src/lib/views/ProfileSidebar.samples.js +33 -0
  230. package/src/lib/views/ProfileView.samples.js +29 -0
  231. package/src/lib/views/ProfileView.svelte +2 -2
  232. package/src/lib/views/RegisterForm.samples.js +7 -0
  233. package/src/lib/views/RegisterView.samples.js +28 -0
  234. package/src/lib/views/RegisterView.svelte +5 -3
  235. package/src/lib/views/RenewPasswordView.samples.js +24 -0
  236. package/src/lib/views/RenewPasswordView.svelte +6 -6
  237. package/src/lib/views/ResetPasswordView.samples.js +24 -0
  238. package/src/lib/views/ResetPasswordView.svelte +3 -3
  239. package/src/lib/views/RulesView.samples.js +14 -0
  240. package/src/lib/views/RulesView.svelte +3 -3
  241. package/src/lib/views/SettingsView.svelte +48 -17
  242. package/src/lib/views/Sidebar.samples.js +7 -0
  243. package/src/lib/views/SupportSidebar.samples.js +24 -0
  244. package/src/lib/views/SupportView.samples.js +16 -0
  245. package/src/lib/views/SupportView.svelte +8 -6
  246. package/src/lib/views/ThemeSettingsLayoutView.samples.js +9 -0
  247. package/src/lib/views/ThemeSettingsLayoutView.svelte +1 -1
  248. package/src/lib/views/ThemeSettingsView.svelte +89 -89
  249. package/src/lib/views/TicketCreateAndDetailSidebar.samples.js +33 -0
  250. package/src/lib/views/TicketDetailView.samples.js +34 -0
  251. package/src/lib/views/TicketDetailView.svelte +17 -15
  252. package/src/lib/views/TicketRow.samples.js +10 -0
  253. package/src/lib/views/TicketStatus.samples.js +8 -0
  254. package/src/lib/views/Tickets.samples.js +9 -0
  255. package/src/lib/views/TicketsLayoutView.samples.js +4 -0
  256. package/src/lib/views/TicketsView.samples.js +23 -0
  257. package/src/lib/views/TicketsView.svelte +11 -9
  258. package/src/lib/views/Toast.samples.js +9 -0
  259. package/src/lib/views/ToastContainer.samples.js +8 -0
  260. package/src/lib/views/parts/Breadcrumb.svelte +53 -0
  261. package/src/lib/views/parts/CloseTicketConfirmModal.svelte +63 -0
  262. package/src/lib/views/parts/ConfirmRemoveAllNotificationsModal.svelte +55 -0
  263. package/src/lib/views/parts/DefaultToast.svelte +22 -0
  264. package/src/lib/views/parts/HomeSidebar.svelte +334 -0
  265. package/src/lib/views/parts/LogoutSessionConfirmModal.svelte +46 -0
  266. package/src/lib/views/parts/Main.svelte +71 -0
  267. package/src/lib/views/parts/NotificationContainer.svelte +109 -0
  268. package/src/lib/views/parts/PlayerDetailSidebar.svelte +81 -0
  269. package/src/lib/views/parts/Post.svelte +255 -0
  270. package/src/lib/views/parts/Posts.svelte +25 -0
  271. package/src/lib/views/parts/ProfileSidebar.svelte +115 -0
  272. package/src/lib/views/parts/Sidebar.svelte +19 -0
  273. package/src/lib/views/parts/SupportSidebar.svelte +34 -0
  274. package/src/lib/views/parts/TicketCreateAndDetailSidebar.svelte +51 -0
  275. package/src/lib/views/parts/TicketRow.svelte +63 -0
  276. package/src/lib/views/parts/TicketStatus.svelte +24 -0
  277. package/src/lib/views/parts/Tickets.svelte +45 -0
  278. package/src/lib/views/parts/Toast.svelte +27 -0
  279. package/src/lib/views/parts/ToastContainer.svelte +17 -0
  280. package/src/lib/views/parts/engine-views.generated.js +63 -0
  281. package/src/lib/views/parts/publicHref.js +18 -0
  282. package/src/lib/views/parts/ticketStatuses.js +7 -0
  283. package/src/plugin-engine/__tests__/engine.test.js +161 -0
  284. package/src/plugin-engine/engine.js +80 -12
  285. package/src/registry/__tests__/registry.test.js +510 -0
  286. package/src/registry/__tests__/view.test.js +52 -0
  287. package/src/registry/index.js +700 -51
  288. package/src/registry/routes.js +62 -0
  289. package/src/registry/view.js +69 -0
  290. package/src/routes/RootLayout.svelte +24 -1
  291. package/src/routes/catalogue/List.svelte +163 -0
  292. package/src/routes/catalogue/Stage.svelte +355 -0
  293. package/src/routes/catalogue/__tests__/browserSafe.test.js +13 -0
  294. package/src/routes/catalogue/__tests__/catalogue.test.js +539 -0
  295. package/src/routes/catalogue/catalogue.js +129 -0
  296. package/src/routes/catalogue/deps.js +147 -0
  297. package/src/routes/catalogue/engineSamples.js +63 -0
  298. package/src/routes/catalogue/fixtures.js +77 -0
  299. package/src/routes/catalogue/list.js +37 -0
  300. package/src/routes/catalogue/model.js +286 -0
  301. package/src/routes/catalogue/stage.js +69 -0
  302. package/src/routes/catalogue/views-json.js +24 -0
  303. package/src/routes/plugin-ui/Layout.svelte +29 -4
  304. package/src/routes/plugin-ui/Page.svelte +86 -31
  305. package/src/routes/plugin-ui/load.js +173 -0
  306. package/src/routes/plugins-client-file.js +8 -3
  307. package/src/routes/plugins-ui-file.js +60 -0
  308. package/src/routes/root-layout-load.js +59 -2
@@ -2,7 +2,7 @@
2
2
 
3
3
  <script context="module">
4
4
  import { processLoad } from "$pano/lib/ui-logics/page-logics/PlayerDetailPageLogics";
5
- import { resolveView } from "$pano/registry/index.js";
5
+ import { loadView } from "$pano/registry/index.js";
6
6
 
7
7
  /**
8
8
  * @type {import('@sveltejs/kit').Load}
@@ -11,14 +11,9 @@
11
11
  // Resolved in load (not {#await} in markup): universal load data is not
12
12
  // serialized, so the component class can travel in it, and SSR renders the
13
13
  // view instead of an await-pending branch.
14
- const viewPromise = resolveView(
15
- "PlayerDetailView",
16
- () => import("../views/PlayerDetailView.svelte"),
17
- );
18
-
19
14
  const loadData = await processLoad(event);
20
15
 
21
- return { ...loadData, View: await viewPromise };
16
+ return { ...loadData, ...(await loadView(event, "PlayerDetailView", () => import("../views/PlayerDetailView.svelte"))) };
22
17
  }
23
18
  </script>
24
19
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <script context="module">
4
4
  import { processLoad } from "$pano/lib/ui-logics/page-logics/PostDetailPageLogics";
5
- import { resolveView } from "$pano/registry/index.js";
5
+ import { loadView } from "$pano/registry/index.js";
6
6
 
7
7
  /**
8
8
  * @type {import('@sveltejs/kit').Load}
@@ -11,14 +11,9 @@
11
11
  // Resolved in load (not {#await} in markup): universal load data is not
12
12
  // serialized, so the component class can travel in it, and SSR renders the
13
13
  // view instead of an await-pending branch.
14
- const viewPromise = resolveView(
15
- "PostDetailView",
16
- () => import("../views/PostDetailView.svelte"),
17
- );
18
-
19
14
  const data = await processLoad(event);
20
15
 
21
- return { ...data, View: await viewPromise };
16
+ return { ...data, ...(await loadView(event, "PostDetailView", () => import("../views/PostDetailView.svelte"))) };
22
17
  }
23
18
  </script>
24
19
 
@@ -10,20 +10,15 @@
10
10
  * @type {import("@sveltejs/kit").Load}
11
11
  */
12
12
  import { processLoad } from "$pano/lib/ui-logics/page-logics/PreviewPostPageLogics";
13
- import { resolveView } from "$pano/registry/index.js";
13
+ import { loadView } from "$pano/registry/index.js";
14
14
 
15
15
  export async function load(event) {
16
16
  // Resolved in load (not {#await} in markup): universal load data is not
17
17
  // serialized, so the component class can travel in it, and SSR renders the
18
18
  // view instead of an await-pending branch.
19
- const viewPromise = resolveView(
20
- "PreviewPostView",
21
- () => import("../views/PreviewPostView.svelte"),
22
- );
23
-
24
19
  const loadData = await processLoad(event);
25
20
 
26
- return { ...loadData, View: await viewPromise };
21
+ return { ...loadData, ...(await loadView(event, "PreviewPostView", () => import("../views/PreviewPostView.svelte"))) };
27
22
  }
28
23
  </script>
29
24
 
@@ -15,17 +15,12 @@
15
15
 
16
16
  <script context="module">
17
17
  import { executeLifecycle, executeViewLoad, panoApiServer } from "$pano/lib/PluginAPI";
18
- import { resolveView } from "$pano/registry/index.js";
18
+ import { loadView } from "$pano/registry/index.js";
19
19
 
20
20
  export async function load(event) {
21
21
  // Resolved in load (not {#await} in markup): universal load data is not
22
22
  // serialized, so the component class can travel in it, and SSR renders the
23
23
  // view instead of an await-pending branch.
24
- const viewPromise = resolveView(
25
- "RegisterView",
26
- () => import("../views/RegisterView.svelte"),
27
- );
28
-
29
24
  const { parent } = event;
30
25
  await parent();
31
26
 
@@ -43,15 +38,16 @@
43
38
  initialError: lifecycleData.error || null,
44
39
  initialUsername: lifecycleData.username || null,
45
40
  pageTitle: "components.modals.register.title",
46
- View: await viewPromise
41
+ ...(await loadView(event, "RegisterView", () => import("../views/RegisterView.svelte")))
47
42
  };
48
43
  }
49
44
  </script>
50
45
 
51
46
  <script>
52
47
  import { getContext, onMount } from "svelte";
53
- import { writable } from "svelte/store";
48
+ import { get, writable } from "svelte/store";
54
49
  import { goto } from "$app/navigation";
50
+ import { page } from "$app/stores";
55
51
 
56
52
  import { NETWORK_ERROR } from "$pano/lib/api.util";
57
53
 
@@ -60,6 +56,7 @@
60
56
 
61
57
  import { sendRegister, getCredentials } from "$pano/lib/services/auth.js";
62
58
  import { panoApiClient } from "$pano/lib/PluginAPI.js";
59
+ import { returnToFromUrl } from "$pano/lib/returnTo.util.js";
63
60
 
64
61
  export let data;
65
62
 
@@ -97,7 +94,7 @@
97
94
  recaptcha: "",
98
95
  })
99
96
  .then(async (body) => {
100
- if (body.result === "ok") {
97
+ if (!body.error) {
101
98
  if (body.login) {
102
99
  const csrfToken = body.csrfToken;
103
100
  const credsBody = await getCredentials(csrfToken);
@@ -116,7 +113,7 @@
116
113
  });
117
114
 
118
115
  await showSuccessToast("successes.LOGIN_SUCCESSFUL");
119
- await goto("/");
116
+ await goto(returnToFromUrl(get(page).url));
120
117
  loading.set(false);
121
118
  return;
122
119
  }
@@ -124,10 +121,10 @@
124
121
  successMessage.set("REGISTER_SUCCESSFUL");
125
122
  loading.set(false);
126
123
  } else {
127
- if (body.error === "PLUGIN_DENIED_LOGIN" && body.reason) {
128
- error.set(body.reason);
124
+ if (body.error.code === "PLUGIN_DENIED_LOGIN" && body.error.details?.reason) {
125
+ error.set(body.error.details.reason);
129
126
  } else {
130
- error.set(body.result === "error" ? body.error : NETWORK_ERROR);
127
+ error.set(body.error.code || NETWORK_ERROR);
131
128
  }
132
129
  loading.set(false);
133
130
  }
@@ -11,7 +11,7 @@
11
11
 
12
12
  <script context="module">
13
13
  import { processLoad } from "$pano/lib/ui-logics/page-logics/RenewPasswordPageLogics";
14
- import { resolveView } from "$pano/registry/index.js";
14
+ import { loadView } from "$pano/registry/index.js";
15
15
 
16
16
  /**
17
17
  * @type {import('@sveltejs/kit').PageLoad}
@@ -20,14 +20,9 @@
20
20
  // Resolved in load (not {#await} in markup): universal load data is not
21
21
  // serialized, so the component class can travel in it, and SSR renders the
22
22
  // view instead of an await-pending branch.
23
- const viewPromise = resolveView(
24
- "RenewPasswordView",
25
- () => import("../views/RenewPasswordView.svelte"),
26
- );
27
-
28
23
  const loadData = await processLoad(event);
29
24
 
30
- return { ...loadData, View: await viewPromise };
25
+ return { ...loadData, ...(await loadView(event, "RenewPasswordView", () => import("../views/RenewPasswordView.svelte"))) };
31
26
  }
32
27
  </script>
33
28
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  <script context="module">
13
13
  import { processLoad } from "$pano/lib/ui-logics/page-logics/ResetPasswordPageLogics";
14
- import { resolveView } from "$pano/registry/index.js";
14
+ import { loadView } from "$pano/registry/index.js";
15
15
 
16
16
  /**
17
17
  * @type {import('@sveltejs/kit').LayoutLoad}
@@ -20,14 +20,9 @@
20
20
  // Resolved in load (not {#await} in markup): universal load data is not
21
21
  // serialized, so the component class can travel in it, and SSR renders the
22
22
  // view instead of an await-pending branch.
23
- const viewPromise = resolveView(
24
- "ResetPasswordView",
25
- () => import("../views/ResetPasswordView.svelte"),
26
- );
27
-
28
23
  const loadData = await processLoad(event);
29
24
 
30
- return { ...loadData, View: await viewPromise };
25
+ return { ...loadData, ...(await loadView(event, "ResetPasswordView", () => import("../views/ResetPasswordView.svelte"))) };
31
26
  }
32
27
  </script>
33
28
 
@@ -4,7 +4,7 @@
4
4
  import { error } from "@sveltejs/kit";
5
5
 
6
6
  import ApiUtil from "$pano/lib/api.util";
7
- import { resolveView } from "$pano/registry/index.js";
7
+ import { loadView } from "$pano/registry/index.js";
8
8
 
9
9
  /**
10
10
  * @type {import("@sveltejs/kit").PageLoad}
@@ -13,11 +13,6 @@
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
- "RulesView",
18
- () => import("../views/RulesView.svelte"),
19
- );
20
-
21
16
  const parentData = await event.parent();
22
17
  const session = parentData.session;
23
18
 
@@ -29,7 +24,7 @@
29
24
  let registerAgreement;
30
25
  try {
31
26
  const body = await ApiUtil.get({
32
- path: "/api/registerAgreement",
27
+ path: "/register-agreement",
33
28
  request: event,
34
29
  csrfToken
35
30
  });
@@ -42,7 +37,7 @@
42
37
  ...parentData,
43
38
  pageTitle: "pages.rules.title",
44
39
  registerAgreement,
45
- View: await viewPromise
40
+ ...(await loadView(event, "RulesView", () => import("../views/RulesView.svelte")))
46
41
  };
47
42
  }
48
43
  </script>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <script context="module">
4
4
  import { processLoad } from "$pano/lib/ui-logics/page-logics/SupportPageLogics";
5
- import { resolveView } from "$pano/registry/index.js";
5
+ import { loadView } from "$pano/registry/index.js";
6
6
 
7
7
  /**
8
8
  * @type {import('@sveltejs/kit').Load}
@@ -11,14 +11,9 @@
11
11
  // Resolved in load (not {#await} in markup): universal load data is not
12
12
  // serialized, so the component class can travel in it, and SSR renders the
13
13
  // view instead of an await-pending branch.
14
- const viewPromise = resolveView(
15
- "SupportView",
16
- () => import("../views/SupportView.svelte"),
17
- );
18
-
19
14
  const loadData = await processLoad(event);
20
15
 
21
- return { ...loadData, View: await viewPromise };
16
+ return { ...loadData, ...(await loadView(event, "SupportView", () => import("../views/SupportView.svelte"))) };
22
17
  }
23
18
  </script>
24
19
 
@@ -38,7 +38,7 @@
38
38
 
39
39
  <script context="module">
40
40
  import { writable } from "svelte/store";
41
- import { resolveView } from "$pano/registry/index.js";
41
+ import { loadView } from "$pano/registry/index.js";
42
42
 
43
43
  /**
44
44
  * @type {import("@sveltejs/kit").Load}
@@ -47,15 +47,10 @@
47
47
  // Resolved in load (not {#await} in markup): universal load data is not
48
48
  // serialized, so the component class can travel in it, and SSR renders the
49
49
  // view instead of an await-pending branch.
50
- const viewPromise = resolveView(
51
- "ThemeSettingsView",
52
- () => import("../views/ThemeSettingsView.svelte"),
53
- );
54
-
55
50
  const { parent } = event;
56
51
 
57
52
  const { themeSettings } = await parent();
58
- return { themeSettings, View: await viewPromise };
53
+ return { themeSettings, ...(await loadView(event, "ThemeSettingsView", () => import("../views/ThemeSettingsView.svelte"))) };
59
54
  }
60
55
  </script>
61
56
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <script context="module">
4
4
  import { processLoad } from "$pano/lib/ui-logics/page-logics/ProfilePageLogics";
5
- import { resolveView } from "$pano/registry/index.js";
5
+ import { loadView } from "$pano/registry/index.js";
6
6
 
7
7
  /**
8
8
  * @type {import('@sveltejs/kit').Load}
@@ -11,14 +11,9 @@
11
11
  // Resolved in load (not {#await} in markup): universal load data is not
12
12
  // serialized, so the component class can travel in it, and SSR renders the
13
13
  // view instead of an await-pending branch.
14
- const viewPromise = resolveView(
15
- "ProfileView",
16
- () => import("../../views/ProfileView.svelte"),
17
- );
18
-
19
14
  const loadData = await processLoad(event);
20
15
 
21
- return { ...loadData, View: await viewPromise };
16
+ return { ...loadData, ...(await loadView(event, "ProfileView", () => import("../../views/ProfileView.svelte"))) };
22
17
  }
23
18
  </script>
24
19
 
@@ -36,7 +36,7 @@
36
36
 
37
37
  <script context="module">
38
38
  import { processLoad } from "$pano/lib/ui-logics/page-logics/SettingsPageLogics";
39
- import { resolveView } from "$pano/registry/index.js";
39
+ import { loadView } from "$pano/registry/index.js";
40
40
 
41
41
  /**
42
42
  * @type {import('@sveltejs/kit').Load}
@@ -45,14 +45,9 @@
45
45
  // Resolved in load (not {#await} in markup): universal load data is not
46
46
  // serialized, so the component class can travel in it, and SSR renders the
47
47
  // view instead of an await-pending branch.
48
- const viewPromise = resolveView(
49
- "SettingsView",
50
- () => import("../../views/SettingsView.svelte"),
51
- );
52
-
53
48
  const loadData = await processLoad(event);
54
49
 
55
- return { ...loadData, View: await viewPromise };
50
+ return { ...loadData, ...(await loadView(event, "SettingsView", () => import("../../views/SettingsView.svelte"))) };
56
51
  }
57
52
  </script>
58
53
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  <script context="module">
11
11
  import { processLoad } from "$pano/lib/ui-logics/page-logics/TicketsPageLogics";
12
- import { resolveView } from "$pano/registry/index.js";
12
+ import { loadView } from "$pano/registry/index.js";
13
13
 
14
14
  /**
15
15
  * @type {import('@sveltejs/kit').Load}
@@ -18,14 +18,9 @@
18
18
  // Resolved in load (not {#await} in markup): universal load data is not
19
19
  // serialized, so the component class can travel in it, and SSR renders the
20
20
  // view instead of an await-pending branch.
21
- const viewPromise = resolveView(
22
- "TicketsView",
23
- () => import("../../views/TicketsView.svelte"),
24
- );
25
-
26
21
  const loadData = await processLoad(event);
27
22
 
28
- return { ...loadData, View: await viewPromise };
23
+ return { ...loadData, ...(await loadView(event, "TicketsView", () => import("../../views/TicketsView.svelte"))) };
29
24
  }
30
25
  </script>
31
26
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  <script context="module">
12
12
  import { processLoad } from "$pano/lib/ui-logics/page-logics/CreateTicketPageLogics.js";
13
- import { resolveView } from "$pano/registry/index.js";
13
+ import { loadView } from "$pano/registry/index.js";
14
14
 
15
15
  /**
16
16
  * @type {import('@sveltejs/kit').Load}
@@ -19,14 +19,9 @@
19
19
  // Resolved in load (not {#await} in markup): universal load data is not
20
20
  // serialized, so the component class can travel in it, and SSR renders the
21
21
  // view instead of an await-pending branch.
22
- const viewPromise = resolveView(
23
- "CreateTicketView",
24
- () => import("../../views/CreateTicketView.svelte"),
25
- );
26
-
27
22
  const result = await processLoad(event);
28
23
 
29
- return { ...result, View: await viewPromise };
24
+ return { ...result, ...(await loadView(event, "CreateTicketView", () => import("../../views/CreateTicketView.svelte"))) };
30
25
  }
31
26
  </script>
32
27
 
@@ -15,7 +15,7 @@
15
15
 
16
16
  <script context="module">
17
17
  import { processLoad } from "$pano/lib/ui-logics/page-logics/TicketDetailPageLogics.js";
18
- import { resolveView } from "$pano/registry/index.js";
18
+ import { loadView } from "$pano/registry/index.js";
19
19
 
20
20
  /**
21
21
  * @type {import('@sveltejs/kit').Load}
@@ -24,14 +24,9 @@
24
24
  // Resolved in load (not {#await} in markup): universal load data is not
25
25
  // serialized, so the component class can travel in it, and SSR renders the
26
26
  // view instead of an await-pending branch.
27
- const viewPromise = resolveView(
28
- "TicketDetailView",
29
- () => import("../../views/TicketDetailView.svelte"),
30
- );
31
-
32
27
  const loadData = await processLoad(event);
33
28
 
34
- return { ...loadData, View: await viewPromise };
29
+ return { ...loadData, ...(await loadView(event, "TicketDetailView", () => import("../../views/TicketDetailView.svelte"))) };
35
30
  }
36
31
  </script>
37
32
 
@@ -0,0 +1,61 @@
1
+ // "Is plugin X installed?" for theme code (`$pano/lib/plugins.js`).
2
+ //
3
+ // The answer is `siteInfo.plugins` (GET /api/v1/site-info): one entry per installed AND running plugin, keyed by the
4
+ // full plugin id, `{ version: string | null, uiHash: string, dependencies: string[] }`. It is the same object the layout
5
+ // already carries in `session.siteInfo`, so these helpers take it as an argument and keep no state of their own: that
6
+ // is what makes them safe during SSR (nothing is shared between requests) and reactive in a component (pass the store
7
+ // value, `$session.siteInfo`, and the markup follows the store). The plugin list is read once per page load and changes
8
+ // only when the site info is reloaded (a plugin is installed or switched on by restarting Pano).
9
+ import { pluginIdOf } from "@panomc/sdk/core/js/ControllerRegistry.js";
10
+
11
+ /** @typedef {{ version: string | null, uiHash: string, dependencies: string[] }} PluginEntry */
12
+
13
+ const has = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
14
+
15
+ /**
16
+ * The key of `idOrNamespace` in the plugins map, or null. The full plugin id (`pano-plugin-market`) is canonical;
17
+ * the short namespace (`market`) is accepted too, resolved like `plugin('market')` does: the namespace the plugin
18
+ * registered its controllers under, else `pano-plugin-<namespace>`.
19
+ * @param {Record<string, PluginEntry> | null | undefined} plugins
20
+ * @param {unknown} idOrNamespace
21
+ * @returns {string | null}
22
+ */
23
+ function keyOf(plugins, idOrNamespace) {
24
+ if (!plugins || typeof plugins !== "object" || typeof idOrNamespace !== "string" || !idOrNamespace) return null;
25
+
26
+ if (has(plugins, idOrNamespace)) return idOrNamespace;
27
+
28
+ const registered = pluginIdOf(idOrNamespace);
29
+ if (registered && has(plugins, registered)) return registered;
30
+
31
+ const conventional = `pano-plugin-${idOrNamespace}`;
32
+ return has(plugins, conventional) ? conventional : null;
33
+ }
34
+
35
+ /**
36
+ * The site info entry of an installed, running plugin (`{ version, uiHash, dependencies }`), or null.
37
+ * @param {{ plugins?: Record<string, PluginEntry> } | null | undefined} siteInfo `session.siteInfo`
38
+ * @param {string} idOrNamespace `"pano-plugin-market"` (canonical) or `"market"`
39
+ * @returns {PluginEntry | null}
40
+ */
41
+ export function pluginInfo(siteInfo, idOrNamespace) {
42
+ const plugins = siteInfo?.plugins;
43
+ const key = keyOf(plugins, idOrNamespace);
44
+ return key === null ? null : plugins[key];
45
+ }
46
+
47
+ /**
48
+ * True when the plugin is installed and running. False for an unknown plugin and while there is no site info yet.
49
+ * @example
50
+ * // in a +page.js / load()
51
+ * const { session } = await parent();
52
+ * const shop = hasPlugin(session.siteInfo, "market");
53
+ * // in a component
54
+ * {#if hasPlugin($session.siteInfo, "pano-plugin-market")} ... {/if}
55
+ * @param {{ plugins?: Record<string, PluginEntry> } | null | undefined} siteInfo `session.siteInfo`
56
+ * @param {string} idOrNamespace `"pano-plugin-market"` (canonical) or `"market"`
57
+ * @returns {boolean}
58
+ */
59
+ export function hasPlugin(siteInfo, idOrNamespace) {
60
+ return keyOf(siteInfo?.plugins, idOrNamespace) !== null;
61
+ }
@@ -0,0 +1,116 @@
1
+ // Pure helpers for the login return URL (`/login?redirect=<site-relative target>`).
2
+ // No framework imports: this module is shared by the SvelteKit load functions, the login /
3
+ // register pages, `pano.auth` and the unit tests.
4
+
5
+ const BASE = "http://pano.invalid";
6
+ const MAX_LENGTH = 2048;
7
+
8
+ // The auth route set of `bin/sync.js`. A return target inside it would loop (or land on a page
9
+ // that bounces a logged-in visitor away), so it falls back instead.
10
+ const AUTH_PATHS = [
11
+ "/login",
12
+ "/register",
13
+ "/reset-password",
14
+ "/renew-password",
15
+ "/activate",
16
+ "/activate-new-email",
17
+ ];
18
+
19
+ function safeDecode(value) {
20
+ try {
21
+ return decodeURIComponent(value);
22
+ } catch {
23
+ return value;
24
+ }
25
+ }
26
+
27
+ function isAuthPath(pathname) {
28
+ // Check the raw and the decoded form: the router matches the decoded path, so `/%6Cogin` is `/login`.
29
+ return [pathname, safeDecode(pathname)].some((candidate) => {
30
+ const lower = candidate.toLowerCase();
31
+ return AUTH_PATHS.some((p) => lower === p || lower.startsWith(`${p}/`));
32
+ });
33
+ }
34
+
35
+ /**
36
+ * @param {unknown} value
37
+ * @param {string} [fallback]
38
+ * @returns {string} a safe site-relative target, or `fallback`.
39
+ */
40
+ export function sanitizeReturnTo(value, fallback = "/") {
41
+ if (typeof value !== "string") return fallback;
42
+ if (value.length < 1 || value.length > MAX_LENGTH) return fallback;
43
+ if (value[0] !== "/") return fallback;
44
+ if (value[1] === "/" || value[1] === "\\") return fallback;
45
+
46
+ for (let i = 0; i < value.length; i++) {
47
+ const code = value.charCodeAt(i);
48
+ if (code === 0x5c || code <= 0x1f || code === 0x7f) return fallback;
49
+ }
50
+
51
+ let parsed;
52
+ try {
53
+ parsed = new URL(value, BASE);
54
+ } catch {
55
+ return fallback;
56
+ }
57
+
58
+ if (parsed.origin !== BASE) return fallback;
59
+ if (isAuthPath(parsed.pathname)) return fallback;
60
+
61
+ // Dot-segment removal can create a leading `//` (`/.//evil.com` -> `//evil.com`), which the
62
+ // browser reads as a protocol-relative URL: validate the normalised form too.
63
+ const out = parsed.pathname + parsed.search + parsed.hash;
64
+ if (out[0] !== "/" || out[1] === "/" || out[1] === "\\" || out.includes("\\")) return fallback;
65
+
66
+ return out;
67
+ }
68
+
69
+ /**
70
+ * @param {unknown} returnTo
71
+ * @returns {string} `/login` or `/login?redirect=<encoded target>`
72
+ */
73
+ export function buildLoginUrl(returnTo) {
74
+ const safe = sanitizeReturnTo(returnTo);
75
+
76
+ return safe === "/" ? "/login" : `/login?redirect=${encodeURIComponent(safe)}`;
77
+ }
78
+
79
+ /**
80
+ * Reads `?redirect=` from a URL (a `URL`, a string, or anything with `searchParams`).
81
+ * @param {URL | string | { searchParams?: URLSearchParams } | null | undefined} url
82
+ * @param {string} [fallback]
83
+ */
84
+ export function returnToFromUrl(url, fallback = "/") {
85
+ if (url === null || url === undefined) return fallback;
86
+
87
+ let params;
88
+ try {
89
+ if (typeof url === "string") {
90
+ params = new URL(url, BASE).searchParams;
91
+ } else if (url.searchParams) {
92
+ params = url.searchParams;
93
+ } else {
94
+ return fallback;
95
+ }
96
+ } catch {
97
+ return fallback;
98
+ }
99
+
100
+ return sanitizeReturnTo(params.get("redirect"), fallback);
101
+ }
102
+
103
+ /**
104
+ * Where a guest on a `loginRequired` plugin page must be sent, or `null` when no redirect is due.
105
+ * @param {{ loginRequired?: boolean } | null | undefined} registeredPage
106
+ * @param {unknown} user the session user (falsy for a guest)
107
+ * @param {{ pathname: string, search?: string }} url
108
+ * @returns {string | null}
109
+ */
110
+ export function loginRedirectFor(registeredPage, user, url) {
111
+ if (registeredPage?.loginRequired && !user) {
112
+ return buildLoginUrl(url.pathname + (url.search ?? ""));
113
+ }
114
+
115
+ return null;
116
+ }