svelteplot 0.4.5-pr-208.3 → 0.4.5
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 +73 -87
- package/dist/Mark.svelte.d.ts +34 -37
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/scales.d.ts +2 -2
- package/dist/helpers/scales.js +10 -21
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/marks/Area.svelte.d.ts +34 -37
- package/dist/marks/AreaX.svelte.d.ts +35 -38
- package/dist/marks/AreaY.svelte.d.ts +35 -38
- package/dist/marks/Arrow.svelte.d.ts +34 -37
- package/dist/marks/AxisX.svelte +2 -2
- package/dist/marks/AxisX.svelte.d.ts +36 -39
- package/dist/marks/AxisY.svelte.d.ts +35 -38
- package/dist/marks/BarX.svelte.d.ts +35 -38
- package/dist/marks/BarY.svelte.d.ts +34 -37
- package/dist/marks/BollingerX.svelte.d.ts +74 -2
- package/dist/marks/BollingerY.svelte.d.ts +74 -2
- package/dist/marks/Cell.svelte.d.ts +34 -37
- package/dist/marks/CustomMark.svelte.d.ts +81 -2
- package/dist/marks/DifferenceY.svelte.d.ts +67 -7
- package/dist/marks/Dot.svelte +1 -1
- package/dist/marks/Dot.svelte.d.ts +34 -37
- package/dist/marks/DotX.svelte.d.ts +34 -37
- package/dist/marks/DotY.svelte.d.ts +34 -37
- package/dist/marks/Geo.svelte.d.ts +34 -37
- package/dist/marks/GridX.svelte.d.ts +34 -37
- package/dist/marks/GridY.svelte.d.ts +34 -37
- package/dist/marks/Line.svelte.d.ts +36 -39
- package/dist/marks/LineX.svelte.d.ts +35 -38
- package/dist/marks/LineY.svelte.d.ts +35 -38
- package/dist/marks/Link.svelte.d.ts +34 -37
- package/dist/marks/Rect.svelte.d.ts +34 -37
- package/dist/marks/RuleX.svelte.d.ts +34 -37
- package/dist/marks/RuleY.svelte.d.ts +34 -37
- package/dist/marks/Spike.svelte.d.ts +34 -36
- package/dist/marks/Text.svelte.d.ts +34 -37
- package/dist/marks/TickX.svelte.d.ts +34 -37
- package/dist/marks/TickY.svelte.d.ts +34 -37
- package/dist/marks/Vector.svelte.d.ts +34 -37
- package/dist/marks/helpers/BaseAxisX.svelte +0 -10
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +0 -1
- package/dist/marks/helpers/RectPath.svelte.d.ts +63 -3
- package/dist/marks/helpers/Regression.svelte +1 -1
- package/dist/transforms/bollinger.d.ts +67 -1
- package/dist/transforms/group.d.ts +12 -4
- package/dist/transforms/interval.d.ts +124 -2
- package/dist/transforms/recordize.d.ts +4 -1
- package/dist/transforms/select.d.ts +434 -7
- package/dist/transforms/sort.d.ts +246 -3
- package/dist/transforms/stack.d.ts +23 -3
- package/dist/transforms/window.d.ts +130 -2
- package/dist/types/mark.d.ts +34 -37
- package/dist/types/scale.d.ts +0 -6
- package/package.json +128 -130
- package/dist/regression/exponential.d.ts +0 -17
- package/dist/regression/exponential.js +0 -56
- package/dist/regression/index.d.ts +0 -10
- package/dist/regression/index.js +0 -10
- package/dist/regression/linear.d.ts +0 -17
- package/dist/regression/linear.js +0 -59
- package/dist/regression/loess.d.ts +0 -14
- package/dist/regression/loess.js +0 -122
- package/dist/regression/logarithmic.d.ts +0 -20
- package/dist/regression/logarithmic.js +0 -60
- package/dist/regression/polynomial.d.ts +0 -21
- package/dist/regression/polynomial.js +0 -160
- package/dist/regression/power.d.ts +0 -18
- package/dist/regression/power.js +0 -56
- package/dist/regression/quadratic.d.ts +0 -19
- package/dist/regression/quadratic.js +0 -70
- package/dist/regression/types.d.ts +0 -4
- package/dist/regression/types.js +0 -1
- package/dist/regression/utils/determination.d.ts +0 -6
- package/dist/regression/utils/determination.js +0 -16
- package/dist/regression/utils/geometry.d.ts +0 -9
- package/dist/regression/utils/geometry.js +0 -12
- package/dist/regression/utils/interpose.d.ts +0 -6
- package/dist/regression/utils/interpose.js +0 -37
- package/dist/regression/utils/median.d.ts +0 -4
- package/dist/regression/utils/median.js +0 -8
- package/dist/regression/utils/ols.d.ts +0 -6
- package/dist/regression/utils/ols.js +0 -9
- package/dist/regression/utils/points.d.ts +0 -11
- package/dist/regression/utils/points.js +0 -45
- package/dist/transforms/dodge.d.ts +0 -17
- package/dist/transforms/dodge.js +0 -128
package/dist/Mark.svelte
CHANGED
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
import { testFilter, isValid } from './helpers/index.js';
|
|
42
42
|
import { resolveChannel, resolveProp } from './helpers/resolve.js';
|
|
43
43
|
import { RENAME } from './transforms/rename.js';
|
|
44
|
-
import { dodgeX, dodgeY } from './transforms/dodge.js';
|
|
45
44
|
|
|
46
45
|
let {
|
|
47
46
|
data = [],
|
|
@@ -208,98 +207,85 @@
|
|
|
208
207
|
* elements to the scales
|
|
209
208
|
*/
|
|
210
209
|
const scaledData = $derived(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
out.valid
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
isValid(y);
|
|
251
|
-
}
|
|
210
|
+
resolvedData.flatMap((row) => {
|
|
211
|
+
const out: ScaledDataRecord<Datum> = {
|
|
212
|
+
datum: row.datum,
|
|
213
|
+
index: row[INDEX],
|
|
214
|
+
valid: true
|
|
215
|
+
};
|
|
216
|
+
// compute dx/dy
|
|
217
|
+
out.dx = Number(resolveProp<number>(options.dx, out.datum, 0));
|
|
218
|
+
out.dy = Number(resolveProp<number>(options.dy, out.datum, 0));
|
|
219
|
+
|
|
220
|
+
// special handling if there's a projection, e.g. a line mark
|
|
221
|
+
if (plot.scales.projection && mark.type !== 'geo') {
|
|
222
|
+
for (const suffix of ['', '1', '2']) {
|
|
223
|
+
if (
|
|
224
|
+
options?.[`x${suffix}`] !== undefined &&
|
|
225
|
+
options?.[`y${suffix}`] !== undefined
|
|
226
|
+
) {
|
|
227
|
+
// we have two-dimensional accessors
|
|
228
|
+
// for the x and y channels
|
|
229
|
+
const [x, y] =
|
|
230
|
+
mark.type === 'line'
|
|
231
|
+
? [row.x, row.y] // line paths are projected later
|
|
232
|
+
: projectXY(
|
|
233
|
+
plot.scales,
|
|
234
|
+
row.x,
|
|
235
|
+
row.y,
|
|
236
|
+
usedScales.x,
|
|
237
|
+
usedScales.y,
|
|
238
|
+
suffix
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
out[`x${suffix}`] = x;
|
|
242
|
+
out[`y${suffix}`] = y;
|
|
243
|
+
out.valid =
|
|
244
|
+
out.valid &&
|
|
245
|
+
isValid(row.x) &&
|
|
246
|
+
isValid(row.y) &&
|
|
247
|
+
isValid(x) &&
|
|
248
|
+
isValid(y);
|
|
252
249
|
}
|
|
253
250
|
}
|
|
251
|
+
}
|
|
254
252
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
253
|
+
// iterate over all scaled channels
|
|
254
|
+
for (const [channel, scale] of Object.entries(CHANNEL_SCALE) as [
|
|
255
|
+
ScaledChannelName,
|
|
256
|
+
ScaleName
|
|
257
|
+
][]) {
|
|
258
|
+
// check if the mark has defined an accessor for this channel
|
|
259
|
+
if (options?.[channel] != null && out[channel] === undefined) {
|
|
260
|
+
// resolve value
|
|
261
|
+
const value = row[channel];
|
|
262
|
+
// if this channel was renamed, use the original channel for scaling
|
|
263
|
+
const origChannel = options?.[RENAME]?.[channel] || channel;
|
|
264
|
+
const scaled = usedScales[channel]
|
|
265
|
+
? scale === 'x'
|
|
266
|
+
? projectX(origChannel as 'x' | 'x1' | 'x2', plot.scales, value)
|
|
267
|
+
: scale === 'y'
|
|
268
|
+
? projectY(origChannel as 'y' | 'y1' | 'y2', plot.scales, value)
|
|
269
|
+
: scale === 'color' && !isValid(value)
|
|
270
|
+
? plot.options.color.unknown
|
|
271
|
+
: plot.scales[scale].fn(value)
|
|
272
|
+
: value;
|
|
273
|
+
|
|
274
|
+
out.valid = out.valid && (scale === 'color' || isValid(value));
|
|
275
|
+
|
|
276
|
+
// apply dx/dy transform
|
|
277
|
+
out[channel] =
|
|
278
|
+
Number.isFinite(scaled) && (scale === 'x' || scale === 'y')
|
|
279
|
+
? scaled + (scale === 'x' ? out.dx : out.dy)
|
|
280
|
+
: scaled;
|
|
281
|
+
} else if (defaults[channel]) {
|
|
282
|
+
out[channel] = defaults[channel];
|
|
286
283
|
}
|
|
284
|
+
}
|
|
287
285
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
options
|
|
291
|
-
)
|
|
286
|
+
return [out];
|
|
287
|
+
})
|
|
292
288
|
);
|
|
293
|
-
|
|
294
|
-
function dodge<T>(data: ScaledDataRecord<Datum>[], options: BaseMarkProps<T>) {
|
|
295
|
-
if (options.dodgeX) {
|
|
296
|
-
return dodgeX({ data, ...options }, plot);
|
|
297
|
-
}
|
|
298
|
-
if (options.dodgeY) {
|
|
299
|
-
return dodgeY({ data, ...options }, plot);
|
|
300
|
-
}
|
|
301
|
-
return data;
|
|
302
|
-
}
|
|
303
289
|
</script>
|
|
304
290
|
|
|
305
291
|
{#if errors.length}
|
package/dist/Mark.svelte.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
|
-
import { CHANNEL_SCALE } from './constants.js';
|
|
3
2
|
import type { ScaledChannelName, MarkType, DataRecord, ChannelAccessor, ScaleName, RawValue, ScaledDataRecord, ScaleType } from './types/index.js';
|
|
4
3
|
import { getUsedScales } from './helpers/scales.js';
|
|
5
4
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
6
5
|
props(): Partial<Partial<{
|
|
7
|
-
filter
|
|
8
|
-
facet
|
|
6
|
+
filter?: import("./types/index.js").ConstantAccessor<boolean, Datum>;
|
|
7
|
+
facet?: "auto" | "include" | "exclude";
|
|
9
8
|
fx: ChannelAccessor<Datum>;
|
|
10
9
|
fy: ChannelAccessor<Datum>;
|
|
11
10
|
dx: import("./types/index.js").ConstantAccessor<number, Datum>;
|
|
12
11
|
dy: import("./types/index.js").ConstantAccessor<number, Datum>;
|
|
13
|
-
dodgeX: CHANNEL_SCALE;
|
|
14
|
-
dodgeY: CHANNEL_SCALE;
|
|
15
12
|
fill: ChannelAccessor<Datum>;
|
|
16
13
|
fillOpacity: import("./types/index.js").ConstantAccessor<number, Datum>;
|
|
17
14
|
sort: {
|
|
@@ -32,38 +29,38 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
32
29
|
imageFilter: import("./types/index.js").ConstantAccessor<string, Datum>;
|
|
33
30
|
shapeRendering: import("./types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
34
31
|
paintOrder: import("./types/index.js").ConstantAccessor<string, Datum>;
|
|
35
|
-
onclick
|
|
36
|
-
ondblclick
|
|
37
|
-
onmouseup
|
|
38
|
-
onmousedown
|
|
39
|
-
onmouseenter
|
|
40
|
-
onmousemove
|
|
41
|
-
onmouseleave
|
|
42
|
-
onmouseout
|
|
43
|
-
onmouseover
|
|
44
|
-
onpointercancel
|
|
45
|
-
onpointerdown
|
|
46
|
-
onpointerup
|
|
47
|
-
onpointerenter
|
|
48
|
-
onpointerleave
|
|
49
|
-
onpointermove
|
|
50
|
-
onpointerover
|
|
51
|
-
onpointerout
|
|
52
|
-
ondrag
|
|
53
|
-
ondrop
|
|
54
|
-
ondragstart
|
|
55
|
-
ondragenter
|
|
56
|
-
ondragleave
|
|
57
|
-
ondragover
|
|
58
|
-
ondragend
|
|
59
|
-
ontouchstart
|
|
60
|
-
ontouchmove
|
|
61
|
-
ontouchend
|
|
62
|
-
ontouchcancel
|
|
63
|
-
oncontextmenu
|
|
64
|
-
onwheel
|
|
65
|
-
class
|
|
66
|
-
style
|
|
32
|
+
onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
33
|
+
ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
34
|
+
onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
35
|
+
onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
36
|
+
onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
37
|
+
onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
38
|
+
onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
39
|
+
onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
40
|
+
onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
41
|
+
onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
42
|
+
onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
43
|
+
onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
44
|
+
onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
45
|
+
onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
46
|
+
onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
47
|
+
onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
48
|
+
onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
49
|
+
ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
50
|
+
ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
51
|
+
ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
52
|
+
ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
53
|
+
ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
54
|
+
ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
55
|
+
ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
56
|
+
ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
57
|
+
ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
58
|
+
ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
59
|
+
ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
60
|
+
oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
61
|
+
onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
62
|
+
class?: string;
|
|
63
|
+
style?: string;
|
|
67
64
|
cursor: import("./types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
68
65
|
}>> & {
|
|
69
66
|
data?: Datum[] | undefined;
|
package/dist/helpers/colors.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type SchemeGetter = (n: number) => readonly string[];
|
|
|
6
6
|
export declare function isOrdinalScheme(scheme: ColorScheme): boolean;
|
|
7
7
|
export declare function ordinalScheme(scheme: string): SchemeGetter | undefined;
|
|
8
8
|
export declare function ordinalRange(scheme: string, length: number): readonly string[] | undefined;
|
|
9
|
-
export declare function maybeBooleanRange(domain: boolean[], scheme?: string):
|
|
9
|
+
export declare function maybeBooleanRange(domain: boolean[], scheme?: string): unknown[] | undefined;
|
|
10
10
|
export declare function isQuantitativeScheme(scheme: string): boolean;
|
|
11
11
|
export declare function quantitativeScheme(scheme: string): typeof interpolateBrBG | undefined;
|
|
12
12
|
export declare function isDivergingScheme(scheme: string): boolean;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns first argument that is not null or undefined
|
|
5
5
|
*/
|
|
6
|
-
export declare function coalesce(...args: (RawValue | undefined | null)[]):
|
|
7
|
-
export declare function testFilter<T>(datum: T, options: Channels<T>):
|
|
6
|
+
export declare function coalesce(...args: (RawValue | undefined | null)[]): RawValue | null;
|
|
7
|
+
export declare function testFilter<T>(datum: T, options: Channels<T>): true | T | null;
|
|
8
8
|
export declare function randomId(): string;
|
|
9
9
|
export declare function isSnippet(value: unknown): value is Snippet;
|
|
10
10
|
export declare function isValid(value: RawValue | undefined): value is number | Date | string;
|
package/dist/helpers/scales.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare function createScale<T extends ScaleOptions>(name: ScaleName, sca
|
|
|
15
15
|
autoTitle?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
type: ScaleType;
|
|
18
|
-
domain:
|
|
18
|
+
domain: RawValue[] | [undefined, undefined];
|
|
19
19
|
range: any;
|
|
20
20
|
fn: any;
|
|
21
21
|
skip: Map<ScaledChannelName, Set<symbol>>;
|
|
@@ -28,7 +28,7 @@ export declare function createScale<T extends ScaleOptions>(name: ScaleName, sca
|
|
|
28
28
|
* Infer a scale type based on the scale name, the data values mapped to it and
|
|
29
29
|
* the mark types that are bound to the scale
|
|
30
30
|
*/
|
|
31
|
-
export declare function inferScaleType(name: ScaleName, dataValues: RawValue[], markTypes: Set<MarkType
|
|
31
|
+
export declare function inferScaleType(name: ScaleName, dataValues: RawValue[], markTypes: Set<MarkType>): ScaleType;
|
|
32
32
|
/**
|
|
33
33
|
* Mark channels can explicitly or implicitly be exempt from being
|
|
34
34
|
* mapped to a scale, so everywhere where values are being mapped to
|
package/dist/helpers/scales.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extent, ascending } from 'd3-array';
|
|
2
|
-
import { isColorOrNull,
|
|
2
|
+
import { isColorOrNull, isDateOrNull, isNumberOrNull, isNumberOrNullOrNaN, isStringOrNull } from './typeChecks.js';
|
|
3
3
|
import { CHANNEL_SCALE, VALID_SCALE_TYPES } from '../constants.js';
|
|
4
4
|
import { isSymbolOrNull } from './typeChecks.js';
|
|
5
5
|
import { resolveProp, toChannelOption } from './resolve.js';
|
|
@@ -146,7 +146,7 @@ export function createScale(name, scaleOptions, marks, plotOptions, plotWidth, p
|
|
|
146
146
|
// construct domain from data values
|
|
147
147
|
const valueArr = [...dataValues.values(), ...(scaleOptions.domain || [])].filter((d) => d != null);
|
|
148
148
|
const type = scaleOptions.type === 'auto'
|
|
149
|
-
? inferScaleType(name, valueArr, markTypes
|
|
149
|
+
? inferScaleType(name, valueArr, markTypes)
|
|
150
150
|
: scaleOptions.type;
|
|
151
151
|
if (VALID_SCALE_TYPES[name] && !VALID_SCALE_TYPES[name].has(type)) {
|
|
152
152
|
throw new Error(`Invalid scale type ${type} for scale
|
|
@@ -217,15 +217,11 @@ function domainFromInterval(domain, interval, name) {
|
|
|
217
217
|
const out = interval_.range(lo, interval_.offset(hi));
|
|
218
218
|
return name === 'y' ? out.toReversed() : out;
|
|
219
219
|
}
|
|
220
|
-
const markTypesWithBandDefault = {
|
|
221
|
-
x: new Set(['barY', 'cell', 'tickY']),
|
|
222
|
-
y: new Set(['barX', 'cell', 'tickX'])
|
|
223
|
-
};
|
|
224
220
|
/**
|
|
225
221
|
* Infer a scale type based on the scale name, the data values mapped to it and
|
|
226
222
|
* the mark types that are bound to the scale
|
|
227
223
|
*/
|
|
228
|
-
export function inferScaleType(name, dataValues, markTypes
|
|
224
|
+
export function inferScaleType(name, dataValues, markTypes) {
|
|
229
225
|
if (name === 'color') {
|
|
230
226
|
if (!dataValues.length)
|
|
231
227
|
return 'ordinal';
|
|
@@ -239,22 +235,15 @@ export function inferScaleType(name, dataValues, markTypes, scaleOptions = {}) {
|
|
|
239
235
|
}
|
|
240
236
|
if (name === 'symbol')
|
|
241
237
|
return 'ordinal';
|
|
238
|
+
// for positional scales, try to pick a scale that's required by the mark types
|
|
242
239
|
if (name === 'x' || name === 'y') {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return '
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (scaleOptions.domain.every(isDate))
|
|
250
|
-
return 'time';
|
|
251
|
-
}
|
|
240
|
+
if (name === 'y' &&
|
|
241
|
+
(markTypes.has('barX') || markTypes.has('tickX') || markTypes.has('cell')))
|
|
242
|
+
return 'band';
|
|
243
|
+
if (name === 'x' &&
|
|
244
|
+
(markTypes.has('barY') || markTypes.has('tickY') || markTypes.has('cell')))
|
|
245
|
+
return 'band';
|
|
252
246
|
}
|
|
253
|
-
// for positional scales, try to pick a scale that's required by the mark types
|
|
254
|
-
if (name === 'y' && Array.from(markTypes).some((d) => markTypesWithBandDefault.y.has(d)))
|
|
255
|
-
return 'band';
|
|
256
|
-
if (name === 'x' && Array.from(markTypes).some((d) => markTypesWithBandDefault.x.has(d)))
|
|
257
|
-
return 'band';
|
|
258
247
|
if (!dataValues.length)
|
|
259
248
|
return 'linear';
|
|
260
249
|
if (dataValues.length === 1)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RawValue } from '../types/index.js';
|
|
2
|
-
export declare function isBooleanOrNull(v: RawValue): boolean;
|
|
2
|
+
export declare function isBooleanOrNull(v: RawValue): v is boolean;
|
|
3
3
|
export declare function isDate(v: RawValue): v is Date;
|
|
4
|
-
export declare function isDateOrNull(v: RawValue | null | undefined):
|
|
4
|
+
export declare function isDateOrNull(v: RawValue | null | undefined): v is Date | null | undefined;
|
|
5
5
|
export declare function isNumberOrNull(v: RawValue | null | undefined): boolean;
|
|
6
6
|
export declare function isNumberOrNullOrNaN(v: RawValue | null | undefined): boolean;
|
|
7
|
-
export declare function isStringOrNull(v: RawValue | null | undefined):
|
|
7
|
+
export declare function isStringOrNull(v: RawValue | null | undefined): v is string | null | undefined;
|
|
8
8
|
export declare function isSymbolOrNull(v: RawValue | null | undefined): boolean;
|
|
9
|
-
export declare function isColorOrNull(v: RawValue | null | undefined):
|
|
9
|
+
export declare function isColorOrNull(v: RawValue | null | undefined): boolean;
|
|
10
10
|
export declare function isOpacityOrNull(v: RawValue): boolean;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { type CurveFactory } from 'd3-shape';
|
|
2
|
-
import callWithProps from '../helpers/callWithProps.js';
|
|
3
2
|
import type { CurveName, DataRecord, ConstantAccessor, ChannelAccessor, LinkableMarkProps, RawValue } from '../types/index.js';
|
|
4
3
|
import type { StackOptions } from '../transforms/stack.js';
|
|
5
4
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
6
5
|
props(): Partial<{
|
|
7
|
-
filter
|
|
8
|
-
facet
|
|
6
|
+
filter?: ConstantAccessor<boolean, Datum>;
|
|
7
|
+
facet?: "auto" | "include" | "exclude";
|
|
9
8
|
fx: ChannelAccessor<Datum>;
|
|
10
9
|
fy: ChannelAccessor<Datum>;
|
|
11
10
|
dx: ConstantAccessor<number, Datum>;
|
|
12
11
|
dy: ConstantAccessor<number, Datum>;
|
|
13
|
-
dodgeX: callWithProps;
|
|
14
|
-
dodgeY: callWithProps;
|
|
15
12
|
fill: ChannelAccessor<Datum>;
|
|
16
13
|
fillOpacity: ConstantAccessor<number, Datum>;
|
|
17
14
|
sort: {
|
|
@@ -32,38 +29,38 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
32
29
|
imageFilter: ConstantAccessor<string, Datum>;
|
|
33
30
|
shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
34
31
|
paintOrder: ConstantAccessor<string, Datum>;
|
|
35
|
-
onclick
|
|
36
|
-
ondblclick
|
|
37
|
-
onmouseup
|
|
38
|
-
onmousedown
|
|
39
|
-
onmouseenter
|
|
40
|
-
onmousemove
|
|
41
|
-
onmouseleave
|
|
42
|
-
onmouseout
|
|
43
|
-
onmouseover
|
|
44
|
-
onpointercancel
|
|
45
|
-
onpointerdown
|
|
46
|
-
onpointerup
|
|
47
|
-
onpointerenter
|
|
48
|
-
onpointerleave
|
|
49
|
-
onpointermove
|
|
50
|
-
onpointerover
|
|
51
|
-
onpointerout
|
|
52
|
-
ondrag
|
|
53
|
-
ondrop
|
|
54
|
-
ondragstart
|
|
55
|
-
ondragenter
|
|
56
|
-
ondragleave
|
|
57
|
-
ondragover
|
|
58
|
-
ondragend
|
|
59
|
-
ontouchstart
|
|
60
|
-
ontouchmove
|
|
61
|
-
ontouchend
|
|
62
|
-
ontouchcancel
|
|
63
|
-
oncontextmenu
|
|
64
|
-
onwheel
|
|
65
|
-
class
|
|
66
|
-
style
|
|
32
|
+
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
33
|
+
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
34
|
+
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
35
|
+
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
36
|
+
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
37
|
+
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
38
|
+
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
39
|
+
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
40
|
+
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
41
|
+
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
42
|
+
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
43
|
+
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
44
|
+
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
45
|
+
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
46
|
+
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
47
|
+
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
48
|
+
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
49
|
+
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
50
|
+
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
51
|
+
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
52
|
+
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
53
|
+
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
54
|
+
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
55
|
+
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
56
|
+
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
57
|
+
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
58
|
+
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
|
+
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
|
+
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
61
|
+
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
62
|
+
class?: string;
|
|
63
|
+
style?: string;
|
|
67
64
|
cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
68
65
|
}> & LinkableMarkProps<Datum> & {
|
|
69
66
|
data: Datum[];
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { renameChannels } from '../transforms/rename.js';
|
|
2
1
|
import type { ChannelAccessor, DataRow } from '../types/index.js';
|
|
3
2
|
declare class __sveltets_Render<Datum extends DataRow> {
|
|
4
3
|
props(): Omit<Partial<{
|
|
5
|
-
filter
|
|
6
|
-
facet
|
|
4
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data").RawValue>>;
|
|
5
|
+
facet?: "auto" | "include" | "exclude";
|
|
7
6
|
fx: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
8
7
|
fy: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
9
8
|
dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
10
9
|
dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
11
|
-
dodgeX: renameChannels;
|
|
12
|
-
dodgeY: renameChannels;
|
|
13
10
|
fill: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
14
11
|
fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
15
12
|
sort: {
|
|
@@ -30,38 +27,38 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
30
27
|
imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
31
28
|
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
|
|
32
29
|
paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
33
|
-
onclick
|
|
34
|
-
ondblclick
|
|
35
|
-
onmouseup
|
|
36
|
-
onmousedown
|
|
37
|
-
onmouseenter
|
|
38
|
-
onmousemove
|
|
39
|
-
onmouseleave
|
|
40
|
-
onmouseout
|
|
41
|
-
onmouseover
|
|
42
|
-
onpointercancel
|
|
43
|
-
onpointerdown
|
|
44
|
-
onpointerup
|
|
45
|
-
onpointerenter
|
|
46
|
-
onpointerleave
|
|
47
|
-
onpointermove
|
|
48
|
-
onpointerover
|
|
49
|
-
onpointerout
|
|
50
|
-
ondrag
|
|
51
|
-
ondrop
|
|
52
|
-
ondragstart
|
|
53
|
-
ondragenter
|
|
54
|
-
ondragleave
|
|
55
|
-
ondragover
|
|
56
|
-
ondragend
|
|
57
|
-
ontouchstart
|
|
58
|
-
ontouchmove
|
|
59
|
-
ontouchend
|
|
60
|
-
ontouchcancel
|
|
61
|
-
oncontextmenu
|
|
62
|
-
onwheel
|
|
63
|
-
class
|
|
64
|
-
style
|
|
30
|
+
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
|
+
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
|
+
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
33
|
+
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
34
|
+
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
35
|
+
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
36
|
+
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
37
|
+
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
38
|
+
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
39
|
+
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
40
|
+
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
41
|
+
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
42
|
+
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
43
|
+
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
44
|
+
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
45
|
+
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
46
|
+
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
47
|
+
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
48
|
+
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
49
|
+
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
50
|
+
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
51
|
+
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
52
|
+
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
53
|
+
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
54
|
+
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
55
|
+
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
56
|
+
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
57
|
+
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
58
|
+
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
|
+
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
|
+
class?: string;
|
|
61
|
+
style?: string;
|
|
65
62
|
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data").RawValue>>;
|
|
66
63
|
}> & import("../types/mark").LinkableMarkProps<Record<string | symbol, import("../types/data").RawValue>> & {
|
|
67
64
|
data: Record<string | symbol, import("../types/data").RawValue>[];
|
|
@@ -75,7 +72,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
75
72
|
sort?: import("../types/index.js").ConstantAccessor<import("../types/data").RawValue> | {
|
|
76
73
|
channel: "stroke" | "fill";
|
|
77
74
|
};
|
|
78
|
-
stack?: Partial<
|
|
75
|
+
stack?: Partial<import("../transforms/stack.js").StackOptions>;
|
|
79
76
|
canvas?: boolean;
|
|
80
77
|
}, "y1" | "y2"> & {
|
|
81
78
|
x?: ChannelAccessor<Datum>;
|