@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.
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 +8 -9
  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 -62
  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
@@ -0,0 +1,21 @@
1
+ <Sidebar {side}>
2
+ <div class="vstack gap-3">
3
+ {#each items as item (item.id)}
4
+ <ViewComponent component={item.component} {...item.props} />
5
+ {/each}
6
+ </div>
7
+ </Sidebar>
8
+
9
+ <script>
10
+ import { fromStore } from "svelte/store";
11
+
12
+ import { panoApi } from "$pano/lib/PluginAPI";
13
+ import Sidebar from "$pano/lib/components/Sidebar.svelte";
14
+ import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
15
+
16
+ // Generic engine sidebar for plugin pages (`sidebar: "plugin:<sidebarId>"`): renders the items
17
+ // other plugins contributed with `pano.ui.sidebar.register({ sidebarId, id, component, priority })`.
18
+ let { side = "right", sidebarId } = $props();
19
+
20
+ const items = $derived(fromStore(panoApi.ui.sidebar.get(sidebarId)).current ?? []);
21
+ </script>
@@ -0,0 +1,24 @@
1
+ <div class="card">
2
+ <div class="list-group list-group-flush">
3
+ {#each entries as entry (entry.id)}
4
+ <a
5
+ class="list-group-item list-group-item-action d-flex align-items-center"
6
+ class:active={entry.active}
7
+ aria-current={entry.active ? "page" : undefined}
8
+ href={entry.href}>
9
+ {#if entry.icon}
10
+ <i class="{entry.icon} fa-fw me-2" aria-hidden="true"></i>
11
+ {/if}
12
+ {entry.text}
13
+ {#if entry.badge}
14
+ <span class="badge text-bg-primary ms-auto">{entry.badge}</span>
15
+ {/if}
16
+ </a>
17
+ {/each}
18
+ </div>
19
+ </div>
20
+
21
+ <script>
22
+ // Render entries built by buildProfileNavEntries (profileNav.util.js): { id, href, text, icon, badge, active }.
23
+ let { entries = [] } = $props();
24
+ </script>
@@ -1,66 +1,24 @@
1
- <Sidebar side={side}>
2
- <div class="d-flex flex-column gap-3">
3
- {#if showDeleteAll}
4
- <div class="order-last order-lg-first w-100">
5
- <button
6
- class="btn btn-danger w-100"
7
- type="button"
8
- on:click={() => showDeleteAllNotificationsModal()}>
9
- <i class="fas fa-trash-alt me-2"></i>
10
- {$_("buttons.delete-all")}
11
- </button>
12
- </div>
13
- {/if}
14
- <div
15
- class="vstack gap-3"
16
- class:order-first={showDeleteAll}
17
- class:order-lg-last={showDeleteAll}>
18
- {#each $items as item (item.id)}
19
- {#if item.id === "profile-info"}
20
- <!-- Profile Info Snippet -->
21
- <div class="card square-card-desktop">
22
- <div class="card-body vstack gap-3">
23
- <div class="d-block">
24
- <PlayerHead
25
- width="64"
26
- height="64"
27
- username={user.username}
28
- inGame={$data.inGame}
29
- lastActivityTime={$data.lastActivityTime}
30
- checkTime={checkTime} />
31
- </div>
32
- <PageTitle title={user.username} breadcrumb={false} />
33
- <div class="text-center">
34
- <PlayerStatusBadge
35
- banned={$data.isBanned}
36
- lastActivityTime={$data.lastActivityTime}
37
- inGame={$data.inGame}
38
- checkTime={checkTime} />
39
- </div>
40
- <div class="text-center">
41
- <PlayerPermissionBadge
42
- permissionGroupName={$data.permissionGroupName} />
43
- </div>
44
- </div>
45
- </div>
46
- {:else}
47
- <!-- External Component -->
48
- <ViewComponent
49
- component={item.component}
50
- data={$data}
51
- user={user}
52
- checkTime={checkTime}
53
- {...item.props} />
54
- {/if}
55
- {/each}
56
- </div>
57
- </div>
58
- </Sidebar>
1
+ <!--
2
+ Controller of the engine's <ProfileSidebar>. The markup lives in views/parts/ProfileSidebar.svelte; a
3
+ theme may replace it with the "ProfileSidebar" entry of theme.config.js views (see skin-contract.json
4
+ for the props). The controller keeps the data, the item list, the navigation entries and the clock.
5
+ -->
6
+ <svelte:component
7
+ this={getOverride("ProfileSidebar") ?? ProfileSidebarView}
8
+ {side}
9
+ {showDeleteAll}
10
+ {onDeleteAllClick}
11
+ {items}
12
+ {data}
13
+ {user}
14
+ {checkTime}
15
+ {navEntries} />
59
16
 
60
17
  <script context="module">
61
18
  import ApiUtil from "$pano/lib/api.util.js";
62
19
  import { writable } from "svelte/store";
63
20
  import { executeSidebarLoad, panoApi } from "$pano/lib/PluginAPI";
21
+ import { mergeProfileNav } from "./profileNav.util.js";
64
22
 
65
23
  const data = writable({
66
24
  lastActivityTime: 0,
@@ -78,12 +36,25 @@
78
36
  priority: 100,
79
37
  });
80
38
 
39
+ panoApi.ui.sidebar.register({
40
+ sidebarId: "profile",
41
+ id: "profile-nav",
42
+ component: "local:profile-nav",
43
+ priority: 95,
44
+ });
45
+
46
+ // Built-in navigation entries; plugins add theirs with pano.ui.profile.nav.edit. Built-ins an
47
+ // item of the same id already covers are not added again (load runs on every page visit).
48
+ panoApi.ui.profile.nav.edit((navItems) => {
49
+ navItems.splice(0, navItems.length, ...mergeProfileNav(navItems));
50
+ });
51
+
81
52
  // Execute sidebar load and resolve components for SSR
82
53
  await executeSidebarLoad("profile", event);
83
54
 
84
55
  data.set(
85
56
  await ApiUtil.get({
86
- path: "/api/sidebars/profile",
57
+ path: "/sidebars/profile",
87
58
  request: event,
88
59
  }),
89
60
  );
@@ -97,15 +68,12 @@
97
68
  <script>
98
69
  import { getContext, onDestroy, onMount } from "svelte";
99
70
  import { _ } from "svelte-i18n";
71
+ import { page } from "$app/stores";
72
+ import { base } from "$app/paths";
100
73
 
101
- import tooltip from "$pano/lib/tooltip.util";
102
-
103
- import PlayerPermissionBadge from "$pano/lib/components/PlayerPermissionBadge.svelte";
104
- import PlayerStatusBadge from "$pano/lib/components/PlayerStatusBadge.svelte";
105
- import Sidebar from "$pano/lib/components/Sidebar.svelte";
106
- import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
107
- import PlayerHead from "$pano/lib/components/PlayerHead.svelte";
108
- import PageTitle from "../PageTitle.svelte";
74
+ import { getOverride } from "$pano/registry/index.js";
75
+ import ProfileSidebarView from "$pano/lib/views/parts/ProfileSidebar.svelte";
76
+ import { buildProfileNavEntries } from "./profileNav.util.js";
109
77
  import { show as showDeleteAllNotificationsModal } from "$pano/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte";
110
78
 
111
79
  export let side;
@@ -129,21 +97,13 @@
129
97
  });
130
98
 
131
99
  const items = panoApi.ui.sidebar.get("profile");
132
- </script>
100
+ const navItems = panoApi.ui.profile.nav.get();
101
+
102
+ const onDeleteAllClick = () => showDeleteAllNotificationsModal();
133
103
 
134
- <style>
135
- @media (min-width: 992px) {
136
- .square-card-desktop {
137
- aspect-ratio: 1 / 1;
138
- display: flex;
139
- flex-direction: column;
140
- }
141
-
142
- .square-card-desktop :global(.card-body) {
143
- flex: 1;
144
- display: flex;
145
- flex-direction: column;
146
- justify-content: center;
147
- }
148
- }
149
- </style>
104
+ $: navEntries = buildProfileNavEntries($navItems, {
105
+ pathname: $page.url.pathname,
106
+ base,
107
+ translate: (key) => $_(key),
108
+ });
109
+ </script>
@@ -1,16 +1,13 @@
1
- <Sidebar side="{side}">
2
- <div class="vstack gap-3">
3
- {#each $items as item (item.id)}
4
- {#if item.id === 'online-admins'}
5
- <!-- Online Admins Snippet -->
6
- <OnlineAdmins onlineAdmins="{$data.onlineAdmins}" />
7
- {:else}
8
- <!-- External Component -->
9
- <ViewComponent component={item.component} data={$data} {...item.props} />
10
- {/if}
11
- {/each}
12
- </div>
13
- </Sidebar>
1
+ <!--
2
+ Controller of the engine's <SupportSidebar>. The markup lives in views/parts/SupportSidebar.svelte; a
3
+ theme may replace it with the "SupportSidebar" entry of theme.config.js views (see skin-contract.json
4
+ for the props).
5
+ -->
6
+ <svelte:component
7
+ this={getOverride("SupportSidebar") ?? SupportSidebarView}
8
+ {side}
9
+ {items}
10
+ {data} />
14
11
 
15
12
  <script context="module">
16
13
  import ApiUtil from "$pano/lib/api.util.js";
@@ -34,19 +31,19 @@
34
31
  // Execute sidebar load and resolve components for SSR
35
32
  await executeSidebarLoad('support', event);
36
33
 
37
- data.set(
38
- await ApiUtil.get({
39
- path: "/api/sidebars/support",
40
- request: event,
41
- }),
42
- );
34
+ // The wire shape is { items: string[] } (decision 80); the view contract keeps { onlineAdmins }.
35
+ const response = await ApiUtil.get({
36
+ path: "/sidebars/support",
37
+ request: event,
38
+ });
39
+
40
+ data.set({ onlineAdmins: Array.isArray(response?.items) ? response.items : [] });
43
41
  };
44
42
  </script>
45
43
 
46
44
  <script>
47
- import Sidebar from "$pano/lib/components/Sidebar.svelte";
48
- import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
49
- import OnlineAdmins from "$pano/lib/components/OnlineAdmins.svelte";
45
+ import { getOverride } from "$pano/registry/index.js";
46
+ import SupportSidebarView from "$pano/lib/views/parts/SupportSidebar.svelte";
50
47
 
51
48
  export let side;
52
49
 
@@ -1,27 +1,15 @@
1
- <Sidebar side={side}>
2
- <div class="vstack gap-3">
3
- {#each $items as item (item.id)}
4
- {#if item.id === 'online-admins'}
5
- <!-- Online Admins Snippet -->
6
- <OnlineAdmins onlineAdmins={$data.onlineAdmins} />
7
- {:else if item.id === 'close-ticket-button'}
8
- <!-- Close Ticket Button Snippet -->
9
- {#if $ticketData && $ticketData.status !== TicketStatuses.CLOSED}
10
- <button
11
- class="btn btn-danger w-100"
12
- type="button"
13
- on:click={() => showCloseTicketConfirmModal($ticketData)}>
14
- <i class="fas fa-times me-2"></i>
15
- {$_("buttons.close-ticket")}
16
- </button>
17
- {/if}
18
- {:else}
19
- <!-- External Component -->
20
- <ViewComponent component={item.component} data={$data} ticketData={$ticketData} {...item.props} />
21
- {/if}
22
- {/each}
23
- </div>
24
- </Sidebar>
1
+ <!--
2
+ Controller of the engine's <TicketCreateAndDetailSidebar>. The markup lives in views/parts/TicketCreateAndDetailSidebar.svelte; a
3
+ theme may replace it with the "TicketCreateAndDetailSidebar" entry of theme.config.js views (see skin-contract.json
4
+ for the props).
5
+ -->
6
+ <svelte:component
7
+ this={getOverride("TicketCreateAndDetailSidebar") ?? TicketCreateAndDetailSidebarView}
8
+ {side}
9
+ {items}
10
+ {data}
11
+ {ticketData}
12
+ {onCloseTicketClick} />
25
13
 
26
14
  <script context="module">
27
15
  import { writable } from "svelte/store";
@@ -53,12 +41,13 @@
53
41
  // Execute sidebar load and resolve components for SSR
54
42
  await executeSidebarLoad('ticket', event);
55
43
 
56
- data.set(
57
- await ApiUtil.get({
58
- path: "/api/sidebars/support",
59
- request: event,
60
- }),
61
- );
44
+ // The wire shape is { items: string[] } (decision 80); the view contract keeps { onlineAdmins }.
45
+ const response = await ApiUtil.get({
46
+ path: "/sidebars/support",
47
+ request: event,
48
+ });
49
+
50
+ data.set({ onlineAdmins: Array.isArray(response?.items) ? response.items : [] });
62
51
 
63
52
  if (ticket) {
64
53
  ticketData.set(ticket);
@@ -71,14 +60,13 @@
71
60
  </script>
72
61
 
73
62
  <script>
74
- import { _ } from "svelte-i18n";
75
- import Sidebar from "$pano/lib/components/Sidebar.svelte";
76
- import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
77
- import OnlineAdmins from "$pano/lib/components/OnlineAdmins.svelte";
63
+ import { getOverride } from "$pano/registry/index.js";
64
+ import TicketCreateAndDetailSidebarView from "$pano/lib/views/parts/TicketCreateAndDetailSidebar.svelte";
78
65
  import { show as showCloseTicketConfirmModal } from "$pano/lib/components/modals/CloseTicketConfirmModal.svelte";
79
- import { TicketStatuses } from "$pano/lib/components/TicketStatus.svelte";
80
66
 
81
67
  export let side;
82
68
 
83
69
  const items = panoApi.ui.sidebar.get("ticket");
70
+
71
+ const onCloseTicketClick = (ticket) => showCloseTicketConfirmModal(ticket);
84
72
  </script>
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Pure helpers for the profile sidebar navigation (market plugin spec 15 section 4.6).
3
+ *
4
+ * The `profile-nav` view slot holds `{ id, priority, hidden?, props: { href, text, icon?, startsWith?, badge? } }`
5
+ * items. The built-ins below are registered by the profile sidebar's `load`; plugins add their own
6
+ * through `pano.ui.profile.nav.edit`.
7
+ */
8
+
9
+ /** Built-in entries, reusing the label keys of the navbar profile dropdown. */
10
+ export const PROFILE_NAV_BUILTINS = Object.freeze([
11
+ { id: "profile", priority: 100, props: { href: "/profile", text: "buttons.profile", icon: "fas fa-user" } },
12
+ {
13
+ id: "settings",
14
+ priority: 90,
15
+ props: { href: "/profile/settings", text: "buttons.settings", icon: "fas fa-gear" },
16
+ },
17
+ { id: "tickets", priority: 80, props: { href: "/tickets", text: "buttons.tickets", icon: "fas fa-ticket" } },
18
+ {
19
+ id: "notifications",
20
+ priority: 70,
21
+ props: { href: "/notifications", text: "buttons.notifications", icon: "fas fa-bell" },
22
+ },
23
+ ]);
24
+
25
+ /**
26
+ * Adds the built-ins that no item with the same id already covers. A plugin that registered an
27
+ * item with a built-in id (to replace or reorder it) keeps its own version; calling this on every
28
+ * page load never duplicates anything.
29
+ *
30
+ * @param {Array<{ id?: string }>} items the current slot content
31
+ * @returns {Array<object>} a new array: existing items first, then the missing built-ins
32
+ */
33
+ export function mergeProfileNav(items) {
34
+ const existing = Array.isArray(items) ? items : [];
35
+ const ids = new Set(existing.map((item) => item?.id));
36
+ const missing = PROFILE_NAV_BUILTINS.filter((item) => !ids.has(item.id)).map((item) => ({
37
+ ...item,
38
+ hidden: false,
39
+ props: { ...item.props },
40
+ }));
41
+
42
+ return [...existing, ...missing];
43
+ }
44
+
45
+ /**
46
+ * A nav `href` must be site-relative: starts with "/", not protocol-relative, no backslash, no
47
+ * control characters.
48
+ * @param {unknown} href
49
+ */
50
+ export function isSafeNavHref(href) {
51
+ return (
52
+ typeof href === "string" &&
53
+ href.startsWith("/") &&
54
+ !href.startsWith("//") &&
55
+ !href.includes("\\") &&
56
+ // eslint-disable-next-line no-control-regex
57
+ !/[\u0000-\u001f\u007f]/.test(href)
58
+ );
59
+ }
60
+
61
+ /**
62
+ * Active state of a nav item: the exact path, or any sub-path when `props.startsWith` is set.
63
+ * @param {string} pathname
64
+ * @param {string} base the SvelteKit base path ("" when none)
65
+ * @param {{ href: string, startsWith?: boolean }} props
66
+ */
67
+ export function isProfileNavActive(pathname, base, props) {
68
+ const target = (base || "") + props.href;
69
+
70
+ if (pathname === target) return true;
71
+
72
+ return Boolean(props.startsWith) && pathname.startsWith(target + "/");
73
+ }
74
+
75
+ /**
76
+ * Turns slot items into render entries: items without usable props/href are dropped, the text is
77
+ * translated when it contains a dot (the navbar dropdown rule), `href` gets the base path and the
78
+ * active flag is computed. The order of `items` is kept (the slot already sorts by priority).
79
+ *
80
+ * @param {Array<object>} items visible items of the `profile-nav` slot
81
+ * @param {{ pathname: string, base?: string, translate: (key: string) => string }} context
82
+ * @returns {Array<{ id: string, href: string, text: string, icon: string | null, badge: string | null, active: boolean }>}
83
+ */
84
+ export function buildProfileNavEntries(items, { pathname, base = "", translate }) {
85
+ const entries = [];
86
+
87
+ for (const item of Array.isArray(items) ? items : []) {
88
+ const props = item?.props;
89
+
90
+ if (!props || !isSafeNavHref(props.href)) continue;
91
+
92
+ const text = typeof props.text === "string" ? props.text : "";
93
+
94
+ entries.push({
95
+ id: String(item.id),
96
+ href: base + props.href,
97
+ text: text.includes(".") ? translate(text) : text,
98
+ icon: typeof props.icon === "string" && props.icon ? props.icon : null,
99
+ badge: props.badge === undefined || props.badge === null || props.badge === "" ? null : String(props.badge),
100
+ active: isProfileNavActive(pathname, base, props),
101
+ });
102
+ }
103
+
104
+ return entries;
105
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Pure helpers for the `sidebar` a plugin page's `load` may return (market plugin spec 15 section 4.5).
3
+ *
4
+ * A plugin page returns either a component (unchanged behaviour) or a string:
5
+ * "home" | "profile" the host sidebar of that id (its own `load(event)` is run)
6
+ * "plugin:<sidebarId>" the generic engine sidebar rendering the slot `<sidebarId>`
7
+ * Anything else is rejected (`player-detail`, `support`, `ticket` need page data).
8
+ *
9
+ * Kept free of SvelteKit / Svelte imports so it can be tested with `bun test`; the route module
10
+ * (`routes/plugin-ui/Page.svelte`) injects the real sidebars and the slot registry.
11
+ */
12
+
13
+ export const SIDEBAR_ID_PATTERN = /^[a-z0-9][a-z0-9:-]{0,63}$/;
14
+
15
+ const HOST_SIDEBAR_IDS = ["home", "profile"];
16
+ const PLUGIN_PREFIX = "plugin:";
17
+
18
+ /**
19
+ * Classifies a `sidebar` value.
20
+ * @param {unknown} sidebar
21
+ * @returns {{ kind: "component" } | { kind: "host", id: "home" | "profile" } | { kind: "plugin", sidebarId: string } | { kind: "invalid", value: string }}
22
+ */
23
+ export function parseSidebarSpec(sidebar) {
24
+ if (typeof sidebar !== "string") return { kind: "component" };
25
+
26
+ if (HOST_SIDEBAR_IDS.includes(sidebar)) return { kind: "host", id: sidebar };
27
+
28
+ if (sidebar.startsWith(PLUGIN_PREFIX)) {
29
+ const sidebarId = sidebar.slice(PLUGIN_PREFIX.length);
30
+ if (SIDEBAR_ID_PATTERN.test(sidebarId)) return { kind: "plugin", sidebarId };
31
+ }
32
+
33
+ return { kind: "invalid", value: sidebar };
34
+ }
35
+
36
+ /**
37
+ * Resolves a string `sidebar` into the `{ sidebar, sidebarProps }` pair for the page data.
38
+ * Returns `null` when the value is not a string (the caller leaves the output unchanged).
39
+ *
40
+ * @param {object} args
41
+ * @param {unknown} args.sidebar the value the plugin page returned
42
+ * @param {object} [args.sidebarProps] the `sidebarProps` the plugin page returned
43
+ * @param {object} args.event the SvelteKit load event
44
+ * @param {{ home: object, profile: object }} args.hosts host sidebar modules (`default` + `load`)
45
+ * @param {object} args.PluginSidebar the engine sidebar component
46
+ * @param {(sidebarId: string, event: object) => Promise<unknown>} args.executeSidebarLoad
47
+ * @param {(sidebarId: string) => number} args.countVisible number of visible items in the slot
48
+ * @param {(...args: unknown[]) => void} [args.warn]
49
+ * @returns {Promise<null | { sidebar: object | null, sidebarProps?: object }>}
50
+ */
51
+ export async function resolveSidebarSpec({
52
+ sidebar,
53
+ sidebarProps,
54
+ event,
55
+ hosts,
56
+ PluginSidebar,
57
+ executeSidebarLoad,
58
+ countVisible,
59
+ warn = console.warn,
60
+ }) {
61
+ const spec = parseSidebarSpec(sidebar);
62
+
63
+ if (spec.kind === "component") return null;
64
+
65
+ if (spec.kind === "host") {
66
+ const module = hosts[spec.id];
67
+ if (typeof module.load === "function") await module.load(event);
68
+
69
+ return { sidebar: module.default };
70
+ }
71
+
72
+ if (spec.kind === "plugin") {
73
+ await executeSidebarLoad(spec.sidebarId, event);
74
+
75
+ if (countVisible(spec.sidebarId) === 0) {
76
+ // Zero items: no sidebar, the content takes the full width.
77
+ return { sidebar: null, sidebarProps: {} };
78
+ }
79
+
80
+ return {
81
+ sidebar: PluginSidebar,
82
+ sidebarProps: { ...(sidebarProps || {}), sidebarId: spec.sidebarId },
83
+ };
84
+ }
85
+
86
+ warn(
87
+ `[plugin-ui] Unsupported sidebar "${spec.value}" returned by a plugin page; ` +
88
+ `use a component, "home", "profile" or "plugin:<sidebarId>".`,
89
+ );
90
+
91
+ return { sidebar: null, sidebarProps: {} };
92
+ }