@vit-foundation/ui 0.21.0 → 0.22.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.
@@ -25,7 +25,7 @@
25
25
  <script lang="ts">
26
26
  import { getUiConfig } from '../../config/context.js';
27
27
  import ActionLabel from '../../edit/ActionLabel.svelte';
28
- import type { MilestoneCategory, MilestoneData } from '../../content/types.js';
28
+ import { MILESTONE_CATEGORIES, type MilestoneData } from '../../content/types.js';
29
29
  import EditFrame from '../../edit/chrome/EditFrame.svelte';
30
30
  import EditPanel from '../../edit/chrome/EditPanel.svelte';
31
31
  import Editable from '../../edit/Editable.svelte';
@@ -46,7 +46,7 @@
46
46
 
47
47
  const config = getUiConfig();
48
48
 
49
- const CATEGORIES = Object.keys(MILESTONE_CATEGORY_COLOR) as MilestoneCategory[];
49
+ // The set's own order, not a colour map's key order and not a cast.
50
50
 
51
51
  /**
52
52
  * The panel rows, zipped from the map's descriptors and this milestone's
@@ -58,7 +58,7 @@
58
58
  edit?.occurredOn && { descriptor: edit.occurredOn, value: milestone.occurredOn },
59
59
  edit?.category && {
60
60
  descriptor: {
61
- options: CATEGORIES.map((category) => ({
61
+ options: MILESTONE_CATEGORIES.map((category) => ({
62
62
  value: category,
63
63
  label: milestoneCategoryLabel(category, config.messages)
64
64
  })),
@@ -20,7 +20,7 @@ export interface MilestoneEditMap {
20
20
  kind: 'remove';
21
21
  }>;
22
22
  }
23
- import type { MilestoneData } from '../../content/types.js';
23
+ import { type MilestoneData } from '../../content/types.js';
24
24
  interface Props {
25
25
  milestone: MilestoneData;
26
26
  /** Marks fields editable where an edit adapter is active. */
@@ -1,4 +1,4 @@
1
1
  export { renderBody } from './richtext.js';
2
2
  export type { RichTextBlock } from './richtext.js';
3
- export { CONTACT_CATEGORIES, REACTIONS } from './types.js';
3
+ export { CONTACT_CATEGORIES, MILESTONE_CATEGORIES, PROJECT_KINDS, REACTIONS } from './types.js';
4
4
  export type { CollaboratorData, CommentData, CommentThreadData, ContactCategory, FieldConstraint, FormFailReason, JobOpeningData, MilestoneCategory, MilestoneData, ProjectCardData, ProjectKind, Reaction, ReactionSummary, ReactionTarget, SortDirection, TeamMemberData, WeeklyCardData } from './types.js';
@@ -1,2 +1,2 @@
1
1
  export { renderBody } from './richtext.js';
2
- export { CONTACT_CATEGORIES, REACTIONS } from './types.js';
2
+ export { CONTACT_CATEGORIES, MILESTONE_CATEGORIES, PROJECT_KINDS, REACTIONS } from './types.js';
@@ -28,7 +28,9 @@ export interface WeeklyCardData {
28
28
  excerpt: string;
29
29
  imageUrl: string;
30
30
  }
31
- export type ProjectKind = 'collaboration' | 'passion';
31
+ /** The kinds a project can have, in display order — a host's enum derives from this. */
32
+ export declare const PROJECT_KINDS: readonly ["collaboration", "passion"];
33
+ export type ProjectKind = (typeof PROJECT_KINDS)[number];
32
34
  /** A project as its card shows it. */
33
35
  export interface ProjectCardData {
34
36
  id: number;
@@ -43,7 +45,23 @@ export interface ProjectCardData {
43
45
  externalUrl: string | null;
44
46
  hasStory: boolean;
45
47
  }
46
- export type MilestoneCategory = 'education' | 'lab' | 'foundation' | 'collaboration' | 'press';
48
+ /**
49
+ * The timeline's categories, in DISPLAY ORDER — every select that offers them
50
+ * and every host enum derives from this.
51
+ *
52
+ * The order was an emergent property of two unrelated literals before: the
53
+ * panel select read `Object.keys(MILESTONE_CATEGORY_COLOR)` while vit-brain's
54
+ * record form spelled its own array, so one CMS offered the same field in two
55
+ * orders and seeded a new row with the third member of one of them. The order
56
+ * kept here is the colour map's, which is the one with a reason attached (its
57
+ * slots are fixed and never reordered).
58
+ *
59
+ * A tuple rather than a union for the reason `CONTACT_CATEGORIES` is one: a
60
+ * `satisfies readonly MilestoneCategory[]` binds the element type and never
61
+ * the list, so a host could drop a member and still compile.
62
+ */
63
+ export declare const MILESTONE_CATEGORIES: readonly ["foundation", "lab", "education", "collaboration", "press"];
64
+ export type MilestoneCategory = (typeof MILESTONE_CATEGORIES)[number];
47
65
  /** One timeline milestone. */
48
66
  export interface MilestoneData {
49
67
  id: number;
@@ -3,6 +3,30 @@
3
3
  * applied. The website's zod-inferred types satisfy these structurally; the
4
4
  * package states them itself so consumers owe it no schema library.
5
5
  */
6
+ /** The kinds a project can have, in display order — a host's enum derives from this. */
7
+ export const PROJECT_KINDS = ['collaboration', 'passion'];
8
+ /**
9
+ * The timeline's categories, in DISPLAY ORDER — every select that offers them
10
+ * and every host enum derives from this.
11
+ *
12
+ * The order was an emergent property of two unrelated literals before: the
13
+ * panel select read `Object.keys(MILESTONE_CATEGORY_COLOR)` while vit-brain's
14
+ * record form spelled its own array, so one CMS offered the same field in two
15
+ * orders and seeded a new row with the third member of one of them. The order
16
+ * kept here is the colour map's, which is the one with a reason attached (its
17
+ * slots are fixed and never reordered).
18
+ *
19
+ * A tuple rather than a union for the reason `CONTACT_CATEGORIES` is one: a
20
+ * `satisfies readonly MilestoneCategory[]` binds the element type and never
21
+ * the list, so a host could drop a member and still compile.
22
+ */
23
+ export const MILESTONE_CATEGORIES = [
24
+ 'foundation',
25
+ 'lab',
26
+ 'education',
27
+ 'collaboration',
28
+ 'press'
29
+ ];
6
30
  /** The reactions a weekly or comment can carry, in display order. */
7
31
  export const REACTIONS = ['like', 'love', 'clap'];
8
32
  /** The contact form's reasons, in display order — the host schema derives its enum from this. */
@@ -43,6 +43,8 @@ export { localize } from './edit/types.js';
43
43
  export type { CollectionRef, ContentRef, EditableEntity, EditDescriptor, EntityOp, LocalizedText, PropertyDescriptor, PropertyOption, PropertyType, PropertyValue } from './edit/types.js';
44
44
  export { REACTIONS } from './content/types.js';
45
45
  export type { Reaction, ReactionSummary, SortDirection } from './content/types.js';
46
+ export { MILESTONE_CATEGORIES, PROJECT_KINDS } from './content/types.js';
47
+ export type { MilestoneCategory, ProjectKind } from './content/types.js';
46
48
  export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
47
49
  export type { WeeklyListFilters, WeeklyListPage, WeeklyListServerData } from './utils/weekly-list-contract.js';
48
50
  export { CONTACT_CATEGORIES } from './content/types.js';
@@ -51,3 +53,15 @@ export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN
51
53
  export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
52
54
  export type { FormFail, FormFieldIssue, FormResultLike, FormResultOf, KeyedRemoteForms, RemoteField, RemoteFormAttributes, RemoteFormInstance } from './forms/types.js';
53
55
  export { buildQueryString, isExternalUrl, isInternalPath, isPathUnder } from './utils/paths.js';
56
+ /**
57
+ * The descriptor factories. `edit/helpers.ts` imports nothing but types from
58
+ * two modules this subpath already anchors, so it needed a door rather than a
59
+ * split.
60
+ *
61
+ * They were reachable only beside the components, which cost vit-brain an
62
+ * eslint exception that switched `no-restricted-imports` off WHOLESALE for the
63
+ * two files calling one factory each — and one of those, `mirror.ts`, is
64
+ * already reached from a server repository by `import type`. A per-specifier
65
+ * door replaces a per-file hole.
66
+ */
67
+ export { chromeEdit, chromeProperty, collectionOf, entityEdit, entityProperty, pageCopyEdit } from './edit/helpers.js';
package/dist/contract.js CHANGED
@@ -40,8 +40,24 @@
40
40
  export { LOCALES, BASE_LOCALE } from './config/types.js';
41
41
  export { localize } from './edit/types.js';
42
42
  export { REACTIONS } from './content/types.js';
43
+ // The two content vocabularies a host's zod enum derives from, the way its
44
+ // contact form already derives from CONTACT_CATEGORIES below. Values, because
45
+ // a type cannot be the source of an enum.
46
+ export { MILESTONE_CATEGORIES, PROJECT_KINDS } from './content/types.js';
43
47
  export { WEEKLY_LIST_DEFAULTS } from './utils/weekly-list-contract.js';
44
48
  export { CONTACT_CATEGORIES } from './content/types.js';
45
49
  export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN_PASSWORD, PASSWORD } from './forms/constraints.js';
46
50
  export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
47
51
  export { buildQueryString, isExternalUrl, isInternalPath, isPathUnder } from './utils/paths.js';
52
+ /**
53
+ * The descriptor factories. `edit/helpers.ts` imports nothing but types from
54
+ * two modules this subpath already anchors, so it needed a door rather than a
55
+ * split.
56
+ *
57
+ * They were reachable only beside the components, which cost vit-brain an
58
+ * eslint exception that switched `no-restricted-imports` off WHOLESALE for the
59
+ * two files calling one factory each — and one of those, `mirror.ts`, is
60
+ * already reached from a server repository by `import type`. A per-specifier
61
+ * door replaces a per-file hole.
62
+ */
63
+ export { chromeEdit, chromeProperty, collectionOf, entityEdit, entityProperty, pageCopyEdit } from './edit/helpers.js';
@@ -5,6 +5,11 @@ import type { MilestoneCategory } from '../content/types.js';
5
5
  * teal, slots are never reordered). Labels always accompany the color dot,
6
6
  * so color is never the only encoding. The --series-* tokens ship in
7
7
  * tokens.css.
8
+ *
9
+ * Keyed, not positional, so a member added to `MILESTONE_CATEGORIES` fails to
10
+ * compile here rather than silently taking slot 6 — and so the display order
11
+ * is `MILESTONE_CATEGORIES`' to decide, not a side effect of this literal's
12
+ * key order, which is what the panel select used to read.
8
13
  */
9
14
  export declare const MILESTONE_CATEGORY_COLOR: Record<MilestoneCategory, string>;
10
15
  /**
@@ -3,6 +3,11 @@
3
3
  * teal, slots are never reordered). Labels always accompany the color dot,
4
4
  * so color is never the only encoding. The --series-* tokens ship in
5
5
  * tokens.css.
6
+ *
7
+ * Keyed, not positional, so a member added to `MILESTONE_CATEGORIES` fails to
8
+ * compile here rather than silently taking slot 6 — and so the display order
9
+ * is `MILESTONE_CATEGORIES`' to decide, not a side effect of this literal's
10
+ * key order, which is what the panel select used to read.
6
11
  */
7
12
  export const MILESTONE_CATEGORY_COLOR = {
8
13
  foundation: 'var(--series-1)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vit-foundation/ui",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1,2 +0,0 @@
1
- export { default as JobList } from './JobList.svelte';
2
- export type { JobEditMap } from './JobList.svelte';
@@ -1 +0,0 @@
1
- export { default as JobList } from './JobList.svelte';
@@ -1,3 +0,0 @@
1
- export { default as Footer } from './Footer.svelte';
2
- export { default as Nav } from './Nav.svelte';
3
- export { default as PageShell } from './PageShell.svelte';
@@ -1,3 +0,0 @@
1
- export { default as Footer } from './Footer.svelte';
2
- export { default as Nav } from './Nav.svelte';
3
- export { default as PageShell } from './PageShell.svelte';
@@ -1,2 +0,0 @@
1
- export { default as ProjectCard } from './ProjectCard.svelte';
2
- export type { ProjectEditMap } from './ProjectCard.svelte';
@@ -1 +0,0 @@
1
- export { default as ProjectCard } from './ProjectCard.svelte';
@@ -1,3 +0,0 @@
1
- export { default as CollaboratorList } from './CollaboratorList.svelte';
2
- export { default as TeamMemberCard } from './TeamMemberCard.svelte';
3
- export type { TeamMemberEditMap } from './TeamMemberCard.svelte';
@@ -1,2 +0,0 @@
1
- export { default as CollaboratorList } from './CollaboratorList.svelte';
2
- export { default as TeamMemberCard } from './TeamMemberCard.svelte';
@@ -1,3 +0,0 @@
1
- export { default as Timeline } from './Timeline.svelte';
2
- export { default as TimelineMilestone } from './TimelineMilestone.svelte';
3
- export type { MilestoneEditMap } from './TimelineMilestone.svelte';
@@ -1,2 +0,0 @@
1
- export { default as Timeline } from './Timeline.svelte';
2
- export { default as TimelineMilestone } from './TimelineMilestone.svelte';
@@ -1,20 +0,0 @@
1
- export { default as Button } from './Button.svelte';
2
- export { default as CardMedia } from './CardMedia.svelte';
3
- export { default as CardTitle } from './CardTitle.svelte';
4
- export { default as CopyIntro } from './CopyIntro.svelte';
5
- export { default as DateText } from './DateText.svelte';
6
- export { default as DecorShapes } from './DecorShapes.svelte';
7
- export { default as Field } from './Field.svelte';
8
- export { default as FilterChips } from './FilterChips.svelte';
9
- export { default as FormErrorFeedback } from './FormErrorFeedback.svelte';
10
- export { default as FormFeedback } from './FormFeedback.svelte';
11
- export { default as FormResultSlot } from './FormResultSlot.svelte';
12
- export { default as GhostButton } from './GhostButton.svelte';
13
- export { default as Honeypot } from './Honeypot.svelte';
14
- export { default as Link } from './Link.svelte';
15
- export { default as LocaleField } from './LocaleField.svelte';
16
- export { default as NewsletterIntentField } from './NewsletterIntentField.svelte';
17
- export { default as Pagination } from './Pagination.svelte';
18
- export { default as RichText } from './RichText.svelte';
19
- export { default as SearchInput } from './SearchInput.svelte';
20
- export { default as ShareRow } from './ShareRow.svelte';
@@ -1,20 +0,0 @@
1
- export { default as Button } from './Button.svelte';
2
- export { default as CardMedia } from './CardMedia.svelte';
3
- export { default as CardTitle } from './CardTitle.svelte';
4
- export { default as CopyIntro } from './CopyIntro.svelte';
5
- export { default as DateText } from './DateText.svelte';
6
- export { default as DecorShapes } from './DecorShapes.svelte';
7
- export { default as Field } from './Field.svelte';
8
- export { default as FilterChips } from './FilterChips.svelte';
9
- export { default as FormErrorFeedback } from './FormErrorFeedback.svelte';
10
- export { default as FormFeedback } from './FormFeedback.svelte';
11
- export { default as FormResultSlot } from './FormResultSlot.svelte';
12
- export { default as GhostButton } from './GhostButton.svelte';
13
- export { default as Honeypot } from './Honeypot.svelte';
14
- export { default as Link } from './Link.svelte';
15
- export { default as LocaleField } from './LocaleField.svelte';
16
- export { default as NewsletterIntentField } from './NewsletterIntentField.svelte';
17
- export { default as Pagination } from './Pagination.svelte';
18
- export { default as RichText } from './RichText.svelte';
19
- export { default as SearchInput } from './SearchInput.svelte';
20
- export { default as ShareRow } from './ShareRow.svelte';
@@ -1,7 +0,0 @@
1
- export { default as CommentSection } from './CommentSection.svelte';
2
- export type { CommentFormInstance } from './CommentSection.svelte';
3
- export { default as ReactionBar } from './ReactionBar.svelte';
4
- export type { CommentReactionChip, ReactionBarForms, WeeklyReactionChip } from './ReactionBar.svelte';
5
- export { default as SortSelect } from './SortSelect.svelte';
6
- export { default as WeeklieCard } from './WeeklieCard.svelte';
7
- export type { WeeklyEditMap } from './WeeklieCard.svelte';
@@ -1,4 +0,0 @@
1
- export { default as CommentSection } from './CommentSection.svelte';
2
- export { default as ReactionBar } from './ReactionBar.svelte';
3
- export { default as SortSelect } from './SortSelect.svelte';
4
- export { default as WeeklieCard } from './WeeklieCard.svelte';