@panomc/theme-core 1.0.0-dev.39
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/bundle-internal-libs.js +104 -0
- package/bin/check.js +253 -0
- package/bin/generate-licenses.js +125 -0
- package/bin/generate-runtime-shims.js +180 -0
- package/bin/license/file-fingerprint.js +74 -0
- package/bin/license/finalize-fingerprint.js +72 -0
- package/bin/license/generate-license-constants.js +335 -0
- package/bin/new.js +281 -0
- package/bin/package-zip.js +57 -0
- package/bin/sync.js +326 -0
- package/bin/templates/app.html +59 -0
- package/bin/theme-core.js +103 -0
- package/package.json +77 -0
- package/src/index.js +15 -0
- package/src/kit/hooks-client.js +128 -0
- package/src/kit/hooks-server.js +319 -0
- package/src/kit/license-runtime.js +373 -0
- package/src/kit/resolve.js +71 -0
- package/src/kit/specifiers.js +62 -0
- package/src/kit/svelte-config.js +74 -0
- package/src/kit/vite-config.js +249 -0
- package/src/lib/NotificationManager.js +1 -0
- package/src/lib/PluginAPI.js +368 -0
- package/src/lib/PluginManager.js +1 -0
- package/src/lib/Store.js +43 -0
- package/src/lib/api.util.js +5 -0
- package/src/lib/auth.util.js +77 -0
- package/src/lib/components/App.svelte +10 -0
- package/src/lib/components/Breadcrumb.svelte +88 -0
- package/src/lib/components/CardHeader.svelte +42 -0
- package/src/lib/components/Date.svelte +34 -0
- package/src/lib/components/DefaultToast.svelte +11 -0
- package/src/lib/components/ErrorAlert.svelte +16 -0
- package/src/lib/components/Footer.svelte +223 -0
- package/src/lib/components/Header.svelte +122 -0
- package/src/lib/components/Hook.svelte +71 -0
- package/src/lib/components/LinkCodeInput.svelte +129 -0
- package/src/lib/components/LoginFormBody.svelte +90 -0
- package/src/lib/components/Main.svelte +76 -0
- package/src/lib/components/Navbar.svelte +462 -0
- package/src/lib/components/NoContent.svelte +14 -0
- package/src/lib/components/NotificationContainer.svelte +304 -0
- package/src/lib/components/OnlineAdmins.svelte +64 -0
- package/src/lib/components/PageActions.svelte +39 -0
- package/src/lib/components/PageTitle.svelte +36 -0
- package/src/lib/components/Pagination.svelte +65 -0
- package/src/lib/components/PlayerHead.svelte +58 -0
- package/src/lib/components/PlayerPermissionBadge.svelte +19 -0
- package/src/lib/components/PlayerStatusBadge.svelte +63 -0
- package/src/lib/components/Post.svelte +240 -0
- package/src/lib/components/Posts.svelte +19 -0
- package/src/lib/components/RegisterForm.svelte +125 -0
- package/src/lib/components/Sidebar.svelte +12 -0
- package/src/lib/components/SuccessAlert.svelte +14 -0
- package/src/lib/components/TicketRow.svelte +61 -0
- package/src/lib/components/TicketStatus.svelte +24 -0
- package/src/lib/components/Tickets.svelte +43 -0
- package/src/lib/components/Toast.svelte +13 -0
- package/src/lib/components/ToastContainer.svelte +83 -0
- package/src/lib/components/ViewComponent.svelte +8 -0
- package/src/lib/components/modals/CloseTicketConfirmModal.svelte +121 -0
- package/src/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte +93 -0
- package/src/lib/components/modals/LogoutSessionConfirmModal.svelte +61 -0
- package/src/lib/components/sidebars/HomeSidebar.svelte +333 -0
- package/src/lib/components/sidebars/PlayerDetailSidebar.svelte +124 -0
- package/src/lib/components/sidebars/ProfileSidebar.svelte +149 -0
- package/src/lib/components/sidebars/SupportSidebar.svelte +54 -0
- package/src/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte +84 -0
- package/src/lib/csrf.js +5 -0
- package/src/lib/init.libs.js +2 -0
- package/src/lib/language.util.js +154 -0
- package/src/lib/layouts/AppLayout.svelte +59 -0
- package/src/lib/layouts/AuthLayout.svelte +29 -0
- package/src/lib/layouts/MainLayout.svelte +60 -0
- package/src/lib/layouts/ProfileLayout.svelte +29 -0
- package/src/lib/layouts/ThemeSettingsLayout.svelte +37 -0
- package/src/lib/layouts/TicketsLayout.svelte +31 -0
- package/src/lib/loginInput.util.js +4 -0
- package/src/lib/orderNavLinks.util.js +58 -0
- package/src/lib/pages/ActivateEmailPage.svelte +48 -0
- package/src/lib/pages/ConfirmNewEmailPage.svelte +48 -0
- package/src/lib/pages/ErrorPage.svelte +41 -0
- package/src/lib/pages/HomePage.svelte +35 -0
- package/src/lib/pages/LoginPage.svelte +448 -0
- package/src/lib/pages/NotificationsPage.svelte +70 -0
- package/src/lib/pages/PlayerDetailPage.svelte +29 -0
- package/src/lib/pages/PostDetailPage.svelte +36 -0
- package/src/lib/pages/PreviewPostPage.svelte +38 -0
- package/src/lib/pages/RegisterPage.svelte +144 -0
- package/src/lib/pages/RenewPasswordPage.svelte +49 -0
- package/src/lib/pages/ResetPasswordPage.svelte +55 -0
- package/src/lib/pages/RulesPage.svelte +52 -0
- package/src/lib/pages/SupportPage.svelte +36 -0
- package/src/lib/pages/ThemeSettingsPage.svelte +551 -0
- package/src/lib/pages/profile/ProfilePage.svelte +32 -0
- package/src/lib/pages/profile/SettingsPage.svelte +163 -0
- package/src/lib/pages/profile/TicketsPage.svelte +54 -0
- package/src/lib/pages/ticket/CreateTicketPage.svelte +48 -0
- package/src/lib/pages/ticket/TicketDetailPage.svelte +59 -0
- package/src/lib/services/auth.js +85 -0
- package/src/lib/services/posts.js +152 -0
- package/src/lib/services/profile.js +37 -0
- package/src/lib/services/theme-setting.js +22 -0
- package/src/lib/services/tickets.js +95 -0
- package/src/lib/siteRealtime.js +244 -0
- package/src/lib/string.util.js +27 -0
- package/src/lib/tooltip.util.js +5 -0
- package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +321 -0
- package/src/lib/ui-logics/layout-logics/AuthLayoutLogics.js +10 -0
- package/src/lib/ui-logics/layout-logics/MainLayoutLogics.js +19 -0
- package/src/lib/ui-logics/layout-logics/ProfileLayoutLogics.js +10 -0
- package/src/lib/ui-logics/layout-logics/ThemeSettingsLayoutLogics.js +215 -0
- package/src/lib/ui-logics/layout-logics/TicketsLayoutLogics.js +10 -0
- package/src/lib/ui-logics/page-logics/ActiveEmailPageLogics.js +45 -0
- package/src/lib/ui-logics/page-logics/ConfirmNewEmailPageLogics.js +42 -0
- package/src/lib/ui-logics/page-logics/CreateTicketPageLogics.js +83 -0
- package/src/lib/ui-logics/page-logics/HomePageLogics.js +65 -0
- package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +264 -0
- package/src/lib/ui-logics/page-logics/PlayerDetailPageLogics.js +40 -0
- package/src/lib/ui-logics/page-logics/PostDetailPageLogics.js +58 -0
- package/src/lib/ui-logics/page-logics/PreviewPostPageLogics.js +53 -0
- package/src/lib/ui-logics/page-logics/ProfilePageLogics.js +44 -0
- package/src/lib/ui-logics/page-logics/RenewPasswordPageLogics.js +44 -0
- package/src/lib/ui-logics/page-logics/ResetPasswordPageLogics.js +53 -0
- package/src/lib/ui-logics/page-logics/SettingsPageLogics.js +230 -0
- package/src/lib/ui-logics/page-logics/SupportPageLogics.js +60 -0
- package/src/lib/ui-logics/page-logics/TicketDetailPageLogics.js +160 -0
- package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +132 -0
- package/src/lib/variables.js +1 -0
- package/src/lib/views/ActivateEmailView.svelte +71 -0
- package/src/lib/views/AppLayoutView.svelte +31 -0
- package/src/lib/views/AuthLayoutView.svelte +23 -0
- package/src/lib/views/ConfirmNewEmailView.svelte +71 -0
- package/src/lib/views/CreateTicketView.svelte +73 -0
- package/src/lib/views/ErrorView.svelte +38 -0
- package/src/lib/views/HomeView.svelte +72 -0
- package/src/lib/views/LoginView.svelte +372 -0
- package/src/lib/views/MainLayoutView.svelte +86 -0
- package/src/lib/views/NotificationsView.svelte +129 -0
- package/src/lib/views/PlayerDetailView.svelte +31 -0
- package/src/lib/views/PostDetailView.svelte +199 -0
- package/src/lib/views/PreviewPostView.svelte +151 -0
- package/src/lib/views/ProfileLayoutView.svelte +16 -0
- package/src/lib/views/ProfileView.svelte +68 -0
- package/src/lib/views/RegisterView.svelte +113 -0
- package/src/lib/views/RenewPasswordView.svelte +98 -0
- package/src/lib/views/ResetPasswordView.svelte +88 -0
- package/src/lib/views/RulesView.svelte +26 -0
- package/src/lib/views/SettingsView.svelte +471 -0
- package/src/lib/views/SupportView.svelte +79 -0
- package/src/lib/views/ThemeSettingsLayoutView.svelte +19 -0
- package/src/lib/views/ThemeSettingsView.svelte +1508 -0
- package/src/lib/views/TicketDetailView.svelte +185 -0
- package/src/lib/views/TicketsLayoutView.svelte +21 -0
- package/src/lib/views/TicketsView.svelte +87 -0
- package/src/plugin-engine/engine.js +484 -0
- package/src/registry/index.js +86 -0
- package/src/routes/RootLayout.svelte +21 -0
- package/src/routes/plugin-ui/Layout.svelte +291 -0
- package/src/routes/plugin-ui/Page.svelte +117 -0
- package/src/routes/plugin-ui/layout.js +8 -0
- package/src/routes/plugin-ui/page.js +8 -0
- package/src/routes/plugins-client-file.js +76 -0
- package/src/routes/root-layout-load.js +15 -0
- package/src/routes/theme-api-languages.js +52 -0
- package/src/routes/theme-api-licenses.js +28 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{#if error || alwaysVisible}
|
|
2
|
+
{@const errorKey = error.key || error}
|
|
3
|
+
<div class="alert alert-danger" in:fade out:fade>
|
|
4
|
+
{$_(errorKey.includes('.') ? errorKey : 'errors.' + errorKey, { values: error.props })}
|
|
5
|
+
</div>
|
|
6
|
+
{/if}
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import { fade } from "svelte/transition";
|
|
10
|
+
import { _ } from "svelte-i18n";
|
|
11
|
+
|
|
12
|
+
export let error;
|
|
13
|
+
|
|
14
|
+
const alwaysVisible = false;
|
|
15
|
+
</script>
|
|
16
|
+
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.no-caret::after {
|
|
3
|
+
display: none !important;
|
|
4
|
+
}
|
|
5
|
+
</style>
|
|
6
|
+
|
|
7
|
+
<!-- Footer -->
|
|
8
|
+
<footer class="border-top bg-gray bg-opacity-10 py-5">
|
|
9
|
+
<div class="container py-lg-5 position-relative z-1">
|
|
10
|
+
<div class="row justify-content-center align-items-center g-3">
|
|
11
|
+
<div
|
|
12
|
+
class="col-lg-4 d-flex justify-content-center align-items-center order-lg-first order-md-2 order-last">
|
|
13
|
+
<ul
|
|
14
|
+
class="nav nav-pills justify-content-lg-start justify-content-center small flex-wrap">
|
|
15
|
+
{#each visibleLinks as link (link.id)}
|
|
16
|
+
<li class="nav-item">
|
|
17
|
+
<a
|
|
18
|
+
class="nav-link rounded-pill small"
|
|
19
|
+
href={link.href}
|
|
20
|
+
target={link.target}
|
|
21
|
+
title={link.text && link.text.includes(".")
|
|
22
|
+
? $_(link.text)
|
|
23
|
+
: link.text}>
|
|
24
|
+
{link.text && link.text.includes(".")
|
|
25
|
+
? $_(link.text)
|
|
26
|
+
: link.text}
|
|
27
|
+
</a>
|
|
28
|
+
</li>
|
|
29
|
+
{/each}
|
|
30
|
+
|
|
31
|
+
{#if moreLinks.length > 0}
|
|
32
|
+
<li class="nav-item dropup">
|
|
33
|
+
<button
|
|
34
|
+
class="nav-link rounded-pill small dropdown-toggle no-caret"
|
|
35
|
+
data-bs-toggle="dropdown"
|
|
36
|
+
type="button"
|
|
37
|
+
aria-label={$_("buttons.toggle")}
|
|
38
|
+
aria-expanded="false"
|
|
39
|
+
on:pointerdown|preventDefault
|
|
40
|
+
on:mousedown|preventDefault>
|
|
41
|
+
<i class="fa-solid fa-ellipsis"></i>
|
|
42
|
+
</button>
|
|
43
|
+
<ul class="dropdown-menu dropdown-menu-end">
|
|
44
|
+
{#each moreLinksInMenuOrder as link (link.id)}
|
|
45
|
+
<li>
|
|
46
|
+
<a
|
|
47
|
+
class="dropdown-item small"
|
|
48
|
+
href={link.href}
|
|
49
|
+
target={link.target}>
|
|
50
|
+
{link.text && link.text.includes(".")
|
|
51
|
+
? $_(link.text)
|
|
52
|
+
: link.text}
|
|
53
|
+
</a>
|
|
54
|
+
</li>
|
|
55
|
+
{/each}
|
|
56
|
+
</ul>
|
|
57
|
+
</li>
|
|
58
|
+
{/if}
|
|
59
|
+
</ul>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="col-lg-4 col-sm-8">
|
|
62
|
+
<div class="text-center vstack align-items-center gap-3">
|
|
63
|
+
{#if themeSettings.footerLogoEnabled ?? true}
|
|
64
|
+
<a href="/" class="d-inline-block">
|
|
65
|
+
<img
|
|
66
|
+
class="d-block mx-auto"
|
|
67
|
+
width="128"
|
|
68
|
+
height="auto"
|
|
69
|
+
alt={$_("components.header.alt")}
|
|
70
|
+
src="/api/websiteLogo?hash={$session.siteInfo.websiteLogoHash}" />
|
|
71
|
+
</a>
|
|
72
|
+
{/if}
|
|
73
|
+
{#if themeSettings.footerTitleEnabled ?? true}
|
|
74
|
+
<h5>{themeSettings.footerTitle || $session.siteInfo.websiteName}</h5>
|
|
75
|
+
{/if}
|
|
76
|
+
{#if themeSettings.footerContentEnabled ?? true}
|
|
77
|
+
<small class="text-center">
|
|
78
|
+
{themeSettings.footerContent || $session.siteInfo.websiteDescription}
|
|
79
|
+
</small>
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="col-lg-4 d-flex justify-content-center align-items-center">
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
class="badge fs-6 {ipBadgeClass} border-0"
|
|
87
|
+
on:click={onCopyIpClick}
|
|
88
|
+
aria-label={$session.siteInfo.ipAddress}
|
|
89
|
+
use:tooltip={[
|
|
90
|
+
isIpCopied ? $_("sidebars.home.copied") : $_("sidebars.home.copy"),
|
|
91
|
+
{ placement: "bottom", hideOnClick: false },
|
|
92
|
+
]}>
|
|
93
|
+
{$session.siteInfo.ipAddress}
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="w-100"></div>
|
|
97
|
+
<div class="col order-last">
|
|
98
|
+
<div class="text-center vstack align-items-center mt-5">
|
|
99
|
+
<a
|
|
100
|
+
href={PANO_WEBSITE_URL}
|
|
101
|
+
target="_blank"
|
|
102
|
+
rel="noreferrer"
|
|
103
|
+
class="d-inline-flex align-items-center justify-content-center bg-primary rounded-3 mb-2"
|
|
104
|
+
style="width: 32px; height: 32px;"
|
|
105
|
+
title="Pano">
|
|
106
|
+
<img src="/assets/img/logo.svg" width="20" height="20" alt="Pano" />
|
|
107
|
+
</a>
|
|
108
|
+
<small>
|
|
109
|
+
{@html $_("footer.been-created-with", {
|
|
110
|
+
values: {
|
|
111
|
+
pano: `<a href="${PANO_WEBSITE_URL}" class="rounded focus-ring" target="_blank" rel="noreferrer">Pano</a>`,
|
|
112
|
+
},
|
|
113
|
+
})}
|
|
114
|
+
</small>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</footer>
|
|
120
|
+
|
|
121
|
+
<!-- Footer End -->
|
|
122
|
+
<script>
|
|
123
|
+
import { getContext } from "svelte";
|
|
124
|
+
import { _ } from "svelte-i18n";
|
|
125
|
+
import copy from "copy-to-clipboard";
|
|
126
|
+
import tooltip from "$pano/lib/tooltip.util";
|
|
127
|
+
import { PANO_WEBSITE_URL } from "$pano/lib/variables";
|
|
128
|
+
import { panoApiClient } from "$pano/lib/PluginAPI.js";
|
|
129
|
+
import { hasPermission } from "$pano/lib/auth.util.js";
|
|
130
|
+
import { orderLinksBySavedOrder } from "$pano/lib/orderNavLinks.util.js";
|
|
131
|
+
|
|
132
|
+
const session = getContext("session");
|
|
133
|
+
const themeSettings = getContext("themeSettings");
|
|
134
|
+
|
|
135
|
+
const navLinks = panoApiClient.ui.nav.site.getNavLinks();
|
|
136
|
+
|
|
137
|
+
$: nativeLinks = [
|
|
138
|
+
{ id: "home", text: "nav-links.homepage", href: "/" },
|
|
139
|
+
{ id: "support", text: "nav-links.support", href: "/support" },
|
|
140
|
+
{
|
|
141
|
+
id: "rules",
|
|
142
|
+
text: "nav-links.rules",
|
|
143
|
+
href: "/rules",
|
|
144
|
+
condition: !!$session.siteInfo?.hasRegisterAgreement
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
$: ipBadgeClass =
|
|
149
|
+
themeSettings.themeColor === "emerald"
|
|
150
|
+
? "text-bg-success"
|
|
151
|
+
: themeSettings.themeColor === "midnight"
|
|
152
|
+
? "text-bg-purple"
|
|
153
|
+
: themeSettings.themeColor === "crimson"
|
|
154
|
+
? "text-bg-danger"
|
|
155
|
+
: themeSettings.themeColor === "copper"
|
|
156
|
+
? "text-bg-warning"
|
|
157
|
+
: "text-bg-secondary";
|
|
158
|
+
|
|
159
|
+
$: displayLinks = (() => {
|
|
160
|
+
// Check if footer links are globally disabled
|
|
161
|
+
if (themeSettings.footerLinksEnabled === false) return [];
|
|
162
|
+
|
|
163
|
+
// 1. Merge
|
|
164
|
+
const pluginLinks = $navLinks.map((l) => ({
|
|
165
|
+
...l,
|
|
166
|
+
id: l.href,
|
|
167
|
+
isPlugin: true,
|
|
168
|
+
target: l.target === "_self" ? null : l.target,
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
const allLinks = [...nativeLinks, ...pluginLinks];
|
|
172
|
+
const sorted = orderLinksBySavedOrder(
|
|
173
|
+
allLinks,
|
|
174
|
+
themeSettings.footerLinksOrder
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
// 3. Filter visibility & conditions
|
|
178
|
+
return sorted.filter((link) => {
|
|
179
|
+
// Handle plugin links visibility setting
|
|
180
|
+
if (link.isPlugin && themeSettings.footerPluginLinksEnabled === false)
|
|
181
|
+
return false;
|
|
182
|
+
|
|
183
|
+
// Check explicit footer toggle for individual link
|
|
184
|
+
const status = themeSettings.footerLinksEnableStatus?.[link.id];
|
|
185
|
+
if (status === false) return false;
|
|
186
|
+
|
|
187
|
+
if (typeof link.condition !== "undefined" && !link.condition)
|
|
188
|
+
return false;
|
|
189
|
+
|
|
190
|
+
if (link.loginRequired && !$session.user) return false;
|
|
191
|
+
if (link.permission && !hasPermission(link.permission)) return false;
|
|
192
|
+
|
|
193
|
+
return true;
|
|
194
|
+
});
|
|
195
|
+
})();
|
|
196
|
+
|
|
197
|
+
const MAX_INLINE_FOOTER_LINKS = 3;
|
|
198
|
+
|
|
199
|
+
$: visibleLinks = displayLinks.slice(0, MAX_INLINE_FOOTER_LINKS);
|
|
200
|
+
$: moreLinks =
|
|
201
|
+
displayLinks.length > MAX_INLINE_FOOTER_LINKS
|
|
202
|
+
? displayLinks.slice(MAX_INLINE_FOOTER_LINKS)
|
|
203
|
+
: [];
|
|
204
|
+
// With dropup, the first DOM child is furthest from the "⋯" toggle; the last is right above it.
|
|
205
|
+
// Reverse so the 4th link (first overflow) is adjacent to the toggle, matching left-to-right order.
|
|
206
|
+
$: moreLinksInMenuOrder = [...moreLinks].reverse();
|
|
207
|
+
|
|
208
|
+
/* IP Copy Logic */
|
|
209
|
+
let copyClickID = 0;
|
|
210
|
+
let isIpCopied = false;
|
|
211
|
+
|
|
212
|
+
function onCopyIpClick() {
|
|
213
|
+
copyClickID++;
|
|
214
|
+
const id = copyClickID;
|
|
215
|
+
copy($session.siteInfo.ipAddress);
|
|
216
|
+
isIpCopied = true;
|
|
217
|
+
setTimeout(function () {
|
|
218
|
+
if (copyClickID === id) {
|
|
219
|
+
isIpCopied = false;
|
|
220
|
+
}
|
|
221
|
+
}, 1000);
|
|
222
|
+
}
|
|
223
|
+
</script>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<svelte:head>
|
|
2
|
+
{@html `<style>;</style>`.replace(";", styles)}
|
|
3
|
+
</svelte:head>
|
|
4
|
+
|
|
5
|
+
<!-- Header -->
|
|
6
|
+
<div class="hero" class:container={headerWidthOption !== "FULL_SIZE"}>
|
|
7
|
+
<div
|
|
8
|
+
class="hero-content position-relative p-0"
|
|
9
|
+
class:bg-transparent={!effectiveHeaderBgColor}
|
|
10
|
+
id="header"
|
|
11
|
+
style="background-position: center; height: {themeSettings.headerHeight || '256'}px;">
|
|
12
|
+
<a href="/">
|
|
13
|
+
<div
|
|
14
|
+
class="position-absolute {logoPositionClasses} px-3"
|
|
15
|
+
style="padding-top: 80px; padding-bottom: 40px;"
|
|
16
|
+
class:d-none={themeSettings.logoVisibility === false}>
|
|
17
|
+
<img
|
|
18
|
+
alt={$_("components.header.alt")}
|
|
19
|
+
class={logoAnimationClass}
|
|
20
|
+
src="/api/websiteLogo?hash={$session.siteInfo.websiteLogoHash}"
|
|
21
|
+
style="object-fit: contain; width: {themeSettings.logoWidth || '256'}px; height: {themeSettings.logoHeight ? themeSettings.logoHeight + 'px' : 'auto'}; max-width: 100%;"
|
|
22
|
+
title={$session.siteInfo.websiteName} />
|
|
23
|
+
</div>
|
|
24
|
+
</a>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- Header End -->
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { getContext } from "svelte";
|
|
32
|
+
import { _ } from "svelte-i18n";
|
|
33
|
+
|
|
34
|
+
const session = getContext("session");
|
|
35
|
+
const themeSettings = getContext("themeSettings");
|
|
36
|
+
|
|
37
|
+
const headerDefaults = {
|
|
38
|
+
dark: "",
|
|
39
|
+
light: "",
|
|
40
|
+
copper: "#b87333",
|
|
41
|
+
emerald: "#10b981",
|
|
42
|
+
midnight: "#8b5cf6",
|
|
43
|
+
crimson: "#ef4444",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
$: effectiveHeaderBgColor =
|
|
47
|
+
themeSettings.headerBgColor ||
|
|
48
|
+
headerDefaults[themeSettings.themeColor || "dark"];
|
|
49
|
+
|
|
50
|
+
$: logoPosition = themeSettings.logoPosition
|
|
51
|
+
? themeSettings.logoPosition
|
|
52
|
+
: "CENTER";
|
|
53
|
+
$: logoPositionClasses = getLogoPositionClasses(logoPosition);
|
|
54
|
+
|
|
55
|
+
$: logoAnimation = themeSettings.logoAnimation || "off";
|
|
56
|
+
$: logoAnimationClass = getLogoAnimationClass(logoAnimation);
|
|
57
|
+
|
|
58
|
+
$: headerWidthOption = themeSettings.headerWidthOption || "FULL_SIZE";
|
|
59
|
+
|
|
60
|
+
function getLogoAnimationClass(animation) {
|
|
61
|
+
if (animation === "zoom") return "logo-animation-zoom";
|
|
62
|
+
if (animation === "floating") return "logo-animation-floating";
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getLogoPositionClasses(logoPosition) {
|
|
67
|
+
if (logoPosition === "TOP_START") {
|
|
68
|
+
return "top-0 start-0";
|
|
69
|
+
} else if (logoPosition === "TOP") {
|
|
70
|
+
return "top-0 start-50 translate-middle-x";
|
|
71
|
+
} else if (logoPosition === "TOP_END") {
|
|
72
|
+
return "top-0 end-0";
|
|
73
|
+
} else if (logoPosition === "CENTER_START") {
|
|
74
|
+
return "top-50 start-0 translate-middle-y";
|
|
75
|
+
} else if (logoPosition === "CENTER") {
|
|
76
|
+
return "top-50 start-50 translate-middle";
|
|
77
|
+
} else if (logoPosition === "CENTER_END") {
|
|
78
|
+
return "top-50 end-0 translate-middle-y";
|
|
79
|
+
} else if (logoPosition === "BOTTOM_START") {
|
|
80
|
+
return "bottom-0 start-0 ";
|
|
81
|
+
} else if (logoPosition === "BOTTOM") {
|
|
82
|
+
return "bottom-0 start-50 translate-middle-x";
|
|
83
|
+
} else if (logoPosition === "BOTTOM_END") {
|
|
84
|
+
return "bottom-0 end-0";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return "top-50 start-50 translate-middle";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const defaultHeaderBg =
|
|
91
|
+
typeof themeSettings.defaultHeaderBg === "undefined"
|
|
92
|
+
? true
|
|
93
|
+
: themeSettings.defaultHeaderBg;
|
|
94
|
+
|
|
95
|
+
const styles = `
|
|
96
|
+
.hero::before {
|
|
97
|
+
${effectiveHeaderBgColor ? `background-color: ${effectiveHeaderBgColor};` : ""}
|
|
98
|
+
background-image: url(${defaultHeaderBg ? "/assets/img/default-header-bg.png" : themeSettings.files?.headerBackgroundImage ? "/api/theme/file/" + themeSettings.files?.headerBackgroundImage : ""}) !important;
|
|
99
|
+
${themeSettings.headerBgImagePosition ? `background-position: ${themeSettings.headerBgImagePosition} !important;` : ""}
|
|
100
|
+
${themeSettings.headerBgImageRepeat ? `background-repeat: ${themeSettings.headerBgImageRepeat} !important;` : ""}
|
|
101
|
+
background-size: ${themeSettings.headerBgImageSize || "cover"} !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.logo-animation-zoom {
|
|
105
|
+
animation: logo-zoom 5s ease-in-out infinite;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.logo-animation-floating {
|
|
109
|
+
animation: logo-floating 3s ease-in-out infinite;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@keyframes logo-zoom {
|
|
113
|
+
0%, 100% { transform: scale(1); }
|
|
114
|
+
50% { transform: scale(1.05); }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes logo-floating {
|
|
118
|
+
0%, 100% { transform: translateY(0); }
|
|
119
|
+
50% { transform: translateY(-20px); }
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{#each hookList as module, i}
|
|
2
|
+
{@const props = hookProps[i] || {}}
|
|
3
|
+
{@const hasPerm =
|
|
4
|
+
!filteredHooks[i]?.permission ||
|
|
5
|
+
hasPermission(filteredHooks[i]?.permission, $page.data.user)}
|
|
6
|
+
{#if module && hasPerm && typeof module !== 'function'}
|
|
7
|
+
{@const Component = module.default || module}
|
|
8
|
+
{@const isInvisible = props.hookOptions?.invisible || filteredHooks[i]?.invisible}
|
|
9
|
+
|
|
10
|
+
{#if !isInvisible}
|
|
11
|
+
<svelte:element
|
|
12
|
+
this={tag}
|
|
13
|
+
class="hook-view-container {rest.class || ''}"
|
|
14
|
+
style="{tag === 'div' ? 'display: contents;' : ''} {rest.style || ''}"
|
|
15
|
+
hookName={name}
|
|
16
|
+
{...props}
|
|
17
|
+
{...rest}>
|
|
18
|
+
</svelte:element>
|
|
19
|
+
|
|
20
|
+
<!-- Svelte renders Component natively for both SSR and client -->
|
|
21
|
+
<Component hookName={name} {...props} {...rest} />
|
|
22
|
+
{/if}
|
|
23
|
+
{/if}
|
|
24
|
+
{/each}
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import { panoApiClient } from "$pano/lib/PluginAPI.js";
|
|
28
|
+
import { page } from "$app/stores";
|
|
29
|
+
import { getAllContexts } from "svelte";
|
|
30
|
+
import { hasPermission } from "$pano/lib/auth.util.js";
|
|
31
|
+
|
|
32
|
+
let { name, tag = "div", ...rest } = $props();
|
|
33
|
+
|
|
34
|
+
const hookStore = $derived(panoApiClient.ui.hook.get(name));
|
|
35
|
+
|
|
36
|
+
const filteredHooks = $derived($hookStore || []);
|
|
37
|
+
|
|
38
|
+
let resolvedHooks = $state([]);
|
|
39
|
+
const hookList = $derived(
|
|
40
|
+
resolvedHooks.length > 0
|
|
41
|
+
? resolvedHooks.map((h) => h.component || h)
|
|
42
|
+
: filteredHooks.map((h) => h.component || h),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const contexts = getAllContexts();
|
|
46
|
+
|
|
47
|
+
// Use passed hooks props if available
|
|
48
|
+
const hookProps = $derived($page.data.hookProps?.[name] || []);
|
|
49
|
+
|
|
50
|
+
$effect(() => {
|
|
51
|
+
// Sync with store and resolve any functions if needed (Client only)
|
|
52
|
+
const current = filteredHooks.map((h) => h.component || h);
|
|
53
|
+
if (current.some((h) => typeof h === "function" && !h.prototype)) {
|
|
54
|
+
resolveHooks(current);
|
|
55
|
+
} else {
|
|
56
|
+
resolvedHooks = [];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
async function resolveHooks(list) {
|
|
61
|
+
const resolved = await Promise.all(
|
|
62
|
+
list.map(async (h) => {
|
|
63
|
+
if (typeof h === "function" && !h.prototype) {
|
|
64
|
+
return await h();
|
|
65
|
+
}
|
|
66
|
+
return h;
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
resolvedHooks = resolved;
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createEventDispatcher, onMount } from "svelte";
|
|
3
|
+
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
|
|
6
|
+
export let length = 6;
|
|
7
|
+
export let disabled = false;
|
|
8
|
+
export let isInvalid = false;
|
|
9
|
+
|
|
10
|
+
let values = Array(length).fill("");
|
|
11
|
+
let inputs = [];
|
|
12
|
+
|
|
13
|
+
function handleInput(index, event) {
|
|
14
|
+
const value = event.target.value;
|
|
15
|
+
|
|
16
|
+
if (isInvalid) isInvalid = false;
|
|
17
|
+
|
|
18
|
+
// If empty, just update and return
|
|
19
|
+
if (value === "") {
|
|
20
|
+
values[index] = "";
|
|
21
|
+
values = [...values];
|
|
22
|
+
dispatch("change", { code: values.join("") });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Allow only numbers
|
|
27
|
+
if (!/^\d+$/.test(value)) {
|
|
28
|
+
event.target.value = values[index];
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Take the last character entered
|
|
33
|
+
const char = value.slice(-1);
|
|
34
|
+
values[index] = char;
|
|
35
|
+
values = [...values];
|
|
36
|
+
|
|
37
|
+
// Focus next
|
|
38
|
+
if (index < length - 1) {
|
|
39
|
+
inputs[index + 1]?.focus();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const code = values.join("");
|
|
43
|
+
dispatch("change", { code });
|
|
44
|
+
if (code.length === length) {
|
|
45
|
+
dispatch("complete", { code });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function handlePaste(event) {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
const pastedData = (event.clipboardData || window.clipboardData).getData("text").slice(0, length);
|
|
52
|
+
if (!/^\d+$/.test(pastedData)) return;
|
|
53
|
+
|
|
54
|
+
const chars = pastedData.split("");
|
|
55
|
+
chars.forEach((char, i) => {
|
|
56
|
+
values[i] = char;
|
|
57
|
+
});
|
|
58
|
+
values = [...values];
|
|
59
|
+
|
|
60
|
+
const nextIndex = Math.min(chars.length, length - 1);
|
|
61
|
+
inputs[nextIndex]?.focus();
|
|
62
|
+
|
|
63
|
+
const code = values.join("");
|
|
64
|
+
dispatch("change", { code });
|
|
65
|
+
if (code.length === length) {
|
|
66
|
+
dispatch("complete", { code });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function handleKeyDown(index, event) {
|
|
71
|
+
if (event.key === "Backspace") {
|
|
72
|
+
if (values[index]) {
|
|
73
|
+
// If current is full, clear it
|
|
74
|
+
values[index] = "";
|
|
75
|
+
} else if (index > 0) {
|
|
76
|
+
// If current is empty, move to previous and clear it
|
|
77
|
+
inputs[index - 1]?.focus();
|
|
78
|
+
values[index - 1] = "";
|
|
79
|
+
}
|
|
80
|
+
values = [...values];
|
|
81
|
+
dispatch("change", { code: values.join("") });
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (event.key === "ArrowLeft" && index > 0) {
|
|
87
|
+
inputs[index - 1]?.focus();
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (event.key === "ArrowRight" && index < length - 1) {
|
|
93
|
+
inputs[index + 1]?.focus();
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (["Tab", "Delete", "Enter"].includes(event.key)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!/^\d$/.test(event.key) && !event.ctrlKey && !event.metaKey) {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
onMount(() => {
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
inputs[0]?.focus();
|
|
110
|
+
}, 50);
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<div class="d-flex gap-2 justify-content-center">
|
|
115
|
+
{#each values as value, index}
|
|
116
|
+
<input
|
|
117
|
+
bind:this={inputs[index]}
|
|
118
|
+
class="form-control text-center p-0 fs-4 {isInvalid ? 'border-danger' : ''}"
|
|
119
|
+
disabled={disabled}
|
|
120
|
+
inputmode="numeric"
|
|
121
|
+
on:focus={(e) => e.target.select()}
|
|
122
|
+
on:input={(e) => handleInput(index, e)}
|
|
123
|
+
on:keydown={(e) => handleKeyDown(index, e)}
|
|
124
|
+
on:paste={index === 0 ? handlePaste : undefined}
|
|
125
|
+
style="width: 3rem; height: 3.5rem;"
|
|
126
|
+
type="text"
|
|
127
|
+
value={values[index]} />
|
|
128
|
+
{/each}
|
|
129
|
+
</div>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
#lfb-usernameOrEmail, #lfb-password {
|
|
3
|
+
margin-bottom: -1px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
#lfb-usernameOrEmail:focus, #lfb-password:focus {
|
|
7
|
+
position: relative;
|
|
8
|
+
z-index: 2;
|
|
9
|
+
}
|
|
10
|
+
</style>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import { _ } from "svelte-i18n";
|
|
14
|
+
|
|
15
|
+
import { stripIdentifierWhitespace } from "$pano/lib/loginInput.util.js";
|
|
16
|
+
import { panoApiClient } from "$pano/lib/PluginAPI.js";
|
|
17
|
+
import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
|
|
18
|
+
|
|
19
|
+
export let usernameOrEmail = "";
|
|
20
|
+
export let password = "";
|
|
21
|
+
export let loading = false;
|
|
22
|
+
export let usernameDisabled = false;
|
|
23
|
+
export let submitLabel = null;
|
|
24
|
+
|
|
25
|
+
function onUsernameInput() {
|
|
26
|
+
const c = stripIdentifierWhitespace(usernameOrEmail);
|
|
27
|
+
if (c !== usernameOrEmail) {
|
|
28
|
+
usernameOrEmail = c;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Plugin-contributed login fields (e.g. auth-guard captcha) appear inline in the form, exactly
|
|
33
|
+
// as they do on the theme's /login page. The "login-form" item is the marker the theme uses to
|
|
34
|
+
// place its own form in the slot order — we don't render it ourselves.
|
|
35
|
+
const contentItems = panoApiClient.ui.auth.login.content.get();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div class="form-group">
|
|
39
|
+
<div class="form-floating">
|
|
40
|
+
<input
|
|
41
|
+
bind:value={usernameOrEmail}
|
|
42
|
+
class="form-control rounded-bottom-0"
|
|
43
|
+
id="lfb-usernameOrEmail"
|
|
44
|
+
on:input={onUsernameInput}
|
|
45
|
+
disabled={loading || usernameDisabled}
|
|
46
|
+
type="text" />
|
|
47
|
+
<label for="lfb-usernameOrEmail">
|
|
48
|
+
{$_("components.modals.login.inputs.username-email")}
|
|
49
|
+
</label>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="form-floating">
|
|
53
|
+
<input
|
|
54
|
+
bind:value={password}
|
|
55
|
+
class="form-control rounded-top-0"
|
|
56
|
+
id="lfb-password"
|
|
57
|
+
disabled={loading}
|
|
58
|
+
type="password" />
|
|
59
|
+
<label for="lfb-password">
|
|
60
|
+
{$_("components.modals.login.inputs.password")}
|
|
61
|
+
</label>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
{#each $contentItems as item (item.id)}
|
|
66
|
+
{#if item.id !== 'login-form' && item.component && (item.priority || 0) < 100}
|
|
67
|
+
<ViewComponent component={item.component} data={{ pageType: 'login' }} />
|
|
68
|
+
{/if}
|
|
69
|
+
{/each}
|
|
70
|
+
|
|
71
|
+
<slot name="beforeSubmit" />
|
|
72
|
+
|
|
73
|
+
<div class="vstack gap-2">
|
|
74
|
+
<button
|
|
75
|
+
class="btn btn-lg btn-secondary"
|
|
76
|
+
class:disabled={loading || !usernameOrEmail || !password}
|
|
77
|
+
disabled={loading || !usernameOrEmail || !password}
|
|
78
|
+
type="submit">
|
|
79
|
+
{#if loading}
|
|
80
|
+
<span
|
|
81
|
+
class="spinner-border spinner-border-sm me-2"
|
|
82
|
+
role="status"
|
|
83
|
+
aria-label="Loading"></span>
|
|
84
|
+
<span>{submitLabel || $_("buttons.login")}...</span>
|
|
85
|
+
{:else}
|
|
86
|
+
{submitLabel || $_("buttons.login")}
|
|
87
|
+
{/if}
|
|
88
|
+
</button>
|
|
89
|
+
<slot name="footer" />
|
|
90
|
+
</div>
|