@octane-xplat/charts 0.19.0 → 0.20.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/README.md +2 -102
- package/package.json +14 -14
- package/src/Chart.macos.tsrx +248 -246
- package/src/Chart.tsrx +249 -247
- package/src/Chart.web.tsrx +236 -226
- package/src/appkit-pointer.macos.ts +91 -76
- package/src/core/axes.ts +175 -168
- package/src/core/hit.ts +197 -177
- package/src/core/marks.ts +336 -319
- package/src/core/scales.ts +128 -115
- package/src/core/scene.ts +123 -120
- package/src/core/svg.ts +52 -50
- package/src/index.macos.ts +7 -7
- package/src/index.ts +7 -7
- package/src/index.web.ts +7 -7
- package/src/props.ts +83 -83
- package/src/style-merge.ts +40 -37
- package/src/svg-image.macos.ts +21 -20
- package/types/generated/.tsrx-typegen-manifest.json +1 -7
- package/types/generated/Chart.macos.d.ts +0 -7
- package/types/generated/Chart.web.d.ts +0 -10
- package/types/generated/appkit-pointer.macos.d.ts +0 -37
- package/types/generated/index.macos.d.ts +0 -2
- package/types/generated/index.web.d.ts +0 -2
- package/types/generated/svg-image.macos.d.ts +0 -3
package/src/core/svg.ts
CHANGED
|
@@ -8,77 +8,79 @@ import type { PlotBox } from './scales'
|
|
|
8
8
|
* leaf overlay (.agents/docs/notes/primitive-notes.md). */
|
|
9
9
|
|
|
10
10
|
function num(v: number): string {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (!Number.isFinite(v)) {
|
|
12
|
+
return '0'
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
return Number.isInteger(v) ? String(v) : String(+v.toFixed(2))
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function esc(v: string): string {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return v
|
|
20
|
+
.replaceAll('&', '&')
|
|
21
|
+
.replaceAll('"', '"')
|
|
22
|
+
.replaceAll('<', '<')
|
|
23
|
+
.replaceAll('>', '>')
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function paintAttrs(m: Mark): string {
|
|
27
|
-
|
|
28
|
-
if (m.fill !== undefined) {
|
|
29
|
-
out += ` fill="${esc(m.fill)}"`
|
|
30
|
-
}
|
|
27
|
+
let out = ''
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
if (m.fill !== undefined) {
|
|
30
|
+
out += ` fill="${esc(m.fill)}"`
|
|
31
|
+
}
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
if (m.fillOpacity !== undefined) {
|
|
34
|
+
out += ` fill-opacity="${num(m.fillOpacity)}"`
|
|
35
|
+
}
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
if (m.stroke !== undefined) {
|
|
38
|
+
out += ` stroke="${esc(m.stroke)}"`
|
|
39
|
+
}
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
if (m.strokeOpacity !== undefined) {
|
|
42
|
+
out += ` stroke-opacity="${num(m.strokeOpacity)}"`
|
|
43
|
+
}
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
if (m.strokeWidth !== undefined) {
|
|
46
|
+
out += ` stroke-width="${num(m.strokeWidth)}"`
|
|
47
|
+
}
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
if (m.strokeLinecap !== undefined) {
|
|
50
|
+
out += ` stroke-linecap="${m.strokeLinecap}"`
|
|
51
|
+
}
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
if (m.transform !== undefined) {
|
|
54
|
+
out += ` transform="${esc(m.transform)}"`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return out
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
function markXml(m: Mark): string {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
switch (m.kind) {
|
|
62
|
+
case 'path':
|
|
63
|
+
return `<path d="${esc(m.d)}"${paintAttrs(m)}/>`
|
|
64
|
+
case 'rect':
|
|
65
|
+
return `<rect x="${num(m.x)}" y="${num(m.y)}" width="${num(m.width)}" height="${num(m.height)}"${paintAttrs(m)}/>`
|
|
66
|
+
case 'circle':
|
|
67
|
+
return `<circle cx="${num(m.cx)}" cy="${num(m.cy)}" r="${num(m.r)}"${paintAttrs(m)}/>`
|
|
68
|
+
case 'line':
|
|
69
|
+
return `<line x1="${num(m.x1)}" y1="${num(m.y1)}" x2="${num(m.x2)}" y2="${num(m.y2)}"${paintAttrs(m)}/>`
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/** Chart marks are plot-space; axis rules are chart-space. Paint order:
|
|
73
74
|
* gridlines under the translated marks group, frame (spine + stubs) over. */
|
|
74
75
|
export function svgDocument(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
marks: Mark[],
|
|
77
|
+
grid: Mark[],
|
|
78
|
+
frame: Mark[],
|
|
79
|
+
plot: PlotBox,
|
|
80
|
+
width: number,
|
|
81
|
+
height: number,
|
|
81
82
|
): string {
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
const body = `${grid.map(markXml).join('')}<g transform="translate(${num(plot.x)} ${num(plot.y)})">${marks.map(markXml).join('')}</g>${frame.map(markXml).join('')}`
|
|
84
|
+
|
|
85
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${num(width)} ${num(height)}" width="${num(width)}" height="${num(height)}">${body}</svg>`
|
|
84
86
|
}
|
package/src/index.macos.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// reach .tsrx; same convention as @octane-xplat/ui index.*.ts).
|
|
3
3
|
export { Chart } from './Chart.macos.tsrx'
|
|
4
4
|
export type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
AxisSpec,
|
|
6
|
+
ChartDatum,
|
|
7
|
+
ChartHit,
|
|
8
|
+
ChartMargin,
|
|
9
|
+
ChartProps,
|
|
10
|
+
ChartType,
|
|
11
|
+
SeriesSpec,
|
|
12
12
|
} from './props'
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// reach .tsrx; same convention as @octane-xplat/ui index.*.ts).
|
|
3
3
|
export { Chart } from './Chart.tsrx'
|
|
4
4
|
export type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
AxisSpec,
|
|
6
|
+
ChartDatum,
|
|
7
|
+
ChartHit,
|
|
8
|
+
ChartMargin,
|
|
9
|
+
ChartProps,
|
|
10
|
+
ChartType,
|
|
11
|
+
SeriesSpec,
|
|
12
12
|
} from './props'
|
package/src/index.web.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// reach .tsrx; same convention as @octane-xplat/ui index.*.ts).
|
|
3
3
|
export { Chart } from './Chart.web.tsrx'
|
|
4
4
|
export type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
AxisSpec,
|
|
6
|
+
ChartDatum,
|
|
7
|
+
ChartHit,
|
|
8
|
+
ChartMargin,
|
|
9
|
+
ChartProps,
|
|
10
|
+
ChartType,
|
|
11
|
+
SeriesSpec,
|
|
12
12
|
} from './props'
|
package/src/props.ts
CHANGED
|
@@ -6,112 +6,112 @@ export type ChartType = 'line' | 'area' | 'bar' | 'pie' | 'scatter'
|
|
|
6
6
|
|
|
7
7
|
/** One plotted value. */
|
|
8
8
|
export interface ChartDatum {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/** Bar/pie: the category label. Line/area/scatter: number or Date. */
|
|
10
|
+
x: number | string | Date
|
|
11
|
+
/** Value on the quantitative axis. */
|
|
12
|
+
y: number
|
|
13
|
+
/** Per-datum color override — wins over the series color (pie slices,
|
|
14
|
+
* scatter points, individual bars). */
|
|
15
|
+
color?: string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/** One named data series. */
|
|
19
19
|
export interface SeriesSpec {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
/** Legend/tooltip name for the series. */
|
|
21
|
+
name: string
|
|
22
|
+
/** Series color — stroke for line/scatter, fill for area/bar. Falls back
|
|
23
|
+
* to the built-in palette by series index. */
|
|
24
|
+
color?: string
|
|
25
|
+
/** The plotted values. */
|
|
26
|
+
values: ChartDatum[]
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** Per-edge space inside the chart box reserved for axis labels — the
|
|
30
30
|
* plot area occupies the remainder. */
|
|
31
31
|
export interface ChartMargin {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
/** Top margin in px/dips. */
|
|
33
|
+
top?: number
|
|
34
|
+
/** Right margin in px/dips. */
|
|
35
|
+
right?: number
|
|
36
|
+
/** Bottom margin in px/dips — x-axis labels live here by default. */
|
|
37
|
+
bottom?: number
|
|
38
|
+
/** Left margin in px/dips — y-axis labels live here by default. */
|
|
39
|
+
left?: number
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/** Axis decomposition — gridline, tick stub, and label toggle independently
|
|
43
43
|
* (Swift Charts `AxisMarks` shape). Labels render as real positioned
|
|
44
44
|
* elements in the overlay, never `<text>` in markup. */
|
|
45
45
|
export interface AxisSpec {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
/** Tick labels in the margin. Default true. */
|
|
47
|
+
labels?: boolean
|
|
48
|
+
/** Tick stubs on the axis spine. Default true. */
|
|
49
|
+
ticks?: boolean
|
|
50
|
+
/** Gridlines across the plot area. Default false. */
|
|
51
|
+
grid?: boolean
|
|
52
|
+
/** Desired tick count hint — a hint, not a guarantee. */
|
|
53
|
+
tickCount?: number
|
|
54
|
+
/** Tick label formatter; receives the domain value. */
|
|
55
|
+
format?: (value: number | string | Date) => string
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/** A resolved datum reference — `x`/`y` are the datum's values, not pixels. */
|
|
59
59
|
/** A resolved datum reference — `x`/`y` are the datum's values, not pixels. */
|
|
60
60
|
export interface ChartHit {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
/** Series index into `data`. */
|
|
62
|
+
series: number
|
|
63
|
+
/** Datum index within the series. */
|
|
64
|
+
index: number
|
|
65
|
+
/** The datum's x value. */
|
|
66
|
+
x: number | string | Date
|
|
67
|
+
/** Value on the quantitative axis. */
|
|
68
|
+
y: number
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/** Props for the `<Chart>` element — one component for every chart kind,
|
|
72
72
|
* each platform leaf rendering natively. */
|
|
73
73
|
export interface ChartProps {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
74
|
+
/** Which chart kind to render. */
|
|
75
|
+
type: ChartType
|
|
76
|
+
/** Plotted series; most types read `values`, pie reads slice x/y. */
|
|
77
|
+
data: SeriesSpec[]
|
|
78
|
+
/** Explicit size in px (web) / dips (native). Without `height`, the leaf
|
|
79
|
+
* fills its parent or derives height from `aspectRatio`. */
|
|
80
|
+
width?: number
|
|
81
|
+
/** Explicit height — same units as `width`. */
|
|
82
|
+
height?: number
|
|
83
|
+
/** width/height ratio used when `height` is unset. */
|
|
84
|
+
aspectRatio?: number
|
|
85
|
+
/** Space reserved inside the chart box for axis labels — labels live in
|
|
86
|
+
* the margin band, the plot in the remainder. Defaults reserve room for
|
|
87
|
+
* x labels (bottom) and y labels (left) when those axes show labels. */
|
|
88
|
+
margin?: ChartMargin
|
|
89
|
+
/** Bar only: stack series instead of grouping side by side. */
|
|
90
|
+
stacked?: boolean
|
|
91
|
+
/** Pie only: 0–<1 inner-radius fraction — any positive value renders a
|
|
92
|
+
* donut. */
|
|
93
|
+
innerRadiusRatio?: number
|
|
94
|
+
/** X-axis presentation options. */
|
|
95
|
+
xAxis?: AxisSpec
|
|
96
|
+
/** Y-axis presentation options. */
|
|
97
|
+
yAxis?: AxisSpec
|
|
98
|
+
/** Legend row of series swatches. `true` = 'bottom'. Pie legends list
|
|
99
|
+
* slices, not series. */
|
|
100
|
+
legend?: boolean | 'top' | 'bottom'
|
|
101
|
+
/** Show a value callout at the scrub/hover cursor. */
|
|
102
|
+
tooltip?: boolean
|
|
103
|
+
/** Show a snap-to-x cursor rule while scrubbing. */
|
|
104
|
+
crosshair?: boolean
|
|
105
|
+
/** Tap/click a datum. */
|
|
106
|
+
onPress?: (hit: ChartHit) => void
|
|
107
|
+
/** Scrub position changes — `null` when the gesture ends or leaves. */
|
|
108
|
+
onScrub?: (hit: ChartHit | null) => void
|
|
109
|
+
/** Accessible description of the chart for assistive tech. */
|
|
110
|
+
accessibilityLabel?: string
|
|
111
|
+
/** Class list applied to the chart element. */
|
|
112
|
+
className?: any
|
|
113
|
+
/** Inline style (string CSS or object). */
|
|
114
|
+
style?: any
|
|
115
|
+
/** Element id passed through to the host element. */
|
|
116
|
+
id?: string
|
|
117
117
|
}
|
package/src/style-merge.ts
CHANGED
|
@@ -7,50 +7,53 @@ export type StyleInput = string | Record<string, any> | null | undefined | reado
|
|
|
7
7
|
* Authored keys win; array styles fold in order; a string style is appended
|
|
8
8
|
* after the serialized defaults so its declarations override them too. */
|
|
9
9
|
export function mergeStyle(
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
base: Record<string, any>,
|
|
11
|
+
style?: Record<string, any> | readonly (Record<string, any> | null | undefined)[] | null,
|
|
12
12
|
): Record<string, any>
|
|
13
13
|
|
|
14
14
|
export function mergeStyle(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
base: Record<string, any>,
|
|
16
|
+
style?: StyleInput,
|
|
17
17
|
): string | Record<string, any>
|
|
18
18
|
|
|
19
19
|
export function mergeStyle(
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
base: Record<string, any>,
|
|
21
|
+
style?: StyleInput,
|
|
22
22
|
): string | Record<string, any> {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
if (style == null) {
|
|
24
|
+
return base
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let obj: Record<string, any> = { ...base }
|
|
28
|
+
const strings: string[] = []
|
|
29
|
+
const add = (s: StyleInput) => {
|
|
30
|
+
if (s == null) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof s === 'string') {
|
|
35
|
+
strings.push(s)
|
|
36
|
+
} else if (Array.isArray(s)) {
|
|
37
|
+
for (const part of s) {
|
|
38
|
+
add(part)
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
obj = { ...obj, ...s }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
add(style)
|
|
46
|
+
|
|
47
|
+
if (strings.length === 0) {
|
|
48
|
+
return obj
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const prefix = Object.entries(obj)
|
|
52
|
+
.filter(([, v]) => v != null)
|
|
53
|
+
.map(([k, v]) => `${kebab(k)}:${v}`)
|
|
54
|
+
.join(';')
|
|
55
|
+
|
|
56
|
+
return [prefix, ...strings].filter(Boolean).join(';')
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export type StyleProp = string | Record<string, any> | readonly StyleProp[] | null | undefined
|
package/src/svg-image.macos.ts
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
// Kept local to avoid coupling the charts leaf to private UI helpers.
|
|
2
2
|
// Foundation's public ObjC API is available through the AppKit metadata bridge.
|
|
3
3
|
declare const NSString: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
stringWithString(value: string): {
|
|
5
|
+
dataUsingEncoding(encoding: number): {
|
|
6
|
+
base64EncodedStringWithOptions(options: number): string
|
|
7
|
+
} | null
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function svgDataUri(markup: string): string {
|
|
12
|
-
|
|
13
|
-
if (!data) {
|
|
14
|
-
throw new Error('Unable to encode SVG as UTF-8')
|
|
15
|
-
}
|
|
12
|
+
const data = NSString.stringWithString(markup).dataUsingEncoding(4) // NSUTF8StringEncoding
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
if (!data) {
|
|
15
|
+
throw new Error('Unable to encode SVG as UTF-8')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return `data:image/svg+xml;base64,${data.base64EncodedStringWithOptions(0)}`
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/** Normalize bundled markup and SVG data URIs for AppKit's image host. */
|
|
21
22
|
export function appKitImageSource(src: string): string {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (src.trimStart().startsWith('<svg') || src.trimStart().startsWith('<?xml')) {
|
|
24
|
+
return svgDataUri(src)
|
|
25
|
+
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if (
|
|
28
|
+
/^data:image\/svg\+xml[;,]/i.test(src) &&
|
|
29
|
+
!src.slice(0, src.indexOf(',')).endsWith(';base64')
|
|
30
|
+
) {
|
|
31
|
+
return svgDataUri(decodeURIComponent(src.slice(src.indexOf(',') + 1)))
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
return src
|
|
34
35
|
}
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"files": [
|
|
4
4
|
"Chart.d.ts",
|
|
5
|
-
"Chart.macos.d.ts",
|
|
6
|
-
"Chart.web.d.ts",
|
|
7
|
-
"appkit-pointer.macos.d.ts",
|
|
8
5
|
"core/axes.d.ts",
|
|
9
6
|
"core/hit.d.ts",
|
|
10
7
|
"core/marks.d.ts",
|
|
@@ -12,10 +9,7 @@
|
|
|
12
9
|
"core/scene.d.ts",
|
|
13
10
|
"core/svg.d.ts",
|
|
14
11
|
"index.d.ts",
|
|
15
|
-
"index.macos.d.ts",
|
|
16
|
-
"index.web.d.ts",
|
|
17
12
|
"props.d.ts",
|
|
18
|
-
"style-merge.d.ts"
|
|
19
|
-
"svg-image.macos.d.ts"
|
|
13
|
+
"style-merge.d.ts"
|
|
20
14
|
]
|
|
21
15
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ChartProps } from './props.js';
|
|
2
|
-
/** AppKit leaf: one NSImage plus native label and cursor overlays.
|
|
3
|
-
* Hover/drag/click coordinates come from renderer tracking areas, pan
|
|
4
|
-
* recognizer location and the current mouse event; native delivery is
|
|
5
|
-
* unqualified. AppKit does not deliver onTouch, so touch scrubbing is
|
|
6
|
-
* unavailable. */
|
|
7
|
-
export declare function Chart(props: ChartProps): unknown;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** @jsxImportSource @octane-xplat/jsx/dom */
|
|
2
|
-
import type { JSX } from 'octane/jsx-runtime';
|
|
3
|
-
import type { ChartProps } from './props.js';
|
|
4
|
-
/** Chart — web leaf. The core's Mark[] serialize to one svg markup string,
|
|
5
|
-
* inlined as `innerHTML` (Icon.web precedent — the same bytes feed
|
|
6
|
-
* `<svgview>` on native). Axis labels, legend, tooltip, and crosshair are
|
|
7
|
-
* real absolutely-positioned elements in the overlay — never `<text>` in
|
|
8
|
-
* the markup. Pointer handlers attach to the plot host so chart coords are
|
|
9
|
-
* client-minus-rect, matching the markup's coordinate space. */
|
|
10
|
-
export declare function Chart(props: ChartProps): JSX.Element;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ScrubPhase } from './core/hit.js';
|
|
2
|
-
export interface AppKitChartPointerBridge {
|
|
3
|
-
observePointerMotion?(view: unknown, handlers: {
|
|
4
|
-
move(x: number, y: number): void;
|
|
5
|
-
exit(): void;
|
|
6
|
-
}): () => void;
|
|
7
|
-
locatePointer?(view: unknown): {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
} | null;
|
|
11
|
-
}
|
|
12
|
-
/** Raw renderer onPan event — top-left x/y and the NSPanGestureRecognizer
|
|
13
|
-
* state (1 began / 2 changed / 3 ended / anything else cancelled). */
|
|
14
|
-
export interface AppKitPanEvent {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
deltaX: number;
|
|
18
|
-
deltaY: number;
|
|
19
|
-
state: number;
|
|
20
|
-
}
|
|
21
|
-
/** Normalizes the AppKit pointer sources — pan recognizer deltas, tracking-
|
|
22
|
-
* area motion and the current mouse event — onto the shared scrub phases,
|
|
23
|
-
* mirroring the DOM listeners in Chart.web. */
|
|
24
|
-
export declare function createAppKitChartPointer(scrub: (phase: ScrubPhase, x: number, y: number) => void, size: () => {
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
}, bridge?: () => AppKitChartPointerBridge | undefined): {
|
|
28
|
-
pan(event: {
|
|
29
|
-
deltaX?: unknown;
|
|
30
|
-
deltaY?: unknown;
|
|
31
|
-
state?: unknown;
|
|
32
|
-
x?: number;
|
|
33
|
-
y?: number;
|
|
34
|
-
}): void;
|
|
35
|
-
tap(view: unknown): void;
|
|
36
|
-
observe(view: unknown): () => void;
|
|
37
|
-
};
|