@panomc/theme-core 1.0.0-dev.63 → 1.0.0-dev.65
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/bin/__tests__/cli/core-meta.test.js +6 -7
- package/bin/new.js +0 -5
- package/bin/package-zip.js +2 -2
- package/bin/sync.js +3 -3
- package/lang/en-US.json +1 -1
- package/package.json +19 -19
- package/src/kit/__tests__/hooks-server-fetch.test.js +1 -1
- package/src/kit/hooks-client.js +1 -1
- package/src/kit/hooks-server.js +1 -1
- package/src/kit/resolve.js +1 -1
- package/src/kit/svelte-config.js +37 -30
- package/src/kit/vite-config.js +31 -9
- package/src/lib/PluginAPI.js +19 -2
- package/src/lib/__tests__/controllerHost.test.js +2 -2
- package/src/lib/__tests__/cx03.test.js +2 -2
- package/src/lib/__tests__/engineBoot.test.js +1 -1
- package/src/lib/__tests__/engineParts.helper.js +2 -1
- package/src/lib/__tests__/engineParts.test.js +1 -1
- package/src/lib/__tests__/engineSidebars.helper.js +3 -3
- package/src/lib/__tests__/engineSidebars.test.js +1 -1
- package/src/lib/__tests__/engineWiring.test.js +8 -8
- package/src/lib/__tests__/fallbackStyles.test.js +5 -5
- package/src/lib/__tests__/home.test.js +1 -1
- package/src/lib/__tests__/injectedScope.test.js +2 -2
- package/src/lib/__tests__/languageConcurrency.test.js +1 -1
- package/src/lib/__tests__/languageLayers.test.js +1 -1
- package/src/lib/__tests__/pluginApiViews.test.js +2 -2
- package/src/lib/__tests__/registryReady.test.js +1 -1
- package/src/lib/__tests__/returnTo.util.test.js +8 -5
- package/src/lib/__tests__/routeConfig.test.js +1 -1
- package/src/lib/__tests__/skinContract.test.js +1 -1
- package/src/lib/__tests__/tc03.test.js +8 -5
- package/src/lib/__tests__/tc11.test.js +1 -1
- package/src/lib/auth.util.js +2 -2
- package/src/lib/components/App.svelte +1 -1
- package/src/lib/components/FallbackLinks.svelte +1 -1
- package/src/lib/components/Hook.svelte +1 -1
- package/src/lib/components/Main.svelte +1 -1
- package/src/lib/components/Navbar.svelte +2 -2
- package/src/lib/components/NotificationContainer.svelte +3 -3
- package/src/lib/components/PluginBlock.svelte +2 -2
- package/src/lib/components/sidebars/ProfileSidebar.svelte +2 -2
- package/src/lib/controllerHost.js +2 -2
- package/src/lib/language.util.js +2 -2
- package/src/lib/layouts/AppLayout.svelte +1 -1
- package/src/lib/layouts/AuthLayout.svelte +1 -1
- package/src/lib/layouts/MainLayout.svelte +1 -1
- package/src/lib/layouts/ProfileLayout.svelte +1 -1
- package/src/lib/layouts/ThemeSettingsLayout.svelte +1 -1
- package/src/lib/layouts/TicketsLayout.svelte +1 -1
- package/src/lib/pages/LoginPage.svelte +1 -1
- package/src/lib/pages/PreviewPostPage.svelte +1 -1
- package/src/lib/pages/RegisterPage.svelte +1 -1
- package/src/lib/pages/ResetPasswordPage.svelte +1 -1
- package/src/lib/siteRealtime.js +1 -1
- package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +8 -5
- package/src/lib/ui-logics/layout-logics/ThemeSettingsLayoutLogics.js +1 -1
- package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +1 -1
- package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +1 -1
- package/src/lib/views/NotificationsView.svelte +1 -1
- package/src/plugin-engine/engine.js +2 -2
- package/src/registry/__tests__/registry.test.js +1 -1
- package/src/registry/__tests__/view.test.js +1 -1
- package/src/registry/index.js +1 -1
- package/src/routes/RootLayout.svelte +2 -2
- package/src/routes/catalogue/__tests__/catalogue.test.js +3 -3
- package/src/routes/catalogue/deps.js +2 -2
- package/src/routes/plugin-ui/Layout.svelte +2 -2
- package/src/routes/plugin-ui/Page.svelte +1 -1
|
@@ -11,7 +11,7 @@ import { buildCases, renderPart } from "./engineParts.helper.js";
|
|
|
11
11
|
// `/posts` route, and `route()` in the default views.
|
|
12
12
|
|
|
13
13
|
// bun mocks are process-wide: every stub is a superset of what the other suites use
|
|
14
|
-
mock.module("$app/
|
|
14
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
15
15
|
mock.module("@sveltejs/kit", () => ({
|
|
16
16
|
error: (status, message) => Object.assign(new Error(`HTTP ${status} ${message ?? ""}`), { status }),
|
|
17
17
|
redirect: (status, location) => Object.assign(new Error("redirect"), { status, location, redirect: true }),
|
|
@@ -25,9 +25,9 @@ mock.module("@sveltejs/kit", () => ({
|
|
|
25
25
|
error: (status, message) => Object.assign(new Error(`HTTP ${status} ${message ?? ""}`), { status }),
|
|
26
26
|
}));
|
|
27
27
|
mock.module("$app/paths", () => ({ base: "" }));
|
|
28
|
-
mock.module("$app/
|
|
28
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
29
29
|
mock.module("$app/navigation", () => ({ goto: async () => {}, invalidate: async () => {}, invalidateAll: async () => {} }));
|
|
30
|
-
mock.module("
|
|
30
|
+
mock.module("@panomc/sdk/core/js/appStores.js", () => ({ page: pageStore, navigating: writable(null), captureRequestState: () => {} }));
|
|
31
31
|
|
|
32
32
|
const registry = await import("../../registry/index.js");
|
|
33
33
|
const { setPanoContext, getPanoContext } = await import("../../../../sdk/src/internal/index.js");
|
|
@@ -2,7 +2,7 @@ import { describe, expect, mock, test } from "bun:test";
|
|
|
2
2
|
import { get } from "svelte/store";
|
|
3
3
|
|
|
4
4
|
mock.module("$app/paths", () => ({ base: "" }));
|
|
5
|
-
mock.module("$app/
|
|
5
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
6
6
|
|
|
7
7
|
const delay = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
8
8
|
const LOCALES = [
|
|
@@ -9,7 +9,7 @@ import { dirname, join } from "node:path";
|
|
|
9
9
|
// 4.2, 4.6). Also that the bins find hoisted packages in a Bun workspace.
|
|
10
10
|
|
|
11
11
|
mock.module("$app/paths", () => ({ base: "" }));
|
|
12
|
-
mock.module("$app/
|
|
12
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
13
13
|
|
|
14
14
|
/** What the stubbed translations API answers; each test sets it. */
|
|
15
15
|
let apiAnswer = { result: "ok", data: {}, meta: {} };
|
|
@@ -19,7 +19,7 @@ mock.module("@sveltejs/kit", () => ({
|
|
|
19
19
|
error: (status) => Object.assign(new Error(`HTTP ${status}`), { status }),
|
|
20
20
|
}));
|
|
21
21
|
mock.module("$app/paths", () => ({ base: "" }));
|
|
22
|
-
mock.module("$app/
|
|
22
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
23
23
|
mock.module("$app/navigation", () => ({
|
|
24
24
|
goto: async (url, options) => {
|
|
25
25
|
navigations.push({ url, options });
|
|
@@ -513,7 +513,7 @@ describe("routes: what plugins are handed goes through route()", () => {
|
|
|
513
513
|
await api.routedGoto("//elsewhere.test/store");
|
|
514
514
|
|
|
515
515
|
expect(navigations).toEqual([
|
|
516
|
-
{ url: "/shop", options: {
|
|
516
|
+
{ url: "/shop", options: { replace: true } },
|
|
517
517
|
{ url: "https://elsewhere.test/store", options: undefined },
|
|
518
518
|
{ url: "//elsewhere.test/store", options: undefined },
|
|
519
519
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, mock, test } from "bun:test";
|
|
2
2
|
|
|
3
|
-
mock.module("$app/
|
|
3
|
+
mock.module("$app/env", () => ({ dev: false, browser: false }));
|
|
4
4
|
|
|
5
5
|
const { resolveView, setThemeConfig } = await import("../../registry/index.js");
|
|
6
6
|
|
|
@@ -14,14 +14,10 @@ mock.module("@sveltejs/kit", () => ({
|
|
|
14
14
|
redirect: (status, location) => new Redirect(status, location),
|
|
15
15
|
}));
|
|
16
16
|
mock.module("$app/paths", () => ({ base: "" }));
|
|
17
|
-
mock.module("$app/
|
|
17
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
18
18
|
mock.module("$app/navigation", () => ({ goto: async () => {} }));
|
|
19
19
|
mock.module("$pano/lib/services/auth.js", () => ({ sendLogout: async () => {} }));
|
|
20
20
|
mock.module("$pano/lib/components/ToastContainer.svelte", () => ({ showSuccess: async () => {} }));
|
|
21
|
-
mock.module("$pano/lib/returnTo.util.js", () => import("../returnTo.util.js"));
|
|
22
|
-
mock.module("@panomc/sdk/core/js/PluginAPI", () =>
|
|
23
|
-
import("../../../../sdk/core/js/PluginAPI.js"),
|
|
24
|
-
);
|
|
25
21
|
// Superset of what the sdk tests mock for the same file (bun mocks are process-wide).
|
|
26
22
|
const pluginManagerStub = () => ({
|
|
27
23
|
plugins: writable([]),
|
|
@@ -30,6 +26,13 @@ const pluginManagerStub = () => ({
|
|
|
30
26
|
});
|
|
31
27
|
mock.module("@panomc/sdk/core/js/PluginManager.js", pluginManagerStub);
|
|
32
28
|
mock.module(new URL("../../../../sdk/core/js/PluginManager.js", import.meta.url).pathname, pluginManagerStub);
|
|
29
|
+
// A mock factory must not import(): since Bun 1.4 the factory runs inside the module load that asked for the mock, and an
|
|
30
|
+
// import() from there waits on that same load. The real modules are loaded first (after the PluginManager mocks the sdk
|
|
31
|
+
// PluginAPI depends on) and handed over as they are.
|
|
32
|
+
const returnToUtil = await import("../returnTo.util.js");
|
|
33
|
+
mock.module("$pano/lib/returnTo.util.js", () => returnToUtil);
|
|
34
|
+
const sdkPluginAPI = await import("../../../../sdk/core/js/PluginAPI.js");
|
|
35
|
+
mock.module("@panomc/sdk/core/js/PluginAPI", () => sdkPluginAPI);
|
|
33
36
|
mock.module("$pano/plugin-engine/engine.js", () => ({
|
|
34
37
|
createHookEngine: () => ({ reset() {}, executeHookLoad() {}, register() {}, get() {}, setVisible() {} }),
|
|
35
38
|
createLifecycleRegistry: () => ({ reset() {}, executeLifecycle() {}, on() {} }),
|
|
@@ -8,7 +8,7 @@ import { findSvelte } from "./svelteSsr.helper.js";
|
|
|
8
8
|
// routes.add / hooks.js, the 308 for a renamed-away path, the 404 for a disabled one, and
|
|
9
9
|
// themePageLoad.
|
|
10
10
|
|
|
11
|
-
mock.module("$app/
|
|
11
|
+
mock.module("$app/env", () => ({ dev: false, browser: false }));
|
|
12
12
|
mock.module("$pano/lib/api.util", () => ({ default: {} }));
|
|
13
13
|
|
|
14
14
|
// Modules the plugin-ui Layout imports.
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import { engineViews } from "../views/parts/engine-views.generated.js";
|
|
19
19
|
|
|
20
20
|
// The registry reads SvelteKit's `dev` flag; the old pre-split modals import the SDK's api util.
|
|
21
|
-
mock.module("$app/
|
|
21
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
22
22
|
mock.module("@panomc/sdk/core/js/api.util", () => ({ default: {}, NETWORK_ERROR: "NETWORK_ERROR", buildQueryParams: () => "" }));
|
|
23
23
|
|
|
24
24
|
const registry = await import("../../registry/index.js");
|
|
@@ -18,14 +18,10 @@ mock.module("@sveltejs/kit", () => ({
|
|
|
18
18
|
redirect: (status, location) => new Redirect(status, location),
|
|
19
19
|
}));
|
|
20
20
|
mock.module("$app/paths", () => ({ base: "" }));
|
|
21
|
-
mock.module("$app/
|
|
21
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
22
22
|
mock.module("$app/navigation", () => ({ goto: async () => {} }));
|
|
23
23
|
mock.module("$pano/lib/services/auth.js", () => ({ sendLogout: async () => {} }));
|
|
24
24
|
mock.module("$pano/lib/components/ToastContainer.svelte", () => ({ showSuccess: async () => {} }));
|
|
25
|
-
mock.module("$pano/lib/returnTo.util.js", () => import("../returnTo.util.js"));
|
|
26
|
-
mock.module("@panomc/sdk/core/js/PluginAPI", () =>
|
|
27
|
-
import("../../../../sdk/core/js/PluginAPI.js"),
|
|
28
|
-
);
|
|
29
25
|
// Superset of what the sdk tests mock for the same file (bun mocks are process-wide).
|
|
30
26
|
const pluginManagerStub = () => ({
|
|
31
27
|
plugins: writable([]),
|
|
@@ -34,6 +30,13 @@ const pluginManagerStub = () => ({
|
|
|
34
30
|
});
|
|
35
31
|
mock.module("@panomc/sdk/core/js/PluginManager.js", pluginManagerStub);
|
|
36
32
|
mock.module(new URL("../../../../sdk/core/js/PluginManager.js", import.meta.url).pathname, pluginManagerStub);
|
|
33
|
+
// A mock factory must not import(): since Bun 1.4 the factory runs inside the module load that asked for the mock, and an
|
|
34
|
+
// import() from there waits on that same load. The real modules are loaded first (after the PluginManager mocks the sdk
|
|
35
|
+
// PluginAPI depends on) and handed over as they are.
|
|
36
|
+
const returnToUtil = await import("../returnTo.util.js");
|
|
37
|
+
mock.module("$pano/lib/returnTo.util.js", () => returnToUtil);
|
|
38
|
+
const sdkPluginAPI = await import("../../../../sdk/core/js/PluginAPI.js");
|
|
39
|
+
mock.module("@panomc/sdk/core/js/PluginAPI", () => sdkPluginAPI);
|
|
37
40
|
mock.module("$pano/plugin-engine/engine.js", () => ({
|
|
38
41
|
createHookEngine: () => ({ reset() {}, executeHookLoad() {}, register() {}, get() {}, setVisible() {} }),
|
|
39
42
|
createLifecycleRegistry: () => ({ reset() {}, executeLifecycle() {}, on() {} }),
|
|
@@ -8,7 +8,7 @@ import { join } from "node:path";
|
|
|
8
8
|
// `<script context="module">` is extracted, its imports are replaced by stubs and
|
|
9
9
|
// its view thunks by markers, and `load` is run against the real registry.
|
|
10
10
|
|
|
11
|
-
mock.module("$app/
|
|
11
|
+
mock.module("$app/env", () => ({ dev: false, browser: false }));
|
|
12
12
|
const registry = await import("../../registry/index.js");
|
|
13
13
|
mock.module("$pano/registry/index.js", () => registry);
|
|
14
14
|
// root-layout-load.js registers the generated engine table at import; the tests register their own.
|
package/src/lib/auth.util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { get } from "svelte/store";
|
|
2
|
-
import { page } from "
|
|
3
|
-
import { browser } from "$app/
|
|
2
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
3
|
+
import { browser } from "$app/env";
|
|
4
4
|
|
|
5
5
|
export const Permissions = Object.freeze({
|
|
6
6
|
ACCESS_PANEL: "ACCESS_PANEL",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
// A theme that provides Bootstrap gets no tokens link and only the `own:` links (and `icons` when it has no
|
|
22
22
|
// Font Awesome); a theme without Bootstrap gets `pano-tokens.css` first.
|
|
23
|
-
import { base } from "
|
|
23
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
24
24
|
import { fallbackHref } from "$pano/lib/fallbackStyles.js";
|
|
25
25
|
|
|
26
26
|
/** @type {{ styles: { keys: Set<string> }, plugins: Record<string, any>, provides: { bootstrap: boolean } }} */
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
import { panoApiClient } from "$pano/lib/PluginAPI.js";
|
|
28
|
-
import { page } from "
|
|
28
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
29
29
|
import { getAllContexts } from "svelte";
|
|
30
30
|
import { hasPermission } from "$pano/lib/auth.util.js";
|
|
31
31
|
import { getPanoContext } from "@panomc/sdk/internal";
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script>
|
|
19
19
|
import "@theme-style";
|
|
20
20
|
import { getContext } from "svelte";
|
|
21
|
-
import { dev } from "$app/
|
|
21
|
+
import { dev } from "$app/env";
|
|
22
22
|
import { _ } from "svelte-i18n";
|
|
23
23
|
import { getOverride } from "$pano/registry/index.js";
|
|
24
24
|
import MainView from "$pano/lib/views/parts/Main.svelte";
|
|
@@ -312,8 +312,8 @@
|
|
|
312
312
|
import { getContext, onMount } from "svelte";
|
|
313
313
|
import { _ } from "svelte-i18n";
|
|
314
314
|
|
|
315
|
-
import { page } from "
|
|
316
|
-
import { browser } from "$app/
|
|
315
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
316
|
+
import { browser } from "$app/env";
|
|
317
317
|
import { PANEL_URL } from "$pano/lib/variables.js";
|
|
318
318
|
import { route } from "$pano/registry/routes.js";
|
|
319
319
|
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
import { formatDistanceToNow } from "date-fns";
|
|
85
85
|
import { sanitize } from "@jill64/universal-sanitizer";
|
|
86
86
|
|
|
87
|
-
import { browser } from "$app/
|
|
87
|
+
import { browser } from "$app/env";
|
|
88
88
|
import { goto, invalidateAll } from "$app/navigation";
|
|
89
|
-
import { page } from "
|
|
90
|
-
import { base } from "
|
|
89
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
90
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
91
91
|
|
|
92
92
|
import { notificationsCount, quickNotifications, avatarVersion } from "$pano/lib/Store";
|
|
93
93
|
import { onNotificationRefresh, setSiteNotificationsSubscription } from "$pano/lib/siteRealtime.js";
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
// - view not preloaded (client navigation to a page that places it): it is resolved after mount;
|
|
29
29
|
// - unknown id / plugin not installed: nothing, or the `fallback` snippet.
|
|
30
30
|
import { untrack } from "svelte";
|
|
31
|
-
import { page } from "
|
|
32
|
-
import { browser, dev } from "$app/
|
|
31
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
32
|
+
import { browser, dev } from "$app/env";
|
|
33
33
|
import { getPanoContext } from "@panomc/sdk/internal";
|
|
34
34
|
import {
|
|
35
35
|
getDefault,
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
<script>
|
|
70
70
|
import { getContext, onDestroy, onMount } from "svelte";
|
|
71
71
|
import { _ } from "svelte-i18n";
|
|
72
|
-
import { page } from "
|
|
73
|
-
import { base } from "
|
|
72
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
73
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
74
74
|
|
|
75
75
|
import { getOverride } from "$pano/registry/index.js";
|
|
76
76
|
import ProfileSidebarView from "$pano/lib/views/parts/ProfileSidebar.svelte";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { get } from "svelte/store";
|
|
15
15
|
import { _, locale } from "svelte-i18n";
|
|
16
16
|
|
|
17
|
-
import { browser } from "$app/
|
|
17
|
+
import { browser } from "$app/env";
|
|
18
18
|
|
|
19
19
|
import ApiUtil from "$pano/lib/api.util.js";
|
|
20
20
|
import { sanitizeReturnTo } from "./returnTo.util.js";
|
|
@@ -241,7 +241,7 @@ export function createThemeHost({ event } = {}) {
|
|
|
241
241
|
navigate(url, options) {
|
|
242
242
|
if (!browser) return;
|
|
243
243
|
|
|
244
|
-
routedGoto(url, options?.replace ? {
|
|
244
|
+
routedGoto(url, options?.replace ? { replace: true } : undefined);
|
|
245
245
|
},
|
|
246
246
|
feature: (name) => panoApi.features.has(name),
|
|
247
247
|
loginUrl: (returnTo) => panoApi.auth.loginUrl(returnTo),
|
package/src/lib/language.util.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getLocaleFromNavigator, init as initI18n, locale, register, waitLocale } from "svelte-i18n";
|
|
2
2
|
import { get, writable } from "svelte/store";
|
|
3
3
|
|
|
4
|
-
import { browser } from "$app/
|
|
4
|
+
import { browser } from "$app/env";
|
|
5
5
|
|
|
6
|
-
import { base } from "
|
|
6
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
7
7
|
import ApiUtil from "$pano/lib/api.util.js";
|
|
8
8
|
import { mergeTranslationLayers } from "./translationLayers.js";
|
|
9
9
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<script>
|
|
42
|
-
import { page } from "
|
|
42
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
43
43
|
import { _ } from "svelte-i18n";
|
|
44
44
|
import { init } from "$pano/lib/ui-logics/layout-logics/AppLayoutLogics";
|
|
45
45
|
import { onMount } from "svelte";
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
<script>
|
|
52
52
|
import { getContext } from "svelte";
|
|
53
|
-
import { page } from "
|
|
53
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
54
54
|
|
|
55
55
|
// RootLayout renders <MainLayout><slot /></MainLayout> with no data prop;
|
|
56
56
|
// fall back to the root-merged $page.data (see the alias note in load above).
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
import * as locales from "date-fns/locale";
|
|
59
59
|
|
|
60
60
|
import { afterNavigate, goto } from "$app/navigation";
|
|
61
|
-
import { page } from "
|
|
61
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
62
62
|
|
|
63
63
|
import { NETWORK_ERROR } from "$pano/lib/api.util";
|
|
64
64
|
import { currentLanguage } from "$pano/lib/language.util";
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { getContext } from "svelte";
|
|
27
27
|
import { avatarVersion } from "$pano/lib/Store";
|
|
28
28
|
|
|
29
|
-
import { page } from "
|
|
29
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
30
30
|
|
|
31
31
|
// The route generated for this page hands over `post` only (older syncs) or `data` (newer ones).
|
|
32
32
|
// Without `data` the view could not be found (`data.View` of undefined) and the preview answered
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
import { getContext, onMount } from "svelte";
|
|
48
48
|
import { get, writable } from "svelte/store";
|
|
49
49
|
import { goto } from "$app/navigation";
|
|
50
|
-
import { page } from "
|
|
50
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
51
51
|
|
|
52
52
|
import { NETWORK_ERROR } from "$pano/lib/api.util";
|
|
53
53
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<script>
|
|
30
30
|
import { getContext, onMount } from "svelte";
|
|
31
31
|
import { writable } from "svelte/store";
|
|
32
|
-
import { page } from "
|
|
32
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
33
33
|
|
|
34
34
|
import { onSubmit } from "$pano/lib/ui-logics/page-logics/ResetPasswordPageLogics";
|
|
35
35
|
import { panoApiClient } from "$pano/lib/PluginAPI";
|
package/src/lib/siteRealtime.js
CHANGED
|
@@ -15,10 +15,10 @@ import { setRouteConfig } from "$pano/registry/routes.js";
|
|
|
15
15
|
import { _ } from "svelte-i18n";
|
|
16
16
|
import copy from "copy-to-clipboard";
|
|
17
17
|
|
|
18
|
-
import { browser } from "$app/
|
|
18
|
+
import { browser } from "$app/env";
|
|
19
19
|
import { goto, invalidate, invalidateAll } from "$app/navigation";
|
|
20
|
-
import { navigating, page } from "
|
|
21
|
-
import { base } from "
|
|
20
|
+
import { captureRequestState, navigating, page } from "@panomc/sdk/core/js/appStores.js";
|
|
21
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
22
22
|
import { error, redirect } from "@sveltejs/kit";
|
|
23
23
|
|
|
24
24
|
import { avatarVersion, initialized } from "$pano/lib/Store";
|
|
@@ -179,7 +179,7 @@ function initNotificationListeners() {
|
|
|
179
179
|
details: { id }
|
|
180
180
|
} = notification;
|
|
181
181
|
|
|
182
|
-
await goto("/ticket/" + id, {
|
|
182
|
+
await goto("/ticket/" + id, { refreshAll: true });
|
|
183
183
|
});
|
|
184
184
|
|
|
185
185
|
addListener("AN_ADMIN_CLOSED_TICKET", async (notification) => {
|
|
@@ -187,7 +187,7 @@ function initNotificationListeners() {
|
|
|
187
187
|
details: { id }
|
|
188
188
|
} = notification;
|
|
189
189
|
|
|
190
|
-
await goto("/ticket/" + id, {
|
|
190
|
+
await goto("/ticket/" + id, { refreshAll: true });
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -370,6 +370,9 @@ export function init(data) {
|
|
|
370
370
|
languageStuff.activateLanguage(data.language);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
// SSR: plugin components read `$page` with their own Svelte runtime; they get this request's page (appStores.js).
|
|
374
|
+
captureRequestState();
|
|
375
|
+
|
|
373
376
|
const session = writable(data.session);
|
|
374
377
|
const sidebar = writable(null);
|
|
375
378
|
const sidebarProps = writable({});
|
|
@@ -3,7 +3,7 @@ import { redirect } from "@sveltejs/kit";
|
|
|
3
3
|
import { writable } from "svelte/store";
|
|
4
4
|
|
|
5
5
|
import { hasPermission, Permissions } from "$pano/lib/auth.util";
|
|
6
|
-
import { browser } from "$app/
|
|
6
|
+
import { browser } from "$app/env";
|
|
7
7
|
|
|
8
8
|
function postHeight() {
|
|
9
9
|
const h = Math.max(
|
|
@@ -4,7 +4,7 @@ import { get, writable } from "svelte/store";
|
|
|
4
4
|
import { formatDistanceToNow } from "date-fns";
|
|
5
5
|
import { sanitize } from "@jill64/universal-sanitizer";
|
|
6
6
|
|
|
7
|
-
import { browser } from "$app/
|
|
7
|
+
import { browser } from "$app/env";
|
|
8
8
|
|
|
9
9
|
import ApiUtil from "$pano/lib/api.util.js";
|
|
10
10
|
import { onNotificationRefresh } from "$pano/lib/siteRealtime.js";
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
import { _ } from "svelte-i18n";
|
|
111
111
|
|
|
112
112
|
import { goto } from "$app/navigation";
|
|
113
|
-
import { base } from "
|
|
113
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
114
114
|
import { notificationTextKey } from "@panomc/sdk/core/js/NotificationManager.js";
|
|
115
115
|
|
|
116
116
|
import tooltip from "$pano/lib/tooltip.util.js";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* contract (`init`, `panoApiClient`, `panoApiServer`). All the ordering/caching/SSR-safety
|
|
9
9
|
* fixes live here once, so both profiles get them.
|
|
10
10
|
*
|
|
11
|
-
* Nothing in this module reads SvelteKit app aliases ($app/
|
|
11
|
+
* Nothing in this module reads SvelteKit app aliases ($app/env, the PluginManager) or a
|
|
12
12
|
* theme's utils directly — the profile injects `plugins` and `browser` so this file stays a pure,
|
|
13
13
|
* portable engine that both the theme and panel bundles can consume.
|
|
14
14
|
*/
|
|
@@ -337,7 +337,7 @@ export function createHookEngine(policy) {
|
|
|
337
337
|
* `get()`-resolved from the PluginManager `plugins` store). A thunk, not the store itself, so
|
|
338
338
|
* this factory never reads the store at construction — the PluginManager<->PluginAPI import
|
|
339
339
|
* cycle would otherwise put that binding in the temporal dead zone at module-eval time.
|
|
340
|
-
* @param {boolean} deps.browser `$app/
|
|
340
|
+
* @param {boolean} deps.browser `$app/env`'s browser flag — decides whether to clone
|
|
341
341
|
* items per-request on the server.
|
|
342
342
|
* @param {(name: string, data: any, event: any) => Promise<void>} [deps.executeLifecycle]
|
|
343
343
|
* the lifecycle registry's executor, used by executeViewLoad/executeSidebarLoad.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeEach, describe, expect, mock, spyOn, test } from "bun:test";
|
|
2
2
|
|
|
3
|
-
mock.module("$app/
|
|
3
|
+
mock.module("$app/env", () => ({ dev: false, browser: false }));
|
|
4
4
|
|
|
5
5
|
const registry = await import("../index.js");
|
|
6
6
|
const {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { afterAll, beforeEach, describe, expect, mock, test } from "bun:test";
|
|
2
2
|
|
|
3
|
-
mock.module("$app/
|
|
3
|
+
mock.module("$app/env", () => ({ dev: false, browser: false }));
|
|
4
4
|
|
|
5
5
|
const { blockKey, stableJson, pluginView } = await import("../view.js");
|
|
6
6
|
const registry = await import("../index.js");
|
package/src/registry/index.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* an alias. Engine views keep bare names.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
import { dev } from "$app/
|
|
31
|
+
import { dev } from "$app/env";
|
|
32
32
|
import { blockKey } from "./view.js";
|
|
33
33
|
|
|
34
34
|
// `route()` (doc 01 section 9) is part of this module's public surface, so themes and plugins
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { onMount, setContext } from "svelte";
|
|
3
|
-
import { page } from "
|
|
4
|
-
import { browser } from "$app/
|
|
3
|
+
import { page } from "@panomc/sdk/core/js/appStores.js";
|
|
4
|
+
import { browser } from "$app/env";
|
|
5
5
|
import { markAvatarVersionHydrated } from "$pano/lib/avatarVersion.js";
|
|
6
6
|
import { markAppBooted } from "$pano/kit/hooks-client.js";
|
|
7
7
|
import AppLayout from "$pano/lib/layouts/AppLayout.svelte";
|
|
@@ -10,7 +10,7 @@ import { renderPart } from "../../../lib/__tests__/engineParts.helper.js";
|
|
|
10
10
|
// dependencies, the engine's sample files, and the route files `theme-core sync` generates.
|
|
11
11
|
|
|
12
12
|
// bun mocks are process-wide: every stub is a superset of what the other suites use
|
|
13
|
-
mock.module("$app/
|
|
13
|
+
mock.module("$app/env", () => ({ browser: false, dev: false }));
|
|
14
14
|
mock.module("@sveltejs/kit", () => ({
|
|
15
15
|
error: (status, message) => Object.assign(new Error(`HTTP ${status} ${message ?? ""}`), { status }),
|
|
16
16
|
redirect: (status, location) => Object.assign(new Error("redirect"), { status, location, redirect: true }),
|
|
@@ -438,7 +438,7 @@ describe("sync: the catalogue routes", () => {
|
|
|
438
438
|
["(theme)/__pano/views.json/+server.js", "views-json", "GET"],
|
|
439
439
|
]) {
|
|
440
440
|
const text = read(dir, file);
|
|
441
|
-
expect(text).toContain('import { dev } from "$app/
|
|
441
|
+
expect(text).toContain('import { dev } from "$app/env";');
|
|
442
442
|
expect(text).toContain(`dev ? await import("$pano/routes/catalogue/${module}.js") : null`);
|
|
443
443
|
expect(text).toContain("if (!m) throw error(404");
|
|
444
444
|
expect(text).toContain(`m.${run}(event)`);
|
|
@@ -517,7 +517,7 @@ describe.skipIf(!svelteDir)("catalogue components", () => {
|
|
|
517
517
|
// ---------------------------------------------------------------------------
|
|
518
518
|
|
|
519
519
|
describe.skipIf(!svelteDir)("engine samples render", () => {
|
|
520
|
-
// Views whose imports the SSR helper can stub (the others pull in SvelteKit's `$app/
|
|
520
|
+
// Views whose imports the SSR helper can stub (the others pull in SvelteKit's `$app/state`).
|
|
521
521
|
for (const name of ["ProfileView", "LoginView", "RulesView", "PlayerDetailView"]) {
|
|
522
522
|
test(`${name}: every state renders markup`, async () => {
|
|
523
523
|
const { default: samples } = await ENGINE_SAMPLES[name]();
|
|
@@ -107,7 +107,7 @@ export async function readEngineSource(path) {
|
|
|
107
107
|
* @param {{ fetch?: typeof fetch, parent?: () => Promise<any> }} [event] the SvelteKit load event (its `fetch` is the one to use)
|
|
108
108
|
*/
|
|
109
109
|
export async function createDeps(event) {
|
|
110
|
-
const { browser } = await import("$app/
|
|
110
|
+
const { browser } = await import("$app/env");
|
|
111
111
|
|
|
112
112
|
/** @type {ReturnType<typeof browserPluginSource>} */
|
|
113
113
|
let source;
|
|
@@ -116,7 +116,7 @@ export async function createDeps(event) {
|
|
|
116
116
|
// layouts unless it waits, and read too early the list is empty: every plugin view was "No view named ...".
|
|
117
117
|
await event?.parent?.().catch(() => {});
|
|
118
118
|
|
|
119
|
-
const { base } = await import("
|
|
119
|
+
const { base } = await import("@panomc/sdk/core/js/basePath.js");
|
|
120
120
|
const { get } = await import("svelte/store");
|
|
121
121
|
|
|
122
122
|
source = browserPluginSource({
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
import { error, redirect } from "@sveltejs/kit";
|
|
44
44
|
|
|
45
45
|
import { findMatch, registeredPages } from "$pano/lib/PluginManager.js";
|
|
46
|
-
import { base } from "
|
|
46
|
+
import { base } from "@panomc/sdk/core/js/basePath.js";
|
|
47
47
|
import { hasPermission } from "$pano/lib/auth.util.js";
|
|
48
48
|
import { loginRedirectFor } from "$pano/lib/returnTo.util.js";
|
|
49
49
|
import { resolveCanonical } from "$pano/registry/routes.js";
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
|
|
173
173
|
<script>
|
|
174
174
|
import { mount, unmount, getAllContexts } from 'svelte';
|
|
175
|
-
import { browser } from '$app/
|
|
175
|
+
import { browser } from '$app/env';
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
let { data } = $props();
|