@yimingliao/cms 0.0.146 → 0.0.147
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/dist/export/client/components/index.js +69 -0
- package/dist/src/client/applications/ui/use-parent-pathname.js +10 -0
- package/dist/src/client/interfaces/components/admin-initializer.js +29 -0
- package/dist/src/client/interfaces/components/resources/file/file-card.js +87 -0
- package/dist/src/client/interfaces/components/resources/file/file-list.js +159 -0
- package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +71 -0
- package/dist/src/client/interfaces/components/resources/file/type-buttons.js +62 -0
- package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +96 -0
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +63 -0
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +94 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +26 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +74 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +33 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +39 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +33 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +33 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +48 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +61 -0
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +39 -0
- package/dist/src/client/interfaces/components/ui/buttons/return-button.js +61 -0
- package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +82 -0
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +51 -0
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +38 -0
- package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +77 -0
- package/dist/src/client/interfaces/components/ui/display/array-list.js +69 -0
- package/dist/src/client/interfaces/components/ui/display/badge.js +41 -0
- package/dist/src/client/interfaces/components/ui/display/html-display.js +32 -0
- package/dist/src/client/interfaces/components/ui/display/object-array-list.js +75 -0
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +31 -0
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +34 -0
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +81 -0
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +39 -0
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +49 -0
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +53 -0
- package/dist/src/client/interfaces/components/ui/features/external-link.js +15 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +118 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +48 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +74 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +48 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +109 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +85 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +40 -0
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +113 -0
- package/dist/src/client/interfaces/components/ui/features/file/uploader.js +101 -0
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +112 -0
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +97 -0
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +77 -0
- package/dist/src/client/interfaces/components/ui/features/smart-image.js +57 -0
- package/dist/src/client/interfaces/components/ui/features/tick.js +27 -0
- package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +24 -0
- package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +25 -0
- package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +24 -0
- package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +9 -0
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +112 -0
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +158 -0
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +59 -0
- package/dist/src/client/interfaces/components/ui/form/field-body.js +79 -0
- package/dist/src/client/interfaces/components/ui/form/index-field.js +87 -0
- package/dist/src/client/interfaces/components/ui/form/slug-field.js +82 -0
- package/dist/src/client/interfaces/components/ui/inputs/array-input.js +110 -0
- package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +93 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +143 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +71 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +41 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +32 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +15 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +112 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +24 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +26 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +84 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +17 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +81 -0
- package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +50 -0
- package/dist/src/client/interfaces/components/ui/inputs/search-input.js +61 -0
- package/dist/src/client/interfaces/components/ui/inputs/select.js +69 -0
- package/dist/src/client/interfaces/components/ui/inputs/textarea.js +62 -0
- package/dist/src/client/interfaces/components/ui/layouts/content-container.js +38 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +42 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +106 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +84 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +58 -0
- package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +51 -0
- package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +99 -0
- package/dist/src/client/interfaces/styles/constants.js +3 -1
- package/dist/src/constants/file.js +27 -0
- package/dist/src/shared/list-items.js +3 -0
- package/dist/src/shared/utils/debounce.js +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { Sun, Moon, TvMinimal } from 'lucide-react';
|
|
5
|
+
import { useTheme } from 'next-themes';
|
|
6
|
+
import '@radix-ui/react-avatar';
|
|
7
|
+
import 'react';
|
|
8
|
+
import 'ua-parser-js';
|
|
9
|
+
import 'clsx';
|
|
10
|
+
import 'tailwind-merge';
|
|
11
|
+
import 'next/navigation';
|
|
12
|
+
import '../../../shadcn/badge.js';
|
|
13
|
+
import '../../../shadcn/button.js';
|
|
14
|
+
import '@radix-ui/react-collapsible';
|
|
15
|
+
import '@radix-ui/react-dialog';
|
|
16
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '../../../shadcn/dropdown-menu.js';
|
|
17
|
+
import '../../../shadcn/input-group.js';
|
|
18
|
+
import '@radix-ui/react-label';
|
|
19
|
+
import '@radix-ui/react-select';
|
|
20
|
+
import '@radix-ui/react-separator';
|
|
21
|
+
import '../../../shadcn/sidebar.js';
|
|
22
|
+
import '@radix-ui/react-tooltip';
|
|
23
|
+
import { Button } from '../../buttons/button.js';
|
|
24
|
+
|
|
25
|
+
function ThemeSelector() {
|
|
26
|
+
const { setTheme } = useTheme();
|
|
27
|
+
const { t } = useTranslator();
|
|
28
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "icon", children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Sun, { className: "h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
|
|
31
|
+
/* @__PURE__ */ jsx(Moon, { className: "absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Select theme" })
|
|
33
|
+
] }) }),
|
|
34
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setTheme("light"), children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Sun, {}),
|
|
37
|
+
t("ui.layout.navbar.theme.light.text")
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setTheme("dark"), children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Moon, {}),
|
|
41
|
+
t("ui.layout.navbar.theme.dark.text")
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setTheme("system"), children: [
|
|
44
|
+
/* @__PURE__ */ jsx(TvMinimal, {}),
|
|
45
|
+
t("ui.layout.navbar.theme.system.text")
|
|
46
|
+
] })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { ThemeSelector };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { usePathname } from 'next/navigation';
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
7
|
+
import '@radix-ui/react-avatar';
|
|
8
|
+
import 'ua-parser-js';
|
|
9
|
+
import 'clsx';
|
|
10
|
+
import 'tailwind-merge';
|
|
11
|
+
import '../../../shadcn/badge.js';
|
|
12
|
+
import '../../../shadcn/button.js';
|
|
13
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '../../../shadcn/collapsible.js';
|
|
14
|
+
import '@radix-ui/react-dialog';
|
|
15
|
+
import '@radix-ui/react-dropdown-menu';
|
|
16
|
+
import '../../../shadcn/input-group.js';
|
|
17
|
+
import '@radix-ui/react-label';
|
|
18
|
+
import '@radix-ui/react-select';
|
|
19
|
+
import { Separator } from '../../../shadcn/separator.js';
|
|
20
|
+
import { SidebarGroup, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarMenuAction, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton } from '../../../shadcn/sidebar.js';
|
|
21
|
+
import '@radix-ui/react-tooltip';
|
|
22
|
+
|
|
23
|
+
const getMainPath = (path) => "/" + path.split("/").slice(3).filter(Boolean).join("/");
|
|
24
|
+
const toSegments = (path) => path.split("/").filter(Boolean);
|
|
25
|
+
const isSegmentMatch = (current, target) => {
|
|
26
|
+
const currentSeg = toSegments(current);
|
|
27
|
+
const targetSeg = toSegments(target);
|
|
28
|
+
if (targetSeg.length > currentSeg.length) return false;
|
|
29
|
+
return targetSeg.every((seg, i) => currentSeg[i] === seg);
|
|
30
|
+
};
|
|
31
|
+
function NavMain({ items }) {
|
|
32
|
+
const pathname = usePathname();
|
|
33
|
+
const [openItems, setOpenItems] = useState([]);
|
|
34
|
+
const toggleItem = (title, open) => {
|
|
35
|
+
setOpenItems(
|
|
36
|
+
(prev) => open ? [...prev, title] : prev.filter((t) => t !== title)
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
const parsedPathname = getMainPath(pathname);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const matched = items.filter(
|
|
42
|
+
(item) => item.url ? isSegmentMatch(parsedPathname, getMainPath(item.url)) : false
|
|
43
|
+
).map((item) => item.title || "");
|
|
44
|
+
queueMicrotask(() => setOpenItems(matched));
|
|
45
|
+
}, [parsedPathname, items]);
|
|
46
|
+
return /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: items.map((item, index) => {
|
|
47
|
+
const isOpen = openItems.includes(item.title || "");
|
|
48
|
+
const parsedUrl = getMainPath(item.url || "");
|
|
49
|
+
const isCurrentPath = item.url ? isSegmentMatch(parsedPathname, parsedUrl) : false;
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
Collapsible,
|
|
52
|
+
{
|
|
53
|
+
asChild: true,
|
|
54
|
+
open: isOpen,
|
|
55
|
+
onOpenChange: (open) => toggleItem(item.title || "", open),
|
|
56
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, { className: "[&>button]:top-2 [&>button]:size-6", children: [
|
|
57
|
+
!item.isSeparator ? /* @__PURE__ */ jsx(
|
|
58
|
+
SidebarMenuButton,
|
|
59
|
+
{
|
|
60
|
+
asChild: true,
|
|
61
|
+
size: "md",
|
|
62
|
+
isActive: isCurrentPath,
|
|
63
|
+
children: /* @__PURE__ */ jsxs(Link, { href: item.url || "", children: [
|
|
64
|
+
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
65
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
66
|
+
] })
|
|
67
|
+
}
|
|
68
|
+
) : /* @__PURE__ */ jsx(Separator, {}),
|
|
69
|
+
item.items?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(SidebarMenuAction, { className: "data-[state=open]:rotate-90", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(ChevronRight, {}),
|
|
72
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle" })
|
|
73
|
+
] }) }),
|
|
74
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem, index2) => {
|
|
75
|
+
const parsedPathname2 = getMainPath(pathname);
|
|
76
|
+
const parsedUrl2 = getMainPath(subItem.url || "");
|
|
77
|
+
const isCurrentPath2 = subItem.url ? isSegmentMatch(parsedPathname2, parsedUrl2) : false;
|
|
78
|
+
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: !subItem.isSeparator ? /* @__PURE__ */ jsx(
|
|
79
|
+
SidebarMenuSubButton,
|
|
80
|
+
{
|
|
81
|
+
asChild: true,
|
|
82
|
+
size: "lg",
|
|
83
|
+
isActive: isCurrentPath2,
|
|
84
|
+
children: /* @__PURE__ */ jsxs(Link, { href: subItem.url || "", children: [
|
|
85
|
+
subItem.icon && /* @__PURE__ */ jsx(subItem.icon, {}),
|
|
86
|
+
/* @__PURE__ */ jsx("span", { children: subItem.title })
|
|
87
|
+
] })
|
|
88
|
+
}
|
|
89
|
+
) : /* @__PURE__ */ jsx(Separator, {}) }, index2);
|
|
90
|
+
}) }) })
|
|
91
|
+
] }) : null
|
|
92
|
+
] })
|
|
93
|
+
},
|
|
94
|
+
index
|
|
95
|
+
);
|
|
96
|
+
}) }) });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { NavMain };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const NAVBAR_HEIGHT = 60;
|
|
2
2
|
const SIDEBAR_WIDTH = 288;
|
|
3
3
|
const PAGE_HEADER_HEIGHT = 56;
|
|
4
|
+
const FORM_SIDE_FIELDS_WIDTH = 320;
|
|
5
|
+
const FORM_MIDDLE_GAP_WIDTH = 24;
|
|
4
6
|
|
|
5
|
-
export { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH };
|
|
7
|
+
export { FORM_MIDDLE_GAP_WIDTH, FORM_SIDE_FIELDS_WIDTH, NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT, SIDEBAR_WIDTH };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const IMAGE_EXTENSIONS = [
|
|
2
|
+
"png",
|
|
3
|
+
"jpg",
|
|
4
|
+
"jpeg",
|
|
5
|
+
"webp",
|
|
6
|
+
"gif",
|
|
7
|
+
"avif",
|
|
8
|
+
"svg",
|
|
9
|
+
"bmp",
|
|
10
|
+
"tiff"
|
|
11
|
+
];
|
|
12
|
+
const VIDEO_EXTENSIONS = [
|
|
13
|
+
"mp4",
|
|
14
|
+
"mov",
|
|
15
|
+
"webm",
|
|
16
|
+
"ogg",
|
|
17
|
+
"avi",
|
|
18
|
+
"mkv",
|
|
19
|
+
"flv",
|
|
20
|
+
"wmv",
|
|
21
|
+
"m4v",
|
|
22
|
+
"3gp",
|
|
23
|
+
"ts",
|
|
24
|
+
"mjpeg"
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export { IMAGE_EXTENSIONS, VIDEO_EXTENSIONS };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const debounce = (fn, delay = 100) => {
|
|
2
|
+
let timer;
|
|
3
|
+
const debouncedFn = (...args) => {
|
|
4
|
+
if (timer) clearTimeout(timer);
|
|
5
|
+
timer = setTimeout(() => fn(...args), delay);
|
|
6
|
+
};
|
|
7
|
+
debouncedFn.clear = () => {
|
|
8
|
+
if (timer) clearTimeout(timer);
|
|
9
|
+
timer = void 0;
|
|
10
|
+
};
|
|
11
|
+
return debouncedFn;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { debounce };
|