@silverpoint/react 0.1.0 → 0.2.0
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/README.md +228 -0
- package/dist/activity-grid.js +3 -2
- package/dist/area-chart.js +3 -2
- package/dist/bar-chart.js +3 -2
- package/dist/bubble-chart.js +3 -2
- package/dist/bullet-chart.js +3 -2
- package/dist/candlestick-chart.js +3 -2
- package/dist/chord-ring.js +3 -2
- package/dist/{chunk-FDROMD5U.js → chunk-2NQ4DXLT.js} +2 -2
- package/dist/{chunk-INZGRNO3.js → chunk-46S63XYT.js} +10 -3
- package/dist/chunk-46S63XYT.js.map +1 -0
- package/dist/chunk-4GQ5X2WK.js +10 -0
- package/dist/chunk-4GQ5X2WK.js.map +1 -0
- package/dist/{chunk-4DUH2UHE.js → chunk-4LS7B7CK.js} +2 -2
- package/dist/{chunk-CXXCUD4B.js → chunk-6KPX5HYV.js} +2 -2
- package/dist/{chunk-6FZO4SMF.js → chunk-74ONV2GE.js} +2 -2
- package/dist/{chunk-ORIH4UQP.js → chunk-7KED5KUU.js} +2 -2
- package/dist/{chunk-Y7WZS3VB.js → chunk-A42AKCPS.js} +2 -2
- package/dist/{chunk-WLHXHAEV.js → chunk-CERHTEML.js} +2 -2
- package/dist/{chunk-2JXPSUCK.js → chunk-DTBEXYYC.js} +2 -2
- package/dist/{chunk-JCIEWEQC.js → chunk-E5LIZKJT.js} +2 -2
- package/dist/{chunk-R6PUPQUI.js → chunk-FQHAHZBR.js} +2 -2
- package/dist/{chunk-HH2RZCH6.js → chunk-FZMY6NWJ.js} +2 -2
- package/dist/{chunk-5LQGSI6N.js → chunk-GBTH55AM.js} +2 -2
- package/dist/{chunk-KTBGRGB7.js → chunk-GYUTG5R2.js} +2 -2
- package/dist/{chunk-NAYUAF7O.js → chunk-H3UH7F5S.js} +2 -2
- package/dist/{chunk-AQMWZQ2P.js → chunk-H4NCK6RE.js} +2 -2
- package/dist/{chunk-LOIVX5IV.js → chunk-J5OOZDFF.js} +2 -2
- package/dist/{chunk-BIIINOXE.js → chunk-JRAHTS5O.js} +2 -2
- package/dist/{chunk-2Q2ZZTUW.js → chunk-KDQHOND7.js} +2 -2
- package/dist/{chunk-G2A5PWIR.js → chunk-NHUVAE4Z.js} +2 -2
- package/dist/{chunk-NOVLEZPR.js → chunk-NW2SQ6QW.js} +2 -2
- package/dist/chunk-OD6N2ATZ.js +45 -0
- package/dist/chunk-OD6N2ATZ.js.map +1 -0
- package/dist/{chunk-DZPDZGM7.js → chunk-OFDVE64G.js} +2 -2
- package/dist/{chunk-V3PBT4XB.js → chunk-P53KSCPE.js} +2 -2
- package/dist/{chunk-2OAPH7JN.js → chunk-PWFDYIXV.js} +2 -2
- package/dist/{chunk-HYQLSAEO.js → chunk-TAQOBBF7.js} +2 -2
- package/dist/{chunk-DYK3SUIZ.js → chunk-TKQ2PQDW.js} +2 -2
- package/dist/{chunk-RUC577P7.js → chunk-UXVYCPFL.js} +2 -2
- package/dist/{chunk-CCFFHU7V.js → chunk-VISNFHPM.js} +2 -2
- package/dist/{chunk-YS5YVHK5.js → chunk-WHZ4ALRI.js} +2 -2
- package/dist/{chunk-CI4PGKUI.js → chunk-WICFKWEZ.js} +2 -2
- package/dist/{chunk-BHZNDYU3.js → chunk-WNX4XCL6.js} +22 -12
- package/dist/chunk-WNX4XCL6.js.map +1 -0
- package/dist/{chunk-O2DNGRM7.js → chunk-WOKDS6AK.js} +2 -2
- package/dist/{chunk-PBT76UXS.js → chunk-X2ACXB2U.js} +2 -2
- package/dist/{chunk-KPWHWNZH.js → chunk-XWSCKTPG.js} +2 -2
- package/dist/{chunk-M3X7JONW.js → chunk-ZKLVP4JE.js} +2 -2
- package/dist/composed-chart.js +3 -2
- package/dist/coxcomb-chart.js +3 -2
- package/dist/create-server-chart-DJQCtKVM.d.ts +17 -0
- package/dist/dashboard-link.d.ts +20 -0
- package/dist/dashboard-link.js +27 -0
- package/dist/dashboard-link.js.map +1 -0
- package/dist/dashboard-markup-_EoDs-s-.d.ts +21 -0
- package/dist/dashboard.d.ts +22 -0
- package/dist/dashboard.js +18 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/donut-chart.js +3 -2
- package/dist/funnel-chart.js +3 -2
- package/dist/gauge-arc.js +3 -2
- package/dist/heatmap-chart.js +3 -2
- package/dist/index.js +35 -34
- package/dist/index.js.map +1 -1
- package/dist/kpi-card.js +3 -2
- package/dist/line-chart.js +3 -2
- package/dist/meter-chart.js +3 -2
- package/dist/orbit-chart.js +3 -2
- package/dist/polar-bar-chart.js +3 -2
- package/dist/pyramid-chart.js +3 -2
- package/dist/radar-chart.js +3 -2
- package/dist/radial-arc-group.js +3 -2
- package/dist/radial-rings.js +3 -2
- package/dist/range-band-chart.js +3 -2
- package/dist/sankey-chart.js +3 -2
- package/dist/scatter-chart.js +3 -2
- package/dist/server/activity-grid.d.ts +9 -2
- package/dist/server/activity-grid.js +1 -1
- package/dist/server/area-chart.d.ts +9 -2
- package/dist/server/area-chart.js +1 -1
- package/dist/server/bar-chart.d.ts +9 -2
- package/dist/server/bar-chart.js +1 -1
- package/dist/server/bubble-chart.d.ts +9 -2
- package/dist/server/bubble-chart.js +1 -1
- package/dist/server/bullet-chart.d.ts +9 -2
- package/dist/server/bullet-chart.js +1 -1
- package/dist/server/candlestick-chart.d.ts +9 -2
- package/dist/server/candlestick-chart.js +1 -1
- package/dist/server/chord-ring.d.ts +9 -2
- package/dist/server/chord-ring.js +1 -1
- package/dist/server/composed-chart.d.ts +9 -2
- package/dist/server/composed-chart.js +1 -1
- package/dist/server/coxcomb-chart.d.ts +9 -2
- package/dist/server/coxcomb-chart.js +1 -1
- package/dist/server/dashboard.d.ts +15 -0
- package/dist/server/dashboard.js +15 -0
- package/dist/server/dashboard.js.map +1 -0
- package/dist/server/donut-chart.d.ts +9 -2
- package/dist/server/donut-chart.js +1 -1
- package/dist/server/funnel-chart.d.ts +9 -2
- package/dist/server/funnel-chart.js +1 -1
- package/dist/server/gauge-arc.d.ts +9 -2
- package/dist/server/gauge-arc.js +1 -1
- package/dist/server/heatmap-chart.d.ts +9 -2
- package/dist/server/heatmap-chart.js +1 -1
- package/dist/server/kpi-card.d.ts +9 -2
- package/dist/server/kpi-card.js +1 -1
- package/dist/server/line-chart.d.ts +9 -2
- package/dist/server/line-chart.js +1 -1
- package/dist/server/meter-chart.d.ts +9 -2
- package/dist/server/meter-chart.js +1 -1
- package/dist/server/orbit-chart.d.ts +9 -2
- package/dist/server/orbit-chart.js +1 -1
- package/dist/server/polar-bar-chart.d.ts +9 -2
- package/dist/server/polar-bar-chart.js +1 -1
- package/dist/server/pyramid-chart.d.ts +9 -2
- package/dist/server/pyramid-chart.js +1 -1
- package/dist/server/radar-chart.d.ts +9 -2
- package/dist/server/radar-chart.js +1 -1
- package/dist/server/radial-arc-group.d.ts +9 -2
- package/dist/server/radial-arc-group.js +1 -1
- package/dist/server/radial-rings.d.ts +9 -2
- package/dist/server/radial-rings.js +1 -1
- package/dist/server/range-band-chart.d.ts +9 -2
- package/dist/server/range-band-chart.js +1 -1
- package/dist/server/sankey-chart.d.ts +9 -2
- package/dist/server/sankey-chart.js +1 -1
- package/dist/server/scatter-chart.d.ts +9 -2
- package/dist/server/scatter-chart.js +1 -1
- package/dist/server/sparkline-rows.d.ts +9 -2
- package/dist/server/sparkline-rows.js +1 -1
- package/dist/server/stacked-bar-chart.d.ts +9 -2
- package/dist/server/stacked-bar-chart.js +1 -1
- package/dist/server/step-chart.d.ts +9 -2
- package/dist/server/step-chart.js +1 -1
- package/dist/server/stream-chart.d.ts +9 -2
- package/dist/server/stream-chart.js +1 -1
- package/dist/server/treemap-chart.d.ts +9 -2
- package/dist/server/treemap-chart.js +1 -1
- package/dist/server/volvelle-chart.d.ts +9 -2
- package/dist/server/volvelle-chart.js +1 -1
- package/dist/server/waterfall-chart.d.ts +9 -2
- package/dist/server/waterfall-chart.js +1 -1
- package/dist/server/wind-rose.d.ts +9 -2
- package/dist/server/wind-rose.js +1 -1
- package/dist/sparkline-rows.js +3 -2
- package/dist/stacked-bar-chart.js +3 -2
- package/dist/step-chart.js +3 -2
- package/dist/stream-chart.js +3 -2
- package/dist/treemap-chart.js +3 -2
- package/dist/volvelle-chart.js +3 -2
- package/dist/waterfall-chart.js +3 -2
- package/dist/wind-rose.js +3 -2
- package/package.json +21 -3
- package/dist/chunk-BHZNDYU3.js.map +0 -1
- package/dist/chunk-INZGRNO3.js.map +0 -1
- package/dist/create-server-chart-B0LbkpQP.d.ts +0 -16
- /package/dist/{chunk-FDROMD5U.js.map → chunk-2NQ4DXLT.js.map} +0 -0
- /package/dist/{chunk-4DUH2UHE.js.map → chunk-4LS7B7CK.js.map} +0 -0
- /package/dist/{chunk-CXXCUD4B.js.map → chunk-6KPX5HYV.js.map} +0 -0
- /package/dist/{chunk-6FZO4SMF.js.map → chunk-74ONV2GE.js.map} +0 -0
- /package/dist/{chunk-ORIH4UQP.js.map → chunk-7KED5KUU.js.map} +0 -0
- /package/dist/{chunk-Y7WZS3VB.js.map → chunk-A42AKCPS.js.map} +0 -0
- /package/dist/{chunk-WLHXHAEV.js.map → chunk-CERHTEML.js.map} +0 -0
- /package/dist/{chunk-2JXPSUCK.js.map → chunk-DTBEXYYC.js.map} +0 -0
- /package/dist/{chunk-JCIEWEQC.js.map → chunk-E5LIZKJT.js.map} +0 -0
- /package/dist/{chunk-R6PUPQUI.js.map → chunk-FQHAHZBR.js.map} +0 -0
- /package/dist/{chunk-HH2RZCH6.js.map → chunk-FZMY6NWJ.js.map} +0 -0
- /package/dist/{chunk-5LQGSI6N.js.map → chunk-GBTH55AM.js.map} +0 -0
- /package/dist/{chunk-KTBGRGB7.js.map → chunk-GYUTG5R2.js.map} +0 -0
- /package/dist/{chunk-NAYUAF7O.js.map → chunk-H3UH7F5S.js.map} +0 -0
- /package/dist/{chunk-AQMWZQ2P.js.map → chunk-H4NCK6RE.js.map} +0 -0
- /package/dist/{chunk-LOIVX5IV.js.map → chunk-J5OOZDFF.js.map} +0 -0
- /package/dist/{chunk-BIIINOXE.js.map → chunk-JRAHTS5O.js.map} +0 -0
- /package/dist/{chunk-2Q2ZZTUW.js.map → chunk-KDQHOND7.js.map} +0 -0
- /package/dist/{chunk-G2A5PWIR.js.map → chunk-NHUVAE4Z.js.map} +0 -0
- /package/dist/{chunk-NOVLEZPR.js.map → chunk-NW2SQ6QW.js.map} +0 -0
- /package/dist/{chunk-DZPDZGM7.js.map → chunk-OFDVE64G.js.map} +0 -0
- /package/dist/{chunk-V3PBT4XB.js.map → chunk-P53KSCPE.js.map} +0 -0
- /package/dist/{chunk-2OAPH7JN.js.map → chunk-PWFDYIXV.js.map} +0 -0
- /package/dist/{chunk-HYQLSAEO.js.map → chunk-TAQOBBF7.js.map} +0 -0
- /package/dist/{chunk-DYK3SUIZ.js.map → chunk-TKQ2PQDW.js.map} +0 -0
- /package/dist/{chunk-RUC577P7.js.map → chunk-UXVYCPFL.js.map} +0 -0
- /package/dist/{chunk-CCFFHU7V.js.map → chunk-VISNFHPM.js.map} +0 -0
- /package/dist/{chunk-YS5YVHK5.js.map → chunk-WHZ4ALRI.js.map} +0 -0
- /package/dist/{chunk-CI4PGKUI.js.map → chunk-WICFKWEZ.js.map} +0 -0
- /package/dist/{chunk-O2DNGRM7.js.map → chunk-WOKDS6AK.js.map} +0 -0
- /package/dist/{chunk-PBT76UXS.js.map → chunk-X2ACXB2U.js.map} +0 -0
- /package/dist/{chunk-KPWHWNZH.js.map → chunk-XWSCKTPG.js.map} +0 -0
- /package/dist/{chunk-M3X7JONW.js.map → chunk-ZKLVP4JE.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/pyramid-chart.tsx
|
|
7
7
|
import { pyramidChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var PyramidChart = createClientChart(pyramidChart);
|
|
|
10
10
|
export {
|
|
11
11
|
PyramidChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-KDQHOND7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/coxcomb-chart.tsx
|
|
7
7
|
import { coxcombChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var CoxcombChart = createClientChart(coxcombChart);
|
|
|
10
10
|
export {
|
|
11
11
|
CoxcombChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-NHUVAE4Z.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/waterfall-chart.tsx
|
|
7
7
|
import { waterfallChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var WaterfallChart = createClientChart(waterfallChart);
|
|
|
10
10
|
export {
|
|
11
11
|
WaterfallChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-NW2SQ6QW.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/dashboard-markup.tsx
|
|
2
|
+
import { dashboardView } from "@silverpoint/core";
|
|
3
|
+
import { Children, cloneElement, isValidElement } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function DashboardCell({ children }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
7
|
+
}
|
|
8
|
+
var asStyle = (vars) => vars;
|
|
9
|
+
function DashboardMarkup({ children, wrapGrid, ...props }) {
|
|
10
|
+
const given = Children.toArray(children).map((child) => {
|
|
11
|
+
const marked = isValidElement(child) && child.type === DashboardCell;
|
|
12
|
+
const content = marked ? child.props.children : child;
|
|
13
|
+
const chart = isValidElement(content) ? content : void 0;
|
|
14
|
+
return { cell: marked ? child.props.cell : void 0, id: chart?.props.id, content, chart };
|
|
15
|
+
});
|
|
16
|
+
const view = dashboardView(props, given.map(({ cell, id }) => ({ cell, id })));
|
|
17
|
+
const Heading = view.heading ? `h${view.heading.level}` : void 0;
|
|
18
|
+
const grid = /* @__PURE__ */ jsx("div", { className: "sp-dashboard-grid", part: "dashboard-grid", children: view.cells.map((cell) => {
|
|
19
|
+
const { chart, content } = given[cell.child];
|
|
20
|
+
return /* @__PURE__ */ jsx("article", { className: "sp-dashboard-cell", part: "dashboard-cell", "aria-labelledby": cell.labelledby, style: asStyle(cell.style), children: chart ? cloneElement(chart, { dashboardCell: cell.context }) : content }, cell.context.chartId);
|
|
21
|
+
}) });
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"section",
|
|
24
|
+
{
|
|
25
|
+
className: view.section.className,
|
|
26
|
+
part: "dashboard",
|
|
27
|
+
"data-substrate": view.section.substrate,
|
|
28
|
+
"aria-labelledby": view.section.labelledby,
|
|
29
|
+
"aria-describedby": view.section.describedby,
|
|
30
|
+
"aria-label": view.section.label,
|
|
31
|
+
style: asStyle(view.section.style),
|
|
32
|
+
children: [
|
|
33
|
+
Heading && view.heading && /* @__PURE__ */ jsx(Heading, { className: "sp-dashboard-title", part: "dashboard-title", id: view.heading.id, children: view.heading.text }),
|
|
34
|
+
view.description && /* @__PURE__ */ jsx("p", { className: "sp-dashboard-description", part: "dashboard-description", id: view.description.id, children: view.description.text }),
|
|
35
|
+
wrapGrid ? wrapGrid(grid) : grid
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
DashboardCell,
|
|
43
|
+
DashboardMarkup
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=chunk-OD6N2ATZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dashboard-markup.tsx"],"sourcesContent":["import { dashboardView, type DashboardCellContext, type DashboardProps } from '@silverpoint/core';\nimport { Children, cloneElement, isValidElement, type CSSProperties, type ReactElement, type ReactNode } from 'react';\n\nexport interface DashboardCellProps {\n /** The layout cell this child fills. Omitted: next in source order, span 1 (API Spec §7.1). */\n readonly cell?: string;\n /** The chart. A single element receives the cell's id, size and configuration. */\n readonly children?: ReactNode;\n}\n\n/**\n * Marks a child of `Dashboard` with its layout cell. Rendered on its own it is its children; inside\n * a dashboard, the dashboard reads its `cell` and emits it as an `article` (REQ-200).\n */\nexport function DashboardCell({ children }: DashboardCellProps) {\n return <>{children}</>;\n}\n\n/** The internal prop through which a cell hands its chart id, box and config (TD §3.3). */\nexport interface CellChartProps {\n readonly dashboardCell?: DashboardCellContext;\n}\n\nconst asStyle = (vars: Readonly<Record<string, string>>) => vars as CSSProperties;\n\n/**\n * The dashboard's DOM (API Spec §10), shared by the client and server entries. It computes\n * nothing: the core's `dashboardView` gives every attribute, and each cell's chart gets its\n * context as a prop, which crosses a Server Components boundary as plain data (Art. 2).\n */\nexport function DashboardMarkup({ children, wrapGrid, ...props }: DashboardProps & { readonly children?: ReactNode; readonly wrapGrid?: (grid: ReactNode) => ReactNode }) {\n const given = Children.toArray(children).map((child) => {\n const marked = isValidElement<DashboardCellProps>(child) && child.type === DashboardCell;\n const content = marked ? child.props.children : child;\n const chart = isValidElement<{ id?: string }>(content) ? content : undefined;\n return { cell: marked ? child.props.cell : undefined, id: chart?.props.id, content, chart };\n });\n const view = dashboardView(props, given.map(({ cell, id }) => ({ cell, id })));\n const Heading = view.heading ? (`h${view.heading.level}` as const) : undefined;\n const grid = (\n <div className=\"sp-dashboard-grid\" part=\"dashboard-grid\">\n {view.cells.map((cell) => {\n const { chart, content } = given[cell.child]!;\n return (\n <article key={cell.context.chartId} className=\"sp-dashboard-cell\" part=\"dashboard-cell\" aria-labelledby={cell.labelledby} style={asStyle(cell.style)}>\n {chart ? cloneElement(chart as ReactElement<CellChartProps>, { dashboardCell: cell.context }) : content}\n </article>\n );\n })}\n </div>\n );\n return (\n <section\n className={view.section.className}\n part=\"dashboard\"\n data-substrate={view.section.substrate}\n aria-labelledby={view.section.labelledby}\n aria-describedby={view.section.describedby}\n aria-label={view.section.label}\n style={asStyle(view.section.style)}\n >\n {Heading && view.heading && (\n <Heading className=\"sp-dashboard-title\" part=\"dashboard-title\" id={view.heading.id}>\n {view.heading.text}\n </Heading>\n )}\n {view.description && (\n <p className=\"sp-dashboard-description\" part=\"dashboard-description\" id={view.description.id}>\n {view.description.text}\n </p>\n )}\n {wrapGrid ? wrapGrid(grid) : grid}\n </section>\n );\n}\n"],"mappings":";AAAA,SAAS,qBAAqE;AAC9E,SAAS,UAAU,cAAc,sBAA6E;AAcrG,wBAqCL,YArCK;AADF,SAAS,cAAc,EAAE,SAAS,GAAuB;AAC9D,SAAO,gCAAG,UAAS;AACrB;AAOA,IAAM,UAAU,CAAC,SAA2C;AAOrD,SAAS,gBAAgB,EAAE,UAAU,UAAU,GAAG,MAAM,GAA2G;AACxK,QAAM,QAAQ,SAAS,QAAQ,QAAQ,EAAE,IAAI,CAAC,UAAU;AACtD,UAAM,SAAS,eAAmC,KAAK,KAAK,MAAM,SAAS;AAC3E,UAAM,UAAU,SAAS,MAAM,MAAM,WAAW;AAChD,UAAM,QAAQ,eAAgC,OAAO,IAAI,UAAU;AACnE,WAAO,EAAE,MAAM,SAAS,MAAM,MAAM,OAAO,QAAW,IAAI,OAAO,MAAM,IAAI,SAAS,MAAM;AAAA,EAC5F,CAAC;AACD,QAAM,OAAO,cAAc,OAAO,MAAM,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,EAA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@@ var RadarChart = createClientChart(radarChart);
|
|
|
10
10
|
export {
|
|
11
11
|
RadarChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-OFDVE64G.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/sankey-chart.tsx
|
|
7
7
|
import { sankeyChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var SankeyChart = createClientChart(sankeyChart);
|
|
|
10
10
|
export {
|
|
11
11
|
SankeyChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-P53KSCPE.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/chord-ring.tsx
|
|
7
7
|
import { chordRing } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var ChordRing = createClientChart(chordRing);
|
|
|
10
10
|
export {
|
|
11
11
|
ChordRing
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-PWFDYIXV.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/volvelle-chart.tsx
|
|
7
7
|
import { volvelleChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var VolvelleChart = createClientChart(volvelleChart);
|
|
|
10
10
|
export {
|
|
11
11
|
VolvelleChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-TAQOBBF7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/scatter-chart.tsx
|
|
7
7
|
import { scatterChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var ScatterChart = createClientChart(scatterChart);
|
|
|
10
10
|
export {
|
|
11
11
|
ScatterChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-TKQ2PQDW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/wind-rose.tsx
|
|
7
7
|
import { windRose } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var WindRose = createClientChart(windRose);
|
|
|
10
10
|
export {
|
|
11
11
|
WindRose
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-UXVYCPFL.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/kpi-card.tsx
|
|
7
7
|
import { kpiCard } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var KpiCard = createClientChart(kpiCard);
|
|
|
10
10
|
export {
|
|
11
11
|
KpiCard
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-VISNFHPM.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/donut-chart.tsx
|
|
7
7
|
import { donutChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var DonutChart = createClientChart(donutChart);
|
|
|
10
10
|
export {
|
|
11
11
|
DonutChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-WHZ4ALRI.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/range-band-chart.tsx
|
|
7
7
|
import { rangeBandChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var RangeBandChart = createClientChart(rangeBandChart);
|
|
|
10
10
|
export {
|
|
11
11
|
RangeBandChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-WICFKWEZ.js.map
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import {
|
|
3
|
+
DashboardLinkContext
|
|
4
|
+
} from "./chunk-4GQ5X2WK.js";
|
|
2
5
|
|
|
3
6
|
// src/create-chart.tsx
|
|
4
7
|
import {
|
|
8
|
+
inCell,
|
|
5
9
|
instanceId,
|
|
10
|
+
linkFrom,
|
|
6
11
|
reduceInteraction
|
|
7
12
|
} from "@silverpoint/core";
|
|
8
13
|
import { renderChart, toSVGString } from "@silverpoint/grounds";
|
|
9
14
|
import {
|
|
10
15
|
forwardRef,
|
|
11
|
-
useContext,
|
|
16
|
+
useContext as useContext2,
|
|
12
17
|
useEffect as useEffect2,
|
|
13
18
|
useId,
|
|
14
19
|
useImperativeHandle,
|
|
@@ -28,6 +33,7 @@ function Path({ path }) {
|
|
|
28
33
|
"data-role": path.role,
|
|
29
34
|
"data-paint": path.paint,
|
|
30
35
|
"data-dash": path.dash ?? void 0,
|
|
36
|
+
"data-weight": path.weight ?? void 0,
|
|
31
37
|
fill: path.fill ?? void 0
|
|
32
38
|
}
|
|
33
39
|
);
|
|
@@ -139,7 +145,8 @@ function useTypefaceCheck(chart) {
|
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
// src/overlay.tsx
|
|
142
|
-
import { readout } from "@silverpoint/core";
|
|
148
|
+
import { linkedMarks, readout } from "@silverpoint/core";
|
|
149
|
+
import { useContext } from "react";
|
|
143
150
|
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
144
151
|
function Overlay({
|
|
145
152
|
rendered,
|
|
@@ -147,7 +154,9 @@ function Overlay({
|
|
|
147
154
|
tooltip
|
|
148
155
|
}) {
|
|
149
156
|
const current = active ? readout(rendered, active) : null;
|
|
157
|
+
const linked = linkedMarks(rendered, useContext(DashboardLinkContext)?.state);
|
|
150
158
|
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
159
|
+
linked.length > 0 && /* @__PURE__ */ jsx3("svg", { className: "sp-marker", part: "linked", viewBox: rendered.view.svg.viewBox, "aria-hidden": "true", focusable: "false", children: linked.map((d, index) => /* @__PURE__ */ jsx3("path", { d }, index)) }),
|
|
151
160
|
current && active && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
152
161
|
/* @__PURE__ */ jsx3("svg", { className: "sp-marker", viewBox: rendered.view.svg.viewBox, "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx3("path", { d: current.marker.d }) }),
|
|
153
162
|
/* @__PURE__ */ jsx3("div", { className: "sp-readout", style: { left: current.left, top: current.top }, "aria-hidden": "true", children: tooltip ? tooltip(active, current) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
@@ -164,29 +173,30 @@ import { jsx as jsx4 } from "react/jsx-runtime";
|
|
|
164
173
|
function createClientChart(recipe) {
|
|
165
174
|
const Chart = forwardRef(function Chart2(allProps, ref) {
|
|
166
175
|
const { onActiveChange, onSelect, tooltip } = allProps;
|
|
167
|
-
const provider =
|
|
176
|
+
const provider = useContext2(SilverpointContext);
|
|
177
|
+
const link = useContext2(DashboardLinkContext);
|
|
168
178
|
const generated = useId();
|
|
169
179
|
const rootRef = useRef(null);
|
|
170
180
|
const forcedPrecision = useForcedPrecision();
|
|
171
181
|
useTypefaceCheck(recipe.name);
|
|
172
182
|
const measured = useMeasuredWidth(rootRef, allProps.width === void 0);
|
|
173
|
-
const rendered = useMemo(
|
|
174
|
-
|
|
183
|
+
const rendered = useMemo(() => {
|
|
184
|
+
const { dashboardCell, ...own } = allProps;
|
|
185
|
+
const fitted = inCell(own, dashboardCell, recipe);
|
|
186
|
+
return renderChart(recipe, fitted.props, {
|
|
175
187
|
id: instanceId(recipe.name, generated),
|
|
176
|
-
width: measured,
|
|
188
|
+
width: measured ?? fitted.width,
|
|
177
189
|
provider,
|
|
178
190
|
forcedPrecision
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
// state changes, so moving the pointer never re-inks the chart.
|
|
182
|
-
[allProps, generated, measured, provider, forcedPrecision]
|
|
183
|
-
);
|
|
191
|
+
});
|
|
192
|
+
}, [allProps, generated, measured, provider, forcedPrecision]);
|
|
184
193
|
const [active, setActive] = useState2(null);
|
|
185
194
|
const dispatch = (event) => {
|
|
186
195
|
const result = reduceInteraction(rendered.geometry, active, event);
|
|
187
196
|
if (result.changed) {
|
|
188
197
|
setActive(result.active);
|
|
189
198
|
onActiveChange?.(result.active);
|
|
199
|
+
link?.set(linkFrom(link.key, rendered.id, result.active));
|
|
190
200
|
}
|
|
191
201
|
if (result.selected) onSelect?.(result.selected);
|
|
192
202
|
return result.handled;
|
|
@@ -254,4 +264,4 @@ export {
|
|
|
254
264
|
SilverpointContext,
|
|
255
265
|
createClientChart
|
|
256
266
|
};
|
|
257
|
-
//# sourceMappingURL=chunk-
|
|
267
|
+
//# sourceMappingURL=chunk-WNX4XCL6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/create-chart.tsx","../src/chart-svg.tsx","../src/chart-frame.tsx","../src/context.ts","../src/environment.ts","../src/overlay.tsx"],"sourcesContent":["import {\n inCell,\n instanceId,\n linkFrom,\n reduceInteraction,\n type ActiveItem,\n type ChartHandle,\n type ChartRecipe,\n type CommonChartProps,\n type InteractionEvent,\n type PointerKind,\n} from '@silverpoint/core';\nimport { renderChart, toSVGString } from '@silverpoint/grounds';\nimport {\n forwardRef,\n useContext,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ForwardRefExoticComponent,\n type KeyboardEvent,\n type PointerEvent,\n type RefAttributes,\n} from 'react';\nimport { ChartFrame } from './chart-frame';\nimport type { CellChartProps } from './dashboard-markup';\nimport { DashboardLinkContext } from './link-context';\nimport { SilverpointContext } from './context';\nimport { useForcedPrecision, useMeasuredWidth, useTypefaceCheck } from './environment';\nimport { Overlay, type TooltipRenderer } from './overlay';\n\nexport type { ChartHandle };\n\n/** Interaction props of the client components (API Spec §9). */\nexport interface InteractionProps {\n /** The active item changed, or `null` when it cleared (REQ-141, REQ-143). */\n onActiveChange?: (item: ActiveItem | null) => void;\n /** An item was chosen by click, Enter or Space. */\n onSelect?: (item: ActiveItem) => void;\n /** Replaces the built-in readout (REQ-142). */\n tooltip?: TooltipRenderer;\n}\n\nexport type ClientChart<P> = ForwardRefExoticComponent<P & InteractionProps & RefAttributes<ChartHandle>>;\n\n/**\n * The client component of a recipe: it measures, renders through the core pipeline and forwards\n * interaction events to the core's reducer. Every client chart is this function applied to its\n * recipe, so the charts differ only in the recipe (Art. 2).\n */\nexport function createClientChart<P extends CommonChartProps>(recipe: ChartRecipe<P>): ClientChart<P> {\n const Chart = forwardRef<ChartHandle, P & InteractionProps & CellChartProps>(function Chart(allProps, ref) {\n const { onActiveChange, onSelect, tooltip } = allProps;\n const provider = useContext(SilverpointContext);\n const link = useContext(DashboardLinkContext);\n const generated = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const forcedPrecision = useForcedPrecision();\n useTypefaceCheck(recipe.name);\n const measured = useMeasuredWidth(rootRef, allProps.width === undefined);\n\n const rendered = useMemo(() => {\n // Inside a dashboard cell: its id, height and config, and its nominal width until measured\n // (REQ-206, REQ-207, REQ-209, REQ-212); the chart's own props win.\n const { dashboardCell, ...own } = allProps;\n const fitted = inCell(own as unknown as P, dashboardCell, recipe);\n return renderChart(recipe, fitted.props, {\n id: instanceId(recipe.name, generated),\n width: measured ?? fitted.width,\n provider,\n forcedPrecision,\n });\n // Keyed on the props object React hands in, which is stable across this component's own\n // state changes, so moving the pointer never re-inks the chart.\n }, [allProps, generated, measured, provider, forcedPrecision]);\n\n const [active, setActive] = useState<ActiveItem | null>(null);\n const dispatch = (event: InteractionEvent): boolean => {\n const result = reduceInteraction(rendered.geometry, active, event);\n if (result.changed) {\n setActive(result.active);\n onActiveChange?.(result.active);\n // In a linked dashboard this chart becomes the source, or clears the link (REQ-216, REQ-218).\n link?.set(linkFrom(link.key, rendered.id, result.active));\n }\n if (result.selected) onSelect?.(result.selected);\n return result.handled;\n };\n // WCAG 1.4.13: a readout shown by the pointer is dismissible with Escape wherever focus is.\n const latest = useRef(dispatch);\n latest.current = dispatch;\n const showing = active !== null;\n useEffect(() => {\n if (!showing) return undefined;\n const onKey = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape' && !rootRef.current?.contains(event.target as Node)) latest.current({ type: 'key', key: 'Escape' });\n };\n document.addEventListener('keydown', onKey);\n return () => document.removeEventListener('keydown', onKey);\n }, [showing]);\n const pointer = (type: 'pointer' | 'click') => (event: PointerEvent<HTMLDivElement>) => {\n const svg = rootRef.current?.querySelector('svg.sp-chart');\n if (!svg) return;\n const box = svg.getBoundingClientRect();\n dispatch({\n type,\n client: { x: event.clientX, y: event.clientY },\n box: { left: box.left, top: box.top, width: box.width, height: box.height },\n kind: (event.pointerType || 'mouse') as PointerKind,\n });\n };\n const rootProps = {\n tabIndex: 0,\n role: 'group',\n 'aria-label': rendered.name,\n onPointerMove: pointer('pointer'),\n onPointerDown: pointer('pointer'),\n onClick: pointer('click'),\n onPointerLeave: () => dispatch({ type: 'leave' }),\n onFocus: () => dispatch({ type: 'focus' }),\n onBlur: () => dispatch({ type: 'blur' }),\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => {\n if (dispatch({ type: 'key', key: event.key })) event.preventDefault();\n },\n };\n\n useImperativeHandle(\n ref,\n () => ({\n getGeometry: () => rendered.geometry,\n toSVGString: () => toSVGString(rendered),\n }),\n [rendered],\n );\n\n return (\n <ChartFrame\n rendered={rendered}\n className={allProps.className}\n rootRef={rootRef}\n rootProps={rootProps}\n overlay={<Overlay rendered={rendered} active={active} tooltip={tooltip} />}\n />\n );\n });\n Chart.displayName = recipe.name;\n return Chart as ClientChart<P>;\n}\n","import type { PathView, SvgView } from '@silverpoint/core';\n\nfunction Path({ path }: { readonly path: PathView }) {\n return (\n <path\n d={path.d}\n part={path.part}\n data-role={path.role}\n data-paint={path.paint}\n data-dash={path.dash ?? undefined}\n data-weight={path.weight ?? undefined}\n fill={path.fill ?? undefined}\n />\n );\n}\n\n/** Writes the core's SVG view one field to one attribute; computes nothing (Art. 2). */\nexport function ChartSvg({ view }: { readonly view: SvgView }) {\n const { svg } = view;\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox={svg.viewBox}\n width={svg.width}\n height={svg.height}\n className={svg.class}\n data-substrate={svg.substrate}\n data-mode={svg.mode}\n role={svg.role}\n aria-labelledby={svg.labelledby}\n >\n <title id={view.title.id}>{view.title.text}</title>\n <desc id={view.desc.id}>{view.desc.text}</desc>\n {view.patterns.length > 0 && (\n <defs>\n {view.patterns.map((pattern) => (\n <pattern\n key={pattern.id}\n id={pattern.id}\n width={pattern.width}\n height={pattern.height}\n patternUnits=\"userSpaceOnUse\"\n patternTransform={pattern.transform}\n >\n {pattern.paths.map((path, index) => (\n <Path key={index} path={path} />\n ))}\n </pattern>\n ))}\n </defs>\n )}\n {view.paths.map((path, index) => (\n <Path key={index} path={path} />\n ))}\n {view.texts.map((text, index) => (\n <text key={index} x={text.x} y={text.y} part={text.part} data-kind={text.kind} textAnchor={text.anchor}>\n {text.text}\n </text>\n ))}\n </svg>\n );\n}\n","import type { DataTable } from '@silverpoint/core';\nimport type { RenderedChart } from '@silverpoint/grounds';\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\nimport { ChartSvg } from './chart-svg';\n\nfunction Table({ table, id, visibility }: { readonly table: DataTable; readonly id: string; readonly visibility: string }) {\n return (\n <div className=\"sp-table-box\" data-visibility={visibility}>\n <table className=\"sp-table\" id={id} data-visibility={visibility}>\n <caption>{table.caption}</caption>\n <thead>\n <tr>\n {table.columns.map((column, index) => (\n <th key={index} scope=\"col\">\n {column}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {table.rows.map((row, index) => (\n <tr key={index}>\n {row.map((cell, column) =>\n column === 0 ? (\n <th key={column} scope=\"row\">\n {cell}\n </th>\n ) : (\n <td key={column}>{cell}</td>\n ),\n )}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport interface ChartFrameProps {\n readonly rendered: RenderedChart;\n readonly className?: string;\n /** Interaction handlers and focus attributes, supplied by the client component only. */\n readonly rootProps?: HTMLAttributes<HTMLDivElement>;\n readonly rootRef?: Ref<HTMLDivElement>;\n /** Readout and marker, drawn over the chart by the client component. */\n readonly overlay?: ReactNode;\n}\n\n/** The chart's DOM: root, SVG, overlay and tabular alternative (API Spec §10). */\nexport function ChartFrame({ rendered, className, rootProps, rootRef, overlay }: ChartFrameProps) {\n const classes = ['sp-root', `sp-ground-${rendered.ground}`, className].filter(Boolean).join(' ');\n return (\n <div\n className={classes}\n data-substrate={rendered.substrate}\n data-chrome={rendered.chrome}\n data-status={rendered.status}\n ref={rootRef}\n {...rootProps}\n >\n <ChartSvg view={rendered.view} />\n {overlay}\n {rendered.dataTable !== 'none' && (\n <Table table={rendered.table} id={rendered.ids.table} visibility={rendered.dataTable} />\n )}\n </div>\n );\n}\n","import type { ProviderConfig } from '@silverpoint/core';\nimport { createContext } from 'react';\n\n/** Application-wide configuration (API Spec §8.1); a chart prop always wins over it. */\nexport const SilverpointContext = createContext<ProviderConfig>({});\n","import { checkTypeface, FORCED_PRECISION_QUERY } from '@silverpoint/core';\nimport { useEffect, useState, type RefObject } from 'react';\n\n/**\n * Whether the environment forces `precision` (REQ-123). Read after hydration, so the server\n * render and the first client render agree (REQ-103).\n */\nexport function useForcedPrecision(): boolean {\n const [forced, setForced] = useState(false);\n useEffect(() => {\n if (typeof matchMedia !== 'function') return;\n const query = matchMedia(FORCED_PRECISION_QUERY);\n const update = () => setForced(query.matches);\n update();\n query.addEventListener?.('change', update);\n return () => query.removeEventListener?.('change', update);\n }, []);\n return forced;\n}\n\n/** Width of the container, measured with ResizeObserver; `undefined` until measured (REQ-009). */\nexport function useMeasuredWidth(ref: RefObject<HTMLElement | null>, enabled: boolean): number | undefined {\n const [width, setWidth] = useState<number | undefined>(undefined);\n useEffect(() => {\n const element = ref.current;\n if (!enabled || !element || typeof ResizeObserver !== 'function') return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setWidth(entry.contentRect.width);\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref, enabled]);\n return width;\n}\n\n/** Reports SP013 when the display typeface fails to load; never blocks the render (REQ-032). */\nexport function useTypefaceCheck(chart: string): void {\n useEffect(() => {\n if (typeof document !== 'undefined' && document.fonts) void checkTypeface(document.fonts, chart);\n }, [chart]);\n}\n","import { linkedMarks, readout, type ActiveItem, type Readout } from '@silverpoint/core';\nimport type { RenderedChart } from '@silverpoint/grounds';\nimport { useContext, type ReactNode } from 'react';\nimport { DashboardLinkContext } from './link-context';\n\n/** A consumer-supplied readout renderer (REQ-142). */\nexport type TooltipRenderer = (active: ActiveItem, readout: Readout) => ReactNode;\n\n/**\n * Marker, readout and live region of the active item (REQ-141, REQ-122). Every number comes from\n * the core's `readout`; this component only places it.\n */\nexport function Overlay({\n rendered,\n active,\n tooltip,\n}: {\n readonly rendered: RenderedChart;\n readonly active: ActiveItem | null;\n readonly tooltip?: TooltipRenderer;\n}) {\n const current = active ? readout(rendered, active) : null;\n // Another chart's linked item, marked here and hidden from assistive technology (REQ-216, REQ-218).\n const linked = linkedMarks(rendered, useContext(DashboardLinkContext)?.state);\n return (\n <>\n {linked.length > 0 && (\n <svg className=\"sp-marker\" part=\"linked\" viewBox={rendered.view.svg.viewBox} aria-hidden=\"true\" focusable=\"false\">\n {linked.map((d, index) => (\n <path key={index} d={d} />\n ))}\n </svg>\n )}\n {current && active && (\n <>\n <svg className=\"sp-marker\" viewBox={rendered.view.svg.viewBox} aria-hidden=\"true\" focusable=\"false\">\n <path d={current.marker.d} />\n </svg>\n <div className=\"sp-readout\" style={{ left: current.left, top: current.top }} aria-hidden=\"true\">\n {tooltip ? (\n tooltip(active, current)\n ) : (\n <>\n <span className=\"sp-readout-heading\">{current.heading}</span>\n {current.text}\n </>\n )}\n </div>\n </>\n )}\n <div className=\"sp-live\" aria-live=\"polite\">\n {current ? current.announcement : ''}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,aAAa,mBAAmB;AACzC;AAAA,EACE;AAAA,EACA,cAAAA;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,OAKK;;;ACtBH,cAgBA,YAhBA;AAFJ,SAAS,KAAK,EAAE,KAAK,GAAgC;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,GAAG,KAAK;AAAA,MACR,MAAM,KAAK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1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/bullet-chart.tsx
|
|
7
7
|
import { bulletChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var BulletChart = createClientChart(bulletChart);
|
|
|
10
10
|
export {
|
|
11
11
|
BulletChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-WOKDS6AK.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/activity-grid.tsx
|
|
7
7
|
import { activityGrid } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var ActivityGrid = createClientChart(activityGrid);
|
|
|
10
10
|
export {
|
|
11
11
|
ActivityGrid
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-X2ACXB2U.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/candlestick-chart.tsx
|
|
7
7
|
import { candlestickChart } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var CandlestickChart = createClientChart(candlestickChart);
|
|
|
10
10
|
export {
|
|
11
11
|
CandlestickChart
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-XWSCKTPG.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
createClientChart
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNX4XCL6.js";
|
|
5
5
|
|
|
6
6
|
// src/radial-rings.tsx
|
|
7
7
|
import { radialRings } from "@silverpoint/core";
|
|
@@ -10,4 +10,4 @@ var RadialRings = createClientChart(radialRings);
|
|
|
10
10
|
export {
|
|
11
11
|
RadialRings
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-ZKLVP4JE.js.map
|
package/dist/composed-chart.js
CHANGED
package/dist/coxcomb-chart.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommonChartProps } from '@silverpoint/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props of a server chart: pure SVG, no client JavaScript (REQ-104); interaction props do not
|
|
5
|
+
* exist here. Nothing can be measured on the server and a server component has no mount position
|
|
6
|
+
* to derive a unique id from (TD §6), so a chart standing alone passes `id`, `width` and `height`;
|
|
7
|
+
* inside a `Dashboard` the cell supplies them (REQ-206, REQ-209).
|
|
8
|
+
*/
|
|
9
|
+
type ServerChartProps<P extends CommonChartProps> = Omit<P, 'id' | 'width' | 'height'> & {
|
|
10
|
+
readonly id?: string;
|
|
11
|
+
readonly width?: number;
|
|
12
|
+
readonly height?: number;
|
|
13
|
+
readonly onActiveChange?: never;
|
|
14
|
+
readonly onSelect?: never;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { ServerChartProps as S };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { DashboardLink as DashboardLink$1 } from '@silverpoint/core';
|
|
4
|
+
|
|
5
|
+
interface DashboardLinkProps {
|
|
6
|
+
readonly link: DashboardLink$1;
|
|
7
|
+
/** The linked value changed; `null` when the source cleared (API Spec §9, REQ-218). */
|
|
8
|
+
readonly onLinkChange?: (link: {
|
|
9
|
+
key: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
} | null) => void;
|
|
12
|
+
readonly children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The client boundary of a linked dashboard (REQ-104, REQ-219): the one linked value its charts
|
|
16
|
+
* share. The dashboard renders it only when `link` is given; it adds no element of its own.
|
|
17
|
+
*/
|
|
18
|
+
declare function DashboardLink({ link, onLinkChange, children }: DashboardLinkProps): react.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { DashboardLink, type DashboardLinkProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
DashboardLinkContext
|
|
4
|
+
} from "./chunk-4GQ5X2WK.js";
|
|
5
|
+
|
|
6
|
+
// src/dashboard-link.tsx
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function DashboardLink({ link, onLinkChange, children }) {
|
|
10
|
+
const [state, setState] = useState(null);
|
|
11
|
+
const value = useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
key: link.key,
|
|
14
|
+
state,
|
|
15
|
+
set(next) {
|
|
16
|
+
setState(next);
|
|
17
|
+
onLinkChange?.(next && { key: next.key, value: next.value });
|
|
18
|
+
}
|
|
19
|
+
}),
|
|
20
|
+
[link.key, state, onLinkChange]
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ jsx(DashboardLinkContext.Provider, { value, children });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
DashboardLink
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=dashboard-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dashboard-link.tsx"],"sourcesContent":["import type { DashboardLink as Link, LinkState } from '@silverpoint/core';\nimport { useMemo, useState, type ReactNode } from 'react';\nimport { DashboardLinkContext } from './link-context';\n\nexport interface DashboardLinkProps {\n readonly link: Link;\n /** The linked value changed; `null` when the source cleared (API Spec §9, REQ-218). */\n readonly onLinkChange?: (link: { key: string; value: unknown } | null) => void;\n readonly children?: ReactNode;\n}\n\n/**\n * The client boundary of a linked dashboard (REQ-104, REQ-219): the one linked value its charts\n * share. The dashboard renders it only when `link` is given; it adds no element of its own.\n */\nexport function DashboardLink({ link, onLinkChange, children }: DashboardLinkProps) {\n const [state, setState] = useState<LinkState | null>(null);\n const value = useMemo(\n () => ({\n key: link.key,\n state,\n set(next: LinkState | null) {\n setState(next);\n onLinkChange?.(next && { key: next.key, value: next.value });\n },\n }),\n [link.key, state, onLinkChange],\n );\n return <DashboardLinkContext.Provider value={value}>{children}</DashboardLinkContext.Provider>;\n}\n"],"mappings":";;;;;;AACA,SAAS,SAAS,gBAAgC;AA2BzC;AAbF,SAAS,cAAc,EAAE,MAAM,cAAc,SAAS,GAAuB;AAClF,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2B,IAAI;AACzD,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,KAAK,KAAK;AAAA,MACV;AAAA,MACA,IAAI,MAAwB;AAC1B,iBAAS,IAAI;AACb,uBAAe,QAAQ,EAAE,KAAK,KAAK,KAAK,OAAO,KAAK,MAAM,CAAC;AAAA,MAC7D;AAAA,IACF;AAAA,IACA,CAAC,KAAK,KAAK,OAAO,YAAY;AAAA,EAChC;AACA,SAAO,oBAAC,qBAAqB,UAArB,EAA8B,OAAe,UAAS;AAChE;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { DashboardCellContext } from '@silverpoint/core';
|
|
4
|
+
|
|
5
|
+
interface DashboardCellProps {
|
|
6
|
+
/** The layout cell this child fills. Omitted: next in source order, span 1 (API Spec §7.1). */
|
|
7
|
+
readonly cell?: string;
|
|
8
|
+
/** The chart. A single element receives the cell's id, size and configuration. */
|
|
9
|
+
readonly children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Marks a child of `Dashboard` with its layout cell. Rendered on its own it is its children; inside
|
|
13
|
+
* a dashboard, the dashboard reads its `cell` and emits it as an `article` (REQ-200).
|
|
14
|
+
*/
|
|
15
|
+
declare function DashboardCell({ children }: DashboardCellProps): react.JSX.Element;
|
|
16
|
+
/** The internal prop through which a cell hands its chart id, box and config (TD §3.3). */
|
|
17
|
+
interface CellChartProps {
|
|
18
|
+
readonly dashboardCell?: DashboardCellContext;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { type CellChartProps as C, DashboardCell as D, type DashboardCellProps as a };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { DashboardProps } from '@silverpoint/core';
|
|
4
|
+
export { DashboardCellLayout, DashboardLayout, DashboardLink } from '@silverpoint/core';
|
|
5
|
+
export { D as DashboardCell, a as DashboardCellProps } from './dashboard-markup-_EoDs-s-.js';
|
|
6
|
+
|
|
7
|
+
type ClientDashboardProps = DashboardProps & {
|
|
8
|
+
readonly children?: ReactNode;
|
|
9
|
+
/** The linked value changed; `null` when the source cleared (API Spec §9, REQ-216). */
|
|
10
|
+
readonly onLinkChange?: (link: {
|
|
11
|
+
key: string;
|
|
12
|
+
value: unknown;
|
|
13
|
+
} | null) => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* `Dashboard` (REQ-200): a declarative grid of cards, laid out in the core from a data-only
|
|
17
|
+
* layout (API Spec §7.1). No `"use client"` of its own (REQ-104): it renders in a Server Component
|
|
18
|
+
* as well as on the client, and its charts are the client components the consumer passes in.
|
|
19
|
+
*/
|
|
20
|
+
declare function Dashboard({ onLinkChange, ...props }: ClientDashboardProps): react.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { type ClientDashboardProps, Dashboard };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DashboardCell,
|
|
3
|
+
DashboardMarkup
|
|
4
|
+
} from "./chunk-OD6N2ATZ.js";
|
|
5
|
+
|
|
6
|
+
// src/dashboard.tsx
|
|
7
|
+
import { DashboardLink } from "@silverpoint/react/dashboard-link";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function Dashboard({ onLinkChange, ...props }) {
|
|
10
|
+
const { link } = props;
|
|
11
|
+
const wrapGrid = link ? (grid) => /* @__PURE__ */ jsx(DashboardLink, { link, onLinkChange, children: grid }) : void 0;
|
|
12
|
+
return /* @__PURE__ */ jsx(DashboardMarkup, { ...props, wrapGrid });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Dashboard,
|
|
16
|
+
DashboardCell
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dashboard.tsx"],"sourcesContent":["import type { DashboardProps } from '@silverpoint/core';\n// A package self-reference, kept external: the link keeps its own \"use client\" boundary (REQ-104).\nimport { DashboardLink } from '@silverpoint/react/dashboard-link';\nimport type { ReactNode } from 'react';\nimport { DashboardCell, DashboardMarkup, type DashboardCellProps } from './dashboard-markup';\n\nexport { DashboardCell, type DashboardCellProps };\nexport type { DashboardLayout, DashboardCellLayout, DashboardLink } from '@silverpoint/core';\n\nexport type ClientDashboardProps = DashboardProps & {\n readonly children?: ReactNode;\n /** The linked value changed; `null` when the source cleared (API Spec §9, REQ-216). */\n readonly onLinkChange?: (link: { key: string; value: unknown } | null) => void;\n};\n\n/**\n * `Dashboard` (REQ-200): a declarative grid of cards, laid out in the core from a data-only\n * layout (API Spec §7.1). No `\"use client\"` of its own (REQ-104): it renders in a Server Component\n * as well as on the client, and its charts are the client components the consumer passes in.\n */\nexport function Dashboard({ onLinkChange, ...props }: ClientDashboardProps) {\n const { link } = props;\n // Only a linked dashboard crosses into client code: the boundary is the link, not the grid.\n const wrapGrid = link\n ? (grid: ReactNode) => (\n <DashboardLink link={link} onLinkChange={onLinkChange}>\n {grid}\n </DashboardLink>\n )\n : undefined;\n return <DashboardMarkup {...props} wrapGrid={wrapGrid} />;\n}\n"],"mappings":";;;;;;AAEA,SAAS,qBAAqB;AAuBtB;AALD,SAAS,UAAU,EAAE,cAAc,GAAG,MAAM,GAAyB;AAC1E,QAAM,EAAE,KAAK,IAAI;AAEjB,QAAM,WAAW,OACb,CAAC,SACC,oBAAC,iBAAc,MAAY,cACxB,gBACH,IAEF;AACJ,SAAO,oBAAC,mBAAiB,GAAG,OAAO,UAAoB;AACzD;","names":[]}
|
package/dist/donut-chart.js
CHANGED