gomtm 0.0.321 → 0.0.322
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/esm/components/MtDate.d.ts +6 -0
- package/dist/esm/components/MtDate.js +17 -0
- package/dist/esm/components/Tag.d.ts +6 -0
- package/dist/esm/components/Tag.js +17 -0
- package/dist/esm/curd/list-item/ListLayout.js +3 -9
- package/dist/esm/curd/list-item/PostCardListItem.js +36 -0
- package/dist/esm/curd/list-item/PostListItemAuto.d.ts +5 -0
- package/dist/esm/curd/list-item/PostListItemAuto.js +43 -0
- package/dist/esm/gomtmpb/mtm/sppb/mtm_pb.d.ts +3 -1
- package/dist/esm/gomtmpb/mtm/sppb/mtm_pb.js +21 -9
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { formatDate } from "pliny/utils/formatDate";
|
|
4
|
+
const MtDateView = (props) => {
|
|
5
|
+
const { date } = props;
|
|
6
|
+
if (!date) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const date1 = /* @__PURE__ */ new Date();
|
|
10
|
+
date1.setFullYear(date.year);
|
|
11
|
+
date1.setMonth(date.month);
|
|
12
|
+
date1.setDate(date.day);
|
|
13
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("time", { dateTime: date1.toString(), children: formatDate(date1.toString(), "en-US") }) });
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
MtDateView
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { slug } from "github-slugger";
|
|
4
|
+
const Tag = ({ text }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
Link,
|
|
7
|
+
{
|
|
8
|
+
href: `/tags/${slug(text)}`,
|
|
9
|
+
className: "mr-3 text-sm font-medium uppercase text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
|
|
10
|
+
children: text.split(" ").join("-")
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
var Tag_default = Tag;
|
|
15
|
+
export {
|
|
16
|
+
Tag_default as default
|
|
17
|
+
};
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
|
|
4
4
|
const ListLayout = (props) => {
|
|
5
5
|
const { children } = props;
|
|
6
6
|
switch (props.layout) {
|
|
7
7
|
case ListViewLayout.simple:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */ jsx("div", { children: "simple-list-layout" }),
|
|
10
|
-
children
|
|
11
|
-
] });
|
|
8
|
+
return /* @__PURE__ */ jsx("ul", { className: "divide-y divide-gray-200 dark:divide-gray-700", children });
|
|
12
9
|
case ListViewLayout.grid:
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */ jsx("div", { children: "grid-layout" }),
|
|
15
|
-
children
|
|
16
|
-
] });
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
|
|
17
11
|
case ListViewLayout.card:
|
|
18
12
|
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
|
|
19
13
|
default:
|
|
@@ -5,13 +5,49 @@ import { cn } from "mtxuilib/lib/utils";
|
|
|
5
5
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
|
|
6
6
|
import { Icons } from "mtxuilib/icons/icons";
|
|
7
7
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
|
|
8
|
+
import { title } from "process";
|
|
8
9
|
import { useState } from "react";
|
|
10
|
+
import { MtDateView } from "../../components/MtDate";
|
|
11
|
+
import Tag from "../../components/Tag";
|
|
9
12
|
import { useListview } from "../listview/list-store";
|
|
10
13
|
const PostCardListItem = (props) => {
|
|
11
14
|
const { item } = props;
|
|
12
15
|
const slugPath = useListview((x) => x.slugPath);
|
|
13
16
|
const activateItem = useListview((x) => x.activateItem);
|
|
14
17
|
const setActivateItem = useListview((x) => x.setActivateItem);
|
|
18
|
+
if (item.layoutVariant == "list") {
|
|
19
|
+
return /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("dl", { children: [
|
|
21
|
+
/* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
|
|
22
|
+
/* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx(MtDateView, { date: item.publishDate }) })
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
27
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
|
|
28
|
+
MtLink,
|
|
29
|
+
{
|
|
30
|
+
href: `/blog/${item.slug}`,
|
|
31
|
+
className: "text-gray-900 dark:text-gray-100",
|
|
32
|
+
children: item.title
|
|
33
|
+
}
|
|
34
|
+
) }),
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: item.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
|
|
36
|
+
] }),
|
|
37
|
+
/* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: item.summary })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
|
|
40
|
+
MtLink,
|
|
41
|
+
{
|
|
42
|
+
href: `/blog/${item.slug}`,
|
|
43
|
+
className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
|
|
44
|
+
"aria-label": `Read more: "${title}"`,
|
|
45
|
+
children: "Read more \u2192"
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
] })
|
|
49
|
+
] }) }) });
|
|
50
|
+
}
|
|
15
51
|
return /* @__PURE__ */ jsxs(
|
|
16
52
|
Card,
|
|
17
53
|
{
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useListview } from "../listview/list-store";
|
|
4
|
+
const PostCardListItem = (props) => {
|
|
5
|
+
const { item } = props;
|
|
6
|
+
const slugPath = useListview((x) => x.slugPath);
|
|
7
|
+
const activateItem = useListview((x) => x.activateItem);
|
|
8
|
+
const setActivateItem = useListview((x) => x.setActivateItem);
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("li", { className: "py-12", children: /* @__PURE__ */ jsx("article", { children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 xl:grid xl:grid-cols-4 xl:items-baseline xl:space-y-0", children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("dl", { children: [
|
|
11
|
+
/* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Published on" }),
|
|
12
|
+
/* @__PURE__ */ jsx("dd", { className: "text-base font-medium leading-6 text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsx("time", { dateTime: date, children: formatDate(date, siteMetadata.locale) }) })
|
|
13
|
+
] }),
|
|
14
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-5 xl:col-span-3", children: [
|
|
15
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
16
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
17
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold leading-8 tracking-tight", children: /* @__PURE__ */ jsx(
|
|
18
|
+
Link,
|
|
19
|
+
{
|
|
20
|
+
href: `/blog/${slug}`,
|
|
21
|
+
className: "text-gray-900 dark:text-gray-100",
|
|
22
|
+
children: title
|
|
23
|
+
}
|
|
24
|
+
) }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap", children: tags.map((tag) => /* @__PURE__ */ jsx(Tag, { text: tag }, tag)) })
|
|
26
|
+
] }),
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: "prose max-w-none text-gray-500 dark:text-gray-400", children: summary })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ jsx("div", { className: "text-base font-medium leading-6", children: /* @__PURE__ */ jsx(
|
|
30
|
+
Link,
|
|
31
|
+
{
|
|
32
|
+
href: `/blog/${slug}`,
|
|
33
|
+
className: "text-primary-500 hover:text-primary-600 dark:hover:text-primary-400",
|
|
34
|
+
"aria-label": `Read more: "${title}"`,
|
|
35
|
+
children: "Read more \u2192"
|
|
36
|
+
}
|
|
37
|
+
) })
|
|
38
|
+
] })
|
|
39
|
+
] }) }) }, slug) });
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
PostCardListItem
|
|
43
|
+
};
|
|
@@ -428,12 +428,14 @@ export declare class PostCardItem extends Message<PostCardItem> {
|
|
|
428
428
|
title: string;
|
|
429
429
|
subTitle: string;
|
|
430
430
|
actions?: ItemAction;
|
|
431
|
-
|
|
431
|
+
summary: string;
|
|
432
432
|
topImage: string;
|
|
433
433
|
excerpt: string;
|
|
434
434
|
category: string;
|
|
435
435
|
author: string;
|
|
436
436
|
publishDate?: MtDate;
|
|
437
|
+
slug: string;
|
|
438
|
+
tags: string[];
|
|
437
439
|
constructor(data?: PartialMessage<PostCardItem>);
|
|
438
440
|
static readonly runtime: typeof proto3;
|
|
439
441
|
static readonly typeName = "sppb.PostCardItem";
|
|
@@ -1612,7 +1612,7 @@ const _PostCardItem = class _PostCardItem extends Message {
|
|
|
1612
1612
|
*/
|
|
1613
1613
|
__publicField(this, "id", "");
|
|
1614
1614
|
/**
|
|
1615
|
-
*
|
|
1615
|
+
* 布局
|
|
1616
1616
|
*
|
|
1617
1617
|
* @generated from field: string layout_variant = 2;
|
|
1618
1618
|
*/
|
|
@@ -1630,9 +1630,9 @@ const _PostCardItem = class _PostCardItem extends Message {
|
|
|
1630
1630
|
*/
|
|
1631
1631
|
__publicField(this, "actions");
|
|
1632
1632
|
/**
|
|
1633
|
-
* @generated from field: string
|
|
1633
|
+
* @generated from field: string summary = 6;
|
|
1634
1634
|
*/
|
|
1635
|
-
__publicField(this, "
|
|
1635
|
+
__publicField(this, "summary", "");
|
|
1636
1636
|
/**
|
|
1637
1637
|
* @generated from field: string top_image = 7;
|
|
1638
1638
|
*/
|
|
@@ -1657,6 +1657,14 @@ const _PostCardItem = class _PostCardItem extends Message {
|
|
|
1657
1657
|
* @generated from field: sppb.MtDate publish_date = 11;
|
|
1658
1658
|
*/
|
|
1659
1659
|
__publicField(this, "publishDate");
|
|
1660
|
+
/**
|
|
1661
|
+
* @generated from field: string slug = 12;
|
|
1662
|
+
*/
|
|
1663
|
+
__publicField(this, "slug", "");
|
|
1664
|
+
/**
|
|
1665
|
+
* @generated from field: repeated string tags = 13;
|
|
1666
|
+
*/
|
|
1667
|
+
__publicField(this, "tags", []);
|
|
1660
1668
|
proto3.util.initPartial(data, this);
|
|
1661
1669
|
}
|
|
1662
1670
|
static fromBinary(bytes, options) {
|
|
@@ -1706,7 +1714,7 @@ __publicField(_PostCardItem, "fields", proto3.util.newFieldList(() => [
|
|
|
1706
1714
|
{ no: 5, name: "actions", kind: "message", T: ItemAction },
|
|
1707
1715
|
{
|
|
1708
1716
|
no: 6,
|
|
1709
|
-
name: "
|
|
1717
|
+
name: "summary",
|
|
1710
1718
|
kind: "scalar",
|
|
1711
1719
|
T: 9
|
|
1712
1720
|
/* ScalarType.STRING */
|
|
@@ -1739,7 +1747,15 @@ __publicField(_PostCardItem, "fields", proto3.util.newFieldList(() => [
|
|
|
1739
1747
|
T: 9
|
|
1740
1748
|
/* ScalarType.STRING */
|
|
1741
1749
|
},
|
|
1742
|
-
{ no: 11, name: "publish_date", kind: "message", T: MtDate }
|
|
1750
|
+
{ no: 11, name: "publish_date", kind: "message", T: MtDate },
|
|
1751
|
+
{
|
|
1752
|
+
no: 12,
|
|
1753
|
+
name: "slug",
|
|
1754
|
+
kind: "scalar",
|
|
1755
|
+
T: 9
|
|
1756
|
+
/* ScalarType.STRING */
|
|
1757
|
+
},
|
|
1758
|
+
{ no: 13, name: "tags", kind: "scalar", T: 9, repeated: true }
|
|
1743
1759
|
]));
|
|
1744
1760
|
let PostCardItem = _PostCardItem;
|
|
1745
1761
|
const _ListItemAction = class _ListItemAction extends Message {
|
|
@@ -1929,9 +1945,6 @@ const _CommontListReq = class _CommontListReq extends Message {
|
|
|
1929
1945
|
constructor(data) {
|
|
1930
1946
|
super();
|
|
1931
1947
|
/**
|
|
1932
|
-
* ListParams params = 1;
|
|
1933
|
-
* Paging pagination = 2;
|
|
1934
|
-
*
|
|
1935
1948
|
* @generated from field: optional string slugs = 1;
|
|
1936
1949
|
*/
|
|
1937
1950
|
__publicField(this, "slugs");
|
|
@@ -1946,7 +1959,6 @@ const _CommontListReq = class _CommontListReq extends Message {
|
|
|
1946
1959
|
*/
|
|
1947
1960
|
__publicField(this, "pagination");
|
|
1948
1961
|
/**
|
|
1949
|
-
* ListViewLayout view_type = 5;
|
|
1950
1962
|
* optional repeated string service_tags = 6; // 匹配到具体服务的标签(多个)
|
|
1951
1963
|
*
|
|
1952
1964
|
* 单个服务最大结果数
|