footprint-explainable-ui 0.14.2 → 0.14.4

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/index.d.cts CHANGED
@@ -367,10 +367,12 @@ interface RuntimeSnapshotInput {
367
367
  executionTree: unknown;
368
368
  commitLog: unknown[];
369
369
  subflowResults?: Record<string, unknown>;
370
- /** Recorder snapshots from FlowRecorder.toSnapshot() — auto-generates detail tabs. */
370
+ /** Recorder snapshots from toSnapshot() — auto-generates detail tabs. */
371
371
  recorders?: Array<{
372
372
  id: string;
373
373
  name: string;
374
+ description?: string;
375
+ preferredOperation?: 'translate' | 'accumulate' | 'aggregate';
374
376
  data: unknown;
375
377
  }>;
376
378
  }
package/dist/index.d.ts CHANGED
@@ -367,10 +367,12 @@ interface RuntimeSnapshotInput {
367
367
  executionTree: unknown;
368
368
  commitLog: unknown[];
369
369
  subflowResults?: Record<string, unknown>;
370
- /** Recorder snapshots from FlowRecorder.toSnapshot() — auto-generates detail tabs. */
370
+ /** Recorder snapshots from toSnapshot() — auto-generates detail tabs. */
371
371
  recorders?: Array<{
372
372
  id: string;
373
373
  name: string;
374
+ description?: string;
375
+ preferredOperation?: 'translate' | 'accumulate' | 'aggregate';
374
376
  data: unknown;
375
377
  }>;
376
378
  }
package/dist/index.js CHANGED
@@ -4065,6 +4065,7 @@ function findNumericField(entry) {
4065
4065
  function KeyedRecorderView({
4066
4066
  data,
4067
4067
  description,
4068
+ preferredOperation = "accumulate",
4068
4069
  snapshots,
4069
4070
  selectedIndex
4070
4071
  }) {
@@ -4107,6 +4108,55 @@ function KeyedRecorderView({
4107
4108
  return /* @__PURE__ */ jsxs17("div", { style: { overflow: "auto", height: "100%", display: "flex", flexDirection: "column" }, children: [
4108
4109
  description && /* @__PURE__ */ jsx18("div", { style: { padding: "6px 12px", fontSize: 11, color: theme.textMuted, fontStyle: "italic", borderBottom: `1px solid ${theme.border}`, flexShrink: 0 }, children: description }),
4109
4110
  /* @__PURE__ */ jsxs17("div", { style: { padding: 12, flex: 1, overflow: "auto" }, children: [
4111
+ preferredOperation === "aggregate" ? (
4112
+ /* AGGREGATE primary: show grand total prominently, per-step expandable */
4113
+ /* @__PURE__ */ jsxs17(Fragment6, { children: [
4114
+ isAtEnd ? /* @__PURE__ */ jsxs17("div", { style: { padding: "12px 14px", background: `color-mix(in srgb, ${theme.success} 12%, transparent)`, borderRadius: 6, border: `1px solid ${theme.success}44`, marginBottom: 16 }, children: [
4115
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4, fontWeight: 600 }, children: "Aggregate \u2014 grand total" }),
4116
+ numFieldKey && /* @__PURE__ */ jsxs17("div", { style: { fontSize: 22, fontWeight: 700, color: theme.success }, children: [
4117
+ grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1),
4118
+ /* @__PURE__ */ jsxs17("span", { style: { fontSize: 11, color: theme.textMuted, fontWeight: 400, marginLeft: 8 }, children: [
4119
+ numFieldKey,
4120
+ " \xB7 ",
4121
+ allKeys.length,
4122
+ " steps"
4123
+ ] })
4124
+ ] })
4125
+ ] }) : /* @__PURE__ */ jsxs17("div", { style: { padding: "8px 12px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, marginBottom: 16 }, children: [
4126
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4, fontWeight: 600 }, children: "Accumulate \u2014 running total" }),
4127
+ numFieldKey && /* @__PURE__ */ jsxs17("span", { style: { fontWeight: 700, fontSize: 16, color: theme.primary }, children: [
4128
+ runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1),
4129
+ /* @__PURE__ */ jsxs17("span", { style: { fontSize: 10, color: theme.textMuted, fontWeight: 400, marginLeft: 8 }, children: [
4130
+ visibleEntries.length,
4131
+ " of ",
4132
+ allKeys.length,
4133
+ " steps"
4134
+ ] })
4135
+ ] })
4136
+ ] }),
4137
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Per-step detail" })
4138
+ ] })
4139
+ ) : preferredOperation === "accumulate" ? (
4140
+ /* ACCUMULATE primary: running total prominent, per-step listed */
4141
+ /* @__PURE__ */ jsxs17(Fragment6, { children: [
4142
+ numFieldKey && visibleEntries.length > 0 && /* @__PURE__ */ jsxs17("div", { style: { padding: "10px 14px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, marginBottom: 16 }, children: [
4143
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4, fontWeight: 600 }, children: "Accumulate \u2014 running total up to this step" }),
4144
+ /* @__PURE__ */ jsx18("span", { style: { fontWeight: 700, fontSize: 18, color: theme.primary }, children: runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1) }),
4145
+ /* @__PURE__ */ jsxs17("span", { style: { color: theme.textMuted, marginLeft: 8, fontSize: 10 }, children: [
4146
+ numFieldKey,
4147
+ " \xB7 ",
4148
+ visibleEntries.length,
4149
+ " of ",
4150
+ allKeys.length,
4151
+ " steps"
4152
+ ] })
4153
+ ] }),
4154
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Per-step detail" })
4155
+ ] })
4156
+ ) : (
4157
+ /* TRANSLATE primary: per-step entries prominent */
4158
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Translate \u2014 per-step detail" })
4159
+ ),
4110
4160
  visibleEntries.map((key) => {
4111
4161
  const entry = steps[key];
4112
4162
  const label = entry.stageName ?? key;
@@ -4118,22 +4168,7 @@ function KeyedRecorderView({
4118
4168
  ] }, key);
4119
4169
  }),
4120
4170
  visibleEntries.length === 0 && /* @__PURE__ */ jsx18("div", { style: { color: theme.textMuted, fontSize: 11, fontStyle: "italic", padding: "8px 0" }, children: "Scrub the slider to reveal entries..." }),
4121
- numFieldKey && visibleEntries.length > 0 && /* @__PURE__ */ jsxs17("div", { style: { marginTop: 12, padding: "8px 12px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, fontSize: 12 }, children: [
4122
- /* @__PURE__ */ jsxs17("span", { style: { color: theme.textMuted }, children: [
4123
- "Running total (",
4124
- numFieldKey,
4125
- "):"
4126
- ] }),
4127
- /* @__PURE__ */ jsx18("span", { style: { fontWeight: 700, marginLeft: 8, color: theme.primary }, children: runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1) }),
4128
- /* @__PURE__ */ jsxs17("span", { style: { color: theme.textMuted, marginLeft: 8, fontSize: 10 }, children: [
4129
- "(",
4130
- visibleEntries.length,
4131
- " of ",
4132
- allKeys.length,
4133
- " steps)"
4134
- ] })
4135
- ] }),
4136
- isAtEnd && numFieldKey && /* @__PURE__ */ jsx18("div", { style: { marginTop: 12 }, children: !showAggregate ? /* @__PURE__ */ jsxs17(
4171
+ preferredOperation === "accumulate" && isAtEnd && numFieldKey && /* @__PURE__ */ jsx18("div", { style: { marginTop: 16 }, children: !showAggregate ? /* @__PURE__ */ jsx18(
4137
4172
  "button",
4138
4173
  {
4139
4174
  onClick: () => setShowAggregate(true),
@@ -4142,21 +4177,18 @@ function KeyedRecorderView({
4142
4177
  color: "#fff",
4143
4178
  border: "none",
4144
4179
  borderRadius: 6,
4145
- padding: "8px 16px",
4180
+ padding: "10px 20px",
4146
4181
  fontSize: 12,
4147
4182
  fontWeight: 600,
4148
4183
  cursor: "pointer",
4149
- fontFamily: "inherit"
4184
+ fontFamily: "inherit",
4185
+ width: "100%"
4150
4186
  },
4151
- children: [
4152
- "Aggregate (",
4153
- numFieldKey,
4154
- ")"
4155
- ]
4187
+ children: "Show Aggregate \u2014 Grand Total"
4156
4188
  }
4157
4189
  ) : /* @__PURE__ */ jsxs17("div", { style: { padding: "10px 14px", background: `color-mix(in srgb, ${theme.success} 12%, transparent)`, borderRadius: 6, border: `1px solid ${theme.success}44` }, children: [
4158
- /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4 }, children: "Aggregate \u2014 Grand Total" }),
4159
- /* @__PURE__ */ jsx18("div", { style: { fontSize: 20, fontWeight: 700, color: theme.success }, children: grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1) }),
4190
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4, fontWeight: 600 }, children: "Aggregate \u2014 grand total" }),
4191
+ /* @__PURE__ */ jsx18("div", { style: { fontSize: 22, fontWeight: 700, color: theme.success }, children: grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1) }),
4160
4192
  /* @__PURE__ */ jsxs17("div", { style: { fontSize: 10, color: theme.textMuted, marginTop: 2 }, children: [
4161
4193
  allKeys.length,
4162
4194
  " steps \xB7 ",
@@ -4333,7 +4365,7 @@ function ExplainableShell({
4333
4365
  const recorders = runtimeSnapshot?.recorders;
4334
4366
  if (!recorders?.length) return [];
4335
4367
  const explicitIds = new Set((recorderViews ?? []).map((v2) => v2.id));
4336
- return recorders.filter((r) => !explicitIds.has(r.id)).map((r) => ({ id: r.id, name: r.name, description: r.description, data: r.data }));
4368
+ return recorders.filter((r) => !explicitIds.has(r.id)).map((r) => ({ id: r.id, name: r.name, description: r.description, preferredOperation: r.preferredOperation, data: r.data }));
4337
4369
  }, [runtimeSnapshot, recorderViews]);
4338
4370
  const hasNarrative = !!(narrative?.length || narrativeEntries?.length);
4339
4371
  const allTabs = useMemo11(() => {
@@ -4515,6 +4547,7 @@ function ExplainableShell({
4515
4547
  {
4516
4548
  data: autoView.data,
4517
4549
  description: autoView.description,
4550
+ preferredOperation: autoView.preferredOperation,
4518
4551
  snapshots: activeSnapshots,
4519
4552
  selectedIndex: safeIdx
4520
4553
  }