@jant/core 0.3.32 → 0.3.34
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/dist/client/client.css +1 -1
- package/dist/client/client.js +1442 -989
- package/dist/index.js +1431 -1057
- package/package.json +1 -1
- package/src/__tests__/helpers/app.ts +6 -3
- package/src/__tests__/helpers/db.ts +3 -0
- package/src/app.tsx +1 -1
- package/src/client.ts +2 -1
- package/src/db/migrations/0011_add_path_registry.sql +23 -0
- package/src/db/schema.ts +12 -1
- package/src/i18n/locales/en.po +225 -91
- package/src/i18n/locales/en.ts +1 -1
- package/src/i18n/locales/zh-Hans.po +201 -152
- package/src/i18n/locales/zh-Hans.ts +1 -1
- package/src/i18n/locales/zh-Hant.po +201 -152
- package/src/i18n/locales/zh-Hant.ts +1 -1
- package/src/lib/__tests__/excerpt.test.ts +25 -0
- package/src/lib/__tests__/resolve-config.test.ts +26 -2
- package/src/lib/__tests__/timeline.test.ts +2 -1
- package/src/lib/compose-bridge.ts +30 -1
- package/src/lib/excerpt.ts +16 -7
- package/src/lib/nav-manager-bridge.ts +54 -0
- package/src/lib/navigation.ts +7 -4
- package/src/lib/render.tsx +5 -2
- package/src/lib/resolve-config.ts +7 -0
- package/src/lib/view.ts +42 -10
- package/src/middleware/error-handler.ts +16 -0
- package/src/routes/api/__tests__/posts.test.ts +80 -0
- package/src/routes/api/__tests__/settings.test.ts +1 -1
- package/src/routes/api/posts.ts +6 -29
- package/src/routes/api/upload.ts +2 -14
- package/src/routes/auth/__tests__/setup.test.ts +3 -2
- package/src/routes/auth/setup.tsx +1 -1
- package/src/routes/compose.tsx +13 -5
- package/src/routes/dash/__tests__/pages.test.ts +2 -1
- package/src/routes/dash/__tests__/settings-avatar.test.ts +151 -33
- package/src/routes/dash/appearance.tsx +71 -4
- package/src/routes/dash/collections.tsx +15 -21
- package/src/routes/dash/media.tsx +1 -13
- package/src/routes/dash/pages.tsx +5 -150
- package/src/routes/dash/posts.tsx +25 -32
- package/src/routes/dash/redirects.tsx +9 -11
- package/src/routes/dash/settings.tsx +29 -111
- package/src/routes/feed/__tests__/rss.test.ts +5 -1
- package/src/routes/pages/__tests__/collections.test.ts +2 -1
- package/src/routes/pages/__tests__/featured.test.ts +2 -1
- package/src/routes/pages/page.tsx +20 -25
- package/src/services/__tests__/collection.test.ts +2 -1
- package/src/services/__tests__/media.test.ts +78 -1
- package/src/services/__tests__/navigation.test.ts +2 -1
- package/src/services/__tests__/page.test.ts +78 -1
- package/src/services/__tests__/path-registry.test.ts +165 -0
- package/src/services/__tests__/post-timeline.test.ts +2 -1
- package/src/services/__tests__/post.test.ts +103 -1
- package/src/services/__tests__/redirect.test.ts +53 -4
- package/src/services/__tests__/search.test.ts +2 -1
- package/src/services/__tests__/settings.test.ts +153 -0
- package/src/services/index.ts +12 -4
- package/src/services/media.ts +72 -4
- package/src/services/page.ts +64 -17
- package/src/services/path-registry.ts +160 -0
- package/src/services/post.ts +119 -24
- package/src/services/redirect.ts +23 -3
- package/src/services/settings.ts +181 -0
- package/src/styles/components.css +135 -0
- package/src/styles/tokens.css +6 -1
- package/src/styles/ui.css +70 -26
- package/src/types/bindings.ts +1 -0
- package/src/types/config.ts +7 -2
- package/src/types/constants.ts +9 -1
- package/src/types/sortablejs.d.ts +8 -2
- package/src/types/views.ts +1 -1
- package/src/ui/color-themes.ts +31 -31
- package/src/ui/components/__tests__/jant-settings-avatar.test.ts +0 -3
- package/src/ui/components/__tests__/jant-settings-general.test.ts +2 -6
- package/src/ui/components/jant-compose-dialog.ts +3 -2
- package/src/ui/components/jant-compose-editor.ts +17 -2
- package/src/ui/components/jant-nav-manager.ts +1067 -0
- package/src/ui/components/jant-settings-general.ts +2 -35
- package/src/ui/components/nav-manager-types.ts +72 -0
- package/src/ui/components/settings-types.ts +0 -3
- package/src/ui/compose/ComposePrompt.tsx +3 -11
- package/src/ui/dash/appearance/AdvancedContent.tsx +0 -3
- package/src/ui/dash/appearance/AppearanceNav.tsx +12 -8
- package/src/ui/dash/appearance/ColorThemeContent.tsx +1 -4
- package/src/ui/dash/appearance/FontThemeContent.tsx +0 -3
- package/src/ui/dash/appearance/NavigationContent.tsx +302 -0
- package/src/ui/dash/pages/PagesContent.tsx +74 -0
- package/src/ui/dash/settings/AccountContent.tsx +0 -3
- package/src/ui/dash/settings/GeneralContent.tsx +1 -19
- package/src/ui/dash/settings/SettingsNav.tsx +2 -6
- package/src/ui/feed/NoteCard.tsx +2 -2
- package/src/ui/layouts/DashLayout.tsx +83 -86
- package/src/ui/layouts/SiteLayout.tsx +82 -21
- package/src/lib/nav-reorder.ts +0 -26
- package/src/ui/dash/pages/LinkFormContent.tsx +0 -119
- package/src/ui/dash/pages/UnifiedPagesContent.tsx +0 -203
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ import { createCollectionService } from "../../services/collection.js";
|
|
|
17
17
|
import { createSearchService } from "../../services/search.js";
|
|
18
18
|
import { createNavItemService } from "../../services/navigation.js";
|
|
19
19
|
import { createAuthService } from "../../services/auth.js";
|
|
20
|
+
import { createPathRegistryService } from "../../services/path-registry.js";
|
|
20
21
|
import type { Database } from "../../db/index.js";
|
|
21
22
|
import type BetterSqlite3 from "better-sqlite3";
|
|
22
23
|
import { errorHandler } from "../../middleware/error-handler.js";
|
|
@@ -45,11 +46,13 @@ export function createTestApp(options: TestAppOptions = {}) {
|
|
|
45
46
|
const mockD1 = createMockD1(sqlite);
|
|
46
47
|
|
|
47
48
|
const settingsService = createSettingsService(db);
|
|
49
|
+
const pathRegistryService = createPathRegistryService(db);
|
|
48
50
|
const services = {
|
|
49
|
-
posts: createPostService(db),
|
|
50
|
-
pages: createPageService(db),
|
|
51
|
+
posts: createPostService(db, pathRegistryService),
|
|
52
|
+
pages: createPageService(db, pathRegistryService),
|
|
51
53
|
settings: settingsService,
|
|
52
|
-
|
|
54
|
+
pathRegistry: pathRegistryService,
|
|
55
|
+
redirects: createRedirectService(db, pathRegistryService),
|
|
53
56
|
media: createMediaService(db),
|
|
54
57
|
collections: createCollectionService(db),
|
|
55
58
|
search: createSearchService(mockD1),
|
|
@@ -119,6 +119,9 @@ export function createTestDatabase(options?: { fts?: boolean }) {
|
|
|
119
119
|
// Apply 0010: performance indexes
|
|
120
120
|
applyMigration(sqlite, "0010_add_performance_indexes.sql");
|
|
121
121
|
|
|
122
|
+
// Apply 0011: path registry
|
|
123
|
+
applyMigration(sqlite, "0011_add_path_registry.sql");
|
|
124
|
+
|
|
122
125
|
const db = drizzle(sqlite, { schema });
|
|
123
126
|
|
|
124
127
|
// Polyfill D1 batch() for test compatibility.
|
package/src/app.tsx
CHANGED
|
@@ -266,7 +266,7 @@ export function createApp(): App {
|
|
|
266
266
|
app.route("/archive", archiveRoutes);
|
|
267
267
|
app.route("/featured", featuredRoutes);
|
|
268
268
|
app.route("/latest", latestRoutes);
|
|
269
|
-
app.route("/
|
|
269
|
+
app.route("/c", collectionsPageRoutes);
|
|
270
270
|
app.route("/c", collectionRoutes);
|
|
271
271
|
app.route("/p", postRoutes);
|
|
272
272
|
app.route("/", homeRoutes);
|
package/src/client.ts
CHANGED
|
@@ -12,7 +12,6 @@ import "basecoat-css/all";
|
|
|
12
12
|
import "./lib/image-processor.js";
|
|
13
13
|
import "./lib/media-upload.js";
|
|
14
14
|
import "./lib/avatar-upload.js";
|
|
15
|
-
import "./lib/nav-reorder.js";
|
|
16
15
|
import "./lib/collections-reorder.js";
|
|
17
16
|
|
|
18
17
|
// Lit Web Components
|
|
@@ -26,3 +25,5 @@ import "./ui/components/jant-collection-form.js";
|
|
|
26
25
|
import "./lib/collection-form-bridge.js";
|
|
27
26
|
import "./ui/components/jant-post-form.js";
|
|
28
27
|
import "./lib/post-form-bridge.js";
|
|
28
|
+
import "./ui/components/jant-nav-manager.js";
|
|
29
|
+
import "./lib/nav-manager-bridge.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- Path Registry: single source of truth for all claimed URL paths.
|
|
2
|
+
-- Enforces uniqueness at the DB level via PRIMARY KEY on path.
|
|
3
|
+
|
|
4
|
+
CREATE TABLE path_registry (
|
|
5
|
+
path TEXT PRIMARY KEY,
|
|
6
|
+
owner_type TEXT NOT NULL,
|
|
7
|
+
owner_id INTEGER NOT NULL,
|
|
8
|
+
created_at INTEGER NOT NULL
|
|
9
|
+
);
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
CREATE INDEX idx_path_registry_owner ON path_registry (owner_type, owner_id);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
-- Backfill from existing pages (slug)
|
|
14
|
+
INSERT INTO path_registry (path, owner_type, owner_id, created_at)
|
|
15
|
+
SELECT slug, 'page', id, created_at FROM pages;
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
-- Backfill from existing posts with custom paths (non-deleted only)
|
|
18
|
+
INSERT INTO path_registry (path, owner_type, owner_id, created_at)
|
|
19
|
+
SELECT path, 'post', id, created_at FROM posts WHERE path IS NOT NULL AND deleted_at IS NULL;
|
|
20
|
+
--> statement-breakpoint
|
|
21
|
+
-- Backfill from existing redirects
|
|
22
|
+
INSERT INTO path_registry (path, owner_type, owner_id, created_at)
|
|
23
|
+
SELECT from_path, 'redirect', id, created_at FROM redirects;
|
package/src/db/schema.ts
CHANGED
|
@@ -128,7 +128,7 @@ export const postCollections = sqliteTable("post_collections", {
|
|
|
128
128
|
export const navItems = sqliteTable("nav_items", {
|
|
129
129
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
130
130
|
type: text("type", {
|
|
131
|
-
enum: ["page", "link"],
|
|
131
|
+
enum: ["page", "link", "system"],
|
|
132
132
|
})
|
|
133
133
|
.notNull()
|
|
134
134
|
.default("link"),
|
|
@@ -154,6 +154,17 @@ export const redirects = sqliteTable("redirects", {
|
|
|
154
154
|
createdAt: integer("created_at").notNull(),
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
+
// =============================================================================
|
|
158
|
+
// Path Registry (URL path ownership)
|
|
159
|
+
// =============================================================================
|
|
160
|
+
|
|
161
|
+
export const pathRegistry = sqliteTable("path_registry", {
|
|
162
|
+
path: text("path").primaryKey(),
|
|
163
|
+
ownerType: text("owner_type").notNull(),
|
|
164
|
+
ownerId: integer("owner_id").notNull(),
|
|
165
|
+
createdAt: integer("created_at").notNull(),
|
|
166
|
+
});
|
|
167
|
+
|
|
157
168
|
// =============================================================================
|
|
158
169
|
// Settings (Key-Value)
|
|
159
170
|
// =============================================================================
|