@ponchia/ui 0.6.0 → 0.6.4
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 +82 -4
- package/README.md +1 -1
- package/annotations/index.d.ts.map +1 -1
- package/annotations/index.js +36 -33
- package/behaviors/carousel.d.ts +28 -0
- package/behaviors/carousel.d.ts.map +1 -0
- package/behaviors/carousel.js +3 -0
- package/behaviors/combobox.d.ts +40 -0
- package/behaviors/combobox.d.ts.map +1 -0
- package/behaviors/combobox.js +71 -20
- package/behaviors/command.d.ts +41 -0
- package/behaviors/command.d.ts.map +1 -0
- package/behaviors/command.js +9 -0
- package/behaviors/connectors.d.ts +17 -0
- package/behaviors/connectors.d.ts.map +1 -0
- package/behaviors/connectors.js +3 -0
- package/behaviors/crosshair.d.ts +42 -0
- package/behaviors/crosshair.d.ts.map +1 -0
- package/behaviors/crosshair.js +19 -1
- package/behaviors/dialog.d.ts +20 -0
- package/behaviors/dialog.d.ts.map +1 -0
- package/behaviors/dialog.js +3 -0
- package/behaviors/disclosure.d.ts +10 -0
- package/behaviors/disclosure.d.ts.map +1 -0
- package/behaviors/disclosure.js +3 -0
- package/behaviors/dismissible.d.ts +10 -0
- package/behaviors/dismissible.d.ts.map +1 -0
- package/behaviors/dismissible.js +3 -0
- package/behaviors/forms.d.ts +27 -0
- package/behaviors/forms.d.ts.map +1 -0
- package/behaviors/forms.js +18 -5
- package/behaviors/glyph.d.ts +21 -0
- package/behaviors/glyph.d.ts.map +1 -0
- package/behaviors/glyph.js +82 -4
- package/behaviors/index.d.ts +31 -237
- package/behaviors/index.d.ts.map +1 -0
- package/behaviors/index.js +17 -0
- package/behaviors/inert.d.ts +20 -0
- package/behaviors/inert.d.ts.map +1 -0
- package/behaviors/inert.js +46 -0
- package/behaviors/internal.d.ts +25 -0
- package/behaviors/internal.d.ts.map +1 -0
- package/behaviors/internal.js +30 -1
- package/behaviors/legend.d.ts +35 -0
- package/behaviors/legend.d.ts.map +1 -0
- package/behaviors/legend.js +9 -0
- package/behaviors/menu.d.ts +16 -0
- package/behaviors/menu.d.ts.map +1 -0
- package/behaviors/menu.js +3 -0
- package/behaviors/modal.d.ts +41 -0
- package/behaviors/modal.d.ts.map +1 -0
- package/behaviors/modal.js +124 -0
- package/behaviors/popover.d.ts +28 -0
- package/behaviors/popover.d.ts.map +1 -0
- package/behaviors/popover.js +17 -17
- package/behaviors/spotlight.d.ts +17 -0
- package/behaviors/spotlight.d.ts.map +1 -0
- package/behaviors/spotlight.js +3 -0
- package/behaviors/table.d.ts +36 -0
- package/behaviors/table.d.ts.map +1 -0
- package/behaviors/table.js +48 -8
- package/behaviors/tabs.d.ts +20 -0
- package/behaviors/tabs.d.ts.map +1 -0
- package/behaviors/tabs.js +3 -0
- package/behaviors/theme.d.ts +54 -0
- package/behaviors/theme.d.ts.map +1 -0
- package/behaviors/theme.js +17 -0
- package/behaviors/toast.d.ts +49 -0
- package/behaviors/toast.d.ts.map +1 -0
- package/behaviors/toast.js +34 -2
- package/classes/classes.json +747 -15
- package/classes/index.d.ts +118 -3
- package/classes/index.js +264 -66
- package/connectors/index.d.ts +12 -0
- package/connectors/index.d.ts.map +1 -1
- package/connectors/index.js +23 -2
- package/css/app.css +26 -0
- package/css/bullet.css +108 -0
- package/css/code.css +98 -0
- package/css/content.css +15 -2
- package/css/crosshair.css +7 -7
- package/css/diff.css +153 -0
- package/css/disclosure.css +18 -4
- package/css/dots.css +246 -9
- package/css/feedback.css +39 -7
- package/css/forms.css +71 -3
- package/css/legend.css +5 -2
- package/css/motion.css +79 -14
- package/css/overlay.css +59 -2
- package/css/primitives.css +67 -8
- package/css/report.css +43 -4
- package/css/sidenote.css +67 -0
- package/css/skins.css +9 -0
- package/css/spark.css +76 -0
- package/css/table.css +16 -3
- package/css/term.css +110 -0
- package/css/textref.css +63 -0
- package/css/toc.css +91 -0
- package/css/tokens.css +14 -1
- package/css/tree.css +134 -0
- package/dist/bronto.css +1 -1
- package/dist/css/analytical.css +1 -1
- package/dist/css/app.css +1 -1
- package/dist/css/bullet.css +1 -0
- package/dist/css/code.css +1 -0
- package/dist/css/content.css +1 -1
- package/dist/css/crosshair.css +1 -1
- package/dist/css/diff.css +1 -0
- package/dist/css/disclosure.css +1 -1
- package/dist/css/dots.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/forms.css +1 -1
- package/dist/css/legend.css +1 -1
- package/dist/css/motion.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/primitives.css +1 -1
- package/dist/css/report.css +1 -1
- package/dist/css/sidenote.css +1 -0
- package/dist/css/skins.css +1 -1
- package/dist/css/spark.css +1 -0
- package/dist/css/table.css +1 -1
- package/dist/css/term.css +1 -0
- package/dist/css/textref.css +1 -0
- package/dist/css/toc.css +1 -0
- package/dist/css/tokens.css +1 -1
- package/dist/css/tree.css +1 -0
- package/docs/annotations.md +39 -0
- package/docs/architecture.md +2 -3
- package/docs/bullet.md +78 -0
- package/docs/code.md +76 -0
- package/docs/d2.md +4 -3
- package/docs/diff.md +146 -0
- package/docs/dots.md +146 -0
- package/docs/glyphs.md +114 -0
- package/docs/legends.md +8 -4
- package/docs/mermaid.md +21 -4
- package/docs/reference.md +168 -8
- package/docs/reporting.md +49 -17
- package/docs/sidenote.md +64 -0
- package/docs/spark.md +78 -0
- package/docs/stability.md +1 -0
- package/docs/term.md +81 -0
- package/docs/textref.md +78 -0
- package/docs/theming.md +44 -5
- package/docs/toc.md +83 -0
- package/docs/tree.md +74 -0
- package/docs/usage.md +264 -23
- package/docs/vega.md +22 -3
- package/glyphs/glyphs.d.ts +61 -0
- package/glyphs/glyphs.js +600 -31
- package/llms.txt +169 -15
- package/package.json +51 -7
- package/qwik/index.d.ts +4 -2
- package/qwik/index.d.ts.map +1 -1
- package/qwik/index.js +10 -0
- package/react/index.d.ts +4 -2
- package/react/index.d.ts.map +1 -1
- package/react/index.js +6 -0
- package/solid/index.d.ts +6 -2
- package/solid/index.d.ts.map +1 -1
- package/solid/index.js +6 -0
- package/tokens/skins.js +22 -9
package/classes/index.d.ts
CHANGED
|
@@ -79,6 +79,16 @@ export declare const cls: {
|
|
|
79
79
|
readonly dotspinner: 'ui-dotspinner';
|
|
80
80
|
readonly dotspinnerSm: 'ui-dotspinner--sm';
|
|
81
81
|
readonly dotspinnerLg: 'ui-dotspinner--lg';
|
|
82
|
+
readonly waffle: 'ui-waffle';
|
|
83
|
+
readonly activity: 'ui-activity';
|
|
84
|
+
readonly level: 'ui-level';
|
|
85
|
+
readonly levelWarn: 'ui-level--warn';
|
|
86
|
+
readonly levelDanger: 'ui-level--danger';
|
|
87
|
+
readonly dotgauge: 'ui-dotgauge';
|
|
88
|
+
readonly readout: 'ui-readout';
|
|
89
|
+
readonly readoutSpacer: 'ui-readout__spacer';
|
|
90
|
+
readonly halftone: 'ui-halftone';
|
|
91
|
+
readonly dotfit: 'ui-dotfit';
|
|
82
92
|
readonly field: 'ui-field';
|
|
83
93
|
readonly label: 'ui-label';
|
|
84
94
|
readonly input: 'ui-input';
|
|
@@ -104,7 +114,7 @@ export declare const cls: {
|
|
|
104
114
|
readonly alert: 'ui-alert';
|
|
105
115
|
readonly alertTitle: 'ui-alert__title';
|
|
106
116
|
readonly alertBody: 'ui-alert__body';
|
|
107
|
-
readonly
|
|
117
|
+
readonly alertClose: 'ui-alert__close';
|
|
108
118
|
readonly alertAccent: 'ui-alert--accent';
|
|
109
119
|
readonly alertSuccess: 'ui-alert--success';
|
|
110
120
|
readonly alertWarning: 'ui-alert--warning';
|
|
@@ -128,6 +138,9 @@ export declare const cls: {
|
|
|
128
138
|
readonly progressIndeterminate: 'ui-progress--indeterminate';
|
|
129
139
|
readonly meter: 'ui-meter';
|
|
130
140
|
readonly meterFill: 'ui-meter__fill';
|
|
141
|
+
readonly meterRow: 'ui-meter__row';
|
|
142
|
+
readonly meterLabel: 'ui-meter__label';
|
|
143
|
+
readonly meterValue: 'ui-meter__value';
|
|
131
144
|
readonly meterAccent: 'ui-meter--accent';
|
|
132
145
|
readonly meterSuccess: 'ui-meter--success';
|
|
133
146
|
readonly meterWarning: 'ui-meter--warning';
|
|
@@ -186,13 +199,14 @@ export declare const cls: {
|
|
|
186
199
|
readonly tableDense: 'ui-table--dense';
|
|
187
200
|
readonly tableComfortable: 'ui-table--comfortable';
|
|
188
201
|
readonly tableLined: 'ui-table--lined';
|
|
202
|
+
readonly tableBreakAnywhere: 'ui-table--break-anywhere';
|
|
189
203
|
readonly tableWrap: 'ui-table-wrap';
|
|
204
|
+
readonly tableLoading: 'ui-table-wrap--loading';
|
|
190
205
|
readonly tableEmpty: 'ui-table__empty';
|
|
191
206
|
readonly tableSort: 'ui-table__sort';
|
|
192
207
|
readonly tableSelect: 'ui-table__select';
|
|
193
208
|
readonly tableToolbar: 'ui-table__toolbar';
|
|
194
209
|
readonly tableSelectable: 'ui-table--selectable';
|
|
195
|
-
readonly tableLoading: 'ui-table--loading';
|
|
196
210
|
readonly panel: 'ui-panel';
|
|
197
211
|
readonly panelHead: 'ui-panel__head';
|
|
198
212
|
readonly surface: 'ui-surface';
|
|
@@ -369,7 +383,6 @@ export declare const cls: {
|
|
|
369
383
|
readonly crosshairLineX: 'ui-crosshair__line--x';
|
|
370
384
|
readonly crosshairLineY: 'ui-crosshair__line--y';
|
|
371
385
|
readonly crosshairBadge: 'ui-crosshair__badge';
|
|
372
|
-
readonly readout: 'ui-readout';
|
|
373
386
|
readonly sel: 'ui-sel';
|
|
374
387
|
readonly selOn: 'ui-sel--on';
|
|
375
388
|
readonly selOff: 'ui-sel--off';
|
|
@@ -393,6 +406,56 @@ export declare const cls: {
|
|
|
393
406
|
readonly srcReviewed: 'ui-src--reviewed';
|
|
394
407
|
readonly srcStale: 'ui-src--stale';
|
|
395
408
|
readonly srcConflict: 'ui-src--conflict';
|
|
409
|
+
readonly diff: 'ui-diff';
|
|
410
|
+
readonly diffSplit: 'ui-diff--split';
|
|
411
|
+
readonly diffPane: 'ui-diff__pane';
|
|
412
|
+
readonly diffHunk: 'ui-diff__hunk';
|
|
413
|
+
readonly diffHead: 'ui-diff__head';
|
|
414
|
+
readonly diffRow: 'ui-diff__row';
|
|
415
|
+
readonly diffRowAdd: 'ui-diff__row--add';
|
|
416
|
+
readonly diffRowRemove: 'ui-diff__row--remove';
|
|
417
|
+
readonly diffRowContext: 'ui-diff__row--context';
|
|
418
|
+
readonly diffLn: 'ui-diff__ln';
|
|
419
|
+
readonly diffCode: 'ui-diff__code';
|
|
420
|
+
readonly code: 'ui-code';
|
|
421
|
+
readonly codeNumbered: 'ui-code--numbered';
|
|
422
|
+
readonly codeHead: 'ui-code__head';
|
|
423
|
+
readonly codeBody: 'ui-code__body';
|
|
424
|
+
readonly codeLine: 'ui-code__line';
|
|
425
|
+
readonly codeLineAdd: 'ui-code__line--add';
|
|
426
|
+
readonly codeLineRemove: 'ui-code__line--remove';
|
|
427
|
+
readonly codeLineHl: 'ui-code__line--hl';
|
|
428
|
+
readonly spark: 'ui-spark';
|
|
429
|
+
readonly sparkDots: 'ui-spark--dots';
|
|
430
|
+
readonly sparkBar: 'ui-spark__bar';
|
|
431
|
+
readonly sparkBarAccent: 'ui-spark__bar--accent';
|
|
432
|
+
readonly sparkBarPos: 'ui-spark__bar--pos';
|
|
433
|
+
readonly sparkBarNeg: 'ui-spark__bar--neg';
|
|
434
|
+
readonly sidenote: 'ui-sidenote';
|
|
435
|
+
readonly marginnote: 'ui-marginnote';
|
|
436
|
+
readonly sidenoteRef: 'ui-sidenote__ref';
|
|
437
|
+
readonly textref: 'ui-textref';
|
|
438
|
+
readonly bullet: 'ui-bullet';
|
|
439
|
+
readonly bulletMeasure: 'ui-bullet__measure';
|
|
440
|
+
readonly bulletMeasureAccent: 'ui-bullet__measure--accent';
|
|
441
|
+
readonly bulletMeasurePos: 'ui-bullet__measure--pos';
|
|
442
|
+
readonly bulletMeasureNeg: 'ui-bullet__measure--neg';
|
|
443
|
+
readonly bulletTarget: 'ui-bullet__target';
|
|
444
|
+
readonly bulletLabel: 'ui-bullet__label';
|
|
445
|
+
readonly term: 'ui-term';
|
|
446
|
+
readonly def: 'ui-def';
|
|
447
|
+
readonly glossary: 'ui-glossary';
|
|
448
|
+
readonly glossaryTerm: 'ui-glossary__term';
|
|
449
|
+
readonly glossaryDef: 'ui-glossary__def';
|
|
450
|
+
readonly toc: 'ui-toc';
|
|
451
|
+
readonly tocTitle: 'ui-toc__title';
|
|
452
|
+
readonly tocList: 'ui-toc__list';
|
|
453
|
+
readonly tocLink: 'ui-toc__link';
|
|
454
|
+
readonly tree: 'ui-tree';
|
|
455
|
+
readonly treeBranch: 'ui-tree__branch';
|
|
456
|
+
readonly treeLeaf: 'ui-tree__leaf';
|
|
457
|
+
readonly treeSummary: 'ui-tree__summary';
|
|
458
|
+
readonly treeLabel: 'ui-tree__label';
|
|
396
459
|
readonly state: 'ui-state';
|
|
397
460
|
readonly stateLabel: 'ui-state__label';
|
|
398
461
|
readonly stateDetail: 'ui-state__detail';
|
|
@@ -690,6 +753,32 @@ export interface OriginLabelOpts {
|
|
|
690
753
|
/** Accent-tint the label for AI/model-generated origin (vs a neutral tag). */
|
|
691
754
|
ai?: boolean;
|
|
692
755
|
}
|
|
756
|
+
export interface DiffOpts {
|
|
757
|
+
/** Two side-by-side `.ui-diff__pane` columns (old | new) instead of the unified view. */
|
|
758
|
+
split?: boolean;
|
|
759
|
+
}
|
|
760
|
+
export interface DiffRowOpts {
|
|
761
|
+
/** The host-classified change kind — sets the tint and the +/− gutter glyph. */
|
|
762
|
+
change?: 'add' | 'remove' | 'context';
|
|
763
|
+
}
|
|
764
|
+
export interface CodeOpts {
|
|
765
|
+
/** Show the line-number gutter (counts each `.ui-code__line`). */
|
|
766
|
+
numbered?: boolean;
|
|
767
|
+
}
|
|
768
|
+
export interface CodeLineOpts {
|
|
769
|
+
/** The host-classified line state — `hl` is a neutral highlight, not a change.
|
|
770
|
+
* `remove` matches `ui.diffRow`'s verb (was `del`) so the two change-review
|
|
771
|
+
* surfaces share one vocabulary. */
|
|
772
|
+
change?: 'add' | 'remove' | 'hl';
|
|
773
|
+
}
|
|
774
|
+
export interface SparkBarOpts {
|
|
775
|
+
/** Emphasise / tone a single bar. The meaning must still be in the spark's aria-label. */
|
|
776
|
+
tone?: 'accent' | 'pos' | 'neg';
|
|
777
|
+
}
|
|
778
|
+
export interface BulletMeasureOpts {
|
|
779
|
+
/** Emphasise / tone the measure bar. The meaning must still be in the bullet's aria-label. */
|
|
780
|
+
tone?: 'accent' | 'pos' | 'neg';
|
|
781
|
+
}
|
|
693
782
|
|
|
694
783
|
export interface Ui {
|
|
695
784
|
button(opts?: ButtonOpts): string;
|
|
@@ -733,9 +822,35 @@ export interface Ui {
|
|
|
733
822
|
citation(opts?: CitationOpts): string;
|
|
734
823
|
source(opts?: SourceOpts): string;
|
|
735
824
|
provenance(opts?: ProvenanceOpts): string;
|
|
825
|
+
diff(opts?: DiffOpts): string;
|
|
826
|
+
diffRow(opts?: DiffRowOpts): string;
|
|
827
|
+
code(opts?: CodeOpts): string;
|
|
828
|
+
codeLine(opts?: CodeLineOpts): string;
|
|
829
|
+
sparkBar(opts?: SparkBarOpts): string;
|
|
830
|
+
bulletMeasure(opts?: BulletMeasureOpts): string;
|
|
736
831
|
state(opts?: StateOpts): string;
|
|
737
832
|
originLabel(opts?: OriginLabelOpts): string;
|
|
738
833
|
}
|
|
739
834
|
|
|
740
835
|
export declare const ui: Ui;
|
|
741
836
|
export default ui;
|
|
837
|
+
|
|
838
|
+
/** Min/max for the value-bearing fills; defaults to 0–100. */
|
|
839
|
+
export interface ValueRangeOpts {
|
|
840
|
+
min?: number;
|
|
841
|
+
max?: number;
|
|
842
|
+
}
|
|
843
|
+
/** ARIA + style bundle to spread onto a `ui-meter`/`ui-progress` host. */
|
|
844
|
+
export interface ValueAttrs {
|
|
845
|
+
role: 'meter' | 'progressbar';
|
|
846
|
+
'aria-valuenow': number;
|
|
847
|
+
'aria-valuemin': number;
|
|
848
|
+
'aria-valuemax': number;
|
|
849
|
+
style: { '--value': number };
|
|
850
|
+
}
|
|
851
|
+
export interface Attrs {
|
|
852
|
+
meter(value: number, opts?: ValueRangeOpts): ValueAttrs;
|
|
853
|
+
progress(value: number, opts?: ValueRangeOpts): ValueAttrs;
|
|
854
|
+
}
|
|
855
|
+
/** Set the painted value AND its ARIA together so they cannot drift. */
|
|
856
|
+
export declare const attrs: Attrs;
|
package/classes/index.js
CHANGED
|
@@ -84,6 +84,17 @@ export const cls = Object.freeze({
|
|
|
84
84
|
dotspinner: 'ui-dotspinner',
|
|
85
85
|
dotspinnerSm: 'ui-dotspinner--sm',
|
|
86
86
|
dotspinnerLg: 'ui-dotspinner--lg',
|
|
87
|
+
// data-bound dot surfaces (reporting/dashboard family)
|
|
88
|
+
waffle: 'ui-waffle',
|
|
89
|
+
activity: 'ui-activity',
|
|
90
|
+
level: 'ui-level',
|
|
91
|
+
levelWarn: 'ui-level--warn',
|
|
92
|
+
levelDanger: 'ui-level--danger',
|
|
93
|
+
dotgauge: 'ui-dotgauge',
|
|
94
|
+
readout: 'ui-readout',
|
|
95
|
+
readoutSpacer: 'ui-readout__spacer',
|
|
96
|
+
halftone: 'ui-halftone',
|
|
97
|
+
dotfit: 'ui-dotfit',
|
|
87
98
|
// forms
|
|
88
99
|
field: 'ui-field',
|
|
89
100
|
label: 'ui-label',
|
|
@@ -111,7 +122,7 @@ export const cls = Object.freeze({
|
|
|
111
122
|
alert: 'ui-alert',
|
|
112
123
|
alertTitle: 'ui-alert__title',
|
|
113
124
|
alertBody: 'ui-alert__body',
|
|
114
|
-
|
|
125
|
+
alertClose: 'ui-alert__close',
|
|
115
126
|
alertAccent: 'ui-alert--accent',
|
|
116
127
|
alertSuccess: 'ui-alert--success',
|
|
117
128
|
alertWarning: 'ui-alert--warning',
|
|
@@ -135,6 +146,9 @@ export const cls = Object.freeze({
|
|
|
135
146
|
progressIndeterminate: 'ui-progress--indeterminate',
|
|
136
147
|
meter: 'ui-meter',
|
|
137
148
|
meterFill: 'ui-meter__fill',
|
|
149
|
+
meterRow: 'ui-meter__row',
|
|
150
|
+
meterLabel: 'ui-meter__label',
|
|
151
|
+
meterValue: 'ui-meter__value',
|
|
138
152
|
meterAccent: 'ui-meter--accent',
|
|
139
153
|
meterSuccess: 'ui-meter--success',
|
|
140
154
|
meterWarning: 'ui-meter--warning',
|
|
@@ -196,13 +210,15 @@ export const cls = Object.freeze({
|
|
|
196
210
|
tableDense: 'ui-table--dense',
|
|
197
211
|
tableComfortable: 'ui-table--comfortable',
|
|
198
212
|
tableLined: 'ui-table--lined',
|
|
213
|
+
tableBreakAnywhere: 'ui-table--break-anywhere',
|
|
199
214
|
tableWrap: 'ui-table-wrap',
|
|
215
|
+
// Loading state goes on the WRAP, so the modifier is named for the wrap (C19).
|
|
216
|
+
tableLoading: 'ui-table-wrap--loading',
|
|
200
217
|
tableEmpty: 'ui-table__empty',
|
|
201
218
|
tableSort: 'ui-table__sort',
|
|
202
219
|
tableSelect: 'ui-table__select',
|
|
203
220
|
tableToolbar: 'ui-table__toolbar',
|
|
204
221
|
tableSelectable: 'ui-table--selectable',
|
|
205
|
-
tableLoading: 'ui-table--loading',
|
|
206
222
|
// shell / layout
|
|
207
223
|
panel: 'ui-panel',
|
|
208
224
|
panelHead: 'ui-panel__head',
|
|
@@ -414,6 +430,65 @@ export const cls = Object.freeze({
|
|
|
414
430
|
srcReviewed: 'ui-src--reviewed',
|
|
415
431
|
srcStale: 'ui-src--stale',
|
|
416
432
|
srcConflict: 'ui-src--conflict',
|
|
433
|
+
// diff — line/row change-review grammar (css/diff.css)
|
|
434
|
+
diff: 'ui-diff',
|
|
435
|
+
diffSplit: 'ui-diff--split',
|
|
436
|
+
diffPane: 'ui-diff__pane',
|
|
437
|
+
diffHunk: 'ui-diff__hunk',
|
|
438
|
+
diffHead: 'ui-diff__head',
|
|
439
|
+
diffRow: 'ui-diff__row',
|
|
440
|
+
diffRowAdd: 'ui-diff__row--add',
|
|
441
|
+
diffRowRemove: 'ui-diff__row--remove',
|
|
442
|
+
diffRowContext: 'ui-diff__row--context',
|
|
443
|
+
diffLn: 'ui-diff__ln',
|
|
444
|
+
diffCode: 'ui-diff__code',
|
|
445
|
+
// code — fenced-code evidence chrome (css/code.css)
|
|
446
|
+
code: 'ui-code',
|
|
447
|
+
codeNumbered: 'ui-code--numbered',
|
|
448
|
+
codeHead: 'ui-code__head',
|
|
449
|
+
codeBody: 'ui-code__body',
|
|
450
|
+
codeLine: 'ui-code__line',
|
|
451
|
+
codeLineAdd: 'ui-code__line--add',
|
|
452
|
+
codeLineRemove: 'ui-code__line--remove',
|
|
453
|
+
codeLineHl: 'ui-code__line--hl',
|
|
454
|
+
// spark — inline datawords / microcharts (css/spark.css)
|
|
455
|
+
spark: 'ui-spark',
|
|
456
|
+
sparkDots: 'ui-spark--dots',
|
|
457
|
+
sparkBar: 'ui-spark__bar',
|
|
458
|
+
sparkBarAccent: 'ui-spark__bar--accent',
|
|
459
|
+
sparkBarPos: 'ui-spark__bar--pos',
|
|
460
|
+
sparkBarNeg: 'ui-spark__bar--neg',
|
|
461
|
+
// sidenote — Tufte margin notes (css/sidenote.css)
|
|
462
|
+
sidenote: 'ui-sidenote',
|
|
463
|
+
marginnote: 'ui-marginnote',
|
|
464
|
+
sidenoteRef: 'ui-sidenote__ref',
|
|
465
|
+
// textref — deep-link-to-cited-text provenance link (css/textref.css)
|
|
466
|
+
textref: 'ui-textref',
|
|
467
|
+
// bullet — Stephen-Few bullet graph: measure vs target vs bands (css/bullet.css)
|
|
468
|
+
bullet: 'ui-bullet',
|
|
469
|
+
bulletMeasure: 'ui-bullet__measure',
|
|
470
|
+
bulletMeasureAccent: 'ui-bullet__measure--accent',
|
|
471
|
+
bulletMeasurePos: 'ui-bullet__measure--pos',
|
|
472
|
+
bulletMeasureNeg: 'ui-bullet__measure--neg',
|
|
473
|
+
bulletTarget: 'ui-bullet__target',
|
|
474
|
+
bulletLabel: 'ui-bullet__label',
|
|
475
|
+
// term — inline glossary term + definition popover + glossary <dl> (css/term.css)
|
|
476
|
+
term: 'ui-term',
|
|
477
|
+
def: 'ui-def',
|
|
478
|
+
glossary: 'ui-glossary',
|
|
479
|
+
glossaryTerm: 'ui-glossary__term',
|
|
480
|
+
glossaryDef: 'ui-glossary__def',
|
|
481
|
+
// toc — scrollspy table-of-contents rail (css/toc.css)
|
|
482
|
+
toc: 'ui-toc',
|
|
483
|
+
tocTitle: 'ui-toc__title',
|
|
484
|
+
tocList: 'ui-toc__list',
|
|
485
|
+
tocLink: 'ui-toc__link',
|
|
486
|
+
// tree — hierarchy outline on nested <details> (css/tree.css)
|
|
487
|
+
tree: 'ui-tree',
|
|
488
|
+
treeBranch: 'ui-tree__branch',
|
|
489
|
+
treeLeaf: 'ui-tree__leaf',
|
|
490
|
+
treeSummary: 'ui-tree__summary',
|
|
491
|
+
treeLabel: 'ui-tree__label',
|
|
417
492
|
// lifecycle / system state (css/state.css)
|
|
418
493
|
state: 'ui-state',
|
|
419
494
|
stateLabel: 'ui-state__label',
|
|
@@ -557,6 +632,95 @@ const srcTone = (state) =>
|
|
|
557
632
|
conflict: cls.srcConflict,
|
|
558
633
|
})[state] || '';
|
|
559
634
|
|
|
635
|
+
// Component tone → modifier class. Same object-literal idiom as srcTone/stateTone
|
|
636
|
+
// (still grep-by-class-name; the modifier set differs per component). (Q9.)
|
|
637
|
+
//
|
|
638
|
+
// The set differs PER COMPONENT on purpose — `muted` is a badge/num tone, not an
|
|
639
|
+
// alert/toast/meter/dot one — so a caller extrapolating a universal tone (e.g.
|
|
640
|
+
// `ui.alert({ tone: 'muted' })`) used to get a silent no-op: a bare, untoned
|
|
641
|
+
// element with no signal that the tone was dropped. Warn at dev time instead, so
|
|
642
|
+
// that "validates-but-no-ops" trap is loud rather than invisible. An omitted tone
|
|
643
|
+
// is fine (returns no modifier). (component audit C12.)
|
|
644
|
+
const toneClass = (component, map, tone) => {
|
|
645
|
+
if (tone == null) return '';
|
|
646
|
+
const hit = map[tone];
|
|
647
|
+
if (!hit && typeof console !== 'undefined') {
|
|
648
|
+
console.warn(
|
|
649
|
+
`[bronto] ui.${component}(): "${tone}" is not a ${component} tone (use one of: ${Object.keys(map).join(', ')}).`,
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
return hit || '';
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
const badgeTone = (tone) =>
|
|
656
|
+
toneClass(
|
|
657
|
+
'badge',
|
|
658
|
+
{
|
|
659
|
+
accent: cls.badgeAccent,
|
|
660
|
+
success: cls.badgeSuccess,
|
|
661
|
+
warning: cls.badgeWarning,
|
|
662
|
+
danger: cls.badgeDanger,
|
|
663
|
+
info: cls.badgeInfo,
|
|
664
|
+
muted: cls.badgeMuted,
|
|
665
|
+
},
|
|
666
|
+
tone,
|
|
667
|
+
);
|
|
668
|
+
|
|
669
|
+
const numTone = (tone) =>
|
|
670
|
+
toneClass('num', { pos: cls.numPos, neg: cls.numNeg, muted: cls.numMuted }, tone);
|
|
671
|
+
|
|
672
|
+
const dotTone = (tone) =>
|
|
673
|
+
toneClass(
|
|
674
|
+
'dot',
|
|
675
|
+
{
|
|
676
|
+
accent: cls.dotAccent,
|
|
677
|
+
success: cls.dotSuccess,
|
|
678
|
+
warning: cls.dotWarning,
|
|
679
|
+
danger: cls.dotDanger,
|
|
680
|
+
info: cls.dotInfo,
|
|
681
|
+
},
|
|
682
|
+
tone,
|
|
683
|
+
);
|
|
684
|
+
|
|
685
|
+
const alertTone = (tone) =>
|
|
686
|
+
toneClass(
|
|
687
|
+
'alert',
|
|
688
|
+
{
|
|
689
|
+
accent: cls.alertAccent,
|
|
690
|
+
success: cls.alertSuccess,
|
|
691
|
+
warning: cls.alertWarning,
|
|
692
|
+
danger: cls.alertDanger,
|
|
693
|
+
info: cls.alertInfo,
|
|
694
|
+
},
|
|
695
|
+
tone,
|
|
696
|
+
);
|
|
697
|
+
|
|
698
|
+
const toastTone = (tone) =>
|
|
699
|
+
toneClass(
|
|
700
|
+
'toast',
|
|
701
|
+
{
|
|
702
|
+
accent: cls.toastAccent,
|
|
703
|
+
success: cls.toastSuccess,
|
|
704
|
+
warning: cls.toastWarning,
|
|
705
|
+
danger: cls.toastDanger,
|
|
706
|
+
info: cls.toastInfo,
|
|
707
|
+
},
|
|
708
|
+
tone,
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
const meterTone = (tone) =>
|
|
712
|
+
toneClass(
|
|
713
|
+
'meter',
|
|
714
|
+
{
|
|
715
|
+
accent: cls.meterAccent,
|
|
716
|
+
success: cls.meterSuccess,
|
|
717
|
+
warning: cls.meterWarning,
|
|
718
|
+
danger: cls.meterDanger,
|
|
719
|
+
info: cls.meterInfo,
|
|
720
|
+
},
|
|
721
|
+
tone,
|
|
722
|
+
);
|
|
723
|
+
|
|
560
724
|
export const ui = {
|
|
561
725
|
button: ({ variant, icon, size } = {}) =>
|
|
562
726
|
j(
|
|
@@ -570,24 +734,8 @@ export const ui = {
|
|
|
570
734
|
),
|
|
571
735
|
card: ({ accent, interactive } = {}) =>
|
|
572
736
|
j(cls.card, accent && cls.cardAccent, interactive && cls.cardInteractive),
|
|
573
|
-
badge: ({ tone, dot } = {}) =>
|
|
574
|
-
|
|
575
|
-
cls.badge,
|
|
576
|
-
tone === 'accent' && cls.badgeAccent,
|
|
577
|
-
tone === 'success' && cls.badgeSuccess,
|
|
578
|
-
tone === 'warning' && cls.badgeWarning,
|
|
579
|
-
tone === 'danger' && cls.badgeDanger,
|
|
580
|
-
tone === 'info' && cls.badgeInfo,
|
|
581
|
-
tone === 'muted' && cls.badgeMuted,
|
|
582
|
-
dot && cls.badgeDot,
|
|
583
|
-
),
|
|
584
|
-
num: ({ tone } = {}) =>
|
|
585
|
-
j(
|
|
586
|
-
cls.num,
|
|
587
|
-
tone === 'pos' && cls.numPos,
|
|
588
|
-
tone === 'neg' && cls.numNeg,
|
|
589
|
-
tone === 'muted' && cls.numMuted,
|
|
590
|
-
),
|
|
737
|
+
badge: ({ tone, dot } = {}) => j(cls.badge, badgeTone(tone), dot && cls.badgeDot),
|
|
738
|
+
num: ({ tone } = {}) => j(cls.num, numTone(tone)),
|
|
591
739
|
delta: ({ dir, invert } = {}) =>
|
|
592
740
|
j(
|
|
593
741
|
cls.delta,
|
|
@@ -599,57 +747,25 @@ export const ui = {
|
|
|
599
747
|
compare: ({ cols } = {}) => j(cls.compare, cols === 2 && cls.compare2up),
|
|
600
748
|
chip: ({ accent } = {}) => j(cls.chip, accent && cls.chipAccent),
|
|
601
749
|
link: ({ arrow, cta } = {}) => j(cls.link, arrow && cls.linkArrow, cta && cls.linkCta),
|
|
602
|
-
dot: ({ tone, live } = {}) =>
|
|
603
|
-
j(
|
|
604
|
-
cls.dot,
|
|
605
|
-
tone === 'accent' && cls.dotAccent,
|
|
606
|
-
tone === 'success' && cls.dotSuccess,
|
|
607
|
-
tone === 'warning' && cls.dotWarning,
|
|
608
|
-
tone === 'danger' && cls.dotDanger,
|
|
609
|
-
tone === 'info' && cls.dotInfo,
|
|
610
|
-
live && cls.dotLive,
|
|
611
|
-
),
|
|
750
|
+
dot: ({ tone, live } = {}) => j(cls.dot, dotTone(tone), live && cls.dotLive),
|
|
612
751
|
dotgrid: ({ accent, dense } = {}) =>
|
|
613
752
|
j(cls.dotgrid, accent && cls.dotgridAccent, dense && cls.dotgridDense),
|
|
614
|
-
table: ({ density, lined } = {}) =>
|
|
753
|
+
table: ({ density, lined, breakAnywhere } = {}) =>
|
|
615
754
|
j(
|
|
616
755
|
cls.table,
|
|
617
756
|
density === 'dense' && cls.tableDense,
|
|
618
757
|
density === 'comfortable' && cls.tableComfortable,
|
|
619
758
|
lined && cls.tableLined,
|
|
759
|
+
breakAnywhere && cls.tableBreakAnywhere,
|
|
620
760
|
),
|
|
621
761
|
eyebrow: ({ muted, sm } = {}) => j(cls.eyebrow, muted && cls.eyebrowMuted, sm && cls.eyebrowSm),
|
|
622
762
|
hint: ({ error } = {}) => j(cls.hint, error && cls.hintError),
|
|
623
763
|
cluster: ({ between } = {}) => j(cls.cluster, between && cls.clusterBetween),
|
|
624
764
|
stagger: ({ auto } = {}) => j(cls.stagger, auto && cls.staggerAuto),
|
|
625
|
-
alert: ({ tone } = {}) =>
|
|
626
|
-
|
|
627
|
-
cls.alert,
|
|
628
|
-
tone === 'accent' && cls.alertAccent,
|
|
629
|
-
tone === 'success' && cls.alertSuccess,
|
|
630
|
-
tone === 'warning' && cls.alertWarning,
|
|
631
|
-
tone === 'danger' && cls.alertDanger,
|
|
632
|
-
tone === 'info' && cls.alertInfo,
|
|
633
|
-
),
|
|
634
|
-
toast: ({ tone } = {}) =>
|
|
635
|
-
j(
|
|
636
|
-
cls.toast,
|
|
637
|
-
tone === 'accent' && cls.toastAccent,
|
|
638
|
-
tone === 'success' && cls.toastSuccess,
|
|
639
|
-
tone === 'warning' && cls.toastWarning,
|
|
640
|
-
tone === 'danger' && cls.toastDanger,
|
|
641
|
-
tone === 'info' && cls.toastInfo,
|
|
642
|
-
),
|
|
765
|
+
alert: ({ tone } = {}) => j(cls.alert, alertTone(tone)),
|
|
766
|
+
toast: ({ tone } = {}) => j(cls.toast, toastTone(tone)),
|
|
643
767
|
progress: ({ indeterminate } = {}) => j(cls.progress, indeterminate && cls.progressIndeterminate),
|
|
644
|
-
meter: ({ tone } = {}) =>
|
|
645
|
-
j(
|
|
646
|
-
cls.meter,
|
|
647
|
-
tone === 'accent' && cls.meterAccent,
|
|
648
|
-
tone === 'success' && cls.meterSuccess,
|
|
649
|
-
tone === 'warning' && cls.meterWarning,
|
|
650
|
-
tone === 'danger' && cls.meterDanger,
|
|
651
|
-
tone === 'info' && cls.meterInfo,
|
|
652
|
-
),
|
|
768
|
+
meter: ({ tone } = {}) => j(cls.meter, meterTone(tone)),
|
|
653
769
|
dotspinner: ({ size } = {}) =>
|
|
654
770
|
j(cls.dotspinner, size === 'sm' && cls.dotspinnerSm, size === 'lg' && cls.dotspinnerLg),
|
|
655
771
|
dotbar: ({ indeterminate } = {}) => j(cls.dotbar, indeterminate && cls.dotbarIndeterminate),
|
|
@@ -677,14 +793,9 @@ export const ui = {
|
|
|
677
793
|
legendSwatch: ({ series, shape } = {}) =>
|
|
678
794
|
j(
|
|
679
795
|
cls.legendSwatch,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
series
|
|
683
|
-
series === 4 && cls.legendSwatch4,
|
|
684
|
-
series === 5 && cls.legendSwatch5,
|
|
685
|
-
series === 6 && cls.legendSwatch6,
|
|
686
|
-
series === 7 && cls.legendSwatch7,
|
|
687
|
-
series === 8 && cls.legendSwatch8,
|
|
796
|
+
// Series 1–8 map to ui-legend__swatch--N; the explicit bounds-check keeps a
|
|
797
|
+
// 0/9/non-integer from coining a class the stylesheet never defines. (Q9.)
|
|
798
|
+
Number.isInteger(series) && series >= 1 && series <= 8 && cls[`legendSwatch${series}`],
|
|
688
799
|
shape === 'circle' && cls.legendSwatchCircle,
|
|
689
800
|
shape === 'line' && cls.legendSwatchLine,
|
|
690
801
|
),
|
|
@@ -765,8 +876,95 @@ export const ui = {
|
|
|
765
876
|
citation: ({ chip, state } = {}) => j(cls.citation, chip && cls.citationChip, srcTone(state)),
|
|
766
877
|
source: ({ state } = {}) => j(cls.sourceCard, srcTone(state)),
|
|
767
878
|
provenance: ({ state } = {}) => j(cls.provenance, srcTone(state)),
|
|
879
|
+
diff: ({ split } = {}) => j(cls.diff, split && cls.diffSplit),
|
|
880
|
+
diffRow: ({ change } = {}) =>
|
|
881
|
+
j(
|
|
882
|
+
cls.diffRow,
|
|
883
|
+
change === 'add' && cls.diffRowAdd,
|
|
884
|
+
change === 'remove' && cls.diffRowRemove,
|
|
885
|
+
change === 'context' && cls.diffRowContext,
|
|
886
|
+
),
|
|
887
|
+
code: ({ numbered } = {}) => j(cls.code, numbered && cls.codeNumbered),
|
|
888
|
+
codeLine: ({ change } = {}) =>
|
|
889
|
+
j(
|
|
890
|
+
cls.codeLine,
|
|
891
|
+
change === 'add' && cls.codeLineAdd,
|
|
892
|
+
change === 'remove' && cls.codeLineRemove,
|
|
893
|
+
change === 'hl' && cls.codeLineHl,
|
|
894
|
+
),
|
|
895
|
+
sparkBar: ({ tone } = {}) =>
|
|
896
|
+
j(
|
|
897
|
+
cls.sparkBar,
|
|
898
|
+
tone === 'accent' && cls.sparkBarAccent,
|
|
899
|
+
tone === 'pos' && cls.sparkBarPos,
|
|
900
|
+
tone === 'neg' && cls.sparkBarNeg,
|
|
901
|
+
),
|
|
902
|
+
bulletMeasure: ({ tone } = {}) =>
|
|
903
|
+
j(
|
|
904
|
+
cls.bulletMeasure,
|
|
905
|
+
tone === 'accent' && cls.bulletMeasureAccent,
|
|
906
|
+
tone === 'pos' && cls.bulletMeasurePos,
|
|
907
|
+
tone === 'neg' && cls.bulletMeasureNeg,
|
|
908
|
+
),
|
|
768
909
|
state: ({ state, busy } = {}) => j(cls.state, stateTone(state), busy && cls.stateBusy),
|
|
769
910
|
originLabel: ({ ai } = {}) => j(cls.originLabel, ai && cls.originLabelAi),
|
|
770
911
|
};
|
|
771
912
|
|
|
913
|
+
// Attribute + style bundle for the data-bearing fills (`ui-meter`/`ui-progress`).
|
|
914
|
+
// The class string alone paints a 0-width, unannounced bar: the fill width is a
|
|
915
|
+
// UNITLESS `--value` (0–100) and AT needs role + aria-valuenow/min/max. This sets
|
|
916
|
+
// the painted value and its announced value together so they can't drift, and
|
|
917
|
+
// normalizes an arbitrary {min,max} to the 0–100 `--value` the CSS expects while
|
|
918
|
+
// keeping aria-valuenow in the caller's real units. (component audit C8.)
|
|
919
|
+
// `busyWhenIndeterminate` — a progressbar advertises aria-busy when its value is
|
|
920
|
+
// unknown; a meter is never indeterminate so it passes false. (Kept a boolean
|
|
921
|
+
// flag rather than testing the role string, so check:recipe-types doesn't read it
|
|
922
|
+
// as a recipe option literal.)
|
|
923
|
+
const valueAttrs = (role, value, min, max, busyWhenIndeterminate) => {
|
|
924
|
+
const lo = Number(min);
|
|
925
|
+
const hi = Number(max);
|
|
926
|
+
const raw = Number(value);
|
|
927
|
+
// Indeterminate: an omitted/unknown value (attrs.progress() with no argument).
|
|
928
|
+
// ARIA requires aria-valuenow be OMITTED here — emitting 0 announces "0%",
|
|
929
|
+
// indistinguishable from a real stalled-at-zero bar. A progressbar instead
|
|
930
|
+
// advertises aria-busy; a meter has no indeterminate state, so a non-finite
|
|
931
|
+
// value there is a caller error we still fail safe on by omitting the
|
|
932
|
+
// misleading 0. Pair with `ui.progress({ indeterminate: true })` for the CSS
|
|
933
|
+
// sweep. (component audit C9.)
|
|
934
|
+
if (!Number.isFinite(raw)) {
|
|
935
|
+
return busyWhenIndeterminate ? { role, 'aria-busy': 'true' } : { role };
|
|
936
|
+
}
|
|
937
|
+
const now = Math.min(hi, Math.max(lo, raw));
|
|
938
|
+
const pct = hi > lo ? ((now - lo) / (hi - lo)) * 100 : 0;
|
|
939
|
+
return {
|
|
940
|
+
role,
|
|
941
|
+
'aria-valuenow': now,
|
|
942
|
+
'aria-valuemin': lo,
|
|
943
|
+
'aria-valuemax': hi,
|
|
944
|
+
style: { '--value': Math.round(pct * 100) / 100 },
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* ARIA + style bundles for the value-bearing fills. Spread onto the host:
|
|
950
|
+
* <div class={ui.meter({ tone: 'warning' })} {...attrs.meter(72)}>
|
|
951
|
+
* <span class={cls.meterFill} />
|
|
952
|
+
* </div>
|
|
953
|
+
* `value` is in your own units; pass `{ min, max }` (default 0–100) and the
|
|
954
|
+
* `--value` width is normalized for you. Call `attrs.progress()` with no value
|
|
955
|
+
* for an indeterminate bar (omits aria-valuenow, sets aria-busy). (audit C9.)
|
|
956
|
+
*
|
|
957
|
+
* `attrs.dotbar(value)` is the segmented analogue of `attrs.progress`: a
|
|
958
|
+
* determinate `.ui-dotbar` carries the same progress data as `.ui-progress` but,
|
|
959
|
+
* without this, was eight empty `<span>`s to AT (the segments are decorative —
|
|
960
|
+
* mark them `aria-hidden`). Same progressbar role + aria-valuenow/min/max;
|
|
961
|
+
* call with no value for the indeterminate sweep. (component audit C10.)
|
|
962
|
+
*/
|
|
963
|
+
export const attrs = Object.freeze({
|
|
964
|
+
meter: (value, { min = 0, max = 100 } = {}) => valueAttrs('meter', value, min, max, false),
|
|
965
|
+
progress: (value, { min = 0, max = 100 } = {}) =>
|
|
966
|
+
valueAttrs('progressbar', value, min, max, true),
|
|
967
|
+
dotbar: (value, { min = 0, max = 100 } = {}) => valueAttrs('progressbar', value, min, max, true),
|
|
968
|
+
});
|
|
969
|
+
|
|
772
970
|
export default ui;
|
package/connectors/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export function finite(name: any, value: any, fallback: any): any;
|
|
2
2
|
export function dimension(name: any, value: any, fallback: any): any;
|
|
3
|
+
export function roundNumber(value: any): number;
|
|
3
4
|
export function fmt(value: any): string;
|
|
4
5
|
export function point(x: any, y: any): string;
|
|
5
6
|
export function clamp(value: any, min: any, max: any): any;
|
|
@@ -67,6 +68,17 @@ export function arrowHead(p: Point, angle: number, size?: number, spread?: numbe
|
|
|
67
68
|
* @returns {string}
|
|
68
69
|
*/
|
|
69
70
|
export function dotMark(p: Point, radius?: number): string;
|
|
71
|
+
/**
|
|
72
|
+
* An axis-aligned rectangle path from its corners (callers derive the corners
|
|
73
|
+
* from a centre or a top-left as they need). Shared by the annotation
|
|
74
|
+
* rect/band and evidence-marker subjects. (code-quality audit Q5.)
|
|
75
|
+
* @param {number} left
|
|
76
|
+
* @param {number} top
|
|
77
|
+
* @param {number} right
|
|
78
|
+
* @param {number} bottom
|
|
79
|
+
* @returns {string}
|
|
80
|
+
*/
|
|
81
|
+
export function rectPath(left: number, top: number, right: number, bottom: number): string;
|
|
70
82
|
/**
|
|
71
83
|
* Pick facing edges from the rects' relative centres.
|
|
72
84
|
* @param {Rect} fromRect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAkDA,kEAIC;AAED,qEAIC;AAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAkDA,kEAIC;AAED,qEAIC;AAKD,gDAGC;AAED,wCAEC;AAED,8CAEC;AAID,2DAGC;AAED;;;;;GAKG;AACH,kCAJW,IAAI,SACJ,IAAI,GACF,KAAK,CAoBjB;AAED;;;;;GAKG;AACH,mCAJW,KAAK,MACL,KAAK,GACH,MAAM,CAOlB;AAED;;;;;GAKG;AACH,mCAJW,KAAK,MACL,KAAK,GACH,MAAM,CAOlB;AAED;;;;;;GAMG;AACH,gCALW,KAAK,MACL,KAAK,SACL;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACd,MAAM,CAgBlB;AAED;;;;;;GAMG;AACH,gCALW,KAAK,MACL,KAAK,SACL;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACpB,MAAM,CAclB;AAED;;;;GAIG;AACH,qCAHW,oBAAoB,GAClB,MAAM,CAOlB;AAED;;;;;;;;GAQG;AACH,6BAPW,KAAK,SACL,MAAM,SACN,MAAM,WACN,MAAM,GAEJ,MAAM,CAalB;AAED;;;;;GAKG;AACH,2BAJW,KAAK,WACL,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;;;;GASG;AACH,+BANW,MAAM,OACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;GAKG;AACH,oCAJW,IAAI,UACJ,IAAI,GACF;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,CAWpC;AAED;;;;;;;;GAQG;AACH,sCALW,KAAK,MACL,KAAK,UACL,cAAc,GACZ,MAAM,CAQlB;AAED;;;;;;GAMG;AACH,oCAHW,mBAAmB,GACjB,kBAAkB,CAW9B;AAvSD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,wBAAyB,IAAI,CAAC;oBAhCjB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;mBACxB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;mBACvD,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ;6BAC9C,UAAU,GAAG,OAAO,GAAG,OAAO;;UAG7B,KAAK;QACL,KAAK;;;;;;;;;;;;cAML,IAAI;YACJ,IAAI;;;;;;;;;;;;;;OAQJ,MAAM;UACN,KAAK;QACL,KAAK;;;;WACL,MAAM"}
|
package/connectors/index.js
CHANGED
|
@@ -60,9 +60,16 @@ export function dimension(name, value, fallback) {
|
|
|
60
60
|
return v;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
// Round to PRECISION, normalising -0 → 0, and return the NUMBER (the numeric
|
|
64
|
+
// core `fmt` stringifies). Shared with the annotations layer for the rounded
|
|
65
|
+
// coordinates it echoes back to the host. (code-quality audit Q5.)
|
|
66
|
+
export function roundNumber(value) {
|
|
64
67
|
const rounded = Math.round((Object.is(value, -0) ? 0 : value) * PRECISION) / PRECISION;
|
|
65
|
-
return
|
|
68
|
+
return Object.is(rounded, -0) ? 0 : rounded;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function fmt(value) {
|
|
72
|
+
return String(roundNumber(value));
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
export function point(x, y) {
|
|
@@ -222,6 +229,20 @@ export function dotMark(p, radius = 3) {
|
|
|
222
229
|
)} 0 1 1 ${point(px, py - r)}Z`;
|
|
223
230
|
}
|
|
224
231
|
|
|
232
|
+
/**
|
|
233
|
+
* An axis-aligned rectangle path from its corners (callers derive the corners
|
|
234
|
+
* from a centre or a top-left as they need). Shared by the annotation
|
|
235
|
+
* rect/band and evidence-marker subjects. (code-quality audit Q5.)
|
|
236
|
+
* @param {number} left
|
|
237
|
+
* @param {number} top
|
|
238
|
+
* @param {number} right
|
|
239
|
+
* @param {number} bottom
|
|
240
|
+
* @returns {string}
|
|
241
|
+
*/
|
|
242
|
+
export function rectPath(left, top, right, bottom) {
|
|
243
|
+
return `M${point(left, top)}H${fmt(right)}V${fmt(bottom)}H${fmt(left)}Z`;
|
|
244
|
+
}
|
|
245
|
+
|
|
225
246
|
/**
|
|
226
247
|
* Pick facing edges from the rects' relative centres.
|
|
227
248
|
* @param {Rect} fromRect
|