@vit-foundation/ui 0.20.1 → 0.21.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.
@@ -21,7 +21,9 @@ export * from './content/index.js';
21
21
  export { MILESTONE_CATEGORY_COLOR, matchesMilestoneFilter, milestoneCategoryLabel } from './utils/milestones.js';
22
22
  export { createUrlFilters } from './utils/url-filters.svelte.js';
23
23
  export type { UrlFilters, UrlFiltersConfig } from './utils/url-filters.svelte.js';
24
- export { createWeeklyList, WEEKLY_LIST_DEFAULTS } from './utils/weekly-list.svelte.js';
25
- export type { WeeklyList, WeeklyListConfig, WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './utils/weekly-list.svelte.js';
24
+ export { createWeeklyList } from './utils/weekly-list.svelte.js';
25
+ export type { WeeklyList, WeeklyListConfig } from './utils/weekly-list.svelte.js';
26
+ export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
27
+ export type { WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './utils/weekly-list-contract.js';
26
28
  export { contactCategoryLabel } from './utils/contact.js';
27
29
  export { formatDate, yearOf } from './utils/dates.js';
@@ -15,6 +15,9 @@ export * from './content/index.js';
15
15
  export { MILESTONE_CATEGORY_COLOR, matchesMilestoneFilter, milestoneCategoryLabel } from './utils/milestones.js';
16
16
  // The two list rules: URL-mirrored filters, and the weeklies index over them.
17
17
  export { createUrlFilters } from './utils/url-filters.svelte.js';
18
- export { createWeeklyList, WEEKLY_LIST_DEFAULTS } from './utils/weekly-list.svelte.js';
18
+ export { createWeeklyList } from './utils/weekly-list.svelte.js';
19
+ // The list's contract is component-free on purpose, so ./contract carries it
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';
19
22
  export { contactCategoryLabel } from './utils/contact.js';
20
23
  export { formatDate, yearOf } from './utils/dates.js';
@@ -20,6 +20,22 @@
20
20
  * It adds nothing. Every name below is already exported from a semantic
21
21
  * subpath and stays there — this is a second door into the same rooms, not a
22
22
  * new floor, and the barrel remains the surface a component host reads.
23
+ *
24
+ * It was cut to fit ONE consumer, and the second one did not fit through it.
25
+ * vit-brain's four restatements were the motive, so the first version carried
26
+ * the locale vocabulary, the edit contract and REACTIONS — and of the fifteen
27
+ * names fndvit-website's SERVER modules take from the barrel, it covered
28
+ * exactly one. Its `schemas/{common,auth,comment,contact}.ts` and
29
+ * `remote/result.ts` are read by `server/auth.ts`, `server/form-action.ts` and
30
+ * eleven repositories, so that site reaches a sixty-component graph to obtain
31
+ * string bounds and a hidden field's name.
32
+ *
33
+ * The fix moved no files, which is the tell that the seam was in the right
34
+ * place and merely too narrow: `forms/constraints.ts`, `forms/transport.ts`,
35
+ * `forms/types.ts` and `utils/paths.ts` were ALREADY component-free leaves —
36
+ * they import nothing but `content/types.js`, or nothing at all. They were
37
+ * what this subpath promises, with no door onto them. Now there is one, and
38
+ * the guard walks them like the rest.
23
39
  */
24
40
  export { LOCALES, BASE_LOCALE } from './config/types.js';
25
41
  export type { Locale, NotParameterized, ParameterizedKey, ParameterlessKey, SiteLink, UiMessages } from './config/types.js';
@@ -27,3 +43,11 @@ export { localize } from './edit/types.js';
27
43
  export type { CollectionRef, ContentRef, EditableEntity, EditDescriptor, EntityOp, LocalizedText, PropertyDescriptor, PropertyOption, PropertyType, PropertyValue } from './edit/types.js';
28
44
  export { REACTIONS } from './content/types.js';
29
45
  export type { Reaction, ReactionSummary, SortDirection } from './content/types.js';
46
+ export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
47
+ export type { WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './utils/weekly-list-contract.js';
48
+ export { CONTACT_CATEGORIES } from './content/types.js';
49
+ export type { ContactCategory, FieldConstraint, FormFailReason } from './content/types.js';
50
+ export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN_PASSWORD, PASSWORD } from './forms/constraints.js';
51
+ export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
52
+ export type { FormFail, FormFieldIssue, FormResultLike, FormResultOf, KeyedRemoteForms, RemoteField, RemoteFormAttributes, RemoteFormInstance } from './forms/types.js';
53
+ export { buildQueryString, isExternalUrl, isInternalPath, isPathUnder } from './utils/paths.js';
package/dist/contract.js CHANGED
@@ -20,7 +20,28 @@
20
20
  * It adds nothing. Every name below is already exported from a semantic
21
21
  * subpath and stays there — this is a second door into the same rooms, not a
22
22
  * new floor, and the barrel remains the surface a component host reads.
23
+ *
24
+ * It was cut to fit ONE consumer, and the second one did not fit through it.
25
+ * vit-brain's four restatements were the motive, so the first version carried
26
+ * the locale vocabulary, the edit contract and REACTIONS — and of the fifteen
27
+ * names fndvit-website's SERVER modules take from the barrel, it covered
28
+ * exactly one. Its `schemas/{common,auth,comment,contact}.ts` and
29
+ * `remote/result.ts` are read by `server/auth.ts`, `server/form-action.ts` and
30
+ * eleven repositories, so that site reaches a sixty-component graph to obtain
31
+ * string bounds and a hidden field's name.
32
+ *
33
+ * The fix moved no files, which is the tell that the seam was in the right
34
+ * place and merely too narrow: `forms/constraints.ts`, `forms/transport.ts`,
35
+ * `forms/types.ts` and `utils/paths.ts` were ALREADY component-free leaves —
36
+ * they import nothing but `content/types.js`, or nothing at all. They were
37
+ * what this subpath promises, with no door onto them. Now there is one, and
38
+ * the guard walks them like the rest.
23
39
  */
24
40
  export { LOCALES, BASE_LOCALE } from './config/types.js';
25
41
  export { localize } from './edit/types.js';
26
42
  export { REACTIONS } from './content/types.js';
43
+ export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
44
+ export { CONTACT_CATEGORIES } from './content/types.js';
45
+ export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN_PASSWORD, PASSWORD } from './forms/constraints.js';
46
+ export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
47
+ export { buildQueryString, isExternalUrl, isInternalPath, isPathUnder } from './utils/paths.js';
@@ -0,0 +1,66 @@
1
+ import type { SortDirection, WeeklyCardData } from '../content/types.js';
2
+ /**
3
+ * The weeklies index's contract, without the view that runs it.
4
+ *
5
+ * `createWeeklyList` needs the Svelte compiler — four `$state` cells, an
6
+ * `$effect` and three `$derived` — so it lives in a `.svelte.ts` rune module.
7
+ * These four names do not: they are what a HOST has to agree with this
8
+ * package about before any of that runs, and a host agrees with them on the
9
+ * server. `+page.server.ts` builds `WeeklyListServerData`, a query schema
10
+ * takes its defaults from `WEEKLY_LIST_DEFAULTS`, and a repository answers
11
+ * `WeeklyListPage`.
12
+ *
13
+ * They were in the rune module, which put them behind `./content` — eight
14
+ * components — and, worse, out of reach of `./contract` altogether, because
15
+ * that subpath's guard refuses a rune module by name (they need the
16
+ * compiler, so a server import of one is the defect the guard exists to
17
+ * catch). So the release that gave `pageSize` an owner, to end a restatement
18
+ * in two repositories that cannot import each other, shipped it where
19
+ * neither host's server could import it: fndvit-website's
20
+ * `schemas/weekly.ts` reaches it through `./content` and is itself read by
21
+ * `routes/weeklies/+page.server.ts`.
22
+ *
23
+ * Splitting the file is the whole fix. Nothing moves for a component host —
24
+ * `./content` still exports every name from here — and the four facts a
25
+ * server needs stop being locked behind a graph it must not load.
26
+ */
27
+ /**
28
+ * The weeklies index's URL defaults: the value a param stands for when it is
29
+ * absent. Both halves of the URL contract — `createWeeklyList` omitting a
30
+ * default, the host's query schema supplying one — must name the same values,
31
+ * so a host derives its schema defaults from here rather than restating them.
32
+ *
33
+ * `pageSize` is here for the same reason one step further out. It is not a
34
+ * URL param: it is what a page of this list HOLDS, which the grid this
35
+ * package renders decides. Every host was spelling its own — fndvit-website
36
+ * as `WEEKLIES_PAGE_SIZE`, vit-brain's mirror as a bare `12` in markup — and
37
+ * the two must agree, because the mirror exists to page the same corpus the
38
+ * site pages. Two repositories that cannot import each other were each
39
+ * holding half of one number. `createWeeklyList` still READS the size from
40
+ * `config.server().pageSize`, so a host may still answer something else; this
41
+ * is the value it should answer unless it means to differ.
42
+ */
43
+ export declare const WEEKLY_LIST_DEFAULTS: {
44
+ readonly sort: "desc";
45
+ readonly page: 1;
46
+ readonly pageSize: 12;
47
+ };
48
+ /** A type alias, not an interface: createUrlFilters needs an index signature. */
49
+ export type WeeklyListFilters = {
50
+ q: string;
51
+ theme: string | null;
52
+ sort: SortDirection;
53
+ };
54
+ /** One page of the list plus the unpaged total (for the pagination). */
55
+ export interface WeeklyListPage {
56
+ items: WeeklyCardData[];
57
+ total: number;
58
+ }
59
+ /** The server-rendered page, re-read on every navigation. */
60
+ export interface WeeklyListServerData {
61
+ weeklies: WeeklyCardData[];
62
+ total: number;
63
+ page: number;
64
+ pageSize: number;
65
+ query: WeeklyListFilters;
66
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The weeklies index's contract, without the view that runs it.
3
+ *
4
+ * `createWeeklyList` needs the Svelte compiler — four `$state` cells, an
5
+ * `$effect` and three `$derived` — so it lives in a `.svelte.ts` rune module.
6
+ * These four names do not: they are what a HOST has to agree with this
7
+ * package about before any of that runs, and a host agrees with them on the
8
+ * server. `+page.server.ts` builds `WeeklyListServerData`, a query schema
9
+ * takes its defaults from `WEEKLY_LIST_DEFAULTS`, and a repository answers
10
+ * `WeeklyListPage`.
11
+ *
12
+ * They were in the rune module, which put them behind `./content` — eight
13
+ * components — and, worse, out of reach of `./contract` altogether, because
14
+ * that subpath's guard refuses a rune module by name (they need the
15
+ * compiler, so a server import of one is the defect the guard exists to
16
+ * catch). So the release that gave `pageSize` an owner, to end a restatement
17
+ * in two repositories that cannot import each other, shipped it where
18
+ * neither host's server could import it: fndvit-website's
19
+ * `schemas/weekly.ts` reaches it through `./content` and is itself read by
20
+ * `routes/weeklies/+page.server.ts`.
21
+ *
22
+ * Splitting the file is the whole fix. Nothing moves for a component host —
23
+ * `./content` still exports every name from here — and the four facts a
24
+ * server needs stop being locked behind a graph it must not load.
25
+ */
26
+ /**
27
+ * The weeklies index's URL defaults: the value a param stands for when it is
28
+ * absent. Both halves of the URL contract — `createWeeklyList` omitting a
29
+ * default, the host's query schema supplying one — must name the same values,
30
+ * so a host derives its schema defaults from here rather than restating them.
31
+ *
32
+ * `pageSize` is here for the same reason one step further out. It is not a
33
+ * URL param: it is what a page of this list HOLDS, which the grid this
34
+ * package renders decides. Every host was spelling its own — fndvit-website
35
+ * as `WEEKLIES_PAGE_SIZE`, vit-brain's mirror as a bare `12` in markup — and
36
+ * the two must agree, because the mirror exists to page the same corpus the
37
+ * site pages. Two repositories that cannot import each other were each
38
+ * holding half of one number. `createWeeklyList` still READS the size from
39
+ * `config.server().pageSize`, so a host may still answer something else; this
40
+ * is the value it should answer unless it means to differ.
41
+ */
42
+ export const WEEKLY_LIST_DEFAULTS = { sort: 'desc', page: 1, pageSize: 12 };
@@ -1,45 +1,6 @@
1
1
  import type { Locale } from '../config/types.js';
2
2
  import type { SortDirection, WeeklyCardData } from '../content/types.js';
3
- /**
4
- * The weeklies index's URL defaults: the value a param stands for when it is
5
- * absent. Both halves of the URL contract — this module omitting a default,
6
- * the host's query schema supplying one — must name the same values, so a
7
- * host derives its schema defaults from here rather than restating them.
8
- *
9
- * `pageSize` is here for the same reason one step further out. It is not a
10
- * URL param: it is what a page of this list HOLDS, which the grid this
11
- * package renders decides. Every host was spelling its own — fndvit-website
12
- * as `WEEKLIES_PAGE_SIZE`, vit-brain's mirror as a bare `12` in markup — and
13
- * the two must agree, because the mirror exists to page the same corpus the
14
- * site pages. Two repositories that cannot import each other were each
15
- * holding half of one number. `createWeeklyList` still READS the size from
16
- * `config.server().pageSize`, so a host may still answer something else; this
17
- * is the value it should answer unless it means to differ.
18
- */
19
- export declare const WEEKLY_LIST_DEFAULTS: {
20
- readonly sort: "desc";
21
- readonly page: 1;
22
- readonly pageSize: 12;
23
- };
24
- /** A type alias, not an interface: createUrlFilters needs an index signature. */
25
- export type WeeklyListFilters = {
26
- q: string;
27
- theme: string | null;
28
- sort: SortDirection;
29
- };
30
- /** One page of the list plus the unpaged total (for the pagination). */
31
- export interface WeeklyListPage {
32
- items: WeeklyCardData[];
33
- total: number;
34
- }
35
- /** The server-rendered page, re-read on every navigation. */
36
- export interface WeeklyListServerData {
37
- weeklies: WeeklyCardData[];
38
- total: number;
39
- page: number;
40
- pageSize: number;
41
- query: WeeklyListFilters;
42
- }
3
+ import type { WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './weekly-list-contract.js';
43
4
  export interface WeeklyListConfig {
44
5
  /** Reads the route's `data`; called inside an effect, so it tracks it. */
45
6
  server: () => WeeklyListServerData;
@@ -1,22 +1,6 @@
1
1
  import { buildQueryString } from './paths.js';
2
2
  import { createUrlFilters } from './url-filters.svelte.js';
3
- /**
4
- * The weeklies index's URL defaults: the value a param stands for when it is
5
- * absent. Both halves of the URL contract — this module omitting a default,
6
- * the host's query schema supplying one — must name the same values, so a
7
- * host derives its schema defaults from here rather than restating them.
8
- *
9
- * `pageSize` is here for the same reason one step further out. It is not a
10
- * URL param: it is what a page of this list HOLDS, which the grid this
11
- * package renders decides. Every host was spelling its own — fndvit-website
12
- * as `WEEKLIES_PAGE_SIZE`, vit-brain's mirror as a bare `12` in markup — and
13
- * the two must agree, because the mirror exists to page the same corpus the
14
- * site pages. Two repositories that cannot import each other were each
15
- * holding half of one number. `createWeeklyList` still READS the size from
16
- * `config.server().pageSize`, so a host may still answer something else; this
17
- * is the value it should answer unless it means to differ.
18
- */
19
- export const WEEKLY_LIST_DEFAULTS = { sort: 'desc', page: 1, pageSize: 12 };
3
+ import { WEEKLY_LIST_DEFAULTS } from './weekly-list-contract.js';
20
4
  /** The index's path, shared by the mirrored URL and the paging hrefs. */
21
5
  const WEEKLIES_PATH = '/weeklies';
22
6
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vit-foundation/ui",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",