@jant/core 0.2.12 → 0.2.13

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 (146) hide show
  1. package/bin/jant.js +3 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +112 -85
  4. package/dist/auth.d.ts +1 -0
  5. package/dist/auth.d.ts.map +1 -1
  6. package/dist/auth.js +2 -1
  7. package/dist/client.js +1 -1
  8. package/dist/db/schema.d.ts.map +1 -1
  9. package/dist/i18n/context.d.ts.map +1 -1
  10. package/dist/i18n/context.js +0 -3
  11. package/dist/i18n/detect.d.ts +0 -11
  12. package/dist/i18n/detect.d.ts.map +1 -1
  13. package/dist/i18n/detect.js +1 -52
  14. package/dist/i18n/i18n.d.ts +4 -14
  15. package/dist/i18n/i18n.d.ts.map +1 -1
  16. package/dist/i18n/i18n.js +19 -25
  17. package/dist/i18n/index.d.ts +1 -1
  18. package/dist/i18n/index.d.ts.map +1 -1
  19. package/dist/i18n/index.js +1 -1
  20. package/dist/i18n/middleware.d.ts +2 -5
  21. package/dist/i18n/middleware.d.ts.map +1 -1
  22. package/dist/i18n/middleware.js +12 -23
  23. package/dist/lib/constants.d.ts.map +1 -1
  24. package/dist/lib/image.d.ts.map +1 -1
  25. package/dist/lib/schemas.d.ts.map +1 -1
  26. package/dist/lib/sse.d.ts +45 -17
  27. package/dist/lib/sse.d.ts.map +1 -1
  28. package/dist/lib/sse.js +77 -37
  29. package/dist/middleware/auth.d.ts.map +1 -1
  30. package/dist/routes/api/posts.js +0 -1
  31. package/dist/routes/api/upload.js +3 -1
  32. package/dist/routes/dash/collections.d.ts.map +1 -1
  33. package/dist/routes/dash/collections.js +134 -142
  34. package/dist/routes/dash/index.js +25 -26
  35. package/dist/routes/dash/media.d.ts.map +1 -1
  36. package/dist/routes/dash/media.js +60 -56
  37. package/dist/routes/dash/pages.js +64 -66
  38. package/dist/routes/dash/posts.d.ts.map +1 -1
  39. package/dist/routes/dash/posts.js +50 -59
  40. package/dist/routes/dash/redirects.d.ts.map +1 -1
  41. package/dist/routes/dash/redirects.js +63 -60
  42. package/dist/routes/dash/settings.d.ts.map +1 -1
  43. package/dist/routes/dash/settings.js +249 -93
  44. package/dist/routes/feed/rss.js +6 -4
  45. package/dist/routes/pages/archive.js +60 -62
  46. package/dist/routes/pages/collection.js +8 -8
  47. package/dist/routes/pages/home.js +14 -14
  48. package/dist/routes/pages/page.js +7 -6
  49. package/dist/routes/pages/post.js +8 -8
  50. package/dist/routes/pages/search.js +25 -27
  51. package/dist/services/collection.d.ts.map +1 -1
  52. package/dist/services/index.d.ts.map +1 -1
  53. package/dist/services/media.d.ts.map +1 -1
  54. package/dist/services/post.d.ts.map +1 -1
  55. package/dist/services/redirect.d.ts.map +1 -1
  56. package/dist/services/settings.d.ts.map +1 -1
  57. package/dist/theme/components/ActionButtons.d.ts +1 -1
  58. package/dist/theme/components/ActionButtons.d.ts.map +1 -1
  59. package/dist/theme/components/ActionButtons.js +17 -21
  60. package/dist/theme/components/CrudPageHeader.d.ts.map +1 -1
  61. package/dist/theme/components/DangerZone.d.ts.map +1 -1
  62. package/dist/theme/components/DangerZone.js +12 -15
  63. package/dist/theme/components/EmptyState.d.ts.map +1 -1
  64. package/dist/theme/components/PageForm.d.ts.map +1 -1
  65. package/dist/theme/components/PageForm.js +58 -56
  66. package/dist/theme/components/Pagination.d.ts.map +1 -1
  67. package/dist/theme/components/Pagination.js +22 -25
  68. package/dist/theme/components/PostForm.d.ts +0 -1
  69. package/dist/theme/components/PostForm.d.ts.map +1 -1
  70. package/dist/theme/components/PostForm.js +85 -77
  71. package/dist/theme/components/PostList.d.ts.map +1 -1
  72. package/dist/theme/components/PostList.js +17 -17
  73. package/dist/theme/components/ThreadView.d.ts.map +1 -1
  74. package/dist/theme/components/ThreadView.js +15 -18
  75. package/dist/theme/components/TypeBadge.d.ts.map +1 -1
  76. package/dist/theme/components/TypeBadge.js +20 -20
  77. package/dist/theme/components/VisibilityBadge.d.ts.map +1 -1
  78. package/dist/theme/components/VisibilityBadge.js +14 -14
  79. package/dist/theme/components/index.d.ts +1 -1
  80. package/dist/theme/components/index.d.ts.map +1 -1
  81. package/dist/theme/layouts/BaseLayout.d.ts.map +1 -1
  82. package/dist/theme/layouts/BaseLayout.js +4 -2
  83. package/dist/theme/layouts/DashLayout.d.ts.map +1 -1
  84. package/dist/theme/layouts/DashLayout.js +29 -29
  85. package/dist/types/lingui-react-macro.d.js +9 -0
  86. package/dist/types.d.ts +2 -0
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/vendor/datastar.js +1606 -0
  89. package/package.json +5 -2
  90. package/src/app.tsx +175 -56
  91. package/src/auth.ts +5 -1
  92. package/src/client.ts +1 -1
  93. package/src/db/schema.ts +22 -7
  94. package/src/i18n/EXAMPLES.md +34 -14
  95. package/src/i18n/README.md +19 -9
  96. package/src/i18n/context.tsx +1 -4
  97. package/src/i18n/detect.ts +1 -67
  98. package/src/i18n/i18n.ts +15 -19
  99. package/src/i18n/index.ts +0 -3
  100. package/src/i18n/middleware.ts +12 -24
  101. package/src/lib/constants.ts +2 -1
  102. package/src/lib/image-processor.ts +23 -7
  103. package/src/lib/image.ts +6 -2
  104. package/src/lib/schemas.ts +6 -2
  105. package/src/lib/sse.ts +138 -50
  106. package/src/middleware/auth.ts +6 -2
  107. package/src/routes/api/posts.ts +14 -5
  108. package/src/routes/api/upload.ts +25 -7
  109. package/src/routes/dash/collections.tsx +162 -70
  110. package/src/routes/dash/index.tsx +22 -7
  111. package/src/routes/dash/media.tsx +59 -16
  112. package/src/routes/dash/pages.tsx +102 -44
  113. package/src/routes/dash/posts.tsx +87 -54
  114. package/src/routes/dash/redirects.tsx +74 -26
  115. package/src/routes/dash/settings.tsx +250 -57
  116. package/src/routes/feed/rss.ts +6 -4
  117. package/src/routes/pages/archive.tsx +71 -21
  118. package/src/routes/pages/collection.tsx +21 -6
  119. package/src/routes/pages/home.tsx +30 -9
  120. package/src/routes/pages/page.tsx +14 -5
  121. package/src/routes/pages/post.tsx +21 -7
  122. package/src/routes/pages/search.tsx +42 -11
  123. package/src/services/collection.ts +34 -9
  124. package/src/services/index.ts +4 -1
  125. package/src/services/media.ts +15 -3
  126. package/src/services/post.ts +39 -10
  127. package/src/services/redirect.ts +4 -1
  128. package/src/services/settings.ts +14 -3
  129. package/src/theme/components/ActionButtons.tsx +26 -14
  130. package/src/theme/components/CrudPageHeader.tsx +6 -1
  131. package/src/theme/components/DangerZone.tsx +19 -13
  132. package/src/theme/components/EmptyState.tsx +6 -1
  133. package/src/theme/components/PageForm.tsx +71 -24
  134. package/src/theme/components/Pagination.tsx +26 -8
  135. package/src/theme/components/PostForm.tsx +72 -25
  136. package/src/theme/components/PostList.tsx +16 -5
  137. package/src/theme/components/ThreadView.tsx +25 -7
  138. package/src/theme/components/TypeBadge.tsx +13 -4
  139. package/src/theme/components/VisibilityBadge.tsx +17 -5
  140. package/src/theme/components/index.ts +4 -1
  141. package/src/theme/layouts/BaseLayout.tsx +5 -2
  142. package/src/theme/layouts/DashLayout.tsx +41 -12
  143. package/src/types/lingui-react-macro.d.ts +34 -0
  144. package/src/types.ts +16 -2
  145. package/src/vendor/datastar.js +9 -0
  146. package/src/vendor/datastar.js.map +7 -0
@@ -3,39 +3,42 @@
3
3
  *
4
4
  * For managing custom pages (posts with type="page")
5
5
  */ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
6
- import { useLingui } from "../../i18n/index.js";
6
+ import { useLingui as $_useLingui } from "@jant/core/i18n";
7
7
  export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
8
- const { t } = useLingui();
8
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
9
9
  const isEdit = !!page;
10
+ const signals = JSON.stringify({
11
+ title: page?.title ?? "",
12
+ path: page?.path ?? "",
13
+ content: page?.content ?? "",
14
+ visibility: page?.visibility ?? "unlisted"
15
+ }).replace(/</g, "\\u003c");
10
16
  return /*#__PURE__*/ _jsxs("form", {
11
- method: "post",
12
- action: action,
17
+ "data-signals": signals,
18
+ "data-on:submit__prevent": `@post('${action}')`,
13
19
  class: "flex flex-col gap-4",
14
20
  children: [
15
- /*#__PURE__*/ _jsx("input", {
16
- type: "hidden",
17
- name: "type",
18
- value: "page"
21
+ /*#__PURE__*/ _jsx("div", {
22
+ id: "page-form-message"
19
23
  }),
20
24
  /*#__PURE__*/ _jsxs("div", {
21
25
  class: "field",
22
26
  children: [
23
27
  /*#__PURE__*/ _jsx("label", {
24
28
  class: "label",
25
- children: t({
26
- message: "Title",
27
- comment: "@context: Page form field label - title"
29
+ children: $__i18n._({
30
+ id: "MHrjPM",
31
+ message: "Title"
28
32
  })
29
33
  }),
30
34
  /*#__PURE__*/ _jsx("input", {
31
35
  type: "text",
32
- name: "title",
36
+ "data-bind": "title",
33
37
  class: "input",
34
- placeholder: t({
35
- message: "Page title...",
36
- comment: "@context: Page title placeholder"
38
+ placeholder: $__i18n._({
39
+ id: "2rJGtU",
40
+ message: "Page title..."
37
41
  }),
38
- value: page?.title ?? "",
39
42
  required: true
40
43
  })
41
44
  ]
@@ -45,9 +48,9 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
45
48
  children: [
46
49
  /*#__PURE__*/ _jsx("label", {
47
50
  class: "label",
48
- children: t({
49
- message: "Path",
50
- comment: "@context: Page form field label - URL path"
51
+ children: $__i18n._({
52
+ id: "I6gXOa",
53
+ message: "Path"
51
54
  })
52
55
  }),
53
56
  /*#__PURE__*/ _jsxs("div", {
@@ -59,14 +62,13 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
59
62
  }),
60
63
  /*#__PURE__*/ _jsx("input", {
61
64
  type: "text",
62
- name: "path",
65
+ "data-bind": "path",
63
66
  class: "input flex-1",
64
67
  placeholder: "about",
65
- value: page?.path ?? "",
66
68
  pattern: "[a-z0-9\\-]+",
67
- title: t({
68
- message: "Lowercase letters, numbers, and hyphens only",
69
- comment: "@context: Page path validation message"
69
+ title: $__i18n._({
70
+ id: "BjF0Jv",
71
+ message: "Lowercase letters, numbers, and hyphens only"
70
72
  }),
71
73
  required: true
72
74
  })
@@ -74,9 +76,9 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
74
76
  }),
75
77
  /*#__PURE__*/ _jsx("p", {
76
78
  class: "text-xs text-muted-foreground mt-1",
77
- children: t({
78
- message: "The URL path for this page. Use lowercase letters, numbers, and hyphens.",
79
- comment: "@context: Page path helper text"
79
+ children: $__i18n._({
80
+ id: "4mDPGp",
81
+ message: "The URL path for this page. Use lowercase letters, numbers, and hyphens."
80
82
  })
81
83
  })
82
84
  ]
@@ -86,17 +88,17 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
86
88
  children: [
87
89
  /*#__PURE__*/ _jsx("label", {
88
90
  class: "label",
89
- children: t({
90
- message: "Content",
91
- comment: "@context: Page form field label - content"
91
+ children: $__i18n._({
92
+ id: "4b3oEV",
93
+ message: "Content"
92
94
  })
93
95
  }),
94
96
  /*#__PURE__*/ _jsx("textarea", {
95
- name: "content",
97
+ "data-bind": "content",
96
98
  class: "textarea min-h-48",
97
- placeholder: t({
98
- message: "Page content (Markdown supported)...",
99
- comment: "@context: Page content placeholder"
99
+ placeholder: $__i18n._({
100
+ id: "7G4SBz",
101
+ message: "Page content (Markdown supported)..."
100
102
  }),
101
103
  required: true,
102
104
  children: page?.content ?? ""
@@ -108,38 +110,38 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
108
110
  children: [
109
111
  /*#__PURE__*/ _jsx("label", {
110
112
  class: "label",
111
- children: t({
112
- message: "Status",
113
- comment: "@context: Page form field label - publish status"
113
+ children: $__i18n._({
114
+ id: "uAQUqI",
115
+ message: "Status"
114
116
  })
115
117
  }),
116
118
  /*#__PURE__*/ _jsxs("select", {
117
- name: "visibility",
119
+ "data-bind": "visibility",
118
120
  class: "select",
119
121
  children: [
120
122
  /*#__PURE__*/ _jsx("option", {
121
123
  value: "unlisted",
122
124
  selected: page?.visibility === "unlisted" || !page,
123
- children: t({
124
- message: "Published",
125
- comment: "@context: Page status option - published"
125
+ children: $__i18n._({
126
+ id: "u3wRF+",
127
+ message: "Published"
126
128
  })
127
129
  }),
128
130
  /*#__PURE__*/ _jsx("option", {
129
131
  value: "draft",
130
132
  selected: page?.visibility === "draft",
131
- children: t({
132
- message: "Draft",
133
- comment: "@context: Page status option - draft"
133
+ children: $__i18n._({
134
+ id: "eneWvv",
135
+ message: "Draft"
134
136
  })
135
137
  })
136
138
  ]
137
139
  }),
138
140
  /*#__PURE__*/ _jsx("p", {
139
141
  class: "text-xs text-muted-foreground mt-1",
140
- children: t({
141
- message: "Published pages are accessible via their path. Drafts are not visible.",
142
- comment: "@context: Page status helper text"
142
+ children: $__i18n._({
143
+ id: "JiP4aa",
144
+ message: "Published pages are accessible via their path. Drafts are not visible."
143
145
  })
144
146
  })
145
147
  ]
@@ -150,20 +152,20 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
150
152
  /*#__PURE__*/ _jsx("button", {
151
153
  type: "submit",
152
154
  class: "btn",
153
- children: isEdit ? t({
154
- message: "Update Page",
155
- comment: "@context: Button to update existing page"
156
- }) : t({
157
- message: "Create Page",
158
- comment: "@context: Button to create new page"
155
+ children: isEdit ? $__i18n._({
156
+ id: "oYPBa0",
157
+ message: "Update Page"
158
+ }) : $__i18n._({
159
+ id: "Y+7JGK",
160
+ message: "Create Page"
159
161
  })
160
162
  }),
161
163
  /*#__PURE__*/ _jsx("a", {
162
164
  href: cancelUrl,
163
165
  class: "btn-outline",
164
- children: t({
165
- message: "Cancel",
166
- comment: "@context: Button to cancel and go back"
166
+ children: $__i18n._({
167
+ id: "dEgA5A",
168
+ message: "Cancel"
167
169
  })
168
170
  })
169
171
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/theme/components/Pagination.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAGnC,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAmD1C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAgBtC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA6DlD,CAAC"}
1
+ {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/theme/components/Pagination.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAGnC,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA0D1C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAoBtC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAoElD,CAAC"}
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * Cursor-based pagination for post lists
5
5
  */ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
6
- import { useLingui } from "../../i18n/index.js";
6
+ import { useLingui as $_useLingui } from "@jant/core/i18n";
7
7
  export const Pagination = ({ baseUrl, hasMore, nextCursor, prevCursor, cursorParam = "cursor" })=>{
8
- const { t } = useLingui();
8
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
9
9
  const hasPrev = prevCursor !== undefined;
10
10
  const hasNext = hasMore && nextCursor !== undefined;
11
11
  if (!hasPrev && !hasNext) {
@@ -17,13 +17,13 @@ export const Pagination = ({ baseUrl, hasMore, nextCursor, prevCursor, cursorPar
17
17
  url.searchParams.set(cursorParam, String(cursor));
18
18
  return `${url.pathname}${url.search}`;
19
19
  };
20
- const prevText = t({
21
- message: "Previous",
22
- comment: "@context: Pagination button - previous page"
20
+ const prevText = $__i18n._({
21
+ id: "DHhJ7s",
22
+ message: "Previous"
23
23
  });
24
- const nextText = t({
25
- message: "Next",
26
- comment: "@context: Pagination button - next page"
24
+ const nextText = $__i18n._({
25
+ id: "hXzOVo",
26
+ message: "Next"
27
27
  });
28
28
  return /*#__PURE__*/ _jsxs("nav", {
29
29
  class: "flex items-center justify-between py-4",
@@ -65,13 +65,13 @@ export const Pagination = ({ baseUrl, hasMore, nextCursor, prevCursor, cursorPar
65
65
  });
66
66
  };
67
67
  export const LoadMore = ({ href, hasMore, text })=>{
68
- const { t } = useLingui();
68
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
69
69
  if (!hasMore) {
70
70
  return null;
71
71
  }
72
- const buttonText = text ?? t({
73
- message: "Load more",
74
- comment: "@context: Pagination button - load more items"
72
+ const buttonText = text ?? $__i18n._({
73
+ id: "yQ2kGp",
74
+ message: "Load more"
75
75
  });
76
76
  return /*#__PURE__*/ _jsx("div", {
77
77
  class: "text-center py-4",
@@ -83,7 +83,7 @@ export const LoadMore = ({ href, hasMore, text })=>{
83
83
  });
84
84
  };
85
85
  export const PagePagination = ({ baseUrl, currentPage, hasMore, pageParam = "page" })=>{
86
- const { t } = useLingui();
86
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
87
87
  const hasPrev = currentPage > 1;
88
88
  const hasNext = hasMore;
89
89
  if (!hasPrev && !hasNext) {
@@ -99,20 +99,17 @@ export const PagePagination = ({ baseUrl, currentPage, hasMore, pageParam = "pag
99
99
  }
100
100
  return `${url.pathname}${url.search}`;
101
101
  };
102
- const prevText = t({
103
- message: "Previous",
104
- comment: "@context: Pagination button - previous page"
102
+ const prevText = $__i18n._({
103
+ id: "DHhJ7s",
104
+ message: "Previous"
105
105
  });
106
- const nextText = t({
107
- message: "Next",
108
- comment: "@context: Pagination button - next page"
106
+ const nextText = $__i18n._({
107
+ id: "hXzOVo",
108
+ message: "Next"
109
109
  });
110
- const pageText = t({
111
- message: "Page {page}",
112
- comment: "@context: Pagination - current page indicator",
113
- values: {
114
- page: String(currentPage)
115
- }
110
+ const pageText = $__i18n._({
111
+ id: "tiq7kl",
112
+ message: "Page {page}"
116
113
  });
117
114
  return /*#__PURE__*/ _jsxs("nav", {
118
115
  class: "flex items-center justify-between py-4",
@@ -6,7 +6,6 @@ import type { Post } from "../../types.js";
6
6
  export interface PostFormProps {
7
7
  post?: Post;
8
8
  action: string;
9
- method?: "get" | "post";
10
9
  }
11
10
  export declare const PostForm: FC<PostFormProps>;
12
11
  //# sourceMappingURL=PostForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostForm.d.ts","sourceRoot":"","sources":["../../../src/theme/components/PostForm.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA4HtC,CAAC"}
1
+ {"version":3,"file":"PostForm.d.ts","sourceRoot":"","sources":["../../../src/theme/components/PostForm.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA4KtC,CAAC"}
@@ -1,68 +1,79 @@
1
1
  /**
2
2
  * Post Creation/Edit Form
3
3
  */ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
4
- import { useLingui } from "../../i18n/index.js";
5
- export const PostForm = ({ post, action, method = "post" })=>{
6
- const { t } = useLingui();
4
+ import { useLingui as $_useLingui } from "@jant/core/i18n";
5
+ export const PostForm = ({ post, action })=>{
6
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
7
7
  const isEdit = !!post;
8
+ const signals = JSON.stringify({
9
+ type: post?.type ?? "note",
10
+ title: post?.title ?? "",
11
+ content: post?.content ?? "",
12
+ sourceUrl: post?.sourceUrl ?? "",
13
+ visibility: post?.visibility ?? "quiet",
14
+ path: post?.path ?? ""
15
+ }).replace(/</g, "\\u003c");
8
16
  return /*#__PURE__*/ _jsxs("form", {
9
- method: method,
10
- action: action,
17
+ "data-signals": signals,
18
+ "data-on:submit__prevent": `@post('${action}')`,
11
19
  class: "flex flex-col gap-4",
12
20
  children: [
21
+ /*#__PURE__*/ _jsx("div", {
22
+ id: "post-form-message"
23
+ }),
13
24
  /*#__PURE__*/ _jsxs("div", {
14
25
  class: "field",
15
26
  children: [
16
27
  /*#__PURE__*/ _jsx("label", {
17
28
  class: "label",
18
- children: t({
19
- message: "Type",
20
- comment: "@context: Post form field - post type"
29
+ children: $__i18n._({
30
+ id: "+zy2Nq",
31
+ message: "Type"
21
32
  })
22
33
  }),
23
34
  /*#__PURE__*/ _jsxs("select", {
24
- name: "type",
35
+ "data-bind": "type",
25
36
  class: "select",
26
37
  required: true,
27
38
  children: [
28
39
  /*#__PURE__*/ _jsx("option", {
29
40
  value: "note",
30
41
  selected: post?.type === "note",
31
- children: t({
32
- message: "Note",
33
- comment: "@context: Post type option"
42
+ children: $__i18n._({
43
+ id: "KiJn9B",
44
+ message: "Note"
34
45
  })
35
46
  }),
36
47
  /*#__PURE__*/ _jsx("option", {
37
48
  value: "article",
38
49
  selected: post?.type === "article",
39
- children: t({
40
- message: "Article",
41
- comment: "@context: Post type option"
50
+ children: $__i18n._({
51
+ id: "f6e0Ry",
52
+ message: "Article"
42
53
  })
43
54
  }),
44
55
  /*#__PURE__*/ _jsx("option", {
45
56
  value: "link",
46
57
  selected: post?.type === "link",
47
- children: t({
48
- message: "Link",
49
- comment: "@context: Post type option"
58
+ children: $__i18n._({
59
+ id: "yzF66j",
60
+ message: "Link"
50
61
  })
51
62
  }),
52
63
  /*#__PURE__*/ _jsx("option", {
53
64
  value: "quote",
54
65
  selected: post?.type === "quote",
55
- children: t({
56
- message: "Quote",
57
- comment: "@context: Post type option"
66
+ children: $__i18n._({
67
+ id: "ZhhOwV",
68
+ message: "Quote"
58
69
  })
59
70
  }),
60
71
  /*#__PURE__*/ _jsx("option", {
61
72
  value: "image",
62
73
  selected: post?.type === "image",
63
- children: t({
64
- message: "Image",
65
- comment: "@context: Post type option"
74
+ children: $__i18n._({
75
+ id: "hG89Ed",
76
+ message: "Image"
66
77
  })
67
78
  })
68
79
  ]
@@ -74,20 +85,19 @@ export const PostForm = ({ post, action, method = "post" })=>{
74
85
  children: [
75
86
  /*#__PURE__*/ _jsx("label", {
76
87
  class: "label",
77
- children: t({
78
- message: "Title (optional)",
79
- comment: "@context: Post form field"
88
+ children: $__i18n._({
89
+ id: "wK4OTM",
90
+ message: "Title (optional)"
80
91
  })
81
92
  }),
82
93
  /*#__PURE__*/ _jsx("input", {
83
94
  type: "text",
84
- name: "title",
95
+ "data-bind": "title",
85
96
  class: "input",
86
- placeholder: t({
87
- message: "Post title...",
88
- comment: "@context: Post title placeholder"
89
- }),
90
- value: post?.title ?? ""
97
+ placeholder: $__i18n._({
98
+ id: "2N0qpv",
99
+ message: "Post title..."
100
+ })
91
101
  })
92
102
  ]
93
103
  }),
@@ -96,17 +106,17 @@ export const PostForm = ({ post, action, method = "post" })=>{
96
106
  children: [
97
107
  /*#__PURE__*/ _jsx("label", {
98
108
  class: "label",
99
- children: t({
100
- message: "Content",
101
- comment: "@context: Post form field"
109
+ children: $__i18n._({
110
+ id: "4b3oEV",
111
+ message: "Content"
102
112
  })
103
113
  }),
104
114
  /*#__PURE__*/ _jsx("textarea", {
105
- name: "content",
115
+ "data-bind": "content",
106
116
  class: "textarea min-h-32",
107
- placeholder: t({
108
- message: "What's on your mind?",
109
- comment: "@context: Post content placeholder"
117
+ placeholder: $__i18n._({
118
+ id: "7nGhhM",
119
+ message: "What's on your mind?"
110
120
  }),
111
121
  required: true,
112
122
  children: post?.content ?? ""
@@ -118,17 +128,16 @@ export const PostForm = ({ post, action, method = "post" })=>{
118
128
  children: [
119
129
  /*#__PURE__*/ _jsx("label", {
120
130
  class: "label",
121
- children: t({
122
- message: "Source URL (optional)",
123
- comment: "@context: Post form field"
131
+ children: $__i18n._({
132
+ id: "qMyM2u",
133
+ message: "Source URL (optional)"
124
134
  })
125
135
  }),
126
136
  /*#__PURE__*/ _jsx("input", {
127
137
  type: "url",
128
- name: "sourceUrl",
138
+ "data-bind": "sourceUrl",
129
139
  class: "input",
130
- placeholder: "https://...",
131
- value: post?.sourceUrl ?? ""
140
+ placeholder: "https://..."
132
141
  })
133
142
  ]
134
143
  }),
@@ -137,45 +146,45 @@ export const PostForm = ({ post, action, method = "post" })=>{
137
146
  children: [
138
147
  /*#__PURE__*/ _jsx("label", {
139
148
  class: "label",
140
- children: t({
141
- message: "Visibility",
142
- comment: "@context: Post form field"
149
+ children: $__i18n._({
150
+ id: "2q/Q7x",
151
+ message: "Visibility"
143
152
  })
144
153
  }),
145
154
  /*#__PURE__*/ _jsxs("select", {
146
- name: "visibility",
155
+ "data-bind": "visibility",
147
156
  class: "select",
148
157
  children: [
149
158
  /*#__PURE__*/ _jsx("option", {
150
159
  value: "quiet",
151
160
  selected: post?.visibility === "quiet" || !post,
152
- children: t({
153
- message: "Quiet (normal)",
154
- comment: "@context: Post visibility option"
161
+ children: $__i18n._({
162
+ id: "HiETwV",
163
+ message: "Quiet (normal)"
155
164
  })
156
165
  }),
157
166
  /*#__PURE__*/ _jsx("option", {
158
167
  value: "featured",
159
168
  selected: post?.visibility === "featured",
160
- children: t({
161
- message: "Featured",
162
- comment: "@context: Post visibility option"
169
+ children: $__i18n._({
170
+ id: "FkMol5",
171
+ message: "Featured"
163
172
  })
164
173
  }),
165
174
  /*#__PURE__*/ _jsx("option", {
166
175
  value: "unlisted",
167
176
  selected: post?.visibility === "unlisted",
168
- children: t({
169
- message: "Unlisted",
170
- comment: "@context: Post visibility option"
177
+ children: $__i18n._({
178
+ id: "WDcQq9",
179
+ message: "Unlisted"
171
180
  })
172
181
  }),
173
182
  /*#__PURE__*/ _jsx("option", {
174
183
  value: "draft",
175
184
  selected: post?.visibility === "draft",
176
- children: t({
177
- message: "Draft",
178
- comment: "@context: Post visibility option"
185
+ children: $__i18n._({
186
+ id: "eneWvv",
187
+ message: "Draft"
179
188
  })
180
189
  })
181
190
  ]
@@ -187,17 +196,16 @@ export const PostForm = ({ post, action, method = "post" })=>{
187
196
  children: [
188
197
  /*#__PURE__*/ _jsx("label", {
189
198
  class: "label",
190
- children: t({
191
- message: "Custom Path (optional)",
192
- comment: "@context: Post form field"
199
+ children: $__i18n._({
200
+ id: "40TVQj",
201
+ message: "Custom Path (optional)"
193
202
  })
194
203
  }),
195
204
  /*#__PURE__*/ _jsx("input", {
196
205
  type: "text",
197
- name: "path",
206
+ "data-bind": "path",
198
207
  class: "input",
199
- placeholder: "my-custom-url",
200
- value: post?.path ?? ""
208
+ placeholder: "my-custom-url"
201
209
  })
202
210
  ]
203
211
  }),
@@ -207,20 +215,20 @@ export const PostForm = ({ post, action, method = "post" })=>{
207
215
  /*#__PURE__*/ _jsx("button", {
208
216
  type: "submit",
209
217
  class: "btn",
210
- children: isEdit ? t({
211
- message: "Update",
212
- comment: "@context: Button to update existing post"
213
- }) : t({
214
- message: "Publish",
215
- comment: "@context: Button to publish new post"
218
+ children: isEdit ? $__i18n._({
219
+ id: "EkH9pt",
220
+ message: "Update"
221
+ }) : $__i18n._({
222
+ id: "EEYbdt",
223
+ message: "Publish"
216
224
  })
217
225
  }),
218
226
  /*#__PURE__*/ _jsx("a", {
219
227
  href: "/dash/posts",
220
228
  class: "btn-outline",
221
- children: t({
222
- message: "Cancel",
223
- comment: "@context: Button to cancel form"
229
+ children: $__i18n._({
230
+ id: "dEgA5A",
231
+ message: "Cancel"
224
232
  })
225
233
  })
226
234
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"PostList.d.ts","sourceRoot":"","sources":["../../../src/theme/components/PostList.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAS3C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAsDtC,CAAC"}
1
+ {"version":3,"file":"PostList.d.ts","sourceRoot":"","sources":["../../../src/theme/components/PostList.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAS3C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiEtC,CAAC"}