@jant/core 0.6.11 → 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.
- package/bin/commands/import-site.js +45 -20
- package/dist/app-B5P1b4TF.js +6 -0
- package/dist/{app-CpmficmQ.js → app-D-zAhayc.js} +331 -55
- package/dist/client/.vite/manifest.json +3 -3
- package/dist/client/_assets/client-BUxR-E8O.css +2 -0
- package/dist/client/_assets/{client-Dd9U383b.js → client-S1cdvulk.js} +1 -1
- package/dist/client/_assets/{client-auth-DkpSdIDz.js → client-auth-YW92ZH7u.js} +116 -55
- package/dist/{export-Ba7NJImL.js → export-Ckwh4BiE.js} +4 -4
- package/dist/{github-sync-BD4w2m8-.js → github-sync-BMmK3JZ0.js} +2 -2
- package/dist/{github-sync-Cb4_6_i7.js → github-sync-Dl9wQMar.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/node.js +4 -4
- package/package.json +1 -1
- package/src/__tests__/import-site-command.test.ts +75 -0
- package/src/__tests__/vite-dev-plugins.test.ts +34 -0
- package/src/client/__tests__/compose-launch.test.ts +50 -1
- package/src/client/__tests__/compose-shortcuts.test.ts +74 -18
- package/src/client/components/__tests__/jant-command-palette.test.ts +63 -0
- package/src/client/components/__tests__/jant-compose-dialog.test.ts +33 -0
- package/src/client/components/__tests__/jant-compose-editor-rehost-notice.test.ts +20 -1
- package/src/client/components/__tests__/jant-nav-manager.test.ts +77 -1
- package/src/client/components/__tests__/jant-settings-avatar.test.ts +6 -0
- package/src/client/components/__tests__/jant-settings-general.test.ts +71 -0
- package/src/client/components/jant-command-palette.ts +67 -2
- package/src/client/components/jant-compose-dialog.ts +8 -2
- package/src/client/components/jant-nav-manager.ts +142 -2
- package/src/client/components/jant-settings-general.ts +56 -0
- package/src/client/components/nav-manager-types.ts +14 -0
- package/src/client/components/settings-types.ts +30 -0
- package/src/client/compose-launch.ts +30 -0
- package/src/client/compose-shortcuts.ts +46 -3
- package/src/client/tiptap/__tests__/rehost-images.test.ts +66 -13
- package/src/client/tiptap/rehost-images.ts +5 -1
- package/src/i18n/__tests__/fallback.test.ts +24 -0
- package/src/i18n/locales/public/zh-Hans.po +2 -2
- package/src/i18n/locales/public/zh-Hans.ts +1 -1
- package/src/i18n/locales/public/zh-Hant.po +2 -2
- package/src/i18n/locales/public/zh-Hant.ts +1 -1
- package/src/i18n/locales/settings/en.po +54 -0
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +64 -10
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +56 -2
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/lib/__tests__/feed.test.ts +96 -10
- package/src/lib/feed.ts +63 -3
- package/src/lib/post-display.ts +14 -8
- package/src/preset.css +60 -18
- package/src/routes/dash/settings.tsx +41 -2
- package/src/routes/pages/__tests__/draft-about-edit.test.ts +65 -0
- package/src/routes/pages/page.tsx +44 -12
- package/src/services/__tests__/about-page.test.ts +116 -0
- package/src/services/__tests__/navigation.test.ts +190 -1
- package/src/services/__tests__/post-timeline.test.ts +119 -2
- package/src/services/about-page.ts +143 -0
- package/src/services/export-theme/layouts/_default/rss.xml +2 -1
- package/src/services/export-theme/layouts/partials/feed-post-content.xml +25 -1
- package/src/services/export-theme/styles/main.css +46 -14
- package/src/services/index.ts +27 -17
- package/src/services/navigation.ts +155 -1
- package/src/services/post.ts +24 -7
- package/src/styles/components.css +20 -0
- package/src/styles/tokens.css +26 -8
- package/src/styles/ui.css +149 -7
- package/src/types/views.ts +13 -0
- package/src/ui/dash/appearance/NavigationContent.tsx +57 -0
- package/src/ui/dash/appearance/__tests__/NavigationContent.test.tsx +19 -0
- package/src/ui/dash/settings/GeneralContent.tsx +44 -0
- package/src/ui/dash/settings/__tests__/GeneralContent.test.tsx +8 -0
- package/src/ui/feed/__tests__/timeline-cards.test.ts +162 -1
- package/dist/app-DqKkZenB.js +0 -6
- package/dist/client/_assets/client-BhHHVvSY.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
|
-
|
|
516
|
-
|
|
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 } =
|
|
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
|
-
|