gomtm 0.0.162 → 0.0.164

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 (90) hide show
  1. package/dist/esm/components/ListItem.d.ts +6 -0
  2. package/dist/esm/components/ListItem.js +49 -0
  3. package/dist/esm/components/auth/AuthPage.d.ts +2 -0
  4. package/dist/esm/components/auth/AuthPage.js +36 -0
  5. package/dist/esm/components/auth/LoginScreen2.d.ts +2 -0
  6. package/dist/esm/components/auth/LoginScreen2.js +106 -0
  7. package/dist/esm/components/auth/UserAuthForm.d.ts +6 -0
  8. package/dist/esm/components/auth/UserAuthForm.js +76 -0
  9. package/dist/esm/components/blog/BlogPostActions.d.ts +4 -0
  10. package/dist/esm/components/blog/BlogPostActions.js +34 -0
  11. package/dist/esm/components/blog/BlogPostCreateForm.d.ts +2 -0
  12. package/dist/esm/components/blog/BlogPostCreateForm.js +27 -0
  13. package/dist/esm/components/blog/BlogPostImportDlgUrl.d.ts +6 -0
  14. package/dist/esm/components/blog/BlogPostImportDlgUrl.js +94 -0
  15. package/dist/esm/components/blog/PostCard.d.ts +5 -0
  16. package/dist/esm/components/blog/PostCard.js +38 -0
  17. package/dist/esm/components/blog/PostEditForm.d.ts +2 -0
  18. package/dist/esm/components/blog/PostEditForm.js +91 -0
  19. package/dist/esm/components/blog/post-content.d.ts +5 -0
  20. package/dist/esm/components/blog/post-content.js +15 -0
  21. package/dist/esm/components/blog/post.atoms.d.ts +11 -0
  22. package/dist/esm/components/blog/post.atoms.js +9 -0
  23. package/dist/esm/curd/CommonListViewV2.d.ts +4 -3
  24. package/dist/esm/curd/CommonListViewV2.js +6 -6
  25. package/dist/esm/curd/CreateFormV2.d.ts +2 -3
  26. package/dist/esm/curd/CreateFormV2.js +1 -1
  27. package/dist/esm/curd/CurdViewView.d.ts +2 -2
  28. package/dist/esm/curd/CurdViewView.js +3 -6
  29. package/dist/esm/gomtm-clients-ss.d.ts +6 -0
  30. package/dist/esm/gomtm-clients-ss.js +9 -3
  31. package/dist/esm/gomtmpb/mtm/sppb/mtm_pb.d.ts +5 -9
  32. package/dist/esm/gomtmpb/mtm/sppb/mtm_pb.js +20 -63
  33. package/dist/esm/hooks/useAuth.d.ts +5 -0
  34. package/dist/esm/hooks/useAuth.js +43 -0
  35. package/dist/esm/lib/auth/jwt.d.ts +7 -0
  36. package/dist/esm/lib/auth/jwt.js +43 -0
  37. package/dist/esm/ly/DashLayout.d.ts +2 -0
  38. package/dist/esm/ly/DashLayout.js +39 -0
  39. package/dist/esm/ly/UserAvatorMenus.d.ts +2 -0
  40. package/dist/esm/ly/UserAvatorMenus.js +63 -0
  41. package/dist/esm/ly/dash5/aside.d.ts +2 -0
  42. package/dist/esm/ly/dash5/aside.js +40 -0
  43. package/dist/esm/ly/dash5/components/PageCreate.d.ts +4 -0
  44. package/dist/esm/ly/dash5/components/PageCreate.js +8 -0
  45. package/dist/esm/ly/dash5/components/PageEdit.d.ts +4 -0
  46. package/dist/esm/ly/dash5/components/PageEdit.js +8 -0
  47. package/dist/esm/ly/dash5/components/PageList.d.ts +4 -0
  48. package/dist/esm/ly/dash5/components/PageList.js +9 -0
  49. package/dist/esm/ly/dash5/components/PageShow.d.ts +4 -0
  50. package/dist/esm/ly/dash5/components/PageShow.js +8 -0
  51. package/dist/esm/ly/dash5/header.d.ts +2 -0
  52. package/dist/esm/ly/dash5/header.js +123 -0
  53. package/dist/esm/ly/dash5/index.d.ts +2 -0
  54. package/dist/esm/ly/dash5/index.js +21 -0
  55. package/dist/esm/ly/front-layout/PageCmds.d.ts +2 -0
  56. package/dist/esm/ly/front-layout/PageCmds.js +25 -0
  57. package/dist/esm/ly/front-layout/PageSearchCmd.d.ts +2 -0
  58. package/dist/esm/ly/front-layout/PageSearchCmd.js +63 -0
  59. package/dist/esm/ly/front-layout/header.d.ts +2 -0
  60. package/dist/esm/ly/front-layout/header.js +18 -0
  61. package/dist/esm/ly/front-layout/index.d.ts +2 -0
  62. package/dist/esm/ly/front-layout/index.js +13 -0
  63. package/dist/esm/ly/front-layout/main-nav.d.ts +3 -0
  64. package/dist/esm/ly/front-layout/main-nav.js +116 -0
  65. package/dist/esm/mtmFetcher.d.ts +0 -13
  66. package/dist/esm/mtmFetcher.js +1 -148
  67. package/dist/esm/mtmcore.d.ts +0 -5
  68. package/dist/esm/mtmcore.js +0 -19
  69. package/dist/esm/mtmquery.d.ts +0 -6
  70. package/dist/esm/mtmquery.js +1 -64
  71. package/dist/esm/providers/GomtmAppSS.d.ts +1 -0
  72. package/dist/esm/providers/GomtmAppSS.js +23 -11
  73. package/dist/esm/providers/GomtmProvider.d.ts +1 -3
  74. package/dist/esm/providers/GomtmProvider.js +7 -30
  75. package/dist/esm/providers/MtConnectProvider.js +3 -8
  76. package/dist/esm/providers/logger.context.d.ts +4 -0
  77. package/dist/esm/sscore.d.ts +0 -3
  78. package/dist/esm/sscore.js +2 -34
  79. package/dist/esm/store/CurdListViewV3.d.ts +13 -0
  80. package/dist/esm/store/CurdListViewV3.js +78 -0
  81. package/dist/esm/store/ExampleStoreProvider.d.ts +6 -0
  82. package/dist/esm/store/ExampleStoreProvider.js +43 -0
  83. package/dist/esm/store/GomtmBackendProvider.d.ts +12 -0
  84. package/dist/esm/store/GomtmBackendProvider.js +49 -0
  85. package/dist/esm/validations/env.d.ts +2 -2
  86. package/dist/esm/validations/spContentModi.d.ts +8 -8
  87. package/dist/esm/validations/spRoute.d.ts +8 -8
  88. package/dist/gomtm +0 -0
  89. package/dist/tsconfig.type.tsbuildinfo +1 -1
  90. package/package.json +119 -7
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { PlainMessage } from "@bufbuild/protobuf";
3
+ import { ListItem } from "../gomtmpb/mtm/sppb/mtm_pb";
4
+ export declare const ListItemView: (props: {
5
+ item: PlainMessage<ListItem>;
6
+ }) => import("react").JSX.Element | null;
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { MtLink } from "mtxuilib/common/mtlink";
4
+ import { cn } from "mtxuilib/lib/utils";
5
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
6
+ import { useCurdView } from "../curd/CurdViewView";
7
+ import { PostCard } from "./blog/PostCard";
8
+ const ListItemView = (props) => {
9
+ var _a, _b;
10
+ const { item } = props;
11
+ if ((_a = item == null ? void 0 : item.item) == null ? void 0 : _a.value) {
12
+ const itemCase = ((_b = item.item) == null ? void 0 : _b.case) || "";
13
+ switch (itemCase) {
14
+ case "commonListItem":
15
+ return /* @__PURE__ */ jsx(CommonListItemView, { item: item.item.value });
16
+ case "postCard":
17
+ return /* @__PURE__ */ jsx(PostCard, { item: item.item.value });
18
+ default:
19
+ return /* @__PURE__ */ jsx("span", { className: "bg-red-600 p-2", children: "unknow list item type" });
20
+ }
21
+ }
22
+ return null;
23
+ };
24
+ const CommonListItemView = (props) => {
25
+ const { item } = props;
26
+ const curd = useCurdView();
27
+ const handleSelect = () => {
28
+ curd.openShow(item.id);
29
+ };
30
+ return /* @__PURE__ */ jsx(
31
+ MtButton,
32
+ {
33
+ variant: "ghost",
34
+ onClick: handleSelect,
35
+ className: cn(
36
+ "flex min-h-16 justify-start border p-4 text-left",
37
+ item.id == curd.activateId && " font-bold"
38
+ ),
39
+ "aria-label": item.id,
40
+ children: /* @__PURE__ */ jsxs(MtLink, { href: curd.showLink(item.id), children: [
41
+ item.title || item.id,
42
+ item.description && /* @__PURE__ */ jsx("div", { children: item.description })
43
+ ] })
44
+ }
45
+ );
46
+ };
47
+ export {
48
+ ListItemView
49
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function AuthPage(): import("react").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { ChevronLeft } from "lucide-react";
4
+ import { MtLink } from "mtxuilib/common/mtlink";
5
+ import { Icons } from "mtxuilib/icons/icons";
6
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
7
+ import { LoginScreen2 } from "./LoginScreen2";
8
+ import { UserAuthForm } from "./UserAuthForm";
9
+ function AuthPage() {
10
+ return /* @__PURE__ */ jsxs("div", { className: "size-screen container flex flex-col items-center justify-center", children: [
11
+ /* @__PURE__ */ jsx("div", { className: "absolute left-4 top-4 focus:z-10 focus:outline-none md:left-8 md:top-8", children: /* @__PURE__ */ jsx(MtLink, { href: "/", children: /* @__PURE__ */ jsx(MtButton, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "mr-2 size-4" }),
13
+ "Back"
14
+ ] }) }) }) }),
15
+ /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]", children: [
16
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2 text-center", children: [
17
+ /* @__PURE__ */ jsx(Icons.logo, { color: "white", className: "mx-auto size-12" }),
18
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold ", children: "Welcome back" }),
19
+ /* @__PURE__ */ jsx("p", { className: "text-sm ", children: "Sign in with Github to login" })
20
+ ] }),
21
+ /* @__PURE__ */ jsx(UserAuthForm, {}),
22
+ /* @__PURE__ */ jsx(LoginScreen2, {}),
23
+ /* @__PURE__ */ jsx("p", { className: "px-8 text-center text-sm ", children: /* @__PURE__ */ jsx(
24
+ MtLink,
25
+ {
26
+ href: "/register",
27
+ className: "hover:text-brand underline",
28
+ children: "Don't have an account? Sign Up"
29
+ }
30
+ ) })
31
+ ] })
32
+ ] });
33
+ }
34
+ export {
35
+ AuthPage
36
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function LoginScreen2(): import("react").JSX.Element;
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ var __async = (__this, __arguments, generator) => {
19
+ return new Promise((resolve, reject) => {
20
+ var fulfilled = (value) => {
21
+ try {
22
+ step(generator.next(value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ };
27
+ var rejected = (value) => {
28
+ try {
29
+ step(generator.throw(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
+ step((generator = generator.apply(__this, __arguments)).next());
36
+ });
37
+ };
38
+ import { jsx, jsxs } from "react/jsx-runtime";
39
+ import { MtLink } from "mtxuilib/common/mtlink";
40
+ import { ZForm, useZodForm } from "mtxuilib/form/ZodForm";
41
+ import { Input } from "mtxuilib/ui/input";
42
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
43
+ import { useRouter, useSearchParams } from "next/navigation";
44
+ import { AuthLoginInput } from "../../validations/auth";
45
+ function LoginScreen2() {
46
+ const form = useZodForm({
47
+ schema: AuthLoginInput,
48
+ defaultValues: {}
49
+ });
50
+ const searchParams = useSearchParams();
51
+ const router = useRouter();
52
+ const handleSubmit = (values) => __async(this, null, function* () {
53
+ const res = yield fetch("/api.v1/auth/login", {
54
+ method: "POST",
55
+ body: JSON.stringify(values)
56
+ });
57
+ const { success } = yield res.json();
58
+ if (success) {
59
+ const nextUrl = searchParams.get("next");
60
+ router.push(nextUrl != null ? nextUrl : "/");
61
+ router.refresh();
62
+ } else {
63
+ alert("Login failed");
64
+ }
65
+ });
66
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-md", children: [
67
+ /* @__PURE__ */ jsx("div", { className: "prose", children: "Sign in" }),
68
+ /* @__PURE__ */ jsxs("div", { className: "prose text-sm", children: [
69
+ "New to company?",
70
+ " ",
71
+ /* @__PURE__ */ jsx(MtLink, { href: "#replace-with-a-link", children: "Sign up!" })
72
+ ] }),
73
+ /* @__PURE__ */ jsx(
74
+ MtButton,
75
+ {
76
+ variant: "ghost",
77
+ className: "bg-opacity/0.8 w-full bg-neutral-50",
78
+ children: "Continue with Google"
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsxs(
82
+ ZForm,
83
+ {
84
+ form,
85
+ className: "space-y-2",
86
+ handleSubmit,
87
+ children: [
88
+ /* @__PURE__ */ jsx(
89
+ Input,
90
+ __spreadValues({}, form.register("username"))
91
+ ),
92
+ /* @__PURE__ */ jsx(Input, __spreadValues({ type: "password" }, form.register("password"))),
93
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between" }),
94
+ /* @__PURE__ */ jsx(MtButton, { type: "submit", className: "w-full", children: "Sign in" })
95
+ ]
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx("footer", { className: "py-3", children: /* @__PURE__ */ jsxs("div", { className: "prose text-center", children: [
99
+ "\xA9 Mtm ltd. ",
100
+ (/* @__PURE__ */ new Date()).getFullYear()
101
+ ] }) })
102
+ ] });
103
+ }
104
+ export {
105
+ LoginScreen2
106
+ };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react/experimental" />
2
+ import * as React from "react";
3
+ interface UserAuthFormProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ }
5
+ export declare function UserAuthForm({ className, ...props }: UserAuthFormProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+ import { jsx, jsxs } from "react/jsx-runtime";
34
+ import { cn } from "mtxuilib/lib/utils";
35
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
36
+ function UserAuthForm(_a) {
37
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
38
+ return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: cn("grid gap-6", className) }, props), { children: [
39
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
40
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ jsx("div", { className: "w-full border-t " }) }),
41
+ /* @__PURE__ */ jsx("div", { className: "relative flex justify-center text-xs uppercase", children: /* @__PURE__ */ jsx("span", { className: "bg-appbg px-2 ", children: "Continue with" }) })
42
+ ] }),
43
+ /* @__PURE__ */ jsxs(
44
+ MtButton,
45
+ {
46
+ type: "button",
47
+ children: [
48
+ /* @__PURE__ */ jsx(
49
+ "svg",
50
+ {
51
+ className: "mr-2 size-4",
52
+ "aria-hidden": "true",
53
+ focusable: "false",
54
+ "data-prefix": "fab",
55
+ "data-icon": "github",
56
+ role: "img",
57
+ xmlns: "http://www.w3.org/2000/svg",
58
+ viewBox: "0 0 496 512",
59
+ children: /* @__PURE__ */ jsx(
60
+ "path",
61
+ {
62
+ fill: "currentColor",
63
+ d: "M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"
64
+ }
65
+ )
66
+ }
67
+ ),
68
+ "Github"
69
+ ]
70
+ }
71
+ )
72
+ ] }));
73
+ }
74
+ export {
75
+ UserAuthForm
76
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const BlogPostItemActions: (props: {
3
+ postId: string;
4
+ }) => import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Icons } from "mtxuilib/icons/icons";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
5
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
6
+ import { DropdownMenuItemLink } from "mtxuilib/ui/ui-mt/DropdownMenuItemLink";
7
+ const BlogPostItemActions = (props) => {
8
+ const { postId } = props;
9
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
10
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
11
+ MtButton,
12
+ {
13
+ variant: "ghost",
14
+ className: "data-[state=open]:bg-muted flex size-8 p-0",
15
+ children: [
16
+ /* @__PURE__ */ jsx(Icons.chevronRight, { className: "size-4" }),
17
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Open menu" })
18
+ ]
19
+ }
20
+ ) }),
21
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[160px]", children: [
22
+ /* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `/post/${postId}/edit`, children: "Edit" }),
23
+ /* @__PURE__ */ jsx(DropdownMenuItemLink, { href: `/post/${postId}/create`, children: "create" }),
24
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
25
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
26
+ "Delete",
27
+ /* @__PURE__ */ jsx(DropdownMenuShortcut, { children: "\u2318\u232B" })
28
+ ] })
29
+ ] })
30
+ ] });
31
+ };
32
+ export {
33
+ BlogPostItemActions
34
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const BlogPostCreateForm: () => import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ import { Fragment, jsx } from "react/jsx-runtime";
19
+ import { InputField } from "mtxuilib/ui/ui-mt/input-field/InputField";
20
+ import { useFormContext } from "react-hook-form";
21
+ const BlogPostCreateForm = () => {
22
+ const form = useFormContext();
23
+ return /* @__PURE__ */ jsx(Fragment, { children: form && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InputField, __spreadValues({ label: "title" }, form.register("title"))) }) });
24
+ };
25
+ export {
26
+ BlogPostCreateForm
27
+ };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare function BlogPostImportUrlFormDlg(): import("react").JSX.Element;
3
+ export declare function BlogPostImportUrlForm(props: {
4
+ onCancel?: () => void;
5
+ onSubmit?: (values: any) => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
42
+ import { EditFormToolbar } from "mtxuilib/form/EditFormToolbar";
43
+ import { Dialog, DialogContent } from "mtxuilib/ui/dialog";
44
+ import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "mtxuilib/ui/form";
45
+ import { Input } from "mtxuilib/ui/input";
46
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
47
+ import { useState } from "react";
48
+ import { useForm } from "react-hook-form";
49
+ function BlogPostImportUrlFormDlg() {
50
+ const [open, setOpen] = useState(false);
51
+ const handleSubmit = (values) => __async(this, null, function* () {
52
+ setOpen(false);
53
+ });
54
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
55
+ /* @__PURE__ */ jsx(MtButton, { variant: "outline", onClick: () => {
56
+ setOpen(true);
57
+ }, children: "Import from url" }),
58
+ /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(
59
+ BlogPostImportUrlForm,
60
+ {
61
+ onCancel: () => {
62
+ setOpen(false);
63
+ },
64
+ onSubmit: handleSubmit
65
+ }
66
+ ) }) })
67
+ ] });
68
+ }
69
+ function BlogPostImportUrlForm(props) {
70
+ const { onCancel, onSubmit } = props;
71
+ const form = useForm();
72
+ return /* @__PURE__ */ jsx(Form, __spreadProps(__spreadValues({}, form), { children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit((values) => {
73
+ onSubmit && onSubmit(values);
74
+ }), className: "flex w-full flex-col p-1", children: [
75
+ /* @__PURE__ */ jsx(
76
+ FormField,
77
+ {
78
+ control: form.control,
79
+ name: "url",
80
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
81
+ /* @__PURE__ */ jsx(FormLabel, { children: "Url" }),
82
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, __spreadValues({ placeholder: "url" }, field)) }),
83
+ /* @__PURE__ */ jsx(FormDescription, { children: "\u8F93\u5165url\uFF0C \u5BFC\u5165\u7A0B\u5E8F\u5C06\u4ECE\u8FD9\u4E2A\u9875\u9762\u5C1D\u8BD5\u5BFC\u5165\u6587\u7AE0" }),
84
+ /* @__PURE__ */ jsx(FormMessage, {})
85
+ ] })
86
+ }
87
+ ),
88
+ /* @__PURE__ */ jsx(EditFormToolbar, { submitText: "ok", onCancel })
89
+ ] }) }));
90
+ }
91
+ export {
92
+ BlogPostImportUrlForm,
93
+ BlogPostImportUrlFormDlg
94
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { PostCardItem } from "../../gomtmpb/mtm/sppb/mtm_pb";
3
+ export declare const PostCard: (props: {
4
+ item: PostCardItem;
5
+ }) => import("react").JSX.Element;
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { MtLink } from "mtxuilib/common/mtlink";
4
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
5
+ import { BlogPostItemActions } from "./BlogPostActions";
6
+ const PostCard = (props) => {
7
+ const { item } = props;
8
+ return /* @__PURE__ */ jsxs(Card, { className: "w-[350px]", children: [
9
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
10
+ /* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(MtLink, { href: `/post/${item.id}`, className: "pb-4 text-3xl font-bold hover:text-gray-700", children: item == null ? void 0 : item.title }) }),
11
+ /* @__PURE__ */ jsx(CardDescription, { children: "Deploy your new project in one-click." })
12
+ ] }),
13
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("article", { className: "my-4 flex flex-col", children: [
14
+ /* @__PURE__ */ jsx(MtLink, {
15
+ href: `/post/${item.id}`,
16
+ className: "hover:opacity-75",
17
+ // eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
18
+ children: item.topImage && /* @__PURE__ */ jsx("img", { src: item.topImage, alt: item.title })
19
+ }),
20
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-start bg-white p-6", children: [
21
+ /* @__PURE__ */ jsx(MtLink, { href: `/post/${item.id}`, className: "pb-4 text-sm font-bold uppercase text-blue-700", children: item.category || "news" }),
22
+ /* @__PURE__ */ jsxs("p", { className: "pb-3 text-sm", children: [
23
+ "By ",
24
+ /* @__PURE__ */ jsx(MtLink, { href: "#", children: item.author }),
25
+ ","
26
+ ] }),
27
+ /* @__PURE__ */ jsx("div", { children: item.excerpt })
28
+ ] })
29
+ ] }) }),
30
+ /* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-end", children: [
31
+ /* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: `/post/${item.id}`, children: "Show" }),
32
+ /* @__PURE__ */ jsx(BlogPostItemActions, { postId: item.id })
33
+ ] })
34
+ ] });
35
+ };
36
+ export {
37
+ PostCard
38
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function PostEditForm(): import("react").JSX.Element;
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "mtxuilib/ui/form";
20
+ import { Input } from "mtxuilib/ui/input";
21
+ import { Separator } from "mtxuilib/ui/separator";
22
+ import { Switch } from "mtxuilib/ui/switch";
23
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "mtxuilib/ui/tabs";
24
+ import { RichTextInput } from "mtxuilib/ui/ui-mt/input-field/RichEditorInput";
25
+ import { useFormContext } from "react-hook-form";
26
+ function PostEditForm() {
27
+ const form = useFormContext();
28
+ return /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: "edit", children: [
29
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center px-4 py-2", children: [
30
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-bold", children: "edit post" }),
31
+ /* @__PURE__ */ jsxs(TabsList, { className: "ml-auto", children: [
32
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "edit", className: "text-zinc-600 dark:text-zinc-200", children: "\u7F16\u8F91" }),
33
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "op", className: "text-zinc-600 dark:text-zinc-200", children: "\u64CD\u4F5C" })
34
+ ] })
35
+ ] }),
36
+ /* @__PURE__ */ jsx(Separator, {}),
37
+ /* @__PURE__ */ jsxs(TabsContent, { value: "edit", className: "m-0", children: [
38
+ /* @__PURE__ */ jsx("input", __spreadValues({ type: "hidden" }, form.register("id", { valueAsNumber: true }))),
39
+ /* @__PURE__ */ jsx(
40
+ FormField,
41
+ {
42
+ control: form.control,
43
+ name: "title",
44
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
45
+ /* @__PURE__ */ jsx(FormLabel, { children: "\u6807\u9898" }),
46
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, __spreadValues({ placeholder: "title" }, field)) }),
47
+ /* @__PURE__ */ jsx(FormMessage, {})
48
+ ] })
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsx("div", { className: "container mx-auto flex items-center justify-center py-2", children: /* @__PURE__ */ jsx(RichTextInput, __spreadValues({ contentType: "html" }, form.register("content"))) })
52
+ ] }),
53
+ /* @__PURE__ */ jsx(TabsContent, { value: "op", className: "m-0", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
54
+ /* @__PURE__ */ jsx(
55
+ FormField,
56
+ {
57
+ control: form.control,
58
+ name: "slugs",
59
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
60
+ /* @__PURE__ */ jsx(FormLabel, { children: "slugs" }),
61
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, __spreadValues({ placeholder: "slugs" }, field)) }),
62
+ /* @__PURE__ */ jsx(FormMessage, {})
63
+ ] })
64
+ }
65
+ ),
66
+ /* @__PURE__ */ jsx(
67
+ FormField,
68
+ {
69
+ control: form.control,
70
+ name: "isManual",
71
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm", children: [
72
+ /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
73
+ /* @__PURE__ */ jsx(FormLabel, { children: "isManual" }),
74
+ /* @__PURE__ */ jsx(FormDescription, { children: "\u624B\u5DE5\u7F16\u8F91\u6807\u8BB0" })
75
+ ] }),
76
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
77
+ Switch,
78
+ {
79
+ checked: field.value,
80
+ onCheckedChange: field.onChange
81
+ }
82
+ ) })
83
+ ] })
84
+ }
85
+ )
86
+ ] }) })
87
+ ] }) });
88
+ }
89
+ export {
90
+ PostEditForm
91
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { BlogPost } from "../../gomtmpb/mtm/sppb/mtm_pb";
3
+ export declare const BlogPostContent: (props: {
4
+ post: BlogPost;
5
+ }) => import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { MtImage } from "mtxuilib/common/MtImage";
4
+ import { ImageNoExist } from "../../consts";
5
+ const BlogPostContent = (props) => {
6
+ const { post } = props;
7
+ return /* @__PURE__ */ jsxs("article", { className: "prose dark:prose-invert p-2", children: [
8
+ /* @__PURE__ */ jsx("h1", { className: "mt-6", children: post.title }),
9
+ /* @__PURE__ */ jsx("section", { children: /* @__PURE__ */ jsx(MtImage, { src: post.topImage || ImageNoExist, alt: post.title, width: 100, height: 100 }) }),
10
+ /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: post.content } })
11
+ ] });
12
+ };
13
+ export {
14
+ BlogPostContent
15
+ };
@@ -0,0 +1,11 @@
1
+ import { PlainMessage } from "@bufbuild/protobuf";
2
+ import { BlogPost, BlogPostGetReq } from "../../gomtmpb/mtm/sppb/mtm_pb";
3
+ export declare const postDetailAtom: import("jotai").PrimitiveAtom<PlainMessage<BlogPost> | null> & {
4
+ init: PlainMessage<BlogPost> | null;
5
+ };
6
+ export declare const postIdAtom: import("jotai").PrimitiveAtom<string | null> & {
7
+ init: string | null;
8
+ };
9
+ export declare const blogPostGetReqAtom: import("jotai").PrimitiveAtom<Partial<PlainMessage<BlogPostGetReq>> | undefined> & {
10
+ init: Partial<PlainMessage<BlogPostGetReq>> | undefined;
11
+ };