@byline/cli 0.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 (251) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +23 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +72 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/doctor.d.ts +2 -0
  8. package/dist/commands/doctor.d.ts.map +1 -0
  9. package/dist/commands/doctor.js +36 -0
  10. package/dist/commands/doctor.js.map +1 -0
  11. package/dist/commands/init.d.ts +16 -0
  12. package/dist/commands/init.d.ts.map +1 -0
  13. package/dist/commands/init.js +76 -0
  14. package/dist/commands/init.js.map +1 -0
  15. package/dist/context.d.ts +38 -0
  16. package/dist/context.d.ts.map +1 -0
  17. package/dist/context.js +37 -0
  18. package/dist/context.js.map +1 -0
  19. package/dist/index.d.ts +5 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +4 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/lib/pg-url.d.ts +11 -0
  24. package/dist/lib/pg-url.d.ts.map +1 -0
  25. package/dist/lib/pg-url.js +22 -0
  26. package/dist/lib/pg-url.js.map +1 -0
  27. package/dist/manifest/deps.d.ts +29 -0
  28. package/dist/manifest/deps.d.ts.map +1 -0
  29. package/dist/manifest/deps.js +97 -0
  30. package/dist/manifest/deps.js.map +1 -0
  31. package/dist/manifest/env.d.ts +18 -0
  32. package/dist/manifest/env.d.ts.map +1 -0
  33. package/dist/manifest/env.js +38 -0
  34. package/dist/manifest/env.js.map +1 -0
  35. package/dist/phases/db-init.d.ts +3 -0
  36. package/dist/phases/db-init.d.ts.map +1 -0
  37. package/dist/phases/db-init.js +163 -0
  38. package/dist/phases/db-init.js.map +1 -0
  39. package/dist/phases/db.d.ts +11 -0
  40. package/dist/phases/db.d.ts.map +1 -0
  41. package/dist/phases/db.js +93 -0
  42. package/dist/phases/db.js.map +1 -0
  43. package/dist/phases/deps.d.ts +3 -0
  44. package/dist/phases/deps.d.ts.map +1 -0
  45. package/dist/phases/deps.js +115 -0
  46. package/dist/phases/deps.js.map +1 -0
  47. package/dist/phases/env.d.ts +3 -0
  48. package/dist/phases/env.d.ts.map +1 -0
  49. package/dist/phases/env.js +172 -0
  50. package/dist/phases/env.js.map +1 -0
  51. package/dist/phases/host.d.ts +3 -0
  52. package/dist/phases/host.d.ts.map +1 -0
  53. package/dist/phases/host.js +99 -0
  54. package/dist/phases/host.js.map +1 -0
  55. package/dist/phases/index.d.ts +7 -0
  56. package/dist/phases/index.d.ts.map +1 -0
  57. package/dist/phases/index.js +40 -0
  58. package/dist/phases/index.js.map +1 -0
  59. package/dist/phases/preflight.d.ts +4 -0
  60. package/dist/phases/preflight.d.ts.map +1 -0
  61. package/dist/phases/preflight.js +81 -0
  62. package/dist/phases/preflight.js.map +1 -0
  63. package/dist/phases/routes.d.ts +3 -0
  64. package/dist/phases/routes.d.ts.map +1 -0
  65. package/dist/phases/routes.js +145 -0
  66. package/dist/phases/routes.js.map +1 -0
  67. package/dist/phases/scaffold.d.ts +3 -0
  68. package/dist/phases/scaffold.d.ts.map +1 -0
  69. package/dist/phases/scaffold.js +113 -0
  70. package/dist/phases/scaffold.js.map +1 -0
  71. package/dist/phases/stub.d.ts +3 -0
  72. package/dist/phases/stub.d.ts.map +1 -0
  73. package/dist/phases/stub.js +25 -0
  74. package/dist/phases/stub.js.map +1 -0
  75. package/dist/phases/ui.d.ts +3 -0
  76. package/dist/phases/ui.d.ts.map +1 -0
  77. package/dist/phases/ui.js +93 -0
  78. package/dist/phases/ui.js.map +1 -0
  79. package/dist/phases/wire/index.d.ts +3 -0
  80. package/dist/phases/wire/index.d.ts.map +1 -0
  81. package/dist/phases/wire/index.js +67 -0
  82. package/dist/phases/wire/index.js.map +1 -0
  83. package/dist/phases/wire/root-tsx.d.ts +3 -0
  84. package/dist/phases/wire/root-tsx.d.ts.map +1 -0
  85. package/dist/phases/wire/root-tsx.js +57 -0
  86. package/dist/phases/wire/root-tsx.js.map +1 -0
  87. package/dist/phases/wire/server-ts.d.ts +3 -0
  88. package/dist/phases/wire/server-ts.d.ts.map +1 -0
  89. package/dist/phases/wire/server-ts.js +54 -0
  90. package/dist/phases/wire/server-ts.js.map +1 -0
  91. package/dist/phases/wire/shared.d.ts +34 -0
  92. package/dist/phases/wire/shared.d.ts.map +1 -0
  93. package/dist/phases/wire/shared.js +2 -0
  94. package/dist/phases/wire/shared.js.map +1 -0
  95. package/dist/phases/wire/start-ts.d.ts +3 -0
  96. package/dist/phases/wire/start-ts.d.ts.map +1 -0
  97. package/dist/phases/wire/start-ts.js +149 -0
  98. package/dist/phases/wire/start-ts.js.map +1 -0
  99. package/dist/phases/wire/tsconfig.d.ts +3 -0
  100. package/dist/phases/wire/tsconfig.d.ts.map +1 -0
  101. package/dist/phases/wire/tsconfig.js +105 -0
  102. package/dist/phases/wire/tsconfig.js.map +1 -0
  103. package/dist/phases/wire/vite-config.d.ts +3 -0
  104. package/dist/phases/wire/vite-config.d.ts.map +1 -0
  105. package/dist/phases/wire/vite-config.js +46 -0
  106. package/dist/phases/wire/vite-config.js.map +1 -0
  107. package/dist/prompts.d.ts +34 -0
  108. package/dist/prompts.d.ts.map +1 -0
  109. package/dist/prompts.js +49 -0
  110. package/dist/prompts.js.map +1 -0
  111. package/dist/runner.d.ts +5 -0
  112. package/dist/runner.d.ts.map +1 -0
  113. package/dist/runner.js +91 -0
  114. package/dist/runner.js.map +1 -0
  115. package/dist/state.d.ts +18 -0
  116. package/dist/state.d.ts.map +1 -0
  117. package/dist/state.js +68 -0
  118. package/dist/state.js.map +1 -0
  119. package/dist/templates/byline/admin.config.ts +41 -0
  120. package/dist/templates/byline/i18n.ts +47 -0
  121. package/dist/templates/byline/routes.ts +28 -0
  122. package/dist/templates/byline/seed.ts +19 -0
  123. package/dist/templates/byline/seeds/admin.ts +62 -0
  124. package/dist/templates/byline/server.config.ts +92 -0
  125. package/dist/templates/byline-examples/admin.config.ts +74 -0
  126. package/dist/templates/byline-examples/blocks/photo-block.ts +59 -0
  127. package/dist/templates/byline-examples/blocks/richtext-block.ts +35 -0
  128. package/dist/templates/byline-examples/collections/doc-example-flat-locale-all.ts +373 -0
  129. package/dist/templates/byline-examples/collections/doc-example-flat-locale-en.ts +283 -0
  130. package/dist/templates/byline-examples/collections/doc-example-tree-locale-all.ts +278 -0
  131. package/dist/templates/byline-examples/collections/doc-example-tree-locale-en.ts +205 -0
  132. package/dist/templates/byline-examples/collections/docs/admin.tsx +204 -0
  133. package/dist/templates/byline-examples/collections/docs/components/.gitkeep +0 -0
  134. package/dist/templates/byline-examples/collections/docs/components/feature-formatter.tsx +10 -0
  135. package/dist/templates/byline-examples/collections/docs/hooks/.gitkeep +0 -0
  136. package/dist/templates/byline-examples/collections/docs/index.ts +10 -0
  137. package/dist/templates/byline-examples/collections/docs/schema.ts +209 -0
  138. package/dist/templates/byline-examples/collections/docs-categories/admin.tsx +78 -0
  139. package/dist/templates/byline-examples/collections/docs-categories/components/.gitkeep +0 -0
  140. package/dist/templates/byline-examples/collections/docs-categories/hooks/.gitkeep +0 -0
  141. package/dist/templates/byline-examples/collections/docs-categories/index.ts +10 -0
  142. package/dist/templates/byline-examples/collections/docs-categories/schema.ts +33 -0
  143. package/dist/templates/byline-examples/collections/media/admin.tsx +188 -0
  144. package/dist/templates/byline-examples/collections/media/components/media-list-view.tsx +330 -0
  145. package/dist/templates/byline-examples/collections/media/components/media-thumbnail.tsx +63 -0
  146. package/dist/templates/byline-examples/collections/media/hooks/.gitkeep +0 -0
  147. package/dist/templates/byline-examples/collections/media/index.ts +10 -0
  148. package/dist/templates/byline-examples/collections/media/schema.ts +157 -0
  149. package/dist/templates/byline-examples/collections/news/admin.tsx +192 -0
  150. package/dist/templates/byline-examples/collections/news/components/.gitkeep +0 -0
  151. package/dist/templates/byline-examples/collections/news/hooks/.gitkeep +0 -0
  152. package/dist/templates/byline-examples/collections/news/index.ts +10 -0
  153. package/dist/templates/byline-examples/collections/news/schema.ts +91 -0
  154. package/dist/templates/byline-examples/collections/news-categories/admin.tsx +78 -0
  155. package/dist/templates/byline-examples/collections/news-categories/components/.gitkeep +0 -0
  156. package/dist/templates/byline-examples/collections/news-categories/hooks/.gitkeep +0 -0
  157. package/dist/templates/byline-examples/collections/news-categories/index.ts +10 -0
  158. package/dist/templates/byline-examples/collections/news-categories/schema.ts +33 -0
  159. package/dist/templates/byline-examples/collections/pages/admin.tsx +183 -0
  160. package/dist/templates/byline-examples/collections/pages/components/.gitkeep +0 -0
  161. package/dist/templates/byline-examples/collections/pages/hooks/.gitkeep +0 -0
  162. package/dist/templates/byline-examples/collections/pages/index.ts +10 -0
  163. package/dist/templates/byline-examples/collections/pages/schema.ts +96 -0
  164. package/dist/templates/byline-examples/components/length-indicator.tsx +138 -0
  165. package/dist/templates/byline-examples/components/pill.tsx +38 -0
  166. package/dist/templates/byline-examples/components/summary-length.tsx +39 -0
  167. package/dist/templates/byline-examples/fields/available-languages-field.ts +90 -0
  168. package/dist/templates/byline-examples/fields/lexical-richtext-compact.ts +88 -0
  169. package/dist/templates/byline-examples/i18n.ts +47 -0
  170. package/dist/templates/byline-examples/routes.ts +28 -0
  171. package/dist/templates/byline-examples/scripts/regenerate-media.ts +275 -0
  172. package/dist/templates/byline-examples/seed.ts +25 -0
  173. package/dist/templates/byline-examples/seeds/admin.ts +62 -0
  174. package/dist/templates/byline-examples/seeds/doc-categories.ts +71 -0
  175. package/dist/templates/byline-examples/seeds/docs.ts +293 -0
  176. package/dist/templates/byline-examples/seeds/news-categories.ts +71 -0
  177. package/dist/templates/byline-examples/server.config.ts +179 -0
  178. package/dist/templates/host/vite.config.ts +41 -0
  179. package/dist/templates/migrations/0000_condemned_kronos.sql +324 -0
  180. package/dist/templates/migrations/0001_sudden_phantom_reporter.sql +1 -0
  181. package/dist/templates/migrations/meta/0000_snapshot.json +2793 -0
  182. package/dist/templates/migrations/meta/0001_snapshot.json +2799 -0
  183. package/dist/templates/migrations/meta/_journal.json +20 -0
  184. package/dist/templates/routes/(byline)/admin/account/index.tsx +11 -0
  185. package/dist/templates/routes/(byline)/admin/collections/$collection/$id/api.tsx +16 -0
  186. package/dist/templates/routes/(byline)/admin/collections/$collection/$id/history.tsx +19 -0
  187. package/dist/templates/routes/(byline)/admin/collections/$collection/$id/index.tsx +16 -0
  188. package/dist/templates/routes/(byline)/admin/collections/$collection/create.tsx +11 -0
  189. package/dist/templates/routes/(byline)/admin/collections/$collection/index.tsx +11 -0
  190. package/dist/templates/routes/(byline)/admin/index.tsx +11 -0
  191. package/dist/templates/routes/(byline)/admin/permissions/index.tsx +11 -0
  192. package/dist/templates/routes/(byline)/admin/roles/$id/index.tsx +11 -0
  193. package/dist/templates/routes/(byline)/admin/roles/index.tsx +11 -0
  194. package/dist/templates/routes/(byline)/admin/route.tsx +11 -0
  195. package/dist/templates/routes/(byline)/admin/users/$id/index.tsx +11 -0
  196. package/dist/templates/routes/(byline)/admin/users/index.tsx +11 -0
  197. package/dist/templates/routes/(byline)/sign-in.tsx +11 -0
  198. package/dist/templates/ui-byline/blocks/photo-block/index.tsx +80 -0
  199. package/dist/templates/ui-byline/blocks/richtext-block/index.tsx +46 -0
  200. package/dist/templates/ui-byline/components/admonition/index.tsx +40 -0
  201. package/dist/templates/ui-byline/components/code/code-serializer.tsx +20 -0
  202. package/dist/templates/ui-byline/components/code/code.tsx +50 -0
  203. package/dist/templates/ui-byline/components/code/index.module.scss +137 -0
  204. package/dist/templates/ui-byline/components/code/index.ts +2 -0
  205. package/dist/templates/ui-byline/components/code/types.ts +5 -0
  206. package/dist/templates/ui-byline/components/code/utils.ts +20 -0
  207. package/dist/templates/ui-byline/components/heading-anchor/heading-anchor.tsx +69 -0
  208. package/dist/templates/ui-byline/components/heading-anchor/index.ts +1 -0
  209. package/dist/templates/ui-byline/components/heading-anchor/utils.ts +15 -0
  210. package/dist/templates/ui-byline/components/inline-image/index.tsx +109 -0
  211. package/dist/templates/ui-byline/components/layout/index.tsx +63 -0
  212. package/dist/templates/ui-byline/components/link/lang-link.tsx +70 -0
  213. package/dist/templates/ui-byline/components/link/link-field.tsx +298 -0
  214. package/dist/templates/ui-byline/components/link/link-lexical.tsx +191 -0
  215. package/dist/templates/ui-byline/components/list/index.ts +2 -0
  216. package/dist/templates/ui-byline/components/list/list-item.tsx +32 -0
  217. package/dist/templates/ui-byline/components/list/list.tsx +17 -0
  218. package/dist/templates/ui-byline/components/responsive-image/index.tsx +205 -0
  219. package/dist/templates/ui-byline/components/richtext-lexical/index.tsx +31 -0
  220. package/dist/templates/ui-byline/components/richtext-lexical/serialize/index.tsx +249 -0
  221. package/dist/templates/ui-byline/components/richtext-lexical/serialize/richtext-node-formats.ts +66 -0
  222. package/dist/templates/ui-byline/components/richtext-lexical/serialize/types.ts +48 -0
  223. package/dist/templates/ui-byline/components/richtext-lexical/serialize/utils.ts +15 -0
  224. package/dist/templates/ui-byline/components/table-cell/index.tsx +36 -0
  225. package/dist/templates/ui-byline/components/vimeo/index.tsx +21 -0
  226. package/dist/templates/ui-byline/components/youtube/index.tsx +22 -0
  227. package/dist/templates/ui-byline/render-blocks.tsx +71 -0
  228. package/dist/templates/ui-byline/types/i18n.ts +14 -0
  229. package/dist/templates/ui-byline/utils/image-sources.ts +102 -0
  230. package/dist/templates/ui-byline/utils/to-kebab-case.ts +5 -0
  231. package/dist/types.d.ts +54 -0
  232. package/dist/types.d.ts.map +1 -0
  233. package/dist/types.js +2 -0
  234. package/dist/types.js.map +1 -0
  235. package/dist/ui/diff.d.ts +4 -0
  236. package/dist/ui/diff.d.ts.map +1 -0
  237. package/dist/ui/diff.js +23 -0
  238. package/dist/ui/diff.js.map +1 -0
  239. package/dist/ui/grid.d.ts +7 -0
  240. package/dist/ui/grid.d.ts.map +1 -0
  241. package/dist/ui/grid.js +24 -0
  242. package/dist/ui/grid.js.map +1 -0
  243. package/dist/ui/logger.d.ts +14 -0
  244. package/dist/ui/logger.d.ts.map +1 -0
  245. package/dist/ui/logger.js +30 -0
  246. package/dist/ui/logger.js.map +1 -0
  247. package/dist/ui/snippet.d.ts +2 -0
  248. package/dist/ui/snippet.d.ts.map +1 -0
  249. package/dist/ui/snippet.js +7 -0
  250. package/dist/ui/snippet.js.map +1 -0
  251. package/package.json +69 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1776979547426,
9
+ "tag": "0000_condemned_kronos",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1777600377018,
16
+ "tag": "0001_sudden_phantom_reporter",
17
+ "breakpoints": true
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminAccountRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminAccountRoute('/(byline)/admin/account/')
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createCollectionApiRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ import { contentLocales, i18n } from '~/i18n'
12
+
13
+ export const Route = createCollectionApiRoute('/(byline)/admin/collections/$collection/$id/api', {
14
+ contentLocales,
15
+ defaultContentLocale: i18n.content.defaultLocale,
16
+ })
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createCollectionHistoryRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ import { contentLocales, i18n } from '~/i18n'
12
+
13
+ export const Route = createCollectionHistoryRoute(
14
+ '/(byline)/admin/collections/$collection/$id/history',
15
+ {
16
+ contentLocales,
17
+ defaultContentLocale: i18n.content.defaultLocale,
18
+ }
19
+ )
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createCollectionEditRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ import { contentLocales, i18n } from '~/i18n'
12
+
13
+ export const Route = createCollectionEditRoute('/(byline)/admin/collections/$collection/$id/', {
14
+ contentLocales,
15
+ defaultContentLocale: i18n.content.defaultLocale,
16
+ })
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createCollectionCreateRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createCollectionCreateRoute('/(byline)/admin/collections/$collection/create')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createCollectionListRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createCollectionListRoute('/(byline)/admin/collections/$collection/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminDashboardRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminDashboardRoute('/(byline)/admin/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminPermissionsRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminPermissionsRoute('/(byline)/admin/permissions/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminRoleEditRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminRoleEditRoute('/(byline)/admin/roles/$id/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminRolesListRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminRolesListRoute('/(byline)/admin/roles/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminLayoutRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminLayoutRoute('/(byline)/admin')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminUserEditRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminUserEditRoute('/(byline)/admin/users/$id/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createAdminUsersListRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createAdminUsersListRoute('/(byline)/admin/users/')
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This Source Code is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ *
6
+ * Copyright (c) Infonomic Company Limited
7
+ */
8
+
9
+ import { createSignInRoute } from '@byline/host-tanstack-start/routes'
10
+
11
+ export const Route = createSignInRoute('/(byline)/sign-in')
@@ -0,0 +1,80 @@
1
+ 'use client'
2
+
3
+ import type React from 'react'
4
+
5
+ import { Container, FadeInLift } from '@byline/ui'
6
+ import cx from 'classnames'
7
+
8
+ import type { PhotoBlockData } from '~/blocks/photo-block'
9
+ import type { MediaFields } from '~/collections/media/schema'
10
+
11
+ import { ResponsiveImage } from '@/ui/byline/components/responsive-image'
12
+ import { LexicalRichText } from '@/ui/byline/components/richtext-lexical'
13
+ import type { Locale } from '@/ui/byline/types/i18n'
14
+
15
+ interface Props {
16
+ id: string
17
+ block: PhotoBlockData
18
+ lng: Locale
19
+ constrainedLayout?: boolean
20
+ className?: string
21
+ }
22
+
23
+ export function PhotoBlock({
24
+ id,
25
+ block,
26
+ lng,
27
+ className,
28
+ constrainedLayout,
29
+ }: Props): React.JSX.Element | null {
30
+ const { photo, alt, caption, display } = block
31
+
32
+ // The `photo` relation must be populated (`populate: { photo: '*' }`) for
33
+ // the front-end to render an image. When populated, the value is a
34
+ // `PopulatedRelationValue` envelope — `{ ...rel, _resolved: true,
35
+ // document: <MediaFields> }`. Bail out if the relation is missing or
36
+ // unpopulated.
37
+ if (photo == null || (photo as { _resolved?: boolean })._resolved !== true) {
38
+ return null
39
+ }
40
+ const media = (photo as unknown as { document: MediaFields }).document
41
+
42
+ const Comp = display === 'full_width' ? 'div' : Container
43
+
44
+ // TODO: caption is a Lexical richText field — type properly once the
45
+ // Lexical node shape is modelled in @byline/core.
46
+ const captionDoc = caption as Record<string, any> | undefined
47
+
48
+ return (
49
+ <Comp
50
+ id={id}
51
+ className={cx(
52
+ 'px-0 pt-4',
53
+ {
54
+ 'lg:max-w-[920px] xl:max-w-[920px] 2xl:max-w-[920px] mx-auto': display === 'default',
55
+ },
56
+ className
57
+ )}
58
+ >
59
+ <FadeInLift as="div" delay={0.25}>
60
+ <ResponsiveImage
61
+ image={media.image}
62
+ size="large"
63
+ constrainedLayout={constrainedLayout}
64
+ alt={alt ?? media.altText ?? ''}
65
+ className="photo-block"
66
+ imgClassName="photo-block--photo"
67
+ />
68
+ {captionDoc != null && (
69
+ <Container
70
+ className={cx('bg-white dark:bg-canvas-900 py-2', { 'px-0': constrainedLayout })}
71
+ >
72
+ <div className="photo-block--caption">
73
+ <LexicalRichText lng={lng} nodes={captionDoc?.root?.children} />
74
+ </div>
75
+ </Container>
76
+ )}
77
+ </FadeInLift>
78
+ </Comp>
79
+ )
80
+ }
@@ -0,0 +1,46 @@
1
+ 'use client'
2
+
3
+ import { Container } from '@byline/ui'
4
+ import cx from 'classnames'
5
+
6
+ import type { RichTextBlockData } from '~/blocks/richtext-block'
7
+
8
+ import { LexicalRichText } from '@/ui/byline/components/richtext-lexical'
9
+ import type { Locale } from '@/ui/byline/types/i18n'
10
+
11
+ interface Props {
12
+ id: string
13
+ block: RichTextBlockData
14
+ lng: Locale
15
+ constrainedLayout?: boolean
16
+ className?: string
17
+ }
18
+
19
+ export function RichTextBlock({
20
+ id,
21
+ block,
22
+ lng,
23
+ className,
24
+ constrainedLayout,
25
+ }: Props): React.JSX.Element {
26
+ // TODO: richText is a Lexical richText field — type properly once the
27
+ // Lexical node shape is modelled in @byline/core.
28
+ const content = block.richText as Record<string, any> | undefined
29
+ const constrainedWidth = block.constrainedWidth
30
+
31
+ return (
32
+ <Container
33
+ id={id}
34
+ className={cx(
35
+ 'pt-4 bg-white dark:bg-canvas-900',
36
+ { 'max-w-full sm:max-w-full lg:max-w-full xl:max-w-full': constrainedWidth === false },
37
+ { 'px-0': constrainedLayout },
38
+ className
39
+ )}
40
+ >
41
+ <div className={cx('mx-auto', { 'max-w-[920px]': constrainedWidth === true })}>
42
+ <LexicalRichText lng={lng} nodes={content?.root?.children} />
43
+ </div>
44
+ </Container>
45
+ )
46
+ }
@@ -0,0 +1,40 @@
1
+ 'use clients'
2
+
3
+ import type React from 'react'
4
+
5
+ import type { Intent } from '@byline/ui'
6
+ import { Alert } from '@byline/ui'
7
+
8
+ import type { Locale } from '@/ui/byline/types/i18n'
9
+ import type { SerializeOptions, SerializeProps } from '../richtext-lexical/serialize/index.tsx'
10
+ import type { SerializedLexicalNode } from '../richtext-lexical/serialize/types.ts'
11
+
12
+ const intentMap = {
13
+ note: 'info' as Intent,
14
+ tip: 'success' as Intent,
15
+ warning: 'warning' as Intent,
16
+ danger: 'danger' as Intent,
17
+ }
18
+
19
+ export function AdmonitionSerializer({
20
+ node,
21
+ serialize,
22
+ lng,
23
+ options,
24
+ }: {
25
+ node: SerializedLexicalNode
26
+ serialize: ({ nodes }: SerializeProps) => React.JSX.Element
27
+ lng: Locale
28
+ options: SerializeOptions
29
+ }): React.JSX.Element {
30
+ const intent = intentMap[node.admonitionType as keyof typeof intentMap]
31
+ return (
32
+ <Alert title={node.title} intent={intent} close={false} className="rounded-none">
33
+ {node?.content?.editorState?.root?.children != null ? (
34
+ serialize({ nodes: node?.content?.editorState?.root?.children, lng, options })
35
+ ) : (
36
+ <span>Content not found for admonition.</span>
37
+ )}
38
+ </Alert>
39
+ )
40
+ }
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+
3
+ import type React from 'react'
4
+
5
+ import { Code } from './code.tsx'
6
+ import { extractCodeLines } from './utils.ts'
7
+ import type { SerializedLexicalNode } from '../richtext-lexical/serialize/types.ts'
8
+
9
+ export function CodeSerializer({
10
+ node,
11
+ }: {
12
+ node: SerializedLexicalNode
13
+ }): React.JSX.Element | null {
14
+ if (node?.children != null) {
15
+ const codeLines = extractCodeLines(node.children)
16
+ return <Code code={codeLines} language={node?.language} />
17
+ } else {
18
+ return null
19
+ }
20
+ }
@@ -0,0 +1,50 @@
1
+ 'use client'
2
+
3
+ import { CopyButton } from '@byline/ui'
4
+ /* eslint-disable no-param-reassign */
5
+ import cx from 'classnames'
6
+ import { Highlight, themes } from 'prism-react-renderer'
7
+
8
+ type CodeIntrinsicProps = React.JSX.IntrinsicElements['pre']
9
+ interface CodeProps extends CodeIntrinsicProps {
10
+ className?: string
11
+ title?: string
12
+ code: string
13
+ language?: string
14
+ }
15
+
16
+ export function Code({ code, className, language = 'jsx' }: CodeProps): React.JSX.Element {
17
+ return (
18
+ <Highlight theme={themes.oneDark} code={code} language={language}>
19
+ {({ tokens, getLineProps, getTokenProps }) => (
20
+ <div className="code scroller group overflow-y-auto rounded border border-theme-600 relative">
21
+ <CopyButton
22
+ variant="outlined"
23
+ intent="primary"
24
+ className="bg-gray-900 hover:bg-gray-800/50"
25
+ containerClassName="dark absolute top-2 right-2 invisible group-hover:visible"
26
+ svgClassName="fill-gray-200 dark:fill-gray-200"
27
+ text={code}
28
+ />
29
+ <pre
30
+ className={cx('m-0 py-5 px-4 rounded-none bg-gray-900 dark:bg-gray-950/80', className)}
31
+ >
32
+ <code className="not-prose">
33
+ {tokens.map((line, i) => {
34
+ const lineProps = getLineProps({ line, key: i })
35
+ return (
36
+ <div {...lineProps} key={i} className="leading-5">
37
+ {/* <span className="-ml-2 mr-3">{i + 1}</span> */}
38
+ {line.map((token, key) => (
39
+ <span key={key} {...getTokenProps({ token })} />
40
+ ))}
41
+ </div>
42
+ )
43
+ })}
44
+ </code>
45
+ </pre>
46
+ </div>
47
+ )}
48
+ </Highlight>
49
+ )
50
+ }
@@ -0,0 +1,137 @@
1
+ @use '@scss/common.scss' as *;
2
+
3
+ .code {
4
+ padding: calc(var(--base) * 1.5);
5
+ font-size: calc(var(--base) * .65);
6
+ line-height: var(--base);
7
+ background-color: var(--color-base-950);
8
+ color: #ffffff;
9
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
10
+ white-space: pre;
11
+ word-spacing: normal;
12
+ word-break: normal;
13
+ -moz-tab-size: 4;
14
+ -o-tab-size: 4;
15
+ tab-size: 4;
16
+ -webkit-hyphens: none;
17
+ -moz-hyphens: none;
18
+ -ms-hyphens: none;
19
+ hyphens: none;
20
+ overflow: auto;
21
+
22
+ @include dark-custom-scrollbar;
23
+
24
+ :global {
25
+
26
+ .token.comment,
27
+ .token.prolog,
28
+ .token.doctype,
29
+ .token.cdata,
30
+ .token.punctuation {
31
+ color: var(--color-base-500);
32
+ }
33
+
34
+ .token.plain,
35
+ .token.atrule,
36
+ .token.attr-value,
37
+ .token.keyword {
38
+ color: var(--color-success-500);
39
+ }
40
+
41
+ .token.tag,
42
+ .token.boolean,
43
+ .token.number,
44
+ .token.constant,
45
+ .token.symbol,
46
+ .token.deleted {
47
+ color: var(--color-error-500);
48
+ }
49
+
50
+ .token.attr-name,
51
+ .token.char,
52
+ .token.builtin,
53
+ .token.inserted {
54
+ color: white;
55
+ }
56
+
57
+ .token.operator,
58
+ .token.entity,
59
+ .token.url,
60
+ .language-css .token.string,
61
+ .style .token.string {
62
+ color: var(--color-base-500);
63
+ }
64
+
65
+
66
+ .token.selector,
67
+ .token-property,
68
+ .token.function {
69
+ color: var(--color-warning-500);
70
+ }
71
+
72
+ .token.regex,
73
+ .token.important,
74
+ .token.variable,
75
+ .token.string,
76
+ .token.class-name {
77
+ color: var(--color-blue-200);
78
+ }
79
+
80
+ .token.important,
81
+ .token.bold {
82
+ font-weight: bold;
83
+ }
84
+
85
+ .token.italic {
86
+ font-style: italic;
87
+ }
88
+
89
+ .token.entity {
90
+ cursor: help;
91
+ }
92
+
93
+ .token-line {
94
+ height: 0;
95
+ }
96
+
97
+ .token-line:not(:last-child) {
98
+ height: initial;
99
+ min-height: 1rem;
100
+ }
101
+
102
+ .highlight-line {
103
+ position: relative;
104
+
105
+ >* {
106
+ position: relative;
107
+ z-index: 2;
108
+ }
109
+
110
+ &:before {
111
+ content: ' ';
112
+ z-index: 1;
113
+ background-color: var(--color-base-900);
114
+ position: absolute;
115
+ top: 0;
116
+ right: 0;
117
+ bottom: 0;
118
+ left: 0;
119
+ }
120
+ }
121
+ }
122
+
123
+ @include mid-break {
124
+ padding: var(--base);
125
+ font-size: calc(var(--base) * .5);
126
+ line-height: calc(var(--base) * .625);
127
+
128
+ :global {
129
+ .highlight-line {
130
+ &:before {
131
+ right: calc(var(--gutter-h) * -1);
132
+ left: calc(var(--gutter-h) * -1);
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
@@ -0,0 +1,2 @@
1
+ export * from './code.tsx'
2
+ export * from './code-serializer.tsx'
@@ -0,0 +1,5 @@
1
+ export interface Props {
2
+ className?: string
3
+ title?: string
4
+ children: string
5
+ }
@@ -0,0 +1,20 @@
1
+ import type { SerializedLexicalNode } from '../richtext-lexical/serialize/types.ts'
2
+
3
+ function replaceAllNBSP(input: string) {
4
+ // Regular expression to match all non-breaking spaces in the string
5
+ const regex = /\u00A0/g
6
+ // Replace them with normal spaces
7
+ return input.replace(regex, ' ')
8
+ }
9
+
10
+ export function extractCodeLines(nodes: SerializedLexicalNode[]): string {
11
+ let result: string = ''
12
+ for (const node of nodes) {
13
+ if (node.type === 'code-highlight' && node.text != null) {
14
+ result = result + replaceAllNBSP(node.text)
15
+ } else if (node.type === 'linebreak') {
16
+ result = `${result}\r\n`
17
+ }
18
+ }
19
+ return result
20
+ }