footprint-explainable-ui 0.14.3 → 0.14.5

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.cjs CHANGED
@@ -4114,6 +4114,7 @@ function findNumericField(entry) {
4114
4114
  function KeyedRecorderView({
4115
4115
  data,
4116
4116
  description,
4117
+ preferredOperation = "accumulate",
4117
4118
  snapshots,
4118
4119
  selectedIndex
4119
4120
  }) {
@@ -4156,7 +4157,52 @@ function KeyedRecorderView({
4156
4157
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { overflow: "auto", height: "100%", display: "flex", flexDirection: "column" }, children: [
4157
4158
  description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { padding: "6px 12px", fontSize: 11, color: theme.textMuted, fontStyle: "italic", borderBottom: `1px solid ${theme.border}`, flexShrink: 0 }, children: description }),
4158
4159
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: 12, flex: 1, overflow: "auto" }, children: [
4159
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Translate \u2014 per-step detail" }),
4160
+ preferredOperation === "aggregate" ? (
4161
+ /* AGGREGATE primary: collect silently during scrub, reveal grand total at end */
4162
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
4163
+ isAtEnd ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "14px 16px", background: `color-mix(in srgb, ${theme.success} 12%, transparent)`, borderRadius: 8, border: `1px solid ${theme.success}44`, marginBottom: 16 }, children: [
4164
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Aggregate \u2014 grand total" }),
4165
+ numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 26, fontWeight: 700, color: theme.success }, children: [
4166
+ grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1),
4167
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { fontSize: 11, color: theme.textMuted, fontWeight: 400, marginLeft: 8 }, children: [
4168
+ numFieldKey,
4169
+ " \xB7 ",
4170
+ allKeys.length,
4171
+ " steps"
4172
+ ] })
4173
+ ] })
4174
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "10px 14px", background: `color-mix(in srgb, ${theme.textMuted} 6%, transparent)`, borderRadius: 6, marginBottom: 16, border: `1px dashed ${theme.border}` }, children: [
4175
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", fontWeight: 600 }, children: "Collecting data..." }),
4176
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 11, color: theme.textMuted, marginTop: 4 }, children: [
4177
+ visibleEntries.length,
4178
+ " of ",
4179
+ allKeys.length,
4180
+ " steps collected. Scrub to end for aggregate total."
4181
+ ] })
4182
+ ] }),
4183
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Per-step detail" })
4184
+ ] })
4185
+ ) : preferredOperation === "accumulate" ? (
4186
+ /* ACCUMULATE primary: running total prominent, per-step listed */
4187
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
4188
+ numFieldKey && visibleEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "10px 14px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, marginBottom: 16 }, children: [
4189
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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" }),
4190
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontWeight: 700, fontSize: 18, color: theme.primary }, children: runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1) }),
4191
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: theme.textMuted, marginLeft: 8, fontSize: 10 }, children: [
4192
+ numFieldKey,
4193
+ " \xB7 ",
4194
+ visibleEntries.length,
4195
+ " of ",
4196
+ allKeys.length,
4197
+ " steps"
4198
+ ] })
4199
+ ] }),
4200
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Per-step detail" })
4201
+ ] })
4202
+ ) : (
4203
+ /* TRANSLATE primary: per-step entries prominent */
4204
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 6, fontWeight: 600 }, children: "Translate \u2014 per-step detail" })
4205
+ ),
4160
4206
  visibleEntries.map((key) => {
4161
4207
  const entry = steps[key];
4162
4208
  const label = entry.stageName ?? key;
@@ -4168,19 +4214,7 @@ function KeyedRecorderView({
4168
4214
  ] }, key);
4169
4215
  }),
4170
4216
  visibleEntries.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { color: theme.textMuted, fontSize: 11, fontStyle: "italic", padding: "8px 0" }, children: "Scrub the slider to reveal entries..." }),
4171
- numFieldKey && visibleEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginTop: 16, padding: "8px 12px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, fontSize: 12 }, children: [
4172
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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" }),
4173
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontWeight: 700, fontSize: 16, color: theme.primary }, children: runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1) }),
4174
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: theme.textMuted, marginLeft: 8, fontSize: 10 }, children: [
4175
- numFieldKey,
4176
- " \xB7 ",
4177
- visibleEntries.length,
4178
- " of ",
4179
- allKeys.length,
4180
- " steps"
4181
- ] })
4182
- ] }),
4183
- isAtEnd && numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: 16 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4217
+ preferredOperation === "accumulate" && isAtEnd && numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: 16 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4184
4218
  "button",
4185
4219
  {
4186
4220
  onClick: () => setShowAggregate(true),
@@ -4199,7 +4233,7 @@ function KeyedRecorderView({
4199
4233
  children: "Show Aggregate \u2014 Grand Total"
4200
4234
  }
4201
4235
  ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "10px 14px", background: `color-mix(in srgb, ${theme.success} 12%, transparent)`, borderRadius: 6, border: `1px solid ${theme.success}44` }, children: [
4202
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4, fontWeight: 600 }, children: "Aggregate \u2014 grand total across all steps" }),
4236
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4, fontWeight: 600 }, children: "Aggregate \u2014 grand total" }),
4203
4237
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 22, fontWeight: 700, color: theme.success }, children: grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1) }),
4204
4238
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 10, color: theme.textMuted, marginTop: 2 }, children: [
4205
4239
  allKeys.length,
@@ -4377,7 +4411,7 @@ function ExplainableShell({
4377
4411
  const recorders = runtimeSnapshot?.recorders;
4378
4412
  if (!recorders?.length) return [];
4379
4413
  const explicitIds = new Set((recorderViews ?? []).map((v2) => v2.id));
4380
- return recorders.filter((r) => !explicitIds.has(r.id)).map((r) => ({ id: r.id, name: r.name, description: r.description, data: r.data }));
4414
+ 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 }));
4381
4415
  }, [runtimeSnapshot, recorderViews]);
4382
4416
  const hasNarrative = !!(narrative?.length || narrativeEntries?.length);
4383
4417
  const allTabs = (0, import_react19.useMemo)(() => {
@@ -4559,6 +4593,7 @@ function ExplainableShell({
4559
4593
  {
4560
4594
  data: autoView.data,
4561
4595
  description: autoView.description,
4596
+ preferredOperation: autoView.preferredOperation,
4562
4597
  snapshots: activeSnapshots,
4563
4598
  selectedIndex: safeIdx
4564
4599
  }