@ponchia/ui 0.4.1 → 0.5.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/CHANGELOG.md +230 -8
- package/MIGRATIONS.json +92 -0
- package/README.md +9 -6
- package/annotations/index.d.ts +280 -0
- package/annotations/index.js +522 -0
- package/behaviors/carousel.js +197 -0
- package/behaviors/combobox.js +195 -0
- package/behaviors/command.js +187 -0
- package/behaviors/connectors.js +96 -0
- package/behaviors/crosshair.js +58 -0
- package/behaviors/dialog.js +73 -0
- package/behaviors/disclosure.js +25 -0
- package/behaviors/dismissible.js +24 -0
- package/behaviors/forms.js +158 -0
- package/behaviors/glyph.js +109 -0
- package/behaviors/index.d.ts +79 -0
- package/behaviors/index.js +18 -1409
- package/behaviors/internal.js +50 -0
- package/behaviors/legend.js +46 -0
- package/behaviors/menu.js +46 -0
- package/behaviors/popover.js +108 -0
- package/behaviors/spotlight.js +53 -0
- package/behaviors/table.js +109 -0
- package/behaviors/tabs.js +103 -0
- package/behaviors/theme.js +82 -0
- package/behaviors/toast.js +152 -0
- package/classes/index.d.ts +280 -2
- package/classes/index.js +313 -2
- package/connectors/index.d.ts +71 -0
- package/connectors/index.js +179 -0
- package/css/analytical.css +21 -0
- package/css/annotations.css +292 -0
- package/css/command.css +97 -0
- package/css/connectors.css +93 -0
- package/css/crosshair.css +100 -0
- package/css/feedback.css +51 -0
- package/css/fonts.css +11 -7
- package/css/generated.css +117 -0
- package/css/legend.css +268 -0
- package/css/marks.css +144 -0
- package/css/primitives.css +18 -0
- package/css/report.css +12 -31
- package/css/selection.css +46 -0
- package/css/sources.css +179 -0
- package/css/spotlight.css +104 -0
- package/css/state.css +121 -0
- package/css/tokens.css +25 -37
- package/css/workbench.css +83 -0
- package/dist/bronto.css +1 -1
- package/dist/css/analytical.css +1 -0
- package/dist/css/annotations.css +1 -0
- package/dist/css/command.css +1 -0
- package/dist/css/connectors.css +1 -0
- package/dist/css/crosshair.css +1 -0
- package/dist/css/feedback.css +1 -1
- package/dist/css/fonts.css +1 -1
- package/dist/css/generated.css +1 -0
- package/dist/css/legend.css +1 -0
- package/dist/css/marks.css +1 -0
- package/dist/css/primitives.css +1 -1
- package/dist/css/report.css +1 -1
- package/dist/css/selection.css +1 -0
- package/dist/css/sources.css +1 -0
- package/dist/css/spotlight.css +1 -0
- package/dist/css/state.css +1 -0
- package/dist/css/workbench.css +1 -0
- package/docs/adr/0003-theme-model.md +7 -4
- package/docs/annotations.md +345 -0
- package/docs/architecture.md +202 -0
- package/docs/command.md +95 -0
- package/docs/connectors.md +91 -0
- package/docs/crosshair.md +63 -0
- package/docs/generated.md +91 -0
- package/docs/legends.md +168 -0
- package/docs/marks.md +86 -0
- package/docs/reference.md +309 -3
- package/docs/reporting.md +49 -14
- package/docs/selection.md +40 -0
- package/docs/sources.md +110 -0
- package/docs/spotlight.md +78 -0
- package/docs/stability.md +16 -1
- package/docs/state.md +85 -0
- package/docs/usage.md +22 -0
- package/docs/workbench.md +72 -0
- package/fonts/doto-400.woff2 +0 -0
- package/fonts/doto-500.woff2 +0 -0
- package/fonts/doto-600.woff2 +0 -0
- package/fonts/doto-700.woff2 +0 -0
- package/fonts/doto-800.woff2 +0 -0
- package/fonts/doto-900.woff2 +0 -0
- package/llms.txt +229 -6
- package/package.json +69 -4
- package/qwik/index.d.ts +5 -0
- package/qwik/index.js +20 -0
- package/react/index.d.ts +5 -0
- package/react/index.js +10 -0
- package/solid/index.d.ts +5 -0
- package/solid/index.js +10 -0
- package/tokens/index.js +9 -5
- package/fonts/doto-400.ttf +0 -0
- package/fonts/doto-500.ttf +0 -0
- package/fonts/doto-600.ttf +0 -0
- package/fonts/doto-700.ttf +0 -0
- package/fonts/doto-800.ttf +0 -0
- package/fonts/doto-900.ttf +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/** @ponchia/ui — SVG annotation geometry helpers. */
|
|
2
|
+
|
|
3
|
+
export interface AnnotationPoint {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AnnotationOffset {
|
|
9
|
+
dx: number;
|
|
10
|
+
dy: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AnnotationConnectorType = 'callout' | 'elbow' | 'curve';
|
|
14
|
+
export type AnnotationAlign = 'start' | 'middle' | 'end';
|
|
15
|
+
export type AnnotationValign = 'top' | 'middle' | 'bottom';
|
|
16
|
+
export type AxisOrientation = 'horizontal' | 'vertical';
|
|
17
|
+
export type TimelineDirection = 'up' | 'down' | 'left' | 'right';
|
|
18
|
+
|
|
19
|
+
export interface CircleSubject {
|
|
20
|
+
type: 'circle';
|
|
21
|
+
radius: number;
|
|
22
|
+
radiusPadding?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface RectSubject {
|
|
26
|
+
type: 'rect';
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
padding?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ConnectorSubject = CircleSubject | RectSubject;
|
|
35
|
+
|
|
36
|
+
export interface ConnectorOptions extends AnnotationOffset {
|
|
37
|
+
subject?: ConnectorSubject;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CircleSubjectOptions {
|
|
41
|
+
radius: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RectSubjectOptions {
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
47
|
+
x?: number;
|
|
48
|
+
y?: number;
|
|
49
|
+
padding?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ThresholdOptions {
|
|
53
|
+
x1?: number;
|
|
54
|
+
y1?: number;
|
|
55
|
+
x2: number;
|
|
56
|
+
y2: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AxisThresholdOptions {
|
|
60
|
+
orientation?: AxisOrientation;
|
|
61
|
+
value?: number;
|
|
62
|
+
start?: number;
|
|
63
|
+
end: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface BracketSubjectOptions {
|
|
67
|
+
x1: number;
|
|
68
|
+
y1: number;
|
|
69
|
+
x2: number;
|
|
70
|
+
y2: number;
|
|
71
|
+
depth?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface BandSubjectOptions {
|
|
75
|
+
x?: number;
|
|
76
|
+
y?: number;
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
padding?: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface SlopeSubjectOptions {
|
|
83
|
+
x1: number;
|
|
84
|
+
y1: number;
|
|
85
|
+
x2: number;
|
|
86
|
+
y2: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ComparisonBraceOptions {
|
|
90
|
+
x1: number;
|
|
91
|
+
y1: number;
|
|
92
|
+
x2: number;
|
|
93
|
+
y2: number;
|
|
94
|
+
depth?: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface OutlierClusterOptions {
|
|
98
|
+
points: AnnotationPoint[];
|
|
99
|
+
radius?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface TimelineEventOptions {
|
|
103
|
+
size?: number;
|
|
104
|
+
direction?: TimelineDirection;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface EvidenceMarkerOptions {
|
|
108
|
+
x?: number;
|
|
109
|
+
y?: number;
|
|
110
|
+
width?: number;
|
|
111
|
+
height?: number;
|
|
112
|
+
padding?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ConnectorEndDotOptions extends AnnotationPoint {
|
|
116
|
+
radius?: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface ConnectorEndArrowOptions {
|
|
120
|
+
x1?: number;
|
|
121
|
+
y1?: number;
|
|
122
|
+
x2: number;
|
|
123
|
+
y2: number;
|
|
124
|
+
size?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface NoteTransformOptions {
|
|
128
|
+
dx?: number;
|
|
129
|
+
dy?: number;
|
|
130
|
+
x?: number;
|
|
131
|
+
y?: number;
|
|
132
|
+
align?: AnnotationAlign;
|
|
133
|
+
valign?: AnnotationValign;
|
|
134
|
+
width?: number;
|
|
135
|
+
height?: number;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface AnnotationBounds {
|
|
139
|
+
x?: number;
|
|
140
|
+
y?: number;
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface NotePlacementOptions {
|
|
146
|
+
x?: number;
|
|
147
|
+
y?: number;
|
|
148
|
+
width: number;
|
|
149
|
+
height: number;
|
|
150
|
+
bounds: AnnotationBounds;
|
|
151
|
+
padding?: number;
|
|
152
|
+
gap?: number;
|
|
153
|
+
preferred?: 'right' | 'left' | 'top' | 'bottom';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface NotePlacement {
|
|
157
|
+
dx: number;
|
|
158
|
+
dy: number;
|
|
159
|
+
align: AnnotationAlign;
|
|
160
|
+
valign: AnnotationValign;
|
|
161
|
+
transform: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export type AnnotationPartsSubject =
|
|
165
|
+
| CircleSubject
|
|
166
|
+
| RectSubject
|
|
167
|
+
| ({ type: 'threshold' } & ThresholdOptions)
|
|
168
|
+
| ({ type: 'bracket' } & BracketSubjectOptions)
|
|
169
|
+
| ({ type: 'band' } & BandSubjectOptions)
|
|
170
|
+
| ({ type: 'slope' } & SlopeSubjectOptions)
|
|
171
|
+
| ({ type: 'compare' } & ComparisonBraceOptions)
|
|
172
|
+
| ({ type: 'cluster' } & OutlierClusterOptions)
|
|
173
|
+
| ({ type: 'axis' } & AxisThresholdOptions)
|
|
174
|
+
| ({ type: 'timeline' } & TimelineEventOptions)
|
|
175
|
+
| ({ type: 'evidence' } & EvidenceMarkerOptions);
|
|
176
|
+
|
|
177
|
+
export interface AnnotationPartsOptions {
|
|
178
|
+
type?: AnnotationConnectorType;
|
|
179
|
+
x?: number;
|
|
180
|
+
y?: number;
|
|
181
|
+
dx?: number;
|
|
182
|
+
dy?: number;
|
|
183
|
+
subject?: AnnotationPartsSubject;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface AnnotationParts {
|
|
187
|
+
transform: string;
|
|
188
|
+
subject: string;
|
|
189
|
+
connector: string;
|
|
190
|
+
note: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export declare function annotationTransform(point?: Partial<AnnotationPoint>): string;
|
|
194
|
+
export declare function noteTransform(options?: NoteTransformOptions): string;
|
|
195
|
+
export declare function notePlacement(options: NotePlacementOptions): NotePlacement;
|
|
196
|
+
export declare function circleSubjectPath(options: CircleSubjectOptions): string;
|
|
197
|
+
export declare function rectSubjectPath(options: RectSubjectOptions): string;
|
|
198
|
+
export declare function thresholdPath(options: ThresholdOptions): string;
|
|
199
|
+
export declare function axisThresholdPath(options: AxisThresholdOptions): string;
|
|
200
|
+
export declare function bracketSubjectPath(options: BracketSubjectOptions): string;
|
|
201
|
+
export declare function bandSubjectPath(options: BandSubjectOptions): string;
|
|
202
|
+
export declare function slopeSubjectPath(options: SlopeSubjectOptions): string;
|
|
203
|
+
export declare function comparisonBracePath(options: ComparisonBraceOptions): string;
|
|
204
|
+
export declare function outlierClusterPath(options: OutlierClusterOptions): string;
|
|
205
|
+
export declare function timelineEventPath(options?: TimelineEventOptions): string;
|
|
206
|
+
export declare function evidenceMarkerPath(options?: EvidenceMarkerOptions): string;
|
|
207
|
+
export declare function connectorEndDot(options: ConnectorEndDotOptions): string;
|
|
208
|
+
export declare function connectorEndArrow(options: ConnectorEndArrowOptions): string;
|
|
209
|
+
export declare function connectorLine(options: ConnectorOptions): string;
|
|
210
|
+
export declare function connectorElbow(options: ConnectorOptions): string;
|
|
211
|
+
export declare function connectorCurve(options: ConnectorOptions): string;
|
|
212
|
+
export declare function annotationParts(options?: AnnotationPartsOptions): AnnotationParts;
|
|
213
|
+
|
|
214
|
+
export interface DeclutterLabelItem {
|
|
215
|
+
/** Desired centre coordinate along the axis. */
|
|
216
|
+
pos: number;
|
|
217
|
+
/** The label's extent along the axis. */
|
|
218
|
+
size: number;
|
|
219
|
+
}
|
|
220
|
+
export interface DeclutterLabelsOptions {
|
|
221
|
+
/** Minimum gap kept between adjacent labels. Default 0. */
|
|
222
|
+
gap?: number;
|
|
223
|
+
/** Lower bound of the axis. Default -Infinity. */
|
|
224
|
+
min?: number;
|
|
225
|
+
/** Upper bound of the axis. Default Infinity. */
|
|
226
|
+
max?: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 1-D label declutter: nudge overlapping labels apart, order-preserving and
|
|
230
|
+
* deterministic. Returns the adjusted centre per input item (input order). Not
|
|
231
|
+
* a general 2-D collision solver.
|
|
232
|
+
*/
|
|
233
|
+
export declare function declutterLabels(
|
|
234
|
+
items: DeclutterLabelItem[],
|
|
235
|
+
opts?: DeclutterLabelsOptions,
|
|
236
|
+
): number[];
|
|
237
|
+
|
|
238
|
+
export interface DirectLabelItem {
|
|
239
|
+
/** The true data point the label refers to (figure coordinates). */
|
|
240
|
+
anchor: AnnotationPoint;
|
|
241
|
+
/** The label's extent along the layout axis. */
|
|
242
|
+
size: number;
|
|
243
|
+
/** Optional identifier, echoed back on the matching output (input order). */
|
|
244
|
+
key?: string | number;
|
|
245
|
+
}
|
|
246
|
+
export interface DirectLabelsOptions {
|
|
247
|
+
/** Axis the labels declutter along. 'y' = a vertical column. Default 'y'. */
|
|
248
|
+
axis?: 'x' | 'y';
|
|
249
|
+
/** Fixed coordinate on the other axis where the label column/row sits. Default 0. */
|
|
250
|
+
cross?: number;
|
|
251
|
+
/** Minimum gap kept between adjacent labels. Default 0. */
|
|
252
|
+
gap?: number;
|
|
253
|
+
/** Lower bound of the layout axis. Default -Infinity. */
|
|
254
|
+
min?: number;
|
|
255
|
+
/** Upper bound of the layout axis. Default Infinity. */
|
|
256
|
+
max?: number;
|
|
257
|
+
/** Leader-line shape. Default 'straight'. */
|
|
258
|
+
shape?: 'straight' | 'elbow' | 'curve';
|
|
259
|
+
}
|
|
260
|
+
export interface DirectLabel {
|
|
261
|
+
/** Placed label point — the leader's label-side end. */
|
|
262
|
+
x: number;
|
|
263
|
+
y: number;
|
|
264
|
+
/** The echoed input anchor. */
|
|
265
|
+
anchor: AnnotationPoint;
|
|
266
|
+
/** The echoed input key, if any. */
|
|
267
|
+
key?: string | number;
|
|
268
|
+
/** SVG path for the leader (anchor → label point); '' if they coincide. */
|
|
269
|
+
d: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Direct labeling: declutter labels along one axis and draw a leader from each
|
|
273
|
+
* anchor to its placed label (reusing the connector kernel). Deterministic and
|
|
274
|
+
* pure — no scales, no DOM, no 2-D placement. Output feeds a
|
|
275
|
+
* `<path class="ui-annotation__connector">` plus a label at `{x, y}`.
|
|
276
|
+
*/
|
|
277
|
+
export declare function directLabels(
|
|
278
|
+
items: DirectLabelItem[],
|
|
279
|
+
opts?: DirectLabelsOptions,
|
|
280
|
+
): DirectLabel[];
|