@yimingliao/cms 0.0.122 → 0.0.124

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.
@@ -35,6 +35,29 @@ var isFolderLocked = (folder) => {
35
35
  return locked;
36
36
  };
37
37
 
38
+ // src/domain/resources/folder/utils/normalize-folder-key.ts
39
+ var normalizeFolderKey = (key) => {
40
+ if (!key) {
41
+ return { folderKeys: [], segments: [], parentKey: "" };
42
+ }
43
+ const segments = key.split("/").filter(Boolean);
44
+ const folderKeys = [];
45
+ segments.reduce((acc, seg) => {
46
+ const next = acc ? `${acc}/${seg}` : seg;
47
+ folderKeys.push(next);
48
+ return next;
49
+ }, "");
50
+ const parentKey = segments.slice(0, -1).join("/");
51
+ return { folderKeys, segments, parentKey };
52
+ };
53
+
54
+ // src/domain/resources/folder/utils/file-manager-double-click.ts
55
+ var fileManagerDoubleClick = (item) => {
56
+ const url = new URL(globalThis.location.href);
57
+ url.searchParams.set("folderKey", item.key);
58
+ globalThis.history.pushState({}, "", url);
59
+ };
60
+
38
61
  // src/domain/resources/post/props.ts
39
62
  var POST_TYPES = {
40
63
  TOPIC: "TOPIC",
@@ -73,4 +96,4 @@ var ROOT_FOLDER = {
73
96
  var SIMPLE_UPLOAD_FOLDER_NAME = "simple-upload";
74
97
  var SIMPLE_UPLOAD_FOLDER_KEY = `${SIMPLE_UPLOAD_FOLDER_NAME}`;
75
98
 
76
- export { ADMIN_ROLES, ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, isFileLocked, isFolderLocked };
99
+ export { ADMIN_ROLES, ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, fileManagerDoubleClick, isFileLocked, isFolderLocked, normalizeFolderKey };
@@ -1,4 +1,4 @@
1
- import { mimeToExtension } from './chunk-VSV6SQWC.js';
1
+ import { mimeToExtension } from './chunk-YYDELEHA.js';
2
2
  import path from 'path/posix';
3
3
  import { ulid } from 'ulid';
4
4
 
@@ -0,0 +1,225 @@
1
+ // src/constants/keys/auth.ts
2
+ var AUTH_KEYS = {
3
+ key: "auth",
4
+ signIn: { key: "sign-in" },
5
+ forgotPassword: { key: "forgot-password" },
6
+ resetPassword: { key: "reset-password" },
7
+ verifyEmail: { key: "verify-email" },
8
+ changePassword: { key: "change-password" },
9
+ signOut: { key: "sign-out" },
10
+ verify: { key: "verify" },
11
+ emailUnverified: { key: "email-unverified" }
12
+ };
13
+
14
+ // src/constants/keys/email.ts
15
+ var EMAIL_KEYS = {
16
+ key: "email",
17
+ auth: {
18
+ key: "auth",
19
+ verifyEmail: { key: "verify-email" },
20
+ forgotPassword: { key: "forgot-password" }
21
+ }
22
+ };
23
+
24
+ // src/constants/keys/main.ts
25
+ var MAIN_KEYS = {
26
+ key: "main",
27
+ dashboard: { key: "dashboard" },
28
+ cmsSettings: { key: "cms-settings" },
29
+ websitePages: { key: "website-pages" },
30
+ storage: { key: "storage" },
31
+ postManagement: { key: "post-management" },
32
+ fileManager: { key: "file-manager" },
33
+ trash: { key: "trash" },
34
+ batch: { key: "batch" }
35
+ };
36
+
37
+ // src/constants/keys/resources.ts
38
+ var RESOURCES_KEYS = {
39
+ key: "resources",
40
+ admin: { key: "admin" },
41
+ adminRefreshToken: { key: "admin-refresh-token" },
42
+ folder: { key: "folder" },
43
+ file: { key: "file" },
44
+ post: { key: "post" },
45
+ topic: { key: "topic" },
46
+ category: { key: "category" },
47
+ tag: { key: "tag" },
48
+ page: { key: "page" },
49
+ seoMetadata: { key: "seo-metadata" }
50
+ };
51
+
52
+ // src/constants/keys/ui.ts
53
+ var UI_KEYS = {
54
+ key: "ui",
55
+ layout: {
56
+ key: "layout",
57
+ navbar: { key: "navbar" },
58
+ sidebar: { key: "sidebar" },
59
+ itemListContainer: { key: "item-list-container" }
60
+ },
61
+ pageHeader: {
62
+ key: "page-header",
63
+ create: { key: "create" },
64
+ edit: { key: "edit" },
65
+ batch: { key: "batch" },
66
+ batchCreate: { key: "batch-create" }
67
+ },
68
+ button: {
69
+ key: "button",
70
+ create: { key: "create" },
71
+ confirm: { key: "confirm" },
72
+ edit: { key: "edit" },
73
+ update: { key: "update" },
74
+ destroy: { key: "destroy" },
75
+ purge: { key: "purge" },
76
+ restore: { key: "restore" },
77
+ batch: { key: "batch" },
78
+ batchCreate: { key: "batch-create" },
79
+ exitBatchMode: { key: "exit-batch-mode" },
80
+ show: { key: "show" },
81
+ setting: { key: "setting" },
82
+ return: { key: "return" },
83
+ cancel: { key: "cancel" }
84
+ },
85
+ blobFile: {
86
+ key: "blob-file",
87
+ fileInfo: { key: "file-info" },
88
+ filePicker: { key: "file-picker" },
89
+ filePreviewList: { key: "file-preview-list" }
90
+ },
91
+ dialog: {
92
+ key: "dialog",
93
+ confirm: { key: "confirm" }
94
+ },
95
+ modal: {
96
+ key: "modal",
97
+ pickModal: { key: "pick-modal" }
98
+ },
99
+ field: {
100
+ key: "field",
101
+ controlFields: { key: "control-fields" }
102
+ }
103
+ };
104
+
105
+ // src/constants/keys/index.ts
106
+ var KEYS = {
107
+ main: MAIN_KEYS,
108
+ auth: AUTH_KEYS,
109
+ resources: RESOURCES_KEYS,
110
+ ui: UI_KEYS,
111
+ email: EMAIL_KEYS
112
+ };
113
+
114
+ // src/constants/paths/cms-path.ts
115
+ var CMS_PATH = "/cms";
116
+
117
+ // src/constants/paths/main.ts
118
+ var MAIN_PATHS = {
119
+ dashboard: {
120
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}`
121
+ },
122
+ cmsSettings: {
123
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.cmsSettings.key}`
124
+ },
125
+ websitePages: {
126
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.websitePages.key}`
127
+ },
128
+ storage: {
129
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.storage.key}`
130
+ },
131
+ postManagement: {
132
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.postManagement.key}`
133
+ },
134
+ fileManager: {
135
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.storage.key}/${KEYS.main.fileManager.key}`
136
+ },
137
+ trash: {
138
+ path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.storage.key}/${KEYS.main.trash.key}`
139
+ }
140
+ };
141
+
142
+ // src/constants/paths/auth.ts
143
+ var AUTH_PATHS = {
144
+ signIn: {
145
+ path: `${CMS_PATH}/${KEYS.auth.signIn.key}`
146
+ },
147
+ forgotPassword: {
148
+ path: `${CMS_PATH}/${KEYS.auth.forgotPassword.key}`
149
+ },
150
+ resetPassword: {
151
+ path: `${CMS_PATH}/${KEYS.auth.resetPassword.key}`
152
+ },
153
+ verifyEmail: {
154
+ path: `${CMS_PATH}/${KEYS.auth.verifyEmail.key}`
155
+ },
156
+ emailUnverified: {
157
+ path: `${CMS_PATH}/${KEYS.auth.emailUnverified.key}`
158
+ },
159
+ changePassword: {
160
+ path: `${MAIN_PATHS.dashboard.path}/${KEYS.auth.changePassword.key}`
161
+ }
162
+ };
163
+
164
+ // src/constants/paths/resources.ts
165
+ var RESOURCES_PATHS = {
166
+ admin: {
167
+ path: `${MAIN_PATHS.cmsSettings.path}/${KEYS.resources.admin.key}`
168
+ },
169
+ folder: {
170
+ path: `${MAIN_PATHS.storage.path}/${KEYS.resources.folder.key}`
171
+ },
172
+ file: {
173
+ path: `${MAIN_PATHS.storage.path}/${KEYS.resources.file.key}`
174
+ },
175
+ post: {
176
+ path: (topicSlug = "") => `${MAIN_PATHS.postManagement.path}/${topicSlug}/${KEYS.resources.post.key}`
177
+ },
178
+ topic: {
179
+ path: `${MAIN_PATHS.postManagement.path}/${KEYS.resources.topic.key}`
180
+ },
181
+ category: {
182
+ path: (topicSlug = "") => `${MAIN_PATHS.postManagement.path}/${topicSlug}/${KEYS.resources.category.key}`
183
+ },
184
+ tag: {
185
+ path: `${MAIN_PATHS.postManagement.path}/${KEYS.resources.tag.key}`
186
+ }
187
+ };
188
+
189
+ // src/constants/paths/index.ts
190
+ var PATHS = {
191
+ main: MAIN_PATHS,
192
+ auth: AUTH_PATHS,
193
+ resources: RESOURCES_PATHS
194
+ };
195
+
196
+ // src/constants/cache-keys.ts
197
+ var CACHE_KEYS = {
198
+ // ----------------------------------------------------------------
199
+ // shared
200
+ // ----------------------------------------------------------------
201
+ findFull: "find-full",
202
+ findWithSeoMetadata: "find-with-seo-metadata",
203
+ // Only use in Post
204
+ findMany: (key) => `${key}|find-many`,
205
+ findListCards: (key) => `${key}|find-list-cards`,
206
+ findBySlug: (key) => `${key}|find-by-slug`,
207
+ // ----------------------------------------------------------------
208
+ // auth
209
+ // ----------------------------------------------------------------
210
+ auth: { verify: "auth|verify" },
211
+ // Don't clear this ! (also use in useCommand)
212
+ // ----------------------------------------------------------------
213
+ // folder
214
+ // ----------------------------------------------------------------
215
+ folder: {
216
+ findByKey: "folder|find-by-key"
217
+ // use in File Manager
218
+ }
219
+ };
220
+
221
+ // src/constants/anchor.ts
222
+ var NEW_TAB_TARGET = "_blank";
223
+ var NEW_TAB_REL = "noopener noreferrer";
224
+
225
+ export { CACHE_KEYS, KEYS, NEW_TAB_REL, NEW_TAB_TARGET, PATHS };
@@ -617,8 +617,6 @@ declare const PAGE_HEADER_HEIGHT = 56;
617
617
 
618
618
  declare function useDeviceInfo(): DeviceInfo | null;
619
619
 
620
- declare const cn: (...inputs: ClassValue[]) => string;
621
-
622
620
  interface Params {
623
621
  items?: MultiItems;
624
622
  setPickedItems?: Dispatch<SetStateAction<MultiItems>>;
@@ -645,4 +643,8 @@ declare const getControlMeta: ({ records, excludeIndex, excludeSlug, }: {
645
643
  existingSlugs: string[];
646
644
  };
647
645
 
648
- export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ContentContainer, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, LayoutSkeleton, ListCardsContainer, MainFields, NAVBAR_HEIGHT, type NavItem, NavMain, Option, PAGE_HEADER_HEIGHT, PageHeader, PasswordInput, ReturnButton, SIDEBAR_WIDTH, SearchInput, Select, type ShowToastOption, SideFields, SlugField, Textarea, ThemeProvider, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, getControlMeta, handleToast, useAdmin, useDeviceInfo, usePickItems };
646
+ declare const cn: (...inputs: ClassValue[]) => string;
647
+
648
+ declare const isConfirm: (t: (key?: string) => string, key?: string) => boolean;
649
+
650
+ export { AdminProvider, ArrayInput, Button, type ButtonProps, Checkbox, ContentContainer, ControlFields, type ControlMeta, Field, FieldBody, FieldsContainer, Form, IndexField, Input, type InputProps, LayoutSkeleton, ListCardsContainer, MainFields, NAVBAR_HEIGHT, type NavItem, NavMain, Option, PAGE_HEADER_HEIGHT, PageHeader, PasswordInput, ReturnButton, SIDEBAR_WIDTH, SearchInput, Select, type ShowToastOption, SideFields, SlugField, Textarea, ThemeProvider, cn, createAdminInitializer, createChangePasswordPage, createEmailUnverifiedPage, createForgotPasswordPage, createI18nSelector, createNavbar, createRequestInterceptor, createResetPasswordPage, createResponseInterceptor, createSignInPage, createSignOutButton, createSmartFetch, createUseCommand, createUseQuery, createVerifyEmailPage, getControlMeta, handleToast, isConfirm, useAdmin, useDeviceInfo, usePickItems };
@@ -1,6 +1,7 @@
1
- import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-TUHPRDMA.js';
2
- export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, getControlMeta, useDeviceInfo, usePickItems, useSidebar } from '../chunk-TUHPRDMA.js';
3
- import { ensureArray, findTranslation, joinUrl } from '../chunk-VSV6SQWC.js';
1
+ import { PATHS } from '../chunk-VPRGHVG3.js';
2
+ import { cn, useSidebar, Sidebar, Skeleton, SidebarInset, SIDEBAR_WIDTH, SidebarGroup, SidebarMenu, Collapsible, SidebarMenuItem, SidebarMenuButton, Separator, CollapsibleTrigger, SidebarMenuAction, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, Button, Spinner, useParentPathname, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, PAGE_HEADER_HEIGHT, InputGroup, InputGroupAddon, Textarea, InputGroupInput, InputGroupButton, Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, Label, FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, Card, useDeviceInfo, CardHeader, CardTitle, CardContent, useCountdown, CardDescription, NAVBAR_HEIGHT, isConfirm, Avatar, AvatarImage, AvatarFallback, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../chunk-YLFBYJTE.js';
3
+ export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH, Sidebar, SidebarContent, SidebarInset, SidebarProvider, cn, getControlMeta, isConfirm, useDeviceInfo, usePickItems, useSidebar } from '../chunk-YLFBYJTE.js';
4
+ import { ensureArray, findTranslation, joinUrl } from '../chunk-YYDELEHA.js';
4
5
  import { toast } from 'sonner';
5
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
7
  import { useMutation, useQuery } from '@tanstack/react-query';
@@ -382,65 +383,6 @@ function NavMain({ items }) {
382
383
  );
383
384
  }) }) });
384
385
  }
385
-
386
- // src/constants/keys/auth.ts
387
- var AUTH_KEYS = {
388
- signIn: { key: "sign-in" },
389
- forgotPassword: { key: "forgot-password" },
390
- changePassword: { key: "change-password" }};
391
-
392
- // src/constants/keys/main.ts
393
- var MAIN_KEYS = {
394
- dashboard: { key: "dashboard" },
395
- cmsSettings: { key: "cms-settings" }};
396
-
397
- // src/constants/keys/resources.ts
398
- var RESOURCES_KEYS = {
399
- admin: { key: "admin" }};
400
-
401
- // src/constants/keys/index.ts
402
- var KEYS = {
403
- main: MAIN_KEYS,
404
- auth: AUTH_KEYS,
405
- resources: RESOURCES_KEYS};
406
-
407
- // src/constants/paths/cms-path.ts
408
- var CMS_PATH = "/cms";
409
-
410
- // src/constants/paths/main.ts
411
- var MAIN_PATHS = {
412
- dashboard: {
413
- path: `${CMS_PATH}/${KEYS.main.dashboard.key}`
414
- },
415
- cmsSettings: {
416
- path: `${CMS_PATH}/${KEYS.main.dashboard.key}/${KEYS.main.cmsSettings.key}`
417
- }};
418
-
419
- // src/constants/paths/auth.ts
420
- var AUTH_PATHS = {
421
- signIn: {
422
- path: `${CMS_PATH}/${KEYS.auth.signIn.key}`
423
- },
424
- forgotPassword: {
425
- path: `${CMS_PATH}/${KEYS.auth.forgotPassword.key}`
426
- },
427
- changePassword: {
428
- path: `${MAIN_PATHS.dashboard.path}/${KEYS.auth.changePassword.key}`
429
- }
430
- };
431
-
432
- // src/constants/paths/resources.ts
433
- var RESOURCES_PATHS = {
434
- admin: {
435
- path: `${MAIN_PATHS.cmsSettings.path}/${KEYS.resources.admin.key}`
436
- }};
437
-
438
- // src/constants/paths/index.ts
439
- var PATHS = {
440
- main: MAIN_PATHS,
441
- auth: AUTH_PATHS,
442
- resources: RESOURCES_PATHS
443
- };
444
386
  function Button2({
445
387
  icon,
446
388
  href,
@@ -1 +1 @@
1
- export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-TUHPRDMA.js';
1
+ export { Avatar, AvatarFallback, AvatarImage, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, SIDEBAR_COOKIE_NAME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, useSidebar } from '../../chunk-YLFBYJTE.js';
package/dist/index.d.ts CHANGED
@@ -8,6 +8,16 @@ import 'react';
8
8
 
9
9
  declare const isFolderLocked: (folder?: FolderFull | Folder) => boolean;
10
10
 
11
+ declare const normalizeFolderKey: (key?: string) => {
12
+ folderKeys: string[];
13
+ segments: string[];
14
+ parentKey: string;
15
+ };
16
+
17
+ declare const fileManagerDoubleClick: (item: {
18
+ key: string;
19
+ }) => void;
20
+
11
21
  declare const isFileLocked: (file?: FileFull | FileCard | null) => boolean;
12
22
 
13
23
  declare const ADMIN_ROLE_ARRAY: readonly ["SUPER_ADMIN", "ADMIN", "EDITOR"];
@@ -23,6 +33,299 @@ declare const ROOT_FOLDER: FolderFull;
23
33
  declare const SIMPLE_UPLOAD_FOLDER_NAME = "simple-upload";
24
34
  declare const SIMPLE_UPLOAD_FOLDER_KEY = "simple-upload";
25
35
 
36
+ declare const KEYS: {
37
+ readonly main: {
38
+ readonly key: "main";
39
+ readonly dashboard: {
40
+ readonly key: "dashboard";
41
+ };
42
+ readonly cmsSettings: {
43
+ readonly key: "cms-settings";
44
+ };
45
+ readonly websitePages: {
46
+ readonly key: "website-pages";
47
+ };
48
+ readonly storage: {
49
+ readonly key: "storage";
50
+ };
51
+ readonly postManagement: {
52
+ readonly key: "post-management";
53
+ };
54
+ readonly fileManager: {
55
+ readonly key: "file-manager";
56
+ };
57
+ readonly trash: {
58
+ readonly key: "trash";
59
+ };
60
+ readonly batch: {
61
+ readonly key: "batch";
62
+ };
63
+ };
64
+ readonly auth: {
65
+ readonly key: "auth";
66
+ readonly signIn: {
67
+ readonly key: "sign-in";
68
+ };
69
+ readonly forgotPassword: {
70
+ readonly key: "forgot-password";
71
+ };
72
+ readonly resetPassword: {
73
+ readonly key: "reset-password";
74
+ };
75
+ readonly verifyEmail: {
76
+ readonly key: "verify-email";
77
+ };
78
+ readonly changePassword: {
79
+ readonly key: "change-password";
80
+ };
81
+ readonly signOut: {
82
+ readonly key: "sign-out";
83
+ };
84
+ readonly verify: {
85
+ readonly key: "verify";
86
+ };
87
+ readonly emailUnverified: {
88
+ readonly key: "email-unverified";
89
+ };
90
+ };
91
+ readonly resources: {
92
+ readonly key: "resources";
93
+ readonly admin: {
94
+ readonly key: "admin";
95
+ };
96
+ readonly adminRefreshToken: {
97
+ readonly key: "admin-refresh-token";
98
+ };
99
+ readonly folder: {
100
+ readonly key: "folder";
101
+ };
102
+ readonly file: {
103
+ readonly key: "file";
104
+ };
105
+ readonly post: {
106
+ readonly key: "post";
107
+ };
108
+ readonly topic: {
109
+ readonly key: "topic";
110
+ };
111
+ readonly category: {
112
+ readonly key: "category";
113
+ };
114
+ readonly tag: {
115
+ readonly key: "tag";
116
+ };
117
+ readonly page: {
118
+ readonly key: "page";
119
+ };
120
+ readonly seoMetadata: {
121
+ readonly key: "seo-metadata";
122
+ };
123
+ };
124
+ readonly ui: {
125
+ readonly key: "ui";
126
+ readonly layout: {
127
+ readonly key: "layout";
128
+ readonly navbar: {
129
+ readonly key: "navbar";
130
+ };
131
+ readonly sidebar: {
132
+ readonly key: "sidebar";
133
+ };
134
+ readonly itemListContainer: {
135
+ readonly key: "item-list-container";
136
+ };
137
+ };
138
+ readonly pageHeader: {
139
+ readonly key: "page-header";
140
+ readonly create: {
141
+ readonly key: "create";
142
+ };
143
+ readonly edit: {
144
+ readonly key: "edit";
145
+ };
146
+ readonly batch: {
147
+ readonly key: "batch";
148
+ };
149
+ readonly batchCreate: {
150
+ readonly key: "batch-create";
151
+ };
152
+ };
153
+ readonly button: {
154
+ readonly key: "button";
155
+ readonly create: {
156
+ readonly key: "create";
157
+ };
158
+ readonly confirm: {
159
+ readonly key: "confirm";
160
+ };
161
+ readonly edit: {
162
+ readonly key: "edit";
163
+ };
164
+ readonly update: {
165
+ readonly key: "update";
166
+ };
167
+ readonly destroy: {
168
+ readonly key: "destroy";
169
+ };
170
+ readonly purge: {
171
+ readonly key: "purge";
172
+ };
173
+ readonly restore: {
174
+ readonly key: "restore";
175
+ };
176
+ readonly batch: {
177
+ readonly key: "batch";
178
+ };
179
+ readonly batchCreate: {
180
+ readonly key: "batch-create";
181
+ };
182
+ readonly exitBatchMode: {
183
+ readonly key: "exit-batch-mode";
184
+ };
185
+ readonly show: {
186
+ readonly key: "show";
187
+ };
188
+ readonly setting: {
189
+ readonly key: "setting";
190
+ };
191
+ readonly return: {
192
+ readonly key: "return";
193
+ };
194
+ readonly cancel: {
195
+ readonly key: "cancel";
196
+ };
197
+ };
198
+ readonly blobFile: {
199
+ readonly key: "blob-file";
200
+ readonly fileInfo: {
201
+ readonly key: "file-info";
202
+ };
203
+ readonly filePicker: {
204
+ readonly key: "file-picker";
205
+ };
206
+ readonly filePreviewList: {
207
+ readonly key: "file-preview-list";
208
+ };
209
+ };
210
+ readonly dialog: {
211
+ readonly key: "dialog";
212
+ readonly confirm: {
213
+ readonly key: "confirm";
214
+ };
215
+ };
216
+ readonly modal: {
217
+ readonly key: "modal";
218
+ readonly pickModal: {
219
+ readonly key: "pick-modal";
220
+ };
221
+ };
222
+ readonly field: {
223
+ readonly key: "field";
224
+ readonly controlFields: {
225
+ readonly key: "control-fields";
226
+ };
227
+ };
228
+ };
229
+ readonly email: {
230
+ readonly key: "email";
231
+ readonly auth: {
232
+ readonly key: "auth";
233
+ readonly verifyEmail: {
234
+ readonly key: "verify-email";
235
+ };
236
+ readonly forgotPassword: {
237
+ readonly key: "forgot-password";
238
+ };
239
+ };
240
+ };
241
+ };
242
+
243
+ declare const PATHS: {
244
+ readonly main: {
245
+ readonly dashboard: {
246
+ readonly path: "/cms/dashboard";
247
+ };
248
+ readonly cmsSettings: {
249
+ readonly path: "/cms/dashboard/cms-settings";
250
+ };
251
+ readonly websitePages: {
252
+ readonly path: "/cms/dashboard/website-pages";
253
+ };
254
+ readonly storage: {
255
+ readonly path: "/cms/dashboard/storage";
256
+ };
257
+ readonly postManagement: {
258
+ readonly path: "/cms/dashboard/post-management";
259
+ };
260
+ readonly fileManager: {
261
+ readonly path: "/cms/dashboard/storage/file-manager";
262
+ };
263
+ readonly trash: {
264
+ readonly path: "/cms/dashboard/storage/trash";
265
+ };
266
+ };
267
+ readonly auth: {
268
+ readonly signIn: {
269
+ readonly path: "/cms/sign-in";
270
+ };
271
+ readonly forgotPassword: {
272
+ readonly path: "/cms/forgot-password";
273
+ };
274
+ readonly resetPassword: {
275
+ readonly path: "/cms/reset-password";
276
+ };
277
+ readonly verifyEmail: {
278
+ readonly path: "/cms/verify-email";
279
+ };
280
+ readonly emailUnverified: {
281
+ readonly path: "/cms/email-unverified";
282
+ };
283
+ readonly changePassword: {
284
+ readonly path: "/cms/dashboard/change-password";
285
+ };
286
+ };
287
+ readonly resources: {
288
+ readonly admin: {
289
+ readonly path: "/cms/dashboard/cms-settings/admin";
290
+ };
291
+ readonly folder: {
292
+ readonly path: "/cms/dashboard/storage/folder";
293
+ };
294
+ readonly file: {
295
+ readonly path: "/cms/dashboard/storage/file";
296
+ };
297
+ readonly post: {
298
+ readonly path: (topicSlug?: string) => string;
299
+ };
300
+ readonly topic: {
301
+ readonly path: "/cms/dashboard/post-management/topic";
302
+ };
303
+ readonly category: {
304
+ readonly path: (topicSlug?: string) => string;
305
+ };
306
+ readonly tag: {
307
+ readonly path: "/cms/dashboard/post-management/tag";
308
+ };
309
+ };
310
+ };
311
+
312
+ declare const CACHE_KEYS: {
313
+ findFull: string;
314
+ findWithSeoMetadata: string;
315
+ findMany: (key: string) => string;
316
+ findListCards: (key: string) => string;
317
+ findBySlug: (key: string) => string;
318
+ auth: {
319
+ verify: string;
320
+ };
321
+ folder: {
322
+ findByKey: string;
323
+ };
324
+ };
325
+
326
+ declare const NEW_TAB_TARGET = "_blank";
327
+ declare const NEW_TAB_REL = "noopener noreferrer";
328
+
26
329
  declare const mimeToExtension: (mimeType?: string) => string;
27
330
 
28
331
  declare const classifyFileType: (mimeType?: string, extension?: string) => "IMAGE" | "AUDIO" | "VIDEO" | "DOCUMENT" | "ARCHIVE" | "OTHER";
@@ -107,6 +410,8 @@ declare function ensureArray<T>(value: T | T[] | null | undefined): T[];
107
410
 
108
411
  declare function formatDateTime(input?: string | Date): string;
109
412
 
413
+ declare function joinUrl(...parts: string[]): string;
414
+
110
415
  declare const SIZE: {
111
416
  readonly BYTE: 1;
112
417
  readonly KB: 1024;
@@ -117,4 +422,4 @@ declare const SIZE: {
117
422
  };
118
423
  type SizeUnit = keyof typeof SIZE;
119
424
 
120
- export { ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, BaseTranslation, ErrorDetail, ErrorResult, type ErrorResultParams, FileCard, FileFull, Folder, FolderFull, OG_TYPE_ARRAY, type OgType, PostFull, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, SIZE, type SizeUnit, SuccessResult, type SuccessResultParams, TWITTER_CARD_ARRAY, type TwitterCard, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, isFileLocked, isFolderLocked, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd };
425
+ export { ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, BaseTranslation, CACHE_KEYS, ErrorDetail, ErrorResult, type ErrorResultParams, FileCard, FileFull, Folder, FolderFull, KEYS, NEW_TAB_REL, NEW_TAB_TARGET, OG_TYPE_ARRAY, type OgType, PATHS, PostFull, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, SIZE, type SizeUnit, SuccessResult, type SuccessResultParams, TWITTER_CARD_ARRAY, type TwitterCard, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, fileManagerDoubleClick, findTranslation, formatDateTime, formatFileSize, getMediaInfo, isFileLocked, isFolderLocked, joinUrl, jsonArrayToDb, jsonArrayToUi, mimeToExtension, normalizeFolderKey, result, serializeJsonLd };
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { ADMIN_ROLES, ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, isFileLocked, isFolderLocked } from './chunk-UO5SKNAK.js';
2
- export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd } from './chunk-VSV6SQWC.js';
1
+ export { CACHE_KEYS, KEYS, NEW_TAB_REL, NEW_TAB_TARGET, PATHS } from './chunk-VPRGHVG3.js';
2
+ export { ADMIN_ROLES, ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, fileManagerDoubleClick, isFileLocked, isFolderLocked, normalizeFolderKey } from './chunk-5LKI7KHR.js';
3
+ export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, joinUrl, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd } from './chunk-YYDELEHA.js';
@@ -1,5 +1,5 @@
1
- import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER } from '../chunk-UO5SKNAK.js';
2
- import { SIZE, result, datetimeToDb, jsonArrayToDb, mimeToExtension, classifyFileType, TWITTER_CARD_ARRAY, OG_TYPE_ARRAY } from '../chunk-VSV6SQWC.js';
1
+ import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER } from '../chunk-5LKI7KHR.js';
2
+ import { SIZE, result, datetimeToDb, jsonArrayToDb, mimeToExtension, classifyFileType, TWITTER_CARD_ARRAY, OG_TYPE_ARRAY } from '../chunk-YYDELEHA.js';
3
3
  import jwt from 'jsonwebtoken';
4
4
  import argon2 from 'argon2';
5
5
  import crypto, { timingSafeEqual } from 'crypto';
@@ -1,5 +1,5 @@
1
- import { createObjectKey } from '../../chunk-4BSB3AZG.js';
2
- import '../../chunk-VSV6SQWC.js';
1
+ import { createObjectKey } from '../../chunk-V3UUO5WJ.js';
2
+ import '../../chunk-YYDELEHA.js';
3
3
  import { PutObjectCommand, DeleteObjectCommand, CopyObjectCommand } from '@aws-sdk/client-s3';
4
4
 
5
5
  function createR2Service({
@@ -1,5 +1,5 @@
1
- import { createObjectKey } from '../../chunk-4BSB3AZG.js';
2
- import '../../chunk-VSV6SQWC.js';
1
+ import { createObjectKey } from '../../chunk-V3UUO5WJ.js';
2
+ import '../../chunk-YYDELEHA.js';
3
3
  import path from 'path/posix';
4
4
  import { createPool } from 'generic-pool';
5
5
  import SFTPClient from 'ssh2-sftp-client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.122",
3
+ "version": "0.0.124",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,25 +39,6 @@ function useDeviceInfo() {
39
39
  }, []);
40
40
  return deviceInfo;
41
41
  }
42
- var cn = (...inputs) => {
43
- return twMerge(clsx(inputs));
44
- };
45
- var MOBILE_BREAKPOINT = 768;
46
- var useIsMobile = () => {
47
- const [isMobile, setIsMobile] = React15.useState();
48
- React15.useEffect(() => {
49
- const mql = globalThis.matchMedia(
50
- `(max-width: ${MOBILE_BREAKPOINT - 1}px)`
51
- );
52
- const onChange = () => {
53
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
54
- };
55
- mql.addEventListener("change", onChange);
56
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
57
- return () => mql.removeEventListener("change", onChange);
58
- }, []);
59
- return !!isMobile;
60
- };
61
42
  var usePickItems = ({ items, setPickedItems }) => {
62
43
  const pick = useCallback(
63
44
  (item) => {
@@ -128,6 +109,30 @@ var getControlMeta = ({
128
109
  existingSlugs
129
110
  };
130
111
  };
112
+ var cn = (...inputs) => {
113
+ return twMerge(clsx(inputs));
114
+ };
115
+ var MOBILE_BREAKPOINT = 768;
116
+ var useIsMobile = () => {
117
+ const [isMobile, setIsMobile] = React15.useState();
118
+ React15.useEffect(() => {
119
+ const mql = globalThis.matchMedia(
120
+ `(max-width: ${MOBILE_BREAKPOINT - 1}px)`
121
+ );
122
+ const onChange = () => {
123
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
124
+ };
125
+ mql.addEventListener("change", onChange);
126
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
127
+ return () => mql.removeEventListener("change", onChange);
128
+ }, []);
129
+ return !!isMobile;
130
+ };
131
+
132
+ // src/client/applications/ui/is-confirm.ts
133
+ var isConfirm = (t, key = "ui.dialog.confirm.text") => {
134
+ return confirm(t(key));
135
+ };
131
136
  var useCountdown = (initialTime) => {
132
137
  const [timeLeft, setTimeLeft] = useState(initialTime);
133
138
  const [isCounting, setIsCounting] = useState(false);
@@ -165,11 +170,6 @@ var useParentPathname = () => {
165
170
  return index <= 0 ? "/" : pathname.slice(0, index);
166
171
  };
167
172
 
168
- // src/client/applications/ui/is-confirm.ts
169
- var isConfirm = (t, key = "ui.dialog.confirm.text") => {
170
- return confirm(t(key));
171
- };
172
-
173
173
  // src/client/interfaces/styles/constants.ts
174
174
  var NAVBAR_HEIGHT = 60;
175
175
  var SIDEBAR_WIDTH = 288;
File without changes