@fundar/data-chart-telling 0.0.14 → 0.0.16

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 (148) hide show
  1. package/README.md +121 -17
  2. package/dist/charts/{Chart.svelte → BaseChart.svelte} +2 -0
  3. package/dist/charts/{Chart.svelte.d.ts → BaseChart.svelte.d.ts} +3 -3
  4. package/dist/charts/bar/Chart.svelte +5 -5
  5. package/dist/charts/bar/Chart.svelte.d.ts +1 -2
  6. package/dist/charts/heatmap/Chart.svelte +8 -7
  7. package/dist/charts/heatmap/Chart.svelte.d.ts +2 -3
  8. package/dist/charts/line/Chart.svelte +5 -5
  9. package/dist/charts/line/Chart.svelte.d.ts +1 -2
  10. package/dist/charts/pyramid/Chart.svelte +7 -6
  11. package/dist/charts/pyramid/Chart.svelte.d.ts +2 -3
  12. package/dist/configuration/config.svelte.js +2 -1
  13. package/dist/configuration/themes/index.d.ts +60 -40
  14. package/dist/index.d.ts +27 -13
  15. package/dist/index.js +12 -7
  16. package/dist/layout/facet/FacetLayout.svelte +1 -1
  17. package/dist/layout/facet/FacetLayout.svelte.d.ts +1 -1
  18. package/dist/layout/geo/GeoLayout.svelte +47 -0
  19. package/dist/layout/geo/GeoLayout.svelte.d.ts +22 -0
  20. package/dist/layout/geo/resolveProjection.d.ts +10 -0
  21. package/dist/layout/geo/resolveProjection.js +48 -0
  22. package/dist/layout/legend/ContinuousSection.svelte +158 -17
  23. package/dist/layout/legend/DiscreteSection.svelte +56 -4
  24. package/dist/layout/legend/interaction.svelte.d.ts +7 -0
  25. package/dist/layout/legend/interaction.svelte.js +24 -0
  26. package/dist/layout/plot/AxisLayout.svelte +95 -0
  27. package/dist/layout/plot/AxisLayout.svelte.d.ts +39 -0
  28. package/dist/layout/plot/BasePlotLayout.svelte +302 -0
  29. package/dist/layout/plot/BasePlotLayout.svelte.d.ts +95 -0
  30. package/dist/layout/plot/GridLayout.svelte +30 -0
  31. package/dist/layout/plot/GridLayout.svelte.d.ts +27 -0
  32. package/dist/layout/plot/RuleLayout.svelte +111 -0
  33. package/dist/layout/plot/RuleLayout.svelte.d.ts +40 -0
  34. package/dist/layout/plot/margins.d.ts +34 -0
  35. package/dist/layout/plot/margins.js +26 -0
  36. package/dist/layout/timeline/TimelineLayout.svelte +1 -1
  37. package/dist/layout/timeline/TimelineLayout.svelte.d.ts +1 -1
  38. package/dist/layout/tooltip/Tooltip.svelte +15 -0
  39. package/dist/layout/tooltip/Tooltip.svelte.d.ts +7 -0
  40. package/dist/layout/tooltip/TooltipLayout.svelte +45 -0
  41. package/dist/layout/tooltip/TooltipLayout.svelte.d.ts +41 -0
  42. package/dist/layout/tooltip/controller.svelte.d.ts +4 -3
  43. package/dist/layout/tooltip/controller.svelte.js +5 -6
  44. package/dist/layout/tooltip/hover.svelte.d.ts +1 -1
  45. package/dist/layout/tooltip/hover.svelte.js +1 -1
  46. package/dist/layout/tooltip/utils.d.ts +2 -2
  47. package/dist/markers/ContourClipMarker.svelte +77 -0
  48. package/dist/markers/ContourClipMarker.svelte.d.ts +10 -0
  49. package/dist/{plots/markers → markers}/DeltaMarker.svelte +4 -4
  50. package/dist/{plots/markers → markers}/DeltaMarker.svelte.d.ts +3 -3
  51. package/dist/{plots/markers → markers}/DotMarker.svelte +3 -3
  52. package/dist/{plots/markers → markers}/DotMarker.svelte.d.ts +3 -3
  53. package/dist/markers/HoverMarker.svelte +136 -0
  54. package/dist/{plots/markers → markers}/HoverMarker.svelte.d.ts +4 -4
  55. package/dist/{plots/markers → markers}/PeakMarker.svelte +2 -2
  56. package/dist/{plots/markers → markers}/PeakMarker.svelte.d.ts +2 -2
  57. package/dist/{plots/markers → markers}/TextMarker.svelte +11 -4
  58. package/dist/{plots/markers → markers}/TextMarker.svelte.d.ts +3 -3
  59. package/dist/markers/inset/InsetMarker.svelte +170 -0
  60. package/dist/markers/inset/InsetMarker.svelte.d.ts +51 -0
  61. package/dist/markers/inset/insetLayout.d.ts +25 -0
  62. package/dist/markers/inset/insetLayout.js +39 -0
  63. package/dist/markers/inset/insetProjection.d.ts +8 -0
  64. package/dist/markers/inset/insetProjection.js +39 -0
  65. package/dist/plots/bar/BarSegments.svelte +69 -0
  66. package/dist/plots/bar/BarSegments.svelte.d.ts +40 -0
  67. package/dist/plots/bar/Plot.svelte +140 -74
  68. package/dist/plots/bar/Plot.svelte.d.ts +7 -3
  69. package/dist/plots/bar/ValueLabels.svelte +89 -0
  70. package/dist/plots/bar/ValueLabels.svelte.d.ts +39 -0
  71. package/dist/plots/bar/hoverPoints.d.ts +15 -0
  72. package/dist/plots/bar/hoverPoints.js +35 -0
  73. package/dist/plots/bar/layout.svelte.d.ts +37 -0
  74. package/dist/plots/bar/layout.svelte.js +132 -0
  75. package/dist/plots/geo/Plot.svelte +577 -0
  76. package/dist/plots/geo/Plot.svelte.d.ts +29 -0
  77. package/dist/plots/geo/TileLayer.svelte +77 -0
  78. package/dist/plots/geo/TileLayer.svelte.d.ts +11 -0
  79. package/dist/plots/geo/projections/argentina.d.ts +8 -0
  80. package/dist/plots/geo/projections/argentina.js +35 -0
  81. package/dist/plots/geo/projections/fit.d.ts +8 -0
  82. package/dist/plots/geo/projections/fit.js +14 -0
  83. package/dist/plots/geo/rotate.svelte.d.ts +26 -0
  84. package/dist/plots/geo/rotate.svelte.js +79 -0
  85. package/dist/plots/geo/zoom.svelte.d.ts +32 -0
  86. package/dist/plots/geo/zoom.svelte.js +50 -0
  87. package/dist/plots/heatmap/Plot.svelte +171 -58
  88. package/dist/plots/heatmap/Plot.svelte.d.ts +7 -3
  89. package/dist/plots/line/Plot.svelte +67 -30
  90. package/dist/plots/line/Plot.svelte.d.ts +7 -3
  91. package/dist/plots/pyramid/Plot.svelte +88 -35
  92. package/dist/plots/pyramid/Plot.svelte.d.ts +7 -3
  93. package/dist/plots/utils/delta.d.ts +1 -1
  94. package/dist/plots/utils/geoAccessors.d.ts +64 -0
  95. package/dist/plots/utils/geoAccessors.js +188 -0
  96. package/dist/plots/utils/geoSegments.d.ts +14 -0
  97. package/dist/plots/utils/geoSegments.js +17 -0
  98. package/dist/plots/utils/legendDisabled.d.ts +15 -0
  99. package/dist/plots/utils/legendDisabled.js +41 -0
  100. package/dist/plots/utils/segments.d.ts +14 -5
  101. package/dist/plots/utils/segments.js +25 -13
  102. package/dist/plots/utils/tiles.d.ts +89 -0
  103. package/dist/plots/utils/tiles.js +159 -0
  104. package/dist/plots/utils/topojson.d.ts +9 -0
  105. package/dist/plots/utils/topojson.js +30 -0
  106. package/dist/types/charts/common.d.ts +2 -1
  107. package/dist/types/charts/legend.d.ts +32 -1
  108. package/dist/types/charts/props.d.ts +9 -6
  109. package/dist/types/configuration/styling.d.ts +13 -5
  110. package/dist/types/layout/legend.d.ts +26 -0
  111. package/dist/types/layout/tooltip.d.ts +14 -21
  112. package/dist/types/{plots/markers.d.ts → markers/common.d.ts} +2 -18
  113. package/dist/types/markers/geo.d.ts +237 -0
  114. package/dist/types/markers/props.d.ts +11 -0
  115. package/dist/types/markers/props.js +1 -0
  116. package/dist/types/plots/axis.d.ts +55 -0
  117. package/dist/types/plots/axis.js +1 -0
  118. package/dist/types/plots/constants.d.ts +30 -0
  119. package/dist/types/plots/constants.js +1 -0
  120. package/dist/types/plots/data/common.d.ts +40 -0
  121. package/dist/types/plots/data/common.js +1 -0
  122. package/dist/types/plots/data/geo.d.ts +74 -0
  123. package/dist/types/plots/data/geo.js +1 -0
  124. package/dist/types/plots/delta.d.ts +2 -2
  125. package/dist/types/plots/props.d.ts +105 -16
  126. package/dist/types/plots/scales/geo.d.ts +44 -0
  127. package/dist/types/plots/scales/geo.js +1 -0
  128. package/dist/types/plots/segments/common.d.ts +25 -0
  129. package/dist/types/plots/segments/common.js +1 -0
  130. package/dist/types/plots/segments/config.d.ts +51 -0
  131. package/dist/types/plots/segments/config.js +1 -0
  132. package/dist/types/plots/styles/common.d.ts +37 -0
  133. package/dist/types/plots/styles/common.js +1 -0
  134. package/dist/types/plots/styles/geo.d.ts +42 -0
  135. package/dist/types/plots/styles/geo.js +1 -0
  136. package/dist/types/plots/styling.d.ts +45 -0
  137. package/dist/types/plots/styling.js +1 -0
  138. package/dist/utils/grouping.d.ts +2 -1
  139. package/dist/utils/interpolate.d.ts +2 -1
  140. package/package.json +27 -13
  141. package/dist/layout/plot/PlotLayout.svelte +0 -294
  142. package/dist/layout/plot/PlotLayout.svelte.d.ts +0 -70
  143. package/dist/plots/markers/HoverMarker.svelte +0 -98
  144. package/dist/types/plots/common.d.ts +0 -97
  145. package/dist/types/plots/styles.d.ts +0 -187
  146. /package/dist/types/{plots/common.js → layout/legend.js} +0 -0
  147. /package/dist/types/{plots/markers.js → markers/common.js} +0 -0
  148. /package/dist/types/{plots/styles.js → markers/geo.js} +0 -0
@@ -1,187 +0,0 @@
1
- import type { AxisValue, Series } from './common';
2
- /**
3
- * Unified positional anchor for value labels across all plot kinds.
4
- *
5
- * - `'outside'` — beyond the tip of the mark (above a vertical bar, to the
6
- * far end of a horizontal bar or line). This is the only value with no
7
- * direct svelteplot equivalent; the plot computes dx/dy internally.
8
- * - `'start'` — at the tip of the mark, just inside (top of a bar, far end
9
- * of a pyramid bar from zero, right of a line's last point).
10
- * - `'middle'` — centred on the mark.
11
- * - `'end'` — at the baseline/zero end of the mark.
12
- */
13
- export type ValueAnchor = 'outside' | 'start' | 'middle' | 'end';
14
- /**
15
- * Controls if and how value labels are rendered on a plot. The high-level
16
- * `anchor` sets sensible defaults for placement; the low-level svelteplot
17
- * Text-mark fields (`dx`, `dy`, `textAnchor`, `lineAnchor`, `lineHeight`,
18
- * `rotate`, `class`, `textClass`) override those defaults when provided.
19
- */
20
- export type ValuesStyle = {
21
- show?: boolean;
22
- anchor?: ValueAnchor;
23
- /** Called with the numeric value and the series name. Return a string to render. */
24
- format?: (value: number, seriesName: string) => string;
25
- dx?: number;
26
- dy?: number;
27
- textAnchor?: 'start' | 'end' | 'middle';
28
- lineAnchor?: 'top' | 'bottom' | 'middle';
29
- lineHeight?: number;
30
- rotate?: number;
31
- class?: string;
32
- textClass?: string;
33
- };
34
- /**
35
- * Color overrides for plots that derive their palette from data.
36
- * Each plot uses only the fields relevant to its kind; unused fields are
37
- * silently ignored.
38
- *
39
- * - `min` / `max` — sequential colour ramp endpoints (heatmap).
40
- * - `left` / `right` — diverging bar sides (pyramid).
41
- */
42
- export type ColorsStyle = {
43
- min?: string;
44
- max?: string;
45
- left?: string;
46
- right?: string;
47
- };
48
- /**
49
- * Top-level rendering style overrides shared by all plot kinds. Passed as the
50
- * `styles` prop. Each plot reads only the fields it cares about.
51
- */
52
- export type PlotStyles = {
53
- values?: ValuesStyle;
54
- colors?: ColorsStyle;
55
- };
56
- export type SymbolType = 'circle' | 'square' | 'triangle' | 'line';
57
- export type LineStyle = 'solid' | 'dashed' | 'dotted' | 'dashdot';
58
- export type LineCap = 'butt' | 'round' | 'square';
59
- export type LineJoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
60
- /** Stroke styling for any line-ish mark — a line, a rule, a marker's connector. */
61
- export type StrokeStyle = {
62
- stroke?: string;
63
- strokeWidth?: number;
64
- strokeOpacity?: number;
65
- strokeDasharray?: string | LineStyle;
66
- strokeLinecap?: LineCap;
67
- strokeLinejoin?: LineJoin;
68
- };
69
- /**
70
- * Dot styling for any point mark — a line's endpoint dots, a marker's dot.
71
- * Carries its own `dotStroke*` fields rather than nesting a {@link StrokeStyle},
72
- * because a dot's outline is a distinct style from the stroke of the line (or
73
- * other mark) it sits next to — e.g. a {@link LineSegmentStyle} styles its
74
- * line's stroke and its dots' outline independently.
75
- */
76
- export type DotStyle = {
77
- dotRadius?: number;
78
- dotFill?: string;
79
- dotFillOpacity?: number;
80
- dotSymbol?: SymbolType;
81
- dotStroke?: string;
82
- dotStrokeWidth?: number;
83
- dotStrokeOpacity?: number;
84
- dotStrokeDasharray?: string | LineStyle;
85
- };
86
- /** Text/label styling for any text mark — a marker's label, an annotation. */
87
- export type FontStyle = {
88
- fill?: string;
89
- fontSize?: number;
90
- fontWeight?: 'normal' | 'bold';
91
- fontStyle?: 'normal' | 'italic';
92
- textAnchor?: 'start' | 'middle' | 'end';
93
- lineAnchor?: 'top' | 'middle' | 'bottom';
94
- stroke?: string;
95
- strokeWidth?: number;
96
- paintOrder?: string;
97
- dx?: number;
98
- dy?: number;
99
- };
100
- /** Per-segment styling for a line: its stroke and/or its endpoint dots. */
101
- export type LineSegmentStyle = {
102
- stroke?: StrokeStyle;
103
- dots?: DotStyle;
104
- };
105
- /** Per-segment styling for a bar: its fill. */
106
- export type BarSegmentStyle = {
107
- fill?: string;
108
- fillOpacity?: number;
109
- };
110
- /** Per-cell styling override for a heatmap cell. */
111
- export type CellSegmentStyle = {
112
- fill?: string;
113
- fillOpacity?: number;
114
- stroke?: string;
115
- strokeWidth?: number;
116
- };
117
- /** A half-open interval on one axis. Both bounds are inclusive; omit either to leave that end open. */
118
- export type Range = {
119
- from?: AxisValue;
120
- to?: AxisValue;
121
- };
122
- /**
123
- * A 2-D rectangular area on the plot, addressed by optional x and y intervals.
124
- * Omitting an interval leaves that axis unrestricted (matches all values).
125
- *
126
- * - For line/bar/pyramid plots only the `x` interval is used (the series' primary
127
- * axis); `y` is evaluated but filters by the series' value axis.
128
- * - For heatmaps both `x` (column) and `y` (row) are used to address cells.
129
- */
130
- export type Area = {
131
- x?: Range;
132
- y?: Range;
133
- };
134
- /**
135
- * One styled rule for a plot. A data point (or cell) is styled when it falls
136
- * inside **any** of the listed `areas`. Omitting `areas` (or passing an empty
137
- * array) makes the segment a catch-all that matches every data point — useful
138
- * as a baseline style. `TStyle` is the per-mark shape ({@link LineSegmentStyle},
139
- * {@link BarSegmentStyle}, {@link CellSegmentStyle}, …).
140
- *
141
- * Catch-alls are evaluated last so that area-specific segments always take
142
- * priority, regardless of their position in the list. A catch-all placed first
143
- * therefore acts as a fallback baseline that area-specific segments override.
144
- */
145
- export type Segment<TStyle> = {
146
- areas?: Area[];
147
- style?: TStyle;
148
- };
149
- /**
150
- * The `segments` prop accepted by every plot kind.
151
- *
152
- * A record mapping series names (or `'default'` for all series) to lists of
153
- * {@link Segment}s. Segments in a named key apply only to that series;
154
- * segments under `'default'` apply to every series.
155
- *
156
- * ```ts
157
- * segments: {
158
- * female: [{ style: { stroke: { stroke: 'tomato' } } }], // catch-all for female
159
- * male: [{ style: { stroke: { stroke: 'steelblue' } } }], // catch-all for male
160
- * default: [{ areas: [{ x: { from: 2012, to: 2014 } }], style: { dots: { dotSymbol: 'circle' } } }],
161
- * }
162
- * ```
163
- *
164
- * Within each resolved series list, catch-alls (no `areas`) are evaluated last
165
- * so that area-specific segments always override them, regardless of position.
166
- * Area-specific segments also inherit any style key absent from their own style
167
- * by merging the catch-all as a baseline — the area's own style wins on conflict.
168
- * This lets you set a series colour once in a catch-all and add per-range dots
169
- * or dash patterns without repeating the colour on every area segment.
170
- */
171
- export type Segments<TStyle> = Record<string, Segment<TStyle>[]>;
172
- /** One contiguous, styled slice of a series' data — ready to draw as its own mark. */
173
- export type VisualSegment<T extends Record<string, unknown>, TStyle = LineSegmentStyle> = {
174
- data: T[];
175
- style: TStyle;
176
- };
177
- /**
178
- * A series split into its styled visual segments. `S` is the full series
179
- * type Series<T> — its row type is read off `S['data']`
180
- * rather than taken as a separate parameter, since TypeScript can't reliably
181
- * infer a type parameter that only appears inside another parameter's
182
- * constraint.
183
- */
184
- export type VisualGroup<S extends Series<any>, TStyle = LineSegmentStyle> = {
185
- series: S;
186
- visualSegments: VisualSegment<S['data'][number], TStyle>[];
187
- };
File without changes