@btst/stack 1.0.1 → 1.1.1

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 (282) hide show
  1. package/README.md +156 -709
  2. package/dist/api/index.cjs +2 -1
  3. package/dist/api/index.d.cts +4 -3
  4. package/dist/api/index.d.mts +4 -3
  5. package/dist/api/index.d.ts +4 -3
  6. package/dist/api/index.mjs +1 -1
  7. package/dist/client/components/compose.cjs +68 -0
  8. package/dist/client/components/compose.mjs +65 -0
  9. package/dist/client/components/error-boundary.cjs +24 -0
  10. package/dist/client/components/error-boundary.mjs +22 -0
  11. package/dist/client/components/index.cjs +10 -0
  12. package/dist/client/components/index.d.cts +52 -0
  13. package/dist/client/components/index.d.mts +52 -0
  14. package/dist/client/components/index.d.ts +52 -0
  15. package/dist/client/components/index.mjs +2 -0
  16. package/dist/client/index.cjs +24 -5
  17. package/dist/client/index.d.cts +125 -8
  18. package/dist/client/index.d.mts +125 -8
  19. package/dist/client/index.d.ts +125 -8
  20. package/dist/client/index.mjs +21 -4
  21. package/dist/client/meta-utils.cjs +162 -0
  22. package/dist/client/meta-utils.mjs +160 -0
  23. package/dist/client/path-utils.cjs +15 -0
  24. package/dist/client/path-utils.mjs +13 -0
  25. package/dist/client/sitemap-utils.cjs +14 -0
  26. package/dist/client/sitemap-utils.mjs +12 -0
  27. package/dist/context/index.cjs +6 -63
  28. package/dist/context/index.d.cts +21 -24
  29. package/dist/context/index.d.mts +21 -24
  30. package/dist/context/index.d.ts +21 -24
  31. package/dist/context/index.mjs +1 -61
  32. package/dist/context/provider.cjs +51 -0
  33. package/dist/context/provider.mjs +46 -0
  34. package/dist/index.cjs +2 -3
  35. package/dist/index.d.cts +3 -2
  36. package/dist/index.d.mts +3 -2
  37. package/dist/index.d.ts +3 -2
  38. package/dist/index.mjs +1 -2
  39. package/dist/plugins/api/index.cjs +13 -0
  40. package/dist/plugins/api/index.d.cts +40 -0
  41. package/dist/plugins/api/index.d.mts +40 -0
  42. package/dist/plugins/api/index.d.ts +40 -0
  43. package/dist/plugins/api/index.mjs +8 -0
  44. package/dist/plugins/blog/api/index.cjs +11 -0
  45. package/dist/plugins/blog/api/index.d.cts +7 -0
  46. package/dist/plugins/blog/api/index.d.mts +7 -0
  47. package/dist/plugins/blog/api/index.d.ts +7 -0
  48. package/dist/plugins/blog/api/index.mjs +2 -0
  49. package/dist/plugins/blog/api/plugin.cjs +569 -0
  50. package/dist/plugins/blog/api/plugin.mjs +565 -0
  51. package/dist/plugins/blog/client/components/forms/image-field.cjs +133 -0
  52. package/dist/plugins/blog/client/components/forms/image-field.mjs +131 -0
  53. package/dist/plugins/blog/client/components/forms/markdown-editor-styles.css +30 -0
  54. package/dist/plugins/blog/client/components/forms/markdown-editor.cjs +106 -0
  55. package/dist/plugins/blog/client/components/forms/markdown-editor.mjs +104 -0
  56. package/dist/plugins/blog/client/components/forms/post-forms.cjs +401 -0
  57. package/dist/plugins/blog/client/components/forms/post-forms.mjs +398 -0
  58. package/dist/plugins/blog/client/components/forms/tags-multiselect.cjs +71 -0
  59. package/dist/plugins/blog/client/components/forms/tags-multiselect.mjs +65 -0
  60. package/dist/plugins/blog/client/components/index.cjs +17 -0
  61. package/dist/plugins/blog/client/components/index.d.cts +22 -0
  62. package/dist/plugins/blog/client/components/index.d.mts +22 -0
  63. package/dist/plugins/blog/client/components/index.d.ts +22 -0
  64. package/dist/plugins/blog/client/components/index.mjs +12 -0
  65. package/dist/plugins/blog/client/components/loading/form-page-skeleton.cjs +62 -0
  66. package/dist/plugins/blog/client/components/loading/form-page-skeleton.mjs +60 -0
  67. package/dist/plugins/blog/client/components/loading/index.cjs +20 -0
  68. package/dist/plugins/blog/client/components/loading/index.mjs +16 -0
  69. package/dist/plugins/blog/client/components/loading/list-page-skeleton.cjs +26 -0
  70. package/dist/plugins/blog/client/components/loading/list-page-skeleton.mjs +24 -0
  71. package/dist/plugins/blog/client/components/loading/page-header-skeleton.cjs +13 -0
  72. package/dist/plugins/blog/client/components/loading/page-header-skeleton.mjs +11 -0
  73. package/dist/plugins/blog/client/components/loading/post-card-skeleton.cjs +22 -0
  74. package/dist/plugins/blog/client/components/loading/post-card-skeleton.mjs +20 -0
  75. package/dist/plugins/blog/client/components/loading/post-page-skeleton.cjs +56 -0
  76. package/dist/plugins/blog/client/components/loading/post-page-skeleton.mjs +54 -0
  77. package/dist/plugins/blog/client/components/pages/404-page.cjs +19 -0
  78. package/dist/plugins/blog/client/components/pages/404-page.mjs +17 -0
  79. package/dist/plugins/blog/client/components/pages/edit-post-page.cjs +41 -0
  80. package/dist/plugins/blog/client/components/pages/edit-post-page.internal.cjs +57 -0
  81. package/dist/plugins/blog/client/components/pages/edit-post-page.internal.mjs +55 -0
  82. package/dist/plugins/blog/client/components/pages/edit-post-page.mjs +39 -0
  83. package/dist/plugins/blog/client/components/pages/home-page.cjs +41 -0
  84. package/dist/plugins/blog/client/components/pages/home-page.internal.cjs +61 -0
  85. package/dist/plugins/blog/client/components/pages/home-page.internal.mjs +59 -0
  86. package/dist/plugins/blog/client/components/pages/home-page.mjs +39 -0
  87. package/dist/plugins/blog/client/components/pages/new-post-page.cjs +37 -0
  88. package/dist/plugins/blog/client/components/pages/new-post-page.internal.cjs +53 -0
  89. package/dist/plugins/blog/client/components/pages/new-post-page.internal.mjs +51 -0
  90. package/dist/plugins/blog/client/components/pages/new-post-page.mjs +35 -0
  91. package/dist/plugins/blog/client/components/pages/post-page.cjs +39 -0
  92. package/dist/plugins/blog/client/components/pages/post-page.internal.cjs +101 -0
  93. package/dist/plugins/blog/client/components/pages/post-page.internal.mjs +99 -0
  94. package/dist/plugins/blog/client/components/pages/post-page.mjs +37 -0
  95. package/dist/plugins/blog/client/components/pages/tag-page.cjs +39 -0
  96. package/dist/plugins/blog/client/components/pages/tag-page.internal.cjs +61 -0
  97. package/dist/plugins/blog/client/components/pages/tag-page.internal.mjs +59 -0
  98. package/dist/plugins/blog/client/components/pages/tag-page.mjs +37 -0
  99. package/dist/plugins/blog/client/components/shared/better-blog-attribution.cjs +24 -0
  100. package/dist/plugins/blog/client/components/shared/better-blog-attribution.mjs +22 -0
  101. package/dist/plugins/blog/client/components/shared/default-error.cjs +18 -0
  102. package/dist/plugins/blog/client/components/shared/default-error.mjs +16 -0
  103. package/dist/plugins/blog/client/components/shared/defaults.cjs +13 -0
  104. package/dist/plugins/blog/client/components/shared/defaults.mjs +10 -0
  105. package/dist/plugins/blog/client/components/shared/empty-list.cjs +21 -0
  106. package/dist/plugins/blog/client/components/shared/empty-list.mjs +19 -0
  107. package/dist/plugins/blog/client/components/shared/error-placeholder.cjs +24 -0
  108. package/dist/plugins/blog/client/components/shared/error-placeholder.mjs +22 -0
  109. package/dist/plugins/blog/client/components/shared/highlight-text.cjs +53 -0
  110. package/dist/plugins/blog/client/components/shared/highlight-text.mjs +51 -0
  111. package/dist/plugins/blog/client/components/shared/markdown-content-styles.css +328 -0
  112. package/dist/plugins/blog/client/components/shared/markdown-content.cjs +324 -0
  113. package/dist/plugins/blog/client/components/shared/markdown-content.mjs +315 -0
  114. package/dist/plugins/blog/client/components/shared/on-this-page.cjs +161 -0
  115. package/dist/plugins/blog/client/components/shared/on-this-page.mjs +158 -0
  116. package/dist/plugins/blog/client/components/shared/page-header.cjs +40 -0
  117. package/dist/plugins/blog/client/components/shared/page-header.mjs +38 -0
  118. package/dist/plugins/blog/client/components/shared/page-layout.cjs +24 -0
  119. package/dist/plugins/blog/client/components/shared/page-layout.mjs +22 -0
  120. package/dist/plugins/blog/client/components/shared/page-wrapper.cjs +23 -0
  121. package/dist/plugins/blog/client/components/shared/page-wrapper.mjs +21 -0
  122. package/dist/plugins/blog/client/components/shared/post-card.cjs +279 -0
  123. package/dist/plugins/blog/client/components/shared/post-card.mjs +277 -0
  124. package/dist/plugins/blog/client/components/shared/post-navigation.cjs +74 -0
  125. package/dist/plugins/blog/client/components/shared/post-navigation.mjs +72 -0
  126. package/dist/plugins/blog/client/components/shared/posts-list.cjs +48 -0
  127. package/dist/plugins/blog/client/components/shared/posts-list.mjs +46 -0
  128. package/dist/plugins/blog/client/components/shared/recent-posts-carousel.cjs +59 -0
  129. package/dist/plugins/blog/client/components/shared/recent-posts-carousel.mjs +57 -0
  130. package/dist/plugins/blog/client/components/shared/search-input.cjs +136 -0
  131. package/dist/plugins/blog/client/components/shared/search-input.mjs +117 -0
  132. package/dist/plugins/blog/client/components/shared/search-modal.cjs +135 -0
  133. package/dist/plugins/blog/client/components/shared/search-modal.mjs +116 -0
  134. package/dist/plugins/blog/client/components/shared/tags-list.cjs +22 -0
  135. package/dist/plugins/blog/client/components/shared/tags-list.mjs +20 -0
  136. package/dist/plugins/blog/client/components/shared/use-route-lifecycle.cjs +50 -0
  137. package/dist/plugins/blog/client/components/shared/use-route-lifecycle.mjs +48 -0
  138. package/dist/plugins/blog/client/hooks/blog-hooks.cjs +380 -0
  139. package/dist/plugins/blog/client/hooks/blog-hooks.mjs +368 -0
  140. package/dist/plugins/blog/client/hooks/index.cjs +17 -0
  141. package/dist/plugins/blog/client/hooks/index.d.cts +150 -0
  142. package/dist/plugins/blog/client/hooks/index.d.mts +150 -0
  143. package/dist/plugins/blog/client/hooks/index.d.ts +150 -0
  144. package/dist/plugins/blog/client/hooks/index.mjs +1 -0
  145. package/dist/plugins/blog/client/hooks/use-debounce.cjs +16 -0
  146. package/dist/plugins/blog/client/hooks/use-debounce.mjs +14 -0
  147. package/dist/plugins/blog/client/index.cjs +7 -0
  148. package/dist/plugins/blog/client/index.d.cts +414 -0
  149. package/dist/plugins/blog/client/index.d.mts +414 -0
  150. package/dist/plugins/blog/client/index.d.ts +414 -0
  151. package/dist/plugins/blog/client/index.mjs +1 -0
  152. package/dist/plugins/blog/client/localization/blog-card.cjs +7 -0
  153. package/dist/plugins/blog/client/localization/blog-card.mjs +5 -0
  154. package/dist/plugins/blog/client/localization/blog-common.cjs +10 -0
  155. package/dist/plugins/blog/client/localization/blog-common.mjs +8 -0
  156. package/dist/plugins/blog/client/localization/blog-forms.cjs +40 -0
  157. package/dist/plugins/blog/client/localization/blog-forms.mjs +38 -0
  158. package/dist/plugins/blog/client/localization/blog-list.cjs +18 -0
  159. package/dist/plugins/blog/client/localization/blog-list.mjs +16 -0
  160. package/dist/plugins/blog/client/localization/blog-post.cjs +13 -0
  161. package/dist/plugins/blog/client/localization/blog-post.mjs +11 -0
  162. package/dist/plugins/blog/client/localization/index.cjs +17 -0
  163. package/dist/plugins/blog/client/localization/index.mjs +15 -0
  164. package/dist/plugins/blog/client/plugin.cjs +462 -0
  165. package/dist/plugins/blog/client/plugin.mjs +460 -0
  166. package/dist/plugins/blog/client.css +3 -0
  167. package/dist/plugins/blog/db.cjs +90 -0
  168. package/dist/plugins/blog/db.mjs +88 -0
  169. package/dist/plugins/blog/query-keys.cjs +181 -0
  170. package/dist/plugins/blog/query-keys.d.cts +530 -0
  171. package/dist/plugins/blog/query-keys.d.mts +530 -0
  172. package/dist/plugins/blog/query-keys.d.ts +530 -0
  173. package/dist/plugins/blog/query-keys.mjs +179 -0
  174. package/dist/plugins/blog/schemas.cjs +39 -0
  175. package/dist/plugins/blog/schemas.mjs +35 -0
  176. package/dist/plugins/blog/style.css +22 -0
  177. package/dist/plugins/blog/utils.cjs +97 -0
  178. package/dist/plugins/blog/utils.mjs +87 -0
  179. package/dist/plugins/client/index.cjs +15 -0
  180. package/dist/plugins/client/index.d.cts +57 -0
  181. package/dist/plugins/client/index.d.mts +57 -0
  182. package/dist/plugins/client/index.d.ts +57 -0
  183. package/dist/plugins/client/index.mjs +9 -0
  184. package/dist/{shared/stack.3OUyGp_E.mjs → plugins/utils.mjs} +1 -1
  185. package/dist/shared/{stack.DORw_1ps.d.cts → stack.ByOugz9d.d.cts} +17 -1
  186. package/dist/shared/{stack.DORw_1ps.d.mts → stack.ByOugz9d.d.mts} +17 -1
  187. package/dist/shared/{stack.DORw_1ps.d.ts → stack.ByOugz9d.d.ts} +17 -1
  188. package/dist/shared/stack.CoPoHVfV.d.cts +76 -0
  189. package/dist/shared/stack.CoPoHVfV.d.mts +76 -0
  190. package/dist/shared/stack.CoPoHVfV.d.ts +76 -0
  191. package/package.json +102 -14
  192. package/src/__tests__/plugins.test.tsx +539 -0
  193. package/src/__tests__/sitemap.test.ts +60 -0
  194. package/src/api/index.ts +75 -0
  195. package/src/client/components/compose.tsx +116 -0
  196. package/src/client/components/error-boundary.tsx +30 -0
  197. package/src/client/components/index.tsx +2 -0
  198. package/src/client/index.ts +109 -0
  199. package/src/client/meta-utils.ts +228 -0
  200. package/src/client/path-utils.ts +38 -0
  201. package/src/client/sitemap-utils.ts +46 -0
  202. package/src/context/index.ts +1 -0
  203. package/src/context/provider.tsx +157 -0
  204. package/src/index.ts +1 -0
  205. package/src/plugins/api/index.ts +50 -0
  206. package/src/plugins/blog/api/index.ts +2 -0
  207. package/src/plugins/blog/api/plugin.ts +759 -0
  208. package/src/plugins/blog/client/components/forms/image-field.tsx +165 -0
  209. package/src/plugins/blog/client/components/forms/markdown-editor-styles.css +30 -0
  210. package/src/plugins/blog/client/components/forms/markdown-editor.tsx +136 -0
  211. package/src/plugins/blog/client/components/forms/post-forms.tsx +531 -0
  212. package/src/plugins/blog/client/components/forms/tags-multiselect.tsx +79 -0
  213. package/src/plugins/blog/client/components/index.tsx +11 -0
  214. package/src/plugins/blog/client/components/loading/form-page-skeleton.tsx +75 -0
  215. package/src/plugins/blog/client/components/loading/index.tsx +27 -0
  216. package/src/plugins/blog/client/components/loading/list-page-skeleton.tsx +38 -0
  217. package/src/plugins/blog/client/components/loading/page-header-skeleton.tsx +10 -0
  218. package/src/plugins/blog/client/components/loading/post-card-skeleton.tsx +30 -0
  219. package/src/plugins/blog/client/components/loading/post-page-skeleton.tsx +75 -0
  220. package/src/plugins/blog/client/components/pages/404-page.tsx +23 -0
  221. package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +60 -0
  222. package/src/plugins/blog/client/components/pages/edit-post-page.tsx +40 -0
  223. package/src/plugins/blog/client/components/pages/home-page.internal.tsx +71 -0
  224. package/src/plugins/blog/client/components/pages/home-page.tsx +42 -0
  225. package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +59 -0
  226. package/src/plugins/blog/client/components/pages/new-post-page.tsx +36 -0
  227. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +142 -0
  228. package/src/plugins/blog/client/components/pages/post-page.tsx +38 -0
  229. package/src/plugins/blog/client/components/pages/tag-page.internal.tsx +74 -0
  230. package/src/plugins/blog/client/components/pages/tag-page.tsx +38 -0
  231. package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +19 -0
  232. package/src/plugins/blog/client/components/shared/default-error.tsx +20 -0
  233. package/src/plugins/blog/client/components/shared/defaults.tsx +9 -0
  234. package/src/plugins/blog/client/components/shared/empty-list.tsx +25 -0
  235. package/src/plugins/blog/client/components/shared/error-placeholder.tsx +20 -0
  236. package/src/plugins/blog/client/components/shared/highlight-text.tsx +80 -0
  237. package/src/plugins/blog/client/components/shared/markdown-content-styles.css +328 -0
  238. package/src/plugins/blog/client/components/shared/markdown-content.tsx +448 -0
  239. package/src/plugins/blog/client/components/shared/on-this-page.tsx +234 -0
  240. package/src/plugins/blog/client/components/shared/page-header.tsx +35 -0
  241. package/src/plugins/blog/client/components/shared/page-layout.tsx +23 -0
  242. package/src/plugins/blog/client/components/shared/page-wrapper.tsx +32 -0
  243. package/src/plugins/blog/client/components/shared/post-card.tsx +308 -0
  244. package/src/plugins/blog/client/components/shared/post-navigation.tsx +98 -0
  245. package/src/plugins/blog/client/components/shared/posts-list.tsx +67 -0
  246. package/src/plugins/blog/client/components/shared/recent-posts-carousel.tsx +79 -0
  247. package/src/plugins/blog/client/components/shared/search-input.tsx +146 -0
  248. package/src/plugins/blog/client/components/shared/search-modal.tsx +162 -0
  249. package/src/plugins/blog/client/components/shared/tags-list.tsx +34 -0
  250. package/src/plugins/blog/client/components/shared/use-route-lifecycle.tsx +68 -0
  251. package/src/plugins/blog/client/hooks/blog-hooks.tsx +623 -0
  252. package/src/plugins/blog/client/hooks/index.tsx +1 -0
  253. package/src/plugins/blog/client/hooks/use-debounce.ts +43 -0
  254. package/src/plugins/blog/client/index.ts +9 -0
  255. package/src/plugins/blog/client/localization/blog-card.ts +3 -0
  256. package/src/plugins/blog/client/localization/blog-common.ts +7 -0
  257. package/src/plugins/blog/client/localization/blog-forms.ts +45 -0
  258. package/src/plugins/blog/client/localization/blog-list.ts +14 -0
  259. package/src/plugins/blog/client/localization/blog-post.ts +9 -0
  260. package/src/plugins/blog/client/localization/index.ts +15 -0
  261. package/src/plugins/blog/client/overrides.ts +123 -0
  262. package/src/plugins/blog/client/plugin.tsx +672 -0
  263. package/src/plugins/blog/client.css +3 -0
  264. package/src/plugins/blog/db.ts +90 -0
  265. package/src/plugins/blog/query-keys.ts +267 -0
  266. package/src/plugins/blog/schemas.ts +39 -0
  267. package/src/plugins/blog/style.css +22 -0
  268. package/src/plugins/blog/types.ts +37 -0
  269. package/src/plugins/blog/utils.ts +144 -0
  270. package/src/plugins/client/index.ts +53 -0
  271. package/src/plugins/index.ts +0 -0
  272. package/src/plugins/utils.ts +35 -0
  273. package/src/types.ts +209 -0
  274. package/dist/plugins/index.cjs +0 -15
  275. package/dist/plugins/index.d.cts +0 -64
  276. package/dist/plugins/index.d.mts +0 -64
  277. package/dist/plugins/index.d.ts +0 -64
  278. package/dist/plugins/index.mjs +0 -11
  279. package/dist/shared/stack.DrUAVfIH.d.cts +0 -17
  280. package/dist/shared/stack.DrUAVfIH.d.mts +0 -17
  281. package/dist/shared/stack.DrUAVfIH.d.ts +0 -17
  282. /package/dist/{shared/stack.CktCg4PJ.cjs → plugins/utils.cjs} +0 -0
@@ -0,0 +1,38 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ function PageHeader({
4
+ title,
5
+ description,
6
+ childrenTop,
7
+ childrenBottom
8
+ }) {
9
+ return /* @__PURE__ */ jsxs(
10
+ "div",
11
+ {
12
+ className: "flex max-w-2xl flex-col items-center lg:gap-4 gap-2 text-center wrap-anywhere",
13
+ "data-testid": "page-header",
14
+ children: [
15
+ childrenTop,
16
+ /* @__PURE__ */ jsx(
17
+ "h1",
18
+ {
19
+ className: "font-medium font-sans lg:text-6xl text-4xl tracking-tight",
20
+ "data-testid": "page-title",
21
+ children: title
22
+ }
23
+ ),
24
+ description && /* @__PURE__ */ jsx(
25
+ "p",
26
+ {
27
+ className: "text-muted-foreground wrap-anywhere",
28
+ "data-testid": "page-description",
29
+ children: description
30
+ }
31
+ ),
32
+ childrenBottom
33
+ ]
34
+ }
35
+ );
36
+ }
37
+
38
+ export { PageHeader };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const utils = require('../../../utils.cjs');
5
+
6
+ function PageLayout({
7
+ children,
8
+ className,
9
+ "data-testid": dataTestId
10
+ }) {
11
+ return /* @__PURE__ */ jsxRuntime.jsx(
12
+ "div",
13
+ {
14
+ className: utils.cn(
15
+ "container mx-auto flex min-h-dvh flex-col items-center gap-12 px-4 py-18 lg:px-16",
16
+ className
17
+ ),
18
+ "data-testid": dataTestId,
19
+ children
20
+ }
21
+ );
22
+ }
23
+
24
+ exports.PageLayout = PageLayout;
@@ -0,0 +1,22 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../../../utils.mjs';
3
+
4
+ function PageLayout({
5
+ children,
6
+ className,
7
+ "data-testid": dataTestId
8
+ }) {
9
+ return /* @__PURE__ */ jsx(
10
+ "div",
11
+ {
12
+ className: cn(
13
+ "container mx-auto flex min-h-dvh flex-col items-center gap-12 px-4 py-18 lg:px-16",
14
+ className
15
+ ),
16
+ "data-testid": dataTestId,
17
+ children
18
+ }
19
+ );
20
+ }
21
+
22
+ export { PageLayout };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const context = require('@btst/stack/context');
6
+ const betterBlogAttribution = require('./better-blog-attribution.cjs');
7
+ const pageLayout = require('./page-layout.cjs');
8
+
9
+ function PageWrapper({
10
+ children,
11
+ className,
12
+ testId
13
+ }) {
14
+ const { showAttribution } = context.usePluginOverrides("blog", {
15
+ showAttribution: true
16
+ });
17
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18
+ /* @__PURE__ */ jsxRuntime.jsx(pageLayout.PageLayout, { className, "data-testid": testId, children }),
19
+ showAttribution && /* @__PURE__ */ jsxRuntime.jsx(betterBlogAttribution.BetterBlogAttribution, {})
20
+ ] });
21
+ }
22
+
23
+ exports.PageWrapper = PageWrapper;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { usePluginOverrides } from '@btst/stack/context';
4
+ import { BetterBlogAttribution } from './better-blog-attribution.mjs';
5
+ import { PageLayout } from './page-layout.mjs';
6
+
7
+ function PageWrapper({
8
+ children,
9
+ className,
10
+ testId
11
+ }) {
12
+ const { showAttribution } = usePluginOverrides("blog", {
13
+ showAttribution: true
14
+ });
15
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ /* @__PURE__ */ jsx(PageLayout, { className, "data-testid": testId, children }),
17
+ showAttribution && /* @__PURE__ */ jsx(BetterBlogAttribution, {})
18
+ ] });
19
+ }
20
+
21
+ export { PageWrapper };
@@ -0,0 +1,279 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const badge = require('@workspace/ui/components/badge');
6
+ const card = require('@workspace/ui/components/card');
7
+ const context = require('@btst/stack/context');
8
+ const dateFns = require('date-fns');
9
+ const lucideReact = require('lucide-react');
10
+ const index = require('../../localization/index.cjs');
11
+ const defaults = require('./defaults.cjs');
12
+
13
+ const GRADIENT_PALETTES = [
14
+ {
15
+ from: "from-purple-500",
16
+ via: "via-pink-500",
17
+ to: "to-orange-500",
18
+ overlay: "from-blue-600/50"
19
+ },
20
+ {
21
+ from: "from-blue-500",
22
+ via: "via-cyan-500",
23
+ to: "to-teal-500",
24
+ overlay: "from-indigo-600/50"
25
+ },
26
+ {
27
+ from: "from-pink-500",
28
+ via: "via-rose-500",
29
+ to: "to-orange-500",
30
+ overlay: "from-purple-600/50"
31
+ },
32
+ {
33
+ from: "from-green-500",
34
+ via: "via-emerald-500",
35
+ to: "to-teal-500",
36
+ overlay: "from-cyan-600/50"
37
+ },
38
+ {
39
+ from: "from-indigo-500",
40
+ via: "via-purple-500",
41
+ to: "to-pink-500",
42
+ overlay: "from-violet-600/50"
43
+ },
44
+ {
45
+ from: "from-orange-500",
46
+ via: "via-amber-500",
47
+ to: "to-yellow-500",
48
+ overlay: "from-orange-600/50"
49
+ },
50
+ {
51
+ from: "from-cyan-500",
52
+ via: "via-blue-500",
53
+ to: "to-indigo-500",
54
+ overlay: "from-purple-600/50"
55
+ },
56
+ {
57
+ from: "from-violet-500",
58
+ via: "via-purple-500",
59
+ to: "to-fuchsia-500",
60
+ overlay: "from-pink-600/50"
61
+ },
62
+ {
63
+ from: "from-emerald-500",
64
+ via: "via-green-500",
65
+ to: "to-lime-500",
66
+ overlay: "from-teal-600/50"
67
+ },
68
+ {
69
+ from: "from-rose-500",
70
+ via: "via-pink-500",
71
+ to: "to-fuchsia-500",
72
+ overlay: "from-purple-600/50"
73
+ },
74
+ {
75
+ from: "from-sky-500",
76
+ via: "via-blue-500",
77
+ to: "to-indigo-600",
78
+ overlay: "from-purple-700/40"
79
+ },
80
+ {
81
+ from: "from-fuchsia-600",
82
+ via: "via-purple-600",
83
+ to: "to-indigo-600",
84
+ overlay: "from-pink-700/40"
85
+ },
86
+ {
87
+ from: "from-teal-500",
88
+ via: "via-emerald-500",
89
+ to: "to-green-600",
90
+ overlay: "from-cyan-700/40"
91
+ },
92
+ {
93
+ from: "from-amber-500",
94
+ via: "via-orange-500",
95
+ to: "to-pink-500",
96
+ overlay: "from-yellow-600/40"
97
+ },
98
+ {
99
+ from: "from-indigo-600",
100
+ via: "via-blue-600",
101
+ to: "to-purple-600",
102
+ overlay: "from-violet-700/40"
103
+ },
104
+ {
105
+ from: "from-pink-600",
106
+ via: "via-rose-600",
107
+ to: "to-orange-600",
108
+ overlay: "from-fuchsia-700/40"
109
+ },
110
+ {
111
+ from: "from-cyan-600",
112
+ via: "via-teal-600",
113
+ to: "to-emerald-600",
114
+ overlay: "from-blue-700/40"
115
+ },
116
+ {
117
+ from: "from-purple-600",
118
+ via: "via-fuchsia-600",
119
+ to: "to-pink-600",
120
+ overlay: "from-violet-700/40"
121
+ },
122
+ {
123
+ from: "from-blue-600",
124
+ via: "via-indigo-600",
125
+ to: "to-purple-600",
126
+ overlay: "from-cyan-700/40"
127
+ },
128
+ {
129
+ from: "from-green-600",
130
+ via: "via-emerald-600",
131
+ to: "to-teal-600",
132
+ overlay: "from-lime-700/40"
133
+ },
134
+ {
135
+ from: "from-rose-600",
136
+ via: "via-pink-600",
137
+ to: "to-fuchsia-600",
138
+ overlay: "from-pink-700/40"
139
+ },
140
+ {
141
+ from: "from-orange-600",
142
+ via: "via-pink-600",
143
+ to: "to-rose-600",
144
+ overlay: "from-amber-700/40"
145
+ },
146
+ {
147
+ from: "from-violet-600",
148
+ via: "via-purple-600",
149
+ to: "to-fuchsia-600",
150
+ overlay: "from-indigo-700/40"
151
+ },
152
+ {
153
+ from: "from-teal-600",
154
+ via: "via-cyan-600",
155
+ to: "to-blue-600",
156
+ overlay: "from-emerald-700/40"
157
+ },
158
+ {
159
+ from: "from-emerald-600",
160
+ via: "via-teal-600",
161
+ to: "to-cyan-600",
162
+ overlay: "from-green-700/40"
163
+ },
164
+ {
165
+ from: "from-indigo-700",
166
+ via: "via-purple-700",
167
+ to: "to-pink-700",
168
+ overlay: "from-violet-800/30"
169
+ },
170
+ {
171
+ from: "from-blue-700",
172
+ via: "via-cyan-700",
173
+ to: "to-teal-700",
174
+ overlay: "from-indigo-800/30"
175
+ },
176
+ {
177
+ from: "from-purple-700",
178
+ via: "via-fuchsia-700",
179
+ to: "to-pink-700",
180
+ overlay: "from-violet-800/30"
181
+ },
182
+ {
183
+ from: "from-pink-700",
184
+ via: "via-rose-700",
185
+ to: "to-orange-700",
186
+ overlay: "from-fuchsia-800/30"
187
+ },
188
+ {
189
+ from: "from-cyan-700",
190
+ via: "via-blue-700",
191
+ to: "to-indigo-700",
192
+ overlay: "from-teal-800/30"
193
+ }
194
+ ];
195
+ function hashString(str) {
196
+ let hash = 0;
197
+ for (let i = 0; i < str.length; i++) {
198
+ const char = str.charCodeAt(i);
199
+ hash = (hash << 5) - hash + char;
200
+ hash = hash & hash;
201
+ }
202
+ return Math.abs(hash);
203
+ }
204
+ function getGradientFromTitle(title) {
205
+ const hash = hashString(title);
206
+ const palette = GRADIENT_PALETTES[hash % GRADIENT_PALETTES.length];
207
+ return palette;
208
+ }
209
+ function PostCard({ post }) {
210
+ const { Link, Image } = context.usePluginOverrides("blog", {
211
+ Link: defaults.DefaultLink,
212
+ Image: defaults.DefaultImage
213
+ });
214
+ const { localization } = context.usePluginOverrides("blog", {
215
+ localization: index.BLOG_LOCALIZATION
216
+ });
217
+ const basePath = context.useBasePath();
218
+ const blogPath = `${basePath}/blog/${post.slug}`;
219
+ const postDate = dateFns.formatDate(
220
+ post.publishedAt || post.createdAt,
221
+ "MMMM d, yyyy"
222
+ );
223
+ const gradient = post.image ? null : getGradientFromTitle(post.title);
224
+ return /* @__PURE__ */ jsxRuntime.jsxs(card.Card, { className: "group relative flex h-full flex-col gap-4 pt-0! pb-4! transition-shadow duration-200 hover:shadow-lg", children: [
225
+ /* @__PURE__ */ jsxRuntime.jsx(
226
+ Link,
227
+ {
228
+ href: blogPath,
229
+ className: "relative block h-48 w-full overflow-hidden rounded-t-xl bg-muted",
230
+ "aria-label": post.title,
231
+ children: post.image ? /* @__PURE__ */ jsxRuntime.jsx(
232
+ Image,
233
+ {
234
+ src: post.image,
235
+ alt: post.title,
236
+ className: "h-full w-full object-cover transition-transform duration-200 group-hover:scale-105",
237
+ width: 500,
238
+ height: 300
239
+ }
240
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-full w-full overflow-hidden transition-transform duration-200 group-hover:scale-105", children: [
241
+ /* @__PURE__ */ jsxRuntime.jsx(
242
+ "div",
243
+ {
244
+ className: `absolute inset-0 bg-linear-to-br ${gradient.from} ${gradient.via} ${gradient.to}`
245
+ }
246
+ ),
247
+ /* @__PURE__ */ jsxRuntime.jsx(
248
+ "div",
249
+ {
250
+ className: `absolute inset-0 bg-linear-to-tr ${gradient.overlay} via-transparent to-transparent`
251
+ }
252
+ ),
253
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-10 flex h-full w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-center text-xl font-bold leading-tight text-white drop-shadow-lg line-clamp-3", children: post.title }) })
254
+ ] })
255
+ }
256
+ ),
257
+ !post.published && /* @__PURE__ */ jsxRuntime.jsx(badge.Badge, { variant: "destructive", className: "absolute top-2 left-2 text-xs", children: localization.BLOG_CARD_DRAFT_BADGE }),
258
+ /* @__PURE__ */ jsxRuntime.jsxs(
259
+ Link,
260
+ {
261
+ href: blogPath,
262
+ "aria-label": `${post.title}`,
263
+ className: "block focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 grow",
264
+ children: [
265
+ /* @__PURE__ */ jsxRuntime.jsx(card.CardHeader, { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(card.CardTitle, { className: "line-clamp-3 text-lg leading-tight transition-colors group-hover:underline", children: post.title }) }),
266
+ /* @__PURE__ */ jsxRuntime.jsx(card.CardContent, { className: "flex flex-1 flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
267
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground text-xs", children: [
268
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "h-3 w-3" }),
269
+ /* @__PURE__ */ jsxRuntime.jsx("time", { dateTime: postDate, children: postDate })
270
+ ] }),
271
+ post.tags && post.tags.length > 0 && post.tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx(badge.Badge, { variant: "secondary", className: "text-xs", children: tag.name }, tag.id))
272
+ ] }) })
273
+ ]
274
+ }
275
+ )
276
+ ] });
277
+ }
278
+
279
+ exports.PostCard = PostCard;
@@ -0,0 +1,277 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { Badge } from '@workspace/ui/components/badge';
4
+ import { Card, CardHeader, CardTitle, CardContent } from '@workspace/ui/components/card';
5
+ import { usePluginOverrides, useBasePath } from '@btst/stack/context';
6
+ import { formatDate } from 'date-fns';
7
+ import { CalendarIcon } from 'lucide-react';
8
+ import { BLOG_LOCALIZATION } from '../../localization/index.mjs';
9
+ import { DefaultImage, DefaultLink } from './defaults.mjs';
10
+
11
+ const GRADIENT_PALETTES = [
12
+ {
13
+ from: "from-purple-500",
14
+ via: "via-pink-500",
15
+ to: "to-orange-500",
16
+ overlay: "from-blue-600/50"
17
+ },
18
+ {
19
+ from: "from-blue-500",
20
+ via: "via-cyan-500",
21
+ to: "to-teal-500",
22
+ overlay: "from-indigo-600/50"
23
+ },
24
+ {
25
+ from: "from-pink-500",
26
+ via: "via-rose-500",
27
+ to: "to-orange-500",
28
+ overlay: "from-purple-600/50"
29
+ },
30
+ {
31
+ from: "from-green-500",
32
+ via: "via-emerald-500",
33
+ to: "to-teal-500",
34
+ overlay: "from-cyan-600/50"
35
+ },
36
+ {
37
+ from: "from-indigo-500",
38
+ via: "via-purple-500",
39
+ to: "to-pink-500",
40
+ overlay: "from-violet-600/50"
41
+ },
42
+ {
43
+ from: "from-orange-500",
44
+ via: "via-amber-500",
45
+ to: "to-yellow-500",
46
+ overlay: "from-orange-600/50"
47
+ },
48
+ {
49
+ from: "from-cyan-500",
50
+ via: "via-blue-500",
51
+ to: "to-indigo-500",
52
+ overlay: "from-purple-600/50"
53
+ },
54
+ {
55
+ from: "from-violet-500",
56
+ via: "via-purple-500",
57
+ to: "to-fuchsia-500",
58
+ overlay: "from-pink-600/50"
59
+ },
60
+ {
61
+ from: "from-emerald-500",
62
+ via: "via-green-500",
63
+ to: "to-lime-500",
64
+ overlay: "from-teal-600/50"
65
+ },
66
+ {
67
+ from: "from-rose-500",
68
+ via: "via-pink-500",
69
+ to: "to-fuchsia-500",
70
+ overlay: "from-purple-600/50"
71
+ },
72
+ {
73
+ from: "from-sky-500",
74
+ via: "via-blue-500",
75
+ to: "to-indigo-600",
76
+ overlay: "from-purple-700/40"
77
+ },
78
+ {
79
+ from: "from-fuchsia-600",
80
+ via: "via-purple-600",
81
+ to: "to-indigo-600",
82
+ overlay: "from-pink-700/40"
83
+ },
84
+ {
85
+ from: "from-teal-500",
86
+ via: "via-emerald-500",
87
+ to: "to-green-600",
88
+ overlay: "from-cyan-700/40"
89
+ },
90
+ {
91
+ from: "from-amber-500",
92
+ via: "via-orange-500",
93
+ to: "to-pink-500",
94
+ overlay: "from-yellow-600/40"
95
+ },
96
+ {
97
+ from: "from-indigo-600",
98
+ via: "via-blue-600",
99
+ to: "to-purple-600",
100
+ overlay: "from-violet-700/40"
101
+ },
102
+ {
103
+ from: "from-pink-600",
104
+ via: "via-rose-600",
105
+ to: "to-orange-600",
106
+ overlay: "from-fuchsia-700/40"
107
+ },
108
+ {
109
+ from: "from-cyan-600",
110
+ via: "via-teal-600",
111
+ to: "to-emerald-600",
112
+ overlay: "from-blue-700/40"
113
+ },
114
+ {
115
+ from: "from-purple-600",
116
+ via: "via-fuchsia-600",
117
+ to: "to-pink-600",
118
+ overlay: "from-violet-700/40"
119
+ },
120
+ {
121
+ from: "from-blue-600",
122
+ via: "via-indigo-600",
123
+ to: "to-purple-600",
124
+ overlay: "from-cyan-700/40"
125
+ },
126
+ {
127
+ from: "from-green-600",
128
+ via: "via-emerald-600",
129
+ to: "to-teal-600",
130
+ overlay: "from-lime-700/40"
131
+ },
132
+ {
133
+ from: "from-rose-600",
134
+ via: "via-pink-600",
135
+ to: "to-fuchsia-600",
136
+ overlay: "from-pink-700/40"
137
+ },
138
+ {
139
+ from: "from-orange-600",
140
+ via: "via-pink-600",
141
+ to: "to-rose-600",
142
+ overlay: "from-amber-700/40"
143
+ },
144
+ {
145
+ from: "from-violet-600",
146
+ via: "via-purple-600",
147
+ to: "to-fuchsia-600",
148
+ overlay: "from-indigo-700/40"
149
+ },
150
+ {
151
+ from: "from-teal-600",
152
+ via: "via-cyan-600",
153
+ to: "to-blue-600",
154
+ overlay: "from-emerald-700/40"
155
+ },
156
+ {
157
+ from: "from-emerald-600",
158
+ via: "via-teal-600",
159
+ to: "to-cyan-600",
160
+ overlay: "from-green-700/40"
161
+ },
162
+ {
163
+ from: "from-indigo-700",
164
+ via: "via-purple-700",
165
+ to: "to-pink-700",
166
+ overlay: "from-violet-800/30"
167
+ },
168
+ {
169
+ from: "from-blue-700",
170
+ via: "via-cyan-700",
171
+ to: "to-teal-700",
172
+ overlay: "from-indigo-800/30"
173
+ },
174
+ {
175
+ from: "from-purple-700",
176
+ via: "via-fuchsia-700",
177
+ to: "to-pink-700",
178
+ overlay: "from-violet-800/30"
179
+ },
180
+ {
181
+ from: "from-pink-700",
182
+ via: "via-rose-700",
183
+ to: "to-orange-700",
184
+ overlay: "from-fuchsia-800/30"
185
+ },
186
+ {
187
+ from: "from-cyan-700",
188
+ via: "via-blue-700",
189
+ to: "to-indigo-700",
190
+ overlay: "from-teal-800/30"
191
+ }
192
+ ];
193
+ function hashString(str) {
194
+ let hash = 0;
195
+ for (let i = 0; i < str.length; i++) {
196
+ const char = str.charCodeAt(i);
197
+ hash = (hash << 5) - hash + char;
198
+ hash = hash & hash;
199
+ }
200
+ return Math.abs(hash);
201
+ }
202
+ function getGradientFromTitle(title) {
203
+ const hash = hashString(title);
204
+ const palette = GRADIENT_PALETTES[hash % GRADIENT_PALETTES.length];
205
+ return palette;
206
+ }
207
+ function PostCard({ post }) {
208
+ const { Link, Image } = usePluginOverrides("blog", {
209
+ Link: DefaultLink,
210
+ Image: DefaultImage
211
+ });
212
+ const { localization } = usePluginOverrides("blog", {
213
+ localization: BLOG_LOCALIZATION
214
+ });
215
+ const basePath = useBasePath();
216
+ const blogPath = `${basePath}/blog/${post.slug}`;
217
+ const postDate = formatDate(
218
+ post.publishedAt || post.createdAt,
219
+ "MMMM d, yyyy"
220
+ );
221
+ const gradient = post.image ? null : getGradientFromTitle(post.title);
222
+ return /* @__PURE__ */ jsxs(Card, { className: "group relative flex h-full flex-col gap-4 pt-0! pb-4! transition-shadow duration-200 hover:shadow-lg", children: [
223
+ /* @__PURE__ */ jsx(
224
+ Link,
225
+ {
226
+ href: blogPath,
227
+ className: "relative block h-48 w-full overflow-hidden rounded-t-xl bg-muted",
228
+ "aria-label": post.title,
229
+ children: post.image ? /* @__PURE__ */ jsx(
230
+ Image,
231
+ {
232
+ src: post.image,
233
+ alt: post.title,
234
+ className: "h-full w-full object-cover transition-transform duration-200 group-hover:scale-105",
235
+ width: 500,
236
+ height: 300
237
+ }
238
+ ) : /* @__PURE__ */ jsxs("div", { className: "relative h-full w-full overflow-hidden transition-transform duration-200 group-hover:scale-105", children: [
239
+ /* @__PURE__ */ jsx(
240
+ "div",
241
+ {
242
+ className: `absolute inset-0 bg-linear-to-br ${gradient.from} ${gradient.via} ${gradient.to}`
243
+ }
244
+ ),
245
+ /* @__PURE__ */ jsx(
246
+ "div",
247
+ {
248
+ className: `absolute inset-0 bg-linear-to-tr ${gradient.overlay} via-transparent to-transparent`
249
+ }
250
+ ),
251
+ /* @__PURE__ */ jsx("div", { className: "relative z-10 flex h-full w-full items-center justify-center p-6", children: /* @__PURE__ */ jsx("h3", { className: "text-center text-xl font-bold leading-tight text-white drop-shadow-lg line-clamp-3", children: post.title }) })
252
+ ] })
253
+ }
254
+ ),
255
+ !post.published && /* @__PURE__ */ jsx(Badge, { variant: "destructive", className: "absolute top-2 left-2 text-xs", children: localization.BLOG_CARD_DRAFT_BADGE }),
256
+ /* @__PURE__ */ jsxs(
257
+ Link,
258
+ {
259
+ href: blogPath,
260
+ "aria-label": `${post.title}`,
261
+ className: "block focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 grow",
262
+ children: [
263
+ /* @__PURE__ */ jsx(CardHeader, { className: "flex-1", children: /* @__PURE__ */ jsx(CardTitle, { className: "line-clamp-3 text-lg leading-tight transition-colors group-hover:underline", children: post.title }) }),
264
+ /* @__PURE__ */ jsx(CardContent, { className: "flex flex-1 flex-col gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
265
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground text-xs", children: [
266
+ /* @__PURE__ */ jsx(CalendarIcon, { className: "h-3 w-3" }),
267
+ /* @__PURE__ */ jsx("time", { dateTime: postDate, children: postDate })
268
+ ] }),
269
+ post.tags && post.tags.length > 0 && post.tags.map((tag) => /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: tag.name }, tag.id))
270
+ ] }) })
271
+ ]
272
+ }
273
+ )
274
+ ] });
275
+ }
276
+
277
+ export { PostCard };