@vit-foundation/ui 0.22.0 → 0.23.0
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/admin.d.ts +0 -1
- package/dist/admin.js +9 -1
- package/dist/content/index.d.ts +2 -2
- package/dist/content/index.js +1 -1
- package/dist/content/types.d.ts +16 -0
- package/dist/content/types.js +15 -0
- package/dist/content-components.d.ts +1 -1
- package/dist/content-components.js +1 -1
- package/dist/contract.d.ts +4 -3
- package/dist/contract.js +10 -2
- package/dist/index.js +3 -9
- package/dist/utils/paths.d.ts +27 -0
- package/dist/utils/paths.js +27 -0
- package/dist/utils/weekly-list-contract.d.ts +35 -0
- package/dist/utils/weekly-list-contract.js +46 -0
- package/package.json +1 -1
- package/dist/components/admin/AdminShell.svelte +0 -42
- package/dist/components/admin/AdminShell.svelte.d.ts +0 -18
package/dist/admin.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* components receive already-filtered data through props, the Nav/Footer
|
|
6
6
|
* genericization pattern.
|
|
7
7
|
*/
|
|
8
|
-
export { default as AdminShell } from './components/admin/AdminShell.svelte';
|
|
9
8
|
export { default as DecorMosaic } from './components/admin/DecorMosaic.svelte';
|
|
10
9
|
export { default as PageHeading } from './components/admin/PageHeading.svelte';
|
|
11
10
|
export { default as Sidebar, type SidebarItem } from './components/admin/Sidebar.svelte';
|
package/dist/admin.js
CHANGED
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
* components receive already-filtered data through props, the Nav/Footer
|
|
6
6
|
* genericization pattern.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
/*
|
|
9
|
+
* `AdminShell` was exported here — a public name behind two doors with zero
|
|
10
|
+
* readers in either host, no test, and one story. Seven props, five of them
|
|
11
|
+
* forwarded verbatim to `Sidebar`, and the only implementation it added beyond
|
|
12
|
+
* the forwarding was `main { margin-left: 4.5rem }`. The one admin host went
|
|
13
|
+
* the other way: vit-brain imports `Sidebar` directly and composes its own
|
|
14
|
+
* shell with a different offset, so the rail's width had two answers and the
|
|
15
|
+
* untested one was nobody's. Deleting it left nothing to reappear.
|
|
16
|
+
*/
|
|
9
17
|
export { default as DecorMosaic } from './components/admin/DecorMosaic.svelte';
|
|
10
18
|
export { default as PageHeading } from './components/admin/PageHeading.svelte';
|
|
11
19
|
export { default as Sidebar } from './components/admin/Sidebar.svelte';
|
package/dist/content/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { renderBody } from './richtext.js';
|
|
2
2
|
export type { RichTextBlock } from './richtext.js';
|
|
3
|
-
export { CONTACT_CATEGORIES, MILESTONE_CATEGORIES, PROJECT_KINDS, REACTIONS } from './types.js';
|
|
4
|
-
export type { CollaboratorData, CommentData, CommentThreadData, ContactCategory, FieldConstraint, FormFailReason, JobOpeningData, MilestoneCategory, MilestoneData, ProjectCardData, ProjectKind, Reaction, ReactionSummary, ReactionTarget, SortDirection, TeamMemberData, WeeklyCardData } from './types.js';
|
|
3
|
+
export { COMMENT_STATUSES, CONTACT_CATEGORIES, MILESTONE_CATEGORIES, PROJECT_KINDS, REACTIONS } from './types.js';
|
|
4
|
+
export type { CollaboratorData, CommentData, CommentThreadData, CommentStatus, ContactCategory, FieldConstraint, FormFailReason, JobOpeningData, MilestoneCategory, MilestoneData, ProjectCardData, ProjectKind, Reaction, ReactionSummary, ReactionTarget, SortDirection, TeamMemberData, WeeklyCardData } from './types.js';
|
package/dist/content/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { renderBody } from './richtext.js';
|
|
2
|
-
export { CONTACT_CATEGORIES, MILESTONE_CATEGORIES, PROJECT_KINDS, REACTIONS } from './types.js';
|
|
2
|
+
export { COMMENT_STATUSES, CONTACT_CATEGORIES, MILESTONE_CATEGORIES, PROJECT_KINDS, REACTIONS } from './types.js';
|
package/dist/content/types.d.ts
CHANGED
|
@@ -126,6 +126,22 @@ export interface CommentData {
|
|
|
126
126
|
createdAt: string;
|
|
127
127
|
reactions: ReactionSummary[];
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* A comment's moderation state, as the database constrains it.
|
|
131
|
+
*
|
|
132
|
+
* The set is `comments.status`'s CHECK in fndvit-website and the vocabulary
|
|
133
|
+
* vit-brain's Comentaris tab moderates through — two repositories that cannot
|
|
134
|
+
* import each other — and it had no owner in TypeScript at all: the site read
|
|
135
|
+
* `status = 'published'` as a bare SQL literal in four queries, typed the
|
|
136
|
+
* field `z.string()`, and never named the other two states anywhere. A test
|
|
137
|
+
* fixture using `'visible'`, a value the CHECK refuses, passed green.
|
|
138
|
+
*
|
|
139
|
+
* `published` is what a reader sees; `hidden` is moderated away; `pending`
|
|
140
|
+
* awaits review. Which of them a given surface SHOWS is that surface's rule,
|
|
141
|
+
* not this list's.
|
|
142
|
+
*/
|
|
143
|
+
export declare const COMMENT_STATUSES: readonly ["published", "pending", "hidden"];
|
|
144
|
+
export type CommentStatus = (typeof COMMENT_STATUSES)[number];
|
|
129
145
|
/** A top-level comment with its flat reply list. */
|
|
130
146
|
export interface CommentThreadData extends CommentData {
|
|
131
147
|
replies: CommentData[];
|
package/dist/content/types.js
CHANGED
|
@@ -29,5 +29,20 @@ export const MILESTONE_CATEGORIES = [
|
|
|
29
29
|
];
|
|
30
30
|
/** The reactions a weekly or comment can carry, in display order. */
|
|
31
31
|
export const REACTIONS = ['like', 'love', 'clap'];
|
|
32
|
+
/**
|
|
33
|
+
* A comment's moderation state, as the database constrains it.
|
|
34
|
+
*
|
|
35
|
+
* The set is `comments.status`'s CHECK in fndvit-website and the vocabulary
|
|
36
|
+
* vit-brain's Comentaris tab moderates through — two repositories that cannot
|
|
37
|
+
* import each other — and it had no owner in TypeScript at all: the site read
|
|
38
|
+
* `status = 'published'` as a bare SQL literal in four queries, typed the
|
|
39
|
+
* field `z.string()`, and never named the other two states anywhere. A test
|
|
40
|
+
* fixture using `'visible'`, a value the CHECK refuses, passed green.
|
|
41
|
+
*
|
|
42
|
+
* `published` is what a reader sees; `hidden` is moderated away; `pending`
|
|
43
|
+
* awaits review. Which of them a given surface SHOWS is that surface's rule,
|
|
44
|
+
* not this list's.
|
|
45
|
+
*/
|
|
46
|
+
export const COMMENT_STATUSES = ['published', 'pending', 'hidden'];
|
|
32
47
|
/** The contact form's reasons, in display order — the host schema derives its enum from this. */
|
|
33
48
|
export const CONTACT_CATEGORIES = ['collaborate', 'event', 'press', 'brand', 'other'];
|
|
@@ -23,7 +23,7 @@ export { createUrlFilters } from './utils/url-filters.svelte.js';
|
|
|
23
23
|
export type { UrlFilters, UrlFiltersConfig } from './utils/url-filters.svelte.js';
|
|
24
24
|
export { createWeeklyList } from './utils/weekly-list.svelte.js';
|
|
25
25
|
export type { WeeklyList, WeeklyListConfig } from './utils/weekly-list.svelte.js';
|
|
26
|
-
export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
|
|
26
|
+
export { WEEKLY_LIST_DEFAULTS, WEEKLY_LIST_PARAMS, parseWeeklyListUrl } from './utils/weekly-list-contract.js';
|
|
27
27
|
export type { WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './utils/weekly-list-contract.js';
|
|
28
28
|
export { contactCategoryLabel } from './utils/contact.js';
|
|
29
29
|
export { formatDate, yearOf } from './utils/dates.js';
|
|
@@ -18,6 +18,6 @@ export { createUrlFilters } from './utils/url-filters.svelte.js';
|
|
|
18
18
|
export { createWeeklyList } from './utils/weekly-list.svelte.js';
|
|
19
19
|
// The list's contract is component-free on purpose, so ./contract carries it
|
|
20
20
|
// too — a host's +page.server.ts reads these without loading the grid.
|
|
21
|
-
export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
|
|
21
|
+
export { WEEKLY_LIST_DEFAULTS, WEEKLY_LIST_PARAMS, parseWeeklyListUrl } from './utils/weekly-list-contract.js';
|
|
22
22
|
export { contactCategoryLabel } from './utils/contact.js';
|
|
23
23
|
export { formatDate, yearOf } from './utils/dates.js';
|
package/dist/contract.d.ts
CHANGED
|
@@ -45,14 +45,15 @@ export { REACTIONS } from './content/types.js';
|
|
|
45
45
|
export type { Reaction, ReactionSummary, SortDirection } from './content/types.js';
|
|
46
46
|
export { MILESTONE_CATEGORIES, PROJECT_KINDS } from './content/types.js';
|
|
47
47
|
export type { MilestoneCategory, ProjectKind } from './content/types.js';
|
|
48
|
-
export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
|
|
48
|
+
export { WEEKLY_LIST_DEFAULTS, WEEKLY_LIST_PARAMS, parseWeeklyListUrl } from './utils/weekly-list-contract.js';
|
|
49
49
|
export type { WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './utils/weekly-list-contract.js';
|
|
50
50
|
export { CONTACT_CATEGORIES } from './content/types.js';
|
|
51
|
-
export
|
|
51
|
+
export { COMMENT_STATUSES } from './content/types.js';
|
|
52
|
+
export type { CommentStatus, ContactCategory, FieldConstraint, FormFailReason } from './content/types.js';
|
|
52
53
|
export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN_PASSWORD, PASSWORD } from './forms/constraints.js';
|
|
53
54
|
export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
|
|
54
55
|
export type { FormFail, FormFieldIssue, FormResultLike, FormResultOf, KeyedRemoteForms, RemoteField, RemoteFormAttributes, RemoteFormInstance } from './forms/types.js';
|
|
55
|
-
export { buildQueryString, isExternalUrl, isInternalPath
|
|
56
|
+
export { buildQueryString, isExternalUrl, isInternalPath } from './utils/paths.js';
|
|
56
57
|
/**
|
|
57
58
|
* The descriptor factories. `edit/helpers.ts` imports nothing but types from
|
|
58
59
|
* two modules this subpath already anchors, so it needed a door rather than a
|
package/dist/contract.js
CHANGED
|
@@ -44,11 +44,19 @@ export { REACTIONS } from './content/types.js';
|
|
|
44
44
|
// contact form already derives from CONTACT_CATEGORIES below. Values, because
|
|
45
45
|
// a type cannot be the source of an enum.
|
|
46
46
|
export { MILESTONE_CATEGORIES, PROJECT_KINDS } from './content/types.js';
|
|
47
|
-
|
|
47
|
+
// The weeklies URL contract, both halves: the values a param stands for when
|
|
48
|
+
// absent, the names it travels as, and the parse that reads one back. The read
|
|
49
|
+
// half had three spellings across two repositories and this package's own test,
|
|
50
|
+
// and the round-trip case guarding them crossed against the test's copy.
|
|
51
|
+
export { WEEKLY_LIST_DEFAULTS, WEEKLY_LIST_PARAMS, parseWeeklyListUrl } from './utils/weekly-list-contract.js';
|
|
48
52
|
export { CONTACT_CATEGORIES } from './content/types.js';
|
|
53
|
+
export { COMMENT_STATUSES } from './content/types.js';
|
|
49
54
|
export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN_PASSWORD, PASSWORD } from './forms/constraints.js';
|
|
50
55
|
export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
|
|
51
|
-
|
|
56
|
+
// `isPathUnder` is deliberately absent: `Nav` and `Sidebar` reach it by relative
|
|
57
|
+
// import and no host has ever imported it, so exporting it pinned a prefix rule
|
|
58
|
+
// into semver for nobody. See utils/paths.ts.
|
|
59
|
+
export { buildQueryString, isExternalUrl, isInternalPath } from './utils/paths.js';
|
|
52
60
|
/**
|
|
53
61
|
* The descriptor factories. `edit/helpers.ts` imports nothing but types from
|
|
54
62
|
* two modules this subpath already anchors, so it needed a door rather than a
|
package/dist/index.js
CHANGED
|
@@ -12,13 +12,7 @@ export * from './forms/index.js';
|
|
|
12
12
|
// App wiring: configuration context and the edit-mode contract.
|
|
13
13
|
export * from './config/index.js';
|
|
14
14
|
export * from './edit/index.js';
|
|
15
|
-
// The one path utility
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// The other three are NOT exported. `isInternalPath` and `isExternalUrl` are
|
|
19
|
-
// the destination classifiers `Link` and `TimelineMilestone` branch on, and
|
|
20
|
-
// `isPathUnder` is the prefix match `Nav` and `Sidebar` highlight the current
|
|
21
|
-
// section with — all four in-package readers reach them by deep import, and
|
|
22
|
-
// no host imports any of the three. Exporting them would pin their behaviour
|
|
23
|
-
// into semver for no reader; `paths.test.ts` is what holds them instead.
|
|
15
|
+
// The one path utility this BARREL carries. The destination classifiers are
|
|
16
|
+
// server-side rules, so they go through ./contract instead — see the note in
|
|
17
|
+
// utils/paths.ts, which is where the export surface for all of them is decided.
|
|
24
18
|
export { buildQueryString } from './utils/paths.js';
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four path rules, and which doors they go out of.
|
|
3
|
+
*
|
|
4
|
+
* This note used to live in `index.ts` and argue that only `buildQueryString`
|
|
5
|
+
* was exported, that the other three were private, and that exporting them
|
|
6
|
+
* "would pin their behaviour into semver for no reader". All three claims had
|
|
7
|
+
* stopped being true:
|
|
8
|
+
*
|
|
9
|
+
* - `contract.ts` exports all four, and has since the subpath reached both
|
|
10
|
+
* hosts.
|
|
11
|
+
* - Two of them DO have a host reader. fndvit-website's repository integration
|
|
12
|
+
* suite asserts the `site_links.href` check constraint against
|
|
13
|
+
* `isInternalPath` byte for byte, and the https columns against
|
|
14
|
+
* `isExternalUrl` — that binding is the whole reason those cases exist, and
|
|
15
|
+
* it is why these two belong on `./contract`: a CHECK constraint is a
|
|
16
|
+
* server-side rule, and the classifier that has to agree with it must be
|
|
17
|
+
* importable without loading a component.
|
|
18
|
+
* - fndvit-website does not re-export `buildQueryString` from its `nav.ts`
|
|
19
|
+
* any more; that pass-through is deleted and its one reader imports the
|
|
20
|
+
* package directly.
|
|
21
|
+
*
|
|
22
|
+
* What the old note got right is the principle, and `isPathUnder` is the name
|
|
23
|
+
* it applies to: it is the prefix match `Nav` and `Sidebar` highlight the
|
|
24
|
+
* current section with, both of them reach it by relative import, and no host
|
|
25
|
+
* has ever imported it. So it is the one of the four that stays in, held by
|
|
26
|
+
* `paths.test.ts` rather than by semver.
|
|
27
|
+
*/
|
|
1
28
|
/** Prefix match over a URL pathname: '/what-we-do' covers '/what-we-do/<slug>'. */
|
|
2
29
|
export declare function isPathUnder(pathname: string, prefix: string): boolean;
|
|
3
30
|
/**
|
package/dist/utils/paths.js
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four path rules, and which doors they go out of.
|
|
3
|
+
*
|
|
4
|
+
* This note used to live in `index.ts` and argue that only `buildQueryString`
|
|
5
|
+
* was exported, that the other three were private, and that exporting them
|
|
6
|
+
* "would pin their behaviour into semver for no reader". All three claims had
|
|
7
|
+
* stopped being true:
|
|
8
|
+
*
|
|
9
|
+
* - `contract.ts` exports all four, and has since the subpath reached both
|
|
10
|
+
* hosts.
|
|
11
|
+
* - Two of them DO have a host reader. fndvit-website's repository integration
|
|
12
|
+
* suite asserts the `site_links.href` check constraint against
|
|
13
|
+
* `isInternalPath` byte for byte, and the https columns against
|
|
14
|
+
* `isExternalUrl` — that binding is the whole reason those cases exist, and
|
|
15
|
+
* it is why these two belong on `./contract`: a CHECK constraint is a
|
|
16
|
+
* server-side rule, and the classifier that has to agree with it must be
|
|
17
|
+
* importable without loading a component.
|
|
18
|
+
* - fndvit-website does not re-export `buildQueryString` from its `nav.ts`
|
|
19
|
+
* any more; that pass-through is deleted and its one reader imports the
|
|
20
|
+
* package directly.
|
|
21
|
+
*
|
|
22
|
+
* What the old note got right is the principle, and `isPathUnder` is the name
|
|
23
|
+
* it applies to: it is the prefix match `Nav` and `Sidebar` highlight the
|
|
24
|
+
* current section with, both of them reach it by relative import, and no host
|
|
25
|
+
* has ever imported it. So it is the one of the four that stays in, held by
|
|
26
|
+
* `paths.test.ts` rather than by semver.
|
|
27
|
+
*/
|
|
1
28
|
/** Prefix match over a URL pathname: '/what-we-do' covers '/what-we-do/<slug>'. */
|
|
2
29
|
export function isPathUnder(pathname, prefix) {
|
|
3
30
|
return pathname === prefix || pathname.startsWith(`${prefix}/`);
|
|
@@ -64,3 +64,38 @@ export interface WeeklyListServerData {
|
|
|
64
64
|
pageSize: number;
|
|
65
65
|
query: WeeklyListFilters;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* The four params this list travels as, in the order a URL reads.
|
|
69
|
+
*
|
|
70
|
+
* Exported so a host's query schema can be bound to them rather than agreeing
|
|
71
|
+
* by coincidence: fndvit-website's `weeklyListQuerySchema` names all four as
|
|
72
|
+
* zod fields, and nothing said they were these four.
|
|
73
|
+
*/
|
|
74
|
+
export declare const WEEKLY_LIST_PARAMS: readonly ["q", "theme", "sort", "page"];
|
|
75
|
+
/**
|
|
76
|
+
* The READ half of the weeklies URL contract — what a URL this package wrote
|
|
77
|
+
* means when it comes back.
|
|
78
|
+
*
|
|
79
|
+
* `WEEKLY_LIST_DEFAULTS` gave the VALUES one owner and both hosts derive from
|
|
80
|
+
* it correctly. The param NAMES and the parse had none: they were spelled four
|
|
81
|
+
* times across three repositories — `toQuery`/`hrefFor` here, a `parseListUrl`
|
|
82
|
+
* declared inside this package's own test, `weeklyListQuerySchema` in
|
|
83
|
+
* fndvit-website and `weeklyQuery` in vit-brain — and the two repositories
|
|
84
|
+
* cannot import each other, so nothing could disagree out loud. vit-brain's
|
|
85
|
+
* docblock states the failure exactly: rename a param here and the read side
|
|
86
|
+
* drops the filter silently while the write side keeps producing it.
|
|
87
|
+
*
|
|
88
|
+
* Worse, the round-trip case that exists to catch precisely that
|
|
89
|
+
* ("builds URLs that parse back to the filters they were built from") crossed
|
|
90
|
+
* the write half against the stand-in in the test file, not against either
|
|
91
|
+
* real reader. It could not fail for the reason it was written.
|
|
92
|
+
*
|
|
93
|
+
* TOLERANT, because these URLs are shared and hand-edited: an unknown sort or
|
|
94
|
+
* a junk page falls back to its default rather than refusing the page. A host
|
|
95
|
+
* may still layer its own tolerance on top — fndvit-website trims and caps
|
|
96
|
+
* lengths in zod, vit-brain clamps nothing further — but the names, and what
|
|
97
|
+
* an absent or bad value means, are answered once, here.
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseWeeklyListUrl(url: URL | string): WeeklyListFilters & {
|
|
100
|
+
page: number;
|
|
101
|
+
};
|
|
@@ -40,3 +40,49 @@
|
|
|
40
40
|
* is the value it should answer unless it means to differ.
|
|
41
41
|
*/
|
|
42
42
|
export const WEEKLY_LIST_DEFAULTS = { sort: 'desc', page: 1, pageSize: 12 };
|
|
43
|
+
/**
|
|
44
|
+
* The four params this list travels as, in the order a URL reads.
|
|
45
|
+
*
|
|
46
|
+
* Exported so a host's query schema can be bound to them rather than agreeing
|
|
47
|
+
* by coincidence: fndvit-website's `weeklyListQuerySchema` names all four as
|
|
48
|
+
* zod fields, and nothing said they were these four.
|
|
49
|
+
*/
|
|
50
|
+
export const WEEKLY_LIST_PARAMS = ['q', 'theme', 'sort', 'page'];
|
|
51
|
+
/**
|
|
52
|
+
* The READ half of the weeklies URL contract — what a URL this package wrote
|
|
53
|
+
* means when it comes back.
|
|
54
|
+
*
|
|
55
|
+
* `WEEKLY_LIST_DEFAULTS` gave the VALUES one owner and both hosts derive from
|
|
56
|
+
* it correctly. The param NAMES and the parse had none: they were spelled four
|
|
57
|
+
* times across three repositories — `toQuery`/`hrefFor` here, a `parseListUrl`
|
|
58
|
+
* declared inside this package's own test, `weeklyListQuerySchema` in
|
|
59
|
+
* fndvit-website and `weeklyQuery` in vit-brain — and the two repositories
|
|
60
|
+
* cannot import each other, so nothing could disagree out loud. vit-brain's
|
|
61
|
+
* docblock states the failure exactly: rename a param here and the read side
|
|
62
|
+
* drops the filter silently while the write side keeps producing it.
|
|
63
|
+
*
|
|
64
|
+
* Worse, the round-trip case that exists to catch precisely that
|
|
65
|
+
* ("builds URLs that parse back to the filters they were built from") crossed
|
|
66
|
+
* the write half against the stand-in in the test file, not against either
|
|
67
|
+
* real reader. It could not fail for the reason it was written.
|
|
68
|
+
*
|
|
69
|
+
* TOLERANT, because these URLs are shared and hand-edited: an unknown sort or
|
|
70
|
+
* a junk page falls back to its default rather than refusing the page. A host
|
|
71
|
+
* may still layer its own tolerance on top — fndvit-website trims and caps
|
|
72
|
+
* lengths in zod, vit-brain clamps nothing further — but the names, and what
|
|
73
|
+
* an absent or bad value means, are answered once, here.
|
|
74
|
+
*/
|
|
75
|
+
export function parseWeeklyListUrl(url) {
|
|
76
|
+
// A relative href (`hrefFor` writes one) needs a base to parse against; it
|
|
77
|
+
// is never read, only discarded with the rest of the origin.
|
|
78
|
+
const params = (typeof url === 'string' ? new URL(url, 'https://weekly-list.invalid') : url)
|
|
79
|
+
.searchParams;
|
|
80
|
+
const sort = params.get('sort');
|
|
81
|
+
const page = Math.trunc(Number(params.get('page')));
|
|
82
|
+
return {
|
|
83
|
+
q: params.get('q') ?? '',
|
|
84
|
+
theme: params.get('theme'),
|
|
85
|
+
sort: sort === 'asc' || sort === 'desc' ? sort : WEEKLY_LIST_DEFAULTS.sort,
|
|
86
|
+
page: page >= WEEKLY_LIST_DEFAULTS.page ? page : WEEKLY_LIST_DEFAULTS.page
|
|
87
|
+
};
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import Sidebar, { type SidebarItem } from './Sidebar.svelte';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
/** Rail entries, already permission-filtered by the host. */
|
|
7
|
-
items: SidebarItem[];
|
|
8
|
-
/** Accessible name of the sidebar nav landmark. */
|
|
9
|
-
navLabel?: string;
|
|
10
|
-
logo?: Snippet;
|
|
11
|
-
/** Bottom of the rail — the host's logout form. */
|
|
12
|
-
footer?: Snippet;
|
|
13
|
-
/** The page content. */
|
|
14
|
-
children: Snippet;
|
|
15
|
-
/** Highlighting override for tests and stories. */
|
|
16
|
-
url?: URL;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let { items, navLabel = 'Principal', logo, footer, children, url = undefined }: Props = $props();
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<div class="shell">
|
|
23
|
-
<Sidebar {items} label={navLabel} {logo} {footer} {url} />
|
|
24
|
-
<main class="content">
|
|
25
|
-
{@render children()}
|
|
26
|
-
</main>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<style>
|
|
30
|
-
/* The sidebar is fixed at 4.5rem; the content pays for it once, here,
|
|
31
|
-
instead of every page knowing the rail's width. */
|
|
32
|
-
.content {
|
|
33
|
-
margin-left: 4.5rem;
|
|
34
|
-
min-height: 100vh;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@media print {
|
|
38
|
-
.content {
|
|
39
|
-
margin-left: 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import { type SidebarItem } from './Sidebar.svelte';
|
|
3
|
-
interface Props {
|
|
4
|
-
/** Rail entries, already permission-filtered by the host. */
|
|
5
|
-
items: SidebarItem[];
|
|
6
|
-
/** Accessible name of the sidebar nav landmark. */
|
|
7
|
-
navLabel?: string;
|
|
8
|
-
logo?: Snippet;
|
|
9
|
-
/** Bottom of the rail — the host's logout form. */
|
|
10
|
-
footer?: Snippet;
|
|
11
|
-
/** The page content. */
|
|
12
|
-
children: Snippet;
|
|
13
|
-
/** Highlighting override for tests and stories. */
|
|
14
|
-
url?: URL;
|
|
15
|
-
}
|
|
16
|
-
declare const AdminShell: import("svelte").Component<Props, {}, "">;
|
|
17
|
-
type AdminShell = ReturnType<typeof AdminShell>;
|
|
18
|
-
export default AdminShell;
|