footprint-explainable-ui 0.14.5 → 0.14.7
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 +33 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4105,9 +4105,11 @@ function detectKeyedSteps(data) {
|
|
|
4105
4105
|
}
|
|
4106
4106
|
return null;
|
|
4107
4107
|
}
|
|
4108
|
-
function
|
|
4109
|
-
|
|
4110
|
-
|
|
4108
|
+
function extractRenderHints(data) {
|
|
4109
|
+
if (!data || typeof data !== "object") return null;
|
|
4110
|
+
const obj = data;
|
|
4111
|
+
if (typeof obj.numericField === "string" && typeof obj.grandTotal === "number") {
|
|
4112
|
+
return { numericField: obj.numericField, grandTotal: obj.grandTotal };
|
|
4111
4113
|
}
|
|
4112
4114
|
return null;
|
|
4113
4115
|
}
|
|
@@ -4138,29 +4140,42 @@ function KeyedRecorderView({
|
|
|
4138
4140
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { padding: 12, fontFamily: theme.fontMono, fontSize: 11, whiteSpace: "pre-wrap", overflow: "auto", height: "100%" }, children: typeof data === "string" ? data : JSON.stringify(data, null, 2) });
|
|
4139
4141
|
}
|
|
4140
4142
|
const steps = detected.steps;
|
|
4143
|
+
const hints = extractRenderHints(data);
|
|
4144
|
+
const numFieldKey = hints?.numericField ?? "";
|
|
4141
4145
|
const allKeys = Object.keys(steps);
|
|
4142
4146
|
const visibleEntries = allKeys.filter((k) => visibleKeys.has(k));
|
|
4143
|
-
const numField = allKeys.length > 0 ? findNumericField(steps[allKeys[0]]) : null;
|
|
4144
|
-
const numFieldKey = numField?.key ?? "";
|
|
4145
4147
|
let runningTotal = 0;
|
|
4146
4148
|
if (numFieldKey) {
|
|
4147
4149
|
for (const k of visibleEntries) {
|
|
4148
4150
|
runningTotal += steps[k][numFieldKey] ?? 0;
|
|
4149
4151
|
}
|
|
4150
4152
|
}
|
|
4151
|
-
|
|
4152
|
-
if (numFieldKey) {
|
|
4153
|
-
for (const entry of Object.values(steps)) {
|
|
4154
|
-
grandTotal += entry[numFieldKey] ?? 0;
|
|
4155
|
-
}
|
|
4156
|
-
}
|
|
4153
|
+
const grandTotal = hints?.grandTotal ?? 0;
|
|
4157
4154
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { overflow: "auto", height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
4158
4155
|
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 }),
|
|
4159
4156
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: 12, flex: 1, overflow: "auto" }, children: [
|
|
4160
4157
|
preferredOperation === "aggregate" ? (
|
|
4161
|
-
/* AGGREGATE
|
|
4158
|
+
/* AGGREGATE: collect silently during scrub, button at end to reveal total */
|
|
4162
4159
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
4163
|
-
isAtEnd ? /* @__PURE__ */ (0, import_jsx_runtime18.
|
|
4160
|
+
isAtEnd ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginBottom: 16 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4161
|
+
"button",
|
|
4162
|
+
{
|
|
4163
|
+
onClick: () => setShowAggregate(true),
|
|
4164
|
+
style: {
|
|
4165
|
+
background: theme.primary,
|
|
4166
|
+
color: "#fff",
|
|
4167
|
+
border: "none",
|
|
4168
|
+
borderRadius: 8,
|
|
4169
|
+
padding: "12px 20px",
|
|
4170
|
+
fontSize: 13,
|
|
4171
|
+
fontWeight: 600,
|
|
4172
|
+
cursor: "pointer",
|
|
4173
|
+
fontFamily: "inherit",
|
|
4174
|
+
width: "100%"
|
|
4175
|
+
},
|
|
4176
|
+
children: "Aggregate \u2014 Show Grand Total"
|
|
4177
|
+
}
|
|
4178
|
+
) : /* @__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` }, children: [
|
|
4164
4179
|
/* @__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
4180
|
numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 26, fontWeight: 700, color: theme.success }, children: [
|
|
4166
4181
|
grandTotal < 1 ? grandTotal.toFixed(3) : grandTotal.toFixed(1),
|
|
@@ -4171,19 +4186,19 @@ function KeyedRecorderView({
|
|
|
4171
4186
|
" steps"
|
|
4172
4187
|
] })
|
|
4173
4188
|
] })
|
|
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: [
|
|
4189
|
+
] }) }) : /* @__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
4190
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 10, color: theme.textMuted, textTransform: "uppercase", letterSpacing: "0.08em", fontWeight: 600 }, children: "Collecting data..." }),
|
|
4176
4191
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 11, color: theme.textMuted, marginTop: 4 }, children: [
|
|
4177
4192
|
visibleEntries.length,
|
|
4178
4193
|
" of ",
|
|
4179
4194
|
allKeys.length,
|
|
4180
|
-
" steps collected. Scrub to end
|
|
4195
|
+
" steps collected. Scrub to end to aggregate."
|
|
4181
4196
|
] })
|
|
4182
4197
|
] }),
|
|
4183
4198
|
/* @__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
4199
|
] })
|
|
4185
4200
|
) : preferredOperation === "accumulate" ? (
|
|
4186
|
-
/* ACCUMULATE
|
|
4201
|
+
/* ACCUMULATE: running total grows with slider — IS the total at end, no button */
|
|
4187
4202
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
4188
4203
|
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
4204
|
/* @__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" }),
|
|
@@ -4200,7 +4215,7 @@ function KeyedRecorderView({
|
|
|
4200
4215
|
/* @__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
4216
|
] })
|
|
4202
4217
|
) : (
|
|
4203
|
-
/* TRANSLATE
|
|
4218
|
+
/* TRANSLATE: per-step entries prominent, no totals */
|
|
4204
4219
|
/* @__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
4220
|
),
|
|
4206
4221
|
visibleEntries.map((key) => {
|
|
@@ -4213,34 +4228,7 @@ function KeyedRecorderView({
|
|
|
4213
4228
|
numVal !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { color: theme.primary, fontWeight: 700, marginLeft: 8 }, children: numVal < 1 ? numVal.toFixed(3) : numVal.toFixed(1) })
|
|
4214
4229
|
] }, key);
|
|
4215
4230
|
}),
|
|
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..." })
|
|
4217
|
-
preferredOperation === "accumulate" && isAtEnd && numFieldKey && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: 16 }, children: !showAggregate ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4218
|
-
"button",
|
|
4219
|
-
{
|
|
4220
|
-
onClick: () => setShowAggregate(true),
|
|
4221
|
-
style: {
|
|
4222
|
-
background: theme.primary,
|
|
4223
|
-
color: "#fff",
|
|
4224
|
-
border: "none",
|
|
4225
|
-
borderRadius: 6,
|
|
4226
|
-
padding: "10px 20px",
|
|
4227
|
-
fontSize: 12,
|
|
4228
|
-
fontWeight: 600,
|
|
4229
|
-
cursor: "pointer",
|
|
4230
|
-
fontFamily: "inherit",
|
|
4231
|
-
width: "100%"
|
|
4232
|
-
},
|
|
4233
|
-
children: "Show Aggregate \u2014 Grand Total"
|
|
4234
|
-
}
|
|
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: [
|
|
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" }),
|
|
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) }),
|
|
4238
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { fontSize: 10, color: theme.textMuted, marginTop: 2 }, children: [
|
|
4239
|
-
allKeys.length,
|
|
4240
|
-
" steps \xB7 ",
|
|
4241
|
-
numFieldKey
|
|
4242
|
-
] })
|
|
4243
|
-
] }) })
|
|
4231
|
+
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..." })
|
|
4244
4232
|
] })
|
|
4245
4233
|
] });
|
|
4246
4234
|
}
|