svelteplot 0.5.3-pr-253.2 → 0.5.3-pr-255.1
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/Mark.svelte +7 -0
- package/dist/constants.d.ts +1 -1
- package/dist/core/FacetAxes.svelte +2 -2
- package/dist/core/Plot.svelte +0 -4
- package/dist/helpers/colors.d.ts +8 -11
- package/dist/helpers/facets.d.ts +1 -1
- package/dist/helpers/getBaseStyles.d.ts +4 -4
- package/dist/helpers/getBaseStyles.js +8 -0
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/reduce.d.ts +1 -1
- package/dist/helpers/removeIdenticalLines.js +3 -2
- package/dist/helpers/scales.d.ts +5 -5
- package/dist/helpers/scales.js +2 -2
- package/dist/helpers/symbols.d.ts +2 -2
- package/dist/helpers/time.d.ts +3 -3
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/helpers/wordwrap.d.ts +14 -0
- package/dist/helpers/wordwrap.js +129 -0
- package/dist/marks/AxisX.svelte +2 -1
- package/dist/marks/AxisX.svelte.d.ts +1 -0
- package/dist/marks/Brush.svelte +44 -4
- package/dist/marks/CustomMark.svelte +9 -3
- package/dist/marks/Image.svelte +76 -0
- package/dist/marks/Image.svelte.d.ts +19 -0
- package/dist/marks/Text.svelte.d.ts +1 -1
- package/dist/marks/WaffleX.svelte +115 -0
- package/dist/marks/WaffleX.svelte.d.ts +19 -0
- package/dist/marks/WaffleY.svelte +119 -0
- package/dist/marks/WaffleY.svelte.d.ts +19 -0
- package/dist/marks/helpers/Anchor.svelte +16 -2
- package/dist/marks/helpers/Anchor.svelte.d.ts +28 -14
- package/dist/marks/helpers/BaseAxisX.svelte +20 -2
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +2 -0
- package/dist/marks/helpers/waffle.d.ts +58 -0
- package/dist/marks/helpers/waffle.js +196 -0
- package/dist/marks/index.d.ts +4 -1
- package/dist/marks/index.js +4 -1
- package/dist/transforms/centroid.d.ts +1 -4
- package/dist/transforms/group.js +11 -5
- package/dist/transforms/recordize.d.ts +3 -3
- package/dist/transforms/sort.d.ts +2 -2
- package/dist/types/data.d.ts +1 -0
- package/dist/types/mark.d.ts +1 -1
- package/dist/types/plot.d.ts +21 -3
- package/dist/types/scale.d.ts +8 -0
- package/package.json +14 -14
package/dist/marks/index.d.ts
CHANGED
|
@@ -27,12 +27,12 @@ export { default as Geo } from './Geo.svelte';
|
|
|
27
27
|
export { default as Graticule } from './Graticule.svelte';
|
|
28
28
|
export { default as GridX } from './GridX.svelte';
|
|
29
29
|
export { default as GridY } from './GridY.svelte';
|
|
30
|
+
export { default as Image } from './Image.svelte';
|
|
30
31
|
export { default as Line } from './Line.svelte';
|
|
31
32
|
export { default as LineX } from './LineX.svelte';
|
|
32
33
|
export { default as LineY } from './LineY.svelte';
|
|
33
34
|
export { default as Link } from './Link.svelte';
|
|
34
35
|
export { default as Pointer } from './Pointer.svelte';
|
|
35
|
-
export { default as Vector } from './Vector.svelte';
|
|
36
36
|
export { default as Rect } from './Rect.svelte';
|
|
37
37
|
export { default as RectX } from './RectX.svelte';
|
|
38
38
|
export { default as RectY } from './RectY.svelte';
|
|
@@ -45,6 +45,9 @@ export { default as Spike } from './Spike.svelte';
|
|
|
45
45
|
export { default as Text } from './Text.svelte';
|
|
46
46
|
export { default as TickX } from './TickX.svelte';
|
|
47
47
|
export { default as TickY } from './TickY.svelte';
|
|
48
|
+
export { default as Vector } from './Vector.svelte';
|
|
49
|
+
export { default as WaffleX } from './WaffleX.svelte';
|
|
50
|
+
export { default as WaffleY } from './WaffleY.svelte';
|
|
48
51
|
export { default as ColorLegend } from './ColorLegend.svelte';
|
|
49
52
|
export { default as HTMLTooltip } from './HTMLTooltip.svelte';
|
|
50
53
|
export { default as SymbolLegend } from './SymbolLegend.svelte';
|
package/dist/marks/index.js
CHANGED
|
@@ -27,12 +27,12 @@ export { default as Geo } from './Geo.svelte';
|
|
|
27
27
|
export { default as Graticule } from './Graticule.svelte';
|
|
28
28
|
export { default as GridX } from './GridX.svelte';
|
|
29
29
|
export { default as GridY } from './GridY.svelte';
|
|
30
|
+
export { default as Image } from './Image.svelte';
|
|
30
31
|
export { default as Line } from './Line.svelte';
|
|
31
32
|
export { default as LineX } from './LineX.svelte';
|
|
32
33
|
export { default as LineY } from './LineY.svelte';
|
|
33
34
|
export { default as Link } from './Link.svelte';
|
|
34
35
|
export { default as Pointer } from './Pointer.svelte';
|
|
35
|
-
export { default as Vector } from './Vector.svelte';
|
|
36
36
|
export { default as Rect } from './Rect.svelte';
|
|
37
37
|
export { default as RectX } from './RectX.svelte';
|
|
38
38
|
export { default as RectY } from './RectY.svelte';
|
|
@@ -45,6 +45,9 @@ export { default as Spike } from './Spike.svelte';
|
|
|
45
45
|
export { default as Text } from './Text.svelte';
|
|
46
46
|
export { default as TickX } from './TickX.svelte';
|
|
47
47
|
export { default as TickY } from './TickY.svelte';
|
|
48
|
+
export { default as Vector } from './Vector.svelte';
|
|
49
|
+
export { default as WaffleX } from './WaffleX.svelte';
|
|
50
|
+
export { default as WaffleY } from './WaffleY.svelte';
|
|
48
51
|
// HTML marks
|
|
49
52
|
export { default as ColorLegend } from './ColorLegend.svelte';
|
|
50
53
|
export { default as HTMLTooltip } from './HTMLTooltip.svelte';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { DataRecord, TransformArg } from '../types/index.js';
|
|
2
|
-
|
|
3
|
-
type WithCentroid<T> = T & {
|
|
4
|
-
[CENTROID]: [number, number];
|
|
5
|
-
};
|
|
2
|
+
type WithCentroid<T> = T & {};
|
|
6
3
|
export declare function geoCentroid<Datum extends DataRecord>({ data, ...options }: {
|
|
7
4
|
data: Datum[];
|
|
8
5
|
} & TransformArg<Datum>): TransformArg<WithCentroid<Datum>>;
|
package/dist/transforms/group.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { groupFacetsAndZ } from '../helpers/group.js';
|
|
2
|
-
import { testFilter } from '../helpers/index.js';
|
|
2
|
+
import { isValid, testFilter } from '../helpers/index.js';
|
|
3
3
|
import { reduceOutputs } from '../helpers/reduce.js';
|
|
4
4
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
5
5
|
import { groups as d3Groups } from 'd3-array';
|
|
@@ -58,8 +58,12 @@ export function groupY(input, options = {}) {
|
|
|
58
58
|
export function groupZ(input, options = {}) {
|
|
59
59
|
return groupXYZ('z', input, options);
|
|
60
60
|
}
|
|
61
|
+
const groupDimRaw = Symbol('groupDimRaw');
|
|
61
62
|
function groupXYZ(dim, { data, ...channels }, options = {}) {
|
|
62
|
-
|
|
63
|
+
// console.log({ dim, data, channels, options });
|
|
64
|
+
if ((dim === 'z'
|
|
65
|
+
? channels.z || channels.fill || channels.stroke || channels.fx || channels.fy
|
|
66
|
+
: channels[dim]) == null)
|
|
63
67
|
throw new Error('you must provide a channel to group on ' + dim);
|
|
64
68
|
const propName = options[`${dim}PropName`] != null
|
|
65
69
|
? options[`${dim}PropName`]
|
|
@@ -70,9 +74,11 @@ function groupXYZ(dim, { data, ...channels }, options = {}) {
|
|
|
70
74
|
// group by x or y
|
|
71
75
|
const groups = dim === 'z'
|
|
72
76
|
? [[null, data]]
|
|
73
|
-
: d3Groups(data
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
: d3Groups(data
|
|
78
|
+
.filter((d) => testFilter(d, channels))
|
|
79
|
+
.map((d) => ({ ...d, [groupDimRaw]: resolveChannel(dim, d, channels) }))
|
|
80
|
+
.filter((d) => isValid(d[groupDimRaw])), (d) => {
|
|
81
|
+
return interval ? interval.floor(d[groupDimRaw]) : d[groupDimRaw];
|
|
76
82
|
});
|
|
77
83
|
const newData = [];
|
|
78
84
|
let newChannels = omit({ ...channels }, 'filter');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TransformArgsRow, TransformArgsRecord } from '../types/index.js';
|
|
2
|
-
export declare const X:
|
|
3
|
-
export declare const Y:
|
|
4
|
-
export declare const RAW_VALUE:
|
|
2
|
+
export declare const X: any;
|
|
3
|
+
export declare const Y: any;
|
|
4
|
+
export declare const RAW_VALUE: any;
|
|
5
5
|
export declare function indexData<T extends object>(data: T[]): (T & {})[];
|
|
6
6
|
export declare function recordizeX<T>({ data, ...channels }: TransformArgsRow<T>, { withIndex }?: {
|
|
7
7
|
withIndex: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataRow, TransformArg } from '../types/index.js';
|
|
2
|
-
export declare const SORT_KEY:
|
|
3
|
-
export declare const IS_SORTED:
|
|
2
|
+
export declare const SORT_KEY: any;
|
|
3
|
+
export declare const IS_SORTED: any;
|
|
4
4
|
export declare function sort<T>({ data, ...channels }: TransformArg<T>, options?: {
|
|
5
5
|
reverse?: boolean;
|
|
6
6
|
}): any;
|
package/dist/types/data.d.ts
CHANGED
package/dist/types/mark.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Mark<T> = {
|
|
|
6
6
|
data: DataRecord<T>[];
|
|
7
7
|
options: T;
|
|
8
8
|
};
|
|
9
|
-
export type MarkType = 'area' | 'arrow' | 'barX' | 'barY' | 'cell' | 'custom' | 'dot' | 'vector' | 'frame' | 'geo' | 'gridX' | 'gridY' | 'line' | 'rect' | 'regression' | 'ruleX' | 'ruleY' | 'swoopyArrow' | 'text' | 'tickX' | 'tickY';
|
|
9
|
+
export type MarkType = 'area' | 'arrow' | 'barX' | 'barY' | 'cell' | 'custom' | 'dot' | 'vector' | 'frame' | 'geo' | 'gridX' | 'gridY' | 'line' | 'rect' | 'regression' | 'ruleX' | 'ruleY' | 'swoopyArrow' | 'text' | 'tickX' | 'tickY' | 'waffleX' | 'waffleY';
|
|
10
10
|
export type MarkStyleProps = 'strokeDasharray' | 'strokeLinejoin' | 'strokeLinecap' | 'opacity' | 'cursor' | 'pointerEvents' | 'blend' | 'fill' | 'fillOpacity' | 'fontFamily' | 'fontWeight' | 'fontVariant' | 'fontSize' | 'fontStyle' | 'letterSpacing' | 'wordSpacing' | 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'x' | 'y' | 'clipPath' | 'mask' | 'filter' | 'angle' | 'radius' | 'symbol' | 'textAnchor' | 'textTransform' | 'textDecoration' | 'width';
|
|
11
11
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
12
12
|
import type { ChannelAccessor, ConstantAccessor, DataRecord, RawValue } from './index.js';
|
package/dist/types/plot.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import type { ColorScheme } from './colorScheme.js';
|
|
|
3
3
|
import type { GeoProjection } from 'd3-geo';
|
|
4
4
|
import type { ChannelAccessor, ChannelName, ColorScaleOptions, DataRecord, LegendScaleOptions, PlotScales, ScaleOptions, XScaleOptions, YScaleOptions } from './index.js';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
|
-
import type { Area, AreaX, AreaY, Arrow, AxisX, AxisY, BarX, BarY, BoxX, BoxY, Brush, BrushX, BrushY, Cell, DifferenceY, Dot, Frame, Geo, Graticule, GridX, GridY, Line, Link, Pointer, Rect, RectX, RectY, RuleX, RuleY, Sphere, Spike, Text, TickX, TickY, Vector } from '../marks/index.js';
|
|
6
|
+
import type { Area, AreaX, AreaY, Arrow, AxisX, AxisY, BarX, BarY, BoxX, BoxY, Brush, BrushX, BrushY, Cell, DifferenceY, Dot, Frame, Geo, Graticule, GridX, GridY, Image, Line, Link, Pointer, Rect, RectX, RectY, RuleX, RuleY, Sphere, Spike, Text, TickX, TickY, Vector } from '../marks/index.js';
|
|
7
|
+
import type WaffleX from '../marks/WaffleX.svelte';
|
|
8
|
+
import type WaffleY from '../marks/WaffleY.svelte';
|
|
7
9
|
export type PlotState = {
|
|
8
10
|
width: number;
|
|
9
11
|
height: number;
|
|
@@ -230,6 +232,10 @@ export type PlotDefaults = {
|
|
|
230
232
|
gridY: Partial<Omit<ComponentProps<typeof GridY>, IgnoreDefaults> & {
|
|
231
233
|
implicit: boolean;
|
|
232
234
|
}>;
|
|
235
|
+
/**
|
|
236
|
+
* default props for image marks
|
|
237
|
+
*/
|
|
238
|
+
image: Partial<Omit<ComponentProps<typeof Image>, IgnoreDefaults>>;
|
|
233
239
|
/**
|
|
234
240
|
* default props for line marks
|
|
235
241
|
*/
|
|
@@ -294,6 +300,18 @@ export type PlotDefaults = {
|
|
|
294
300
|
* default props for vector marks
|
|
295
301
|
*/
|
|
296
302
|
vector: Partial<Omit<ComponentProps<typeof Vector>, IgnoreDefaults>>;
|
|
303
|
+
/**
|
|
304
|
+
* default props for waffle marks, applied to both waffleX and waffleY marks
|
|
305
|
+
*/
|
|
306
|
+
waffle: Partial<Omit<ComponentProps<typeof WaffleX>, IgnoreDefaults>>;
|
|
307
|
+
/**
|
|
308
|
+
* default props for waffleX marks
|
|
309
|
+
*/
|
|
310
|
+
waffleX: Partial<Omit<ComponentProps<typeof WaffleX>, IgnoreDefaults>>;
|
|
311
|
+
/**
|
|
312
|
+
* default props for waffleY marks
|
|
313
|
+
*/
|
|
314
|
+
waffleY: Partial<Omit<ComponentProps<typeof WaffleY>, IgnoreDefaults>>;
|
|
297
315
|
};
|
|
298
316
|
export type PlotOptions = {
|
|
299
317
|
/**
|
|
@@ -418,8 +436,8 @@ export type PlotOptions = {
|
|
|
418
436
|
opacity: Partial<ScaleOptions>;
|
|
419
437
|
symbol: Partial<LegendScaleOptions>;
|
|
420
438
|
length: Partial<ScaleOptions>;
|
|
421
|
-
fx: Partial<
|
|
422
|
-
fy: Partial<
|
|
439
|
+
fx: Partial<XScaleOptions>;
|
|
440
|
+
fy: Partial<YScaleOptions>;
|
|
423
441
|
children: Snippet<[
|
|
424
442
|
{
|
|
425
443
|
width: number;
|
package/dist/types/scale.d.ts
CHANGED
|
@@ -106,6 +106,14 @@ export type XScaleOptions = ScaleOptions & {
|
|
|
106
106
|
tickRotate: number;
|
|
107
107
|
labelAnchor: 'auto' | 'left' | 'center' | 'right';
|
|
108
108
|
tickFormat: false | Intl.NumberFormatOptions | ((d: RawValue) => string);
|
|
109
|
+
/**
|
|
110
|
+
* Enable word wrapping for axis tick labels, default true
|
|
111
|
+
*/
|
|
112
|
+
wordWrap: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Remove duplicate ticks from axis, default true
|
|
115
|
+
*/
|
|
116
|
+
removeDuplicateTicks: boolean;
|
|
109
117
|
};
|
|
110
118
|
export type YScaleOptions = ScaleOptions & {
|
|
111
119
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelteplot",
|
|
3
|
-
"version": "0.5.3-pr-
|
|
3
|
+
"version": "0.5.3-pr-255.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Gregor Aisch",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"@sveltejs/adapter-auto": "^6.1.1",
|
|
58
58
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
59
59
|
"@sveltejs/eslint-config": "^8.3.4",
|
|
60
|
-
"@sveltejs/kit": "^2.
|
|
60
|
+
"@sveltejs/kit": "^2.48.5",
|
|
61
61
|
"@sveltejs/package": "^2.5.4",
|
|
62
62
|
"@sveltejs/vite-plugin-svelte": "5.1.1",
|
|
63
63
|
"@sveltepress/theme-default": "^6.0.4",
|
|
64
64
|
"@sveltepress/twoslash": "^1.2.2",
|
|
65
65
|
"@sveltepress/vite": "^1.2.2",
|
|
66
|
-
"@testing-library/svelte": "^5.2.
|
|
66
|
+
"@testing-library/svelte": "^5.2.9",
|
|
67
67
|
"@testing-library/user-event": "^14.6.1",
|
|
68
68
|
"@types/d3-array": "^3.2.2",
|
|
69
69
|
"@types/d3-color": "^3.1.3",
|
|
@@ -79,24 +79,24 @@
|
|
|
79
79
|
"@types/geojson": "^7946.0.16",
|
|
80
80
|
"@types/topojson": "^3.2.6",
|
|
81
81
|
"@types/topojson-client": "^3.1.5",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
83
|
-
"@typescript-eslint/parser": "^8.46.
|
|
84
|
-
"csstype": "^3.
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
83
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
84
|
+
"csstype": "^3.2.0",
|
|
85
85
|
"d3-dsv": "^3.0.1",
|
|
86
86
|
"d3-fetch": "^3.0.1",
|
|
87
87
|
"d3-force": "^3.0.0",
|
|
88
|
-
"eslint": "^9.
|
|
88
|
+
"eslint": "^9.39.1",
|
|
89
89
|
"eslint-config-prettier": "^10.1.8",
|
|
90
|
-
"eslint-plugin-svelte": "3.
|
|
90
|
+
"eslint-plugin-svelte": "3.13.0",
|
|
91
91
|
"jsdom": "^26.1.0",
|
|
92
92
|
"prettier": "^3.6.2",
|
|
93
93
|
"prettier-plugin-svelte": "^3.4.0",
|
|
94
|
-
"puppeteer": "^24.
|
|
94
|
+
"puppeteer": "^24.30.0",
|
|
95
95
|
"remark-code-extra": "^1.0.1",
|
|
96
96
|
"remark-code-frontmatter": "^1.0.0",
|
|
97
97
|
"resize-observer-polyfill": "^1.5.1",
|
|
98
|
-
"sass": "^1.
|
|
99
|
-
"svelte-check": "^4.3.
|
|
98
|
+
"sass": "^1.94.0",
|
|
99
|
+
"svelte-check": "^4.3.4",
|
|
100
100
|
"svelte-eslint-parser": "1.4.0",
|
|
101
101
|
"svelte-highlight": "^7.9.0",
|
|
102
102
|
"svg-path-parser": "^1.1.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
108
108
|
"typescript": "^5.9.3",
|
|
109
109
|
"vite": "^6.4.1",
|
|
110
|
-
"vitest": "^
|
|
110
|
+
"vitest": "^4.0.9",
|
|
111
111
|
"vitest-matchmedia-mock": "^2.0.3",
|
|
112
112
|
"yoctocolors": "^2.1.2"
|
|
113
113
|
},
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
"d3-shape": "^3.2.0",
|
|
128
128
|
"d3-time": "^3.1.0",
|
|
129
129
|
"es-toolkit": "^1.41.0",
|
|
130
|
-
"fast-equals": "^5.3.
|
|
130
|
+
"fast-equals": "^5.3.3",
|
|
131
131
|
"interval-tree-1d": "^1.0.4",
|
|
132
132
|
"merge-deep": "^3.0.3",
|
|
133
|
-
"svelte": "5
|
|
133
|
+
"svelte": "5"
|
|
134
134
|
}
|
|
135
135
|
}
|