@burdenoff/microfe-bigconsole 2026.1117.1 → 2026.1117.3
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/bigconsole/components/insights/DraftCheckDialog.d.ts +6 -0
- package/dist/bigconsole/components/insights/DraftCheckDialog.js +148 -47
- package/dist/bigconsole/components/reconcile/KpiReconcileDialog.d.ts +25 -0
- package/dist/bigconsole/components/reconcile/KpiReconcileDialog.js +723 -0
- package/dist/bigconsole/components/reconcile/reconcileModel.d.ts +101 -0
- package/dist/bigconsole/components/reconcile/reconcileModel.js +222 -0
- package/dist/bigconsole/components/widgets/WidgetHeader.d.ts +2 -0
- package/dist/bigconsole/components/widgets/WidgetHeader.js +3 -2
- package/dist/bigconsole/components/widgets/WidgetMenu.d.ts +2 -0
- package/dist/bigconsole/components/widgets/WidgetMenu.js +60 -41
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +263 -253
- package/dist/bigconsole/pages/InsightsPage.js +551 -521
- package/dist/bigconsole/utils/boardLint.d.ts +87 -0
- package/dist/bigconsole/utils/boardLint.js +273 -0
- package/dist/bigconsole/utils/consoleDefinition.d.ts +9 -0
- package/dist/generated/wspace-operations.d.ts +403 -0
- package/dist/generated/wspace-operations.js +1248 -46
- package/dist/generated/wspace-types.d.ts +305 -0
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Board Lint (BOFF-13367, slice 1)
|
|
3
|
+
*
|
|
4
|
+
* A pure, data-free reviewer for dashboard definitions. It reads widget
|
|
5
|
+
* settings (never row data) and reports chart-quality and accessibility
|
|
6
|
+
* problems, each with a plain-language reason. Where a safe, mechanical fix
|
|
7
|
+
* exists, `planLintFix` describes it as a structured patch that maps 1:1 onto
|
|
8
|
+
* the `widgetRefinements` input of `refineGeneratedDashboard`, so a fix is
|
|
9
|
+
* previewed first and then applied as a refined copy (the original draft is
|
|
10
|
+
* never changed, which is the undo).
|
|
11
|
+
*
|
|
12
|
+
* Works on both AI-generated drafts (public enum types such as `BAR_CHART`)
|
|
13
|
+
* and saved dashboards (stored types such as `chart`), so one rule set
|
|
14
|
+
* covers "before the draft becomes a dashboard" and "the board I already have".
|
|
15
|
+
*/
|
|
16
|
+
export type LintSeverity = 'warning' | 'info';
|
|
17
|
+
export type LintRuleId = 'TRUNCATED_AREA_AXIS' | 'COLOUR_ONLY_MEANING' | 'UNLABELLED_DUAL_AXIS' | 'NOT_CONNECTED_TO_DATA' | 'DUPLICATE_WIDGET_TITLE' | 'MISSING_WIDGET_TITLE' | 'OVERLAPPING_LAYOUT';
|
|
18
|
+
export interface LintWidgetPosition {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}
|
|
24
|
+
export interface LintableWidget {
|
|
25
|
+
title: string;
|
|
26
|
+
type: string;
|
|
27
|
+
config?: Record<string, unknown> | null;
|
|
28
|
+
position?: LintWidgetPosition | null;
|
|
29
|
+
dataSinkId?: string | null;
|
|
30
|
+
dataSourceId?: string | null;
|
|
31
|
+
parserId?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface LintablePage {
|
|
34
|
+
name: string;
|
|
35
|
+
widgets: LintableWidget[];
|
|
36
|
+
}
|
|
37
|
+
export interface LintableBoard {
|
|
38
|
+
pages: LintablePage[];
|
|
39
|
+
}
|
|
40
|
+
export interface LintOptions {
|
|
41
|
+
/**
|
|
42
|
+
* AI drafts are unbound by design, so connection problems are reported once
|
|
43
|
+
* for the whole board instead of once per widget.
|
|
44
|
+
*/
|
|
45
|
+
draft?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface LintFinding {
|
|
48
|
+
ruleId: LintRuleId;
|
|
49
|
+
severity: LintSeverity;
|
|
50
|
+
/** Index of the page the finding belongs to, or null for board-level findings. */
|
|
51
|
+
pageIndex: number | null;
|
|
52
|
+
/** Index of the widget inside its page, or null for page/board-level findings. */
|
|
53
|
+
widgetIndex: number | null;
|
|
54
|
+
/** Index of the widget counted across all pages in order; matches the draft's `widgetIndex` in refinements. */
|
|
55
|
+
widgetFlatIndex: number | null;
|
|
56
|
+
widgetTitle: string | null;
|
|
57
|
+
/** Default English message; callers wrap it in their i18n `t()` using the rule id as key. */
|
|
58
|
+
message: string;
|
|
59
|
+
/** True when `planLintFix` can repair the finding without guessing. */
|
|
60
|
+
fixable: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** One widget edit. Field names match `BigConsoleWidgetRefinementInput`. */
|
|
63
|
+
export interface LintFix {
|
|
64
|
+
widgetIndex: number;
|
|
65
|
+
title?: string;
|
|
66
|
+
/** Shallow-merged into the widget config. */
|
|
67
|
+
configOverrides?: Record<string, unknown>;
|
|
68
|
+
/** Default English one-line description of the change, shown as the preview. */
|
|
69
|
+
summary: string;
|
|
70
|
+
}
|
|
71
|
+
/** Resolve the chart kind (bar, area, line, pie...) from config first, then from the widget type name. */
|
|
72
|
+
export declare function resolveChartKind(widget: LintableWidget): string | null;
|
|
73
|
+
/** Review a board. Pure: the input is never mutated and no data is read. */
|
|
74
|
+
export declare function lintBoard(board: LintableBoard, options?: LintOptions): LintFinding[];
|
|
75
|
+
/**
|
|
76
|
+
* Describe the mechanical fix for a finding, or null when the finding is not
|
|
77
|
+
* fixable (or no longer applies). Never guesses: rules that need the author's
|
|
78
|
+
* words or intent (a missing label or title, where to move a widget) have no fix.
|
|
79
|
+
*/
|
|
80
|
+
export declare function planLintFix(board: LintableBoard, finding: LintFinding): LintFix | null;
|
|
81
|
+
/** Apply a planned fix to a board and return a new board. The input is never mutated. */
|
|
82
|
+
export declare function applyLintFixPlan(board: LintableBoard, fix: LintFix): LintableBoard;
|
|
83
|
+
/**
|
|
84
|
+
* Convenience: plan and apply in one step. Findings that are not `fixable`
|
|
85
|
+
* (or that no longer apply) return the same board object unchanged.
|
|
86
|
+
*/
|
|
87
|
+
export declare function applyLintFix(board: LintableBoard, finding: LintFinding): LintableBoard;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// src/bigconsole/utils/boardLint.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"chart",
|
|
4
|
+
"metric_card",
|
|
5
|
+
"kpi",
|
|
6
|
+
"table",
|
|
7
|
+
"funnel",
|
|
8
|
+
"funnel_chart",
|
|
9
|
+
"heatmap",
|
|
10
|
+
"map",
|
|
11
|
+
"waterfall",
|
|
12
|
+
"sankey",
|
|
13
|
+
"box_plot",
|
|
14
|
+
"retention"
|
|
15
|
+
]), t = {
|
|
16
|
+
success: "check",
|
|
17
|
+
danger: "alert",
|
|
18
|
+
warning: "flag",
|
|
19
|
+
info: "dot"
|
|
20
|
+
};
|
|
21
|
+
function n(e) {
|
|
22
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
23
|
+
}
|
|
24
|
+
function r(e) {
|
|
25
|
+
return e.trim().toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
function i(e) {
|
|
28
|
+
let t = r(e.type), i = n(e.config) ? e.config.chartType : void 0;
|
|
29
|
+
return typeof i == "string" && i.length > 0 ? i.toLowerCase() : t.endsWith("_chart") && t !== "funnel_chart" ? t.replace(/_chart$/, "") : t === "chart" ? "line" : null;
|
|
30
|
+
}
|
|
31
|
+
function a(t) {
|
|
32
|
+
let n = r(t.type);
|
|
33
|
+
return e.has(n) || n.endsWith("_chart");
|
|
34
|
+
}
|
|
35
|
+
function o(e) {
|
|
36
|
+
let t = n(e.config) ? e.config : {};
|
|
37
|
+
return !!(e.dataSinkId || e.dataSourceId || e.parserId || t.dataSinkId || t.dataSourceId);
|
|
38
|
+
}
|
|
39
|
+
function s(e) {
|
|
40
|
+
return Array.isArray(e) ? e.filter((e) => n(e) && n(e.style)) : [];
|
|
41
|
+
}
|
|
42
|
+
function c(e) {
|
|
43
|
+
let t = r(e.type);
|
|
44
|
+
return t === "table" ? "table" : t === "metric_card" || t === "kpi" || t === "kpi_comparison" ? "card" : null;
|
|
45
|
+
}
|
|
46
|
+
function l(e, t) {
|
|
47
|
+
let r = n(e.config) ? e.config : {}, i = [{
|
|
48
|
+
location: { key: "conditionalRules" },
|
|
49
|
+
list: r.conditionalRules,
|
|
50
|
+
signals: t === "table" ? "rich" : "bold"
|
|
51
|
+
}];
|
|
52
|
+
return t === "table" && (i.push({
|
|
53
|
+
location: { key: "rowRules" },
|
|
54
|
+
list: r.rowRules,
|
|
55
|
+
signals: "bold"
|
|
56
|
+
}), (Array.isArray(r.columns) ? r.columns : []).forEach((e, t) => {
|
|
57
|
+
n(e) && i.push({
|
|
58
|
+
location: { columnIndex: t },
|
|
59
|
+
list: e.conditionalRules,
|
|
60
|
+
signals: "rich"
|
|
61
|
+
});
|
|
62
|
+
})), i;
|
|
63
|
+
}
|
|
64
|
+
function u(e) {
|
|
65
|
+
for (let n of ["textColor", "bgColor"]) {
|
|
66
|
+
let r = e[n];
|
|
67
|
+
if (typeof r == "string" && Object.hasOwn(t, r)) return r;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
function d(e, t) {
|
|
72
|
+
return u(e) === null ? !1 : t === "rich" ? !e.icon && !e.bold && !e.dataBar : !e.bold;
|
|
73
|
+
}
|
|
74
|
+
function f(e) {
|
|
75
|
+
let t = c(e);
|
|
76
|
+
return t ? l(e, t).some((e) => s(e.list).some((t) => d(t.style, e.signals))) : !1;
|
|
77
|
+
}
|
|
78
|
+
function p(e) {
|
|
79
|
+
return e != null && [
|
|
80
|
+
e.x,
|
|
81
|
+
e.y,
|
|
82
|
+
e.width,
|
|
83
|
+
e.height
|
|
84
|
+
].every(Number.isFinite) && e.width > 0 && e.height > 0;
|
|
85
|
+
}
|
|
86
|
+
function m(e, t) {
|
|
87
|
+
return e.x < t.x + t.width && t.x < e.x + e.width && e.y < t.y + t.height && t.y < e.y + e.height;
|
|
88
|
+
}
|
|
89
|
+
function h(e) {
|
|
90
|
+
if (e.dualAxis === !0) return !0;
|
|
91
|
+
let t = Array.isArray(e.series) ? e.series.filter(n) : [], r = t.some((e) => e.axis === "right"), i = t.some((e) => e.type === "line");
|
|
92
|
+
return r && (e.chartType === "combo" || i);
|
|
93
|
+
}
|
|
94
|
+
function g(e, t, r) {
|
|
95
|
+
let s = [], l = n(e.config) ? e.config : {}, u = e.title.trim().length > 0 ? `"${e.title}"` : "A widget", d = i(e);
|
|
96
|
+
if (e.title.trim().length === 0 && s.push({
|
|
97
|
+
...t,
|
|
98
|
+
ruleId: "MISSING_WIDGET_TITLE",
|
|
99
|
+
severity: "warning",
|
|
100
|
+
message: "A widget has no title. Readers and screen readers need a title to know what the widget shows.",
|
|
101
|
+
fixable: !1
|
|
102
|
+
}), d === "area" && l.logScale !== !0) {
|
|
103
|
+
let e = l.yMin;
|
|
104
|
+
(typeof e == "number" && Number.isFinite(e) ? e > 0 : l.startAtZero === !1) && s.push({
|
|
105
|
+
...t,
|
|
106
|
+
ruleId: "TRUNCATED_AREA_AXIS",
|
|
107
|
+
severity: "warning",
|
|
108
|
+
message: `${u} does not start at zero. An area shows value by size, so a cut-off axis makes small differences look large.`,
|
|
109
|
+
fixable: !0
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (f(e)) {
|
|
113
|
+
let n = c(e) === "table" ? "an icon, bold text or a data bar" : "bold text on the matching value";
|
|
114
|
+
s.push({
|
|
115
|
+
...t,
|
|
116
|
+
ruleId: "COLOUR_ONLY_MEANING",
|
|
117
|
+
severity: "warning",
|
|
118
|
+
message: `${u} uses colour as the only signal. Add ${n} so the meaning survives without colour.`,
|
|
119
|
+
fixable: !0
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
let p = l.yAxisRightLabel;
|
|
123
|
+
return d !== null && h(l) && !(typeof p == "string" && p.trim().length > 0) && s.push({
|
|
124
|
+
...t,
|
|
125
|
+
ruleId: "UNLABELLED_DUAL_AXIS",
|
|
126
|
+
severity: "warning",
|
|
127
|
+
message: `${u} has two vertical axes but the right one has no label, so readers cannot tell which unit it shows.`,
|
|
128
|
+
fixable: !1
|
|
129
|
+
}), !r.draft && a(e) && !o(e) && s.push({
|
|
130
|
+
...t,
|
|
131
|
+
ruleId: "NOT_CONNECTED_TO_DATA",
|
|
132
|
+
severity: "warning",
|
|
133
|
+
message: `${u} is not connected to any data, so it will show an empty state.`,
|
|
134
|
+
fixable: !1
|
|
135
|
+
}), s;
|
|
136
|
+
}
|
|
137
|
+
function _(e, t, n) {
|
|
138
|
+
let r = /* @__PURE__ */ new Set(), i = [];
|
|
139
|
+
return e.widgets.forEach((a, o) => {
|
|
140
|
+
let s = a.title.trim().toLowerCase();
|
|
141
|
+
s.length !== 0 && (r.has(s) ? i.push({
|
|
142
|
+
ruleId: "DUPLICATE_WIDGET_TITLE",
|
|
143
|
+
severity: "info",
|
|
144
|
+
pageIndex: t,
|
|
145
|
+
widgetIndex: o,
|
|
146
|
+
widgetFlatIndex: n + o,
|
|
147
|
+
widgetTitle: a.title,
|
|
148
|
+
message: `Two widgets on "${e.name}" share the title "${a.title}". Distinct titles help readers and screen readers tell them apart.`,
|
|
149
|
+
fixable: !0
|
|
150
|
+
}) : r.add(s));
|
|
151
|
+
}), i;
|
|
152
|
+
}
|
|
153
|
+
function v(e, t, n) {
|
|
154
|
+
let r = [];
|
|
155
|
+
return e.widgets.forEach((i, a) => {
|
|
156
|
+
if (!p(i.position)) return;
|
|
157
|
+
let o = i.position, s = e.widgets.slice(0, a).find((e) => p(e.position) && m(o, e.position));
|
|
158
|
+
s && r.push({
|
|
159
|
+
ruleId: "OVERLAPPING_LAYOUT",
|
|
160
|
+
severity: "warning",
|
|
161
|
+
pageIndex: t,
|
|
162
|
+
widgetIndex: a,
|
|
163
|
+
widgetFlatIndex: n + a,
|
|
164
|
+
widgetTitle: i.title,
|
|
165
|
+
message: `"${i.title}" overlaps "${s.title}" on "${e.name}". Overlapping widgets hide each other's content.`,
|
|
166
|
+
fixable: !1
|
|
167
|
+
});
|
|
168
|
+
}), r;
|
|
169
|
+
}
|
|
170
|
+
function y(e, t = {}) {
|
|
171
|
+
let n = [], r = 0;
|
|
172
|
+
if (e.pages.forEach((e, i) => {
|
|
173
|
+
e.widgets.forEach((e, a) => {
|
|
174
|
+
let o = {
|
|
175
|
+
pageIndex: i,
|
|
176
|
+
widgetIndex: a,
|
|
177
|
+
widgetFlatIndex: r + a,
|
|
178
|
+
widgetTitle: e.title
|
|
179
|
+
};
|
|
180
|
+
n.push(...g(e, o, t));
|
|
181
|
+
}), n.push(..._(e, i, r)), n.push(...v(e, i, r)), r += e.widgets.length;
|
|
182
|
+
}), t.draft) {
|
|
183
|
+
let t = e.pages.reduce((e, t) => e + t.widgets.filter((e) => a(e) && !o(e)).length, 0);
|
|
184
|
+
t > 0 && n.push({
|
|
185
|
+
ruleId: "NOT_CONNECTED_TO_DATA",
|
|
186
|
+
severity: "info",
|
|
187
|
+
pageIndex: null,
|
|
188
|
+
widgetIndex: null,
|
|
189
|
+
widgetFlatIndex: null,
|
|
190
|
+
widgetTitle: null,
|
|
191
|
+
message: `${t} widget${t === 1 ? "" : "s"} in this draft ${t === 1 ? "is" : "are"} not connected to any data yet. Connect each one after you create the dashboard.`,
|
|
192
|
+
fixable: !1
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return n;
|
|
196
|
+
}
|
|
197
|
+
function b(e, t) {
|
|
198
|
+
let { pageIndex: n, widgetIndex: r } = t;
|
|
199
|
+
return n === null || r === null ? null : e.pages[n]?.widgets[r] ?? null;
|
|
200
|
+
}
|
|
201
|
+
function x(e, t) {
|
|
202
|
+
let n = new Set(e.widgets.map((e) => e.title.trim().toLowerCase())), r = t.trim(), i = 2;
|
|
203
|
+
for (; n.has(`${r} (${i})`.toLowerCase());) i += 1;
|
|
204
|
+
return `${r} (${i})`;
|
|
205
|
+
}
|
|
206
|
+
function S(e, r) {
|
|
207
|
+
return e.map((e) => {
|
|
208
|
+
if (!n(e) || !n(e.style) || !d(e.style, r)) return e;
|
|
209
|
+
if (r === "bold") return {
|
|
210
|
+
...e,
|
|
211
|
+
style: {
|
|
212
|
+
...e.style,
|
|
213
|
+
bold: !0
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
let i = u(e.style), a = i ? t[i] : void 0;
|
|
217
|
+
return a ? {
|
|
218
|
+
...e,
|
|
219
|
+
style: {
|
|
220
|
+
...e.style,
|
|
221
|
+
icon: a
|
|
222
|
+
}
|
|
223
|
+
} : e;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function C(e, t) {
|
|
227
|
+
if (!t.fixable || t.widgetFlatIndex === null) return null;
|
|
228
|
+
let r = b(e, t);
|
|
229
|
+
if (!r) return null;
|
|
230
|
+
if (t.ruleId === "TRUNCATED_AREA_AXIS") return {
|
|
231
|
+
widgetIndex: t.widgetFlatIndex,
|
|
232
|
+
configOverrides: {
|
|
233
|
+
startAtZero: !0,
|
|
234
|
+
yMin: 0
|
|
235
|
+
},
|
|
236
|
+
summary: "Start the vertical axis at zero."
|
|
237
|
+
};
|
|
238
|
+
if (t.ruleId === "COLOUR_ONLY_MEANING") {
|
|
239
|
+
let e = c(r);
|
|
240
|
+
if (!e) return null;
|
|
241
|
+
let i = n(r.config) ? r.config : {}, a = {}, o = null, u = !1;
|
|
242
|
+
for (let t of l(r, e)) {
|
|
243
|
+
if (!Array.isArray(t.list) || !s(t.list).some((e) => d(e.style, t.signals))) continue;
|
|
244
|
+
let e = S(t.list, t.signals);
|
|
245
|
+
if (t.signals === "rich" && (u = !0), "key" in t.location) a[t.location.key] = e;
|
|
246
|
+
else if (Array.isArray(i.columns)) {
|
|
247
|
+
o ??= [...i.columns];
|
|
248
|
+
let r = o[t.location.columnIndex];
|
|
249
|
+
n(r) && (o[t.location.columnIndex] = {
|
|
250
|
+
...r,
|
|
251
|
+
conditionalRules: e
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return o && (a.columns = o), {
|
|
256
|
+
widgetIndex: t.widgetFlatIndex,
|
|
257
|
+
configOverrides: a,
|
|
258
|
+
summary: u ? "Add an icon next to each colour-coded rule (check, alert, flag or dot) so the meaning does not rely on colour. Whole-row and card rules get bold text instead." : "Make the value bold wherever a colour rule matches, so the meaning does not rely on colour."
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
if (t.ruleId === "DUPLICATE_WIDGET_TITLE" && t.pageIndex !== null) {
|
|
262
|
+
let n = e.pages[t.pageIndex];
|
|
263
|
+
if (!n) return null;
|
|
264
|
+
let i = x(n, r.title);
|
|
265
|
+
return {
|
|
266
|
+
widgetIndex: t.widgetFlatIndex,
|
|
267
|
+
title: i,
|
|
268
|
+
summary: `Rename this widget to "${i}".`
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
export { y as lintBoard, C as planLintFix, i as resolveChartKind };
|
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
export interface GeneratedWidgetSpecLike {
|
|
15
15
|
title: string;
|
|
16
16
|
type: string;
|
|
17
|
+
/** Free-form widget settings from the generated proposal; read by Board Lint, ignored by the validator. */
|
|
18
|
+
config?: Record<string, unknown> | null;
|
|
19
|
+
/** Grid position from the generated proposal; read by Board Lint, ignored by the validator. */
|
|
20
|
+
position?: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
} | null;
|
|
17
26
|
}
|
|
18
27
|
export interface GeneratedPageSpecLike {
|
|
19
28
|
name: string;
|