@milaboratories/miplots4 1.0.165 → 1.0.166

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 (58) hide show
  1. package/dist/_virtual/index10.js +2 -5
  2. package/dist/_virtual/index10.js.map +1 -1
  3. package/dist/_virtual/index5.js +5 -2
  4. package/dist/_virtual/index5.js.map +1 -1
  5. package/dist/_virtual/index6.js +4 -4
  6. package/dist/_virtual/index7.js +1 -1
  7. package/dist/_virtual/index8.js +4 -4
  8. package/dist/_virtual/index9.js +3 -3
  9. package/dist/bubble/components/ChartsGroup.js +21 -21
  10. package/dist/bubble/components/ChartsGroup.js.map +1 -1
  11. package/dist/common/Tooltip.d.ts +2 -1
  12. package/dist/common/Tooltip.js +147 -143
  13. package/dist/common/Tooltip.js.map +1 -1
  14. package/dist/discrete/DiscreteSettingsImpl.d.ts +11 -31
  15. package/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  16. package/dist/discrete/components/Chart.js +143 -143
  17. package/dist/discrete/components/Chart.js.map +1 -1
  18. package/dist/discrete/layers/stats/pValueCalculation.js +5 -5
  19. package/dist/heatmap/components/ChartsGroup.js +9 -9
  20. package/dist/heatmap/components/ChartsGroup.js.map +1 -1
  21. package/dist/node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/index.js +1 -1
  22. package/dist/scatterplot/components/ChartTooltip.js +34 -33
  23. package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
  24. package/dist/scatterplot/components/ChartsGroup.js +31 -31
  25. package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
  26. package/dist/scatterplot/dots.d.ts +2 -2
  27. package/dist/scatterplot/dots.js +9 -9
  28. package/dist/scatterplot/dots.js.map +1 -1
  29. package/dist/scatterplot/index.js +1 -1
  30. package/dist/scatterplot/index.js.map +1 -1
  31. package/dist/scatterplot/utils/sortDotsByGrouping.d.ts +2 -1
  32. package/dist/scatterplot/utils/sortDotsByGrouping.js +22 -11
  33. package/dist/scatterplot/utils/sortDotsByGrouping.js.map +1 -1
  34. package/dist/scatterplot-umap/ChartRenderer.d.ts +1 -1
  35. package/dist/scatterplot-umap/ChartRenderer.js +17 -17
  36. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  37. package/dist/scatterplot-umap/components/SVGLayer.js +49 -49
  38. package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
  39. package/dist/scatterplot-umap/components/UpperSVG.d.ts +1 -1
  40. package/dist/scatterplot-umap/components/UpperSVG.js +39 -38
  41. package/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  42. package/dist/scatterplot-umap/index.js +87 -77
  43. package/dist/scatterplot-umap/index.js.map +1 -1
  44. package/dist/types/bubble.js +32 -37
  45. package/dist/types/bubble.js.map +1 -1
  46. package/dist/types/common.d.ts +41 -0
  47. package/dist/types/common.js +39 -35
  48. package/dist/types/common.js.map +1 -1
  49. package/dist/types/discrete.d.ts +680 -70
  50. package/dist/types/discrete.js +141 -141
  51. package/dist/types/discrete.js.map +1 -1
  52. package/dist/types/heatmap.js +54 -59
  53. package/dist/types/heatmap.js.map +1 -1
  54. package/dist/types/scatterplot-umap.js +19 -24
  55. package/dist/types/scatterplot-umap.js.map +1 -1
  56. package/dist/types/scatterplot.js +41 -46
  57. package/dist/types/scatterplot.js.map +1 -1
  58. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { union as a, string as o, number as t, null as h, enum as c, object as l, optional as e, literal as s, record as m, boolean as i, array as r } from "../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js";
2
- const I = a([o(), t(), h()]), w = c(["sum", "mean", "median", "min", "max"]), d = [
1
+ import { union as i, string as o, number as t, null as h, enum as l, object as c, optional as e, literal as s, record as u, boolean as a, array as r } from "../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js";
2
+ const w = i([o(), t(), h()]), I = l(["sum", "mean", "median", "min", "max"]), d = [
3
3
  "0",
4
4
  "1",
5
5
  "2",
@@ -25,34 +25,34 @@ const I = a([o(), t(), h()]), w = c(["sum", "mean", "median", "min", "max"]), d
25
25
  "23",
26
26
  "24",
27
27
  "25"
28
- ], g = c(d), S = ["solid", "dashed", "dotted", "dotdash", "longdash", "twodash"], p = c(S), f = ["left", "bottom", "left-bottom", "full", "empty"], N = c(f), y = ["inside", "right", "top", "bottom"], k = c(y), T = ["left", "center", "right"], C = c(T), u = l({
28
+ ], S = l(d), g = ["solid", "dashed", "dotted", "dotdash", "longdash", "twodash"], p = l(g), f = ["left", "bottom", "left-bottom", "full", "empty"], N = l(f), y = ["inside", "right", "top", "bottom"], k = l(y), T = ["left", "center", "right"], C = l(T), m = c({
29
29
  type: s("column"),
30
30
  value: o(),
31
31
  format: e(o()),
32
32
  // d3 format
33
33
  label: e(o()),
34
34
  valueLabels: e(o())
35
- }), b = l({
35
+ }), b = c({
36
36
  fillColor: e(o()),
37
37
  lineColor: e(o()),
38
38
  lineWidth: e(t()),
39
39
  lineShape: e(p),
40
- dotShape: e(g),
40
+ dotShape: e(S),
41
41
  dotSize: e(t()),
42
42
  dotFill: e(o())
43
- }), M = m(b);
43
+ }), M = u(b);
44
44
  function j(n) {
45
- return l({
46
- columnName: u,
47
- valuesMap: m(n)
45
+ return c({
46
+ columnName: m,
47
+ valuesMap: u(n)
48
48
  });
49
49
  }
50
50
  function x(n) {
51
- return l({
52
- columnName: u,
51
+ return c({
52
+ columnName: m,
53
53
  domain: r(t()),
54
54
  range: r(n),
55
- type: e(a([s("linear"), s("log")]))
55
+ type: e(i([s("linear"), s("log")]))
56
56
  });
57
57
  }
58
58
  function F(n) {
@@ -61,32 +61,35 @@ function F(n) {
61
61
  function O(n) {
62
62
  return typeof n != "object" ? !1 : n !== null && "domain" in n && "range" in n;
63
63
  }
64
- const A = a([s("center"), s("45deg"), s("90deg")]), E = l({
65
- title: e(a([o(), u])),
64
+ const A = i([s("center"), s("45deg"), s("90deg")]), E = c({
65
+ title: e(i([o(), m])),
66
66
  scale: e(s("discrete")),
67
- keys: e(r(a([o(), t()]))),
68
- labels: e(m(o())),
69
- showGrid: e(i()),
70
- linesBetweenCategories: e(i()),
71
- showTicks: e(i()),
67
+ keys: e(r(i([o(), t()]))),
68
+ labels: e(u(o())),
69
+ showGrid: e(a()),
70
+ linesBetweenCategories: e(a()),
71
+ showTicks: e(a()),
72
72
  labelsPosition: e(A),
73
- hiddenLabels: e(i())
74
- }), L = l({
75
- title: e(a([o(), u])),
76
- scale: e(a([s("linear"), s("log")])),
77
- showGrid: e(i()),
78
- showTicks: e(i()),
73
+ hiddenLabels: e(a())
74
+ }), L = c({
75
+ title: e(i([o(), m])),
76
+ scale: e(i([s("linear"), s("log")])),
77
+ showGrid: e(a()),
78
+ showTicks: e(a()),
79
79
  significantLines: e(r(t())),
80
80
  significantLinesStyle: e(p),
81
81
  symmetricRange: e(t()),
82
82
  upperValue: e(t()),
83
83
  lowerValue: e(t()),
84
- hiddenLabels: e(i())
85
- }), V = a([E, L]);
86
- function _(n) {
84
+ hiddenLabels: e(a())
85
+ }), V = i([E, L]), _ = c({
86
+ show: e(a()),
87
+ content: e(r(m))
88
+ });
89
+ function D(n) {
87
90
  return typeof n == "object" && n !== null && "type" in n && "info" in n;
88
91
  }
89
- function D(n) {
92
+ function G(n) {
90
93
  return {
91
94
  type: "unknownError",
92
95
  info: {
@@ -98,25 +101,26 @@ function D(n) {
98
101
  export {
99
102
  b as AesItemSchema,
100
103
  M as AesRecordSchema,
101
- w as AggregationMethodSchema,
104
+ I as AggregationMethodSchema,
102
105
  L as AxisSettingsContinuousSchema,
103
106
  E as AxisSettingsDiscreteSchema,
104
107
  V as AxisSettingsSchema,
105
- u as ColumnNameSchema,
106
- I as DataValueSchema,
108
+ m as ColumnNameSchema,
109
+ w as DataValueSchema,
107
110
  A as DiscreteLabelsPositionSchema,
108
111
  N as FrameTypeSchema,
109
112
  k as LegendPositionSchema,
110
113
  p as LineShapeSchema,
111
114
  d as POINT_SHAPE,
112
- g as PointShapeSchema,
115
+ S as PointShapeSchema,
113
116
  T as TITLE_POSITION,
114
117
  C as TitlePositionSchema,
118
+ _ as TooltipSettingsSchema,
115
119
  j as categoricalAesMappingFromValueSchema,
116
120
  x as continuousAesMappingFromValueSchema,
117
- D as getUnknownErrorInfo,
121
+ G as getUnknownErrorInfo,
118
122
  F as isCategoricalAes,
119
123
  O as isContinuousAes,
120
- _ as isErrorInfo
124
+ D as isErrorInfo
121
125
  };
122
126
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sources":["../../src/types/common.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { LassoControlsState, Polygon } from '../scatterplot-umap/types';\nimport type { CategoricalAesFromColumn, ContinuousAesFromColumn } from './scatterplot';\n\nexport type DataValue = string | number | null;\nexport type Category = string;\nexport const DataValueSchema = z.union([z.string(), z.number(), z.null()]);\n\nexport type Row = Record<string, DataValue>\n\nexport type Color = string;\n\nexport const AggregationMethodSchema = z.enum(['sum', 'mean', 'median', 'min', 'max']);\nexport type AggregationMethod = z.infer<typeof AggregationMethodSchema>;\n\n// numbered according ggplot2 symbols, 19 (third size of black circle) is missed\nexport const POINT_SHAPE = [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n '10',\n '11',\n '12',\n '13',\n '14',\n '15',\n '16',\n '17',\n '18',\n '20',\n '21',\n '22',\n '23',\n '24',\n '25',\n] as const;\nexport const PointShapeSchema = z.enum(POINT_SHAPE);\nexport type PointShape = z.infer<typeof PointShapeSchema>;\n\nconst LINE_SHAPE = ['solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash'] as const;\nexport const LineShapeSchema = z.enum(LINE_SHAPE);\nexport type LineShape = z.infer<typeof LineShapeSchema>;\n\nconst FRAME_TYPE = ['left', 'bottom', 'left-bottom', 'full', 'empty'] as const;\nexport const FrameTypeSchema = z.enum(FRAME_TYPE);\nexport type FrameType = z.infer<typeof FrameTypeSchema>;\n\nconst LEGEND_POSITION = ['inside', 'right', 'top', 'bottom'] as const;\nexport const LegendPositionSchema = z.enum(LEGEND_POSITION);\nexport type LegendPosition = z.infer<typeof LegendPositionSchema>;\n\nexport const TITLE_POSITION = ['left', 'center', 'right'] as const;\nexport const TitlePositionSchema = z.enum(TITLE_POSITION);\nexport type TitlePosition = z.infer<typeof TitlePositionSchema>;\n\nexport const ColumnNameSchema = z.object({\n type: z.literal('column'),\n value: z.string(),\n format: z.optional(z.string()), // d3 format\n label: z.optional(z.string()),\n valueLabels: z.optional(z.string())\n});\nexport type ColumnName = z.infer<typeof ColumnNameSchema>\n\nexport type AesItem = {\n fillColor?: Color;\n lineColor?: Color;\n lineWidth?: number;\n lineShape?: LineShape;\n dotShape?: PointShape;\n dotSize?: number;\n dotFill?: Color;\n};\nexport const AesItemSchema = z.object({\n fillColor: z.optional(z.string()),\n lineColor: z.optional(z.string()),\n lineWidth: z.optional(z.number()),\n lineShape: z.optional(LineShapeSchema),\n dotShape: z.optional(PointShapeSchema),\n dotSize: z.optional(z.number()),\n dotFill: z.optional(z.string()),\n});\n\nexport const AesRecordSchema = z.record(AesItemSchema);\nexport type AesRecord = z.infer<typeof AesRecordSchema>;\n\nexport function categoricalAesMappingFromValueSchema<ValueType extends z.ZodTypeAny>(\n valueSchema: ValueType,\n) {\n return z.object({\n columnName: ColumnNameSchema,\n valuesMap: z.record(valueSchema),\n });\n}\nexport function continuousAesMappingFromValueSchema<ValueType extends z.ZodTypeAny>(\n valueSchema: ValueType,\n) {\n return z.object({\n columnName: ColumnNameSchema,\n domain: z.array(z.number()),\n range: z.array(valueSchema),\n type: z.optional(z.union([z.literal('linear'), z.literal('log')]))\n });\n}\n\nexport function isCategoricalAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType> | unknown\n): item is CategoricalAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return item !== null && 'valuesMap' in item;\n}\n\nexport function isContinuousAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType> | unknown\n): item is ContinuousAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return item !== null && 'domain' in item && 'range' in item;\n}\n\nexport const DiscreteLabelsPositionSchema = z.union([z.literal('center'), z.literal('45deg'), z.literal('90deg')]);\n\nexport const AxisSettingsDiscreteSchema = z.object({\n title: z.optional(z.union([z.string(), ColumnNameSchema])),\n scale: z.optional(z.literal('discrete')),\n keys: z.optional(z.array(z.union([z.string(), z.number()]))),\n labels: z.optional(z.record(z.string())),\n showGrid: z.optional(z.boolean()),\n linesBetweenCategories: z.optional(z.boolean()),\n showTicks: z.optional(z.boolean()),\n labelsPosition: z.optional(DiscreteLabelsPositionSchema),\n hiddenLabels: z.optional(z.boolean())\n});\nexport const AxisSettingsContinuousSchema = z.object({\n title: z.optional(z.union([z.string(), ColumnNameSchema])),\n scale: z.optional(z.union([z.literal('linear'), z.literal('log')])),\n showGrid: z.optional(z.boolean()),\n showTicks: z.optional(z.boolean()),\n significantLines: z.optional(z.array(z.number())),\n significantLinesStyle: z.optional(LineShapeSchema),\n symmetricRange: z.optional(z.number()),\n upperValue: z.optional(z.number()),\n lowerValue: z.optional(z.number()),\n hiddenLabels: z.optional(z.boolean()),\n});\n\nexport const AxisSettingsSchema = z.union([AxisSettingsDiscreteSchema, AxisSettingsContinuousSchema]);\n\nexport type AxisSettings = z.infer<typeof AxisSettingsSchema>\nexport type AxisSettingsDiscrete = z.infer<typeof AxisSettingsDiscreteSchema>;\nexport type AxisSettingsContinuous = z.infer<typeof AxisSettingsContinuousSchema>;\n\nexport type DiscreteLabelsPosition = z.infer<typeof DiscreteLabelsPositionSchema>;\n\nexport interface SettingsInterface {\n type: string;\n}\n\nexport type ClickEventData = {\n x: number;\n y: number;\n info: unknown;\n}\n\nexport type PolygonData = [number, number][];\n\nexport type ChartEventHandlers<T> = T;\nexport type DendroEventHandlers = ChartEventHandlers<[(d: ClickEventData) => void]>\nexport type ScatterplotEventHandlers = ChartEventHandlers<{\n onPolygonUpdate: (d: number[], p: Polygon[]) => void;\n onTooltipHintSwitch: (d: boolean) => void;\n onLassoStateChange: () => void;\n onLassoControlsStateUpdate: (v: LassoControlsState) => void;\n onZoomChange: (isZoomChanged: boolean) => void;\n}>\nexport type HeatmapEventHandlers = ChartEventHandlers<{\n onTooltipHintSwitch: (d: boolean) => void;\n onLoadingChange: (d: boolean) => void;\n}>\n\nexport type BubbleEventHandlers = ChartEventHandlers<[(d: boolean) => void]>\nexport type DiscreteEventHandlers = ChartEventHandlers<[(d: boolean) => void]>\nexport type HistogramEventHandlers = ChartEventHandlers<[(d: boolean) => void]>\n\nexport type ErrorTypes = 'tooManyFacets' \n| 'tooManyPrimaryGroups' | 'tooManySecondaryGroups'\n| 'tooManyScatterplotGroupsX' | 'tooManyScatterplotGroupsY'\n| 'tooManyHistogramGroups'\n| 'unknownError';\ntype ErrorInfoBase = { type: ErrorTypes, info: unknown };\nexport interface ErrorInfoFacets extends ErrorInfoBase {\n type: 'tooManyFacets';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoPrimaryGroups extends ErrorInfoBase {\n type: 'tooManyPrimaryGroups';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoSecondaryGroups extends ErrorInfoBase {\n type: 'tooManySecondaryGroups';\n info: {\n count: number;\n maxCount: number;\n };\n}\n\nexport interface ErrorInfoScatterplotGroupsX extends ErrorInfoBase {\n type: 'tooManyScatterplotGroupsX';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoScatterplotGroupsY extends ErrorInfoBase {\n type: 'tooManyScatterplotGroupsY';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoHistogramGroups extends ErrorInfoBase {\n type: 'tooManyHistogramGroups';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoUnknown extends ErrorInfoBase {\n type: 'unknownError';\n info: {\n message: string;\n stack: string | undefined;\n };\n}\nexport type ErrorInfo = ErrorInfoFacets | ErrorInfoPrimaryGroups | ErrorInfoSecondaryGroups | ErrorInfoScatterplotGroupsX | ErrorInfoScatterplotGroupsY | ErrorInfoHistogramGroups | ErrorInfoUnknown;\nexport function isErrorInfo(value: unknown): value is ErrorInfo {\n return typeof value === 'object' && value !== null && 'type' in value && 'info' in value;\n}\nexport function getUnknownErrorInfo(error: Error): ErrorInfoUnknown {\n return {\n type: 'unknownError',\n info: {\n message: error.message,\n stack: error.stack,\n },\n };\n}"],"names":["DataValueSchema","z.union","z.string","z.number","z.null","AggregationMethodSchema","z.enum","POINT_SHAPE","PointShapeSchema","LINE_SHAPE","LineShapeSchema","FRAME_TYPE","FrameTypeSchema","LEGEND_POSITION","LegendPositionSchema","TITLE_POSITION","TitlePositionSchema","ColumnNameSchema","z.object","z.literal","z.optional","AesItemSchema","AesRecordSchema","z.record","categoricalAesMappingFromValueSchema","valueSchema","continuousAesMappingFromValueSchema","z.array","isCategoricalAes","item","isContinuousAes","DiscreteLabelsPositionSchema","AxisSettingsDiscreteSchema","z.boolean","AxisSettingsContinuousSchema","AxisSettingsSchema","isErrorInfo","value","getUnknownErrorInfo","error"],"mappings":";AAMO,MAAMA,IAAkBC,EAAQ,CAACC,EAAE,GAAUC,EAAE,GAAUC,GAAQ,CAAC,GAM5DC,IAA0BC,EAAO,CAAC,OAAO,QAAQ,UAAU,OAAO,KAAK,CAAC,GAIxEC,IAAc;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GACaC,IAAmBF,EAAOC,CAAW,GAG5CE,I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4BE,CAA4B,CAAC;AA+F7F,SAASE,EAAYC,GAAoC;AAC5D,SAAO,OAAOA,KAAU,YAAYA,MAAU,QAAQ,UAAUA,KAAS,UAAUA;AACvF;AACO,SAASC,EAAoBC,GAAgC;AAChE,SAAO;AAAA,IACH,MAAM;AAAA,IACN,MAAM;AAAA,MACF,SAASA,EAAM;AAAA,MACf,OAAOA,EAAM;AAAA,IAAA;AAAA,EACjB;AAER;"}
1
+ {"version":3,"file":"common.js","sources":["../../src/types/common.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { LassoControlsState, Polygon } from '../scatterplot-umap/types';\nimport type { CategoricalAesFromColumn, ContinuousAesFromColumn } from './scatterplot';\n\nexport type DataValue = string | number | null;\nexport type Category = string;\nexport const DataValueSchema = z.union([z.string(), z.number(), z.null()]);\n\nexport type Row = Record<string, DataValue>\n\nexport type Color = string;\n\nexport const AggregationMethodSchema = z.enum(['sum', 'mean', 'median', 'min', 'max']);\nexport type AggregationMethod = z.infer<typeof AggregationMethodSchema>;\n\n// numbered according ggplot2 symbols, 19 (third size of black circle) is missed\nexport const POINT_SHAPE = [\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n '10',\n '11',\n '12',\n '13',\n '14',\n '15',\n '16',\n '17',\n '18',\n '20',\n '21',\n '22',\n '23',\n '24',\n '25',\n] as const;\nexport const PointShapeSchema = z.enum(POINT_SHAPE);\nexport type PointShape = z.infer<typeof PointShapeSchema>;\n\nconst LINE_SHAPE = ['solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash'] as const;\nexport const LineShapeSchema = z.enum(LINE_SHAPE);\nexport type LineShape = z.infer<typeof LineShapeSchema>;\n\nconst FRAME_TYPE = ['left', 'bottom', 'left-bottom', 'full', 'empty'] as const;\nexport const FrameTypeSchema = z.enum(FRAME_TYPE);\nexport type FrameType = z.infer<typeof FrameTypeSchema>;\n\nconst LEGEND_POSITION = ['inside', 'right', 'top', 'bottom'] as const;\nexport const LegendPositionSchema = z.enum(LEGEND_POSITION);\nexport type LegendPosition = z.infer<typeof LegendPositionSchema>;\n\nexport const TITLE_POSITION = ['left', 'center', 'right'] as const;\nexport const TitlePositionSchema = z.enum(TITLE_POSITION);\nexport type TitlePosition = z.infer<typeof TitlePositionSchema>;\n\nexport const ColumnNameSchema = z.object({\n type: z.literal('column'),\n value: z.string(),\n format: z.optional(z.string()), // d3 format\n label: z.optional(z.string()),\n valueLabels: z.optional(z.string())\n});\nexport type ColumnName = z.infer<typeof ColumnNameSchema>\n\nexport type AesItem = {\n fillColor?: Color;\n lineColor?: Color;\n lineWidth?: number;\n lineShape?: LineShape;\n dotShape?: PointShape;\n dotSize?: number;\n dotFill?: Color;\n};\nexport const AesItemSchema = z.object({\n fillColor: z.optional(z.string()),\n lineColor: z.optional(z.string()),\n lineWidth: z.optional(z.number()),\n lineShape: z.optional(LineShapeSchema),\n dotShape: z.optional(PointShapeSchema),\n dotSize: z.optional(z.number()),\n dotFill: z.optional(z.string()),\n});\n\nexport const AesRecordSchema = z.record(AesItemSchema);\nexport type AesRecord = z.infer<typeof AesRecordSchema>;\n\nexport function categoricalAesMappingFromValueSchema<ValueType extends z.ZodTypeAny>(\n valueSchema: ValueType,\n) {\n return z.object({\n columnName: ColumnNameSchema,\n valuesMap: z.record(valueSchema),\n });\n}\nexport function continuousAesMappingFromValueSchema<ValueType extends z.ZodTypeAny>(\n valueSchema: ValueType,\n) {\n return z.object({\n columnName: ColumnNameSchema,\n domain: z.array(z.number()),\n range: z.array(valueSchema),\n type: z.optional(z.union([z.literal('linear'), z.literal('log')]))\n });\n}\n\nexport function isCategoricalAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType> | unknown\n): item is CategoricalAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return item !== null && 'valuesMap' in item;\n}\n\nexport function isContinuousAes<InputType extends string | number | PointShape | LineShape>(\n item: InputType | CategoricalAesFromColumn<InputType> | ContinuousAesFromColumn<InputType> | unknown\n): item is ContinuousAesFromColumn<InputType> {\n if (typeof item !== 'object') {\n return false;\n }\n return item !== null && 'domain' in item && 'range' in item;\n}\n\nexport const DiscreteLabelsPositionSchema = z.union([z.literal('center'), z.literal('45deg'), z.literal('90deg')]);\n\nexport const AxisSettingsDiscreteSchema = z.object({\n title: z.optional(z.union([z.string(), ColumnNameSchema])),\n scale: z.optional(z.literal('discrete')),\n keys: z.optional(z.array(z.union([z.string(), z.number()]))),\n labels: z.optional(z.record(z.string())),\n showGrid: z.optional(z.boolean()),\n linesBetweenCategories: z.optional(z.boolean()),\n showTicks: z.optional(z.boolean()),\n labelsPosition: z.optional(DiscreteLabelsPositionSchema),\n hiddenLabels: z.optional(z.boolean())\n});\nexport const AxisSettingsContinuousSchema = z.object({\n title: z.optional(z.union([z.string(), ColumnNameSchema])),\n scale: z.optional(z.union([z.literal('linear'), z.literal('log')])),\n showGrid: z.optional(z.boolean()),\n showTicks: z.optional(z.boolean()),\n significantLines: z.optional(z.array(z.number())),\n significantLinesStyle: z.optional(LineShapeSchema),\n symmetricRange: z.optional(z.number()),\n upperValue: z.optional(z.number()),\n lowerValue: z.optional(z.number()),\n hiddenLabels: z.optional(z.boolean()),\n});\n\nexport const AxisSettingsSchema = z.union([AxisSettingsDiscreteSchema, AxisSettingsContinuousSchema]);\n\nexport type AxisSettings = z.infer<typeof AxisSettingsSchema>\nexport type AxisSettingsDiscrete = z.infer<typeof AxisSettingsDiscreteSchema>;\nexport type AxisSettingsContinuous = z.infer<typeof AxisSettingsContinuousSchema>;\n\nexport type DiscreteLabelsPosition = z.infer<typeof DiscreteLabelsPositionSchema>;\n\nexport const TooltipSettingsSchema = z.object({\n show: z.optional(z.boolean()),\n content: z.optional(z.array(ColumnNameSchema)),\n});\n\nexport type TooltipSettings = z.infer<typeof TooltipSettingsSchema>;\n\nexport interface SettingsInterface {\n type: string;\n}\n\nexport type ClickEventData = {\n x: number;\n y: number;\n info: unknown;\n}\n\nexport type PolygonData = [number, number][];\n\nexport type ChartEventHandlers<T> = T;\nexport type DendroEventHandlers = ChartEventHandlers<[(d: ClickEventData) => void]>\nexport type ScatterplotEventHandlers = ChartEventHandlers<{\n onPolygonUpdate: (d: number[], p: Polygon[]) => void;\n onTooltipHintSwitch: (d: boolean) => void;\n onLassoStateChange: () => void;\n onLassoControlsStateUpdate: (v: LassoControlsState) => void;\n onZoomChange: (isZoomChanged: boolean) => void;\n}>\nexport type HeatmapEventHandlers = ChartEventHandlers<{\n onTooltipHintSwitch: (d: boolean) => void;\n onLoadingChange: (d: boolean) => void;\n}>\n\nexport type BubbleEventHandlers = ChartEventHandlers<[(d: boolean) => void]>\nexport type DiscreteEventHandlers = ChartEventHandlers<[(d: boolean) => void]>\nexport type HistogramEventHandlers = ChartEventHandlers<[(d: boolean) => void]>\n\nexport type ErrorTypes = 'tooManyFacets' \n| 'tooManyPrimaryGroups' | 'tooManySecondaryGroups'\n| 'tooManyScatterplotGroupsX' | 'tooManyScatterplotGroupsY'\n| 'tooManyHistogramGroups'\n| 'unknownError';\ntype ErrorInfoBase = { type: ErrorTypes, info: unknown };\nexport interface ErrorInfoFacets extends ErrorInfoBase {\n type: 'tooManyFacets';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoPrimaryGroups extends ErrorInfoBase {\n type: 'tooManyPrimaryGroups';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoSecondaryGroups extends ErrorInfoBase {\n type: 'tooManySecondaryGroups';\n info: {\n count: number;\n maxCount: number;\n };\n}\n\nexport interface ErrorInfoScatterplotGroupsX extends ErrorInfoBase {\n type: 'tooManyScatterplotGroupsX';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoScatterplotGroupsY extends ErrorInfoBase {\n type: 'tooManyScatterplotGroupsY';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoHistogramGroups extends ErrorInfoBase {\n type: 'tooManyHistogramGroups';\n info: {\n count: number;\n maxCount: number;\n };\n}\nexport interface ErrorInfoUnknown extends ErrorInfoBase {\n type: 'unknownError';\n info: {\n message: string;\n stack: string | undefined;\n };\n}\nexport type ErrorInfo = ErrorInfoFacets | ErrorInfoPrimaryGroups | ErrorInfoSecondaryGroups | ErrorInfoScatterplotGroupsX | ErrorInfoScatterplotGroupsY | ErrorInfoHistogramGroups | ErrorInfoUnknown;\nexport function isErrorInfo(value: unknown): value is ErrorInfo {\n return typeof value === 'object' && value !== null && 'type' in value && 'info' in value;\n}\nexport function getUnknownErrorInfo(error: Error): ErrorInfoUnknown {\n return {\n type: 'unknownError',\n info: {\n message: error.message,\n stack: error.stack,\n },\n };\n}"],"names":["DataValueSchema","z.union","z.string","z.number","z.null","AggregationMethodSchema","z.enum","POINT_SHAPE","PointShapeSchema","LINE_SHAPE","LineShapeSchema","FRAME_TYPE","FrameTypeSchema","LEGEND_POSITION","LegendPositionSchema","TITLE_POSITION","TitlePositionSchema","ColumnNameSchema","z.object","z.literal","z.optional","AesItemSchema","AesRecordSchema","z.record","categoricalAesMappingFromValueSchema","valueSchema","continuousAesMappingFromValueSchema","z.array","isCategoricalAes","item","isContinuousAes","DiscreteLabelsPositionSchema","AxisSettingsDiscreteSchema","z.boolean","AxisSettingsContinuousSchema","AxisSettingsSchema","TooltipSettingsSchema","isErrorInfo","value","getUnknownErrorInfo","error"],"mappings":";AAMO,MAAMA,IAAkBC,EAAQ,CAACC,EAAE,GAAUC,EAAE,GAAUC,GAAQ,CAAC,GAM5DC,IAA0BC,EAAO,CAAC,OAAO,QAAQ,UAAU,OAAO,KAAK,CAAC,GAIxEC,IAAc;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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