mtxuilib 0.0.319 → 0.0.321

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 (74) hide show
  1. package/dist/components/Header.cjs +41 -0
  2. package/dist/components/ListItem.cjs +92 -0
  3. package/dist/components/PageCmds.cjs +79 -0
  4. package/dist/components/PageSearchCmd.cjs +98 -0
  5. package/dist/components/PostCard.cjs +58 -0
  6. package/dist/components/SideNav.cjs +102 -0
  7. package/dist/components/UserAvatorMenus.cjs +105 -0
  8. package/dist/components/main-nav.cjs +176 -0
  9. package/dist/curd/CommonListView.cjs +122 -0
  10. package/dist/curd/CurdViewView.cjs +202 -0
  11. package/dist/curd/curd-detail.cjs +161 -0
  12. package/dist/esm/components/Header.d.ts +2 -0
  13. package/dist/esm/components/Header.js +17 -0
  14. package/dist/esm/components/ListItem.d.ts +6 -0
  15. package/dist/esm/components/ListItem.js +68 -0
  16. package/dist/esm/components/PageCmds.d.ts +3 -0
  17. package/dist/esm/components/PageCmds.js +57 -0
  18. package/dist/esm/components/PageSearchCmd.d.ts +2 -0
  19. package/dist/esm/components/PageSearchCmd.js +76 -0
  20. package/dist/esm/components/PostCard.d.ts +5 -0
  21. package/dist/esm/components/PostCard.js +34 -0
  22. package/dist/esm/components/SideNav.d.ts +2 -0
  23. package/dist/esm/components/SideNav.js +78 -0
  24. package/dist/esm/components/UserAvatorMenus.d.ts +2 -0
  25. package/dist/esm/components/UserAvatorMenus.js +85 -0
  26. package/dist/esm/components/main-nav.d.ts +3 -0
  27. package/dist/esm/components/main-nav.js +143 -0
  28. package/dist/esm/curd/CommonListView.d.ts +2 -0
  29. package/dist/esm/curd/CommonListView.js +88 -0
  30. package/dist/esm/curd/CurdViewView.d.ts +33 -0
  31. package/dist/esm/curd/CurdViewView.js +176 -0
  32. package/dist/esm/curd/curd-detail.d.ts +8 -0
  33. package/dist/esm/curd/curd-detail.js +137 -0
  34. package/dist/esm/hooks/use-local-storage.d.ts +2 -0
  35. package/dist/esm/hooks/use-local-storage.js +19 -0
  36. package/dist/esm/hooks/use-lock-body.d.ts +1 -0
  37. package/dist/esm/hooks/use-lock-body.js +13 -0
  38. package/dist/esm/hooks/use-media-query.d.ts +7 -0
  39. package/dist/esm/hooks/use-media-query.js +42 -0
  40. package/dist/esm/hooks/use-mounted.d.ts +1 -0
  41. package/dist/esm/hooks/use-mounted.js +11 -0
  42. package/dist/esm/hooks/use-mutation-observer.d.ts +7 -0
  43. package/dist/esm/hooks/use-mutation-observer.js +18 -0
  44. package/dist/esm/hooks/use-router.d.ts +23 -0
  45. package/dist/esm/hooks/use-router.js +69 -0
  46. package/dist/esm/hooks/useIsIntersecting.d.ts +2 -0
  47. package/dist/esm/hooks/useIsIntersecting.js +25 -0
  48. package/dist/esm/hooks/useScript.d.ts +3 -0
  49. package/dist/esm/hooks/useScript.js +71 -0
  50. package/dist/esm/store/userContext.d.ts +14 -0
  51. package/dist/esm/store/userContext.js +102 -0
  52. package/dist/esm/types/common.d.ts +13 -0
  53. package/dist/esm/types/common.js +0 -0
  54. package/dist/esm/types/index.d.js +0 -0
  55. package/dist/esm/types/page.d.js +0 -0
  56. package/dist/esm/types/process.d.js +0 -0
  57. package/dist/esm/types/types.d.ts +6 -0
  58. package/dist/esm/types/types.js +0 -0
  59. package/dist/hooks/use-local-storage.cjs +39 -0
  60. package/dist/hooks/use-lock-body.cjs +47 -0
  61. package/dist/hooks/use-media-query.cjs +82 -0
  62. package/dist/hooks/use-mounted.cjs +45 -0
  63. package/dist/hooks/use-mutation-observer.cjs +52 -0
  64. package/dist/hooks/use-router.cjs +93 -0
  65. package/dist/hooks/useIsIntersecting.cjs +59 -0
  66. package/dist/hooks/useScript.cjs +101 -0
  67. package/dist/store/userContext.cjs +139 -0
  68. package/dist/tsconfig.type.tsbuildinfo +1 -1
  69. package/dist/types/common.cjs +16 -0
  70. package/dist/types/index.d.cjs +16 -0
  71. package/dist/types/page.d.cjs +16 -0
  72. package/dist/types/process.d.cjs +1 -0
  73. package/dist/types/types.cjs +16 -0
  74. package/package.json +3 -1
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var Header_exports = {};
21
+ __export(Header_exports, {
22
+ DefaultHeader: () => DefaultHeader
23
+ });
24
+ module.exports = __toCommonJS(Header_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_mtlink = require("../common/mtlink");
27
+ var import_PageSearchCmd = require("./PageSearchCmd");
28
+ var import_main_nav = require("./main-nav");
29
+ const DefaultHeader = () => {
30
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { className: "bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 w-full border-b backdrop-blur", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex h-14 items-center", children: [
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "hidden w-52 items-center justify-center md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "/", className: "flex items-center space-x-2" }) }),
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_main_nav.MainNav, {}),
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: " flex items-center space-x-6 text-sm font-medium" }),
34
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PageSearchCmd.PageSearchCmd, {}) }),
35
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-1 shrink items-center justify-end space-x-2 pr-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: "flex items-center" }) })
36
+ ] }) }) });
37
+ };
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ DefaultHeader
41
+ });
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var ListItem_exports = {};
21
+ __export(ListItem_exports, {
22
+ ListItemView: () => ListItemView
23
+ });
24
+ module.exports = __toCommonJS(ListItem_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_path_to_regexp = require("path-to-regexp");
27
+ var import_react = require("react");
28
+ var import_mtlink = require("../common/mtlink");
29
+ var import_CurdViewView = require("../curd/CurdViewView");
30
+ var import_utils = require("../lib/utils");
31
+ var import_Button = require("../ui/ui-mt/Button");
32
+ var import_PostCard = require("./PostCard");
33
+ const ListItemView = (props) => {
34
+ var _a, _b;
35
+ const { item } = props;
36
+ if ((_a = item == null ? void 0 : item.item) == null ? void 0 : _a.value) {
37
+ const itemCase = ((_b = item.item) == null ? void 0 : _b.case) || "";
38
+ switch (itemCase) {
39
+ case "commonListItem":
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommonListItemView, { item: item.item.value });
41
+ case "postCard":
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PostCard.PostCard, { item: item.item.value });
43
+ default:
44
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "bg-red-600 p-2", children: "unknow list item type" });
45
+ }
46
+ }
47
+ return null;
48
+ };
49
+ const CommonListItemView = (props) => {
50
+ const { item } = props;
51
+ const curdView = (0, import_CurdViewView.useCurdView)();
52
+ const listView = (0, import_CurdViewView.useCurdViewList)();
53
+ const link = (0, import_react.useMemo)(() => {
54
+ const itemId = item.id;
55
+ const routeShow = curdView.item.routeShow;
56
+ const toPath = (0, import_path_to_regexp.compile)(routeShow, { encode: encodeURIComponent });
57
+ return toPath({ id: itemId });
58
+ }, [curdView.item.routeShow, item.id]);
59
+ const handleSelect = (e) => {
60
+ e.preventDefault();
61
+ e.stopPropagation();
62
+ listView.handleSelectItem(item);
63
+ };
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ import_Button.MtButton,
66
+ {
67
+ variant: "ghost",
68
+ onClick: handleSelect,
69
+ className: (0, import_utils.cn)(
70
+ "flex justify-start border p-4 text-left",
71
+ item.id == curdView.activateId && " font-bold"
72
+ ),
73
+ "aria-label": item.id,
74
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
75
+ import_mtlink.MtLink,
76
+ {
77
+ href: link,
78
+ children: [
79
+ "id:",
80
+ item.id,
81
+ item.title,
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.description })
83
+ ]
84
+ }
85
+ )
86
+ }
87
+ );
88
+ };
89
+ // Annotate the CommonJS export names for ESM import in node:
90
+ 0 && (module.exports = {
91
+ ListItemView
92
+ });
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, { get: all[name], enumerable: true });
39
+ };
40
+ var __copyProps = (to, from, except, desc) => {
41
+ if (from && typeof from === "object" || typeof from === "function") {
42
+ for (let key of __getOwnPropNames(from))
43
+ if (!__hasOwnProp.call(to, key) && key !== except)
44
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
45
+ }
46
+ return to;
47
+ };
48
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
+ var PageCmds_exports = {};
50
+ __export(PageCmds_exports, {
51
+ PageCommands: () => PageCommands
52
+ });
53
+ module.exports = __toCommonJS(PageCmds_exports);
54
+ var import_jsx_runtime = require("react/jsx-runtime");
55
+ var import_lodash = require("lodash");
56
+ var import_react = require("react");
57
+ var import_react_hotkeys_hook = require("react-hotkeys-hook");
58
+ var import_command = require("../ui/command");
59
+ function PageCommands(props) {
60
+ const etc = __objRest(props, []);
61
+ const [open, setOpen] = (0, import_react.useState)(false);
62
+ (0, import_react_hotkeys_hook.useHotkeys)("alt+d", () => {
63
+ console.log("PageCommands");
64
+ setOpen((open2) => !open2);
65
+ }, []);
66
+ const handleValueChange = (search) => {
67
+ };
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandDialog, __spreadProps(__spreadValues({}, etc), { open, onOpenChange: setOpen, children: [
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandInput, { placeholder: "Type a command or search...", onValueChange: (0, import_lodash.debounce)(handleValueChange, 500) }),
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandList, { children: [
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandEmpty, { children: "No results found." }),
72
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandSeparator, {})
73
+ ] })
74
+ ] }));
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ PageCommands
79
+ });
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var PageSearchCmd_exports = {};
38
+ __export(PageSearchCmd_exports, {
39
+ PageSearchCmd: () => PageSearchCmd
40
+ });
41
+ module.exports = __toCommonJS(PageSearchCmd_exports);
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var import_react = require("react");
44
+ var import_react_hook_form = require("react-hook-form");
45
+ var import_react_hotkeys_hook = require("react-hotkeys-hook");
46
+ var import_icons = require("../icons/icons");
47
+ var import_command = require("../ui/command");
48
+ var import_input = require("../ui/input");
49
+ var import_Button = require("../ui/ui-mt/Button");
50
+ var import_MtForm = require("../ui/ui-mt/MtForm");
51
+ const PageSearchCmd = () => {
52
+ const [open, setOpen] = (0, import_react.useState)(false);
53
+ const [isShowSearchInput, setIsShowSearchInput] = (0, import_react.useState)(true);
54
+ (0, import_react_hotkeys_hook.useHotkeys)("alt+s", () => {
55
+ console.log("PageCommands");
56
+ setOpen((open2) => !open2);
57
+ }, []);
58
+ const form = (0, import_react_hook_form.useForm)();
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_MtForm.MtForm, __spreadProps(__spreadValues({}, form), { children: [
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { onSubmit: form.handleSubmit(
61
+ // curd.submitSearch
62
+ () => {
63
+ }
64
+ ), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative flex w-full flex-wrap items-stretch", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex", children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
+ import_input.Input,
67
+ __spreadProps(__spreadValues({
68
+ placeholder: "search"
69
+ }, form.register("q")), {
70
+ "aria-label": "Search",
71
+ "aria-describedby": "button-addon1",
72
+ type: "search",
73
+ className: " focus:border-primary dark:focus:border-primary relative m-0 -mr-0.5 block h-auto min-w-0 flex-auto rounded-l border border-solid border-neutral-300 bg-transparent bg-clip-padding px-3 py-1 text-base font-normal leading-[1.6] text-neutral-700 outline-none transition duration-200 ease-in-out focus:z-[3] focus:text-neutral-700 focus:shadow-[inset_0_0_0_1px_rgb(59,113,202)] focus:outline-none dark:border-neutral-600 dark:text-neutral-200 dark:placeholder:text-neutral-200"
74
+ })
75
+ ),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
77
+ import_Button.MtButton,
78
+ {
79
+ className: " rounded-l-0",
80
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icons.search, {})
81
+ }
82
+ )
83
+ ] }) }) }),
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandDialog, { open, onOpenChange: setOpen, children: [
85
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandInput, { placeholder: "Type a command or search...", onValueChange: (s) => {
86
+ setOpen(false);
87
+ } }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandList, { children: [
89
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandEmpty, { children: "No results found." }),
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandSeparator, {})
91
+ ] })
92
+ ] })
93
+ ] }));
94
+ };
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ PageSearchCmd
98
+ });
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var PostCard_exports = {};
21
+ __export(PostCard_exports, {
22
+ PostCard: () => PostCard
23
+ });
24
+ module.exports = __toCommonJS(PostCard_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_mtlink = require("../common/mtlink");
27
+ var import_card = require("../ui/card");
28
+ const PostCard = (props) => {
29
+ const { item } = props;
30
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { className: "w-[350px]", children: [
31
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardHeader, { children: [
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardTitle, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: `/post/${item.id}`, className: "pb-4 text-3xl font-bold hover:text-gray-700", children: item == null ? void 0 : item.title }) }),
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardDescription, { children: "Deploy your new project in one-click." })
34
+ ] }),
35
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { className: "my-4 flex flex-col", children: [
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, {
37
+ href: `/post/${item.id}`,
38
+ className: "hover:opacity-75",
39
+ // eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
40
+ children: item.topImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: item.topImage, alt: item.title })
41
+ }),
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col justify-start bg-white p-6", children: [
43
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: `/post/${item.id}`, className: "pb-4 text-sm font-bold uppercase text-blue-700", children: item.category || "news" }),
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "pb-3 text-sm", children: [
45
+ "By ",
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "#", children: item.author }),
47
+ ","
48
+ ] }),
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: item.excerpt })
50
+ ] })
51
+ ] }) }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_card.CardFooter, { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { variant: "ghost", href: `/post/${item.id}`, children: "Show" }) })
53
+ ] });
54
+ };
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ PostCard
58
+ });
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var SideNav_exports = {};
21
+ __export(SideNav_exports, {
22
+ SideNavs: () => SideNavs
23
+ });
24
+ module.exports = __toCommonJS(SideNav_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react_avatar = require("@radix-ui/react-avatar");
27
+ var import_react_collapsible = require("@radix-ui/react-collapsible");
28
+ var import_react_icons = require("@radix-ui/react-icons");
29
+ var import_lucide_react = require("lucide-react");
30
+ var import_command = require("../ui/command");
31
+ var import_hover_card = require("../ui/hover-card");
32
+ var import_Button = require("../ui/ui-mt/Button");
33
+ const SideNavs = () => {
34
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.Command, { className: "", children: [
35
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandInput, { placeholder: "Type a command or search...", className: "bg-red-100 p-1" }),
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandList, { className: "flex h-full max-h-full flex-col rounded-lg", children: [
37
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandEmpty, { children: "No results found." }),
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandGroup, { heading: "\u6A21\u5757", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandItem, { children: [
39
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.FaceIcon, { className: "mr-2 h-4 w-4" }),
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Search Emoji" })
41
+ ] }) }),
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandSeparator, {}),
43
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandGroup, { heading: "Settings", className: " justify-end ", children: [
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandItem, { children: [
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.PersonIcon, { className: "mr-2 h-4 w-4" }),
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Profile" }),
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandShortcut, { children: "\u2318P" })
48
+ ] }),
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandItem, { children: [
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.EnvelopeClosedIcon, { className: "mr-2 h-4 w-4" }),
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Mail" }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandShortcut, { children: "\u2318B" })
53
+ ] }),
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
55
+ import_react_collapsible.Collapsible,
56
+ {
57
+ className: "w-full space-y-2",
58
+ children: [
59
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between space-x-4 ", children: [
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "text-sm font-semibold", children: "\u5206\u7C7B1" }),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_collapsible.CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Button.MtButton, { variant: "ghost", size: "sm", className: "w-9 p-0", children: [
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronsUpDown, { className: "h-4 w-4" }),
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Toggle" })
64
+ ] }) })
65
+ ] }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_collapsible.CollapsibleContent, { className: "space-y-2", children: [
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "rounded-md border px-4 py-3 font-mono text-sm", children: "@radix-ui/colors" }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "rounded-md border px-4 py-3 font-mono text-sm", children: "@stitches/react" })
69
+ ] })
70
+ ]
71
+ }
72
+ ) }),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_command.CommandItem, { children: [
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.GearIcon, { className: "mr-2 h-4 w-4" }),
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_hover_card.HoverCard, { children: [
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_hover_card.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.MtButton, { variant: "link", children: "\u4E2D\u6587nextjs" }) }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_hover_card.HoverCardContent, { className: "w-80", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between space-x-4", children: [
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_avatar.Avatar, { children: [
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_avatar.AvatarImage, { src: "https://github.com/vercel.png" }),
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_avatar.AvatarFallback, { children: "VC" })
81
+ ] }),
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1", children: [
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { className: "text-sm font-semibold", children: "@nextjs" }),
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm", children: "The React Framework \u2013 created and maintained by @vercel." }),
85
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center pt-2", children: [
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4 opacity-70" }),
87
+ " ",
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground text-xs", children: "Joined December 2021" })
89
+ ] })
90
+ ] })
91
+ ] }) })
92
+ ] }),
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_command.CommandShortcut, { children: "\u2318S" })
94
+ ] })
95
+ ] }) })
96
+ ] })
97
+ ] }) });
98
+ };
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {
101
+ SideNavs
102
+ });
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var UserAvatorMenus_exports = {};
21
+ __export(UserAvatorMenus_exports, {
22
+ default: () => UserAvatorMenus
23
+ });
24
+ module.exports = __toCommonJS(UserAvatorMenus_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_lucide_react = require("lucide-react");
27
+ var import_next_themes = require("next-themes");
28
+ var import_navigation = require("next/navigation");
29
+ var import_mtlink = require("../common/mtlink");
30
+ var import_userContext = require("../store/userContext");
31
+ var import_avatar = require("../ui/avatar");
32
+ var import_button = require("../ui/button");
33
+ var import_dropdown_menu = require("../ui/dropdown-menu");
34
+ function UserAvatorMenus() {
35
+ var _a;
36
+ const pathName = (0, import_navigation.usePathname)();
37
+ const { setTheme } = (0, import_next_themes.useTheme)();
38
+ const { userInfo } = (0, import_userContext.useUser)();
39
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: !((_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.ID.length) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: `/login?back=${pathName}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { children: "login" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenu, { children: [
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_avatar.Avatar, { children: [
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_avatar.AvatarImage, { src: "https://github.com/shadcn.png", alt: "@siteCook" }),
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_avatar.AvatarFallback, { children: "You" })
43
+ ] }) }),
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuContent, { className: "w-56", children: [
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuLabel, { children: "My Account" }),
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSeparator, {}),
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuGroup, { children: [
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "/profile", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuItem, { children: [
49
+ "Profile",
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuShortcut, { children: "\u21E7\u2318P" })
51
+ ] }) }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuItem, { children: [
53
+ "Settings",
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuShortcut, { children: "\u2318S" })
55
+ ] }),
56
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "/admin/site", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuItem, { children: [
57
+ "Site",
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuShortcut, { children: "\u2318S" })
59
+ ] }) })
60
+ ] }),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSeparator, {}),
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuSub, { children: [
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSubTrigger, { children: "Cx" }),
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuSubContent, { children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "/admin/cx/config", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { children: "config" }) }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "/admin/cx/result", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { children: "result" }) }),
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSeparator, {})
68
+ ] }) })
69
+ ] }) }),
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuSub, { children: [
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSubTrigger, { children: "Blog" }),
72
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSubContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSeparator, {}) }) })
73
+ ] }) }),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuSub, { children: [
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuSubTrigger, { children: [
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.SunIcon, { className: "size-[1.2rem] rotate-0 scale-100 pr-1 transition-all dark:-rotate-90 dark:scale-0" }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MoonIcon, { className: "absolute size-[1.2rem] rotate-90 scale-0 pr-1 transition-all dark:rotate-0 dark:scale-100" }),
78
+ "theme",
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Toggle theme" })
80
+ ] }),
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuSubContent, { children: [
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { onClick: () => setTheme("light"), children: "Light" }),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { onClick: () => setTheme("dark"), children: "Dark" }),
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuItem, { onClick: () => setTheme("system"), children: "System" })
85
+ ] }) })
86
+ ] }) }),
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuSeparator, {}),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mtlink.MtLink, { href: "/logout", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuItem, { children: [
89
+ "Log out",
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuShortcut, { children: "\u21E7\u2318Q" })
91
+ ] }) }),
92
+ userInfo == null ? void 0 : userInfo.navs.map((item, i) => {
93
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuItem, { children: [
94
+ "userNav: ",
95
+ item.label,
96
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuShortcut, { children: "\u21E7\u2318Q" })
97
+ ] }, i);
98
+ }),
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dropdown_menu.DropdownMenuItem, { children: [
100
+ "Log out",
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dropdown_menu.DropdownMenuShortcut, { children: "\u21E7\u2318Q" })
102
+ ] })
103
+ ] })
104
+ ] }) });
105
+ }