@jant/core 0.7.0 → 0.7.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 (158) hide show
  1. package/bin/commands/export.js +3 -1
  2. package/bin/commands/import-site.js +689 -216
  3. package/bin/commands/setup.js +136 -0
  4. package/bin/commands/site/export.js +71 -34
  5. package/bin/commands/site/pull-media.js +2 -6
  6. package/bin/commands/site/snapshot/export.js +18 -60
  7. package/bin/commands/site/snapshot/import.js +22 -23
  8. package/bin/lib/d1-query.js +87 -2
  9. package/bin/lib/hugo-markdown.js +4 -0
  10. package/bin/lib/site-pull-media.js +21 -28
  11. package/bin/lib/site-selection.js +10 -1
  12. package/bin/lib/site-snapshot.js +338 -3
  13. package/bin/lib/sql-export.js +68 -5
  14. package/bin/lib/wrangler-cli.js +9 -0
  15. package/bin/lib/zip-archive.js +187 -0
  16. package/dist/{app-K_Aa1MMn.js → app-ZcaI1kPN.js} +732 -217
  17. package/dist/client/.vite/manifest.json +20 -20
  18. package/dist/client/_assets/chunks/{create-editor-CD3FhrOB.js → create-editor-B-m7X7S5.js} +50 -46
  19. package/dist/client/_assets/chunks/{sortable-list-CgaL2jCs.js → sortable-list-BJyd-LXE.js} +1 -1
  20. package/dist/client/_assets/chunks/{unsafe-svg-0QCkP0vZ.js → unsafe-svg-BkscJx69.js} +2 -2
  21. package/dist/client/_assets/{client-GiYENVw8.css → client-DAhoqPdr.css} +1 -1
  22. package/dist/client/_assets/{client-auth-k8gJ6QJj.js → client-auth-CAMfTrKW.js} +1 -1
  23. package/dist/client/_assets/{client-compose-B_kDtWkW.js → client-compose-D6rExKVK.js} +1 -1
  24. package/dist/client/_assets/{client-VnFxJN7G.js → client-knSEyUJO.js} +1 -1
  25. package/dist/client/_assets/{client-manage-M90aSTOk.js → client-manage-sVOkqVbH.js} +1 -1
  26. package/dist/client/_assets/{client-settings-DfYs9n1F.js → client-settings-CGR_nZ78.js} +7 -7
  27. package/dist/{github-sync-BPAvT999.js → github-sync-Gw4orAHk.js} +799 -110
  28. package/dist/index.js +2 -2
  29. package/dist/node.js +9 -5
  30. package/package.json +13 -3
  31. package/src/__tests__/dev-scripts.test.ts +203 -0
  32. package/src/__tests__/export-collection-order.test.ts +276 -0
  33. package/src/__tests__/export-feed-ids.test.ts +184 -0
  34. package/src/__tests__/export-feed-order.test.ts +294 -0
  35. package/src/__tests__/export-hugo-build.test.ts +130 -0
  36. package/src/__tests__/export-import-roundtrip.test.ts +94 -0
  37. package/src/__tests__/export-service.test.ts +611 -28
  38. package/src/__tests__/export-smart-collection.test.ts +329 -0
  39. package/src/__tests__/helpers/hugo-site.ts +146 -0
  40. package/src/__tests__/import-site-command.test.ts +487 -1
  41. package/src/__tests__/mise-config.test.ts +75 -4
  42. package/src/__tests__/node-dev-tasks.test.ts +264 -0
  43. package/src/__tests__/site-export-canonical-import.test.ts +149 -0
  44. package/src/__tests__/snapshot-canonical-replay.test.ts +179 -0
  45. package/src/__tests__/snapshot-settings.test.ts +97 -0
  46. package/src/__tests__/snapshot-tables.test.ts +219 -0
  47. package/src/__tests__/sql-export.test.ts +173 -0
  48. package/src/__tests__/zip-archive.test.ts +106 -0
  49. package/src/app.tsx +15 -6
  50. package/src/client/components/__tests__/jant-settings-avatar.test.ts +1 -1
  51. package/src/client/components/__tests__/jant-settings-general.test.ts +21 -1
  52. package/src/client/components/jant-repo-picker-types.ts +6 -1
  53. package/src/client/components/jant-repo-picker.ts +4 -7
  54. package/src/client/components/jant-settings-general.ts +17 -12
  55. package/src/client/tiptap/__tests__/list-editing.test.ts +224 -86
  56. package/src/client/tiptap/__tests__/mark-exit.test.ts +1 -2
  57. package/src/client/tiptap/__tests__/markdown-clipboard.test.ts +26 -0
  58. package/src/client/tiptap/extensions.ts +0 -3
  59. package/src/client/tiptap/structural-keymap.ts +158 -47
  60. package/src/db/__tests__/d1-query.test.ts +56 -1
  61. package/src/i18n/locales/settings/en.po +8 -8
  62. package/src/i18n/locales/settings/en.ts +1 -1
  63. package/src/i18n/locales/settings/zh-Hans.po +8 -8
  64. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  65. package/src/i18n/locales/settings/zh-Hant.po +8 -8
  66. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  67. package/src/lib/__tests__/github-sync-repo-name.test.ts +40 -0
  68. package/src/lib/__tests__/image.test.ts +27 -1
  69. package/src/lib/__tests__/markdown-to-tiptap.test.ts +105 -0
  70. package/src/lib/__tests__/markdown.test.ts +10 -0
  71. package/src/lib/__tests__/resolve-config.test.ts +67 -0
  72. package/src/lib/__tests__/schemas.test.ts +27 -1
  73. package/src/lib/__tests__/timeline.test.ts +87 -0
  74. package/src/lib/__tests__/tiptap-to-markdown.test.ts +172 -4
  75. package/src/lib/discover.ts +3 -1
  76. package/src/lib/github-sync-repo-name.ts +45 -0
  77. package/src/lib/hugo-markdown.ts +46 -0
  78. package/src/lib/image.ts +17 -4
  79. package/src/lib/markdown-manager.ts +392 -2
  80. package/src/lib/post-body-html.ts +11 -4
  81. package/src/lib/resolve-config.ts +58 -1
  82. package/src/lib/schemas.ts +50 -5
  83. package/src/lib/thread-fold.ts +3 -3
  84. package/src/lib/timeline.ts +1 -1
  85. package/src/lib/tiptap-to-markdown.ts +13 -7
  86. package/src/lib/url.ts +20 -0
  87. package/src/lib/view.ts +2 -2
  88. package/src/node/__tests__/cli-setup.test.ts +163 -0
  89. package/src/node/__tests__/cli-site-snapshot.test.ts +67 -0
  90. package/src/node/__tests__/cli-snapshot-meta.test.ts +20 -0
  91. package/src/node/__tests__/runtime.test.ts +38 -0
  92. package/src/node/index.ts +2 -0
  93. package/src/node/request-handler.ts +3 -1
  94. package/src/routes/api/__tests__/posts.test.ts +24 -0
  95. package/src/routes/api/__tests__/upload.test.ts +34 -0
  96. package/src/routes/api/export.ts +3 -3
  97. package/src/routes/api/internal/sites.ts +0 -1
  98. package/src/routes/api/posts.ts +2 -0
  99. package/src/routes/api/public/posts.ts +21 -1
  100. package/src/routes/api/upload.ts +10 -3
  101. package/src/routes/compose.tsx +4 -0
  102. package/src/routes/dash/__tests__/github-sync-app.test.ts +365 -0
  103. package/src/routes/dash/settings.tsx +212 -70
  104. package/src/routes/pages/__tests__/post-page-round-trips.test.ts +211 -0
  105. package/src/routes/pages/__tests__/thread-order.test.ts +179 -0
  106. package/src/routes/pages/archive.tsx +17 -11
  107. package/src/routes/pages/featured.tsx +11 -5
  108. package/src/routes/pages/page.tsx +53 -31
  109. package/src/routes/pages/search.tsx +4 -2
  110. package/src/runtime/__tests__/readiness.test.ts +23 -0
  111. package/src/runtime/node.ts +49 -0
  112. package/src/runtime/readiness.ts +15 -0
  113. package/src/services/__tests__/bootstrap-setup-instance.test.ts +230 -0
  114. package/src/services/__tests__/custom-url.test.ts +34 -0
  115. package/src/services/__tests__/github-app-installations.test.ts +153 -0
  116. package/src/services/__tests__/github-sync-push.test.ts +46 -0
  117. package/src/services/__tests__/media.test.ts +31 -0
  118. package/src/services/__tests__/path.test.ts +56 -0
  119. package/src/services/__tests__/post-timeline.test.ts +127 -0
  120. package/src/services/__tests__/post.test.ts +74 -0
  121. package/src/services/bootstrap.ts +263 -44
  122. package/src/services/custom-url.ts +2 -2
  123. package/src/services/export-theme/layouts/_default/alias.html +27 -1
  124. package/src/services/export-theme/layouts/_default/list.html +2 -63
  125. package/src/services/export-theme/layouts/_default/rss.xml +27 -38
  126. package/src/services/export-theme/layouts/collections/list.html +3 -3
  127. package/src/services/export-theme/layouts/featured/list.html +1 -4
  128. package/src/services/export-theme/layouts/index.html +40 -26
  129. package/src/services/export-theme/layouts/partials/collection-members.html +100 -0
  130. package/src/services/export-theme/layouts/partials/collection-threads.html +33 -0
  131. package/src/services/export-theme/layouts/partials/featured-members.html +35 -0
  132. package/src/services/export-theme/layouts/partials/featured-thread.html +1 -1
  133. package/src/services/export-theme/layouts/partials/footer.html +1 -1
  134. package/src/services/export-theme/layouts/partials/head.html +1 -1
  135. package/src/services/export-theme/layouts/partials/header.html +5 -3
  136. package/src/services/export-theme/layouts/partials/jant-data.html +23 -0
  137. package/src/services/export-theme/layouts/partials/latest-members.html +48 -0
  138. package/src/services/export-theme/layouts/partials/smart-collection-members.html +129 -0
  139. package/src/services/export-theme/layouts/partials/thread-preview.html +1 -1
  140. package/src/services/export-theme/layouts/post/list.html +1 -1
  141. package/src/services/export-theme/layouts/smart_collection/list.html +24 -0
  142. package/src/services/export-theme/styles/main.css +0 -1
  143. package/src/services/export-theme/theme.toml +1 -1
  144. package/src/services/export.ts +620 -71
  145. package/src/services/github-app-installations.ts +171 -4
  146. package/src/services/github-sync.ts +69 -15
  147. package/src/services/mcp.ts +19 -1
  148. package/src/services/media.ts +8 -1
  149. package/src/services/path.ts +34 -1
  150. package/src/services/post.ts +214 -39
  151. package/src/services/site-admin.ts +3 -7
  152. package/src/services/site.ts +83 -31
  153. package/src/styles/ui.css +7 -1
  154. package/src/types/app-context.ts +16 -0
  155. package/src/types/bindings.ts +5 -0
  156. package/src/types/operations.ts +10 -0
  157. package/src/ui/dash/settings/GeneralContent.tsx +10 -8
  158. package/src/client/tiptap/exitable-marks.ts +0 -73
@@ -109,6 +109,16 @@ export interface CreatePost {
109
109
  */
110
110
  translationOfId?: string;
111
111
  publishedAt?: number;
112
+ /**
113
+ * The post's creation time, for a restore. Defaults to now. Thread order
114
+ * reads it, then the ID, to order replies; the root always comes first.
115
+ */
116
+ createdAt?: number;
117
+ /**
118
+ * The post's last edit time, for a restore. Defaults to `createdAt`.
119
+ * Feeds and the sitemap report it as the post's update time.
120
+ */
121
+ updatedAt?: number;
112
122
  attachments?: PostAttachmentInput[];
113
123
  }
114
124
 
@@ -127,13 +127,13 @@ export function GeneralContent({
127
127
  noindex: boolean;
128
128
  /** The stored choice, or "" when the owner has never used the control. */
129
129
  discover: string;
130
- /** What the site declares while that choice is unmade. */
131
130
  /**
132
131
  * The deployment's own answer, unresolved: `""` when it has none.
133
132
  *
134
- * Not the effective mode. `noindex` and the feed switch are controls on this
135
- * same page, so folding them in here would hand the browser a value that is
136
- * already stale by the first click; the component applies them itself.
133
+ * Not the effective mode. `noindex` is a control on this same page, so
134
+ * folding it in here would hand the browser a value that is already stale by
135
+ * the first click; the component applies it, and the rest of the rules,
136
+ * itself.
137
137
  */
138
138
  discoverDefault: DiscoverSetting | "";
139
139
  /** The directory's own pages, or `null` when none is configured. */
@@ -152,8 +152,9 @@ export function GeneralContent({
152
152
  const discoverCopy = getDiscoverCopy(i18n);
153
153
 
154
154
  const labels = JSON.stringify({
155
- // The component finds the name and the rules in the help line to make
156
- // them links, so it gets them on their own as well as inside the line.
155
+ // The component finds the name and the rules in the help line (and the
156
+ // name in the demo notice that replaces it) to make them links, so it gets
157
+ // them on their own as well as inside the lines.
157
158
  discoverName: discoverCopy.name,
158
159
  discoverRules: discoverCopy.rules,
159
160
  discoverEnabled: discoverCopy.label,
@@ -415,10 +416,11 @@ export function GeneralContent({
415
416
  ),
416
417
  discoverDemoLocked: i18n._(
417
418
  msg({
418
- message: "Demo sites are never listed in Discover.",
419
+ message: "Demo sites are never listed in {name}.",
419
420
  comment:
420
- "@context: Help text explaining that Discover is locked off in demo mode",
421
+ "@context: Help text under the Jant Discover checkbox explaining that Discover is locked off in demo mode, shown in place of the usual help line. {name} is the directory's name and is rendered as the link to it, so keep it as one run of text.",
421
422
  }),
423
+ { name: discoverCopy.name },
422
424
  ),
423
425
  discoverFeedsOffLocked: i18n._(
424
426
  msg({
@@ -1,73 +0,0 @@
1
- /**
2
- * Exitable Marks Extension
3
- *
4
- * Two behaviors for escaping inline marks (bold, italic, strike, code, underline):
5
- *
6
- * 1. ArrowRight at end of block — clears stored marks so next typed char is plain.
7
- * 2. Enter on an empty block — clears stored marks on the new paragraph.
8
- * (Typing bold → Enter → empty line → Enter = formatting resets.)
9
- */
10
-
11
- import { Extension } from "@tiptap/core";
12
-
13
- const EXITABLE_MARKS = new Set([
14
- "bold",
15
- "italic",
16
- "strike",
17
- "code",
18
- "underline",
19
- ]);
20
-
21
- function getExitableMarks(marks: readonly import("@tiptap/pm/model").Mark[]) {
22
- return marks.filter((m) => EXITABLE_MARKS.has(m.type.name));
23
- }
24
-
25
- export const ExitableMarks = Extension.create({
26
- name: "exitableMarks",
27
-
28
- addKeyboardShortcuts() {
29
- return {
30
- ArrowRight: ({ editor }) => {
31
- const { selection } = editor.state;
32
- const { $from } = selection;
33
-
34
- if (!selection.empty) return false;
35
- if ($from.pos !== $from.end()) return false;
36
-
37
- const exitables = getExitableMarks($from.marks());
38
- if (!exitables.length) return false;
39
-
40
- // Clear stored marks; return true to consume event (don't jump to next block)
41
- const { tr } = editor.state;
42
- for (const mark of exitables) {
43
- tr.removeStoredMark(mark);
44
- }
45
- editor.view.dispatch(tr);
46
- return true;
47
- },
48
-
49
- Enter: ({ editor }) => {
50
- const { selection } = editor.state;
51
- const { $from } = selection;
52
-
53
- if (!selection.empty) return false;
54
-
55
- // Only act on empty blocks (e.g. a blank bold line)
56
- if ($from.parent.textContent.length > 0) return false;
57
-
58
- const storedMarks = editor.state.storedMarks ?? $from.marks();
59
- const exitables = getExitableMarks(storedMarks);
60
- if (!exitables.length) return false;
61
-
62
- // Let ProseMirror create the new paragraph first, then clear marks
63
- requestAnimationFrame(() => {
64
- const { tr } = editor.state;
65
- tr.setStoredMarks([]);
66
- editor.view.dispatch(tr);
67
- });
68
-
69
- return false;
70
- },
71
- };
72
- },
73
- });