@peasant-labs/fairtrade 0.0.41 → 0.0.43

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.
@@ -63,8 +63,13 @@ export function AppPage({ children, as: Tag, className, ...rest }: AppPageProps)
63
63
  */
64
64
  /**
65
65
  * @typedef {Object} AppSidebarAccount
66
- * @property {string} handle shown as @handle; its first letter fills the square avatar.
66
+ * @property {string} handle shown after an at sign; its first letter fills the square avatar. (An at sign
67
+ * opening a word here would start a JSDoc tag and drop every property after it from the types.)
67
68
  * @property {string} [href] makes the account row a link.
69
+ * @property {string} [avatarUrl] the person's picture in the avatar square, decorative (the handle sits beside
70
+ * it); the initial shows instead while it is missing or when it fails to load.
71
+ * @property {import('./Menu.jsx').MenuItem[]} [items] makes the account row its own menu (profile, settings, sign
72
+ * out), drawn as the same flat row with no caret and opening above the footer. Takes precedence over href.
68
73
  */
69
74
  /**
70
75
  * @typedef {Object} AppSidebarProps
@@ -213,9 +218,24 @@ export type AppSidebarSearch = {
213
218
  };
214
219
  export type AppSidebarAccount = {
215
220
  /**
216
- * shown as
221
+ * shown after an at sign; its first letter fills the square avatar. (An at sign
222
+ * opening a word here would start a JSDoc tag and drop every property after it from the types.)
217
223
  */
218
224
  handle: string;
225
+ /**
226
+ * makes the account row a link.
227
+ */
228
+ href?: string;
229
+ /**
230
+ * the person's picture in the avatar square, decorative (the handle sits beside
231
+ * it); the initial shows instead while it is missing or when it fails to load.
232
+ */
233
+ avatarUrl?: string;
234
+ /**
235
+ * makes the account row its own menu (profile, settings, sign
236
+ * out), drawn as the same flat row with no caret and opening above the footer. Takes precedence over href.
237
+ */
238
+ items?: import("./Menu.jsx").MenuItem[];
219
239
  };
220
240
  export type AppSidebarProps = {
221
241
  /**
@@ -21,8 +21,12 @@
21
21
  * @param {React.ComponentType<any>} [props.icon] icon-only trigger: the glyph replaces the label and the caret
22
22
  * @param {string} [props.ariaLabel] the trigger's accessible name; required with `icon`, and the menu's name
23
23
  * @param {'sm'|'md'} [props.size='md'] `sm` uses the compact control height (header rows)
24
+ * @param {'bottom'|'top'} [props.side='bottom'] which side of the trigger the popout opens on; `top` for a
25
+ * trigger at the foot of a column (a sidebar's account row)
26
+ * @param {string} [props.triggerClassName] a host-drawn trigger: these classes replace the button's own,
27
+ * and the caret is left out, so a row can be its own menu trigger
24
28
  */
25
- export default function Menu({ label, items, align, caption, defaultOpen, icon: TriggerIcon, ariaLabel, size }: {
29
+ export default function Menu({ label, items, align, caption, defaultOpen, icon: TriggerIcon, ariaLabel, size, side, triggerClassName }: {
26
30
  label?: React.ReactNode;
27
31
  items?: MenuItem[];
28
32
  align?: "start" | "end";
@@ -31,6 +35,8 @@ export default function Menu({ label, items, align, caption, defaultOpen, icon:
31
35
  icon?: React.ComponentType<any>;
32
36
  ariaLabel?: string;
33
37
  size?: "sm" | "md";
38
+ side?: "bottom" | "top";
39
+ triggerClassName?: string;
34
40
  }): import("react").JSX.Element;
35
41
  export type MenuItem = {
36
42
  /**
@@ -2,5 +2,5 @@
2
2
  * @typedef {import('./types.js').ExploreSurfaceProps} ExploreSurfaceProps
3
3
  */
4
4
  /** @param {ExploreSurfaceProps} props */
5
- export default function Explore({ data, className, onFiltersChange, onOpenTranscript, onOpenProfile, onOpenCollective, transcriptHref, profileHref, collectiveHref, }: ExploreSurfaceProps): import("react").JSX.Element;
5
+ export default function Explore({ data, className, onFiltersChange, onOpenTranscript, onOpenProfile, onOpenCollective, transcriptHref, profileHref, collectiveHref, headingLevel, }: ExploreSurfaceProps): import("react").JSX.Element;
6
6
  export type ExploreSurfaceProps = import("./types.js").ExploreSurfaceProps;
@@ -95,6 +95,12 @@ export type ExploreSurfaceProps = {
95
95
  transcriptHref?: (transcript: ExploreTranscriptPayload) => string;
96
96
  profileHref?: (owner: ExploreOwnerPayload) => string;
97
97
  collectiveHref?: (collective: CollectiveResultPayload) => string;
98
+ /**
99
+ * 2 by default: the page title ("explore transcripts", a transcript's title, a
100
+ * profile's name) is an h2 in a host page. 1 when the host mounts Explore as the whole page: that title is
101
+ * the page's h1 and every heading under it moves up one level.
102
+ */
103
+ headingLevel?: 1 | 2;
98
104
  };
99
105
  /**
100
106
  * The AUTHENTICATED VIEWER's role in a collective — a CollectiveRole, OR the
@@ -53,8 +53,10 @@
53
53
  * @param {import('./codeMapState.js').CodeMapState} [props.state] canonical controlled state
54
54
  * @param {Partial<import('./codeMapState.js').CodeMapState>} [props.defaultState] initial canonical uncontrolled state
55
55
  * @param {(state:import('./codeMapState.js').CodeMapState)=>void} [props.onStateChange]
56
+ * @param {'measured'|'unknown'} [props.lineCounts='measured'] passed to the navigator: 'unknown' leaves out every row's
57
+ * "N lines" figure when the host knows the payload's line counts were not measured
56
58
  */
57
- export default function CodeMapComposition({ payload, zoom, onZoomChange, selectedId, onSelect, onExpand, highlightedIds, nodeDeltas, structureEdgeDeltas, height, ariaLabel, canvasSlot, rail, toolbar, sheetTitle, sheetMeta, railSide, legend, canvasWrapperClassName, canvasWrapperStyle, className, presentation, navigatorSlot, onPresentationChange, viewport, onViewportChange, state, defaultState, onStateChange, }: {
59
+ export default function CodeMapComposition({ payload, zoom, onZoomChange, selectedId, onSelect, onExpand, highlightedIds, nodeDeltas, structureEdgeDeltas, height, ariaLabel, canvasSlot, rail, toolbar, sheetTitle, sheetMeta, railSide, legend, canvasWrapperClassName, canvasWrapperStyle, className, presentation, navigatorSlot, onPresentationChange, viewport, onViewportChange, state, defaultState, onStateChange, lineCounts, }: {
58
60
  payload?: import("./types.js").CodeMapPayload;
59
61
  zoom?: {
60
62
  level: "project" | "package" | "file";
@@ -98,6 +100,7 @@ export default function CodeMapComposition({ payload, zoom, onZoomChange, select
98
100
  state?: import("./codeMapState.js").CodeMapState;
99
101
  defaultState?: Partial<import("./codeMapState.js").CodeMapState>;
100
102
  onStateChange?: (state: import("./codeMapState.js").CodeMapState) => void;
103
+ lineCounts?: "measured" | "unknown";
101
104
  }): import("react").JSX.Element;
102
105
  /**
103
106
  * The persistent legend explaining the canvas's four orthogonal visual channels
@@ -17,8 +17,11 @@
17
17
  * @param {(id:string)=>void} [props.onOpenMap]
18
18
  * @param {(action:import('./codeMapState.js').CodeMapAction)=>void} [props.onStateAction]
19
19
  * @param {string} [props.ariaLabel='code map navigator']
20
+ * @param {'measured'|'unknown'} [props.lineCounts='measured'] whether the payload's line counts were measured.
21
+ * 'unknown' (the host could not read the project's languages, so every loc is an unmeasured 0) leaves the
22
+ * "N lines" figure out of every row instead of stating a false 0; a measured 0 still reads "0 lines".
20
23
  */
21
- export default function CodeMapNavigator({ payload, grain, expandedIds, onExpandedIdsChange, selectedId, onSelect, focusedId, onFocusChange, filter, onFilterChange, onOpenMap, onStateAction, ariaLabel, }: {
24
+ export default function CodeMapNavigator({ payload, grain, expandedIds, onExpandedIdsChange, selectedId, onSelect, focusedId, onFocusChange, filter, onFilterChange, onOpenMap, onStateAction, ariaLabel, lineCounts, }: {
22
25
  payload: import("./types.js").CodeMapPayload;
23
26
  grain?: "project" | "package" | "file";
24
27
  expandedIds?: Iterable<string>;
@@ -32,4 +35,5 @@ export default function CodeMapNavigator({ payload, grain, expandedIds, onExpand
32
35
  onOpenMap?: (id: string) => void;
33
36
  onStateAction?: (action: import("./codeMapState.js").CodeMapAction) => void;
34
37
  ariaLabel?: string;
38
+ lineCounts?: "measured" | "unknown";
35
39
  }): import("react").JSX.Element;
@@ -80,7 +80,7 @@ export function deriveCodeMapView(payload: import("./types.js").CodeMapPayload |
80
80
  * @property {CodeMapRankMode} rankMode - ranked-entry-list scoring mode.
81
81
  * @property {string|null} scentFilter - one `SCENT_TAGS` member, or null for no filter.
82
82
  */
83
- /** @typedef {{node:import('./types.js').MapNodePayload, depth:number, parentId:string|null, childIds:string[], hasChildren:boolean, canExpand:boolean, forcedOpen:boolean, expanded:boolean}} CodeMapNavigatorRow */
83
+ /** @typedef {{node:import('./types.js').MapNodePayload, depth:number, parentId:string|null, childIds:string[], hasChildren:boolean, canExpand:boolean, forcedOpen:boolean, openByGrain:boolean, expanded:boolean}} CodeMapNavigatorRow */
84
84
  /** @typedef {{orderedIds:string[], rootIds:string[], childIdsByParent:Record<string,string[]>, depthById:Record<string,number>}} CodeMapHierarchy */
85
85
  /** @typedef {{allNodes:import('./types.js').MapNodePayload[], nodes:import('./types.js').MapNodePayload[], visibleIds:string[], selectedId:string|null, grain:CodeMapGrain, expandedIds:string[], viewport:CodeMapViewport|null, hierarchy:CodeMapHierarchy}} CodeMapCanvasView */
86
86
  /** @typedef {{state:CodeMapState, rows:CodeMapNavigatorRow[], focusedId:string|null, selected:import('./types.js').MapNodePayload|null, staleSelectedId:string|null, canvas:CodeMapCanvasView}} CodeMapView */
@@ -212,6 +212,7 @@ export type CodeMapNavigatorRow = {
212
212
  hasChildren: boolean;
213
213
  canExpand: boolean;
214
214
  forcedOpen: boolean;
215
+ openByGrain: boolean;
215
216
  expanded: boolean;
216
217
  };
217
218
  export type CodeMapHierarchy = {
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @param {unknown} level - the composite's `headingLevel` prop.
3
+ * @param {string} component - the composite's name, for the error.
4
+ * @returns {1|2}
5
+ */
6
+ export function pageHeadingLevel(level: unknown, component: string): 1 | 2;
7
+ /**
8
+ * The tag for a heading drawn `depth` levels under the composite's title (0 is the title itself).
9
+ * @param {1|2} pageLevel
10
+ * @param {number} depth
11
+ * @returns {'h1'|'h2'|'h3'|'h4'|'h5'|'h6'}
12
+ */
13
+ export function headingTag(pageLevel: 1 | 2, depth: number): "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
14
+ /** The page-title levels a composite accepts. */
15
+ export const PAGE_HEADING_LEVELS: readonly number[];
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @param {TranscriptViewerProps} props
3
3
  */
4
- export default function TranscriptViewer({ viewModel, capabilities, callbacks, theme: themeProp, onThemeChange, graphSlot, activeTab: activeTabProp, onTabChange, viewMode: viewModeProp, onViewModeChange, leftRailOpen: leftRailOpenProp, onLeftRailOpenChange, rightRailOpen: rightRailOpenProp, onRightRailOpenChange, openTools: openToolsProp, onOpenToolsChange, earlierHistoryOpen: earlierHistoryOpenProp, onEarlierHistoryOpenChange, initialPosition: initialPositionProp, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, breadcrumb, LinkComponent, renderTurnPanel, renderTurnActions, anchorHref, headerActions, streamPrelude, showTail, showOutcome, showSearchTrigger, pullRequests, }: TranscriptViewerProps): import("react").JSX.Element;
4
+ export default function TranscriptViewer({ viewModel, capabilities, callbacks, theme: themeProp, onThemeChange, graphSlot, activeTab: activeTabProp, onTabChange, viewMode: viewModeProp, onViewModeChange, leftRailOpen: leftRailOpenProp, onLeftRailOpenChange, rightRailOpen: rightRailOpenProp, onRightRailOpenChange, openTools: openToolsProp, onOpenToolsChange, earlierHistoryOpen: earlierHistoryOpenProp, onEarlierHistoryOpenChange, initialPosition: initialPositionProp, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, breadcrumb, LinkComponent, renderTurnPanel, renderTurnActions, anchorHref, headerActions, streamPrelude, showTail, showOutcome, showSearchTrigger, pullRequests, headingLevel, }: TranscriptViewerProps): import("react").JSX.Element;
5
5
  export type TranscriptViewerProps = import("./state-capabilities.js").TranscriptViewerProps;
6
6
  export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
7
7
  export type TraceReadingSnapshot = {
@@ -13,8 +13,10 @@
13
13
  * @param {boolean} [props.compact]
14
14
  * @param {boolean} [props.expandAll]
15
15
  * @param {number} [props.revealRequest] explicit search navigation sequence
16
+ * @param {number} [props.headingLevel=4] the turn heading's level: h4 under a viewer whose title is an h2, h3 under one
17
+ * whose title is the page's h1
16
18
  */
17
- export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, renderActions, savedLabel, compact, expandAll, revealRequest, }: {
19
+ export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, renderActions, savedLabel, compact, expandAll, revealRequest, headingLevel, }: {
18
20
  turn?: TurnVM;
19
21
  active?: boolean;
20
22
  openTools?: Record<string, boolean>;
@@ -31,5 +33,6 @@ export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAn
31
33
  compact?: boolean;
32
34
  expandAll?: boolean;
33
35
  revealRequest?: number;
36
+ headingLevel?: number;
34
37
  }): import("react").JSX.Element;
35
38
  export type TurnVM = import("./view-model.js").TurnVM;
@@ -230,6 +230,10 @@ export type TranscriptViewerProps = {
230
230
  * default false: render a `search this transcript` button at the end of the tab strip that opens search exactly as ⌘F does; independent of `showTail`
231
231
  */
232
232
  showSearchTrigger?: boolean;
233
+ /**
234
+ * default 2: the transcript's title is an h2 in a host page; 1 when the host mounts the viewer as the whole page, so the title is the page's h1 and the phase and turn headings move up one level
235
+ */
236
+ headingLevel?: 1 | 2;
233
237
  /**
234
238
  * host-owned node rendered under the meta row (a pull request list and its own "show all" control); omitted renders nothing
235
239
  */