footprint-explainable-ui 0.14.3 → 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.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,55 @@ 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: show grand total prominently, per-step expandable */
4162
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
4163
+ isAtEnd ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("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: [
4164
+ /* @__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" }),
4165
+ numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 22, 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: "8px 12px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, marginBottom: 16 }, children: [
4175
+ /* @__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" }),
4176
+ numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { fontWeight: 700, fontSize: 16, color: theme.primary }, children: [
4177
+ runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1),
4178
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { fontSize: 10, color: theme.textMuted, fontWeight: 400, marginLeft: 8 }, children: [
4179
+ visibleEntries.length,
4180
+ " of ",
4181
+ allKeys.length,
4182
+ " steps"
4183
+ ] })
4184
+ ] })
4185
+ ] }),
4186
+ /* @__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" })
4187
+ ] })
4188
+ ) : preferredOperation === "accumulate" ? (
4189
+ /* ACCUMULATE primary: running total prominent, per-step listed */
4190
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
4191
+ 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: [
4192
+ /* @__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" }),
4193
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontWeight: 700, fontSize: 18, color: theme.primary }, children: runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1) }),
4194
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: theme.textMuted, marginLeft: 8, fontSize: 10 }, children: [
4195
+ numFieldKey,
4196
+ " \xB7 ",
4197
+ visibleEntries.length,
4198
+ " of ",
4199
+ allKeys.length,
4200
+ " steps"
4201
+ ] })
4202
+ ] }),
4203
+ /* @__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" })
4204
+ ] })
4205
+ ) : (
4206
+ /* TRANSLATE primary: per-step entries prominent */
4207
+ /* @__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" })
4208
+ ),
4160
4209
  visibleEntries.map((key) => {
4161
4210
  const entry = steps[key];
4162
4211
  const label = entry.stageName ?? key;
@@ -4168,19 +4217,7 @@ function KeyedRecorderView({
4168
4217
  ] }, key);
4169
4218
  }),
4170
4219
  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)(
4220
+ preferredOperation === "accumulate" && isAtEnd && numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: 16 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4184
4221
  "button",
4185
4222
  {
4186
4223
  onClick: () => setShowAggregate(true),
@@ -4199,7 +4236,7 @@ function KeyedRecorderView({
4199
4236
  children: "Show Aggregate \u2014 Grand Total"
4200
4237
  }
4201
4238
  ) : /* @__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" }),
4239
+ /* @__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
4240
  /* @__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
4241
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 10, color: theme.textMuted, marginTop: 2 }, children: [
4205
4242
  allKeys.length,
@@ -4377,7 +4414,7 @@ function ExplainableShell({
4377
4414
  const recorders = runtimeSnapshot?.recorders;
4378
4415
  if (!recorders?.length) return [];
4379
4416
  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 }));
4417
+ 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
4418
  }, [runtimeSnapshot, recorderViews]);
4382
4419
  const hasNarrative = !!(narrative?.length || narrativeEntries?.length);
4383
4420
  const allTabs = (0, import_react19.useMemo)(() => {
@@ -4559,6 +4596,7 @@ function ExplainableShell({
4559
4596
  {
4560
4597
  data: autoView.data,
4561
4598
  description: autoView.description,
4599
+ preferredOperation: autoView.preferredOperation,
4562
4600
  snapshots: activeSnapshots,
4563
4601
  selectedIndex: safeIdx
4564
4602
  }