@carto/ps-react-ui 6.3.0 → 6.5.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.
Files changed (113) hide show
  1. package/dist/actions-D_PVFZaM.js +1272 -0
  2. package/dist/actions-D_PVFZaM.js.map +1 -0
  3. package/dist/{category-DULnoxvk.js → category-UIGvFN3D.js} +263 -246
  4. package/dist/category-UIGvFN3D.js.map +1 -0
  5. package/dist/chat.js +472 -470
  6. package/dist/chat.js.map +1 -1
  7. package/dist/{components-CTUpdQuj.js → components-DDJU4m0t.js} +8 -8
  8. package/dist/components-DDJU4m0t.js.map +1 -0
  9. package/dist/components.js +2 -2
  10. package/dist/{download-B4sykOFm.js → download-DIj1Iz0t.js} +2 -2
  11. package/dist/{download-B4sykOFm.js.map → download-DIj1Iz0t.js.map} +1 -1
  12. package/dist/{formula-DJS-JLpk.js → formula-CSHhAoyW.js} +4 -4
  13. package/dist/{formula-DJS-JLpk.js.map → formula-CSHhAoyW.js.map} +1 -1
  14. package/dist/{item-color-B7xkIpDZ.js → item-color-7o7pFBR2.js} +26 -18
  15. package/dist/item-color-7o7pFBR2.js.map +1 -0
  16. package/dist/markdown-B8lLR-NY.js +106 -0
  17. package/dist/markdown-B8lLR-NY.js.map +1 -0
  18. package/dist/scale-Bhx8HKEB.js +29 -0
  19. package/dist/scale-Bhx8HKEB.js.map +1 -0
  20. package/dist/{spread-CQwFIwuz.js → spread-BRfPPIep.js} +3 -3
  21. package/dist/{spread-CQwFIwuz.js.map → spread-BRfPPIep.js.map} +1 -1
  22. package/dist/style-DTLuIo84.js +87 -0
  23. package/dist/style-DTLuIo84.js.map +1 -0
  24. package/dist/{styles-BCEBm7xh.js → styles-yKcpfyNV.js} +5 -5
  25. package/dist/styles-yKcpfyNV.js.map +1 -0
  26. package/dist/{table-DEdW_fDj.js → table-Col_FRvb.js} +2 -2
  27. package/dist/{table-DEdW_fDj.js.map → table-Col_FRvb.js.map} +1 -1
  28. package/dist/theme/tailwind.css +373 -0
  29. package/dist/theme.js +123 -0
  30. package/dist/theme.js.map +1 -0
  31. package/dist/types/components/lasso-tool/styles.d.ts +4 -4
  32. package/dist/types/theme/create-carto-theme.d.ts +7 -0
  33. package/dist/types/theme/deep-merge.d.ts +6 -0
  34. package/dist/types/theme/generate-tailwind-css.d.ts +8 -0
  35. package/dist/types/theme/index.d.ts +2 -0
  36. package/dist/types/widgets/actions/index.d.ts +1 -1
  37. package/dist/types/widgets/actions/relative-data/index.d.ts +1 -0
  38. package/dist/types/widgets/actions/relative-data/labels.d.ts +3 -0
  39. package/dist/types/widgets/actions/relative-data/relative-data.d.ts +16 -2
  40. package/dist/types/widgets/actions/relative-data/scale.d.ts +26 -0
  41. package/dist/types/widgets/actions/relative-data/style.d.ts +12 -0
  42. package/dist/types/widgets/category/category.d.ts +2 -1
  43. package/dist/types/widgets/index.d.ts +1 -1
  44. package/dist/types/widgets/markdown/style.d.ts +74 -0
  45. package/dist/types/widgets/utils/spacing-px.d.ts +13 -0
  46. package/dist/{utils-C-eWwOhE.js → utils-Dw4y8tiq.js} +2 -2
  47. package/dist/{utils-C-eWwOhE.js.map → utils-Dw4y8tiq.js.map} +1 -1
  48. package/dist/widgets/actions.js +3 -3
  49. package/dist/widgets/bar.js +85 -84
  50. package/dist/widgets/bar.js.map +1 -1
  51. package/dist/widgets/category.js +1 -1
  52. package/dist/widgets/formula.js +1 -1
  53. package/dist/widgets/histogram.js +109 -108
  54. package/dist/widgets/histogram.js.map +1 -1
  55. package/dist/widgets/markdown.js +1 -1
  56. package/dist/widgets/pie.js +78 -78
  57. package/dist/widgets/pie.js.map +1 -1
  58. package/dist/widgets/scatterplot.js +121 -120
  59. package/dist/widgets/scatterplot.js.map +1 -1
  60. package/dist/widgets/spread.js +1 -1
  61. package/dist/widgets/table.js +1 -1
  62. package/dist/widgets/timeseries.js +91 -90
  63. package/dist/widgets/timeseries.js.map +1 -1
  64. package/dist/widgets/utils.js +1 -1
  65. package/dist/widgets.js +283 -279
  66. package/dist/widgets.js.map +1 -1
  67. package/dist/{zoom-toggle-MmLjMTEw.js → zoom-toggle-DqrV_0Ji.js} +2 -2
  68. package/dist/{zoom-toggle-MmLjMTEw.js.map → zoom-toggle-DqrV_0Ji.js.map} +1 -1
  69. package/package.json +8 -1
  70. package/src/chat/bubbles/styles.ts +2 -0
  71. package/src/components/lasso-tool/lasso-tool-inline.test.tsx +4 -4
  72. package/src/components/lasso-tool/lasso-tool-inline.tsx +6 -6
  73. package/src/components/lasso-tool/styles.ts +4 -4
  74. package/src/theme/create-carto-theme.test.ts +53 -0
  75. package/src/theme/create-carto-theme.ts +21 -0
  76. package/src/theme/deep-merge.test.ts +25 -0
  77. package/src/theme/deep-merge.ts +22 -0
  78. package/src/theme/generate-tailwind-css.test.ts +87 -0
  79. package/src/theme/generate-tailwind-css.ts +178 -0
  80. package/src/theme/index.ts +2 -0
  81. package/src/theme/tailwind-compile.test.ts +71 -0
  82. package/src/theme/tailwind.css +373 -0
  83. package/src/widgets/actions/index.ts +1 -0
  84. package/src/widgets/actions/relative-data/index.ts +1 -0
  85. package/src/widgets/actions/relative-data/labels.ts +6 -0
  86. package/src/widgets/actions/relative-data/relative-data.test.tsx +78 -1
  87. package/src/widgets/actions/relative-data/relative-data.tsx +137 -20
  88. package/src/widgets/actions/relative-data/scale.ts +48 -0
  89. package/src/widgets/actions/relative-data/style.ts +10 -0
  90. package/src/widgets/bar/options.test.ts +16 -0
  91. package/src/widgets/bar/options.ts +13 -8
  92. package/src/widgets/category/category.relative-data.test.tsx +51 -63
  93. package/src/widgets/category/category.tsx +25 -11
  94. package/src/widgets/histogram/options.ts +13 -8
  95. package/src/widgets/index.ts +1 -0
  96. package/src/widgets/markdown/style.ts +40 -0
  97. package/src/widgets/note/widget-note.tsx +4 -1
  98. package/src/widgets/pie/options.ts +5 -4
  99. package/src/widgets/scatterplot/options.test.ts +12 -0
  100. package/src/widgets/scatterplot/options.ts +25 -10
  101. package/src/widgets/timeseries/options.ts +13 -8
  102. package/src/widgets/utils/css-variables-theme.test.ts +32 -0
  103. package/src/widgets/utils/option-builders.ts +4 -6
  104. package/src/widgets/utils/spacing-px.test.ts +42 -0
  105. package/src/widgets/utils/spacing-px.ts +24 -0
  106. package/dist/actions-CkxKe8-J.js +0 -1160
  107. package/dist/actions-CkxKe8-J.js.map +0 -1
  108. package/dist/category-DULnoxvk.js.map +0 -1
  109. package/dist/components-CTUpdQuj.js.map +0 -1
  110. package/dist/item-color-B7xkIpDZ.js.map +0 -1
  111. package/dist/markdown-DmvLi3vx.js +0 -159
  112. package/dist/markdown-DmvLi3vx.js.map +0 -1
  113. package/dist/styles-BCEBm7xh.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ import { WidgetState } from '../../stores/types.js';
2
+ /**
3
+ * How far a bar reaches while `RelativeData` is on. The value is always
4
+ * the share of the series total; the scale only moves the end of the
5
+ * value axis: `'max'` ends it at the largest share so the top item fills
6
+ * the bar, `'total'` ends it at 100%.
7
+ */
8
+ export type RelativeScale = 'max' | 'total';
9
+ export declare const RELATIVE_DATA_ID = "relative-data";
10
+ /**
11
+ * The scale the value axis should use right now, or `null` when relative
12
+ * values are off. For widgets that size bars themselves (Category); the
13
+ * ECharts widgets get it through the config transform below.
14
+ */
15
+ export declare function selectRelativeScale(s: WidgetState): RelativeScale | null;
16
+ /**
17
+ * Config transform for `'total'`: pins the value axis to ±100. The widget
18
+ * mergers read numeric `yAxis.min` / `yAxis.max` back through
19
+ * {@link fixedAxisBounds} and apply each only on the side the data reaches.
20
+ */
21
+ export declare const toRelativeTotalAxis: (option: unknown) => unknown;
22
+ /** Numeric bounds a config transform set on the structural `yAxis`. */
23
+ export declare function fixedAxisBounds(yAxis: object): {
24
+ min?: number;
25
+ max?: number;
26
+ };
@@ -1,5 +1,9 @@
1
1
  import { Theme } from '@mui/material';
2
2
  export declare const styles: {
3
+ group: {
4
+ display: "inline-flex";
5
+ alignItems: "center";
6
+ };
3
7
  toggle: {
4
8
  p: number;
5
9
  '& .MuiSvgIcon-root': {
@@ -9,4 +13,12 @@ export declare const styles: {
9
13
  toggleActive: {
10
14
  background: (theme: Theme) => string;
11
15
  };
16
+ arrow: {
17
+ p: number;
18
+ width: number;
19
+ borderRadius: number;
20
+ '& .MuiSvgIcon-root': {
21
+ fontSize: number;
22
+ };
23
+ };
12
24
  };
@@ -29,7 +29,8 @@ export interface CategoryProps {
29
29
  * stay coherent across data transforms (e.g., the Searcher filtering
30
30
  * rows in and out — bars don't rescale just because the larger rows
31
31
  * got hidden). Pass an explicit number to fix the denominator
32
- * regardless of the data.
32
+ * regardless of the data. Ignored while `RelativeData` is on, whose
33
+ * `scale` decides the denominator instead.
33
34
  */
34
35
  maxOverride?: number;
35
36
  /**
@@ -96,7 +96,7 @@ export type { ToolboxLabels } from './toolbox/labels.js';
96
96
  export type { EchartProps, EchartUIProps, EchartsEventHandler } from './echart/index.js';
97
97
  export type { NoteProps, NoteMarkdownProps } from './note/widget-note.js';
98
98
  export type { NoteLabels } from './note/labels.js';
99
- export type { SearcherProps, SearcherToggleProps, StackToggleProps, ShowAllToggleProps, ZoomToggleProps, BrushToggleProps, RelativeDataProps, DownloadProps, DownloadItem, DownloadContext, FullScreenTriggerProps, FullScreenSlotProps, LockSelectionProps, LockSelectionKey, ChangeColumnProps, ChangeColumnItem, } from './actions/index.js';
99
+ export type { SearcherProps, SearcherToggleProps, StackToggleProps, ShowAllToggleProps, ZoomToggleProps, BrushToggleProps, RelativeDataProps, RelativeScale, DownloadProps, DownloadItem, DownloadContext, FullScreenTriggerProps, FullScreenSlotProps, LockSelectionProps, LockSelectionKey, ChangeColumnProps, ChangeColumnItem, } from './actions/index.js';
100
100
  export type { FormulaUIProps, FormulaDataItem, FormulaWidgetData, } from './formula/index.js';
101
101
  export type { MarkdownUIProps, MarkdownWidgetData } from './markdown/index.js';
102
102
  export type { PieDatum, PieWidgetData } from './pie/index.js';
@@ -1,3 +1,46 @@
1
+ /**
2
+ * Browser defaults that rendered Markdown relies on, restated with `revert`
3
+ * so a CSS reset in the app (Tailwind's preflight, for one) cannot strip
4
+ * them: list bullets and indent, link underline, blockquote margins, inline
5
+ * images, monospace fonts, `pre` margins, `sub`/`sup` placement. `revert`
6
+ * rolls back to the browser's own value, so pages without a reset render
7
+ * exactly as before.
8
+ *
9
+ * Wrapped in `:where()` so any element rule a consumer sets on top wins.
10
+ */
11
+ export declare const markdownElementDefaults: {
12
+ '& :where(ul, ol)': {
13
+ listStyle: string;
14
+ margin: string;
15
+ padding: string;
16
+ };
17
+ '& :where(a)': {
18
+ textDecoration: string;
19
+ };
20
+ '& :where(blockquote)': {
21
+ margin: string;
22
+ };
23
+ '& :where(code, kbd, samp)': {
24
+ fontFamily: string;
25
+ };
26
+ '& :where(img)': {
27
+ display: string;
28
+ verticalAlign: string;
29
+ maxWidth: string;
30
+ height: string;
31
+ };
32
+ '& :where(pre)': {
33
+ margin: string;
34
+ fontFamily: string;
35
+ fontSize: string;
36
+ };
37
+ '& :where(sub, sup)': {
38
+ fontSize: string;
39
+ lineHeight: string;
40
+ position: string;
41
+ verticalAlign: string;
42
+ };
43
+ };
1
44
  export declare const styles: {
2
45
  root: {
3
46
  color: "text.primary";
@@ -49,6 +92,37 @@ export declare const styles: {
49
92
  py: number;
50
93
  textAlign: "left";
51
94
  };
95
+ '& :where(ul, ol)': {
96
+ listStyle: string;
97
+ margin: string;
98
+ padding: string;
99
+ };
100
+ '& :where(a)': {
101
+ textDecoration: string;
102
+ };
103
+ '& :where(blockquote)': {
104
+ margin: string;
105
+ };
106
+ '& :where(code, kbd, samp)': {
107
+ fontFamily: string;
108
+ };
109
+ '& :where(img)': {
110
+ display: string;
111
+ verticalAlign: string;
112
+ maxWidth: string;
113
+ height: string;
114
+ };
115
+ '& :where(pre)': {
116
+ margin: string;
117
+ fontFamily: string;
118
+ fontSize: string;
119
+ };
120
+ '& :where(sub, sup)': {
121
+ fontSize: string;
122
+ lineHeight: string;
123
+ position: string;
124
+ verticalAlign: string;
125
+ };
52
126
  };
53
127
  paragraph: {
54
128
  my: number;
@@ -0,0 +1,13 @@
1
+ import { Theme } from '@mui/material';
2
+ /**
3
+ * Theme spacing as a pixel number, for APIs that need numbers (ECharts).
4
+ *
5
+ * `theme.spacing(n)` returns `"8px"` for a regular theme but
6
+ * `"var(--mui-spacing, 8px)"` / `"calc(...)"` once the theme uses
7
+ * `cssVariables`, which does not parse. Resolution order:
8
+ * 1. `parseFloat` of `theme.spacing(factor)` (regular themes);
9
+ * 2. the px unit MUI writes into `theme.spacing(1)` (`var(--mui-spacing, Npx)`),
10
+ * which honours a `spacing` override such as `createCartoTheme({ spacing: 4 })`;
11
+ * 3. meridian's numeric `spacingValue`, or MUI's default 8px.
12
+ */
13
+ export declare function spacingPx(theme: Theme, factor: number): number;
@@ -1,4 +1,4 @@
1
- import { r as e } from "./zoom-toggle-MmLjMTEw.js";
1
+ import { r as e } from "./zoom-toggle-DqrV_0Ji.js";
2
2
  //#region src/widgets/utils/merge-options.ts
3
3
  function t(e, t) {
4
4
  if (!t) return e;
@@ -55,4 +55,4 @@ function a(e, t) {
55
55
  //#endregion
56
56
  export { i as n, t as r, a as t };
57
57
 
58
- //# sourceMappingURL=utils-C-eWwOhE.js.map
58
+ //# sourceMappingURL=utils-Dw4y8tiq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-C-eWwOhE.js","names":["ZOOM_LAYOUT","mergeOptions","override","base","out","key","b","mergeValue","a","len","result","i","av","bv","isPlainObject","v","proto","positionDataZoomForLegend","dataZoom","entry","dz","hasLegend","resolveThemeColor","raw","parts","cursor","theme","part"],"sources":["../src/widgets/utils/merge-options.ts","../src/widgets/utils/data-zoom-layout.ts","../src/widgets/utils/resolve-theme-color.ts"],"sourcesContent":["/**\n * Shallow-merges two ECharts option objects:\n * - Top-level keys from both are combined.\n * - Arrays are merged by index (element-wise shallow merge, primitive override).\n * - Plain objects are shallow-merged.\n * - Primitives are overridden by the override value.\n *\n * Designed for the two-stage memoization pattern: first build a base option\n * object from data + theme + formatters, then call `mergeOptions(base, override)`\n * inside a second `useMemo` keyed on `[base, override]`.\n */\nexport function mergeOptions<T extends Record<string, unknown>>(\n base: T,\n override?: Partial<T>,\n): T {\n if (!override) return base\n const out: Record<string, unknown> = { ...base }\n for (const key of Object.keys(override) as (keyof T)[]) {\n const a = base[key]\n const b = override[key]\n if (b === undefined) continue\n out[key as string] = mergeValue(a, b)\n }\n return out as T\n}\n\nfunction mergeValue(a: unknown, b: unknown): unknown {\n if (Array.isArray(a) && Array.isArray(b)) {\n const len = Math.max(a.length, b.length)\n const result = new Array<unknown>(len)\n for (let i = 0; i < len; i++) {\n const av: unknown = a[i]\n const bv: unknown = b[i]\n if (bv === undefined) result[i] = av\n else if (av === undefined) result[i] = bv\n else result[i] = mergeValue(av, bv)\n }\n return result\n }\n if (isPlainObject(a) && isPlainObject(b)) {\n return { ...a, ...b }\n }\n return b\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n if (v === null || typeof v !== 'object') return false\n const proto = Object.getPrototypeOf(v) as unknown\n return proto === Object.prototype || proto === null\n}\n","import { ZOOM_LAYOUT } from '../actions/zoom-toggle'\n\n/**\n * If the option includes a `dataZoom` array (from ZoomToggle's transform),\n * lift any slider entries above the legend row so they don't overlap.\n * Returns `null` when there is no `dataZoom` — caller skips the layout\n * adjustment entirely.\n *\n * Shared between bar, histogram, and timeseries — every widget with a\n * horizontal x-axis dataZoom slider needs the same offset when a legend\n * is rendered below the plot.\n */\nexport function positionDataZoomForLegend(\n dataZoom: unknown,\n hasLegend: boolean,\n): unknown[] | null {\n if (!Array.isArray(dataZoom) || dataZoom.length === 0) return null\n return dataZoom.map((entry: unknown) => {\n if (entry == null || typeof entry !== 'object') return entry\n const dz = entry as { type?: string; bottom?: number }\n if (dz.type === 'slider' && hasLegend) {\n return { ...dz, bottom: ZOOM_LAYOUT.sliderBottomWithLegend }\n }\n return dz\n })\n}\n","import type { Theme } from '@mui/material'\n\n/**\n * Resolve a colour string against the MUI theme palette.\n *\n * - `'primary.main'`, `'secondary.dark'`, `'success.contrastText'`, … →\n * walks `theme.palette` along the dot-separated path and returns the\n * resolved string when traversal succeeds.\n * - `'#ff0000'`, `'rgb(255, 0, 0)'`, `'red'` → returned as-is (assumed\n * raw CSS; ECharts consumes them directly).\n * - `undefined` → `undefined` (callers fall back to ECharts' palette).\n *\n * Used by the echart option factories (Bar, Pie, Histogram, Scatterplot,\n * Timeseries) so per-series colours specified as theme paths in the\n * unified `WidgetSeries` shape paint correctly. Category, Formula, and\n * Spread render colours through MUI's `sx` resolver, which already\n * handles theme paths — they don't need this helper.\n */\nexport function resolveThemeColor(\n theme: Theme,\n raw: string | undefined,\n): string | undefined {\n if (raw == null) return undefined\n if (!raw.includes('.')) return raw\n const parts = raw.split('.')\n let cursor: unknown = theme.palette\n for (const part of parts) {\n if (cursor == null || typeof cursor !== 'object') {\n return raw\n }\n cursor = (cursor as Record<string, unknown>)[part]\n }\n return typeof cursor === 'string' ? cursor : raw\n}\n"],"mappings":";;AAWA,SAAgBC,EACd,GACA,GACG;CACH,IAAI,CAACC,GAAU,OAAOC;CACtB,IAAMC,IAA+B,EAAE,GAAGD,EAAK;CAC/C,KAAK,IAAME,KAAO,OAAO,KAAKH,CAAQ,GAAkB;EACtD,IAAM,IAAIC,EAAKE,IACTC,IAAIJ,EAASG;EACnB,AAAIC,MAAM,KAAA,MACV,EAAID,KAAiBE,EAAW,GAAGD,CAAC;CACtC;CACA,OAAOF;AACT;AAEA,SAASG,EAAW,GAAY,GAAqB;CACnD,IAAI,MAAM,QAAQC,CAAC,KAAK,MAAM,QAAQF,CAAC,GAAG;EACxC,IAAMG,IAAM,KAAK,IAAID,EAAE,QAAQF,EAAE,MAAM,GACjCI,IAAa,MAAeD,CAAG;EACrC,KAAK,IAAIE,IAAI,GAAGA,IAAIF,GAAK,KAAK;GAC5B,IAAMG,IAAcJ,EAAEG,IAChBE,IAAcP,EAAEK;GACtB,AAAIE,MAAO,KAAA,IAAW,EAAOF,KAAKC,IACzBA,MAAO,KAAA,IAAW,EAAOD,KAAKE,IAClC,EAAOF,KAAKJ,EAAWK,GAAIC,CAAE;EACpC;EACA,OAAOH;CACT;CAIA,OAHII,EAAcN,CAAC,KAAKM,EAAcR,CAAC,IAC9B;EAAE,GAAGE;EAAG,GAAGF;CAAE,IAEfA;AACT;AAEA,SAASQ,EAAc,GAA0C;CAC/D,IAAkB,OAAOC,KAAM,aAA3BA,GAAqC,OAAO;CAChD,IAAMC,IAAQ,OAAO,eAAeD,CAAC;CACrC,OAAOC,MAAU,OAAO,aAAaA,MAAU;AACjD;;;ACrCA,SAAgBC,EACd,GACA,GACkB;CAElB,OADI,CAAC,MAAM,QAAQC,CAAQ,KAAKA,EAAS,WAAW,IAAU,OACvDA,EAAS,KAAK,MAAmB;EACtC,IAAqB,OAAOC,KAAU,aAAlCA,GAA4C,OAAOA;EACvD,IAAMC,IAAKD;EAIX,OAHIC,EAAG,SAAS,YAAYC,IACnB;GAAE,GAAGD;GAAI,QAAQpB,EAAY;EAAuB,IAEtDoB;CACT,CAAC;AACH;;;ACPA,SAAgBE,EACd,GACA,GACoB;CACpB,IAAIC,KAAO,MAAM;CACjB,IAAI,CAACA,EAAI,SAAS,GAAG,GAAG,OAAOA;CAC/B,IAAMC,IAAQD,EAAI,MAAM,GAAG,GACvBE,IAAkBC,EAAM;CAC5B,KAAK,IAAMC,KAAQH,GAAO;EACxB,IAAsB,OAAOC,KAAW,aAApCA,GACF,OAAOF;EAET,IAAUE,EAAmCE;CAC/C;CACA,OAAO,OAAOF,KAAW,WAAWA,IAASF;AAC/C"}
1
+ {"version":3,"file":"utils-Dw4y8tiq.js","names":["ZOOM_LAYOUT","mergeOptions","override","base","out","key","b","mergeValue","a","len","result","i","av","bv","isPlainObject","v","proto","positionDataZoomForLegend","dataZoom","entry","dz","hasLegend","resolveThemeColor","raw","parts","cursor","theme","part"],"sources":["../src/widgets/utils/merge-options.ts","../src/widgets/utils/data-zoom-layout.ts","../src/widgets/utils/resolve-theme-color.ts"],"sourcesContent":["/**\n * Shallow-merges two ECharts option objects:\n * - Top-level keys from both are combined.\n * - Arrays are merged by index (element-wise shallow merge, primitive override).\n * - Plain objects are shallow-merged.\n * - Primitives are overridden by the override value.\n *\n * Designed for the two-stage memoization pattern: first build a base option\n * object from data + theme + formatters, then call `mergeOptions(base, override)`\n * inside a second `useMemo` keyed on `[base, override]`.\n */\nexport function mergeOptions<T extends Record<string, unknown>>(\n base: T,\n override?: Partial<T>,\n): T {\n if (!override) return base\n const out: Record<string, unknown> = { ...base }\n for (const key of Object.keys(override) as (keyof T)[]) {\n const a = base[key]\n const b = override[key]\n if (b === undefined) continue\n out[key as string] = mergeValue(a, b)\n }\n return out as T\n}\n\nfunction mergeValue(a: unknown, b: unknown): unknown {\n if (Array.isArray(a) && Array.isArray(b)) {\n const len = Math.max(a.length, b.length)\n const result = new Array<unknown>(len)\n for (let i = 0; i < len; i++) {\n const av: unknown = a[i]\n const bv: unknown = b[i]\n if (bv === undefined) result[i] = av\n else if (av === undefined) result[i] = bv\n else result[i] = mergeValue(av, bv)\n }\n return result\n }\n if (isPlainObject(a) && isPlainObject(b)) {\n return { ...a, ...b }\n }\n return b\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n if (v === null || typeof v !== 'object') return false\n const proto = Object.getPrototypeOf(v) as unknown\n return proto === Object.prototype || proto === null\n}\n","import { ZOOM_LAYOUT } from '../actions/zoom-toggle'\n\n/**\n * If the option includes a `dataZoom` array (from ZoomToggle's transform),\n * lift any slider entries above the legend row so they don't overlap.\n * Returns `null` when there is no `dataZoom` — caller skips the layout\n * adjustment entirely.\n *\n * Shared between bar, histogram, and timeseries — every widget with a\n * horizontal x-axis dataZoom slider needs the same offset when a legend\n * is rendered below the plot.\n */\nexport function positionDataZoomForLegend(\n dataZoom: unknown,\n hasLegend: boolean,\n): unknown[] | null {\n if (!Array.isArray(dataZoom) || dataZoom.length === 0) return null\n return dataZoom.map((entry: unknown) => {\n if (entry == null || typeof entry !== 'object') return entry\n const dz = entry as { type?: string; bottom?: number }\n if (dz.type === 'slider' && hasLegend) {\n return { ...dz, bottom: ZOOM_LAYOUT.sliderBottomWithLegend }\n }\n return dz\n })\n}\n","import type { Theme } from '@mui/material'\n\n/**\n * Resolve a colour string against the MUI theme palette.\n *\n * - `'primary.main'`, `'secondary.dark'`, `'success.contrastText'`, … →\n * walks `theme.palette` along the dot-separated path and returns the\n * resolved string when traversal succeeds.\n * - `'#ff0000'`, `'rgb(255, 0, 0)'`, `'red'` → returned as-is (assumed\n * raw CSS; ECharts consumes them directly).\n * - `undefined` → `undefined` (callers fall back to ECharts' palette).\n *\n * Used by the echart option factories (Bar, Pie, Histogram, Scatterplot,\n * Timeseries) so per-series colours specified as theme paths in the\n * unified `WidgetSeries` shape paint correctly. Category, Formula, and\n * Spread render colours through MUI's `sx` resolver, which already\n * handles theme paths — they don't need this helper.\n */\nexport function resolveThemeColor(\n theme: Theme,\n raw: string | undefined,\n): string | undefined {\n if (raw == null) return undefined\n if (!raw.includes('.')) return raw\n const parts = raw.split('.')\n let cursor: unknown = theme.palette\n for (const part of parts) {\n if (cursor == null || typeof cursor !== 'object') {\n return raw\n }\n cursor = (cursor as Record<string, unknown>)[part]\n }\n return typeof cursor === 'string' ? cursor : raw\n}\n"],"mappings":";;AAWA,SAAgBC,EACd,GACA,GACG;CACH,IAAI,CAACC,GAAU,OAAOC;CACtB,IAAMC,IAA+B,EAAE,GAAGD,EAAK;CAC/C,KAAK,IAAME,KAAO,OAAO,KAAKH,CAAQ,GAAkB;EACtD,IAAM,IAAIC,EAAKE,IACTC,IAAIJ,EAASG;EACnB,AAAIC,MAAM,KAAA,MACV,EAAID,KAAiBE,EAAW,GAAGD,CAAC;CACtC;CACA,OAAOF;AACT;AAEA,SAASG,EAAW,GAAY,GAAqB;CACnD,IAAI,MAAM,QAAQC,CAAC,KAAK,MAAM,QAAQF,CAAC,GAAG;EACxC,IAAMG,IAAM,KAAK,IAAID,EAAE,QAAQF,EAAE,MAAM,GACjCI,IAAa,MAAeD,CAAG;EACrC,KAAK,IAAIE,IAAI,GAAGA,IAAIF,GAAK,KAAK;GAC5B,IAAMG,IAAcJ,EAAEG,IAChBE,IAAcP,EAAEK;GACtB,AAAIE,MAAO,KAAA,IAAW,EAAOF,KAAKC,IACzBA,MAAO,KAAA,IAAW,EAAOD,KAAKE,IAClC,EAAOF,KAAKJ,EAAWK,GAAIC,CAAE;EACpC;EACA,OAAOH;CACT;CAIA,OAHII,EAAcN,CAAC,KAAKM,EAAcR,CAAC,IAC9B;EAAE,GAAGE;EAAG,GAAGF;CAAE,IAEfA;AACT;AAEA,SAASQ,EAAc,GAA0C;CAC/D,IAAkB,OAAOC,KAAM,aAA3BA,GAAqC,OAAO;CAChD,IAAMC,IAAQ,OAAO,eAAeD,CAAC;CACrC,OAAOC,MAAU,OAAO,aAAaA,MAAU;AACjD;;;ACrCA,SAAgBC,EACd,GACA,GACkB;CAElB,OADI,CAAC,MAAM,QAAQC,CAAQ,KAAKA,EAAS,WAAW,IAAU,OACvDA,EAAS,KAAK,MAAmB;EACtC,IAAqB,OAAOC,KAAU,aAAlCA,GAA4C,OAAOA;EACvD,IAAMC,IAAKD;EAIX,OAHIC,EAAG,SAAS,YAAYC,IACnB;GAAE,GAAGD;GAAI,QAAQpB,EAAY;EAAuB,IAEtDoB;CACT,CAAC;AACH;;;ACPA,SAAgBE,EACd,GACA,GACoB;CACpB,IAAIC,KAAO,MAAM;CACjB,IAAI,CAACA,EAAI,SAAS,GAAG,GAAG,OAAOA;CAC/B,IAAMC,IAAQD,EAAI,MAAM,GAAG,GACvBE,IAAkBC,EAAM;CAC5B,KAAK,IAAMC,KAAQH,GAAO;EACxB,IAAsB,OAAOC,KAAW,aAApCA,GACF,OAAOF;EAET,IAAUE,EAAmCE;CAC/C;CACA,OAAO,OAAOF,KAAW,WAAWA,IAASF;AAC/C"}
@@ -1,4 +1,4 @@
1
- import { C as e, E as t, S as n, T as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "../actions-CkxKe8-J.js";
2
- import { a as E, i as D, n as O, r as k, t as A } from "../zoom-toggle-MmLjMTEw.js";
3
- import { a as j, c as M, d as N, f as P, i as F, l as I, n as L, o as R, p as z, r as B, s as V, t as H, u as U } from "../download-B4sykOFm.js";
1
+ import { C as e, E as t, S as n, T as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "../actions-D_PVFZaM.js";
2
+ import { a as E, i as D, n as O, r as k, t as A } from "../zoom-toggle-DqrV_0Ji.js";
3
+ import { a as j, c as M, d as N, f as P, i as F, l as I, n as L, o as R, p as z, r as B, s as V, t as H, u as U } from "../download-DIj1Iz0t.js";
4
4
  export { l as BrushToggle, j as CSVIcon, b as ChangeColumn, _ as DEFAULT_BRUSH_TOGGLE_LABELS, h as DEFAULT_CHANGE_COLUMN_LABELS, I as DEFAULT_DOWNLOAD_LABELS, y as DEFAULT_FULLSCREEN_LABELS, f as DEFAULT_LOCK_SELECTION_LABELS, p as DEFAULT_RELATIVE_DATA_LABELS, r as DEFAULT_SEARCHER_LABELS, S as DEFAULT_SHOW_ALL_LABELS, o as DEFAULT_STACK_TOGGLE_LABELS, O as DEFAULT_ZOOM_TOGGLE_LABELS, F as DOWNLOAD_ITEM_IDS, M as Download, g as FullScreen, v as LockSelection, R as MarkdownIcon, V as PNGIcon, s as RelativeData, d as SHOW_ALL_ID, n as Searcher, e as SearcherToggle, u as ShowAllToggle, T as StackToggle, k as ZOOM_LAYOUT, A as ZoomToggle, m as addBrush, w as addStack, D as addZoom, L as buildCsvDownloadItem, B as buildPngDownloadItem, E as createAddZoom, x as createPercentFormatter, U as downloadDOMToPNG, N as downloadToCSV, a as filterByLockedItems, t as filterBySearchText, C as setSearcherText, i as setShowAll, P as toCsvString, c as toRelativeData, z as triggerLinkDownload, H as withPngItem };
@@ -1,37 +1,38 @@
1
- import { r as e } from "../zoom-toggle-MmLjMTEw.js";
2
- import { n as t, t as n } from "../download-B4sykOFm.js";
3
- import { n as r, r as i, t as a } from "../utils-C-eWwOhE.js";
4
- import { c as o, i as s, n as c, o as l, r as u, s as d, t as f } from "../item-color-B7xkIpDZ.js";
5
- import { c as p } from "react/compiler-runtime";
6
- import { Box as m, Skeleton as h } from "@mui/material";
7
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
8
- import * as v from "echarts";
1
+ import { r as e } from "../zoom-toggle-DqrV_0Ji.js";
2
+ import { n as t } from "../scale-Bhx8HKEB.js";
3
+ import { n, t as r } from "../download-DIj1Iz0t.js";
4
+ import { n as i, r as a, t as o } from "../utils-Dw4y8tiq.js";
5
+ import { c as s, i as c, l, n as u, o as d, r as f, s as p, t as m } from "../item-color-7o7pFBR2.js";
6
+ import { c as h } from "react/compiler-runtime";
7
+ import { Box as g, Skeleton as _ } from "@mui/material";
8
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
9
+ import * as b from "echarts";
9
10
  //#region src/widgets/bar/options.ts
10
- function y({ theme: e, formatter: t, labelFormatter: n }) {
11
+ function x({ theme: e, formatter: t, labelFormatter: n }) {
11
12
  let r = 0, i = 1;
12
13
  return {
13
14
  grid: {
14
- left: parseInt(e.spacing(1)),
15
- top: parseInt(e.spacing(3)),
16
- right: parseInt(e.spacing(1)),
17
- ...u(!1, e),
15
+ left: l(e, 1),
16
+ top: l(e, 3),
17
+ right: l(e, 1),
18
+ ...f(!1, e),
18
19
  containLabel: !0
19
20
  },
20
21
  tooltip: {
21
22
  trigger: "axis",
22
23
  backgroundColor: e.palette.grey[900],
23
24
  borderWidth: 0,
24
- padding: [parseInt(e.spacing(1)), parseInt(e.spacing(1))],
25
+ padding: [l(e, 1), l(e, 1)],
25
26
  textStyle: {
26
27
  color: e.palette.common.white,
27
28
  fontSize: 11,
28
29
  fontFamily: e.typography.caption.fontFamily
29
30
  },
30
31
  axisPointer: { type: "line" },
31
- position: d(e),
32
- formatter: x(t, n)
32
+ position: p(e),
33
+ formatter: C(t, n)
33
34
  },
34
- legend: { ...s({
35
+ legend: { ...c({
35
36
  hasLegend: !1,
36
37
  labelFormatter: n
37
38
  }) },
@@ -42,9 +43,9 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
42
43
  axisLine: { show: !1 },
43
44
  axisTick: { show: !1 },
44
45
  axisLabel: {
45
- ...c(e),
46
+ ...u(e),
46
47
  padding: [
47
- parseInt(e.spacing(.5)),
48
+ l(e, .5),
48
49
  0,
49
50
  0,
50
51
  0
@@ -57,8 +58,8 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
57
58
  },
58
59
  yAxis: {
59
60
  type: "value",
60
- min: (e) => (r = e.min < 0 ? o(e.min) : 0, r),
61
- max: (e) => (i = e.max <= 0 ? 1 : o(e.max), i),
61
+ min: (e) => (r = e.min < 0 ? s(e.min) : 0, r),
62
+ max: (e) => (i = e.max <= 0 ? 1 : s(e.max), i),
62
63
  axisLine: { show: !1 },
63
64
  axisTick: { show: !1 },
64
65
  splitLine: {
@@ -66,8 +67,8 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
66
67
  lineStyle: { color: e.palette.black?.[4] ?? e.palette.divider }
67
68
  },
68
69
  axisLabel: {
69
- ...c(e),
70
- margin: parseInt(e.spacing(1)),
70
+ ...u(e),
71
+ margin: l(e, 1),
71
72
  show: !0,
72
73
  showMaxLabel: !0,
73
74
  showMinLabel: !0,
@@ -78,84 +79,84 @@ function y({ theme: e, formatter: t, labelFormatter: n }) {
78
79
  }
79
80
  };
80
81
  }
81
- function b(t) {
82
- let { theme: n, formatter: s, labelFormatter: c, optionsOverride: l } = t, u = t.series, d = t.selection, p = d && d.length > 0 ? new Set(d) : null;
83
- return (t, d, m) => {
84
- if (t == null) {
85
- let e = y({
86
- theme: n,
87
- formatter: s,
88
- labelFormatter: c
82
+ function S(n) {
83
+ let { theme: r, formatter: c, labelFormatter: l, optionsOverride: u } = n, d = n.series, f = n.selection, p = f && f.length > 0 ? new Set(f) : null;
84
+ return (n, f, h) => {
85
+ if (n == null) {
86
+ let e = x({
87
+ theme: r,
88
+ formatter: c,
89
+ labelFormatter: l
89
90
  });
90
- return l ? i(e, l) : e;
91
+ return u ? a(e, u) : e;
91
92
  }
92
- let h = Array.isArray(d) ? d : [];
93
- if (h.length === 0) return {
94
- ...t,
93
+ let g = Array.isArray(f) ? f : [];
94
+ if (g.length === 0) return {
95
+ ...n,
95
96
  dataset: [],
96
97
  series: []
97
98
  };
98
- let g = h.length > 1, _ = typeof t.legend == "object" && !Array.isArray(t.legend) ? t.legend : {}, b = typeof t.grid == "object" && !Array.isArray(t.grid) ? t.grid : {}, S = typeof t.tooltip == "object" && !Array.isArray(t.tooltip) ? t.tooltip : {}, C = typeof t.yAxis == "object" && !Array.isArray(t.yAxis) ? t.yAxis : {}, w = Array.isArray(t.series) ? t.series : [], T = w[0] ?? {}, E = m?.formatter, D = m?.labelFormatter, O = 0, k = 1, A = r(t.dataZoom, g), j = typeof b.bottom == "number" ? b.bottom : 24, M = g ? 56 : j, N = A ? M + e.sliderHeight + e.sliderGap : M, P = (e, t) => {
99
- let r = f({
100
- theme: n,
99
+ let _ = g.length > 1, v = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, y = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, S = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, w = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, T = t(w), E = Array.isArray(n.series) ? n.series : [], D = E[0] ?? {}, O = h?.formatter, k = h?.labelFormatter, A = 0, j = 1, M = i(n.dataZoom, _), N = typeof y.bottom == "number" ? y.bottom : 24, P = _ ? 56 : N, F = M ? P + e.sliderHeight + e.sliderGap : P, I = (e, t) => {
100
+ let n = m({
101
+ theme: r,
101
102
  datums: e,
102
103
  template: t,
103
104
  fallback: (e) => e.color
104
105
  });
105
106
  return { color: (e) => {
106
- let t = r(e);
107
+ let t = n(e);
107
108
  if (!p) return t;
108
- let n = e.value?.name ?? e.name;
109
- return n != null && p.has(n) ? t : v.color.modifyAlpha(t, .15);
109
+ let r = e.value?.name ?? e.name;
110
+ return r != null && p.has(r) ? t : b.color.modifyAlpha(t, .15);
110
111
  } };
111
112
  };
112
113
  return {
113
- ...t,
114
- dataset: h.map((e) => ({ source: e })),
115
- series: h.map((e, t) => {
116
- let r = w[t] ?? T, i = a(n, u?.[t]?.color);
114
+ ...n,
115
+ dataset: g.map((e) => ({ source: e })),
116
+ series: g.map((e, t) => {
117
+ let n = E[t] ?? D, i = o(r, d?.[t]?.color);
117
118
  return {
118
- ...typeof r == "object" ? r : {},
119
+ ...typeof n == "object" ? n : {},
119
120
  type: "bar",
120
121
  datasetIndex: t,
121
- name: u?.[t]?.name ?? `Series ${t + 1}`,
122
+ name: d?.[t]?.name ?? `Series ${t + 1}`,
122
123
  encode: {
123
124
  x: "name",
124
125
  y: "value"
125
126
  },
126
127
  barMaxWidth: 100,
127
128
  emphasis: { focus: "series" },
128
- itemStyle: P(e, r),
129
+ itemStyle: I(e, n),
129
130
  ...i ? { color: i } : {}
130
131
  };
131
132
  }),
132
133
  legend: {
133
- ..._,
134
- show: g
134
+ ...v,
135
+ show: _
135
136
  },
136
137
  grid: {
137
- ...b,
138
- bottom: N
138
+ ...y,
139
+ bottom: F
139
140
  },
140
- ...A ? { dataZoom: A } : {},
141
+ ...M ? { dataZoom: M } : {},
141
142
  yAxis: {
142
- ...C,
143
- min: (e) => (O = e.min < 0 ? o(e.min) : 0, O),
144
- max: (e) => (k = e.max <= 0 ? 1 : o(e.max), k),
143
+ ...w,
144
+ min: (e) => (A = e.min < 0 ? T.min ?? s(e.min) : 0, A),
145
+ max: (e) => (j = e.max <= 0 ? 1 : T.max ?? s(e.max), j),
145
146
  axisLabel: {
146
- ...C.axisLabel ?? {},
147
- formatter: (e) => e !== k && e !== O || e === 0 ? "" : E ? E(e) : String(e)
147
+ ...w.axisLabel ?? {},
148
+ formatter: (e) => e !== j && e !== A || e === 0 ? "" : O ? O(e) : String(e)
148
149
  }
149
150
  },
150
151
  tooltip: {
151
152
  ...S,
152
- formatter: x(E, D)
153
+ formatter: C(O, k)
153
154
  }
154
155
  };
155
156
  };
156
157
  }
157
- function x(e, t) {
158
- return l((n) => {
158
+ function C(e, t) {
159
+ return d((n) => {
159
160
  let r = n.value?.value, i = typeof r == "number" && e ? e(r) : r ?? "", a = typeof n.marker == "string" ? n.marker : "", o = n.seriesName ? `${n.seriesName}: ` : "", s = t ? String(t(n.name ?? "")) : n.name ?? "";
160
161
  return {
161
162
  name: String(s),
@@ -167,7 +168,7 @@ function x(e, t) {
167
168
  }
168
169
  //#endregion
169
170
  //#region src/widgets/bar/skeleton.tsx
170
- var S = {
171
+ var w = {
171
172
  container: {
172
173
  display: "flex",
173
174
  alignItems: "center",
@@ -199,52 +200,52 @@ var S = {
199
200
  alignItems: "center",
200
201
  gap: ({ spacing: e }) => e(1.5)
201
202
  }
202
- }, C = [
203
+ }, T = [
203
204
  "20%",
204
205
  "40%",
205
206
  "60%",
206
207
  "20%",
207
208
  "80%"
208
209
  ];
209
- function w() {
210
- let e = p(2), t;
211
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ g(m, {
212
- sx: S.grid,
213
- children: C.map(E)
210
+ function E() {
211
+ let e = h(2), t;
212
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ v(g, {
213
+ sx: w.grid,
214
+ children: T.map(O)
214
215
  }), e[0] = t) : t = e[0];
215
216
  let n;
216
- return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ _(m, {
217
- sx: S.container,
218
- children: [t, /* @__PURE__ */ g(m, {
219
- sx: S.legend,
220
- children: [0, 1].map(T)
217
+ return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ y(g, {
218
+ sx: w.container,
219
+ children: [t, /* @__PURE__ */ v(g, {
220
+ sx: w.legend,
221
+ children: [0, 1].map(D)
221
222
  })]
222
223
  }), e[1] = n) : n = e[1], n;
223
224
  }
224
- function T(e) {
225
- return /* @__PURE__ */ _(m, {
226
- sx: S.legendItem,
227
- children: [/* @__PURE__ */ g(h, {
225
+ function D(e) {
226
+ return /* @__PURE__ */ y(g, {
227
+ sx: w.legendItem,
228
+ children: [/* @__PURE__ */ v(_, {
228
229
  variant: "circular",
229
230
  width: 8,
230
231
  height: 8
231
- }), /* @__PURE__ */ g(h, {
232
+ }), /* @__PURE__ */ v(_, {
232
233
  width: 48,
233
234
  height: 8
234
235
  })]
235
236
  }, `legend-${e}`);
236
237
  }
237
- function E(e, t) {
238
- return /* @__PURE__ */ g(h, {
239
- sx: S.bar,
238
+ function O(e, t) {
239
+ return /* @__PURE__ */ v(_, {
240
+ sx: w.bar,
240
241
  variant: "rectangular",
241
242
  height: e
242
243
  }, `bar-${t}`);
243
244
  }
244
245
  //#endregion
245
246
  //#region src/widgets/bar/download.tsx
246
- function D(e) {
247
- return n(e, t({
247
+ function k(e) {
248
+ return r(e, n({
248
249
  filename: e.filename,
249
250
  getRows: (t) => {
250
251
  let n = e.getData(t), r = [];
@@ -257,6 +258,6 @@ function D(e) {
257
258
  }));
258
259
  }
259
260
  //#endregion
260
- export { w as BarSkeleton, y as barOptions, D as createBarDownloadConfig, b as createBarOptionFactory };
261
+ export { E as BarSkeleton, x as barOptions, k as createBarDownloadConfig, S as createBarOptionFactory };
261
262
 
262
263
  //# sourceMappingURL=bar.js.map