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.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,6 +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: [
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
+ ),
4159
4209
  visibleEntries.map((key) => {
4160
4210
  const entry = steps[key];
4161
4211
  const label = entry.stageName ?? key;
@@ -4167,22 +4217,7 @@ function KeyedRecorderView({
4167
4217
  ] }, key);
4168
4218
  }),
4169
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..." }),
4170
- numFieldKey && visibleEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { marginTop: 12, padding: "8px 12px", background: `color-mix(in srgb, ${theme.primary} 8%, transparent)`, borderRadius: 6, fontSize: 12 }, children: [
4171
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: theme.textMuted }, children: [
4172
- "Running total (",
4173
- numFieldKey,
4174
- "):"
4175
- ] }),
4176
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontWeight: 700, marginLeft: 8, color: theme.primary }, children: runningTotal < 1 ? runningTotal.toFixed(3) : runningTotal.toFixed(1) }),
4177
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: theme.textMuted, marginLeft: 8, fontSize: 10 }, children: [
4178
- "(",
4179
- visibleEntries.length,
4180
- " of ",
4181
- allKeys.length,
4182
- " steps)"
4183
- ] })
4184
- ] }),
4185
- isAtEnd && numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: 12 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4220
+ preferredOperation === "accumulate" && isAtEnd && numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: 16 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4186
4221
  "button",
4187
4222
  {
4188
4223
  onClick: () => setShowAggregate(true),
@@ -4191,21 +4226,18 @@ function KeyedRecorderView({
4191
4226
  color: "#fff",
4192
4227
  border: "none",
4193
4228
  borderRadius: 6,
4194
- padding: "8px 16px",
4229
+ padding: "10px 20px",
4195
4230
  fontSize: 12,
4196
4231
  fontWeight: 600,
4197
4232
  cursor: "pointer",
4198
- fontFamily: "inherit"
4233
+ fontFamily: "inherit",
4234
+ width: "100%"
4199
4235
  },
4200
- children: [
4201
- "Aggregate (",
4202
- numFieldKey,
4203
- ")"
4204
- ]
4236
+ children: "Show Aggregate \u2014 Grand Total"
4205
4237
  }
4206
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: [
4207
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", marginBottom: 4 }, children: "Aggregate \u2014 Grand Total" }),
4208
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 20, fontWeight: 700, color: theme.success }, children: grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1) }),
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" }),
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) }),
4209
4241
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 10, color: theme.textMuted, marginTop: 2 }, children: [
4210
4242
  allKeys.length,
4211
4243
  " steps \xB7 ",
@@ -4382,7 +4414,7 @@ function ExplainableShell({
4382
4414
  const recorders = runtimeSnapshot?.recorders;
4383
4415
  if (!recorders?.length) return [];
4384
4416
  const explicitIds = new Set((recorderViews ?? []).map((v2) => v2.id));
4385
- 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 }));
4386
4418
  }, [runtimeSnapshot, recorderViews]);
4387
4419
  const hasNarrative = !!(narrative?.length || narrativeEntries?.length);
4388
4420
  const allTabs = (0, import_react19.useMemo)(() => {
@@ -4564,6 +4596,7 @@ function ExplainableShell({
4564
4596
  {
4565
4597
  data: autoView.data,
4566
4598
  description: autoView.description,
4599
+ preferredOperation: autoView.preferredOperation,
4567
4600
  snapshots: activeSnapshots,
4568
4601
  selectedIndex: safeIdx
4569
4602
  }