@jant/core 0.6.7 → 0.6.9

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 (131) hide show
  1. package/bin/commands/uploads/cleanup.js +2 -0
  2. package/dist/{app-L1UPUArB.js → app-C-jxWmAV.js} +12421 -12033
  3. package/dist/app-DqHzOwL5.js +6 -0
  4. package/dist/client/.vite/manifest.json +3 -3
  5. package/dist/client/_assets/client-CGf2m3qp.css +2 -0
  6. package/dist/client/_assets/{client-B0MvB2r0.js → client-DWy1LEEk.js} +2 -2
  7. package/dist/client/_assets/{client-auth-CwwuucF_.js → client-auth-Blg-a5Ep.js} +365 -345
  8. package/dist/{env-CoSe-1y4.js → env-OHRKGcMj.js} +1 -1
  9. package/dist/{export-DLukCOO3.js → export-C2DIB7mm.js} +34 -9
  10. package/dist/{github-api-UD4u_7fa.js → github-api-BgSiE71w.js} +1 -1
  11. package/dist/{github-app-DeX6Td1O.js → github-app-BbklkFmU.js} +1 -1
  12. package/dist/{github-sync-BeDecPen.js → github-sync-7XQ5ZM6z.js} +3 -3
  13. package/dist/{github-sync-BtHY2AST.js → github-sync-BEFCfLKK.js} +3 -3
  14. package/dist/index.js +5 -5
  15. package/dist/node.js +6 -6
  16. package/dist/{url-XF0GbKGO.js → url-BMYO-Zlt.js} +42 -2
  17. package/package.json +1 -1
  18. package/src/__tests__/bin/uploads-cleanup.test.ts +2 -0
  19. package/src/client/__tests__/compose-bridge.test.ts +105 -0
  20. package/src/client/__tests__/hydrate-partial.test.ts +27 -0
  21. package/src/client/__tests__/note-expand.test.ts +130 -0
  22. package/src/client/archive-nav.js +2 -1
  23. package/src/client/audio-player.ts +7 -3
  24. package/src/client/components/__tests__/compose-format-convert.test.ts +357 -0
  25. package/src/client/components/__tests__/jant-compose-dialog.test.ts +313 -0
  26. package/src/client/components/__tests__/jant-compose-editor.test.ts +2 -0
  27. package/src/client/components/__tests__/jant-compose-fullscreen.test.ts +2 -0
  28. package/src/client/components/__tests__/jant-settings-avatar.test.ts +5 -2
  29. package/src/client/components/__tests__/jant-settings-general.test.ts +55 -8
  30. package/src/client/components/compose-format-convert.ts +255 -0
  31. package/src/client/components/compose-types.ts +2 -0
  32. package/src/client/components/jant-compose-dialog.ts +110 -44
  33. package/src/client/components/jant-compose-editor.ts +64 -11
  34. package/src/client/components/jant-settings-general.ts +56 -18
  35. package/src/client/components/settings-types.ts +11 -0
  36. package/src/client/compose-bridge.ts +17 -0
  37. package/src/client/feed-video-player.ts +1 -1
  38. package/src/client/hydrate-partial.ts +25 -0
  39. package/src/client/note-expand.ts +63 -0
  40. package/src/client/settings-bridge.ts +3 -0
  41. package/src/client/tiptap/__tests__/mark-exit.test.ts +99 -0
  42. package/src/client/tiptap/bubble-menu.ts +37 -4
  43. package/src/client.ts +1 -0
  44. package/src/db/migrations/0026_absent_rhodey.sql +14 -0
  45. package/src/db/migrations/meta/0026_snapshot.json +2511 -0
  46. package/src/db/migrations/meta/_journal.json +7 -0
  47. package/src/db/migrations/pg/0024_high_violations.sql +14 -0
  48. package/src/db/migrations/pg/meta/0024_snapshot.json +3204 -0
  49. package/src/db/migrations/pg/meta/_journal.json +7 -0
  50. package/src/db/pg/schema.ts +36 -0
  51. package/src/db/schema.ts +36 -0
  52. package/src/i18n/__tests__/middleware.test.ts +46 -0
  53. package/src/i18n/locales/public/en.po +41 -0
  54. package/src/i18n/locales/public/en.ts +1 -1
  55. package/src/i18n/locales/public/zh-Hans.po +41 -0
  56. package/src/i18n/locales/public/zh-Hans.ts +1 -1
  57. package/src/i18n/locales/public/zh-Hant.po +41 -0
  58. package/src/i18n/locales/public/zh-Hant.ts +1 -1
  59. package/src/i18n/locales/settings/en.po +37 -22
  60. package/src/i18n/locales/settings/en.ts +1 -1
  61. package/src/i18n/locales/settings/zh-Hans.po +37 -22
  62. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  63. package/src/i18n/locales/settings/zh-Hant.po +37 -22
  64. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  65. package/src/i18n/middleware.ts +17 -8
  66. package/src/i18n/supported-locales.ts +5 -4
  67. package/src/lib/__tests__/markdown-to-tiptap.test.ts +1 -1
  68. package/src/lib/__tests__/markdown.test.ts +1 -1
  69. package/src/lib/__tests__/summary.test.ts +87 -0
  70. package/src/lib/__tests__/timeline.test.ts +48 -1
  71. package/src/lib/__tests__/tiptap-render.test.ts +4 -4
  72. package/src/lib/__tests__/url.test.ts +44 -0
  73. package/src/lib/__tests__/view.test.ts +168 -1
  74. package/src/lib/ids.ts +1 -0
  75. package/src/lib/navigation.ts +1 -0
  76. package/src/lib/resolve-config.ts +3 -2
  77. package/src/lib/summary.ts +42 -3
  78. package/src/lib/tiptap-render.ts +6 -2
  79. package/src/lib/upload.ts +16 -2
  80. package/src/lib/url.ts +41 -0
  81. package/src/lib/view.ts +102 -40
  82. package/src/preset.css +7 -1
  83. package/src/routes/api/__tests__/settings.test.ts +1 -4
  84. package/src/routes/api/__tests__/upload.test.ts +2 -0
  85. package/src/routes/api/internal/__tests__/uploads.test.ts +86 -0
  86. package/src/routes/api/internal/sites.ts +44 -1
  87. package/src/routes/api/public/__tests__/archive.test.ts +66 -0
  88. package/src/routes/api/public/archive.ts +22 -6
  89. package/src/routes/api/settings.ts +2 -1
  90. package/src/routes/api/telegram.ts +2 -1
  91. package/src/routes/auth/__tests__/setup.test.ts +14 -0
  92. package/src/routes/dash/__tests__/settings-avatar.test.ts +35 -17
  93. package/src/routes/dash/custom-urls.tsx +1 -1
  94. package/src/routes/dash/settings.tsx +23 -7
  95. package/src/routes/pages/__tests__/archive-params.test.ts +135 -0
  96. package/src/routes/pages/archive.tsx +116 -20
  97. package/src/routes/pages/collections.tsx +1 -0
  98. package/src/services/__tests__/media.test.ts +274 -30
  99. package/src/services/__tests__/post.test.ts +81 -0
  100. package/src/services/__tests__/settings.test.ts +55 -0
  101. package/src/services/bootstrap.ts +7 -0
  102. package/src/services/export-theme/assets/client-site.js +1 -1
  103. package/src/services/export-theme/layouts/_default/baseof.html +2 -1
  104. package/src/services/export-theme/styles/main.css +49 -15
  105. package/src/services/media.ts +199 -42
  106. package/src/services/post.ts +22 -2
  107. package/src/services/search.ts +4 -4
  108. package/src/services/settings.ts +49 -15
  109. package/src/services/upload-session.ts +28 -0
  110. package/src/styles/tokens.css +7 -5
  111. package/src/styles/ui.css +163 -34
  112. package/src/types/bindings.ts +1 -0
  113. package/src/types/config.ts +14 -1
  114. package/src/types/props.ts +3 -0
  115. package/src/ui/compose/ComposeDialog.tsx +13 -0
  116. package/src/ui/dash/settings/AccountMenuContent.tsx +0 -39
  117. package/src/ui/dash/settings/GeneralContent.tsx +38 -4
  118. package/src/ui/dash/settings/SettingsDirectory.tsx +26 -1
  119. package/src/ui/dash/settings/SettingsRootContent.tsx +46 -1
  120. package/src/ui/dash/settings/__tests__/SettingsRootContent.test.tsx +55 -0
  121. package/src/ui/feed/NoteCard.tsx +54 -5
  122. package/src/ui/feed/__tests__/timeline-cards.test.ts +73 -0
  123. package/src/ui/layouts/BaseLayout.tsx +1 -0
  124. package/src/ui/layouts/__tests__/BaseLayout.test.tsx +13 -0
  125. package/src/ui/pages/ArchivePage.tsx +89 -6
  126. package/src/ui/pages/CollectionsPage.tsx +7 -1
  127. package/src/ui/pages/__tests__/ArchivePage.test.tsx +37 -0
  128. package/src/ui/shared/CollectionDirectory.tsx +13 -3
  129. package/src/ui/shared/CollectionsManager.tsx +3 -0
  130. package/dist/app-C1QgMNRY.js +0 -6
  131. package/dist/client/_assets/client-BMPMuwvV.css +0 -2
@@ -37,6 +37,39 @@ interface BubbleBtn {
37
37
  isActive: (view: EditorView) => boolean;
38
38
  }
39
39
 
40
+ /**
41
+ * Toggle an inline mark on the current selection, then drop out of it.
42
+ *
43
+ * The toolbar mark buttons (bold, italic) format the *selection* — the same
44
+ * intent as the `**x**` / `~~x~~` markdown shortcuts, which auto-exit once you
45
+ * type the closing delimiter. These marks are inclusive, so a collapsed cursor
46
+ * sitting at the end of the formatted word stays "inside" the mark and keeps
47
+ * extending as the user types, with no obvious way to stop (the bubble menu is
48
+ * hidden once the selection collapses). After toggling, we collapse the cursor
49
+ * to the end of the selection and remove the just-applied mark from the stored
50
+ * set so the next character is plain. Use the keyboard shortcuts (Mod-B /
51
+ * Mod-I) for mode-style "keep typing in this format".
52
+ */
53
+ export function toggleMarkAndExit(editor: Editor, markName: string): void {
54
+ const { to, empty } = editor.state.selection;
55
+ if (empty) {
56
+ // No selection (e.g. shortcut-driven): behave as a plain mode toggle.
57
+ editor.chain().focus().toggleMark(markName).run();
58
+ return;
59
+ }
60
+ const markType = editor.schema.marks[markName];
61
+ editor
62
+ .chain()
63
+ .focus()
64
+ .toggleMark(markName)
65
+ .setTextSelection(to)
66
+ .command(({ tr }) => {
67
+ if (markType) tr.removeStoredMark(markType);
68
+ return true;
69
+ })
70
+ .run();
71
+ }
72
+
40
73
  function getButtons(
41
74
  editor: Editor,
42
75
  toolbarMode: FormattingToolbarMode,
@@ -47,14 +80,14 @@ function getButtons(
47
80
  key: "bold",
48
81
  icon: ICONS.bold,
49
82
  title: "Bold",
50
- action: () => editor.chain().focus().toggleBold().run(),
83
+ action: () => toggleMarkAndExit(editor, "bold"),
51
84
  isActive: () => editor.isActive("bold"),
52
85
  },
53
86
  {
54
87
  key: "italic",
55
88
  icon: ICONS.italic,
56
89
  title: "Italic",
57
- action: () => editor.chain().focus().toggleItalic().run(),
90
+ action: () => toggleMarkAndExit(editor, "italic"),
58
91
  isActive: () => editor.isActive("italic"),
59
92
  },
60
93
  {
@@ -101,14 +134,14 @@ function getButtons(
101
134
  key: "bold",
102
135
  icon: ICONS.bold,
103
136
  title: "Bold",
104
- action: () => editor.chain().focus().toggleBold().run(),
137
+ action: () => toggleMarkAndExit(editor, "bold"),
105
138
  isActive: () => editor.isActive("bold"),
106
139
  },
107
140
  {
108
141
  key: "italic",
109
142
  icon: ICONS.italic,
110
143
  title: "Italic",
111
- action: () => editor.chain().focus().toggleItalic().run(),
144
+ action: () => toggleMarkAndExit(editor, "italic"),
112
145
  isActive: () => editor.isActive("italic"),
113
146
  },
114
147
  {
package/src/client.ts CHANGED
@@ -15,6 +15,7 @@ import "./client/components/jant-media-lightbox.js";
15
15
  import "./client/components/jant-text-preview.js";
16
16
  import "./client/toast.js";
17
17
  import "./client/thread-context.js";
18
+ import "./client/note-expand.js";
18
19
  import "./client/archive-nav.js";
19
20
  import "./client/site-header-nav.js";
20
21
  import "./client/collection-sort-menu.js";
@@ -0,0 +1,14 @@
1
+ CREATE TABLE `storage_purge` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `site_id` text NOT NULL,
4
+ `provider` text NOT NULL,
5
+ `storage_key` text NOT NULL,
6
+ `original_key` text NOT NULL,
7
+ `reason` text,
8
+ `purge_after` integer NOT NULL,
9
+ `created_at` integer NOT NULL,
10
+ FOREIGN KEY (`site_id`) REFERENCES `site`(`id`) ON UPDATE no action ON DELETE cascade
11
+ );
12
+ --> statement-breakpoint
13
+ CREATE UNIQUE INDEX `uq_storage_purge_provider_key` ON `storage_purge` (`provider`,`storage_key`);--> statement-breakpoint
14
+ CREATE INDEX `idx_storage_purge_site_provider_due` ON `storage_purge` (`site_id`,`provider`,`purge_after`);