@panomc/sdk 1.0.0-dev.8 → 2.0.0-dev.1

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 (166) hide show
  1. package/api/routes.core.json +3702 -0
  2. package/bin/api/__tests__/api-compat.test.mjs +97 -0
  3. package/bin/api/__tests__/check-paths.test.mjs +113 -0
  4. package/bin/api/__tests__/cli.test.mjs +44 -0
  5. package/bin/api/__tests__/extract-routes.test.mjs +132 -0
  6. package/bin/api/__tests__/fixtures/core-new/Pano/api/paths.old-new.json +82 -0
  7. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/error/NotExists.kt +10 -0
  8. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/model/Bases.kt +21 -0
  9. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/route/api/GetSiteInfoAPI.kt +19 -0
  10. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/route/api/auth/HostSsoAPI.kt +10 -0
  11. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/route/api/panel/PanelAddonsAPI.kt +28 -0
  12. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/route/api/plugins/GetPluginUiZipAPI.kt +9 -0
  13. package/bin/api/__tests__/fixtures/core-new/Pano/src/main/kotlin/com/panomc/platform/route/template/IndexTemplate.kt +9 -0
  14. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/error/NotExists.kt +10 -0
  15. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/model/Bases.kt +21 -0
  16. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/route/api/GetSiteInfoAPI.kt +19 -0
  17. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/route/api/auth/HostSsoAPI.kt +10 -0
  18. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/route/api/panel/PanelAddonsAPI.kt +28 -0
  19. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/route/api/plugins/GetPluginUiZipAPI.kt +9 -0
  20. package/bin/api/__tests__/fixtures/core-old/Pano/src/main/kotlin/com/panomc/platform/route/template/IndexTemplate.kt +9 -0
  21. package/bin/api/__tests__/fixtures/plugin-new/api/paths.old-new.json +66 -0
  22. package/bin/api/__tests__/fixtures/plugin-new/build.gradle.kts +42 -0
  23. package/bin/api/__tests__/fixtures/plugin-new/gradle.properties +4 -0
  24. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/base/DemoApis.kt +13 -0
  25. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/error/Errors.kt +16 -0
  26. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/error/Plain.kt +4 -0
  27. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/routes/GetThingsAPI.kt +16 -0
  28. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/routes/PanelThingAPI.kt +11 -0
  29. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/routes/ValidatedAPI.kt +18 -0
  30. package/bin/api/__tests__/fixtures/plugin-new/src/main/kotlin/com/example/demo/routes/WebhookAPI.kt +23 -0
  31. package/bin/api/__tests__/fixtures/plugin-new/src/panel/Things.js +4 -0
  32. package/bin/api/__tests__/fixtures/plugin-new/src/theme/Logo.svelte +9 -0
  33. package/bin/api/__tests__/fixtures/plugin-new/src/theme/api.js +29 -0
  34. package/bin/api/__tests__/fixtures/plugin-old/build.gradle.kts +22 -0
  35. package/bin/api/__tests__/fixtures/plugin-old/gradle.properties +4 -0
  36. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/base/DemoApis.kt +13 -0
  37. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/error/Errors.kt +16 -0
  38. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/error/Plain.kt +4 -0
  39. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/routes/GetThingsAPI.kt +16 -0
  40. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/routes/PanelThingAPI.kt +11 -0
  41. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/routes/ValidatedAPI.kt +18 -0
  42. package/bin/api/__tests__/fixtures/plugin-old/src/main/kotlin/com/example/demo/routes/WebhookAPI.kt +23 -0
  43. package/bin/api/__tests__/fixtures/plugin-old/src/panel/Things.js +4 -0
  44. package/bin/api/__tests__/fixtures/plugin-old/src/theme/Logo.svelte +9 -0
  45. package/bin/api/__tests__/fixtures/plugin-old/src/theme/api.js +29 -0
  46. package/bin/api/__tests__/fixtures/refusals/gradle.properties +1 -0
  47. package/bin/api/__tests__/fixtures/refusals/src/main/kotlin/x/Bad.kt +39 -0
  48. package/bin/api/__tests__/fixtures/unresolved/src/main/kotlin/x/Orphan.kt +19 -0
  49. package/bin/api/__tests__/helpers.mjs +48 -0
  50. package/bin/api/__tests__/migrate-v1.test.mjs +377 -0
  51. package/bin/api/__tests__/openapi-snapshot.test.mjs +120 -0
  52. package/bin/api/api-compat.mjs +204 -0
  53. package/bin/api/check-paths.mjs +135 -0
  54. package/bin/api/cli.mjs +83 -0
  55. package/bin/api/extract-routes.mjs +129 -0
  56. package/bin/api/js-scan.mjs +337 -0
  57. package/bin/api/kotlin.mjs +366 -0
  58. package/bin/api/migrate-v1.mjs +330 -0
  59. package/bin/api/openapi-snapshot.mjs +112 -0
  60. package/bin/api/project.mjs +172 -0
  61. package/bin/api/rename-table.mjs +66 -0
  62. package/bin/api/util.mjs +194 -0
  63. package/bin/pano-api.js +5 -0
  64. package/build/plugin-api-rollup.js +46 -0
  65. package/core/css/pano-tokens.css +225 -0
  66. package/core/favicon/apple-touch-icon.png +0 -0
  67. package/core/favicon/favicon-96x96.png +0 -0
  68. package/core/favicon/favicon.ico +0 -0
  69. package/core/favicon/favicon.svg +1 -0
  70. package/core/favicon/site.webmanifest +21 -0
  71. package/core/favicon/web-app-manifest-192x192.png +0 -0
  72. package/core/favicon/web-app-manifest-512x512.png +0 -0
  73. package/core/favicon_old/android-icon-144x144.png +0 -0
  74. package/core/favicon_old/android-icon-192x192.png +0 -0
  75. package/core/favicon_old/android-icon-36x36.png +0 -0
  76. package/core/favicon_old/android-icon-48x48.png +0 -0
  77. package/core/favicon_old/android-icon-72x72.png +0 -0
  78. package/core/favicon_old/android-icon-96x96.png +0 -0
  79. package/core/favicon_old/apple-icon-114x114.png +0 -0
  80. package/core/favicon_old/apple-icon-120x120.png +0 -0
  81. package/core/favicon_old/apple-icon-144x144.png +0 -0
  82. package/core/favicon_old/apple-icon-152x152.png +0 -0
  83. package/core/favicon_old/apple-icon-180x180.png +0 -0
  84. package/core/favicon_old/apple-icon-57x57.png +0 -0
  85. package/core/favicon_old/apple-icon-60x60.png +0 -0
  86. package/core/favicon_old/apple-icon-72x72.png +0 -0
  87. package/core/favicon_old/apple-icon-76x76.png +0 -0
  88. package/core/favicon_old/apple-icon-precomposed.png +0 -0
  89. package/core/favicon_old/apple-icon.png +0 -0
  90. package/core/favicon_old/browserconfig.xml +11 -0
  91. package/core/favicon_old/favicon-16x16.png +0 -0
  92. package/core/favicon_old/favicon-32x32.png +0 -0
  93. package/core/favicon_old/favicon-96x96.png +0 -0
  94. package/core/favicon_old/favicon.ico +0 -0
  95. package/core/favicon_old/manifest.json +41 -0
  96. package/core/favicon_old/ms-icon-144x144.png +0 -0
  97. package/core/favicon_old/ms-icon-150x150.png +0 -0
  98. package/core/favicon_old/ms-icon-310x310.png +0 -0
  99. package/core/favicon_old/ms-icon-70x70.png +0 -0
  100. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-300.eot +0 -0
  101. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-300.svg +483 -0
  102. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-300.ttf +0 -0
  103. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-300.woff +0 -0
  104. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-300.woff2 +0 -0
  105. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-500.eot +0 -0
  106. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-500.svg +486 -0
  107. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-500.ttf +0 -0
  108. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-500.woff +0 -0
  109. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-500.woff2 +0 -0
  110. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-700.eot +0 -0
  111. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-700.svg +484 -0
  112. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-700.ttf +0 -0
  113. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-700.woff +0 -0
  114. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-700.woff2 +0 -0
  115. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.eot +0 -0
  116. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.svg +486 -0
  117. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.ttf +0 -0
  118. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.woff +0 -0
  119. package/core/fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.woff2 +0 -0
  120. package/core/js/ControllerRegistry.js +421 -0
  121. package/core/js/NotificationManager.js +62 -0
  122. package/core/js/PluginAPI.js +39 -0
  123. package/core/js/PluginManager.js +851 -0
  124. package/core/js/RouteMatcher.js +142 -0
  125. package/core/js/__tests__/ControllerRegistry.test.js +378 -0
  126. package/core/js/__tests__/NotificationManager.test.js +57 -0
  127. package/core/js/__tests__/PluginAPI.test.js +25 -0
  128. package/core/js/__tests__/RouteMatcher.test.js +33 -0
  129. package/core/js/__tests__/accessClient.test.js +582 -0
  130. package/core/js/__tests__/api.util.v1.test.js +336 -0
  131. package/core/js/__tests__/appStores.test.js +47 -0
  132. package/core/js/__tests__/devBounce.test.js +28 -0
  133. package/core/js/__tests__/html.util.test.js +18 -0
  134. package/core/js/__tests__/pluginFolder.util.test.js +106 -0
  135. package/core/js/__tests__/pluginPackage.test.js +134 -0
  136. package/core/js/__tests__/pluginUiZip.test.js +47 -0
  137. package/core/js/__tests__/sdkLevel.test.js +34 -0
  138. package/core/js/api.util.js +433 -0
  139. package/core/js/appStores.js +93 -0
  140. package/core/js/basePath.js +10 -0
  141. package/core/js/html.util.js +26 -0
  142. package/core/js/pluginFolder.util.js +95 -0
  143. package/core/js/tooltip.util.js +59 -0
  144. package/core/js/variables.js +95 -0
  145. package/core/js/version.util.js +100 -0
  146. package/core/scss/_pano-tokens.scss +51 -0
  147. package/core/scss/custom-bootstrap.scss +210 -0
  148. package/core/scss/fonts.scss +85 -0
  149. package/core/scss/main.scss +389 -0
  150. package/core/scss/themes.scss +122 -0
  151. package/package.json +63 -11
  152. package/src/__tests__/controllers.test.js +220 -0
  153. package/src/__tests__/views.spike.test.js +472 -0
  154. package/src/components/{index.js → panel.js} +9 -6
  155. package/src/components/theme.js +18 -0
  156. package/src/controllers.js +127 -0
  157. package/src/index.js +1 -1
  158. package/src/runtime-specifiers.js +88 -0
  159. package/src/svelte.js +3 -2
  160. package/src/types.js +5 -3
  161. package/src/utils/api.js +42 -1
  162. package/src/utils/auth.js +8 -0
  163. package/src/utils/component.js +4 -2
  164. package/src/utils/route.js +16 -0
  165. package/src/utils/text.js +8 -0
  166. package/src/views.js +29 -0
@@ -0,0 +1,95 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ // plugins/<pluginId>/ is shared with the backend: it is also the plugin's data folder
5
+ // (config.conf, secret.key, ...). The UI engine may only touch what it writes itself.
6
+ export const UI_OWNED_ENTRIES = [
7
+ "client",
8
+ "server",
9
+ "manifest.json",
10
+ "contract",
11
+ "pano-plugin.json",
12
+ "controllers",
13
+ "samples",
14
+ ];
15
+
16
+ export const PACKAGE_FILE_NAME = "pano-plugin.json";
17
+
18
+ /**
19
+ * Reads the package index (pano-plugin.json) of a plugin folder.
20
+ * A missing or unreadable file means an old plugin without a package: returns null.
21
+ * @param {string} pluginFolder
22
+ * @returns {{ namespace?: string, styles?: any, views?: any, package: object } | null}
23
+ */
24
+ export function readPluginPackage(pluginFolder) {
25
+ let json;
26
+ try {
27
+ json = JSON.parse(fs.readFileSync(path.join(pluginFolder, PACKAGE_FILE_NAME), "utf8"));
28
+ } catch {
29
+ return null;
30
+ }
31
+ if (!json || typeof json !== "object" || Array.isArray(json)) return null;
32
+ const out = { package: json };
33
+ if (typeof json.namespace === "string" && json.namespace) out.namespace = json.namespace;
34
+ if (json.styles !== undefined) out.styles = json.styles;
35
+ if (json.views !== undefined) out.views = json.views;
36
+ return out;
37
+ }
38
+
39
+ /** Removes only the UI-owned entries of a plugin folder, then the folder itself if it is empty. */
40
+ export function removePluginUiFiles(pluginFolder) {
41
+ for (const entry of UI_OWNED_ENTRIES) {
42
+ fs.rmSync(path.join(pluginFolder, entry), { recursive: true, force: true });
43
+ }
44
+
45
+ try {
46
+ fs.rmdirSync(pluginFolder); // only succeeds when empty
47
+ } catch {
48
+ // missing or holds foreign files (plugin data) - leave it alone
49
+ }
50
+ }
51
+
52
+ /** True when both paths hold the same file, or the same tree of files with the same bytes. */
53
+ export function sameContent(a, b) {
54
+ if (!fs.existsSync(a) || !fs.existsSync(b)) return false;
55
+
56
+ const statA = fs.statSync(a);
57
+ const statB = fs.statSync(b);
58
+
59
+ if (statA.isDirectory() !== statB.isDirectory()) return false;
60
+
61
+ if (!statA.isDirectory()) {
62
+ return statA.size === statB.size && fs.readFileSync(a).equals(fs.readFileSync(b));
63
+ }
64
+
65
+ const namesA = fs.readdirSync(a).sort();
66
+ const namesB = fs.readdirSync(b).sort();
67
+
68
+ if (namesA.length !== namesB.length || namesA.some((name, i) => name !== namesB[i])) return false;
69
+
70
+ return namesA.every((name) => sameContent(path.join(a, name), path.join(b, name)));
71
+ }
72
+
73
+ /**
74
+ * Replaces the UI-owned entries in pluginFolder with those of stagingDir, keeping all other files.
75
+ *
76
+ * An entry whose content did not change is left untouched on disk. Development mode downloads every
77
+ * plugin UI again on each server render; rewriting identical files made the dev server's file watcher
78
+ * reload the page right after it had loaded (a blank flash after every refresh).
79
+ */
80
+ export function replacePluginUiFiles(stagingDir, pluginFolder) {
81
+ fs.mkdirSync(pluginFolder, { recursive: true });
82
+
83
+ for (const entry of UI_OWNED_ENTRIES) {
84
+ const target = path.join(pluginFolder, entry);
85
+ const source = path.join(stagingDir, entry);
86
+
87
+ if (sameContent(source, target)) continue;
88
+
89
+ fs.rmSync(target, { recursive: true, force: true });
90
+
91
+ if (fs.existsSync(source)) fs.renameSync(source, target);
92
+ }
93
+
94
+ fs.rmSync(stagingDir, { recursive: true, force: true });
95
+ }
@@ -0,0 +1,59 @@
1
+ import tippy from 'tippy.js';
2
+ import 'tippy.js/dist/tippy.css';
3
+ import { page } from './appStores.js';
4
+
5
+ function setTooltip(element, [value, options]) {
6
+ const instance = typeof element._tippy === 'undefined' ? tippy(element) : element._tippy;
7
+
8
+ instance.setContent(value);
9
+ instance.setProps(options);
10
+ }
11
+
12
+ export default function tooltip(element, properties) {
13
+ let unsubscribePage;
14
+ let instance;
15
+
16
+ const init = (props) => {
17
+ if (!props) return;
18
+
19
+ let [value, options] = props;
20
+ if (!value) {
21
+ if (instance) instance.destroy();
22
+ instance = null;
23
+ return;
24
+ }
25
+
26
+ if (!instance) {
27
+ instance = tippy(element);
28
+ }
29
+
30
+ const mergedOptions = {
31
+ content: value,
32
+ placement: 'bottom',
33
+ interactive: true,
34
+ animation: 'fade',
35
+ ...options
36
+ };
37
+
38
+ instance.setProps(mergedOptions);
39
+
40
+ if (!unsubscribePage) {
41
+ unsubscribePage = page.subscribe(() => {
42
+ if (instance) instance.hide();
43
+ });
44
+ }
45
+ };
46
+
47
+ init(properties);
48
+
49
+ return {
50
+ update(updatedProperties) {
51
+ init(updatedProperties);
52
+ },
53
+
54
+ destroy() {
55
+ if (instance) instance.destroy();
56
+ if (unsubscribePage) unsubscribePage();
57
+ },
58
+ };
59
+ }
@@ -0,0 +1,95 @@
1
+ export let API_URL = import.meta.env.VITE_API_URL;
2
+ export const UI_URL = import.meta.env.VITE_UI_URL ?? '/';
3
+ export const PANEL_URL = import.meta.env.VITE_PANEL_URL ?? '/panel';
4
+ export const SETUP_URL = import.meta.env.VITE_SETUP_URL ?? '/';
5
+ export let PANO_WEBSITE_URL = import.meta.env.VITE_PANO_WEBSITE_URL;
6
+ export let PANO_WEBSITE_API_URL = import.meta.env.VITE_PANO_WEBSITE_API_URL;
7
+ export const PRERELEASE = import.meta.env.VITE_PRERELEASE;
8
+
9
+ // Default matches the Pano backend's cookie prefix — a theme without an explicit
10
+ // VITE_COOKIE_PREFIX would otherwise look up 'undefinedauth_token' and treat every
11
+ // logged-in visitor as anonymous on SSR navigations.
12
+ export const COOKIE_PREFIX = import.meta.env.VITE_COOKIE_PREFIX ?? 'pano_';
13
+
14
+ export const CSRF_TOKEN_COOKIE_NAME = 'csrf_token';
15
+ export const JWT_COOKIE_NAME = 'auth_token';
16
+
17
+ export const CSRF_HEADER = 'X-CSRF-Token';
18
+
19
+ /** Dev-only tool pages (the view catalogue) live in the vite dev server alone: the Pano dev server cannot serve them. */
20
+ const DEV_ONLY_PREFIX = '/__pano/';
21
+
22
+ /**
23
+ * Where a page opened on a vite dev port bounces to, or null when it stays. Pure, so a test can run it.
24
+ * @param {{ apiUrl: string, currentHref: string, basePath?: string }} input
25
+ * @returns {string | null}
26
+ */
27
+ export function devBounceTarget({ apiUrl, currentHref, basePath = '/' }) {
28
+ const api = new URL(apiUrl);
29
+ const currentUrl = new URL(currentHref);
30
+
31
+ // Only bounce when the page was opened on the vite port of the SAME machine
32
+ // (localhost:3000 -> localhost:8088). Reaching the Pano dev server through another
33
+ // hostname — a LAN address, ngrok, cloudflared — is legitimate: Pano already proxies vite
34
+ // for that visitor, and API_URL's host means nothing on their machine.
35
+ if (!isSameDevHost(currentUrl.hostname, api.hostname)) return null;
36
+
37
+ if (currentUrl.port === api.port && currentUrl.protocol === api.protocol) return null;
38
+
39
+ // The view catalogue (`/__pano/...`) exists in `vite dev` only; the Pano on the API port serves the built theme,
40
+ // where the same path is a 404. Bouncing there made every catalogue page a 404.
41
+ if (currentUrl.pathname.startsWith(DEV_ONLY_PREFIX)) return null;
42
+
43
+ let pathname = currentUrl.pathname;
44
+
45
+ if (basePath !== '/' && !pathname.startsWith(basePath)) {
46
+ pathname = basePath + (pathname === '/' ? '' : pathname);
47
+ }
48
+
49
+ return new URL(pathname + currentUrl.search + currentUrl.hash, api.origin).toString();
50
+ }
51
+
52
+ export function checkDomainRedirection() {
53
+ if (typeof window === 'undefined' || !API_URL || API_URL.startsWith('/')) return;
54
+
55
+ // In production API_URL is the Pano host's internal backend address (loopback or
56
+ // server.host:internal-port) — never a browser-reachable origin, so redirecting on it
57
+ // would bounce reverse-proxied visitors to the internal port. Canonical-host redirects
58
+ // are owned by the backend (WebsiteUrlRedirectHandler); this helper only smooths the
59
+ // dev workflow: hitting a vite dev port directly bounces you into the Pano dev server.
60
+ if (!import.meta.env.DEV) return;
61
+
62
+ try {
63
+ const target = devBounceTarget({
64
+ apiUrl: API_URL,
65
+ currentHref: window.location.href,
66
+ basePath: UI_URL || PANEL_URL || SETUP_URL || '/',
67
+ });
68
+
69
+ if (target) window.location.href = target;
70
+ } catch (e) {
71
+ console.error('Failed to check domain redirection:', e);
72
+ }
73
+ }
74
+
75
+ function isLoopbackHost(hostname) {
76
+ const h = hostname.toLowerCase();
77
+ return h === 'localhost' || h.endsWith('.localhost') || h === '[::1]' || h.startsWith('127.');
78
+ }
79
+
80
+ function isSameDevHost(a, b) {
81
+ const norm = (h) => (isLoopbackHost(h) ? 'localhost' : h.toLowerCase());
82
+ return norm(a) === norm(b);
83
+ }
84
+
85
+ export function updateApiUrl(apiUrl) {
86
+ API_URL = apiUrl;
87
+ }
88
+
89
+ export function updatePanoWebsiteUrl(panoWebsiteUrl) {
90
+ PANO_WEBSITE_URL = panoWebsiteUrl;
91
+ }
92
+
93
+ export function updatePanoWebsiteApiUrl(panoWebsiteApiUrl) {
94
+ PANO_WEBSITE_API_URL = panoWebsiteApiUrl;
95
+ }
@@ -0,0 +1,100 @@
1
+ /** Matches Kotlin `VersionUtil.isSemVer` (optional leading v tag). */
2
+ function isSemVer(version) {
3
+ return /^v?\d+\.\d+\.\d+(-[\w.]+)?$/.test(version);
4
+ }
5
+
6
+ /** Kotlin `parseVersion(removePrefix(version, "v"))` with hyphen split limited to core + prerelease remainder. */
7
+ function parseVersion(version) {
8
+ const cleanVersion = version.replace(/^v/, '');
9
+ const hyphen = cleanVersion.indexOf('-');
10
+ const corePart = hyphen === -1 ? cleanVersion : cleanVersion.slice(0, hyphen);
11
+ const preRaw = hyphen === -1 ? '' : cleanVersion.slice(hyphen + 1);
12
+ const coreParts = corePart.split('.').map((p) => Number(p));
13
+ const preParts = preRaw
14
+ ? preRaw.split('.').map((part) => {
15
+ const parsed = /^-?\d+$/.test(part) ? Number(part) : NaN;
16
+ return Number.isNaN(parsed) ? part : parsed;
17
+ })
18
+ : [];
19
+ return { coreParts, preParts };
20
+ }
21
+
22
+ /** Kotlin `compareVersions`; does not coerce non-tags (opaque tags compare only via `===`). */
23
+ export function compareVersions(a, b) {
24
+ const isASemVer = isSemVer(a);
25
+ const isBSemVer = isSemVer(b);
26
+
27
+ if (!isASemVer && !isBSemVer) return 0;
28
+ if (!isASemVer) return -1;
29
+ if (!isBSemVer) return 1;
30
+
31
+ const va = parseVersion(a);
32
+ const vb = parseVersion(b);
33
+
34
+ const len = Math.max(va.coreParts.length, vb.coreParts.length);
35
+ for (let i = 0; i < len; i++) {
36
+ const ai = va.coreParts[i] || 0;
37
+ const bi = vb.coreParts[i] || 0;
38
+ if (ai !== bi) return ai - bi;
39
+ }
40
+
41
+ const prePriority = ['alpha', 'beta'];
42
+
43
+ const isAPre = va.preParts.length > 0;
44
+ const isBPre = vb.preParts.length > 0;
45
+
46
+ if (!isAPre && isBPre) return 1;
47
+ if (isAPre && !isBPre) return -1;
48
+
49
+ for (let i = 0; i < Math.max(va.preParts.length, vb.preParts.length); i++) {
50
+ const ap = va.preParts[i];
51
+ const bp = vb.preParts[i];
52
+ if (ap === bp) continue;
53
+
54
+ if (typeof ap === 'string' && typeof bp === 'string') {
55
+ const ai = prePriority.indexOf(ap);
56
+ const bi = prePriority.indexOf(bp);
57
+ return (ai === -1 ? 99 : ai) - (bi === -1 ? 99 : bi);
58
+ }
59
+ if (typeof ap === 'number' && typeof bp === 'number') return ap - bp;
60
+ return typeof ap === 'string' ? -1 : 1;
61
+ }
62
+
63
+ return 0;
64
+ }
65
+
66
+ /** Kotlin `isVersionHigher` — installed `local-build` is treated below any normal semver release. */
67
+ export function isStoreVersionHigher(latestPublishedTag, installedTag) {
68
+ const normalizedInstalled =
69
+ installedTag === 'local-build' ? 'v1.0.0-alpha.0' : installedTag;
70
+ return compareVersions(latestPublishedTag, normalizedInstalled) > 0;
71
+ }
72
+
73
+ /**
74
+ * Same release according to Kotlin store rules (exact tag strings or semver-equal, including optional `v`).
75
+ */
76
+ export function areStoreVersionTagsEqual(a, b) {
77
+ if (a === b) return true;
78
+ if (a == null || b == null) return false;
79
+ if (!isSemVer(a) || !isSemVer(b)) return false;
80
+ return compareVersions(a, b) === 0;
81
+ }
82
+
83
+ export function isPanoVersionCompatible(current, required) {
84
+ if (current === 'local-build') return true;
85
+ if (!isSemVer(current) || !isSemVer(required)) return false;
86
+
87
+ const currentParsed = parseVersion(current);
88
+ const requiredParsed = parseVersion(required);
89
+
90
+ const coreEqual =
91
+ JSON.stringify(currentParsed.coreParts) === JSON.stringify(requiredParsed.coreParts);
92
+
93
+ const requiredIsPre = requiredParsed.preParts.length > 0;
94
+
95
+ if (coreEqual && !requiredIsPre) {
96
+ return true;
97
+ }
98
+
99
+ return compareVersions(current, required) >= 0;
100
+ }
@@ -0,0 +1,51 @@
1
+ // Generated by scripts/build-tokens.js from packages/plugin-kit/src/styles/tokens.map.js. Do not edit.
2
+ //
3
+ // Imported last by core/scss/main.scss; a theme that imports Bootstrap on its own imports this file
4
+ // after Bootstrap and its tokens (@import "node_modules/@panomc/sdk/core/scss/pano-tokens";).
5
+ // Skipped when $pano-literal-colours is false: the Bootstrap base sheet carries no --pano-* variable.
6
+ $pano-literal-colours: true !default;
7
+
8
+ @if $pano-literal-colours {
9
+ /* pano-tokens: bridge */
10
+ :root,
11
+ [data-bs-theme] {
12
+ --pano-color-bg: var(--bs-body-bg);
13
+ --pano-color-surface: var(--bs-secondary-bg);
14
+ --pano-color-surface-raised: var(--bs-tertiary-bg);
15
+ --pano-color-text: var(--bs-body-color);
16
+ --pano-color-text-muted: var(--bs-secondary-color);
17
+ --pano-color-text-subtle: var(--bs-tertiary-color);
18
+ --pano-color-heading: var(--bs-emphasis-color);
19
+ --pano-color-border: var(--bs-border-color);
20
+ --pano-color-primary: var(--bs-primary);
21
+ --pano-color-secondary: var(--bs-secondary);
22
+ --pano-color-success: var(--bs-success);
23
+ --pano-color-danger: var(--bs-danger);
24
+ --pano-color-warning: var(--bs-warning);
25
+ --pano-color-info: var(--bs-info);
26
+ --pano-color-link: var(--bs-link-color);
27
+ --pano-color-link-hover: var(--bs-link-hover-color);
28
+ --pano-radius: var(--bs-border-radius);
29
+ --pano-radius-sm: var(--bs-border-radius-sm);
30
+ --pano-radius-lg: var(--bs-border-radius-lg);
31
+ --pano-radius-pill: var(--bs-border-radius-pill);
32
+ --pano-border-width: var(--bs-border-width);
33
+ --pano-shadow-sm: var(--bs-box-shadow-sm);
34
+ --pano-shadow: var(--bs-box-shadow);
35
+ --pano-shadow-lg: var(--bs-box-shadow-lg);
36
+ --pano-font-body: var(--bs-body-font-family);
37
+ --pano-font-heading: #{if($headings-font-family, $headings-font-family, inherit)};
38
+ --pano-font-mono: var(--bs-font-monospace);
39
+ --pano-font-size: var(--bs-body-font-size);
40
+ --pano-font-weight: var(--bs-body-font-weight);
41
+ --pano-font-weight-bold: #{$font-weight-bold};
42
+ --pano-line-height: var(--bs-body-line-height);
43
+ --pano-space: #{$spacer};
44
+ }
45
+
46
+ // Zero specificity, so the on-* values that define-theme sets in a palette block win.
47
+ :where(:root, [data-bs-theme]) {
48
+ --pano-color-on-primary: #{color-contrast($primary)};
49
+ --pano-color-on-secondary: #{color-contrast($secondary)};
50
+ }
51
+ }
@@ -0,0 +1,210 @@
1
+ // When false, the rules below that hard-code literal colours (the theme-colour utilities, alerts,
2
+ // badges and the .btn border) and the palette button re-skins in themes.scss are not emitted. Used
3
+ // only to compile the Bootstrap base sheet of the fallback stylesheet (scripts/build-tokens.js).
4
+ $pano-literal-colours: true !default;
5
+
6
+ // Colors
7
+
8
+ $min-contrast-ratio: 2 !default;
9
+
10
+ $primary: #044389 !default;
11
+ $secondary: #ffc947 !default;
12
+ $danger: #ed5565 !default;
13
+ $success: #4ecdc4 !default;
14
+ $warning: #967adc !default;
15
+ $info: #1e96fc !default;
16
+ $dark: #0a1931 !default;
17
+ $gray: #ccd1d9 !default;
18
+ $light: #f5f7fa !default;
19
+ $white: #fff !default;
20
+ $black: #000 !default;
21
+ $purple: #6f42c1 !default;
22
+ $transparent: transparent !default;
23
+
24
+ $theme-colors: (
25
+ "transparent": $transparent,
26
+ "primary": $primary,
27
+ "secondary": $secondary,
28
+ "danger": $danger,
29
+ "success": $success,
30
+ "warning": $warning,
31
+ "info": $info,
32
+ "light": $light,
33
+ "dark": $dark,
34
+ "gray": $gray,
35
+ "purple": $purple,
36
+ "white": $white,
37
+ "black": $black,
38
+ ) !default;
39
+
40
+ // Color shades
41
+
42
+ $primaries: (
43
+ "primary-100": #c9d2ff,
44
+ "primary-200": #a4b3ff,
45
+ "primary-300": #7e94ff,
46
+ "primary-400": #5975ff,
47
+ "primary-500": $primary,
48
+ "primary-600": #314ac3,
49
+ "primary-700": #2136a1,
50
+ "primary-800": #14267f,
51
+ "primary-900": #0a185d,
52
+ ) !default;
53
+
54
+ $secondaries: (
55
+ "secondary-100": #dbffdd,
56
+ "secondary-200": #c0ffc4,
57
+ "secondary-300": #a2faa8,
58
+ "secondary-400": #89dd8f,
59
+ "secondary-500": $secondary,
60
+ "secondary-600": #5ca361,
61
+ "secondary-700": #48864c,
62
+ "secondary-800": #366939,
63
+ "secondary-900": #254b27,
64
+ ) !default;
65
+
66
+ // SETTINGS
67
+
68
+ $enable-shadows: true;
69
+ $enable-gradients: false;
70
+
71
+ // GLOBAL TOKENS
72
+
73
+ $border-width: 1.5px;
74
+ $border-width-sm: 2px;
75
+ $border-width-lg: 3px;
76
+ $border-width-xl: 4px;
77
+
78
+ $border-radius: 9.6px;
79
+ $border-radius-sm: 9.6px;
80
+ $border-radius-lg: 9.6px;
81
+
82
+ $box-shadow-inset: 0;
83
+ $box-shadow-sm: 0 1.5px 0 rgba($dark, 0.1
84
+ ) !default;
85
+ $box-shadow: 0 1.5px 0 rgba($dark, 0.1) !default;
86
+ $box-shadow-lg: 0 4px 0 rgba($dark, 0.1) !default;
87
+
88
+ // Fonts
89
+
90
+ $font-weight-base: 500 !default;
91
+ $font-weight-normal: 500 !default;
92
+ $font-weight-bold: 600 !default;
93
+ $font-weight-bolder: 700 !default;
94
+ $lead-font-weight: 400 !default;
95
+ $font-family-base: "Quicksand", sans-serif !default;
96
+
97
+ // Headings
98
+
99
+ // Buttons
100
+
101
+ $btn-active-bg-tint-amount: 0% !default;
102
+ $btn-box-shadow: $box-shadow-sm !default;
103
+ $btn-active-box-shadow: 0 !default;
104
+
105
+ @if $pano-literal-colours {
106
+ .btn:not(.btn-link) {
107
+ border: 1.5px solid rgba(255, 255, 255, 0.1) !important;
108
+ }
109
+ }
110
+
111
+ // Cards
112
+
113
+ // Header and footer sit transparent on the card, with no rule towards the body. `.card >` keeps
114
+ // them ahead of Bootstrap's own rules, which are imported after this file.
115
+ .card > .card-header {
116
+ border-bottom: 0;
117
+ background-color: transparent;
118
+ }
119
+
120
+ .card > .card-footer {
121
+ border-top: 0;
122
+ background-color: transparent;
123
+ }
124
+
125
+ // Modals
126
+
127
+ $modal-backdrop-opacity: 0.35 !default;
128
+
129
+ // Alerts
130
+
131
+ $alert-padding-y: 1rem !default;
132
+ $alert-padding-x: 1.25rem !default;
133
+ $alert-margin-bottom: 1rem !default;
134
+ $alert-border-radius: $border-radius !default;
135
+ $alert-border-width: $border-width !default;
136
+ $alert-bg-scale: -92% !default;
137
+ $alert-border-scale: -80% !default;
138
+ $alert-color-scale: 30% !default;
139
+ $alert-dismissible-padding-r: 3rem !default;
140
+
141
+ // Focus Ring
142
+
143
+ $focus-ring-opacity: .8 !default;
144
+
145
+ // Lines
146
+
147
+ $link-decoration: none !default;
148
+ $link-hover-decoration: underline !default;
149
+
150
+ // Dropdowns
151
+
152
+ // Subtle & Emphasis Colors Utilities
153
+ @if $pano-literal-colours {
154
+ @each $color, $value in $theme-colors {
155
+
156
+ // Emphasis Text
157
+ .text-#{$color}-emphasis {
158
+ color: shade-color($value, 20%) !important;
159
+ }
160
+
161
+ // Subtle Backgrounds
162
+ .bg-#{$color}-subtle {
163
+ background-color: rgba($value, 0.12) !important;
164
+ color: $value !important; // Some BS versions use emphasis color here, keeping it base color for Pano
165
+ border: 1px solid rgba($value, 0.2) !important;
166
+ }
167
+
168
+ // Alerts
169
+ .alert-#{$color} {
170
+ color: shade-color($value, 15%) !important;
171
+ border: $border-width solid rgba($value, 0.25) !important;
172
+ border-radius: $border-radius !important;
173
+
174
+ .alert-link {
175
+ color: shade-color($value, 30%) !important;
176
+ font-weight: $font-weight-bold;
177
+ }
178
+ }
179
+
180
+ // Aliases for 'subtile' if used by mistake
181
+ .bg-#{$color}-subtile {
182
+ @extend .bg-#{$color}-subtle;
183
+ }
184
+
185
+ // Badge Theming (Solid & High Contrast)
186
+ .badge {
187
+
188
+ &.text-bg-#{$color},
189
+ &.text-bg-#{$color}-subtle {
190
+ background-color: $value !important;
191
+ color: color-contrast($value) !important;
192
+ border: 1px solid rgba($black, 0.1) !important;
193
+ }
194
+ }
195
+ }
196
+ }
197
+
198
+ // Background Gradients
199
+ @if $enable-gradients {
200
+ .bg-gradient {
201
+ background-image: var(--bs-gradient) !important;
202
+ }
203
+ }
204
+
205
+ // Background Opacity
206
+ @each $opacity in 10, 25, 50, 75 {
207
+ .bg-opacity-#{$opacity} {
208
+ --bs-bg-opacity: #{$opacity * 0.01} !important;
209
+ }
210
+ }
@@ -0,0 +1,85 @@
1
+ // Fonts
2
+
3
+ /* quicksand-300 - latin-ext_latin_vietnamese */
4
+ @font-face {
5
+ font-family: 'Quicksand';
6
+ font-style: normal;
7
+ font-weight: 300;
8
+ src: url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-300.eot');
9
+ /* IE9 Compat Modes */
10
+ src: local('Quicksand Light'),
11
+ local('Quicksand-Light'),
12
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-300.eot?#iefix') format('embedded-opentype'),
13
+ /* IE6-IE8 */
14
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-300.woff2') format('woff2'),
15
+ /* Super Modern Browsers */
16
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-300.woff') format('woff'),
17
+ /* Modern Browsers */
18
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-300.ttf') format('truetype'),
19
+ /* Safari, Android, iOS */
20
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-300.svg#Quicksand') format('svg');
21
+ /* Legacy iOS */
22
+ }
23
+
24
+ /* quicksand-regular - latin-ext_latin_vietnamese */
25
+ @font-face {
26
+ font-family: 'Quicksand';
27
+ font-style: normal;
28
+ font-weight: 400;
29
+ src: url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.eot');
30
+ /* IE9 Compat Modes */
31
+ src: local('Quicksand Regular'),
32
+ local('Quicksand-Regular'),
33
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.eot?#iefix') format('embedded-opentype'),
34
+ /* IE6-IE8 */
35
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.woff2') format('woff2'),
36
+ /* Super Modern Browsers */
37
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.woff') format('woff'),
38
+ /* Modern Browsers */
39
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.ttf') format('truetype'),
40
+ /* Safari, Android, iOS */
41
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-regular.svg#Quicksand') format('svg');
42
+ /* Legacy iOS */
43
+ }
44
+
45
+ /* quicksand-500 - latin-ext_latin_vietnamese */
46
+ @font-face {
47
+ font-family: 'Quicksand';
48
+ font-style: normal;
49
+ font-weight: 500;
50
+ src: url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-500.eot');
51
+ /* IE9 Compat Modes */
52
+ src: local('Quicksand Medium'),
53
+ local('Quicksand-Medium'),
54
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-500.eot?#iefix') format('embedded-opentype'),
55
+ /* IE6-IE8 */
56
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-500.woff2') format('woff2'),
57
+ /* Super Modern Browsers */
58
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-500.woff') format('woff'),
59
+ /* Modern Browsers */
60
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-500.ttf') format('truetype'),
61
+ /* Safari, Android, iOS */
62
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-500.svg#Quicksand') format('svg');
63
+ /* Legacy iOS */
64
+ }
65
+
66
+ /* quicksand-700 - latin-ext_latin_vietnamese */
67
+ @font-face {
68
+ font-family: 'Quicksand';
69
+ font-style: normal;
70
+ font-weight: 700;
71
+ src: url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-700.eot');
72
+ /* IE9 Compat Modes */
73
+ src: local('Quicksand Bold'),
74
+ local('Quicksand-Bold'),
75
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-700.eot?#iefix') format('embedded-opentype'),
76
+ /* IE6-IE8 */
77
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-700.woff2') format('woff2'),
78
+ /* Super Modern Browsers */
79
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-700.woff') format('woff'),
80
+ /* Modern Browsers */
81
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-700.ttf') format('truetype'),
82
+ /* Safari, Android, iOS */
83
+ url('#{$pano-asset-path}fonts/quicksand-v8-latin-ext_latin_vietnamese-700.svg#Quicksand') format('svg');
84
+ /* Legacy iOS */
85
+ }