drizzle-cube 0.4.39 → 0.4.41
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/cli/index.cjs +439 -0
- package/dist/client/charts/ChartLoader.d.ts +18 -3
- package/dist/client/charts/chartConfigRegistry.d.ts +11 -1
- package/dist/client/charts/chartPlugin.d.ts +74 -0
- package/dist/client/charts/lazyChartConfigRegistry.d.ts +10 -0
- package/dist/client/charts.js +13 -15
- package/dist/client/chunks/{DashboardEditModal-EmBxK-89.js → DashboardEditModal-D_7J62sG.js} +683 -685
- package/dist/client/chunks/DashboardEditModal-D_7J62sG.js.map +1 -0
- package/dist/client/chunks/{FieldSearchModal-BxQ5JhWz.js → FieldSearchModal-5Qz6vvTz.js} +15 -16
- package/dist/client/chunks/{FieldSearchModal-BxQ5JhWz.js.map → FieldSearchModal-5Qz6vvTz.js.map} +1 -1
- package/dist/client/chunks/{RetentionCombinedChart-D4Yf1TnQ.js → RetentionCombinedChart-B1hUYaXt.js} +2 -2
- package/dist/client/chunks/{RetentionCombinedChart-D4Yf1TnQ.js.map → RetentionCombinedChart-B1hUYaXt.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-BoGY6mlZ.js → RetentionHeatmap-Dn2ocjVf.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-BoGY6mlZ.js.map → RetentionHeatmap-Dn2ocjVf.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-D70S-LZy.js → analysis-builder-DPJJiHVx.js} +1506 -1564
- package/dist/client/chunks/analysis-builder-DPJJiHVx.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-shared-BxHYfTzo.js → analysis-builder-shared-C-C-rOgu.js} +762 -778
- package/dist/client/chunks/analysis-builder-shared-C-C-rOgu.js.map +1 -0
- package/dist/client/chunks/{chart-bar-Bx4oKlqo.js → chart-bar-DVzmau1G.js} +1 -1
- package/dist/client/chunks/{chart-bar-Bx4oKlqo.js.map → chart-bar-DVzmau1G.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-CVIi1aM5.js → chart-box-plot-CCmbHv1Y.js} +1 -1
- package/dist/client/chunks/{chart-box-plot-CVIi1aM5.js.map → chart-box-plot-CCmbHv1Y.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-DvyG15UB.js → chart-bubble-S6qSwWdK.js} +1 -1
- package/dist/client/chunks/{chart-bubble-DvyG15UB.js.map → chart-bubble-S6qSwWdK.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-caHyxB9O.js → chart-candlestick-BNKbDruo.js} +1 -1
- package/dist/client/chunks/{chart-candlestick-caHyxB9O.js.map → chart-candlestick-BNKbDruo.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-USo7JrPh.js → chart-config-activity-grid-BSWS08cI.js} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-USo7JrPh.js.map → chart-config-activity-grid-BSWS08cI.js.map} +1 -1
- package/dist/client/chunks/{chart-config-area-D_ZufYzg.js → chart-config-area-DKwgcHp4.js} +1 -1
- package/dist/client/chunks/{chart-config-area-D_ZufYzg.js.map → chart-config-area-DKwgcHp4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bar-BCi2Wmd6.js → chart-config-bar-deTjEhap.js} +1 -1
- package/dist/client/chunks/{chart-config-bar-BCi2Wmd6.js.map → chart-config-bar-deTjEhap.js.map} +1 -1
- package/dist/client/chunks/{chart-config-box-plot-afKLzJSp.js → chart-config-box-plot-DU4iWk3V.js} +1 -1
- package/dist/client/chunks/{chart-config-box-plot-afKLzJSp.js.map → chart-config-box-plot-DU4iWk3V.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bubble-CgbBjPv8.js → chart-config-bubble-B8FSHSW-.js} +1 -1
- package/dist/client/chunks/{chart-config-bubble-CgbBjPv8.js.map → chart-config-bubble-B8FSHSW-.js.map} +1 -1
- package/dist/client/chunks/{chart-config-candlestick-7boGjZ-A.js → chart-config-candlestick-BGfyWFft.js} +1 -1
- package/dist/client/chunks/{chart-config-candlestick-7boGjZ-A.js.map → chart-config-candlestick-BGfyWFft.js.map} +1 -1
- package/dist/client/chunks/{chart-config-data-table-Cl7sBasW.js → chart-config-data-table-DKRcGa8t.js} +1 -1
- package/dist/client/chunks/{chart-config-data-table-Cl7sBasW.js.map → chart-config-data-table-DKRcGa8t.js.map} +1 -1
- package/dist/client/chunks/{chart-config-funnel-CXPYQtTl.js → chart-config-funnel-Bt4iGFo_.js} +1 -1
- package/dist/client/chunks/{chart-config-funnel-CXPYQtTl.js.map → chart-config-funnel-Bt4iGFo_.js.map} +1 -1
- package/dist/client/chunks/{chart-config-gauge-DUNEUCvh.js → chart-config-gauge-Bk4Jjp3W.js} +1 -1
- package/dist/client/chunks/{chart-config-gauge-DUNEUCvh.js.map → chart-config-gauge-Bk4Jjp3W.js.map} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-BFf1tO11.js → chart-config-heat-map-CkHsqkrY.js} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-BFf1tO11.js.map → chart-config-heat-map-CkHsqkrY.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-C5k2waIJ.js → chart-config-kpi-delta-CkUX98JV.js} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-C5k2waIJ.js.map → chart-config-kpi-delta-CkUX98JV.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DptOyhk0.js → chart-config-kpi-number-DcxyiUgs.js} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DptOyhk0.js.map → chart-config-kpi-number-DcxyiUgs.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-D9DdVWqd.js → chart-config-kpi-text-DI4mj8CN.js} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-D9DdVWqd.js.map → chart-config-kpi-text-DI4mj8CN.js.map} +1 -1
- package/dist/client/chunks/{chart-config-line-B3NgLF7K.js → chart-config-line--j7-dLue.js} +1 -1
- package/dist/client/chunks/{chart-config-line-B3NgLF7K.js.map → chart-config-line--j7-dLue.js.map} +1 -1
- package/dist/client/chunks/{chart-config-markdown-tlfivQTt.js → chart-config-markdown-DUjvVjV4.js} +1 -1
- package/dist/client/chunks/{chart-config-markdown-tlfivQTt.js.map → chart-config-markdown-DUjvVjV4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-measure-profile-D7XDwrU2.js → chart-config-measure-profile-B9FKBNGc.js} +1 -1
- package/dist/client/chunks/{chart-config-measure-profile-D7XDwrU2.js.map → chart-config-measure-profile-B9FKBNGc.js.map} +1 -1
- package/dist/client/chunks/{chart-config-pie-wY0B52PC.js → chart-config-pie-yU4jipl9.js} +1 -1
- package/dist/client/chunks/{chart-config-pie-wY0B52PC.js.map → chart-config-pie-yU4jipl9.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radar-DRpJBy1M.js → chart-config-radar-R9Fkc8wL.js} +1 -1
- package/dist/client/chunks/{chart-config-radar-DRpJBy1M.js.map → chart-config-radar-R9Fkc8wL.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-DCUpXv9G.js → chart-config-radial-bar-DeoXfpIp.js} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-DCUpXv9G.js.map → chart-config-radial-bar-DeoXfpIp.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sankey-CdOhlm4h.js → chart-config-sankey-CXEsxo6s.js} +1 -1
- package/dist/client/chunks/{chart-config-sankey-CdOhlm4h.js.map → chart-config-sankey-CXEsxo6s.js.map} +1 -1
- package/dist/client/chunks/{chart-config-scatter-B2su_x8f.js → chart-config-scatter-MVUFupub.js} +1 -1
- package/dist/client/chunks/{chart-config-scatter-B2su_x8f.js.map → chart-config-scatter-MVUFupub.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-BPdjbk18.js → chart-config-sunburst-Z_gqIY5u.js} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-BPdjbk18.js.map → chart-config-sunburst-Z_gqIY5u.js.map} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-Cbsh2fe2.js → chart-config-tree-map-BD-xAeIy.js} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-Cbsh2fe2.js.map → chart-config-tree-map-BD-xAeIy.js.map} +1 -1
- package/dist/client/chunks/{chart-config-waterfall-DGmuZfQF.js → chart-config-waterfall-CHwVkXZc.js} +1 -1
- package/dist/client/chunks/{chart-config-waterfall-DGmuZfQF.js.map → chart-config-waterfall-CHwVkXZc.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-CW_qZDpt.js → chart-data-table-D4s27-U3.js} +1452 -826
- package/dist/client/chunks/chart-data-table-D4s27-U3.js.map +1 -0
- package/dist/client/chunks/{chart-gauge-BLLJqeXo.js → chart-gauge-BFhc4i_f.js} +1 -1
- package/dist/client/chunks/{chart-gauge-BLLJqeXo.js.map → chart-gauge-BFhc4i_f.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-f2fM2mDC.js → chart-heat-map-BOMQeUDL.js} +1 -1
- package/dist/client/chunks/{chart-heat-map-f2fM2mDC.js.map → chart-heat-map-BOMQeUDL.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-BPexzOe7.js → chart-kpi-delta-DzGNnIcW.js} +4 -4
- package/dist/client/chunks/{chart-kpi-delta-BPexzOe7.js.map → chart-kpi-delta-DzGNnIcW.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-BBtGBtZL.js → chart-kpi-number-sHtgbE_f.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-BBtGBtZL.js.map → chart-kpi-number-sHtgbE_f.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-BqHhmJEB.js → chart-kpi-text-Bmk-GzVJ.js} +2 -2
- package/dist/client/chunks/{chart-kpi-text-BqHhmJEB.js.map → chart-kpi-text-Bmk-GzVJ.js.map} +1 -1
- package/dist/client/chunks/{chart-line-CPhQRMZ7.js → chart-line-Bkl5WQAw.js} +1 -1
- package/dist/client/chunks/{chart-line-CPhQRMZ7.js.map → chart-line-Bkl5WQAw.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-B2X4IwLO.js → chart-markdown-7MNetRtX.js} +1 -1
- package/dist/client/chunks/{chart-markdown-B2X4IwLO.js.map → chart-markdown-7MNetRtX.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-CVlqGslU.js → chart-measure-profile-B7h6vQo4.js} +1 -1
- package/dist/client/chunks/{chart-measure-profile-CVlqGslU.js.map → chart-measure-profile-B7h6vQo4.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-DafSc9sE.js → chart-pie-Do2YnCxl.js} +1 -1
- package/dist/client/chunks/{chart-pie-DafSc9sE.js.map → chart-pie-Do2YnCxl.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-Dz9F5k-B.js → chart-radar-C7gQkH70.js} +1 -1
- package/dist/client/chunks/{chart-radar-Dz9F5k-B.js.map → chart-radar-C7gQkH70.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-N3MNUL7o.js → chart-radial-bar-DHqCck3x.js} +1 -1
- package/dist/client/chunks/{chart-radial-bar-N3MNUL7o.js.map → chart-radial-bar-DHqCck3x.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-J2JNi88S.js → chart-scatter-YSHOUfXf.js} +1 -1
- package/dist/client/chunks/{chart-scatter-J2JNi88S.js.map → chart-scatter-YSHOUfXf.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-D1NFQjqk.js → chart-sunburst-BGhJ4fui.js} +1 -1
- package/dist/client/chunks/{chart-sunburst-D1NFQjqk.js.map → chart-sunburst-BGhJ4fui.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-CbYjko2s.js → chart-tree-map-BlhcXK1F.js} +1 -1
- package/dist/client/chunks/{chart-tree-map-CbYjko2s.js.map → chart-tree-map-BlhcXK1F.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-Z65TGMUO.js → chart-waterfall-BWCAzlPq.js} +1 -1
- package/dist/client/chunks/{chart-waterfall-Z65TGMUO.js.map → chart-waterfall-BWCAzlPq.js.map} +1 -1
- package/dist/client/chunks/{charts-core-CJlGzwsW.js → charts-core-Cy3rHADX.js} +1 -1
- package/dist/client/chunks/{charts-core-CJlGzwsW.js.map → charts-core-Cy3rHADX.js.map} +1 -1
- package/dist/client/chunks/{core-DJrniqct.js → core-BdWfCZ3y.js} +1 -1
- package/dist/client/chunks/{core-DJrniqct.js.map → core-BdWfCZ3y.js.map} +1 -1
- package/dist/client/chunks/{dist-DDBeV_JI.js → dist-BWPE2m_X.js} +1 -1
- package/dist/client/chunks/{dist-DDBeV_JI.js.map → dist-BWPE2m_X.js.map} +1 -1
- package/dist/client/chunks/{javascript-BBwTSo6e.js → javascript-O1RIRkZr.js} +1 -1
- package/dist/client/chunks/{javascript-BBwTSo6e.js.map → javascript-O1RIRkZr.js.map} +1 -1
- package/dist/client/chunks/{json-BpTrLZSh.js → json-C5bX2tt1.js} +1 -1
- package/dist/client/chunks/{json-BpTrLZSh.js.map → json-C5bX2tt1.js.map} +1 -1
- package/dist/client/chunks/{retention-UEXlSdZ-.js → retention-YhT1Oohi.js} +1 -1
- package/dist/client/chunks/{retention-UEXlSdZ-.js.map → retention-YhT1Oohi.js.map} +1 -1
- package/dist/client/chunks/{schema-visualization-BFPl_eKV.js → schema-visualization-BJ8HrNqB.js} +12 -12
- package/dist/client/chunks/schema-visualization-BJ8HrNqB.js.map +1 -0
- package/dist/client/chunks/{sql-B0chxcEK.js → sql-D2qikO5q.js} +1 -1
- package/dist/client/chunks/{sql-B0chxcEK.js.map → sql-D2qikO5q.js.map} +1 -1
- package/dist/client/chunks/{syntaxHighlighting-BLl0ch4A.js → syntaxHighlighting-BYYWYmjr.js} +2 -2
- package/dist/client/chunks/{syntaxHighlighting-BLl0ch4A.js.map → syntaxHighlighting-BYYWYmjr.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-C_wstEud.js → useDebounce-EWynD0lC.js} +12 -12
- package/dist/client/chunks/{useDebounce-C_wstEud.js.map → useDebounce-EWynD0lC.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-CgKZWkel.js → useDirtyStateTracking-KAjwj1Ht.js} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-CgKZWkel.js.map → useDirtyStateTracking-KAjwj1Ht.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-C9ytXRIC.js → useExplainAI-BBTJWQVu.js} +14 -14
- package/dist/client/chunks/{useExplainAI-C9ytXRIC.js.map → useExplainAI-BBTJWQVu.js.map} +1 -1
- package/dist/client/chunks/{useNotebookLayout-BFZ_33Kb.js → useNotebookLayout-DKkMenhj.js} +1 -1
- package/dist/client/chunks/{useNotebookLayout-BFZ_33Kb.js.map → useNotebookLayout-DKkMenhj.js.map} +1 -1
- package/dist/client/chunks/{utils-3FNmeZJR.js → utils-DMyRayr_.js} +2 -2
- package/dist/client/chunks/{utils-3FNmeZJR.js.map → utils-DMyRayr_.js.map} +1 -1
- package/dist/client/chunks/{vendor-BPRWulB7.js → vendor-iY25ogTA.js} +40 -40
- package/dist/client/chunks/{vendor-BPRWulB7.js.map → vendor-iY25ogTA.js.map} +1 -1
- package/dist/client/components.js +3 -3
- package/dist/client/hooks.js +5 -5
- package/dist/client/icons/registry.d.ts +6 -0
- package/dist/client/icons.js +2 -2
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +160 -161
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers/CubeProvider.d.ts +4 -1
- package/dist/client/providers.js +2 -2
- package/dist/client/types.d.ts +2 -1
- package/dist/client/utils.js +6 -6
- package/dist/client-bundle-stats.html +1 -1
- package/package.json +6 -2
- package/dist/client/chunks/DashboardEditModal-EmBxK-89.js.map +0 -1
- package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +0 -56
- package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +0 -1
- package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +0 -25
- package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +0 -1
- package/dist/client/chunks/analysis-builder-D70S-LZy.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-BxHYfTzo.js.map +0 -1
- package/dist/client/chunks/chart-data-table-CW_qZDpt.js.map +0 -1
- package/dist/client/chunks/charts-loader-gZjOqZwG.js +0 -259
- package/dist/client/chunks/charts-loader-gZjOqZwG.js.map +0 -1
- package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +0 -149
- package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +0 -1
- package/dist/client/chunks/schema-visualization-BFPl_eKV.js.map +0 -1
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let node_util = require("node:util");
|
|
25
|
+
let node_fs = require("node:fs");
|
|
26
|
+
node_fs = __toESM(node_fs);
|
|
27
|
+
let node_path = require("node:path");
|
|
28
|
+
node_path = __toESM(node_path);
|
|
29
|
+
//#region src/cli/commands/charts.ts
|
|
30
|
+
/**
|
|
31
|
+
* Charts CLI commands
|
|
32
|
+
*
|
|
33
|
+
* Provides scaffolding for custom chart plugins.
|
|
34
|
+
*/
|
|
35
|
+
var BUILT_IN_CHARTS = {
|
|
36
|
+
bar: "Bar chart — compare values across categories",
|
|
37
|
+
line: "Line chart — show trends over time",
|
|
38
|
+
area: "Area chart — line chart with filled areas",
|
|
39
|
+
pie: "Pie chart — show proportions of a whole",
|
|
40
|
+
scatter: "Scatter chart — show relationships between two measures",
|
|
41
|
+
bubble: "Bubble chart — scatter with size dimension",
|
|
42
|
+
radar: "Radar chart — multi-axis comparison",
|
|
43
|
+
radialBar: "Radial bar chart — circular bar chart",
|
|
44
|
+
treemap: "Treemap — hierarchical data as nested rectangles",
|
|
45
|
+
table: "Data table — sortable tabular display",
|
|
46
|
+
activityGrid: "Activity grid — GitHub-style contribution calendar",
|
|
47
|
+
kpiNumber: "KPI number — single metric display",
|
|
48
|
+
kpiDelta: "KPI delta — metric with change indicator",
|
|
49
|
+
kpiText: "KPI text — text-based metric",
|
|
50
|
+
funnel: "Funnel chart — conversion funnel visualization",
|
|
51
|
+
sankey: "Sankey diagram — flow visualization",
|
|
52
|
+
sunburst: "Sunburst chart — hierarchical pie chart",
|
|
53
|
+
heatmap: "Heatmap — color-coded matrix",
|
|
54
|
+
boxPlot: "Box plot — statistical distribution",
|
|
55
|
+
waterfall: "Waterfall chart — cumulative values",
|
|
56
|
+
candlestick: "Candlestick chart — financial OHLC data",
|
|
57
|
+
gauge: "Gauge — meter-style value display",
|
|
58
|
+
measureProfile: "Measure profile — detailed measure analysis"
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* drizzle-cube charts list
|
|
62
|
+
*/
|
|
63
|
+
function chartsList() {
|
|
64
|
+
console.log("\nAvailable built-in chart types:\n");
|
|
65
|
+
const maxLen = Math.max(...Object.keys(BUILT_IN_CHARTS).map((k) => k.length));
|
|
66
|
+
for (const [type, desc] of Object.entries(BUILT_IN_CHARTS)) console.log(` ${type.padEnd(maxLen + 2)} ${desc}`);
|
|
67
|
+
console.log(`\nUse --from <type> with 'charts init' to copy a built-in as starting point.`);
|
|
68
|
+
console.log(`Example: npx drizzle-cube charts init --from bar\n`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* drizzle-cube charts init
|
|
72
|
+
*/
|
|
73
|
+
function chartsInit() {
|
|
74
|
+
const { values } = (0, node_util.parseArgs)({
|
|
75
|
+
options: {
|
|
76
|
+
from: {
|
|
77
|
+
type: "string",
|
|
78
|
+
short: "f"
|
|
79
|
+
},
|
|
80
|
+
output: {
|
|
81
|
+
type: "string",
|
|
82
|
+
short: "o",
|
|
83
|
+
default: "./src/charts"
|
|
84
|
+
},
|
|
85
|
+
name: {
|
|
86
|
+
type: "string",
|
|
87
|
+
short: "n"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
strict: false
|
|
91
|
+
});
|
|
92
|
+
const outputDir = values.output;
|
|
93
|
+
const fromBuiltIn = values.from;
|
|
94
|
+
const customName = values.name;
|
|
95
|
+
if (fromBuiltIn) {
|
|
96
|
+
if (!BUILT_IN_CHARTS[fromBuiltIn]) {
|
|
97
|
+
console.error(`\nUnknown chart type: "${fromBuiltIn}"`);
|
|
98
|
+
console.error(`Run 'npx drizzle-cube charts list' to see available types.\n`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
scaffoldFromBuiltIn(fromBuiltIn, outputDir, customName);
|
|
102
|
+
} else scaffoldExample(outputDir, customName);
|
|
103
|
+
}
|
|
104
|
+
function scaffoldExample(outputDir, customName) {
|
|
105
|
+
const name = customName || "MyCustomChart";
|
|
106
|
+
const chartType = camelCase(name);
|
|
107
|
+
ensureDir(outputDir);
|
|
108
|
+
const componentPath = node_path.default.join(outputDir, `${name}.tsx`);
|
|
109
|
+
writeIfNotExists(componentPath, generateExampleComponent(name));
|
|
110
|
+
const configPath = node_path.default.join(outputDir, `${name}.config.ts`);
|
|
111
|
+
writeIfNotExists(configPath, generateExampleConfig(name, chartType));
|
|
112
|
+
const indexPath = node_path.default.join(outputDir, "index.ts");
|
|
113
|
+
writeIfNotExists(indexPath, generateRegistrationExample(name, chartType));
|
|
114
|
+
console.log(`
|
|
115
|
+
Chart plugin scaffolded in ${outputDir}/
|
|
116
|
+
|
|
117
|
+
Files created:
|
|
118
|
+
${componentPath} — Chart component
|
|
119
|
+
${configPath} — Chart configuration (drop zones, display options)
|
|
120
|
+
${indexPath} — Registration example
|
|
121
|
+
|
|
122
|
+
Next steps:
|
|
123
|
+
1. Edit ${name}.tsx to implement your chart rendering
|
|
124
|
+
2. Configure drop zones in ${name}.config.ts
|
|
125
|
+
3. Register in your app:
|
|
126
|
+
|
|
127
|
+
import { customCharts } from '${outputDir}'
|
|
128
|
+
|
|
129
|
+
<CubeProvider customCharts={customCharts} ...>
|
|
130
|
+
<App />
|
|
131
|
+
</CubeProvider>
|
|
132
|
+
`);
|
|
133
|
+
}
|
|
134
|
+
function scaffoldFromBuiltIn(chartType, outputDir, customName) {
|
|
135
|
+
const pascalType = chartType.charAt(0).toUpperCase() + chartType.slice(1);
|
|
136
|
+
const name = customName || `Custom${pascalType}Chart`;
|
|
137
|
+
const customType = camelCase(name);
|
|
138
|
+
const sourceDir = findPackageChartsDir();
|
|
139
|
+
if (!sourceDir) {
|
|
140
|
+
console.log(`
|
|
141
|
+
Could not find drizzle-cube chart source files.
|
|
142
|
+
Generating a template based on the ${chartType} chart instead.
|
|
143
|
+
`);
|
|
144
|
+
scaffoldExample(outputDir, name);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const fileName = {
|
|
148
|
+
bar: "BarChart",
|
|
149
|
+
line: "LineChart",
|
|
150
|
+
area: "AreaChart",
|
|
151
|
+
pie: "PieChart",
|
|
152
|
+
scatter: "ScatterChart",
|
|
153
|
+
bubble: "BubbleChart",
|
|
154
|
+
radar: "RadarChart",
|
|
155
|
+
radialBar: "RadialBarChart",
|
|
156
|
+
treemap: "TreeMapChart",
|
|
157
|
+
table: "DataTable",
|
|
158
|
+
activityGrid: "ActivityGridChart",
|
|
159
|
+
kpiNumber: "KpiNumber",
|
|
160
|
+
kpiDelta: "KpiDelta",
|
|
161
|
+
kpiText: "KpiText",
|
|
162
|
+
funnel: "FunnelChart",
|
|
163
|
+
sankey: "SankeyChart",
|
|
164
|
+
sunburst: "SunburstChart",
|
|
165
|
+
heatmap: "HeatMapChart",
|
|
166
|
+
boxPlot: "BoxPlotChart",
|
|
167
|
+
waterfall: "WaterfallChart",
|
|
168
|
+
candlestick: "CandlestickChart",
|
|
169
|
+
gauge: "GaugeChart",
|
|
170
|
+
measureProfile: "MeasureProfileChart"
|
|
171
|
+
}[chartType];
|
|
172
|
+
if (!fileName) {
|
|
173
|
+
console.error(`No file mapping for chart type: ${chartType}`);
|
|
174
|
+
scaffoldExample(outputDir, name);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const componentSource = node_path.default.join(sourceDir, `${fileName}.tsx`);
|
|
178
|
+
const configSource = node_path.default.join(sourceDir, `${fileName}.config.ts`);
|
|
179
|
+
ensureDir(outputDir);
|
|
180
|
+
if (node_fs.default.existsSync(componentSource)) {
|
|
181
|
+
const rewritten = rewriteImports(node_fs.default.readFileSync(componentSource, "utf-8"));
|
|
182
|
+
writeIfNotExists(node_path.default.join(outputDir, `${name}.tsx`), rewritten);
|
|
183
|
+
}
|
|
184
|
+
if (node_fs.default.existsSync(configSource)) {
|
|
185
|
+
const rewritten = rewriteImports(node_fs.default.readFileSync(configSource, "utf-8"));
|
|
186
|
+
writeIfNotExists(node_path.default.join(outputDir, `${name}.config.ts`), rewritten);
|
|
187
|
+
}
|
|
188
|
+
writeIfNotExists(node_path.default.join(outputDir, "index.ts"), generateRegistrationFromBuiltIn(name, customType, chartType, fileName));
|
|
189
|
+
console.log(`
|
|
190
|
+
Chart copied from built-in '${chartType}' to ${outputDir}/
|
|
191
|
+
|
|
192
|
+
Files created:
|
|
193
|
+
${node_path.default.join(outputDir, `${name}.tsx`)} — Chart component (copied from ${fileName})
|
|
194
|
+
${node_path.default.join(outputDir, `${name}.config.ts`)} — Chart configuration
|
|
195
|
+
${node_path.default.join(outputDir, "index.ts")} — Registration example
|
|
196
|
+
|
|
197
|
+
The chart is registered as type '${customType}' (not '${chartType}'), so
|
|
198
|
+
the built-in is preserved. Change the type to '${chartType}' to override it.
|
|
199
|
+
|
|
200
|
+
Next steps:
|
|
201
|
+
1. Customize the component and config
|
|
202
|
+
2. Register in your app:
|
|
203
|
+
|
|
204
|
+
import { customCharts } from '${outputDir}'
|
|
205
|
+
|
|
206
|
+
<CubeProvider customCharts={customCharts} ...>
|
|
207
|
+
<App />
|
|
208
|
+
</CubeProvider>
|
|
209
|
+
`);
|
|
210
|
+
}
|
|
211
|
+
function generateExampleComponent(name) {
|
|
212
|
+
return `import React from 'react'
|
|
213
|
+
import type { ChartProps } from 'drizzle-cube/client'
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* ${name} — Custom chart component
|
|
217
|
+
*
|
|
218
|
+
* Receives the same ChartProps as all drizzle-cube charts:
|
|
219
|
+
* - data: raw query result rows
|
|
220
|
+
* - chartConfig: axis mapping (xAxis, yAxis, series fields)
|
|
221
|
+
* - displayConfig: visual options (colors, legend, etc.)
|
|
222
|
+
* - queryObject: the original CubeQuery
|
|
223
|
+
* - height: container height
|
|
224
|
+
* - colorPalette: theme color palette
|
|
225
|
+
* - onDataPointClick: drill-down handler
|
|
226
|
+
* - drillEnabled: whether drill-down is active
|
|
227
|
+
*/
|
|
228
|
+
const ${name} = React.memo(function ${name}({
|
|
229
|
+
data,
|
|
230
|
+
chartConfig,
|
|
231
|
+
displayConfig = {},
|
|
232
|
+
height = '100%',
|
|
233
|
+
}: ChartProps) {
|
|
234
|
+
if (!data || data.length === 0) {
|
|
235
|
+
return (
|
|
236
|
+
<div
|
|
237
|
+
style={{
|
|
238
|
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
239
|
+
height: typeof height === 'number' ? \`\${height}px\` : height,
|
|
240
|
+
color: '#888', fontSize: '14px',
|
|
241
|
+
}}
|
|
242
|
+
>
|
|
243
|
+
No data available
|
|
244
|
+
</div>
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const xField = chartConfig?.xAxis?.[0]
|
|
249
|
+
const yField = chartConfig?.yAxis?.[0]
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<div style={{ height: typeof height === 'number' ? \`\${height}px\` : height, overflow: 'auto' }}>
|
|
253
|
+
{/* Replace this with your chart rendering logic */}
|
|
254
|
+
<table style={{ width: '100%', borderCollapse: 'collapse' }}>
|
|
255
|
+
<thead>
|
|
256
|
+
<tr>
|
|
257
|
+
{xField && <th style={{ textAlign: 'left', padding: '8px', borderBottom: '2px solid #eee' }}>{xField}</th>}
|
|
258
|
+
{yField && <th style={{ textAlign: 'right', padding: '8px', borderBottom: '2px solid #eee' }}>{yField}</th>}
|
|
259
|
+
</tr>
|
|
260
|
+
</thead>
|
|
261
|
+
<tbody>
|
|
262
|
+
{data.map((row, i) => (
|
|
263
|
+
<tr key={i}>
|
|
264
|
+
{xField && <td style={{ padding: '8px', borderBottom: '1px solid #eee' }}>{String(row[xField] ?? '')}</td>}
|
|
265
|
+
{yField && <td style={{ padding: '8px', borderBottom: '1px solid #eee', textAlign: 'right' }}>{String(row[yField] ?? '')}</td>}
|
|
266
|
+
</tr>
|
|
267
|
+
))}
|
|
268
|
+
</tbody>
|
|
269
|
+
</table>
|
|
270
|
+
</div>
|
|
271
|
+
)
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
export default ${name}
|
|
275
|
+
`;
|
|
276
|
+
}
|
|
277
|
+
function generateExampleConfig(name, chartType) {
|
|
278
|
+
return `import type { ChartTypeConfig } from 'drizzle-cube/client'
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Configuration for ${name}
|
|
282
|
+
*
|
|
283
|
+
* - label: Display name in the chart type picker
|
|
284
|
+
* - dropZones: Define which axes/fields the chart accepts
|
|
285
|
+
* - displayOptionsConfig: Define visual configuration options
|
|
286
|
+
*/
|
|
287
|
+
export const ${chartType}Config: ChartTypeConfig = {
|
|
288
|
+
label: '${name.replace(/([A-Z])/g, " $1").trim()}',
|
|
289
|
+
description: 'A custom chart type',
|
|
290
|
+
useCase: 'Use this chart when you need ...',
|
|
291
|
+
|
|
292
|
+
dropZones: [
|
|
293
|
+
{
|
|
294
|
+
key: 'xAxis',
|
|
295
|
+
label: 'X-Axis (Categories)',
|
|
296
|
+
mandatory: false,
|
|
297
|
+
acceptTypes: ['dimension', 'timeDimension'],
|
|
298
|
+
emptyText: 'Drop dimensions here',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
key: 'yAxis',
|
|
302
|
+
label: 'Y-Axis (Values)',
|
|
303
|
+
mandatory: true,
|
|
304
|
+
acceptTypes: ['measure'],
|
|
305
|
+
emptyText: 'Drop measures here',
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
|
|
309
|
+
displayOptionsConfig: [
|
|
310
|
+
{
|
|
311
|
+
key: 'showLegend',
|
|
312
|
+
label: 'Show Legend',
|
|
313
|
+
type: 'boolean',
|
|
314
|
+
defaultValue: true,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
}
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
function generateRegistrationExample(name, chartType) {
|
|
321
|
+
return `import type { ChartDefinition } from 'drizzle-cube/client'
|
|
322
|
+
import ${name} from './${name}'
|
|
323
|
+
import { ${chartType}Config } from './${name}.config'
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Custom chart definitions to pass to CubeProvider.
|
|
327
|
+
*
|
|
328
|
+
* Usage:
|
|
329
|
+
* import { customCharts } from './charts'
|
|
330
|
+
*
|
|
331
|
+
* <CubeProvider customCharts={customCharts} ...>
|
|
332
|
+
* <App />
|
|
333
|
+
* </CubeProvider>
|
|
334
|
+
*/
|
|
335
|
+
export const customCharts: ChartDefinition[] = [
|
|
336
|
+
{
|
|
337
|
+
type: '${chartType}',
|
|
338
|
+
label: '${name.replace(/([A-Z])/g, " $1").trim()}',
|
|
339
|
+
config: ${chartType}Config,
|
|
340
|
+
component: ${name},
|
|
341
|
+
},
|
|
342
|
+
]
|
|
343
|
+
`;
|
|
344
|
+
}
|
|
345
|
+
function generateRegistrationFromBuiltIn(name, customType, _builtInType, fileName) {
|
|
346
|
+
const configExportName = fileName.charAt(0).toLowerCase() + fileName.slice(1) + "Config";
|
|
347
|
+
return `import type { ChartDefinition } from 'drizzle-cube/client'
|
|
348
|
+
import ${name} from './${name}'
|
|
349
|
+
import { ${configExportName} } from './${name}.config'
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Custom chart definitions to pass to CubeProvider.
|
|
353
|
+
*
|
|
354
|
+
* Usage:
|
|
355
|
+
* import { customCharts } from './charts'
|
|
356
|
+
*
|
|
357
|
+
* <CubeProvider customCharts={customCharts} ...>
|
|
358
|
+
* <App />
|
|
359
|
+
* </CubeProvider>
|
|
360
|
+
*/
|
|
361
|
+
export const customCharts: ChartDefinition[] = [
|
|
362
|
+
{
|
|
363
|
+
type: '${customType}',
|
|
364
|
+
label: ${configExportName}.label || '${name.replace(/([A-Z])/g, " $1").trim()}',
|
|
365
|
+
config: ${configExportName},
|
|
366
|
+
component: ${name},
|
|
367
|
+
},
|
|
368
|
+
]
|
|
369
|
+
`;
|
|
370
|
+
}
|
|
371
|
+
function camelCase(name) {
|
|
372
|
+
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
373
|
+
}
|
|
374
|
+
function ensureDir(dir) {
|
|
375
|
+
if (!node_fs.default.existsSync(dir)) node_fs.default.mkdirSync(dir, { recursive: true });
|
|
376
|
+
}
|
|
377
|
+
function writeIfNotExists(filePath, content) {
|
|
378
|
+
if (node_fs.default.existsSync(filePath)) {
|
|
379
|
+
console.warn(` Skipping ${filePath} (already exists)`);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
node_fs.default.writeFileSync(filePath, content, "utf-8");
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Try to find the chart component source directory from the installed package.
|
|
386
|
+
*/
|
|
387
|
+
function findPackageChartsDir() {
|
|
388
|
+
const candidates = [node_path.default.resolve(__dirname, "..", "..", "src", "client", "components", "charts"), node_path.default.resolve(__dirname, "..", "client", "components", "charts")];
|
|
389
|
+
for (const candidate of candidates) if (node_fs.default.existsSync(candidate)) return candidate;
|
|
390
|
+
try {
|
|
391
|
+
const pkgPath = require.resolve("drizzle-cube/package.json");
|
|
392
|
+
const pkgDir = node_path.default.dirname(pkgPath);
|
|
393
|
+
const chartsDir = node_path.default.join(pkgDir, "src", "client", "components", "charts");
|
|
394
|
+
if (node_fs.default.existsSync(chartsDir)) return chartsDir;
|
|
395
|
+
} catch {}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Rewrite internal drizzle-cube imports to use the public package imports.
|
|
400
|
+
*/
|
|
401
|
+
function rewriteImports(content) {
|
|
402
|
+
return content.replace(/from\s+['"]\.\.\/\.\.\/charts\/chartConfigs['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/charts\/[^'"]+['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/types['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/hooks\/[^'"]+['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/icons['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/icons\/[^'"]+['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/utils\/[^'"]+['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/shared\/[^'"]+['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\.\/\.\.\/providers\/[^'"]+['"]/g, "from 'drizzle-cube/client'").replace(/from\s+['"]\.\/([^'"]+)['"]/g, "from 'drizzle-cube/client'");
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/cli/index.ts
|
|
406
|
+
/**
|
|
407
|
+
* drizzle-cube CLI
|
|
408
|
+
*
|
|
409
|
+
* Usage:
|
|
410
|
+
* npx drizzle-cube charts init # Scaffold an example custom chart
|
|
411
|
+
* npx drizzle-cube charts init --from bar # Copy a built-in chart as starting point
|
|
412
|
+
* npx drizzle-cube charts init -o ./my-charts # Custom output directory
|
|
413
|
+
* npx drizzle-cube charts list # List available built-in chart types
|
|
414
|
+
*/
|
|
415
|
+
var { positionals } = (0, node_util.parseArgs)({
|
|
416
|
+
allowPositionals: true,
|
|
417
|
+
strict: false
|
|
418
|
+
});
|
|
419
|
+
var [command, subcommand] = positionals;
|
|
420
|
+
if (command === "charts") if (subcommand === "init") chartsInit();
|
|
421
|
+
else if (subcommand === "list") chartsList();
|
|
422
|
+
else console.log(`
|
|
423
|
+
drizzle-cube charts
|
|
424
|
+
|
|
425
|
+
Commands:
|
|
426
|
+
drizzle-cube charts init Scaffold a custom chart
|
|
427
|
+
drizzle-cube charts init --from bar Copy a built-in chart as starting point
|
|
428
|
+
drizzle-cube charts init -o <dir> Set output directory (default: ./src/charts)
|
|
429
|
+
drizzle-cube charts list List available built-in chart types
|
|
430
|
+
`);
|
|
431
|
+
else console.log(`
|
|
432
|
+
drizzle-cube CLI
|
|
433
|
+
|
|
434
|
+
Commands:
|
|
435
|
+
drizzle-cube charts Chart plugin scaffolding tools
|
|
436
|
+
|
|
437
|
+
Run 'drizzle-cube charts' for more info.
|
|
438
|
+
`);
|
|
439
|
+
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import { ChartType, ChartProps } from '../types';
|
|
3
3
|
/**
|
|
4
|
-
* Check if a chart type is supported
|
|
4
|
+
* Check if a chart type is supported (built-in or custom plugin)
|
|
5
5
|
*/
|
|
6
6
|
export declare function isValidChartType(chartType: string): chartType is ChartType;
|
|
7
7
|
export interface LazyChartProps extends ChartProps {
|
|
@@ -51,7 +51,7 @@ export declare function preloadChart(chartType: ChartType): void;
|
|
|
51
51
|
*/
|
|
52
52
|
export declare function preloadCharts(chartTypes: ChartType[]): void;
|
|
53
53
|
/**
|
|
54
|
-
* Get all available chart types
|
|
54
|
+
* Get all available chart types (built-in + custom plugins)
|
|
55
55
|
*/
|
|
56
56
|
export declare function getAvailableChartTypes(): ChartType[];
|
|
57
57
|
/**
|
|
@@ -66,3 +66,18 @@ export declare function isChartTypeAvailable(chartType: ChartType): boolean;
|
|
|
66
66
|
* Get list of chart types that failed to load due to missing dependencies.
|
|
67
67
|
*/
|
|
68
68
|
export declare function getUnavailableChartTypes(): ChartType[];
|
|
69
|
+
/**
|
|
70
|
+
* Register a custom chart component.
|
|
71
|
+
* Used by the chart plugin system.
|
|
72
|
+
*/
|
|
73
|
+
export declare function registerChartComponent(type: string, component?: ComponentType<ChartProps>, lazyComponent?: () => Promise<{
|
|
74
|
+
default: ComponentType<ChartProps>;
|
|
75
|
+
}>, dependencies?: {
|
|
76
|
+
packageName: string;
|
|
77
|
+
installCommand: string;
|
|
78
|
+
}): void;
|
|
79
|
+
/**
|
|
80
|
+
* Unregister a custom chart component.
|
|
81
|
+
* Used by the chart plugin system.
|
|
82
|
+
*/
|
|
83
|
+
export declare function unregisterChartComponent(type: string): void;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { ChartConfigRegistry } from './chartConfigs';
|
|
1
|
+
import { ChartTypeConfig, ChartConfigRegistry } from './chartConfigs';
|
|
2
2
|
/**
|
|
3
3
|
* Registry of all chart type configurations
|
|
4
4
|
*/
|
|
5
5
|
export declare const chartConfigRegistry: ChartConfigRegistry;
|
|
6
|
+
/**
|
|
7
|
+
* Register a custom chart config into the registry.
|
|
8
|
+
* Used by the chart plugin system.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerChartConfig(type: string, config: ChartTypeConfig): void;
|
|
11
|
+
/**
|
|
12
|
+
* Unregister a chart config from the registry.
|
|
13
|
+
* Used by the chart plugin system.
|
|
14
|
+
*/
|
|
15
|
+
export declare function unregisterChartConfig(type: string): void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { ChartProps } from '../types';
|
|
3
|
+
import { ChartTypeConfig } from './chartConfigs';
|
|
4
|
+
import { IconProps } from '../icons/types';
|
|
5
|
+
/**
|
|
6
|
+
* Complete definition for registering a custom chart type.
|
|
7
|
+
* Bundles component, config metadata, and optional icon.
|
|
8
|
+
*/
|
|
9
|
+
export interface ChartDefinition {
|
|
10
|
+
/** Unique chart type identifier (e.g., 'myGantt', 'customBar') */
|
|
11
|
+
type: string;
|
|
12
|
+
/** Display label for the chart type picker */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Chart type configuration (drop zones, display options, validation) */
|
|
15
|
+
config: ChartTypeConfig;
|
|
16
|
+
/** The chart component (eager — loaded immediately) */
|
|
17
|
+
component?: ComponentType<ChartProps>;
|
|
18
|
+
/** Lazy-loaded chart component (for code splitting). Use instead of `component`. */
|
|
19
|
+
lazyComponent?: () => Promise<{
|
|
20
|
+
default: ComponentType<ChartProps>;
|
|
21
|
+
}>;
|
|
22
|
+
/** Optional icon component for the chart type picker */
|
|
23
|
+
icon?: ComponentType<IconProps>;
|
|
24
|
+
/** Optional dependency info — shows install instructions if the import fails */
|
|
25
|
+
dependencies?: {
|
|
26
|
+
packageName: string;
|
|
27
|
+
installCommand: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Central registry for custom chart plugins.
|
|
32
|
+
*
|
|
33
|
+
* Coordinates registration across the three internal registries
|
|
34
|
+
* (config, lazy config cache, chart loader) and provides a
|
|
35
|
+
* `useSyncExternalStore`-compatible subscription API for React reactivity.
|
|
36
|
+
*/
|
|
37
|
+
declare class ChartPluginRegistry {
|
|
38
|
+
private customCharts;
|
|
39
|
+
private builtInBackups;
|
|
40
|
+
private iconMap;
|
|
41
|
+
private version;
|
|
42
|
+
private listeners;
|
|
43
|
+
/**
|
|
44
|
+
* Register a custom chart definition.
|
|
45
|
+
* If `type` matches a built-in chart, the built-in is backed up and can be
|
|
46
|
+
* restored by calling `unregister()`.
|
|
47
|
+
*/
|
|
48
|
+
register(definition: ChartDefinition): void;
|
|
49
|
+
/**
|
|
50
|
+
* Unregister a custom chart.
|
|
51
|
+
* If the chart type was a built-in override, the original built-in is restored.
|
|
52
|
+
*/
|
|
53
|
+
unregister(type: string): void;
|
|
54
|
+
/** Get the custom icon for a chart type, if registered */
|
|
55
|
+
getIcon(type: string): ComponentType<IconProps> | undefined;
|
|
56
|
+
/** Get all registered custom chart type strings */
|
|
57
|
+
getCustomTypes(): string[];
|
|
58
|
+
/** Check if a chart type is a custom plugin (not built-in) */
|
|
59
|
+
isCustom(type: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Subscribe to registry changes.
|
|
62
|
+
* Compatible with React's `useSyncExternalStore`.
|
|
63
|
+
*/
|
|
64
|
+
subscribe: (listener: () => void) => (() => void);
|
|
65
|
+
/**
|
|
66
|
+
* Get a snapshot of the registry version.
|
|
67
|
+
* Compatible with React's `useSyncExternalStore`.
|
|
68
|
+
*/
|
|
69
|
+
getSnapshot: () => number;
|
|
70
|
+
private bump;
|
|
71
|
+
}
|
|
72
|
+
/** Singleton chart plugin registry */
|
|
73
|
+
export declare const chartPluginRegistry: ChartPluginRegistry;
|
|
74
|
+
export {};
|
|
@@ -88,3 +88,13 @@ export declare function loadAllChartConfigs(): Promise<ChartConfigRegistry>;
|
|
|
88
88
|
* Useful for testing or when configs need to be reloaded.
|
|
89
89
|
*/
|
|
90
90
|
export declare function clearChartConfigCache(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Register a custom chart config directly into the cache.
|
|
93
|
+
* Used by the chart plugin system.
|
|
94
|
+
*/
|
|
95
|
+
export declare function registerConfigToCache(type: string, config: ChartTypeConfig): void;
|
|
96
|
+
/**
|
|
97
|
+
* Remove a custom chart config from the cache.
|
|
98
|
+
* Used by the chart plugin system.
|
|
99
|
+
*/
|
|
100
|
+
export declare function unregisterConfigFromCache(type: string): void;
|
package/dist/client/charts.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./chunks/chart-funnel-C9JRW79j.js";
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import { t as
|
|
13
|
-
|
|
14
|
-
import { t as k } from "./chunks/chart-tree-map-CbYjko2s.js";
|
|
15
|
-
export { i as CHART_COLORS, r as CHART_MARGINS, e as DataTable, t as FunnelChart, p as LazyChart, n as NEGATIVE_COLOR, a as POSITIVE_COLOR, o as RechartsAreaChart, w as RechartsBarChart, C as RechartsLineChart, T as RechartsPieChart, D as RechartsRadarChart, O as RechartsRadialBarChart, E as RechartsScatterChart, k as RechartsTreeMapChart, x as clearChartConfigCache, S as formatChartData, l as getAvailableChartTypes, _ as getChartConfigAsync, y as getChartConfigSync, d as getUnavailableChartTypes, g as isChartConfigLoaded, c as isChartTypeAvailable, s as isValidChartType, m as loadAllChartConfigs, u as preloadChart, v as preloadChartConfig, b as preloadChartConfigs, f as preloadCharts, h as useChartConfig };
|
|
1
|
+
import { C as e, D as t, E as n, S as r, T as i, _ as a, b as o, g as s, h as c, m as l, p as u, t as d, v as f, w as p, x as m, y as h } from "./chunks/chart-data-table-D4s27-U3.js";
|
|
2
|
+
import { t as g } from "./chunks/chart-funnel-C9JRW79j.js";
|
|
3
|
+
import { a as _, i as v, n as y, o as b } from "./chunks/chart-activity-grid-wR2Twpo7.js";
|
|
4
|
+
import { t as x } from "./chunks/chart-area-e9ysnatQ.js";
|
|
5
|
+
import { i as S } from "./chunks/utils-DMyRayr_.js";
|
|
6
|
+
import { t as C } from "./chunks/chart-line-Bkl5WQAw.js";
|
|
7
|
+
import { t as w } from "./chunks/chart-bar-DVzmau1G.js";
|
|
8
|
+
import { t as T } from "./chunks/chart-pie-Do2YnCxl.js";
|
|
9
|
+
import { t as E } from "./chunks/chart-scatter-YSHOUfXf.js";
|
|
10
|
+
import { t as D } from "./chunks/chart-radar-C7gQkH70.js";
|
|
11
|
+
import { t as O } from "./chunks/chart-radial-bar-DHqCck3x.js";
|
|
12
|
+
import { t as k } from "./chunks/chart-tree-map-BlhcXK1F.js";
|
|
13
|
+
export { y as CHART_COLORS, v as CHART_MARGINS, d as DataTable, g as FunnelChart, m as LazyChart, _ as NEGATIVE_COLOR, b as POSITIVE_COLOR, x as RechartsAreaChart, w as RechartsBarChart, C as RechartsLineChart, T as RechartsPieChart, D as RechartsRadarChart, O as RechartsRadialBarChart, E as RechartsScatterChart, k as RechartsTreeMapChart, u as clearChartConfigCache, S as formatChartData, r as getAvailableChartTypes, l as getChartConfigAsync, c as getChartConfigSync, e as getUnavailableChartTypes, s as isChartConfigLoaded, p as isChartTypeAvailable, i as isValidChartType, a as loadAllChartConfigs, n as preloadChart, f as preloadChartConfig, h as preloadChartConfigs, t as preloadCharts, o as useChartConfig };
|