@carto/ps-react-ui 4.6.2 → 4.7.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/dist/{download-config-C3I0jWIL.js → download-config-DNLkypdN.js} +8 -7
- package/dist/{download-config-C3I0jWIL.js.map → download-config-DNLkypdN.js.map} +1 -1
- package/dist/options-CthfUJDz.js +46 -0
- package/dist/options-CthfUJDz.js.map +1 -0
- package/dist/shared-resize-observer-98b1SK1e.js +17 -0
- package/dist/shared-resize-observer-98b1SK1e.js.map +1 -0
- package/dist/styles-BYTyKQFP.js +142 -0
- package/dist/{styles-Y8q7Jff3.js.map → styles-BYTyKQFP.js.map} +1 -1
- package/dist/types/widgets/actions/brush-toggle/brush-overlay.d.ts +24 -0
- package/dist/types/widgets/actions/brush-toggle/brush-toggle.d.ts +15 -10
- package/dist/types/widgets/actions/brush-toggle/hit-test.d.ts +19 -0
- package/dist/types/widgets/actions/brush-toggle/hit-test.test.d.ts +1 -0
- package/dist/types/widgets/actions/brush-toggle/style.d.ts +8 -0
- package/dist/types/widgets/actions/brush-toggle/types.d.ts +35 -1
- package/dist/types/widgets/utils/chart-config/index.d.ts +1 -1
- package/dist/types/widgets/utils/chart-config/option-builders.d.ts +27 -0
- package/dist/widgets/actions.js +985 -772
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +34 -30
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +9 -8
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js +79 -91
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/formula.js +43 -42
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +67 -63
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/markdown.js +15 -14
- package/dist/widgets/markdown.js.map +1 -1
- package/dist/widgets/pie.js +38 -37
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/scatterplot.js +31 -30
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/spread.js +47 -46
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/table.js +17 -16
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +35 -34
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/utils.js +2 -2
- package/package.json +3 -1
- package/src/widgets/actions/brush-toggle/brush-overlay.tsx +386 -0
- package/src/widgets/actions/brush-toggle/brush-toggle.tsx +88 -152
- package/src/widgets/actions/brush-toggle/hit-test.test.ts +65 -0
- package/src/widgets/actions/brush-toggle/hit-test.ts +45 -0
- package/src/widgets/actions/brush-toggle/style.ts +32 -0
- package/src/widgets/actions/brush-toggle/types.ts +36 -1
- package/src/widgets/bar/config.ts +5 -0
- package/src/widgets/echart/options.ts +1 -4
- package/src/widgets/histogram/config.ts +9 -4
- package/src/widgets/pie/config.ts +2 -0
- package/src/widgets/scatterplot/config.ts +2 -0
- package/src/widgets/timeseries/config.ts +2 -0
- package/src/widgets/utils/chart-config/index.ts +2 -0
- package/src/widgets/utils/chart-config/option-builders.test.ts +105 -1
- package/src/widgets/utils/chart-config/option-builders.ts +56 -0
- package/dist/options-D9wflre6.js +0 -49
- package/dist/options-D9wflre6.js.map +0 -1
- package/dist/styles-Y8q7Jff3.js +0 -118
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsx as g, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { c as _ } from "react/compiler-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "echarts";
|
|
5
5
|
import "../widget-store-Bw5zRUGg.js";
|
|
6
6
|
import "zustand/shallow";
|
|
7
|
-
import { g as k } from "../options-
|
|
7
|
+
import { g as k } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as C } from "../utils-BOhInag6.js";
|
|
9
|
-
import { g as $, h as A, n as u, d as M, e as
|
|
10
|
-
import { Box as f, Skeleton as
|
|
9
|
+
import { j as v, g as $, h as A, n as u, d as M, e as T, c as D } from "../styles-BYTyKQFP.js";
|
|
10
|
+
import { Box as f, Skeleton as y } from "@mui/material";
|
|
11
11
|
import "@mui/icons-material";
|
|
12
|
-
import { d as h, a as
|
|
12
|
+
import { d as h, a as d } from "../exports-Cr43OCul.js";
|
|
13
13
|
import "../lasso-tool-BYbxrJ-7.js";
|
|
14
14
|
import "../cjs-D4KH3azB.js";
|
|
15
15
|
import "@dnd-kit/core";
|
|
16
16
|
import "@dnd-kit/sortable";
|
|
17
17
|
import "@dnd-kit/utilities";
|
|
18
|
-
|
|
18
|
+
import "react-dom";
|
|
19
|
+
function I(e, n, t) {
|
|
19
20
|
if (!e?.length || e[0]?.length === 0) return [];
|
|
20
|
-
const
|
|
21
|
-
return [
|
|
22
|
-
length:
|
|
23
|
-
}, (c, s) => `Series ${s + 1}`)] : ["Bin", "Value"], ...
|
|
21
|
+
const o = e[0]?.length ?? 0, r = b(o, n, t), a = e.length;
|
|
22
|
+
return [a > 1 ? ["Bin", ...Array.from({
|
|
23
|
+
length: a
|
|
24
|
+
}, (c, s) => `Series ${s + 1}`)] : ["Bin", "Value"], ...r.map((c, s) => [c, ...e.map((i) => String(i[s] ?? 0))])];
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function re({
|
|
26
27
|
refUI: e,
|
|
27
28
|
ticks: n,
|
|
28
29
|
labelFormatter: t
|
|
@@ -31,40 +32,42 @@ function ie({
|
|
|
31
32
|
...h,
|
|
32
33
|
modifier: () => h.modifier(e)
|
|
33
34
|
}, {
|
|
34
|
-
...
|
|
35
|
-
modifier: async (
|
|
35
|
+
...d,
|
|
36
|
+
modifier: async (o) => d.modifier(I(o, n, t))
|
|
36
37
|
}];
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
39
|
+
function b(e, n, t) {
|
|
40
|
+
const o = (r) => String(t ? t(r) : r);
|
|
40
41
|
return Array.from({
|
|
41
42
|
length: e
|
|
42
|
-
}, (
|
|
43
|
-
const p = n[
|
|
44
|
-
return l !== void 0 && isFinite(l) ? `${
|
|
43
|
+
}, (r, a) => {
|
|
44
|
+
const p = n[a] ?? a, l = n[a + 1];
|
|
45
|
+
return l !== void 0 && isFinite(l) ? `${o(p)}-${o(l)}` : `${o(p)}+`;
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function ae(e) {
|
|
48
49
|
return {
|
|
49
50
|
type: "histogram",
|
|
50
|
-
option: C(k(e),
|
|
51
|
-
formatter: e.formatter
|
|
51
|
+
option: C(k(e), N(e)),
|
|
52
|
+
formatter: e.formatter,
|
|
53
|
+
labelFormatter: e.labelFormatter
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
function
|
|
56
|
+
function N({
|
|
55
57
|
data: e = [],
|
|
56
58
|
ticks: n,
|
|
57
59
|
theme: t,
|
|
58
|
-
formatter:
|
|
59
|
-
labelFormatter:
|
|
60
|
+
formatter: o,
|
|
61
|
+
labelFormatter: r
|
|
60
62
|
}) {
|
|
61
|
-
const
|
|
63
|
+
const a = (e?.length ?? 0) > 1, p = e[0]?.length ?? 0, l = b(p, n, r);
|
|
62
64
|
let c = 0, s = 1;
|
|
63
65
|
return {
|
|
64
|
-
legend:
|
|
65
|
-
hasLegend:
|
|
66
|
+
legend: T({
|
|
67
|
+
hasLegend: a,
|
|
68
|
+
labelFormatter: r
|
|
66
69
|
}),
|
|
67
|
-
grid: M(
|
|
70
|
+
grid: M(a, t),
|
|
68
71
|
xAxis: {
|
|
69
72
|
type: "category",
|
|
70
73
|
data: l,
|
|
@@ -74,8 +77,8 @@ function I({
|
|
|
74
77
|
axisLabel: {
|
|
75
78
|
fontSize: t.typography.overlineDelicate.fontSize,
|
|
76
79
|
fontFamily: t.typography.overlineDelicate.fontFamily,
|
|
77
|
-
showMinLabel:
|
|
78
|
-
showMaxLabel:
|
|
80
|
+
showMinLabel: void 0,
|
|
81
|
+
showMaxLabel: void 0,
|
|
79
82
|
hideOverlap: !0,
|
|
80
83
|
margin: 0,
|
|
81
84
|
padding: [parseInt(t.spacing(0.5)), parseInt(t.spacing(0.5)), 0, parseInt(t.spacing(0.5))],
|
|
@@ -104,7 +107,7 @@ function I({
|
|
|
104
107
|
showMaxLabel: !0,
|
|
105
108
|
showMinLabel: !0,
|
|
106
109
|
verticalAlign: "bottom",
|
|
107
|
-
formatter: (i) => i !== s && i !== c || i === 0 ? "" :
|
|
110
|
+
formatter: (i) => i !== s && i !== c || i === 0 ? "" : o ? o(i) : String(i)
|
|
108
111
|
},
|
|
109
112
|
axisLine: {
|
|
110
113
|
show: !1
|
|
@@ -122,12 +125,12 @@ function I({
|
|
|
122
125
|
tooltip: {
|
|
123
126
|
position: A(t),
|
|
124
127
|
formatter: $((i) => {
|
|
125
|
-
const
|
|
128
|
+
const m = i.value, x = typeof m == "number" && o ? o(m) : String(m ?? ""), S = typeof i.marker == "string" ? i.marker : "", w = i.seriesName ? `${i.seriesName}: ` : "";
|
|
126
129
|
return {
|
|
127
|
-
name: i.name ?? "",
|
|
128
|
-
seriesName:
|
|
129
|
-
marker:
|
|
130
|
-
value:
|
|
130
|
+
name: r ? String(r(i.name ?? "")) : i.name ?? "",
|
|
131
|
+
seriesName: w,
|
|
132
|
+
marker: S,
|
|
133
|
+
value: x
|
|
131
134
|
};
|
|
132
135
|
})
|
|
133
136
|
},
|
|
@@ -138,70 +141,71 @@ function I({
|
|
|
138
141
|
barCategoryGap: "1%",
|
|
139
142
|
emphasis: {
|
|
140
143
|
focus: "series"
|
|
141
|
-
}
|
|
144
|
+
},
|
|
145
|
+
...v(o)
|
|
142
146
|
}))
|
|
143
147
|
};
|
|
144
148
|
}
|
|
145
|
-
const
|
|
149
|
+
const j = {
|
|
146
150
|
skeleton: {
|
|
147
|
-
graph:
|
|
151
|
+
graph: D.graph
|
|
148
152
|
}
|
|
149
153
|
};
|
|
150
|
-
function
|
|
151
|
-
const e =
|
|
154
|
+
function se() {
|
|
155
|
+
const e = _(2);
|
|
152
156
|
let n;
|
|
153
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */
|
|
157
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ g(f, { sx: {
|
|
154
158
|
display: "flex",
|
|
155
159
|
alignItems: "flex-end",
|
|
156
160
|
justifyContent: "space-between",
|
|
157
|
-
gap:
|
|
158
|
-
height:
|
|
161
|
+
gap: B,
|
|
162
|
+
height: V,
|
|
159
163
|
width: "100%"
|
|
160
|
-
}, children: Array(8).fill(0).map(
|
|
164
|
+
}, children: Array(8).fill(0).map(G) }), e[0] = n) : n = e[0];
|
|
161
165
|
let t;
|
|
162
|
-
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */
|
|
166
|
+
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ L(f, { sx: j.skeleton.graph.container, children: [
|
|
163
167
|
n,
|
|
164
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ g(f, { sx: {
|
|
165
169
|
display: "flex",
|
|
166
170
|
alignItems: "center",
|
|
167
171
|
justifyContent: "space-between",
|
|
168
172
|
width: "100%",
|
|
169
|
-
mt:
|
|
170
|
-
}, children: Array(4).fill(0).map(
|
|
173
|
+
mt: F
|
|
174
|
+
}, children: Array(4).fill(0).map(z) })
|
|
171
175
|
] }), e[1] = t) : t = e[1], t;
|
|
172
176
|
}
|
|
173
|
-
function
|
|
174
|
-
return /* @__PURE__ */
|
|
177
|
+
function z(e, n) {
|
|
178
|
+
return /* @__PURE__ */ g(y, { width: 32, height: 8 }, `skeleton-label-${n}`);
|
|
175
179
|
}
|
|
176
|
-
function
|
|
180
|
+
function F(e) {
|
|
177
181
|
const {
|
|
178
182
|
spacing: n
|
|
179
183
|
} = e;
|
|
180
184
|
return n(1);
|
|
181
185
|
}
|
|
182
|
-
function
|
|
183
|
-
const
|
|
184
|
-
return /* @__PURE__ */
|
|
186
|
+
function G(e, n) {
|
|
187
|
+
const o = `${[60, 80, 95, 85, 70, 55, 40, 30][n]}%`;
|
|
188
|
+
return /* @__PURE__ */ g(y, { variant: "rectangular", sx: {
|
|
185
189
|
flex: 1,
|
|
186
|
-
height:
|
|
190
|
+
height: o
|
|
187
191
|
} }, `skeleton-bar-${n}`);
|
|
188
192
|
}
|
|
189
|
-
function
|
|
193
|
+
function V(e) {
|
|
190
194
|
const {
|
|
191
195
|
spacing: n
|
|
192
196
|
} = e;
|
|
193
197
|
return n(30);
|
|
194
198
|
}
|
|
195
|
-
function
|
|
199
|
+
function B(e) {
|
|
196
200
|
const {
|
|
197
201
|
spacing: n
|
|
198
202
|
} = e;
|
|
199
203
|
return n(0.5);
|
|
200
204
|
}
|
|
201
205
|
export {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
se as HistogramSkeleton,
|
|
207
|
+
ae as histogramConfig,
|
|
208
|
+
I as histogramDataToCSV,
|
|
209
|
+
re as histogramDownloadConfig
|
|
206
210
|
};
|
|
207
211
|
//# sourceMappingURL=histogram.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"histogram.js","sources":["../../src/widgets/histogram/config.ts","../../src/widgets/histogram/style.ts","../../src/widgets/histogram/skeleton.tsx"],"sourcesContent":["import {\n getCommonOptions,\n mergeEchartWidgetConfig,\n type EchartOptionsProps,\n} from '../echart'\nimport type { HistogramConfig, HistogramWidgetConfig } from './types'\nimport {\n buildLegendConfig,\n buildGridConfig,\n createTooltipPositioner,\n createTooltipFormatter,\n niceNum,\n} from '../utils/chart-config'\nimport { downloadToCSV, downloadToPNG, type DownloadItem } from '../actions'\nimport type { ConfigProps } from '../loader/types'\n\nexport interface HistogramDownloadConfigProps extends ConfigProps {\n ticks: number[]\n labelFormatter?: (value: string | number) => string | number\n}\n\nexport function histogramDataToCSV(\n data: number[][],\n ticks: number[],\n labelFormatter?: (value: string | number) => string | number,\n): string[][] {\n if (!data?.length || data[0]?.length === 0) return []\n\n const dataLength = data[0]?.length ?? 0\n const labels = createAxisLabels(dataLength, ticks, labelFormatter)\n const seriesCount = data.length\n const isMulti = seriesCount > 1\n\n const headers = isMulti\n ? [\n 'Bin',\n ...Array.from({ length: seriesCount }, (_, i) => `Series ${i + 1}`),\n ]\n : ['Bin', 'Value']\n\n return [\n headers,\n ...labels.map((label, i) => [\n label,\n ...data.map((series) => String(series[i] ?? 0)),\n ]),\n ]\n}\n\nexport function histogramDownloadConfig({\n refUI,\n ticks,\n labelFormatter,\n}: HistogramDownloadConfigProps): DownloadItem<number[][]>[] {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) =>\n downloadToCSV.modifier(histogramDataToCSV(data, ticks, labelFormatter)),\n },\n ]\n}\n\n/**\n * Creates formatted axis labels from tick boundaries.\n *\n * @param dataLength - Number of data points (determines number of labels).\n * @param ticks - Bin boundaries. If `ticks.length === dataLength + 1`, all\n * bins are ranges. If `ticks.length === dataLength`, the last bin is\n * open-ended (`+`). A last tick of `Infinity` also produces `+`.\n * @param labelFormatter - Optional formatter applied to each individual tick\n * value when building the bin range label.\n */\nfunction createAxisLabels(\n dataLength: number,\n ticks: number[],\n labelFormatter?: (value: string | number) => string | number,\n): string[] {\n const fmt = (v: number) =>\n labelFormatter ? String(labelFormatter(v)) : String(v)\n\n return Array.from({ length: dataLength }, (_, i) => {\n const low = ticks[i] ?? i\n const high = ticks[i + 1]\n return high !== undefined && isFinite(high)\n ? `${fmt(low)}-${fmt(high)}`\n : `${fmt(low)}+`\n })\n}\n\n/**\n * Generates ECharts configuration for distribution histogram widgets with\n * adjacent bars (minimal gap) and axis formatting styled with the CARTO theme.\n *\n * Accepts raw `number[][]` data and `ticks` boundaries. The ticks and\n * `labelFormatter` are used to create the x-axis category labels; the raw\n * numeric data is embedded directly in each series.\n *\n * @param props - Histogram configuration including raw data, ticks, and theme.\n * @returns Widget config with ECharts option object.\n */\nexport function histogramConfig(props: HistogramConfig): HistogramWidgetConfig {\n return {\n type: 'histogram',\n option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),\n formatter: props.formatter,\n }\n}\n\nfunction getOption({\n data = [],\n ticks,\n theme,\n formatter,\n labelFormatter,\n}: HistogramConfig): EchartOptionsProps {\n const hasLegend = (data?.length ?? 0) > 1\n const dataLength = data[0]?.length ?? 0\n const axisLabels = createAxisLabels(dataLength, ticks, labelFormatter)\n\n let niceMin = 0\n let niceMax = 1\n\n return {\n legend: buildLegendConfig({ hasLegend }),\n grid: buildGridConfig(hasLegend, theme),\n xAxis: {\n type: 'category',\n data: axisLabels,\n axisLine: {\n show: false,\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n showMinLabel: true,\n showMaxLabel: true,\n hideOverlap: true,\n margin: 0,\n padding: [\n parseInt(theme.spacing(0.5)),\n parseInt(theme.spacing(0.5)),\n 0,\n parseInt(theme.spacing(0.5)),\n ],\n color: theme.palette.black[60],\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n yAxis: {\n type: 'value' as const,\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n splitNumber: 1,\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom' as const,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n axisLine: {\n show: false,\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n tooltip: {\n position: createTooltipPositioner(theme),\n formatter: createTooltipFormatter((item) => {\n const _value = item.value as number\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : String(_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = item.name ?? ''\n\n return { name, seriesName, marker, value: formattedValue }\n }),\n },\n series: data.map((seriesData: number[]) => ({\n type: 'bar',\n data: seriesData,\n barGap: '1%',\n barCategoryGap: '1%',\n emphasis: {\n focus: 'series',\n },\n })),\n } as EchartOptionsProps\n}\n","import type { SxProps, Theme } from '@mui/material'\nimport { baseSkeletonStyles } from '../utils/skeleton'\n\nexport const styles = {\n skeleton: {\n graph: baseSkeletonStyles.graph,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nexport function HistogramSkeleton() {\n return (\n <Box sx={styles.skeleton.graph.container}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'flex-end',\n justifyContent: 'space-between',\n gap: ({ spacing }) => spacing(0.5),\n height: ({ spacing }) => spacing(30),\n width: '100%',\n }}\n >\n {Array(8)\n .fill(0)\n .map((_, i) => {\n // Create varying heights for histogram bars\n const heights = [60, 80, 95, 85, 70, 55, 40, 30]\n const height = `${heights[i]}%`\n return (\n <Skeleton\n key={`skeleton-bar-${i}`}\n variant='rectangular'\n sx={{\n flex: 1,\n height,\n }}\n />\n )\n })}\n </Box>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n mt: ({ spacing }) => spacing(1),\n }}\n >\n {Array(4)\n .fill(0)\n .map((_, i) => (\n <Skeleton key={`skeleton-label-${i}`} width={32} height={8} />\n ))}\n </Box>\n </Box>\n )\n}\n"],"names":["histogramDataToCSV","data","ticks","labelFormatter","length","dataLength","labels","createAxisLabels","seriesCount","Array","from","_","i","map","label","series","String","histogramDownloadConfig","refUI","downloadToPNG","modifier","downloadToCSV","fmt","v","low","high","undefined","isFinite","histogramConfig","props","type","option","mergeEchartWidgetConfig","getCommonOptions","getOption","formatter","theme","hasLegend","axisLabels","niceMin","niceMax","legend","buildLegendConfig","grid","buildGridConfig","xAxis","axisLine","show","axisLabel","fontSize","typography","overlineDelicate","fontFamily","showMinLabel","showMaxLabel","hideOverlap","margin","padding","parseInt","spacing","color","palette","black","axisTick","splitLine","lineStyle","yAxis","min","extent","niceNum","max","splitNumber","verticalAlign","value","tooltip","position","createTooltipPositioner","createTooltipFormatter","item","_value","formattedValue","marker","seriesName","name","seriesData","barGap","barCategoryGap","emphasis","focus","styles","skeleton","graph","baseSkeletonStyles","HistogramSkeleton","$","_c","t0","Symbol","for","jsx","Box","display","alignItems","justifyContent","gap","_temp","height","_temp2","width","fill","_temp3","t1","container","mt","_temp4","_temp5","__0","i_0","Skeleton","spacing_1","flex","spacing_0"],"mappings":";;;;;;;;;;;;;;;;;AAqBO,SAASA,EACdC,GACAC,GACAC,GACY;AACZ,MAAI,CAACF,GAAMG,UAAUH,EAAK,CAAC,GAAGG,WAAW,EAAG,QAAO,CAAA;AAEnD,QAAMC,IAAaJ,EAAK,CAAC,GAAGG,UAAU,GAChCE,IAASC,EAAiBF,GAAYH,GAAOC,CAAc,GAC3DK,IAAcP,EAAKG;AAUzB,SAAO,CATSI,IAAc,IAG1B,CACE,OACA,GAAGC,MAAMC,KAAK;AAAA,IAAEN,QAAQI;AAAAA,EAAAA,GAAe,CAACG,GAAGC,MAAM,UAAUA,IAAI,CAAC,EAAE,CAAC,IAErE,CAAC,OAAO,OAAO,GAIjB,GAAGN,EAAOO,IAAI,CAACC,GAAOF,MAAM,CAC1BE,GACA,GAAGb,EAAKY,IAAKE,CAAAA,MAAWC,OAAOD,EAAOH,CAAC,KAAK,CAAC,CAAC,CAAC,CAChD,CAAC;AAEN;AAE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IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,EACrB9F,CAAC,CAAC;AAAG,SAE7B,gBAAAuF,EAACmB,GAAA,EAES,SAAA,eACJ,IAAA;AAAA,IAAAE,MACI;AAAA,IAACd,QAAAA;AAAAA,EAAAA,EAET,GALK,gBAAgB9F,CAAC,EAKrB;AACD;AA3BT,SAAA+F,EAAAX,GAAA;AASY,QAAA;AAAA,IAAArC,SAAA8D;AAAAA,EAAAA,IAAAzB;AAAW,SAAKrC,EAAQ,EAAE;AAAC;AATvC,SAAA8C,EAAAT,GAAA;AAQS,QAAA;AAAA,IAAArC,SAAAA;AAAAA,EAAAA,IAAAqC;AAAW,SAAKrC,EAAQ,GAAG;AAAC;"}
|
|
1
|
+
{"version":3,"file":"histogram.js","sources":["../../src/widgets/histogram/config.ts","../../src/widgets/histogram/style.ts","../../src/widgets/histogram/skeleton.tsx"],"sourcesContent":["import {\n getCommonOptions,\n mergeEchartWidgetConfig,\n type EchartOptionsProps,\n} from '../echart'\nimport type { HistogramConfig, HistogramWidgetConfig } from './types'\nimport {\n buildLegendConfig,\n buildGridConfig,\n createTooltipPositioner,\n createTooltipFormatter,\n niceNum,\n buildHistogramSeriesLabelConfig,\n} from '../utils/chart-config'\nimport { downloadToCSV, downloadToPNG, type DownloadItem } from '../actions'\nimport type { ConfigProps } from '../loader/types'\n\nexport interface HistogramDownloadConfigProps extends ConfigProps {\n ticks: number[]\n labelFormatter?: (value: string | number) => string | number\n}\n\nexport function histogramDataToCSV(\n data: number[][],\n ticks: number[],\n labelFormatter?: (value: string | number) => string | number,\n): string[][] {\n if (!data?.length || data[0]?.length === 0) return []\n\n const dataLength = data[0]?.length ?? 0\n const labels = createAxisLabels(dataLength, ticks, labelFormatter)\n const seriesCount = data.length\n const isMulti = seriesCount > 1\n\n const headers = isMulti\n ? [\n 'Bin',\n ...Array.from({ length: seriesCount }, (_, i) => `Series ${i + 1}`),\n ]\n : ['Bin', 'Value']\n\n return [\n headers,\n ...labels.map((label, i) => [\n label,\n ...data.map((series) => String(series[i] ?? 0)),\n ]),\n ]\n}\n\nexport function histogramDownloadConfig({\n refUI,\n ticks,\n labelFormatter,\n}: HistogramDownloadConfigProps): DownloadItem<number[][]>[] {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) =>\n downloadToCSV.modifier(histogramDataToCSV(data, ticks, labelFormatter)),\n },\n ]\n}\n\n/**\n * Creates formatted axis labels from tick boundaries.\n *\n * @param dataLength - Number of data points (determines number of labels).\n * @param ticks - Bin boundaries. If `ticks.length === dataLength + 1`, all\n * bins are ranges. If `ticks.length === dataLength`, the last bin is\n * open-ended (`+`). A last tick of `Infinity` also produces `+`.\n * @param labelFormatter - Optional formatter applied to each individual tick\n * value when building the bin range label.\n */\nfunction createAxisLabels(\n dataLength: number,\n ticks: number[],\n labelFormatter?: (value: string | number) => string | number,\n): string[] {\n const fmt = (v: number) =>\n labelFormatter ? String(labelFormatter(v)) : String(v)\n\n return Array.from({ length: dataLength }, (_, i) => {\n const low = ticks[i] ?? i\n const high = ticks[i + 1]\n return high !== undefined && isFinite(high)\n ? `${fmt(low)}-${fmt(high)}`\n : `${fmt(low)}+`\n })\n}\n\n/**\n * Generates ECharts configuration for distribution histogram widgets with\n * adjacent bars (minimal gap) and axis formatting styled with the CARTO theme.\n *\n * Accepts raw `number[][]` data and `ticks` boundaries. The ticks and\n * `labelFormatter` are used to create the x-axis category labels; the raw\n * numeric data is embedded directly in each series.\n *\n * @param props - Histogram configuration including raw data, ticks, and theme.\n * @returns Widget config with ECharts option object.\n */\nexport function histogramConfig(props: HistogramConfig): HistogramWidgetConfig {\n return {\n type: 'histogram',\n option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),\n formatter: props.formatter,\n labelFormatter: props.labelFormatter,\n }\n}\n\nfunction getOption({\n data = [],\n ticks,\n theme,\n formatter,\n labelFormatter,\n}: HistogramConfig): EchartOptionsProps {\n const hasLegend = (data?.length ?? 0) > 1\n const dataLength = data[0]?.length ?? 0\n const axisLabels = createAxisLabels(dataLength, ticks, labelFormatter)\n\n let niceMin = 0\n let niceMax = 1\n\n return {\n legend: buildLegendConfig({ hasLegend, labelFormatter }),\n grid: buildGridConfig(hasLegend, theme),\n xAxis: {\n type: 'category',\n data: axisLabels,\n axisLine: {\n show: false,\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n showMinLabel: undefined,\n showMaxLabel: undefined,\n hideOverlap: true,\n margin: 0,\n padding: [\n parseInt(theme.spacing(0.5)),\n parseInt(theme.spacing(0.5)),\n 0,\n parseInt(theme.spacing(0.5)),\n ],\n color: theme.palette.black[60],\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n yAxis: {\n type: 'value' as const,\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n splitNumber: 1,\n axisLabel: {\n fontSize: theme.typography.overlineDelicate.fontSize,\n fontFamily: theme.typography.overlineDelicate.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom' as const,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n axisLine: {\n show: false,\n },\n axisTick: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: theme.palette.black[4],\n },\n },\n },\n tooltip: {\n position: createTooltipPositioner(theme),\n formatter: createTooltipFormatter((item) => {\n const _value = item.value as number\n\n const formattedValue =\n typeof _value === 'number' && formatter\n ? formatter(_value)\n : String(_value ?? '')\n\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n\n return { name, seriesName, marker, value: formattedValue }\n }),\n },\n series: data.map((seriesData: number[]) => ({\n type: 'bar',\n data: seriesData,\n barGap: '1%',\n barCategoryGap: '1%',\n emphasis: {\n focus: 'series',\n },\n ...buildHistogramSeriesLabelConfig(formatter),\n })),\n } as EchartOptionsProps\n}\n","import type { SxProps, Theme } from '@mui/material'\nimport { baseSkeletonStyles } from '../utils/skeleton'\n\nexport const styles = {\n skeleton: {\n graph: baseSkeletonStyles.graph,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Skeleton } from '@mui/material'\nimport { styles } from './style'\n\nexport function HistogramSkeleton() {\n return (\n <Box sx={styles.skeleton.graph.container}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'flex-end',\n justifyContent: 'space-between',\n gap: ({ spacing }) => spacing(0.5),\n height: ({ spacing }) => spacing(30),\n width: '100%',\n }}\n >\n {Array(8)\n .fill(0)\n .map((_, i) => {\n // Create varying heights for histogram bars\n const heights = [60, 80, 95, 85, 70, 55, 40, 30]\n const height = `${heights[i]}%`\n return (\n <Skeleton\n key={`skeleton-bar-${i}`}\n variant='rectangular'\n sx={{\n flex: 1,\n height,\n }}\n />\n )\n })}\n </Box>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n mt: ({ spacing }) => spacing(1),\n }}\n >\n {Array(4)\n .fill(0)\n .map((_, i) => (\n <Skeleton key={`skeleton-label-${i}`} width={32} height={8} />\n ))}\n </Box>\n </Box>\n )\n}\n"],"names":["histogramDataToCSV","data","ticks","labelFormatter","length","dataLength","labels","createAxisLabels","seriesCount","Array","from","_","i","map","label","series","String","histogramDownloadConfig","refUI","downloadToPNG","modifier","downloadToCSV","fmt","v","low","high","undefined","isFinite","histogramConfig","props","type","option","mergeEchartWidgetConfig","getCommonOptions","getOption","formatter","theme","hasLegend","axisLabels","niceMin","niceMax","legend","buildLegendConfig","grid","buildGridConfig","xAxis","axisLine","show","axisLabel","fontSize","typography","overlineDelicate","fontFamily","showMinLabel","showMaxLabel","hideOverlap","margin","padding","parseInt","spacing","color","palette","black","axisTick","splitLine","lineStyle","yAxis","min","extent","niceNum","max","splitNumber","verticalAlign","value","tooltip","position","createTooltipPositioner","createTooltipFormatter","item","_value","formattedValue","marker","seriesName","name","seriesData","barGap","barCategoryGap","emphasis","focus","buildHistogramSeriesLabelConfig","styles","skeleton","graph","baseSkeletonStyles","HistogramSkeleton","$","_c","t0","Symbol","for","jsx","Box","display","alignItems","justifyContent","gap","_temp","height","_temp2","width","fill","_temp3","t1","container","mt","_temp4","_temp5","__0","i_0","Skeleton","spacing_1","flex","spacing_0"],"mappings":";;;;;;;;;;;;;;;;;;AAsBO,SAASA,EACdC,GACAC,GACAC,GACY;AACZ,MAAI,CAACF,GAAMG,UAAUH,EAAK,CAAC,GAAGG,WAAW,EAAG,QAAO,CAAA;AAEnD,QAAMC,IAAaJ,EAAK,CAAC,GAAGG,UAAU,GAChCE,IAASC,EAAiBF,GAAYH,GAAOC,CAAc,GAC3DK,IAAcP,EAAKG;AAUzB,SAAO,CATSI,IAAc,IAG1B,CACE,OACA,GAAGC,MAAMC,KAAK;AAAA,IAAEN,QAAQI;AAAAA,EAAAA,GAAe,CAACG,GAAGC,MAAM,UAAUA,IAAI,CAAC,EAAE,CAAC,IAErE,CAAC,OAAO,OAAO,GAIjB,GAAGN,EAAOO,IAAI,CAACC,GAAOF,MAAM,CAC1BE,GACA,GAAGb,EAAKY,IAAKE,CAAAA,MAAWC,OAAOD,EAAOH,CAAC,KAAK,CAAC,CAAC,CAAC,CAChD,CAAC;AAEN;AAEO,SAASK,GAAwB;AAAA,EACtCC,OAAAA;AAAAA,EACAhB,OAAAA;AAAAA,EACAC,gBAAAA;AAC4B,GAA+B;AAC3D,SAAO,CACL;AAAA,IACE,GAAGgB;AAAAA,IACHC,UAAU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Ae,GADC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,EACrB/F,CAAC,CAAC;AAAG,SAE7B,gBAAAwF,EAACmB,GAAA,EAES,SAAA,eACJ,IAAA;AAAA,IAAAE,MACI;AAAA,IAACd,QAAAA;AAAAA,EAAAA,EAET,GALK,gBAAgB/F,CAAC,EAKrB;AACD;AA3BT,SAAAgG,EAAAX,GAAA;AASY,QAAA;AAAA,IAAAtC,SAAA+D;AAAAA,EAAAA,IAAAzB;AAAW,SAAKtC,EAAQ,EAAE;AAAC;AATvC,SAAA+C,EAAAT,GAAA;AAQS,QAAA;AAAA,IAAAtC,SAAAA;AAAAA,EAAAA,IAAAsC;AAAW,SAAKtC,EAAQ,GAAG;AAAC;"}
|
package/dist/widgets/markdown.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { c as s } from "react/compiler-runtime";
|
|
3
3
|
import { u as f } from "../use-widget-selector-DFl2hW0R.js";
|
|
4
|
-
import { ListItem as u, List as
|
|
4
|
+
import { ListItem as u, List as p, Link as g, Typography as m, Skeleton as a, Box as w } from "@mui/material";
|
|
5
5
|
import k from "react-markdown";
|
|
6
6
|
import "../widget-store-Bw5zRUGg.js";
|
|
7
7
|
import "@mui/icons-material";
|
|
@@ -12,9 +12,10 @@ import "../cjs-D4KH3azB.js";
|
|
|
12
12
|
import "@dnd-kit/core";
|
|
13
13
|
import "@dnd-kit/sortable";
|
|
14
14
|
import "@dnd-kit/utilities";
|
|
15
|
+
import "react-dom";
|
|
15
16
|
import "zustand/shallow";
|
|
16
|
-
import { a as
|
|
17
|
-
function
|
|
17
|
+
import { a as d } from "../exports-Cr43OCul.js";
|
|
18
|
+
function U(t) {
|
|
18
19
|
const o = s(2), {
|
|
19
20
|
id: n
|
|
20
21
|
} = t, e = f(n, y);
|
|
@@ -65,10 +66,10 @@ const c = {
|
|
|
65
66
|
}) => /* @__PURE__ */ r(g, { href: o, target: n, rel: e, children: t }),
|
|
66
67
|
ul: ({
|
|
67
68
|
children: t
|
|
68
|
-
}) => /* @__PURE__ */ r(
|
|
69
|
+
}) => /* @__PURE__ */ r(p, { sx: c.ul, children: t }),
|
|
69
70
|
ol: ({
|
|
70
71
|
children: t
|
|
71
|
-
}) => /* @__PURE__ */ r(
|
|
72
|
+
}) => /* @__PURE__ */ r(p, { component: "ol", sx: c.ol, children: t }),
|
|
72
73
|
li: ({
|
|
73
74
|
children: t
|
|
74
75
|
}) => /* @__PURE__ */ r(u, { sx: c.li, children: t })
|
|
@@ -86,7 +87,7 @@ function S(t) {
|
|
|
86
87
|
let l;
|
|
87
88
|
return o[2] !== n || o[3] !== i ? (l = /* @__PURE__ */ r(k, { components: i, children: n }), o[2] = n, o[3] = i, o[4] = l) : l = o[4], l;
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function V() {
|
|
90
91
|
const t = s(3);
|
|
91
92
|
let o;
|
|
92
93
|
t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ r(a, { width: "80%", height: 24, sx: {
|
|
@@ -106,23 +107,23 @@ function U() {
|
|
|
106
107
|
/* @__PURE__ */ r(a, { width: "75%", height: 20 })
|
|
107
108
|
] }), t[2] = e) : e = t[2], e;
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
+
function W() {
|
|
110
111
|
return [{
|
|
111
|
-
...
|
|
112
|
+
...d,
|
|
112
113
|
modifier: async (t) => {
|
|
113
114
|
const o = t?.content ?? "";
|
|
114
|
-
return
|
|
115
|
+
return d.modifier([["Content"], [o]]);
|
|
115
116
|
}
|
|
116
117
|
}];
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
+
function q() {
|
|
119
120
|
return {};
|
|
120
121
|
}
|
|
121
122
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
U as Markdown,
|
|
124
|
+
V as MarkdownSkeleton,
|
|
124
125
|
S as MarkdownUI,
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
q as markdownConfig,
|
|
127
|
+
W as markdownDownloadConfig
|
|
127
128
|
};
|
|
128
129
|
//# sourceMappingURL=markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","sources":["../../src/widgets/markdown/markdown.tsx","../../src/widgets/markdown/style.ts","../../src/widgets/markdown/markdown-ui.tsx","../../src/widgets/markdown/skeleton.tsx","../../src/widgets/markdown/config.ts"],"sourcesContent":["import type { MarkdownUIProps } from './types'\nimport type { MarkdownWidgetData } from './types'\nimport { MarkdownUI } from '.'\nimport { useWidgetSelector } from '../stores/use-widget-selector'\n\n/**\n * Stateful markdown widget component that reads content from the widget store and renders it as formatted rich text.\n */\nexport function Markdown({ id }: MarkdownUIProps) {\n const content = useWidgetSelector(\n id,\n (w) => (w?.data as MarkdownWidgetData | undefined)?.content,\n )\n\n if (!content) {\n return null\n }\n\n return <MarkdownUI>{content}</MarkdownUI>\n}\n","import type { SxProps, Theme } from '@mui/material'\n\nexport const styles: Record<string, SxProps<Theme>> = {\n container: {\n display: 'flex',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(2),\n },\n markdown: {\n overflow: 'hidden',\n typography: ({ typography }) => ({\n ...typography.body1,\n }),\n },\n li: {\n display: 'list-item',\n paddingTop: 0,\n paddingBottom: 0,\n },\n ul: {\n listStyleType: 'disc',\n paddingLeft: ({ spacing }) => spacing(2),\n },\n ol: {\n listStyleType: 'decimal',\n paddingLeft: ({ spacing }) => spacing(2),\n },\n}\n","import { Link, List, ListItem, Typography } from '@mui/material'\nimport ReactMarkdown, { type Components } from 'react-markdown'\nimport { styles } from '../markdown/style'\nimport type { MarkdownComponentProps } from './types'\n\nconst COMPONENTS: Components = {\n h1: ({ children }) => (\n <Typography variant='h4' gutterBottom color='inherit'>\n {children}\n </Typography>\n ),\n h2: ({ children }) => (\n <Typography variant='h5' gutterBottom color='inherit'>\n {children}\n </Typography>\n ),\n h3: ({ children }) => (\n <Typography variant='h6' gutterBottom color='inherit'>\n {children}\n </Typography>\n ),\n p: ({ children }) => (\n <Typography paragraph color='inherit'>\n {children}\n </Typography>\n ),\n a: ({ children, href, target = '_blank', rel = 'noopener noreferrer' }) => (\n <Link href={href} target={target} rel={rel}>\n {children}\n </Link>\n ),\n ul: ({ children }) => <List sx={styles.ul}>{children}</List>,\n ol: ({ children }) => (\n <List component='ol' sx={styles.ol}>\n {children}\n </List>\n ),\n li: ({ children }) => <ListItem sx={styles.li}>{children}</ListItem>,\n}\n\n/**\n * Presentational component that renders a Markdown string as MUI-styled HTML using react-markdown.\n *\n * @remarks\n * Maps Markdown elements (headings, paragraphs, links, lists) to MUI Typography and Link components.\n * Custom component overrides can be passed via the `overrides` prop.\n */\nexport function MarkdownUI({ children, overrides }: MarkdownComponentProps) {\n return (\n <ReactMarkdown\n components={{\n ...COMPONENTS,\n ...overrides,\n }}\n >\n {children}\n </ReactMarkdown>\n )\n}\n","import { Box, Skeleton } from '@mui/material'\n\nexport function MarkdownSkeleton() {\n return (\n <Box aria-label='Markdown skeleton'>\n <Skeleton width='80%' height={24} sx={{ mb: 1 }} />\n <Skeleton width='90%' height={20} sx={{ mb: 0.5 }} />\n <Skeleton width='85%' height={20} sx={{ mb: 0.5 }} />\n <Skeleton width='75%' height={20} />\n </Box>\n )\n}\n","import { downloadToCSV, type DownloadItem } from '../actions'\nimport type { MarkdownWidgetConfig, MarkdownWidgetData } from './types'\n\n/**\n * Creates download configuration for markdown widgets, supporting CSV export of text content. Does not require `refUI` since it only exports text.\n *\n * @returns Array of download items for use with the Download action.\n */\nexport function markdownDownloadConfig(): DownloadItem<MarkdownWidgetData>[] {\n return [\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const content = data?.content ?? ''\n return downloadToCSV.modifier([['Content'], [content]])\n },\n },\n ]\n}\n\n/**\n * Returns the default configuration for markdown content display widgets.\n *\n * @returns Default markdown widget config (empty object).\n */\nexport function markdownConfig(): MarkdownWidgetConfig {\n return {}\n}\n"],"names":["Markdown","t0","$","_c","id","content","useWidgetSelector","_temp","t1","MarkdownUI","w","data","styles","li","display","paddingTop","paddingBottom","ul","listStyleType","paddingLeft","spacing","ol","COMPONENTS","h1","children","Typography","h2","h3","p","jsx","a","href","target","rel","Link","List","ListItem","overrides","t2","ReactMarkdown","MarkdownSkeleton","Symbol","for","Skeleton","mb","jsxs","Box","markdownDownloadConfig","downloadToCSV","modifier","markdownConfig"],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.js","sources":["../../src/widgets/markdown/markdown.tsx","../../src/widgets/markdown/style.ts","../../src/widgets/markdown/markdown-ui.tsx","../../src/widgets/markdown/skeleton.tsx","../../src/widgets/markdown/config.ts"],"sourcesContent":["import type { MarkdownUIProps } from './types'\nimport type { MarkdownWidgetData } from './types'\nimport { MarkdownUI } from '.'\nimport { useWidgetSelector } from '../stores/use-widget-selector'\n\n/**\n * Stateful markdown widget component that reads content from the widget store and renders it as formatted rich text.\n */\nexport function Markdown({ id }: MarkdownUIProps) {\n const content = useWidgetSelector(\n id,\n (w) => (w?.data as MarkdownWidgetData | undefined)?.content,\n )\n\n if (!content) {\n return null\n }\n\n return <MarkdownUI>{content}</MarkdownUI>\n}\n","import type { SxProps, Theme } from '@mui/material'\n\nexport const styles: Record<string, SxProps<Theme>> = {\n container: {\n display: 'flex',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(2),\n },\n markdown: {\n overflow: 'hidden',\n typography: ({ typography }) => ({\n ...typography.body1,\n }),\n },\n li: {\n display: 'list-item',\n paddingTop: 0,\n paddingBottom: 0,\n },\n ul: {\n listStyleType: 'disc',\n paddingLeft: ({ spacing }) => spacing(2),\n },\n ol: {\n listStyleType: 'decimal',\n paddingLeft: ({ spacing }) => spacing(2),\n },\n}\n","import { Link, List, ListItem, Typography } from '@mui/material'\nimport ReactMarkdown, { type Components } from 'react-markdown'\nimport { styles } from '../markdown/style'\nimport type { MarkdownComponentProps } from './types'\n\nconst COMPONENTS: Components = {\n h1: ({ children }) => (\n <Typography variant='h4' gutterBottom color='inherit'>\n {children}\n </Typography>\n ),\n h2: ({ children }) => (\n <Typography variant='h5' gutterBottom color='inherit'>\n {children}\n </Typography>\n ),\n h3: ({ children }) => (\n <Typography variant='h6' gutterBottom color='inherit'>\n {children}\n </Typography>\n ),\n p: ({ children }) => (\n <Typography paragraph color='inherit'>\n {children}\n </Typography>\n ),\n a: ({ children, href, target = '_blank', rel = 'noopener noreferrer' }) => (\n <Link href={href} target={target} rel={rel}>\n {children}\n </Link>\n ),\n ul: ({ children }) => <List sx={styles.ul}>{children}</List>,\n ol: ({ children }) => (\n <List component='ol' sx={styles.ol}>\n {children}\n </List>\n ),\n li: ({ children }) => <ListItem sx={styles.li}>{children}</ListItem>,\n}\n\n/**\n * Presentational component that renders a Markdown string as MUI-styled HTML using react-markdown.\n *\n * @remarks\n * Maps Markdown elements (headings, paragraphs, links, lists) to MUI Typography and Link components.\n * Custom component overrides can be passed via the `overrides` prop.\n */\nexport function MarkdownUI({ children, overrides }: MarkdownComponentProps) {\n return (\n <ReactMarkdown\n components={{\n ...COMPONENTS,\n ...overrides,\n }}\n >\n {children}\n </ReactMarkdown>\n )\n}\n","import { Box, Skeleton } from '@mui/material'\n\nexport function MarkdownSkeleton() {\n return (\n <Box aria-label='Markdown skeleton'>\n <Skeleton width='80%' height={24} sx={{ mb: 1 }} />\n <Skeleton width='90%' height={20} sx={{ mb: 0.5 }} />\n <Skeleton width='85%' height={20} sx={{ mb: 0.5 }} />\n <Skeleton width='75%' height={20} />\n </Box>\n )\n}\n","import { downloadToCSV, type DownloadItem } from '../actions'\nimport type { MarkdownWidgetConfig, MarkdownWidgetData } from './types'\n\n/**\n * Creates download configuration for markdown widgets, supporting CSV export of text content. Does not require `refUI` since it only exports text.\n *\n * @returns Array of download items for use with the Download action.\n */\nexport function markdownDownloadConfig(): DownloadItem<MarkdownWidgetData>[] {\n return [\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const content = data?.content ?? ''\n return downloadToCSV.modifier([['Content'], [content]])\n },\n },\n ]\n}\n\n/**\n * Returns the default configuration for markdown content display widgets.\n *\n * @returns Default markdown widget config (empty object).\n */\nexport function markdownConfig(): MarkdownWidgetConfig {\n return {}\n}\n"],"names":["Markdown","t0","$","_c","id","content","useWidgetSelector","_temp","t1","MarkdownUI","w","data","styles","li","display","paddingTop","paddingBottom","ul","listStyleType","paddingLeft","spacing","ol","COMPONENTS","h1","children","Typography","h2","h3","p","jsx","a","href","target","rel","Link","List","ListItem","overrides","t2","ReactMarkdown","MarkdownSkeleton","Symbol","for","Skeleton","mb","jsxs","Box","markdownDownloadConfig","downloadToCSV","modifier","markdownConfig"],"mappings":";;;;;;;;;;;;;;;;;AAQO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAkB;AAAA,IAAAC,IAAAA;AAAAA,EAAAA,IAAAH,GACvBI,IAAgBC,EACdF,GACAG,CACF;AAEA,MAAI,CAACF;AAAO,WACH;AACR,MAAAG;AAAA,SAAAN,SAAAG,KAEMG,sBAACC,kBAAoB,GAAaP,OAAAG,GAAAH,OAAAM,KAAAA,IAAAN,EAAA,CAAA,GAAlCM;AAAkC;AAVpC,SAAAD,EAAAG,GAAA;AAAA,SAGKA,GAACC,MAAkDN;AAAA;ACTxD,MAAMO,IAAyC;AAAA,EAYpDC,IAAI;AAAA,IACFC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,eAAe;AAAA,EAAA;AAAA,EAEjBC,IAAI;AAAA,IACFC,eAAe;AAAA,IACfC,aAAaA,CAAC;AAAA,MAAEC,SAAAA;AAAAA,IAAAA,MAAcA,EAAQ,CAAC;AAAA,EAAA;AAAA,EAEzCC,IAAI;AAAA,IACFH,eAAe;AAAA,IACfC,aAAaA,CAAC;AAAA,MAAEC,SAAAA;AAAAA,IAAAA,MAAcA,EAAQ,CAAC;AAAA,EAAA;AAE3C,GCtBME,IAAyB;AAAA,EAC7BC,IAAIA,CAA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AAMzC,OAAAoC,KAAAA,IAAApC,EAAA,CAAA,GALNoC;AAKM;ACDH,SAASS,IAA6D;AAC3E,SAAO,CACL;AAAA,IACE,GAAGC;AAAAA,IACHC,UAAU,OAAOtC,MAAS;AACxB,YAAMN,IAAUM,GAAMN,WAAW;AACjC,aAAO2C,EAAcC,SAAS,CAAC,CAAC,SAAS,GAAG,CAAC5C,CAAO,CAAC,CAAC;AAAA,IACxD;AAAA,EAAA,CACD;AAEL;AAOO,SAAS6C,IAAuC;AACrD,SAAO,CAAA;AACT;"}
|
package/dist/widgets/pie.js
CHANGED
|
@@ -4,21 +4,21 @@ import "react";
|
|
|
4
4
|
import "echarts";
|
|
5
5
|
import "../widget-store-Bw5zRUGg.js";
|
|
6
6
|
import "zustand/shallow";
|
|
7
|
-
import { g as L } from "../options-
|
|
7
|
+
import { g as L } from "../options-CthfUJDz.js";
|
|
8
8
|
import { m as N } from "../utils-BOhInag6.js";
|
|
9
|
-
import { c as j, f as A } from "../download-config-
|
|
10
|
-
import { g as b, h as
|
|
11
|
-
import { Box as h, Skeleton as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
9
|
+
import { c as j, f as A } from "../download-config-DNLkypdN.js";
|
|
10
|
+
import { i as O, g as b, h as T, n as v, d as S, e as _, c as z } from "../styles-BYTyKQFP.js";
|
|
11
|
+
import { Box as h, Skeleton as g } from "@mui/material";
|
|
12
|
+
const F = j(A);
|
|
13
|
+
function ee(e) {
|
|
14
14
|
return {
|
|
15
15
|
type: "pie",
|
|
16
|
-
option: N(L(e),
|
|
16
|
+
option: N(L(e), $(e)),
|
|
17
17
|
formatter: e.formatter,
|
|
18
18
|
labelFormatter: e.labelFormatter
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function $({
|
|
22
22
|
data: e = [],
|
|
23
23
|
theme: n,
|
|
24
24
|
formatter: r,
|
|
@@ -79,7 +79,7 @@ function z({
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
tooltip: {
|
|
82
|
-
position:
|
|
82
|
+
position: T(n),
|
|
83
83
|
formatter: b((t) => {
|
|
84
84
|
const s = t.value, u = t.dimensionNames?.[t.encode?.x?.at(0) ?? 1], a = s[u ?? ""], d = typeof a == "number" && r ? r(a) : a ?? "", m = typeof t.marker == "string" ? t.marker : "", I = t.seriesName ? `${t.seriesName}: ` : "";
|
|
85
85
|
return {
|
|
@@ -96,7 +96,8 @@ function z({
|
|
|
96
96
|
barMaxWidth: 100,
|
|
97
97
|
emphasis: {
|
|
98
98
|
focus: "series"
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
|
+
...O(r, "x")
|
|
100
101
|
}))
|
|
101
102
|
};
|
|
102
103
|
}
|
|
@@ -176,12 +177,12 @@ function z({
|
|
|
176
177
|
}))
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
|
-
const
|
|
180
|
+
const D = {
|
|
180
181
|
skeleton: {
|
|
181
|
-
graph:
|
|
182
|
+
graph: z.graph
|
|
182
183
|
}
|
|
183
184
|
}, k = 32, y = 294 - k, w = y - k;
|
|
184
|
-
function
|
|
185
|
+
function te() {
|
|
185
186
|
const e = C(5);
|
|
186
187
|
let n, r;
|
|
187
188
|
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = {
|
|
@@ -189,14 +190,14 @@ function ee() {
|
|
|
189
190
|
alignItems: "center",
|
|
190
191
|
justifyContent: "center",
|
|
191
192
|
position: "relative"
|
|
192
|
-
}, r = /* @__PURE__ */ p(
|
|
193
|
+
}, r = /* @__PURE__ */ p(g, { variant: "circular", width: y, height: y }), e[0] = n, e[1] = r) : (n = e[0], r = e[1]);
|
|
193
194
|
let o;
|
|
194
|
-
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ p(
|
|
195
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ p(g, { sx: {
|
|
195
196
|
position: "absolute",
|
|
196
197
|
zIndex: 1
|
|
197
198
|
}, variant: "circular", width: w, height: w }), e[2] = o) : o = e[2];
|
|
198
|
-
let
|
|
199
|
-
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
199
|
+
let f;
|
|
200
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ x(h, { sx: n, children: [
|
|
200
201
|
r,
|
|
201
202
|
o,
|
|
202
203
|
/* @__PURE__ */ x(h, { sx: {
|
|
@@ -206,60 +207,60 @@ function ee() {
|
|
|
206
207
|
flexDirection: "column",
|
|
207
208
|
alignItems: "center",
|
|
208
209
|
justifyContent: "center",
|
|
209
|
-
gap:
|
|
210
|
+
gap: B
|
|
210
211
|
}, children: [
|
|
211
|
-
/* @__PURE__ */ p(
|
|
212
|
-
/* @__PURE__ */ p(
|
|
212
|
+
/* @__PURE__ */ p(g, { height: 24, width: 72 }),
|
|
213
|
+
/* @__PURE__ */ p(g, { height: 8, width: 48 })
|
|
213
214
|
] })
|
|
214
|
-
] }), e[3] =
|
|
215
|
+
] }), e[3] = f) : f = e[3];
|
|
215
216
|
let c;
|
|
216
|
-
return e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ x(h, { sx:
|
|
217
|
-
|
|
217
|
+
return e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ x(h, { sx: D.skeleton.graph.container, children: [
|
|
218
|
+
f,
|
|
218
219
|
/* @__PURE__ */ p(h, { sx: {
|
|
219
220
|
display: "flex",
|
|
220
221
|
alignItems: "center",
|
|
221
|
-
gap:
|
|
222
|
-
height:
|
|
223
|
-
}, children: Array(2).fill(0).map(
|
|
222
|
+
gap: V,
|
|
223
|
+
height: W
|
|
224
|
+
}, children: Array(2).fill(0).map(E) })
|
|
224
225
|
] }), e[4] = c) : c = e[4], c;
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
+
function E(e, n) {
|
|
227
228
|
return /* @__PURE__ */ x(h, { sx: {
|
|
228
229
|
display: "flex",
|
|
229
230
|
alignItems: "center",
|
|
230
|
-
gap:
|
|
231
|
+
gap: M
|
|
231
232
|
}, children: [
|
|
232
|
-
/* @__PURE__ */ p(
|
|
233
|
-
/* @__PURE__ */ p(
|
|
233
|
+
/* @__PURE__ */ p(g, { variant: "circular", width: 8, height: 8 }),
|
|
234
|
+
/* @__PURE__ */ p(g, { width: 48, height: 8 })
|
|
234
235
|
] }, `skeleton-${n}`);
|
|
235
236
|
}
|
|
236
|
-
function
|
|
237
|
+
function M(e) {
|
|
237
238
|
const {
|
|
238
239
|
spacing: n
|
|
239
240
|
} = e;
|
|
240
241
|
return n(1.5);
|
|
241
242
|
}
|
|
242
|
-
function
|
|
243
|
+
function W(e) {
|
|
243
244
|
const {
|
|
244
245
|
spacing: n
|
|
245
246
|
} = e;
|
|
246
247
|
return n(5);
|
|
247
248
|
}
|
|
248
|
-
function
|
|
249
|
+
function V(e) {
|
|
249
250
|
const {
|
|
250
251
|
spacing: n
|
|
251
252
|
} = e;
|
|
252
253
|
return n(2);
|
|
253
254
|
}
|
|
254
|
-
function
|
|
255
|
+
function B(e) {
|
|
255
256
|
const {
|
|
256
257
|
spacing: n
|
|
257
258
|
} = e;
|
|
258
259
|
return n(1);
|
|
259
260
|
}
|
|
260
261
|
export {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
te as PieSkeleton,
|
|
263
|
+
ee as pieConfig,
|
|
264
|
+
F as pieDownloadConfig
|
|
264
265
|
};
|
|
265
266
|
//# sourceMappingURL=pie.js.map
|