svelteplot 0.3.8-pr-134.3 → 0.3.8-pr-143.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/getBaseStyles.js +6 -1
- package/dist/helpers/index.js +4 -1
- package/dist/helpers/resolve.js +1 -1
- package/dist/marks/AxisX.svelte +3 -1
- package/dist/marks/Cell.svelte +1 -1
- package/dist/marks/Dot.svelte +0 -1
- package/dist/marks/Text.svelte +15 -5
- package/dist/marks/Text.svelte.d.ts +18 -9
- package/dist/marks/TickX.svelte +1 -1
- package/dist/marks/TickY.svelte +1 -1
- package/dist/types/mark.d.ts +1 -1
- package/package.json +1 -1
- package/dist/helpers/isValid.d.ts +0 -6
- package/dist/helpers/isValid.js +0 -6
|
@@ -11,11 +11,16 @@ const styleProps = {
|
|
|
11
11
|
blend: 'mix-blend-mode',
|
|
12
12
|
clipPath: 'clip-path',
|
|
13
13
|
mask: 'mask',
|
|
14
|
+
fontFamily: 'font-family',
|
|
14
15
|
fontSize: 'font-size',
|
|
15
|
-
fontWeight: 'font-weight',
|
|
16
16
|
fontStyle: 'font-style',
|
|
17
|
+
fontWeight: 'font-weight',
|
|
17
18
|
textAnchor: 'text-anchor',
|
|
18
19
|
fontVariant: 'font-variant',
|
|
20
|
+
letterSpacing: 'letter-spacing',
|
|
21
|
+
textDecoration: 'text-decoration',
|
|
22
|
+
textTransform: 'text-transform',
|
|
23
|
+
wordSpacing: 'word-spacing',
|
|
19
24
|
cursor: 'cursor',
|
|
20
25
|
pointerEvents: 'pointer-events'
|
|
21
26
|
};
|
package/dist/helpers/index.js
CHANGED
|
@@ -23,7 +23,10 @@ export function isSnippet(value) {
|
|
|
23
23
|
return typeof value === 'function' && value.length === 1;
|
|
24
24
|
}
|
|
25
25
|
export function isValid(value) {
|
|
26
|
-
return value !== null &&
|
|
26
|
+
return (value !== null &&
|
|
27
|
+
value !== undefined &&
|
|
28
|
+
!Number.isNaN(value) &&
|
|
29
|
+
(typeof value !== 'number' || Number.isFinite(value)));
|
|
27
30
|
}
|
|
28
31
|
export function maybeData(data) {
|
|
29
32
|
// if (data.type === 'FeatureCollection') return data.features;
|
package/dist/helpers/resolve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CHANNEL_SCALE } from '../constants.js';
|
|
2
2
|
import isDataRecord from './isDataRecord.js';
|
|
3
3
|
import isRawValue from './isRawValue.js';
|
|
4
|
-
import { isValid } from './
|
|
4
|
+
import { isValid } from './index.js';
|
|
5
5
|
import { getBaseStylesObject } from './getBaseStyles.js';
|
|
6
6
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
7
7
|
export function resolveProp(accessor, datum, _defaultValue = null) {
|
package/dist/marks/AxisX.svelte
CHANGED
|
@@ -209,7 +209,9 @@
|
|
|
209
209
|
)}
|
|
210
210
|
x={plot.options.marginLeft +
|
|
211
211
|
plot.plotWidth * (titleAlign === 'right' ? 1 : titleAlign === 'center' ? 0.5 : 0)}
|
|
212
|
-
y={anchor === 'top'
|
|
212
|
+
y={anchor === 'top'
|
|
213
|
+
? (options.titleFontSize || 11) + 5
|
|
214
|
+
: plot.height - (options.titleFontSize || 11) - 5}
|
|
213
215
|
class="axis-x-title"
|
|
214
216
|
dominant-baseline={anchor === 'top' ? 'auto' : 'hanging'}>{useTitle}</text>
|
|
215
217
|
{/if}
|
package/dist/marks/Cell.svelte
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { recordizeY, sort } from '../index.js';
|
|
27
27
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
28
28
|
|
|
29
|
-
import { isValid } from '../helpers/
|
|
29
|
+
import { isValid } from '../helpers/index.js';
|
|
30
30
|
import RectPath from './helpers/RectPath.svelte';
|
|
31
31
|
|
|
32
32
|
let markProps: CellMarkProps = $props();
|
package/dist/marks/Dot.svelte
CHANGED
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
import { recordizeXY } from '../transforms/recordize.js';
|
|
33
33
|
import { addEventHandlers } from './helpers/events.js';
|
|
34
34
|
import Anchor from './helpers/Anchor.svelte';
|
|
35
|
-
import type { D } from 'vitest/dist/chunks/reporters.d.DL9pg5DB.js';
|
|
36
35
|
|
|
37
36
|
const DEFAULTS = {
|
|
38
37
|
...getContext<PlotDefaults>('svelteplot/_defaults').dot
|
package/dist/marks/Text.svelte
CHANGED
|
@@ -4,17 +4,27 @@
|
|
|
4
4
|
-->
|
|
5
5
|
|
|
6
6
|
<script lang="ts" generics="Datum extends DataRecord">
|
|
7
|
+
import type * as CSS from 'csstype';
|
|
8
|
+
|
|
7
9
|
interface TextMarkProps extends BaseMarkProps<Datum>, LinkableMarkProps<Datum> {
|
|
8
|
-
data
|
|
9
|
-
x
|
|
10
|
-
y
|
|
10
|
+
data?: Datum[];
|
|
11
|
+
x?: ChannelAccessor<Datum>;
|
|
12
|
+
y?: ChannelAccessor<Datum>;
|
|
11
13
|
children?: Snippet;
|
|
12
14
|
text: ConstantAccessor<string | null | false | undefined, Datum>;
|
|
13
15
|
title?: ConstantAccessor<string, Datum>;
|
|
14
16
|
/**
|
|
15
17
|
* the font size of the text
|
|
16
18
|
*/
|
|
17
|
-
|
|
19
|
+
fontFamily?: ConstantAccessor<CSS.Property.FontFamily, Datum>;
|
|
20
|
+
fontSize?: ConstantAccessor<CSS.Property.FontSize, Datum>;
|
|
21
|
+
fontWeight?: ConstantAccessor<CSS.Property.FontWeight, Datum>;
|
|
22
|
+
fontStyle?: ConstantAccessor<CSS.Property.FontStyle, Datum>;
|
|
23
|
+
fontVariant?: ConstantAccessor<CSS.Property.FontVariant, Datum>;
|
|
24
|
+
letterSpacing?: ConstantAccessor<CSS.Property.LetterSpacing, Datum>;
|
|
25
|
+
wordSpacing?: ConstantAccessor<CSS.Property.WordSpacing, Datum>;
|
|
26
|
+
textTransform?: ConstantAccessor<CSS.Property.TextTransform, Datum>;
|
|
27
|
+
textDecoration?: ConstantAccessor<CSS.Property.TextDecoration, Datum>;
|
|
18
28
|
/**
|
|
19
29
|
* if you want to apply class names to individual text elements
|
|
20
30
|
*/
|
|
@@ -62,7 +72,7 @@
|
|
|
62
72
|
|
|
63
73
|
const DEFAULTS = {
|
|
64
74
|
fontSize: 12,
|
|
65
|
-
|
|
75
|
+
c: 500,
|
|
66
76
|
strokeWidth: 1.6,
|
|
67
77
|
frameAnchor: 'center',
|
|
68
78
|
lineHeight: 1.1,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as CSS from 'csstype';
|
|
1
2
|
import { type Snippet } from 'svelte';
|
|
2
3
|
import type { DataRecord, ConstantAccessor, ChannelAccessor, RawValue, LinkableMarkProps } from '../types/index.js';
|
|
3
4
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
@@ -17,16 +18,16 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
17
18
|
stroke: ChannelAccessor<Datum>;
|
|
18
19
|
strokeWidth: ConstantAccessor<number, Datum>;
|
|
19
20
|
strokeOpacity: ConstantAccessor<number, Datum>;
|
|
20
|
-
strokeLinejoin: ConstantAccessor<
|
|
21
|
-
strokeLinecap: ConstantAccessor<
|
|
21
|
+
strokeLinejoin: ConstantAccessor<CSS.Property.StrokeLinejoin, Datum>;
|
|
22
|
+
strokeLinecap: ConstantAccessor<CSS.Property.StrokeLinecap, Datum>;
|
|
22
23
|
strokeMiterlimit: ConstantAccessor<number, Datum>;
|
|
23
24
|
opacity: ChannelAccessor<Datum>;
|
|
24
25
|
strokeDasharray: ConstantAccessor<string, Datum>;
|
|
25
26
|
strokeDashoffset: ConstantAccessor<number, Datum>;
|
|
26
|
-
mixBlendMode: ConstantAccessor<
|
|
27
|
+
mixBlendMode: ConstantAccessor<CSS.Property.MixBlendMode, Datum>;
|
|
27
28
|
clipPath: string;
|
|
28
29
|
imageFilter: ConstantAccessor<string, Datum>;
|
|
29
|
-
shapeRendering: ConstantAccessor<
|
|
30
|
+
shapeRendering: ConstantAccessor<CSS.Property.ShapeRendering, Datum>;
|
|
30
31
|
paintOrder: ConstantAccessor<string, Datum>;
|
|
31
32
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
33
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
@@ -59,18 +60,26 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
59
60
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
61
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
61
62
|
class: string | null;
|
|
62
|
-
cursor: ConstantAccessor<
|
|
63
|
+
cursor: ConstantAccessor<CSS.Property.Cursor, Datum>;
|
|
63
64
|
}> & LinkableMarkProps<Datum> & {
|
|
64
|
-
data
|
|
65
|
-
x
|
|
66
|
-
y
|
|
65
|
+
data?: Datum[] | undefined;
|
|
66
|
+
x?: ChannelAccessor<Datum>;
|
|
67
|
+
y?: ChannelAccessor<Datum>;
|
|
67
68
|
children?: Snippet;
|
|
68
69
|
text: ConstantAccessor<string | false | null | undefined, Datum>;
|
|
69
70
|
title?: ConstantAccessor<string, Datum>;
|
|
70
71
|
/**
|
|
71
72
|
* the font size of the text
|
|
72
73
|
*/
|
|
73
|
-
|
|
74
|
+
fontFamily?: ConstantAccessor<CSS.Property.FontFamily, Datum>;
|
|
75
|
+
fontSize?: ConstantAccessor<CSS.Property.FontSize<0 | (string & {})>, Datum>;
|
|
76
|
+
fontWeight?: ConstantAccessor<CSS.Property.FontWeight, Datum>;
|
|
77
|
+
fontStyle?: ConstantAccessor<CSS.Property.FontStyle, Datum>;
|
|
78
|
+
fontVariant?: ConstantAccessor<CSS.Property.FontVariant, Datum>;
|
|
79
|
+
letterSpacing?: ConstantAccessor<CSS.Property.LetterSpacing<0 | (string & {})>, Datum>;
|
|
80
|
+
wordSpacing?: ConstantAccessor<CSS.Property.WordSpacing<0 | (string & {})>, Datum>;
|
|
81
|
+
textTransform?: ConstantAccessor<CSS.Property.TextTransform, Datum>;
|
|
82
|
+
textDecoration?: ConstantAccessor<CSS.Property.TextDecoration<0 | (string & {})>, Datum>;
|
|
74
83
|
/**
|
|
75
84
|
* if you want to apply class names to individual text elements
|
|
76
85
|
*/
|
package/dist/marks/TickX.svelte
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
} from '../types/index.js';
|
|
36
36
|
import { recordizeX } from '../index.js';
|
|
37
37
|
import { projectX, projectY } from '../helpers/scales.js';
|
|
38
|
-
import { isValid } from '../helpers/
|
|
38
|
+
import { isValid } from '../helpers/index.js';
|
|
39
39
|
import { testFilter, parseInset } from '../helpers/index.js';
|
|
40
40
|
|
|
41
41
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
package/dist/marks/TickY.svelte
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
} from '../types/index.js';
|
|
35
35
|
import { recordizeY } from '../index.js';
|
|
36
36
|
import { projectX, projectY } from '../helpers/scales.js';
|
|
37
|
-
import { isValid } from '../helpers/
|
|
37
|
+
import { isValid } from '../helpers/index.js';
|
|
38
38
|
import { testFilter, parseInset } from '../helpers/index.js';
|
|
39
39
|
|
|
40
40
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
package/dist/types/mark.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type Mark<T> = {
|
|
|
7
7
|
options: T;
|
|
8
8
|
};
|
|
9
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';
|
|
10
|
-
export type MarkStyleProps = 'strokeDasharray' | 'strokeLinejoin' | 'strokeLinecap' | 'opacity' | 'cursor' | 'pointerEvents' | 'blend' | 'fill' | 'fillOpacity' | 'fontWeight' | 'fontVariant' | 'fontSize' | 'fontStyle' | 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'x' | 'y' | 'clipPath' | 'mask' | 'filter' | 'angle' | 'radius' | 'symbol' | 'textAnchor' | 'width';
|
|
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';
|
|
13
13
|
import type * as CSS from 'csstype';
|
package/package.json
CHANGED