@zlooks.cn/password-auth-server 1.0.2 → 1.0.4

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 (16) hide show
  1. package/.hile-rsc/{build-mtjl0eh7-90bc0b3a/client-browser/chunks/chunk-RZRQMKUX.js → build-mtu1gn28-ec03cfb2/client-browser/chunks/chunk-CZF5VGOJ.js} +40053 -45863
  2. package/.hile-rsc/build-mtu1gn28-ec03cfb2/client-browser/src-plugin-page-frame-07c4de56a6-C2WHPDGD.js +2312 -0
  3. package/.hile-rsc/build-mtu1gn28-ec03cfb2/client-browser/src-plugin-password-form-3bd63d69e5-BCAMXKEX.js +4627 -0
  4. package/.hile-rsc/build-mtu1gn28-ec03cfb2/client-ssr/chunks/chunk-RMKQVF3F.js +36281 -0
  5. package/.hile-rsc/build-mtu1gn28-ec03cfb2/client-ssr/src-plugin-page-frame-07c4de56a6-ICZZGKBP.js +15609 -0
  6. package/.hile-rsc/{build-mtjl0eh7-90bc0b3a/client-ssr/chunks/chunk-SH36JXFV.js → build-mtu1gn28-ec03cfb2/client-ssr/src-plugin-password-form-3bd63d69e5-KF6ZLTDT.js} +104274 -139561
  7. package/.hile-rsc/{build-mtjl0eh7-90bc0b3a → build-mtu1gn28-ec03cfb2}/plugin.json +18 -18
  8. package/.hile-rsc/{build-mtjl0eh7-90bc0b3a → build-mtu1gn28-ec03cfb2}/server-rsc/index.js +160 -27
  9. package/package.json +4 -4
  10. package/.hile-rsc/build-mtjl0eh7-90bc0b3a/client-browser/src-plugin-page-frame-07c4de56a6-GJVQS7WE.js +0 -440
  11. package/.hile-rsc/build-mtjl0eh7-90bc0b3a/client-browser/src-plugin-password-form-3bd63d69e5-PXXZM4RL.js +0 -706
  12. package/.hile-rsc/build-mtjl0eh7-90bc0b3a/client-ssr/src-plugin-page-frame-07c4de56a6-JTUKAMPR.js +0 -441
  13. package/.hile-rsc/build-mtjl0eh7-90bc0b3a/client-ssr/src-plugin-password-form-3bd63d69e5-ESX5GCJR.js +0 -708
  14. /package/.hile-rsc/{build-mtjl0eh7-90bc0b3a → build-mtu1gn28-ec03cfb2}/client-browser/src-plugin-page-frame-07c4de56a6-3F24AYCH.css +0 -0
  15. /package/.hile-rsc/{build-mtjl0eh7-90bc0b3a → build-mtu1gn28-ec03cfb2}/client-browser/src-plugin-password-form-3bd63d69e5-TRYMJX4F.css +0 -0
  16. /package/.hile-rsc/{build-mtjl0eh7-90bc0b3a → build-mtu1gn28-ec03cfb2}/styles/4b3193c4f2b317ffed425ccf401342a4bdd6ccfd5f9c42def3315e776f166975.css +0 -0
@@ -1,441 +0,0 @@
1
- "use client";
2
- import {
3
- RscLink,
4
- __toESM,
5
- createContext,
6
- deepFreeze,
7
- init_react,
8
- isRequestError,
9
- jsx,
10
- jsxs,
11
- require_lib,
12
- useContext,
13
- useEffect,
14
- useMemo,
15
- useRequest,
16
- useRscNavigation,
17
- useState,
18
- useSyncExternalStore
19
- } from "./chunks/chunk-SH36JXFV.js";
20
-
21
- // ../ui/dist/provider.js
22
- var import_antd = __toESM(require_lib());
23
- init_react();
24
-
25
- // ../ui/dist/theme.js
26
- var theme = {
27
- token: {
28
- colorPrimary: "#1677ff",
29
- borderRadius: 10,
30
- motion: true,
31
- fontFamily: [
32
- "-apple-system",
33
- "BlinkMacSystemFont",
34
- "'Segoe UI'",
35
- "Roboto",
36
- "'Helvetica Neue'",
37
- "Arial",
38
- "'Noto Sans'",
39
- "sans-serif"
40
- ].join(", ")
41
- }
42
- };
43
- var zlooksTheme = deepFreeze(theme);
44
-
45
- // ../ui/dist/theme-preference.js
46
- init_react();
47
- var THEME_STORAGE_KEY = "zlooks.theme";
48
- var THEME_CHANGE_EVENT = "zlooks:theme-change";
49
- var memoryMode = "default";
50
- function useZlooksTheme() {
51
- const mode = useSyncExternalStore(subscribeThemePreference, readClientThemeMode, readServerThemeMode);
52
- return { mode, setMode: setThemeMode };
53
- }
54
- function parseStoredZlooksThemeMode(value) {
55
- return value === "dark" || value === "light" || value === "default" ? value : "default";
56
- }
57
- function readClientThemeMode() {
58
- if (typeof window === "undefined")
59
- return memoryMode;
60
- try {
61
- const stored = window.localStorage.getItem(THEME_STORAGE_KEY);
62
- if (stored !== null)
63
- memoryMode = parseStoredZlooksThemeMode(stored);
64
- } catch {
65
- }
66
- return memoryMode;
67
- }
68
- function readServerThemeMode() {
69
- return "default";
70
- }
71
- function setThemeMode(mode) {
72
- if (parseStoredZlooksThemeMode(mode) !== mode) {
73
- throw new TypeError(`Unsupported Zlooks theme mode: ${String(mode)}`);
74
- }
75
- memoryMode = mode;
76
- if (typeof window === "undefined")
77
- return;
78
- try {
79
- window.localStorage.setItem(THEME_STORAGE_KEY, mode);
80
- } catch {
81
- }
82
- window.dispatchEvent(new CustomEvent(THEME_CHANGE_EVENT, { detail: mode }));
83
- }
84
- function subscribeThemePreference(notify) {
85
- if (typeof window === "undefined")
86
- return () => void 0;
87
- const handleThemeChange = (event) => {
88
- memoryMode = parseStoredZlooksThemeMode(event.detail);
89
- notify();
90
- };
91
- const handleStorage = (event) => {
92
- if (event.key !== THEME_STORAGE_KEY)
93
- return;
94
- memoryMode = parseStoredZlooksThemeMode(event.newValue);
95
- notify();
96
- };
97
- window.addEventListener(THEME_CHANGE_EVENT, handleThemeChange);
98
- window.addEventListener("storage", handleStorage);
99
- return () => {
100
- window.removeEventListener(THEME_CHANGE_EVENT, handleThemeChange);
101
- window.removeEventListener("storage", handleStorage);
102
- };
103
- }
104
-
105
- // ../ui/dist/provider.js
106
- function ZlooksUiProvider({ children, theme: theme2 }) {
107
- const preference = useZlooksTheme();
108
- const { resolvedMode, resolvedTheme } = useZlooksThemeRuntime(theme2 ?? preference.mode);
109
- return jsx(import_antd.ConfigProvider, { button: { autoInsertSpace: false }, theme: resolvedTheme, children: jsx(import_antd.App, { children: jsx("div", { className: "zlooks-ui-theme", "data-zlooks-theme": resolvedMode, children }) }) });
110
- }
111
- function useZlooksThemeRuntime(theme2) {
112
- const systemDark = useSystemDarkTheme(theme2 === "default");
113
- const resolvedMode = theme2 === "default" ? systemDark ? "dark" : "light" : theme2;
114
- const resolvedTheme = useMemo(() => ({
115
- ...zlooksTheme,
116
- algorithm: resolvedMode === "dark" ? import_antd.theme.darkAlgorithm : import_antd.theme.defaultAlgorithm,
117
- cssVar: { key: `zlooks-${resolvedMode}` },
118
- hashed: false,
119
- zeroRuntime: true
120
- }), [resolvedMode]);
121
- return { resolvedMode, resolvedTheme };
122
- }
123
- function useSystemDarkTheme(enabled) {
124
- const [dark, setDark] = useState(false);
125
- useEffect(() => {
126
- if (!enabled)
127
- return;
128
- const media = window.matchMedia("(prefers-color-scheme: dark)");
129
- const update = () => setDark(media.matches);
130
- update();
131
- media.addEventListener("change", update);
132
- return () => media.removeEventListener("change", update);
133
- }, [enabled]);
134
- return dark;
135
- }
136
-
137
- // ../ui/dist/shell.js
138
- var import_antd2 = __toESM(require_lib());
139
- init_react();
140
-
141
- // ../ui/dist/client-navigation.js
142
- function shouldUseClientNavigation(event) {
143
- return !event.defaultPrevented && event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
144
- }
145
-
146
- // ../ui/dist/navigation.js
147
- function selectZlooksNavigation(input) {
148
- return [
149
- { key: "gateway:home", label: "\u9996\u9875", href: "/", order: -1 },
150
- ...input.navigation
151
- ].map((item) => ({
152
- ...item,
153
- active: item.href === "/" ? input.pathname === "/" : input.pathname === item.href || input.pathname.startsWith(`${item.href}/`)
154
- }));
155
- }
156
-
157
- // ../ui/dist/theme-internal.js
158
- var zlooksUserAccessComponents = deepFreeze({
159
- Button: {
160
- textActiveBg: "transparent",
161
- textHoverBg: "transparent"
162
- }
163
- });
164
-
165
- // ../ui/dist/shell.js
166
- var ShellContext = createContext(void 0);
167
- function ZlooksShellProvider({ children, initialContext }) {
168
- return jsx(ShellContext, { value: initialContext, children });
169
- }
170
- function useZlooksNavigation() {
171
- const context = useShellContext();
172
- return useMemo(() => selectZlooksNavigation(context), [context]);
173
- }
174
- function ZlooksUserAccess({ className, classNames = {}, style, size = "middle", shape = "round", variant = "compact", onNavigate, onLogout }) {
175
- const view = useShellContext().user;
176
- const [accountOpen, setAccountOpen] = useState(false);
177
- const [loginOpen, setLoginOpen] = useState(false);
178
- const { message, modal } = import_antd2.App.useApp();
179
- const triggerClassName = mergeClassNames("zlooks-user-access-trigger", className, classNames.trigger);
180
- const avatarClassName = mergeClassNames("zlooks-user-access-avatar", classNames.avatar);
181
- const labelClassName = mergeClassNames("zlooks-user-access-label", classNames.label);
182
- const avatarOnly = variant === "avatar";
183
- const triggerAvatarSize = resolveTriggerAvatarSize(size, avatarOnly);
184
- const triggerShape = avatarOnly ? "circle" : shape;
185
- const triggerAvatarShape = avatarOnly ? "circle" : "square";
186
- const triggerStyle = avatarOnly ? {
187
- height: triggerAvatarSize,
188
- minWidth: triggerAvatarSize,
189
- padding: 0,
190
- width: triggerAvatarSize,
191
- ...style
192
- } : style;
193
- async function logout(logoutHref, close) {
194
- try {
195
- await onLogout(logoutHref);
196
- close();
197
- setAccountOpen(false);
198
- } catch (cause) {
199
- if (!isRequestError(cause))
200
- void message.error("\u9000\u51FA\u767B\u5F55\u5931\u8D25");
201
- }
202
- }
203
- function confirmLogout(logoutHref) {
204
- modal.confirm({
205
- title: "\u786E\u8BA4\u9000\u51FA\u767B\u5F55\uFF1F",
206
- content: "\u9000\u51FA\u540E\uFF0C\u9700\u8981\u91CD\u65B0\u767B\u5F55\u624D\u80FD\u8BBF\u95EE\u4E2A\u4EBA\u8D26\u6237\u3002",
207
- okText: "\u9000\u51FA\u767B\u5F55",
208
- okButtonProps: { danger: true },
209
- cancelText: "\u53D6\u6D88",
210
- onOk(close) {
211
- void logout(logoutHref, close);
212
- }
213
- });
214
- }
215
- function navigate(event, href, close) {
216
- if (!onNavigate || !shouldUseClientNavigation(event))
217
- return;
218
- event.preventDefault();
219
- close();
220
- onNavigate(href);
221
- }
222
- if (view.status === "unavailable") {
223
- return jsx(UserAccessTheme, { children: jsx(import_antd2.Button, { "aria-label": "\u8D26\u6237\u670D\u52A1\u6682\u4E0D\u53EF\u7528", className: triggerClassName, disabled: true, shape: triggerShape, size, style: triggerStyle, type: "text", children: jsxs(import_antd2.Space, { align: "center", size: 6, children: [jsx(import_antd2.Avatar, { className: avatarClassName, shape: triggerAvatarShape, size: triggerAvatarSize, style: {
224
- background: "var(--ant-color-fill-secondary)",
225
- border: avatarOnly ? "none" : void 0,
226
- borderRadius: avatarOnly ? "50%" : 9,
227
- boxShadow: avatarOnly ? "none" : void 0,
228
- color: "var(--ant-color-text-tertiary)",
229
- fontSize: 12,
230
- fontWeight: 750
231
- }, children: "Z" }), variant === "compact" ? jsx(import_antd2.Typography.Text, { type: "secondary", children: "\u6682\u4E0D\u53EF\u7528" }) : null] }) }) });
232
- }
233
- if (view.status === "authenticated") {
234
- return jsx(UserAccessTheme, { children: jsx(import_antd2.Popover, { arrow: false, destroyOnHidden: true, onOpenChange: setAccountOpen, open: accountOpen, placement: "bottomRight", styles: {
235
- container: {
236
- border: "1px solid var(--ant-color-border-secondary)",
237
- borderRadius: 16,
238
- boxShadow: "0 18px 48px rgb(15 23 42 / 14%)",
239
- overflow: "hidden",
240
- padding: 0
241
- },
242
- content: {
243
- maxWidth: "calc(100vw - 32px)",
244
- width: 280
245
- }
246
- }, trigger: "click", content: jsxs(import_antd2.Flex, { "aria-label": "\u8D26\u6237\u4FE1\u606F", className: classNames.popup, role: "dialog", style: {
247
- background: "var(--ant-color-bg-elevated)"
248
- }, vertical: true, children: [jsxs(import_antd2.Flex, { align: "center", gap: 12, style: {
249
- background: [
250
- "linear-gradient(color-mix(in srgb, var(--ant-color-fill-quaternary) 48%, transparent) 1px, transparent 1px)",
251
- "linear-gradient(90deg, color-mix(in srgb, var(--ant-color-fill-quaternary) 48%, transparent) 1px, transparent 1px)",
252
- "var(--ant-color-bg-elevated)"
253
- ].join(", "),
254
- backgroundSize: "28px 28px",
255
- padding: 16
256
- }, children: [jsx(import_antd2.Avatar, { className: avatarClassName, shape: "square", size: 44, src: view.user.avatarUrl, style: {
257
- background: "var(--ant-color-text)",
258
- borderRadius: 12,
259
- color: "var(--ant-color-bg-container)",
260
- fontSize: 16,
261
- fontWeight: 700
262
- }, children: view.user.avatarText }), jsxs(import_antd2.Flex, { style: { flex: 1, minWidth: 0 }, vertical: true, children: [jsx(import_antd2.Typography.Text, { strong: true, ellipsis: true, style: { fontSize: 15, lineHeight: 1.4 }, children: view.user.label }), view.user.secondary ? jsx(import_antd2.Typography.Text, { ellipsis: { tooltip: view.user.secondary }, style: { display: "block" }, type: "secondary", children: view.user.secondary }) : null] }), jsx("span", { "aria-label": "\u5DF2\u767B\u5F55", role: "status", style: {
263
- background: "var(--ant-color-success)",
264
- borderRadius: 999,
265
- boxShadow: "0 0 0 3px var(--ant-color-success-bg)",
266
- flex: "0 0 auto",
267
- height: 7,
268
- width: 7
269
- } })] }), jsx(import_antd2.Divider, { style: { margin: 0 } }), jsxs(import_antd2.Flex, { gap: 2, style: { padding: 8 }, vertical: true, children: [jsx(import_antd2.Button, { block: true, href: view.accountHref, size: "large", style: {
270
- fontWeight: 600,
271
- height: 44,
272
- paddingInline: 12
273
- }, type: "text", onClick: (event) => navigate(event, view.accountHref, () => setAccountOpen(false)), children: jsxs(import_antd2.Flex, { justify: "space-between", style: { width: "100%" }, children: [jsx("span", { children: "\u4E2A\u4EBA\u8D44\u6599" }), jsx(import_antd2.Typography.Text, { "aria-hidden": "true", type: "secondary", children: "\u2192" })] }) }), jsx(import_antd2.Button, { block: true, danger: true, size: "large", style: { height: 44, justifyContent: "flex-start", paddingInline: 12 }, type: "text", onClick: () => confirmLogout(view.logoutHref), children: "\u9000\u51FA\u767B\u5F55" })] })] }), children: jsx(import_antd2.Button, { "aria-expanded": accountOpen, "aria-haspopup": "dialog", "aria-label": `\u6253\u5F00${view.user.label}\u7684\u8D26\u6237\u4FE1\u606F`, className: triggerClassName, shape: triggerShape, size, style: triggerStyle, type: "text", children: jsxs(import_antd2.Space, { align: "center", size: 6, children: [jsx(import_antd2.Avatar, { className: avatarClassName, shape: triggerAvatarShape, size: triggerAvatarSize, src: view.user.avatarUrl, style: {
274
- background: avatarOnly ? "var(--ant-color-fill-secondary)" : "var(--ant-color-text)",
275
- border: avatarOnly ? "none" : void 0,
276
- borderRadius: avatarOnly ? "50%" : 9,
277
- boxShadow: avatarOnly ? "none" : void 0,
278
- color: avatarOnly ? "var(--ant-color-text)" : "var(--ant-color-bg-container)",
279
- fontSize: 12,
280
- fontWeight: 700
281
- }, children: view.user.avatarText }), variant === "compact" ? jsx(import_antd2.Typography.Text, { className: labelClassName, ellipsis: true, style: { fontSize: 13, fontWeight: 650, maxWidth: 120 }, children: view.user.label }) : null] }) }) }) });
282
- }
283
- return jsxs(UserAccessTheme, { children: [jsx(import_antd2.Button, { "aria-expanded": loginOpen, "aria-haspopup": "dialog", "aria-label": "\u767B\u5F55", className: triggerClassName, shape: triggerShape, size, style: triggerStyle, type: "text", onClick: () => setLoginOpen(true), children: jsxs(import_antd2.Space, { align: "center", size: 6, children: [jsx(import_antd2.Avatar, { className: avatarClassName, shape: triggerAvatarShape, size: triggerAvatarSize, style: {
284
- background: "var(--ant-color-primary-bg)",
285
- border: avatarOnly ? "none" : "1px solid var(--ant-color-primary-border)",
286
- borderRadius: avatarOnly ? "50%" : 9,
287
- boxShadow: avatarOnly ? "none" : void 0,
288
- color: "var(--ant-color-primary)",
289
- fontSize: 12,
290
- fontWeight: 750
291
- }, children: "Z" }), variant === "compact" ? jsx(import_antd2.Typography.Text, { className: labelClassName, style: { fontSize: 13, fontWeight: 650 }, children: "\u767B\u5F55" }) : null] }) }), jsx(import_antd2.Modal, { centered: true, destroyOnHidden: true, footer: null, open: loginOpen, rootClassName: mergeClassNames("zlooks-user-access-modal", classNames.popup), styles: {
292
- body: { paddingTop: 4 },
293
- container: {
294
- border: "1px solid var(--ant-color-border-secondary)",
295
- borderRadius: 22,
296
- boxShadow: "0 28px 80px rgb(15 23 42 / 18%)",
297
- overflow: "hidden",
298
- padding: 24
299
- },
300
- header: { marginBottom: 22 }
301
- }, title: jsxs(import_antd2.Space, { align: "center", size: "middle", children: [jsx(import_antd2.Avatar, { shape: "square", size: 44, style: {
302
- background: "var(--ant-color-text)",
303
- borderRadius: 12,
304
- color: "var(--ant-color-bg-container)",
305
- fontWeight: 750
306
- }, children: "Z" }), jsxs(import_antd2.Flex, { vertical: true, children: [jsx(import_antd2.Typography.Text, { strong: true, style: { fontSize: 17 }, children: "\u6B22\u8FCE\u56DE\u6765" }), jsx(import_antd2.Typography.Text, { type: "secondary", children: "\u9009\u62E9\u4E00\u79CD\u65B9\u5F0F\u7EE7\u7EED" })] })] }), width: 480, onCancel: () => setLoginOpen(false), children: jsxs(import_antd2.Flex, { gap: 12, vertical: true, children: [view.loginMethods.length === 0 ? jsx(import_antd2.Empty, { description: "\u6682\u65F6\u65E0\u6CD5\u767B\u5F55\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5", image: import_antd2.Empty.PRESENTED_IMAGE_SIMPLE, style: { paddingBlock: 24 } }) : view.loginMethods.map((method, index) => jsx(import_antd2.Button, { block: true, href: method.href, onClick: (event) => navigate(event, method.href, () => setLoginOpen(false)), style: {
307
- height: "auto",
308
- minHeight: 72,
309
- padding: "10px 14px",
310
- textAlign: "left"
311
- }, children: jsxs(import_antd2.Flex, { align: "center", gap: 14, justify: "space-between", style: { width: "100%" }, children: [jsxs(import_antd2.Flex, { align: "center", gap: 12, style: { minWidth: 0 }, children: [jsx(import_antd2.Avatar, { shape: "square", size: 40, style: {
312
- background: "var(--ant-color-primary-bg)",
313
- borderRadius: 11,
314
- color: "var(--ant-color-primary)",
315
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
316
- fontSize: 11,
317
- fontWeight: 700
318
- }, children: String(index + 1).padStart(2, "0") }), jsxs(import_antd2.Flex, { style: { minWidth: 0 }, vertical: true, children: [jsx(import_antd2.Typography.Text, { strong: true, children: method.label }), jsx(import_antd2.Typography.Text, { ellipsis: true, type: "secondary", children: "\u7EE7\u7EED\u8BBF\u95EE\u4F60\u7684\u4E2A\u4EBA\u7A7A\u95F4" })] })] }), jsx(import_antd2.Typography.Text, { "aria-hidden": "true", style: { color: "var(--ant-color-primary)" }, children: "\u2192" })] }) }, method.id)), jsx(import_antd2.Typography.Text, { style: { fontSize: 12, marginTop: 6, textAlign: "center" }, type: "secondary", children: "\u767B\u5F55\u4FE1\u606F\u4EC5\u7528\u4E8E\u8BC6\u522B\u4F60\u7684\u8D26\u6237" })] }) })] });
319
- }
320
- function UserAccessTheme({ children }) {
321
- const { mode } = useZlooksTheme();
322
- const { resolvedMode, resolvedTheme } = useZlooksThemeRuntime(mode);
323
- const userAccessTheme = useMemo(() => ({
324
- ...resolvedTheme,
325
- cssVar: { key: `zlooks-user-access-${resolvedMode}` },
326
- components: {
327
- ...resolvedTheme.components,
328
- Button: {
329
- ...resolvedTheme.components?.Button,
330
- ...zlooksUserAccessComponents.Button
331
- }
332
- }
333
- }), [resolvedMode, resolvedTheme]);
334
- return jsx(import_antd2.ConfigProvider, { theme: userAccessTheme, children });
335
- }
336
- function useShellContext() {
337
- const context = useContext(ShellContext);
338
- if (!context)
339
- throw new Error("ZlooksShellProvider is required");
340
- return context;
341
- }
342
- function mergeClassNames(...values) {
343
- return values.filter(Boolean).join(" ");
344
- }
345
- function resolveTriggerAvatarSize(size, avatarOnly) {
346
- if (avatarOnly && size === "small")
347
- return 32;
348
- if (avatarOnly && size === "large")
349
- return 48;
350
- if (avatarOnly)
351
- return 40;
352
- if (size === "small")
353
- return 20;
354
- if (size === "large")
355
- return 28;
356
- return 24;
357
- }
358
-
359
- // ../ui/dist/site-config.js
360
- init_react();
361
- var SitePresentationContext = createContext(void 0);
362
- function ZlooksSiteConfigProvider({ children, initialConfig }) {
363
- return jsx(SitePresentationContext, { value: initialConfig, children });
364
- }
365
- function useSitePresentation() {
366
- return useSitePresentationSnapshot().value;
367
- }
368
- function useSitePresentationSnapshot() {
369
- const snapshot = useContext(SitePresentationContext);
370
- if (!snapshot)
371
- throw new Error("ZlooksSiteConfigProvider is required");
372
- return snapshot;
373
- }
374
-
375
- // src/plugin/page-frame.module.css
376
- var page_frame_default = {
377
- page: "page_frame_page",
378
- headerWrap: "page_frame_headerWrap",
379
- header: "page_frame_header",
380
- brand: "page_frame_brand",
381
- brandMark: "page_frame_brandMark",
382
- brandLogo: "page_frame_brandLogo",
383
- navigation: "page_frame_navigation",
384
- actions: "page_frame_actions",
385
- content: "page_frame_content",
386
- footer: "page_frame_footer"
387
- };
388
-
389
- // src/plugin/page-frame.tsx
390
- function PasswordPageFrame({
391
- children,
392
- shell,
393
- site
394
- }) {
395
- return /* @__PURE__ */ jsx(ZlooksUiProvider, { children: /* @__PURE__ */ jsx(ZlooksShellProvider, { initialContext: shell, children: /* @__PURE__ */ jsx(ZlooksSiteConfigProvider, { initialConfig: site, children: /* @__PURE__ */ jsx(FrameContent, { children }) }) }) });
396
- }
397
- function FrameContent({ children }) {
398
- const navigation = useZlooksNavigation();
399
- const site = useSitePresentation();
400
- const request = useRequest();
401
- const rscNavigation = useRscNavigation();
402
- async function logout(href) {
403
- await request(href, { method: "POST", credentials: "same-origin" }, {
404
- errorMessage: "\u9000\u51FA\u767B\u5F55\u5931\u8D25"
405
- });
406
- rscNavigation.refresh();
407
- }
408
- return /* @__PURE__ */ jsxs("div", { className: page_frame_default.page, "data-shared-page-frame": true, children: [
409
- /* @__PURE__ */ jsx("div", { className: page_frame_default.headerWrap, children: /* @__PURE__ */ jsxs("header", { className: page_frame_default.header, children: [
410
- /* @__PURE__ */ jsxs(RscLink, { className: page_frame_default.brand, href: site.identity.homeHref, children: [
411
- site.identity.logoUrl ? /* @__PURE__ */ jsx("img", { alt: "", className: page_frame_default.brandLogo, src: site.identity.logoUrl }) : /* @__PURE__ */ jsx("span", { className: page_frame_default.brandMark, "aria-hidden": "true", children: "Z" }),
412
- /* @__PURE__ */ jsx("span", { children: site.identity.name })
413
- ] }),
414
- /* @__PURE__ */ jsx("nav", { "aria-label": "\u4E3B\u5BFC\u822A", className: page_frame_default.navigation, children: navigation.map((item) => /* @__PURE__ */ jsx(RscLink, { "aria-current": item.active ? "page" : void 0, href: item.href, children: item.label }, item.key)) }),
415
- /* @__PURE__ */ jsx("div", { className: page_frame_default.actions, children: /* @__PURE__ */ jsx(
416
- ZlooksUserAccess,
417
- {
418
- size: "middle",
419
- shape: "round",
420
- variant: "avatar",
421
- onLogout: logout,
422
- onNavigate: rscNavigation.push
423
- }
424
- ) })
425
- ] }) }),
426
- /* @__PURE__ */ jsx("main", { className: page_frame_default.content, children }),
427
- /* @__PURE__ */ jsxs("footer", { className: page_frame_default.footer, children: [
428
- /* @__PURE__ */ jsxs("div", { children: [
429
- /* @__PURE__ */ jsx("strong", { children: site.identity.name }),
430
- /* @__PURE__ */ jsx("span", { children: "\u4FDD\u6301\u597D\u5947\uFF0C\u8BA4\u771F\u751F\u6D3B\u3002" })
431
- ] }),
432
- /* @__PURE__ */ jsxs("div", { children: [
433
- site.legal.registrations.map((registration) => registration.verificationUrl ? /* @__PURE__ */ jsx(RscLink, { href: registration.verificationUrl, children: registration.number }, registration.id) : /* @__PURE__ */ jsx("span", { children: registration.number }, registration.id)),
434
- site.legal.copyright ? /* @__PURE__ */ jsx("small", { children: site.legal.copyright }) : null
435
- ] })
436
- ] })
437
- ] });
438
- }
439
- export {
440
- PasswordPageFrame as default
441
- };