@jant/core 0.6.10 → 0.6.12

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 (92) hide show
  1. package/bin/commands/import-site.js +45 -20
  2. package/dist/app-B5P1b4TF.js +6 -0
  3. package/dist/{app-CGHkOdme.js → app-D-zAhayc.js} +847 -244
  4. package/dist/client/.vite/manifest.json +3 -3
  5. package/dist/client/_assets/client-BUxR-E8O.css +2 -0
  6. package/dist/client/_assets/{client-DYrWuaIk.js → client-S1cdvulk.js} +1 -1
  7. package/dist/client/_assets/{client-auth-B5Re0uCd.js → client-auth-YW92ZH7u.js} +158 -97
  8. package/dist/{export-DY1v5Iqu.js → export-Ckwh4BiE.js} +96 -96
  9. package/dist/{github-sync-LefaslGJ.js → github-sync-BMmK3JZ0.js} +2 -2
  10. package/dist/{github-sync-2_T7nbOv.js → github-sync-Dl9wQMar.js} +1 -1
  11. package/dist/index.js +3 -3
  12. package/dist/node.js +4 -4
  13. package/package.json +1 -1
  14. package/src/__tests__/import-site-command.test.ts +75 -0
  15. package/src/__tests__/vite-dev-plugins.test.ts +34 -0
  16. package/src/client/__tests__/compose-launch.test.ts +50 -1
  17. package/src/client/__tests__/compose-shortcuts.test.ts +74 -18
  18. package/src/client/components/__tests__/jant-command-palette.test.ts +63 -0
  19. package/src/client/components/__tests__/jant-compose-dialog.test.ts +33 -0
  20. package/src/client/components/__tests__/jant-compose-editor-rehost-notice.test.ts +81 -0
  21. package/src/client/components/__tests__/jant-nav-manager.test.ts +77 -1
  22. package/src/client/components/__tests__/jant-settings-avatar.test.ts +6 -0
  23. package/src/client/components/__tests__/jant-settings-general.test.ts +71 -0
  24. package/src/client/components/compose-types.ts +4 -0
  25. package/src/client/components/jant-command-palette.ts +67 -2
  26. package/src/client/components/jant-compose-dialog.ts +8 -2
  27. package/src/client/components/jant-compose-editor.ts +111 -0
  28. package/src/client/components/jant-nav-manager.ts +142 -2
  29. package/src/client/components/jant-settings-general.ts +56 -0
  30. package/src/client/components/nav-manager-types.ts +14 -0
  31. package/src/client/components/settings-types.ts +30 -0
  32. package/src/client/compose-bridge.ts +25 -8
  33. package/src/client/compose-launch.ts +30 -0
  34. package/src/client/compose-shortcuts.ts +46 -3
  35. package/src/client/tiptap/__tests__/inline-image-upload.test.ts +143 -0
  36. package/src/client/tiptap/__tests__/paste-rehost-e2e.test.ts +65 -0
  37. package/src/client/tiptap/__tests__/rehost-images.test.ts +192 -0
  38. package/src/client/tiptap/create-editor.ts +3 -0
  39. package/src/client/tiptap/extensions.ts +4 -0
  40. package/src/client/tiptap/inline-image-upload.ts +174 -50
  41. package/src/client/tiptap/rehost-images.ts +108 -0
  42. package/src/i18n/__tests__/fallback.test.ts +24 -0
  43. package/src/i18n/locales/public/en.po +10 -0
  44. package/src/i18n/locales/public/en.ts +1 -1
  45. package/src/i18n/locales/public/zh-Hans.po +10 -0
  46. package/src/i18n/locales/public/zh-Hans.ts +1 -1
  47. package/src/i18n/locales/public/zh-Hant.po +10 -0
  48. package/src/i18n/locales/public/zh-Hant.ts +1 -1
  49. package/src/i18n/locales/settings/en.po +54 -0
  50. package/src/i18n/locales/settings/en.ts +1 -1
  51. package/src/i18n/locales/settings/zh-Hans.po +64 -10
  52. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  53. package/src/i18n/locales/settings/zh-Hant.po +56 -2
  54. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  55. package/src/lib/__tests__/feed.test.ts +96 -10
  56. package/src/lib/__tests__/upload-sideload.test.ts +78 -0
  57. package/src/lib/__tests__/url-fetch.test.ts +181 -0
  58. package/src/lib/feed.ts +63 -3
  59. package/src/lib/post-display.ts +14 -8
  60. package/src/lib/upload.ts +111 -0
  61. package/src/lib/url-fetch.ts +263 -0
  62. package/src/preset.css +60 -18
  63. package/src/routes/api/__tests__/uploads.test.ts +63 -1
  64. package/src/routes/api/uploads.ts +52 -0
  65. package/src/routes/dash/settings.tsx +41 -2
  66. package/src/routes/pages/__tests__/draft-about-edit.test.ts +65 -0
  67. package/src/routes/pages/page.tsx +44 -12
  68. package/src/services/__tests__/about-page.test.ts +116 -0
  69. package/src/services/__tests__/media.test.ts +168 -1
  70. package/src/services/__tests__/navigation.test.ts +190 -1
  71. package/src/services/__tests__/post-timeline.test.ts +119 -2
  72. package/src/services/about-page.ts +143 -0
  73. package/src/services/export-theme/layouts/_default/rss.xml +2 -1
  74. package/src/services/export-theme/layouts/partials/feed-post-content.xml +25 -1
  75. package/src/services/export-theme/styles/main.css +46 -14
  76. package/src/services/index.ts +27 -17
  77. package/src/services/media.ts +111 -0
  78. package/src/services/navigation.ts +155 -1
  79. package/src/services/post.ts +24 -7
  80. package/src/styles/components.css +20 -0
  81. package/src/styles/tokens.css +26 -8
  82. package/src/styles/ui.css +149 -7
  83. package/src/types/views.ts +13 -0
  84. package/src/ui/compose/ComposeDialog.tsx +16 -0
  85. package/src/ui/dash/appearance/NavigationContent.tsx +57 -0
  86. package/src/ui/dash/appearance/__tests__/NavigationContent.test.tsx +19 -0
  87. package/src/ui/dash/settings/GeneralContent.tsx +44 -0
  88. package/src/ui/dash/settings/__tests__/GeneralContent.test.tsx +8 -0
  89. package/src/ui/feed/__tests__/timeline-cards.test.ts +162 -1
  90. package/src/ui/layouts/BaseLayout.tsx +12 -0
  91. package/dist/app-D24n0DoH.js +0 -6
  92. package/dist/client/_assets/client-xWDl78yi.css +0 -2
@@ -504,19 +504,15 @@ async function mediaSpecFromJantMedia(entry, sourceRootDir) {
504
504
  srcFilePath,
505
505
  poster,
506
506
  posterFilePath,
507
- mimeType:
508
- typeof entry.mime_type === "string" ? entry.mime_type : undefined,
507
+ mimeType: typeof entry.mime_type === "string" ? entry.mime_type : undefined,
509
508
  originalName,
510
509
  size: typeof entry.size === "number" ? entry.size : undefined,
511
510
  width: typeof entry.width === "number" ? entry.width : undefined,
512
511
  height: typeof entry.height === "number" ? entry.height : undefined,
513
512
  alt: typeof entry.alt === "string" ? entry.alt : undefined,
514
- position:
515
- typeof entry.position === "string" ? entry.position : undefined,
516
- blurhash:
517
- typeof entry.blurhash === "string" ? entry.blurhash : undefined,
518
- waveform:
519
- typeof entry.waveform === "string" ? entry.waveform : undefined,
513
+ position: typeof entry.position === "string" ? entry.position : undefined,
514
+ blurhash: typeof entry.blurhash === "string" ? entry.blurhash : undefined,
515
+ waveform: typeof entry.waveform === "string" ? entry.waveform : undefined,
520
516
  summary: typeof entry.summary === "string" ? entry.summary : undefined,
521
517
  chars: typeof entry.chars === "number" ? entry.chars : undefined,
522
518
  };
@@ -587,8 +583,7 @@ async function normalizeTextAttachmentSpec(spec, siteConfig, sourceRootDir) {
587
583
  return null;
588
584
  }
589
585
 
590
- const summary =
591
- typeof spec.summary === "string" ? spec.summary : undefined;
586
+ const summary = typeof spec.summary === "string" ? spec.summary : undefined;
592
587
 
593
588
  // Legacy inline content path — no network fetch needed.
594
589
  if (
@@ -1648,9 +1643,7 @@ function resolveCollectionMemberships(frontMatter, collectionSlugToId) {
1648
1643
  if (!id) continue;
1649
1644
  const entry = { collectionId: id };
1650
1645
  if (typeof raw.collected_at === "string" && raw.collected_at) {
1651
- entry.createdAt = Math.floor(
1652
- new Date(raw.collected_at).getTime() / 1000,
1653
- );
1646
+ entry.createdAt = Math.floor(new Date(raw.collected_at).getTime() / 1000);
1654
1647
  }
1655
1648
  if (typeof raw.position === "number") {
1656
1649
  entry.position = raw.position;
@@ -1664,6 +1657,38 @@ function resolveCollectionMemberships(frontMatter, collectionSlugToId) {
1664
1657
  return { entries, ids };
1665
1658
  }
1666
1659
 
1660
+ function parseImportTimestamp(value) {
1661
+ if (typeof value !== "string" || value.trim() === "") return null;
1662
+ const timestamp = Date.parse(value);
1663
+ return Number.isFinite(timestamp) ? Math.floor(timestamp / 1000) : null;
1664
+ }
1665
+
1666
+ function getImportedRootLastActivityAt(frontMatter) {
1667
+ return (
1668
+ parseImportTimestamp(frontMatter.last_activity_at) ??
1669
+ parseImportTimestamp(frontMatter.date)
1670
+ );
1671
+ }
1672
+
1673
+ function getImportedPostStatus(frontMatter) {
1674
+ if (frontMatter.status === "draft" || frontMatter.status === "published") {
1675
+ return frontMatter.status;
1676
+ }
1677
+ return frontMatter.draft ? "draft" : "published";
1678
+ }
1679
+
1680
+ function shouldImportReplyQuietly(rootFrontMatter, replyFrontMatter) {
1681
+ if (getImportedPostStatus(replyFrontMatter) !== "published") return false;
1682
+
1683
+ const rootLastActivityAt = getImportedRootLastActivityAt(rootFrontMatter);
1684
+ const replyPublishedAt = parseImportTimestamp(replyFrontMatter.date);
1685
+ return (
1686
+ rootLastActivityAt !== null &&
1687
+ replyPublishedAt !== null &&
1688
+ replyPublishedAt > rootLastActivityAt
1689
+ );
1690
+ }
1691
+
1667
1692
  /**
1668
1693
  * Build the payload for `target.createPost()` from a parsed bundle. Works
1669
1694
  * for both root bundles (`forReply: false`) and reply leaf bundles — the
@@ -1690,7 +1715,8 @@ function buildPostPayloadFromBundle(bundle, options) {
1690
1715
  frontMatter.visibility === "private"
1691
1716
  ? frontMatter.visibility
1692
1717
  : undefined;
1693
- const { entries: collectionEntries, ids: collectionIds } = options.memberships;
1718
+ const { entries: collectionEntries, ids: collectionIds } =
1719
+ options.memberships;
1694
1720
 
1695
1721
  const data = {
1696
1722
  format,
@@ -1728,6 +1754,7 @@ function buildPostPayloadFromBundle(bundle, options) {
1728
1754
  : undefined,
1729
1755
  rating:
1730
1756
  typeof frontMatter.rating === "number" ? frontMatter.rating : undefined,
1757
+ quietReply: options.quietReply ? true : undefined,
1731
1758
  };
1732
1759
 
1733
1760
  if (options.replyToId) {
@@ -1777,6 +1804,7 @@ export const __test__ = {
1777
1804
  mediaSpecFromJantMedia,
1778
1805
  resolveCollectionMemberships,
1779
1806
  buildPostPayloadFromBundle,
1807
+ shouldImportReplyQuietly,
1780
1808
  };
1781
1809
 
1782
1810
  function printImportUsage() {
@@ -2096,8 +2124,7 @@ export async function run(argv) {
2096
2124
  for (const rootBundle of rootBundles) {
2097
2125
  const { frontMatter: rootFm } = rootBundle;
2098
2126
  const postSlug = rootBundle.slug;
2099
- const format =
2100
- typeof rootFm.format === "string" ? rootFm.format : "note";
2127
+ const format = typeof rootFm.format === "string" ? rootFm.format : "note";
2101
2128
  const postLabel =
2102
2129
  (format === "quote"
2103
2130
  ? typeof rootFm.source_name === "string"
@@ -2215,9 +2242,7 @@ export async function run(argv) {
2215
2242
  if (dryRun) {
2216
2243
  console.log(`[dry-run] Would create post: ${postLabel} (${format})`);
2217
2244
  if (rootBundle.children.length > 0) {
2218
- console.log(
2219
- ` [dry-run] With ${rootBundle.children.length} replies`,
2220
- );
2245
+ console.log(` [dry-run] With ${rootBundle.children.length} replies`);
2221
2246
  }
2222
2247
  postsCreated++;
2223
2248
  repliesCreated += rootBundle.children.length;
@@ -2349,6 +2374,7 @@ export async function run(argv) {
2349
2374
  attachments: replyAttachments,
2350
2375
  memberships: replyMemberships,
2351
2376
  replyToId: threadTailId,
2377
+ quietReply: shouldImportReplyQuietly(rootFm, replyFm),
2352
2378
  });
2353
2379
 
2354
2380
  try {
@@ -2410,4 +2436,3 @@ export async function run(argv) {
2410
2436
  }
2411
2437
  }
2412
2438
  }
2413
-
@@ -0,0 +1,6 @@
1
+ import "./url-BMYO-Zlt.js";
2
+ import { t as createApp } from "./app-D-zAhayc.js";
3
+ import "./export-Ckwh4BiE.js";
4
+ import "./env-OHRKGcMj.js";
5
+ import "./github-sync-Dl9wQMar.js";
6
+ export { createApp };