@peasant-labs/fairtrade 0.0.5 → 0.0.6

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.
@@ -43,8 +43,12 @@ var f = {
43
43
  bottom: 4,
44
44
  left: 4
45
45
  }
46
- }), v = { isAnimationActive: !1 };
47
- function y({ icon: n, title: r, aside: i, sub: a, legend: o, className: s = "", children: c }) {
46
+ }), v = { isAnimationActive: !1 }, y = (e) => {
47
+ if (typeof e != "number" || !Number.isFinite(e) || Math.abs(e) < 1e3) return e;
48
+ let t = e / 1e3;
49
+ return `${Math.abs(t) >= 10 ? Math.round(t) : Math.round(t * 10) / 10}k`;
50
+ };
51
+ function b({ icon: n, title: r, aside: i, sub: a, legend: o, className: s = "", children: c }) {
48
52
  return /* @__PURE__ */ t("figure", {
49
53
  className: ["chart", s].filter(Boolean).join(" "),
50
54
  children: [
@@ -83,7 +87,7 @@ function y({ icon: n, title: r, aside: i, sub: a, legend: o, className: s = "",
83
87
  ]
84
88
  });
85
89
  }
86
- function b({ active: n, payload: r, label: i, labelFormatter: a, valueFormatter: o }) {
90
+ function x({ active: n, payload: r, label: i, labelFormatter: a, valueFormatter: o }) {
87
91
  if (!n || !r || !r.length) return null;
88
92
  let s = o || ((e) => e);
89
93
  return /* @__PURE__ */ t("div", {
@@ -110,7 +114,7 @@ function b({ active: n, payload: r, label: i, labelFormatter: a, valueFormatter:
110
114
  }, r))]
111
115
  });
112
116
  }
113
- function x(e) {
117
+ function S(e) {
114
118
  return e.map((e, t) => ({
115
119
  ...e,
116
120
  color: e.color || m[t % m.length]
@@ -118,18 +122,18 @@ function x(e) {
118
122
  }
119
123
  //#endregion
120
124
  //#region src/ui/ChartBar.jsx
121
- function S({ data: n, xKey: o, series: s, stacked: f = !1, icon: p, title: m, aside: g, sub: S, height: C = 200, yTicks: w, xFormatter: T, valueFormatter: E, className: D = "" }) {
122
- let O = x(s);
123
- return /* @__PURE__ */ e(y, {
125
+ function C({ data: n, xKey: o, series: s, stacked: f = !1, icon: p, title: m, aside: g, sub: C, height: w = 200, yTicks: T, xFormatter: E, yFormatter: D = y, valueFormatter: O, className: k = "" }) {
126
+ let A = S(s);
127
+ return /* @__PURE__ */ e(b, {
124
128
  icon: p,
125
129
  title: m,
126
130
  aside: g,
127
- sub: S,
128
- legend: O,
129
- className: D,
131
+ sub: C,
132
+ legend: A,
133
+ className: k,
130
134
  children: /* @__PURE__ */ e(c, {
131
135
  width: "100%",
132
- height: C,
136
+ height: w,
133
137
  children: /* @__PURE__ */ t(i, {
134
138
  data: n,
135
139
  barCategoryGap: "22%",
@@ -139,27 +143,28 @@ function S({ data: n, xKey: o, series: s, stacked: f = !1, icon: p, title: m, as
139
143
  /* @__PURE__ */ e(u, {
140
144
  dataKey: o,
141
145
  tickLine: !1,
142
- interval: 0,
143
- tickFormatter: T,
146
+ interval: "preserveStartEnd",
147
+ tickFormatter: E,
144
148
  tickMargin: 8,
145
- minTickGap: 0
149
+ minTickGap: 28
146
150
  }),
147
151
  /* @__PURE__ */ e(d, {
148
- width: 28,
152
+ width: 40,
149
153
  tickLine: !1,
150
154
  axisLine: !1,
151
- ticks: w,
155
+ ticks: T,
152
156
  allowDecimals: !1,
153
- tickMargin: 4
157
+ tickMargin: 4,
158
+ tickFormatter: D
154
159
  }),
155
160
  /* @__PURE__ */ e(l, {
156
161
  cursor: { className: "chart-cursor" },
157
- content: /* @__PURE__ */ e(b, {
158
- valueFormatter: E,
159
- labelFormatter: T
162
+ content: /* @__PURE__ */ e(x, {
163
+ valueFormatter: O,
164
+ labelFormatter: E
160
165
  })
161
166
  }),
162
- O.map((t) => /* @__PURE__ */ e(r, {
167
+ A.map((t) => /* @__PURE__ */ e(r, {
163
168
  dataKey: t.key,
164
169
  name: t.name || t.key,
165
170
  className: h(t.color),
@@ -176,18 +181,18 @@ function S({ data: n, xKey: o, series: s, stacked: f = !1, icon: p, title: m, as
176
181
  }
177
182
  //#endregion
178
183
  //#region src/ui/ChartLine.jsx
179
- function C({ data: r, xKey: i, series: f, icon: p, title: m, aside: g, sub: S, height: C = 200, yTicks: w, xFormatter: T, valueFormatter: E, className: D = "" }) {
180
- let O = x(f);
181
- return /* @__PURE__ */ e(y, {
184
+ function w({ data: r, xKey: i, series: f, icon: p, title: m, aside: g, sub: C, height: w = 200, yTicks: T, xFormatter: E, yFormatter: D = y, valueFormatter: O, className: k = "" }) {
185
+ let A = S(f);
186
+ return /* @__PURE__ */ e(b, {
182
187
  icon: p,
183
188
  title: m,
184
189
  aside: g,
185
- sub: S,
186
- legend: O,
187
- className: D,
190
+ sub: C,
191
+ legend: A,
192
+ className: k,
188
193
  children: /* @__PURE__ */ e(c, {
189
194
  width: "100%",
190
- height: C,
195
+ height: w,
191
196
  children: /* @__PURE__ */ t(o, {
192
197
  data: r,
193
198
  ..._(),
@@ -196,30 +201,31 @@ function C({ data: r, xKey: i, series: f, icon: p, title: m, aside: g, sub: S, h
196
201
  /* @__PURE__ */ e(u, {
197
202
  dataKey: i,
198
203
  tickLine: !1,
199
- interval: 0,
200
- tickFormatter: T,
204
+ interval: "preserveStartEnd",
205
+ tickFormatter: E,
201
206
  tickMargin: 8,
202
- minTickGap: 0
207
+ minTickGap: 28
203
208
  }),
204
209
  /* @__PURE__ */ e(d, {
205
- width: 28,
210
+ width: 40,
206
211
  tickLine: !1,
207
212
  axisLine: !1,
208
- ticks: w,
213
+ ticks: T,
209
214
  allowDecimals: !1,
210
- tickMargin: 4
215
+ tickMargin: 4,
216
+ tickFormatter: D
211
217
  }),
212
218
  /* @__PURE__ */ e(l, {
213
219
  cursor: {
214
220
  className: "chart-cursor",
215
221
  strokeWidth: 0
216
222
  },
217
- content: /* @__PURE__ */ e(b, {
218
- valueFormatter: E,
219
- labelFormatter: T
223
+ content: /* @__PURE__ */ e(x, {
224
+ valueFormatter: O,
225
+ labelFormatter: E
220
226
  })
221
227
  }),
222
- O.map((t) => t.area ? /* @__PURE__ */ e(n, {
228
+ A.map((t) => t.area ? /* @__PURE__ */ e(n, {
223
229
  dataKey: t.key,
224
230
  name: t.name || t.key,
225
231
  className: `${h(t.color)} chart-area`,
@@ -261,4 +267,4 @@ function C({ data: r, xKey: i, series: f, icon: p, title: m, aside: g, sub: S, h
261
267
  });
262
268
  }
263
269
  //#endregion
264
- export { S as n, h as r, C as t };
270
+ export { C as n, h as r, w as t };
@@ -749,7 +749,7 @@ function I({ data: u = {
749
749
  Xe,
750
750
  Q
751
751
  ]), Qe = e((e) => {
752
- if (e.button !== 0) return;
752
+ if (e.button !== 0 || e.target instanceof Element && e.target.closest("button, a, input, select, textarea")) return;
753
753
  let t = L.current;
754
754
  t && t.setPointerCapture?.(e.pointerId), R.current = {
755
755
  startX: e.clientX,
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./ChartLine-Dlp6-CLL.js";
1
+ import { n as e, t } from "./ChartLine-Cycmpjep.js";
2
2
  import { useMemo as n, useState as r } from "react";
3
3
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
4
  import { Activity as o, BarChart3 as s, ChevronDown as c, ChevronUp as l, ChevronsUpDown as u, CircleCheck as d, GitCommitHorizontal as f, Hash as p, PieChart as m, SlidersHorizontal as h, Timer as g, TrendingUp as ee, UserPlus as te, Users as _ } from "lucide-react";
@@ -1,4 +1,4 @@
1
- import { Cn as e, Ct as t, Dt as n, G as r, Gn as i, J as a, Ot as o, Rn as s, St as c, Tt as l, Un as u, Vn as d, Wn as f, Y as p, Z as m, kt as h, q as g, wt as _, yn as v } from "./ui-oBFnHPFe.js";
1
+ import { Cn as e, Ct as t, Dt as n, G as r, Gn as i, J as a, Ot as o, Rn as s, St as c, Tt as l, Un as u, Vn as d, Wn as f, Y as p, Z as m, kt as h, q as g, wt as _, yn as v } from "./ui-TG4XLhWL.js";
2
2
  import { useEffect as y, useId as b, useMemo as x, useRef as S, useState as C } from "react";
3
3
  import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
4
4
  import { AlertTriangle as D, ArrowRight as O, Check as k, ChevronDown as A, ChevronRight as j, CircleDot as M, Compass as N, Copy as P, ExternalLink as F, Eye as I, EyeOff as L, FileText as R, FolderGit2 as z, GitBranch as B, Hash as V, LayoutGrid as ee, List as te, Lock as H, LogOut as U, Plus as W, SearchX as ne, Settings as G, ShieldAlert as K, ShieldCheck as q, Terminal as J, Upload as re, User as ie, UserPlus as Y, Users as X, X as Z } from "lucide-react";
package/dist/lib/graph.js CHANGED
@@ -1,4 +1,4 @@
1
- import { d as e, l as t, n, r, s as i, t as a, u as o } from "./InUseShell-DZvmRdj-.js";
1
+ import { d as e, l as t, n, r, s as i, t as a, u as o } from "./InUseShell-CjtqHauP.js";
2
2
  import { useMemo as s, useRef as c, useState as l } from "react";
3
3
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
4
4
  import { Box as f, Check as p, ChevronDown as m, ChevronRight as h, Coins as g, CornerDownRight as _, FileDiff as v, FileText as y, GitMerge as b, Hash as x, MessageSquare as S, RotateCw as C, Share2 as w, Tag as T, TriangleAlert as E, X as D } from "lucide-react";
@@ -17,10 +17,11 @@
17
17
  * @param {number} [props.height=200] plot height in px.
18
18
  * @param {number[]} [props.yTicks] explicit y ticks; omit to auto-pick integers.
19
19
  * @param {(v:any)=>React.ReactNode} [props.xFormatter] format x tick + tooltip label.
20
+ * @param {(v:any)=>React.ReactNode} [props.yFormatter] format y ticks; defaults to thousands-compaction (3000 → 3k).
20
21
  * @param {(v:any)=>React.ReactNode} [props.valueFormatter] format the tooltip value.
21
22
  * @param {string} [props.className] extra class on the chart frame.
22
23
  */
23
- export default function ChartBar({ data, xKey, series, stacked, icon, title, aside, sub, height, yTicks, xFormatter, valueFormatter, className, }: {
24
+ export default function ChartBar({ data, xKey, series, stacked, icon, title, aside, sub, height, yTicks, xFormatter, yFormatter, valueFormatter, className, }: {
24
25
  data: any[];
25
26
  xKey: string;
26
27
  series: BarSeries[];
@@ -32,6 +33,7 @@ export default function ChartBar({ data, xKey, series, stacked, icon, title, asi
32
33
  height?: number;
33
34
  yTicks?: number[];
34
35
  xFormatter?: (v: any) => React.ReactNode;
36
+ yFormatter?: (v: any) => React.ReactNode;
35
37
  valueFormatter?: (v: any) => React.ReactNode;
36
38
  className?: string;
37
39
  }): any;
@@ -17,10 +17,11 @@
17
17
  * @param {number} [props.height=200] plot height in px.
18
18
  * @param {number[]} [props.yTicks] explicit y ticks; omit to auto-pick integers.
19
19
  * @param {(v:any)=>React.ReactNode} [props.xFormatter] format x tick + tooltip label.
20
+ * @param {(v:any)=>React.ReactNode} [props.yFormatter] format y ticks; defaults to thousands-compaction (3000 → 3k).
20
21
  * @param {(v:any)=>React.ReactNode} [props.valueFormatter] format the tooltip value.
21
22
  * @param {string} [props.className] extra class on the chart frame.
22
23
  */
23
- export default function ChartLine({ data, xKey, series, icon, title, aside, sub, height, yTicks, xFormatter, valueFormatter, className, }: {
24
+ export default function ChartLine({ data, xKey, series, icon, title, aside, sub, height, yTicks, xFormatter, yFormatter, valueFormatter, className, }: {
24
25
  data: any[];
25
26
  xKey: string;
26
27
  series: LineSeries[];
@@ -31,6 +32,7 @@ export default function ChartLine({ data, xKey, series, icon, title, aside, sub,
31
32
  height?: number;
32
33
  yTicks?: number[];
33
34
  xFormatter?: (v: any) => React.ReactNode;
35
+ yFormatter?: (v: any) => React.ReactNode;
34
36
  valueFormatter?: (v: any) => React.ReactNode;
35
37
  className?: string;
36
38
  }): any;
@@ -61,3 +61,4 @@ export function cartesianProps(): {
61
61
  export namespace noAnim {
62
62
  let isAnimationActive: boolean;
63
63
  }
64
+ export function compactTick(v: any): any;
@@ -1,6 +1,6 @@
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, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, }: TranscriptViewerProps): any;
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, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, breadcrumb, LinkComponent, renderTurnPanel, renderTurnActions, anchorHref, headerActions, }: TranscriptViewerProps): any;
5
5
  export type TranscriptViewerProps = import("./state-capabilities.js").TranscriptViewerProps;
6
6
  export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
@@ -8,11 +8,12 @@
8
8
  * @param {boolean} [props.copied]
9
9
  * @param {(turnIndex: number, el: HTMLElement | null) => void} [props.registerRef]
10
10
  * @param {(turnIndex: number) => void} [props.onLabel] omit to hide the "label" affordance
11
+ * @param {(turn: object) => unknown} [props.renderActions] host-owned per-turn actions; replaces the built-in label button (hosts with their own label models render their own popover)
11
12
  * @param {{ outcome: string, flag?: string }} [props.savedLabel]
12
13
  * @param {boolean} [props.compact]
13
14
  * @param {boolean} [props.expandAll]
14
15
  */
15
- export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, savedLabel, compact, expandAll, }: {
16
+ export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, renderActions, savedLabel, compact, expandAll, }: {
16
17
  turn?: TurnVM;
17
18
  active?: boolean;
18
19
  openTools?: Record<string, boolean>;
@@ -21,6 +22,7 @@ export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAn
21
22
  copied?: boolean;
22
23
  registerRef?: (turnIndex: number, el: HTMLElement | null) => void;
23
24
  onLabel?: (turnIndex: number) => void;
25
+ renderActions?: (turn: object) => unknown;
24
26
  savedLabel?: {
25
27
  outcome: string;
26
28
  flag?: string;
@@ -36,6 +36,7 @@ export type AnnotationSummary = import("./wire-types.js").AnnotationSummary;
36
36
  export type SessionDetailPayload = import("./wire-types.js").SessionDetailPayload;
37
37
  export type TranscriptWireInput = import("./wire-types.js").TranscriptWireInput;
38
38
  export type TranscriptViewerProps = import("./state-capabilities.js").TranscriptViewerProps;
39
+ export type BreadcrumbItem = import("./state-capabilities.js").BreadcrumbItem;
39
40
  export type ViewerCapabilities = import("./state-capabilities.js").ViewerCapabilities;
40
41
  export type ViewerCallbacks = import("./state-capabilities.js").ViewerCallbacks;
41
42
  export type GraphSlotContext = import("./state-capabilities.js").GraphSlotContext;
@@ -158,4 +158,35 @@ export type TranscriptViewerProps = {
158
158
  */
159
159
  moreOpen?: boolean;
160
160
  onMoreOpenChange?: (open: boolean) => void;
161
+ /**
162
+ * host-routable trail; omit for the demo's static crumb
163
+ */
164
+ breadcrumb?: BreadcrumbItem[];
165
+ /**
166
+ * router link for crumb items (e.g. next/link); defaults to 'a'
167
+ */
168
+ LinkComponent?: any;
169
+ /**
170
+ * host per-turn extension rendered under each turn card
171
+ */
172
+ renderTurnPanel?: (turn: import("./view-model.js").TurnVM) => unknown;
173
+ /**
174
+ * host-owned per-turn actions; replaces the built-in label affordance (hosts with typed label models keep their own popovers)
175
+ */
176
+ renderTurnActions?: (turn: import("./view-model.js").TurnVM) => unknown;
177
+ /**
178
+ * host permalink for a turn's copy-anchor action; a root-relative return is absolutized against the page origin. Omitted, the demo copies its bare '#turn-N' placeholder
179
+ */
180
+ anchorHref?: (turnIndex: number) => string;
181
+ /**
182
+ * host session-level actions rendered at the head of the hero action row (attest etc.); the composite's own actions stay the shared tail
183
+ */
184
+ headerActions?: unknown;
185
+ };
186
+ /**
187
+ * One breadcrumb segment. The last item renders as the current page (no link).
188
+ */
189
+ export type BreadcrumbItem = {
190
+ label: string;
191
+ href?: string;
161
192
  };