svelteplot 0.3.11-pr-153.16 → 0.3.11-pr-153.18
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/marks/Text.svelte
CHANGED
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
| 'bottom-right',
|
|
50
50
|
Datum
|
|
51
51
|
>;
|
|
52
|
+
/**
|
|
53
|
+
* rotate text by angle in degrees
|
|
54
|
+
*/
|
|
55
|
+
rotate: ConstantAccessor<number, Datum>;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
import { getContext, type Snippet } from 'svelte';
|
|
@@ -59,14 +63,11 @@
|
|
|
59
63
|
ConstantAccessor,
|
|
60
64
|
ChannelAccessor,
|
|
61
65
|
PlotDefaults,
|
|
62
|
-
TransformArg,
|
|
63
|
-
RawValue,
|
|
64
66
|
LinkableMarkProps
|
|
65
67
|
} from '../types/index.js';
|
|
66
68
|
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
67
69
|
import Mark from '../Mark.svelte';
|
|
68
70
|
import { sort } from '../index.js';
|
|
69
|
-
import Anchor from './helpers/Anchor.svelte';
|
|
70
71
|
|
|
71
72
|
import MultilineText from './helpers/MultilineText.svelte';
|
|
72
73
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as CSS from 'csstype';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
|
-
import type { DataRecord, ConstantAccessor, ChannelAccessor,
|
|
3
|
+
import type { DataRecord, ConstantAccessor, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
|
|
4
4
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
5
5
|
props(): Partial<{
|
|
6
6
|
filter?: ConstantAccessor<boolean, Datum>;
|
|
@@ -14,7 +14,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
14
14
|
sort: {
|
|
15
15
|
channel: string;
|
|
16
16
|
order?: "ascending" | "descending";
|
|
17
|
-
} | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
|
|
17
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | ConstantAccessor<import("../types/data").RawValue, Datum>;
|
|
18
18
|
stroke: ChannelAccessor<Datum>;
|
|
19
19
|
strokeWidth: ConstantAccessor<number, Datum>;
|
|
20
20
|
strokeOpacity: ConstantAccessor<number, Datum>;
|
|
@@ -94,6 +94,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
|
|
|
94
94
|
*/
|
|
95
95
|
lineHeight?: ConstantAccessor<number, Datum>;
|
|
96
96
|
frameAnchor?: ConstantAccessor<"bottom" | "top" | "left" | "right" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
|
|
97
|
+
/**
|
|
98
|
+
* rotate text by angle in degrees
|
|
99
|
+
*/
|
|
100
|
+
rotate: ConstantAccessor<number, Datum>;
|
|
97
101
|
};
|
|
98
102
|
events(): {};
|
|
99
103
|
slots(): {};
|
|
@@ -116,6 +116,8 @@
|
|
|
116
116
|
const lineHeight = $derived(
|
|
117
117
|
textLines.length > 1 ? (resolveProp(args.lineHeight, d.datum) ?? 1.2) : 0
|
|
118
118
|
);
|
|
119
|
+
|
|
120
|
+
const rotate = $derived(+resolveProp(args.rotate, d.datum, 0));
|
|
119
121
|
</script>
|
|
120
122
|
|
|
121
123
|
{#if textLines.length > 1}
|
|
@@ -134,7 +136,7 @@
|
|
|
134
136
|
: 0) *
|
|
135
137
|
computedFontSize *
|
|
136
138
|
lineHeight
|
|
137
|
-
)})"
|
|
139
|
+
)}) rotate({rotate})"
|
|
138
140
|
>{#each textLines as line, l (l)}<tspan
|
|
139
141
|
x="0"
|
|
140
142
|
dy={l ? computedFontSize * lineHeight : 0}
|
|
@@ -146,7 +148,7 @@
|
|
|
146
148
|
<text
|
|
147
149
|
class={[textClassName, styleClass]}
|
|
148
150
|
dominant-baseline={LINE_ANCHOR[lineAnchor]}
|
|
149
|
-
transform="translate({Math.round(x + dx)},{Math.round(y + dy)})"
|
|
151
|
+
transform="translate({Math.round(x + dx)},{Math.round(y + dy)}) rotate({rotate})"
|
|
150
152
|
{style}
|
|
151
153
|
>{textLines[0]}{#if title}<title>{title}</title>{/if}</text>
|
|
152
154
|
{/if}
|
package/dist/types/scale.d.ts
CHANGED