@bicharts/chart-host 0.6.83 → 0.6.85
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 +43 -0
- package/dist/adapters.mjs +10 -4
- package/dist/card.mjs +2 -2
- package/dist/{chunk-2XWE6YFO.mjs → chunk-2ZUUIZWL.mjs} +115 -115
- package/dist/chunk-7HKVV5T5.mjs +198 -0
- package/dist/chunk-BQFG5HWZ.mjs +582 -0
- package/dist/{chunk-CJNONH6V.mjs → chunk-CDWNZHIN.mjs} +75 -592
- package/dist/{chunk-XIAL6EEC.mjs → chunk-DTOGTKAJ.mjs} +10 -2
- package/dist/{chunk-4KCSAHL5.mjs → chunk-GG4U66E4.mjs} +9 -9
- package/dist/{chunk-MGAO2DR7.mjs → chunk-IURROJT7.mjs} +95 -193
- package/dist/{chunk-7JWL6LYE.mjs → chunk-MR6TL7QZ.mjs} +1 -1
- package/dist/chunk-QIRLWJBI.mjs +665 -0
- package/dist/chunk-ZGQURBRJ.mjs +265 -0
- package/dist/index.mjs +148 -285
- package/dist/legend-fit.mjs +1613 -0
- package/dist/page.mjs +4 -1
- package/dist/react.mjs +8 -5
- package/dist/testing.mjs +1 -1
- package/dist/types/contract.d.ts +35 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/lasso.d.ts +143 -0
- package/dist/types/legendFit/frameFit.d.ts +89 -0
- package/dist/types/legendFit/frameFitDom.d.ts +70 -0
- package/dist/types/legendFit/index.d.ts +4 -0
- package/dist/types/legendFit/legendReconcile.d.ts +295 -0
- package/dist/types/legendFit/legendReconcileDom.d.ts +109 -0
- package/dist/types/qualifyGroups.d.ts +61 -3
- package/dist/types/selection.d.ts +51 -0
- package/package.json +6 -1
package/dist/index.mjs
CHANGED
|
@@ -5,37 +5,39 @@ import {
|
|
|
5
5
|
formatSourceDateFor,
|
|
6
6
|
isExcelDateFormat,
|
|
7
7
|
normaliseAggregation
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GG4U66E4.mjs";
|
|
9
|
+
import {
|
|
10
|
+
captureSvgSnapshot,
|
|
11
|
+
chartSvgOf,
|
|
12
|
+
htmlNaturalSize,
|
|
13
|
+
htmlToSvgDataUrl,
|
|
14
|
+
rasterizeSvgToPngDataUrl,
|
|
15
|
+
svgNaturalSize,
|
|
16
|
+
svgToDataUrl,
|
|
17
|
+
tableHostOf
|
|
18
|
+
} from "./chunk-ZGQURBRJ.mjs";
|
|
9
19
|
import {
|
|
10
20
|
ANNOTATION_CLASS,
|
|
11
21
|
ANNOTATION_LAYER_CLASS,
|
|
12
22
|
AUTO_RAMP_CLASSES,
|
|
13
23
|
AUTO_RAMP_DRAWN_OPACITY,
|
|
14
24
|
AUTO_RAMP_MIN_STEP_DELTA_E,
|
|
15
|
-
AXIS_PIN_BAND_PAD_PX,
|
|
16
|
-
AXIS_PIN_MAX_BAND_FRACTION,
|
|
17
|
-
AXIS_PIN_MIN_LABELS,
|
|
18
|
-
AXIS_PIN_TRACK_REACH_PX,
|
|
19
25
|
BACKING_MAJORITY,
|
|
20
26
|
CLIP_TOLERANCE_PX,
|
|
21
27
|
D3_PLUGIN_PACKAGES,
|
|
22
28
|
DARK_TEXT,
|
|
23
|
-
FIT_CONTENT_SELECTOR,
|
|
24
29
|
GLYPH_SAMPLE_N,
|
|
25
30
|
LABEL_CONTRAST_CAP,
|
|
26
31
|
LABEL_CONTRAST_DONE_ATTR,
|
|
27
32
|
LABEL_PILL_CLASS,
|
|
28
33
|
LIGHT_TEXT,
|
|
29
|
-
MAX_FRAME_GROW_FACTOR,
|
|
30
34
|
MIN_CONTRAST,
|
|
31
35
|
MIN_RAMP_FILLS,
|
|
32
36
|
PAGE_MATCH_TOLERANCE,
|
|
33
|
-
PHANTOM_FRACTION,
|
|
34
37
|
PILL_MIN_ALPHA,
|
|
35
38
|
PILL_MIN_COVERAGE,
|
|
36
39
|
PILL_OPAQUE_ALPHA,
|
|
37
40
|
SAME_SHADE_DELTA_E,
|
|
38
|
-
SCROLL_SLACK_PX,
|
|
39
41
|
STRADDLE_COLS,
|
|
40
42
|
STRADDLE_MIN_SHARE,
|
|
41
43
|
STRADDLE_PILL_ALPHA,
|
|
@@ -47,7 +49,6 @@ import {
|
|
|
47
49
|
assembleD3,
|
|
48
50
|
autoRampCanvas,
|
|
49
51
|
autoRampMinStep,
|
|
50
|
-
axisPinPlacement,
|
|
51
52
|
backingHoldsGlyph,
|
|
52
53
|
blankRenderFlag,
|
|
53
54
|
buildRenderPayload,
|
|
@@ -61,37 +62,25 @@ import {
|
|
|
61
62
|
colourSpreadFlag,
|
|
62
63
|
compileRenderFn,
|
|
63
64
|
compositeOver,
|
|
64
|
-
contentExtentOf,
|
|
65
65
|
contrastRatio,
|
|
66
66
|
createChartGroup,
|
|
67
67
|
createChartHost,
|
|
68
|
-
ctmScaleOf,
|
|
69
68
|
decideLabelColor,
|
|
70
69
|
deltaEHex,
|
|
71
70
|
explainRenderFailure,
|
|
72
|
-
fitReadingFor,
|
|
73
|
-
fitRenderedChart,
|
|
74
71
|
geoAssetFor,
|
|
75
72
|
geoFromCache,
|
|
76
73
|
glyphSampleGrid,
|
|
77
74
|
invalidSentinelReason,
|
|
78
75
|
isBlankRender,
|
|
79
|
-
isHorizontalLabelRow,
|
|
80
76
|
isInvalidSentinelError,
|
|
81
|
-
isPhantomBox,
|
|
82
77
|
isPillBackdropAlpha,
|
|
83
|
-
labelBand,
|
|
84
78
|
loadGeo,
|
|
85
|
-
measureContainerBoxes,
|
|
86
79
|
minContrastOver,
|
|
87
|
-
needsScroll,
|
|
88
80
|
newIdScope,
|
|
89
81
|
noopViewStateProvider,
|
|
90
82
|
pickColorOver,
|
|
91
83
|
pillBacksGlyph,
|
|
92
|
-
pinScrolledAxis,
|
|
93
|
-
planAxisPin,
|
|
94
|
-
planFrameGrow,
|
|
95
84
|
registerGeo,
|
|
96
85
|
registerGeoAsset,
|
|
97
86
|
relativeLuminance,
|
|
@@ -99,43 +88,103 @@ import {
|
|
|
99
88
|
resolveAutoColorScale,
|
|
100
89
|
resolveOptions,
|
|
101
90
|
scopeChartIds,
|
|
102
|
-
scrollFitFor,
|
|
103
91
|
sessionViewStateProvider,
|
|
104
92
|
straddleSampleGrid,
|
|
105
93
|
straddles,
|
|
106
94
|
stripEsmExports,
|
|
107
95
|
stripJsComments,
|
|
108
|
-
svgInkReach,
|
|
109
96
|
syncMemberSelection,
|
|
110
97
|
toRGBA,
|
|
111
98
|
toSourceRows,
|
|
112
|
-
unpinScrolledAxis,
|
|
113
99
|
valuePlacementFlag
|
|
114
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-CDWNZHIN.mjs";
|
|
101
|
+
import {
|
|
102
|
+
LASSO_AXES_SLOT,
|
|
103
|
+
LASSO_COUNT_CLASS,
|
|
104
|
+
LASSO_DEFAULT_ACTIONS,
|
|
105
|
+
LASSO_DRAG_PX,
|
|
106
|
+
LASSO_EVENT,
|
|
107
|
+
LASSO_KNOB_KEY,
|
|
108
|
+
LASSO_MAX_VERTICES,
|
|
109
|
+
LASSO_MODE_ATTR,
|
|
110
|
+
LASSO_NOTE_CLASS,
|
|
111
|
+
LASSO_OUTLINE_CLASS,
|
|
112
|
+
LASSO_PLOT_CLASS,
|
|
113
|
+
LASSO_RESTORE_MAX_SHAPES,
|
|
114
|
+
LASSO_RESTORE_MAX_VERTICES,
|
|
115
|
+
LASSO_ROW_CAP,
|
|
116
|
+
LASSO_SAMPLE_PX,
|
|
117
|
+
LASSO_SURFACE_CLASS,
|
|
118
|
+
clearLasso,
|
|
119
|
+
installLasso,
|
|
120
|
+
lassoActions,
|
|
121
|
+
lassoRowCap,
|
|
122
|
+
lassoVerdict,
|
|
123
|
+
pointInShape,
|
|
124
|
+
registerLassoAction
|
|
125
|
+
} from "./chunk-QIRLWJBI.mjs";
|
|
115
126
|
import {
|
|
116
127
|
_3,
|
|
117
128
|
l,
|
|
118
129
|
o
|
|
119
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-2ZUUIZWL.mjs";
|
|
120
131
|
import {
|
|
121
132
|
MIN_HIT_BAND_PX,
|
|
122
|
-
SELECTION_GLYPH_CLASS,
|
|
123
133
|
censusHitBands,
|
|
134
|
+
ensureCrossfilterHitTargets,
|
|
135
|
+
hitBandFlag
|
|
136
|
+
} from "./chunk-7HKVV5T5.mjs";
|
|
137
|
+
import {
|
|
138
|
+
CONTAINER_SLOT_PRESS_AT,
|
|
139
|
+
DRAG_NOT_CLICK_PX,
|
|
140
|
+
ROW_SET_MAX,
|
|
141
|
+
SELECTION_GLYPH_CLASS,
|
|
142
|
+
clearPress,
|
|
124
143
|
clearSelectionGlyphs,
|
|
144
|
+
clickWasDrag,
|
|
125
145
|
collectD3GlyphCenters,
|
|
126
146
|
createMarkResolver,
|
|
127
|
-
|
|
128
|
-
|
|
147
|
+
dispatchRowSet,
|
|
148
|
+
gestureWasDrag,
|
|
129
149
|
isInsideControl,
|
|
130
150
|
markKeyOf,
|
|
131
151
|
nextClickedMarks,
|
|
132
152
|
nextSelection,
|
|
133
153
|
paintSelectionGlyphs,
|
|
134
154
|
planSelectionPaint,
|
|
155
|
+
pressOf,
|
|
135
156
|
rowIdxsFromMark,
|
|
136
157
|
sameRowSet,
|
|
137
|
-
selectionRuleOf
|
|
138
|
-
|
|
158
|
+
selectionRuleOf,
|
|
159
|
+
trackPress,
|
|
160
|
+
validRowSet
|
|
161
|
+
} from "./chunk-IURROJT7.mjs";
|
|
162
|
+
import {
|
|
163
|
+
AXIS_PIN_BAND_PAD_PX,
|
|
164
|
+
AXIS_PIN_MAX_BAND_FRACTION,
|
|
165
|
+
AXIS_PIN_MIN_LABELS,
|
|
166
|
+
AXIS_PIN_TRACK_REACH_PX,
|
|
167
|
+
FIT_CONTENT_SELECTOR,
|
|
168
|
+
MAX_FRAME_GROW_FACTOR,
|
|
169
|
+
PHANTOM_FRACTION,
|
|
170
|
+
SCROLL_SLACK_PX,
|
|
171
|
+
axisPinPlacement,
|
|
172
|
+
contentExtentOf,
|
|
173
|
+
ctmScaleOf,
|
|
174
|
+
fitReadingFor,
|
|
175
|
+
fitRenderedChart,
|
|
176
|
+
isHorizontalLabelRow,
|
|
177
|
+
isPhantomBox,
|
|
178
|
+
labelBand,
|
|
179
|
+
measureContainerBoxes,
|
|
180
|
+
needsScroll,
|
|
181
|
+
pinScrolledAxis,
|
|
182
|
+
planAxisPin,
|
|
183
|
+
planFrameGrow,
|
|
184
|
+
scrollFitFor,
|
|
185
|
+
svgInkReach,
|
|
186
|
+
unpinScrolledAxis
|
|
187
|
+
} from "./chunk-BQFG5HWZ.mjs";
|
|
139
188
|
import "./chunk-A2GMXZP7.mjs";
|
|
140
189
|
import {
|
|
141
190
|
ACTIVE_TICK_CLASS,
|
|
@@ -187,7 +236,7 @@ import {
|
|
|
187
236
|
chartOwnsTimeline,
|
|
188
237
|
periodTickSuppressesFeedback,
|
|
189
238
|
withoutViewOnlyKeys
|
|
190
|
-
} from "./chunk-
|
|
239
|
+
} from "./chunk-MR6TL7QZ.mjs";
|
|
191
240
|
import "./chunk-GHODWOAL.mjs";
|
|
192
241
|
|
|
193
242
|
// src/optionsVocabulary.ts
|
|
@@ -564,256 +613,6 @@ function histogramSource(idx, name) {
|
|
|
564
613
|
}`;
|
|
565
614
|
}
|
|
566
615
|
|
|
567
|
-
// src/snapshot.ts
|
|
568
|
-
var DEFAULT_TIMEOUT_MS = 2e3;
|
|
569
|
-
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
570
|
-
var XHTML_NS = "http://www.w3.org/1999/xhtml";
|
|
571
|
-
function toBase64(str) {
|
|
572
|
-
const bytes = new TextEncoder().encode(str);
|
|
573
|
-
let binary = "";
|
|
574
|
-
for (let i2 = 0; i2 < bytes.length; i2++) binary += String.fromCharCode(bytes[i2]);
|
|
575
|
-
return btoa(binary);
|
|
576
|
-
}
|
|
577
|
-
function viewOf(el) {
|
|
578
|
-
return el.ownerDocument && el.ownerDocument.defaultView || globalThis;
|
|
579
|
-
}
|
|
580
|
-
var MAX_STYLED_ELEMENTS = 4e3;
|
|
581
|
-
var TEXT_FONT_PROPS = ["font-family", "font-size", "font-weight", "font-style"];
|
|
582
|
-
function inlineTextFonts(original, clone) {
|
|
583
|
-
const view = viewOf(original);
|
|
584
|
-
if (!view || typeof view.getComputedStyle !== "function") return;
|
|
585
|
-
const src = original.querySelectorAll("text");
|
|
586
|
-
const dst = clone.querySelectorAll("text");
|
|
587
|
-
if (src.length !== dst.length) return;
|
|
588
|
-
const n2 = Math.min(src.length, MAX_STYLED_ELEMENTS);
|
|
589
|
-
for (let i2 = 0; i2 < n2; i2++) {
|
|
590
|
-
let cs;
|
|
591
|
-
try {
|
|
592
|
-
cs = view.getComputedStyle(src[i2]);
|
|
593
|
-
} catch {
|
|
594
|
-
continue;
|
|
595
|
-
}
|
|
596
|
-
const style = dst[i2].style;
|
|
597
|
-
if (!style) continue;
|
|
598
|
-
for (const prop of TEXT_FONT_PROPS) {
|
|
599
|
-
const v2 = cs.getPropertyValue(prop);
|
|
600
|
-
if (v2 && !style.getPropertyValue(prop)) style.setProperty(prop, v2);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
function svgToDataUrl(svg) {
|
|
605
|
-
const cloned = svg.cloneNode(true);
|
|
606
|
-
const w2 = svg.clientWidth || svg.getBoundingClientRect && svg.getBoundingClientRect().width || 600;
|
|
607
|
-
const h2 = svg.clientHeight || svg.getBoundingClientRect && svg.getBoundingClientRect().height || 400;
|
|
608
|
-
cloned.setAttribute("width", String(Math.round(w2)));
|
|
609
|
-
cloned.setAttribute("height", String(Math.round(h2)));
|
|
610
|
-
if (!cloned.getAttribute("xmlns")) cloned.setAttribute("xmlns", SVG_NS);
|
|
611
|
-
try {
|
|
612
|
-
inlineTextFonts(svg, cloned);
|
|
613
|
-
} catch {
|
|
614
|
-
}
|
|
615
|
-
return "data:image/svg+xml;base64," + toBase64(new XMLSerializer().serializeToString(cloned));
|
|
616
|
-
}
|
|
617
|
-
function tableHostOf(root) {
|
|
618
|
-
if (!root || typeof root.querySelector !== "function") return null;
|
|
619
|
-
if (root.namespaceURI === SVG_NS) return null;
|
|
620
|
-
const firstSvg = root.querySelector("svg");
|
|
621
|
-
for (const sel of [".lch-table-frame", "table"]) {
|
|
622
|
-
const host = root.querySelector(sel);
|
|
623
|
-
if (host && (!firstSvg || host.contains(firstSvg))) return host;
|
|
624
|
-
}
|
|
625
|
-
return null;
|
|
626
|
-
}
|
|
627
|
-
function chartSvgOf(root) {
|
|
628
|
-
if (!root || typeof root.querySelector !== "function") return null;
|
|
629
|
-
return root.querySelector(`svg[${SNAPSHOT_SVG_ATTR}]`) ?? root.querySelector("svg");
|
|
630
|
-
}
|
|
631
|
-
function inlinePx(v2) {
|
|
632
|
-
const m2 = /^\s*([0-9.]+)px\s*$/.exec(v2 || "");
|
|
633
|
-
return m2 ? parseFloat(m2[1]) : 0;
|
|
634
|
-
}
|
|
635
|
-
function htmlNaturalSize(el) {
|
|
636
|
-
const r2 = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
|
|
637
|
-
const w2 = el.clientWidth || r2 && r2.width || inlinePx(el.style && el.style.width) || 600;
|
|
638
|
-
const h2 = el.clientHeight || r2 && r2.height || inlinePx(el.style && el.style.height) || 400;
|
|
639
|
-
return { width: Math.round(w2), height: Math.round(h2) };
|
|
640
|
-
}
|
|
641
|
-
var HTML_STYLE_PROPS = [
|
|
642
|
-
"display",
|
|
643
|
-
"box-sizing",
|
|
644
|
-
"width",
|
|
645
|
-
"height",
|
|
646
|
-
"margin-top",
|
|
647
|
-
"margin-right",
|
|
648
|
-
"margin-bottom",
|
|
649
|
-
"margin-left",
|
|
650
|
-
"padding-top",
|
|
651
|
-
"padding-right",
|
|
652
|
-
"padding-bottom",
|
|
653
|
-
"padding-left",
|
|
654
|
-
"border-top-width",
|
|
655
|
-
"border-right-width",
|
|
656
|
-
"border-bottom-width",
|
|
657
|
-
"border-left-width",
|
|
658
|
-
"border-top-style",
|
|
659
|
-
"border-right-style",
|
|
660
|
-
"border-bottom-style",
|
|
661
|
-
"border-left-style",
|
|
662
|
-
"border-top-color",
|
|
663
|
-
"border-right-color",
|
|
664
|
-
"border-bottom-color",
|
|
665
|
-
"border-left-color",
|
|
666
|
-
"border-collapse",
|
|
667
|
-
"border-spacing",
|
|
668
|
-
"background-color",
|
|
669
|
-
"color",
|
|
670
|
-
"opacity",
|
|
671
|
-
"font-family",
|
|
672
|
-
"font-size",
|
|
673
|
-
"font-weight",
|
|
674
|
-
"font-style",
|
|
675
|
-
"line-height",
|
|
676
|
-
"letter-spacing",
|
|
677
|
-
"text-align",
|
|
678
|
-
"vertical-align",
|
|
679
|
-
"white-space",
|
|
680
|
-
"text-overflow",
|
|
681
|
-
"text-decoration-line",
|
|
682
|
-
"flex-direction",
|
|
683
|
-
"flex-wrap",
|
|
684
|
-
"flex-grow",
|
|
685
|
-
"flex-shrink",
|
|
686
|
-
"flex-basis",
|
|
687
|
-
"align-items",
|
|
688
|
-
"justify-content",
|
|
689
|
-
"position",
|
|
690
|
-
"top",
|
|
691
|
-
"right",
|
|
692
|
-
"bottom",
|
|
693
|
-
"left"
|
|
694
|
-
];
|
|
695
|
-
function inlineHtmlStyles(original, clone) {
|
|
696
|
-
const view = viewOf(original);
|
|
697
|
-
if (!view || typeof view.getComputedStyle !== "function") return;
|
|
698
|
-
const src = [original, ...Array.from(original.querySelectorAll("*"))];
|
|
699
|
-
const dst = [clone, ...Array.from(clone.querySelectorAll("*"))];
|
|
700
|
-
if (src.length !== dst.length) return;
|
|
701
|
-
let styled = 0;
|
|
702
|
-
for (let i2 = 0; i2 < src.length && styled < MAX_STYLED_ELEMENTS; i2++) {
|
|
703
|
-
const o3 = src[i2], c2 = dst[i2];
|
|
704
|
-
if (o3.namespaceURI !== XHTML_NS || !c2.style) continue;
|
|
705
|
-
let cs;
|
|
706
|
-
try {
|
|
707
|
-
cs = view.getComputedStyle(o3);
|
|
708
|
-
} catch {
|
|
709
|
-
continue;
|
|
710
|
-
}
|
|
711
|
-
for (const prop of HTML_STYLE_PROPS) {
|
|
712
|
-
const v2 = cs.getPropertyValue(prop);
|
|
713
|
-
if (v2) c2.style.setProperty(prop, v2);
|
|
714
|
-
}
|
|
715
|
-
c2.style.setProperty("overflow", "hidden");
|
|
716
|
-
styled++;
|
|
717
|
-
}
|
|
718
|
-
try {
|
|
719
|
-
inlineTextFonts(original, clone);
|
|
720
|
-
} catch {
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function htmlToSvgDataUrl(el) {
|
|
724
|
-
const { width, height } = htmlNaturalSize(el);
|
|
725
|
-
const clone = el.cloneNode(true);
|
|
726
|
-
inlineHtmlStyles(el, clone);
|
|
727
|
-
clone.style.setProperty("width", `${width}px`);
|
|
728
|
-
clone.style.setProperty("height", `${height}px`);
|
|
729
|
-
clone.style.setProperty("margin", "0");
|
|
730
|
-
let xhtml = new XMLSerializer().serializeToString(clone);
|
|
731
|
-
if (!/^<[^>]*\sxmlns=/.test(xhtml)) xhtml = xhtml.replace(/^<([a-zA-Z0-9-]+)/, `<$1 xmlns="${XHTML_NS}"`);
|
|
732
|
-
const svg = `<svg xmlns="${SVG_NS}" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}"><foreignObject x="0" y="0" width="${width}" height="${height}">${xhtml}</foreignObject></svg>`;
|
|
733
|
-
return { url: "data:image/svg+xml;base64," + toBase64(svg), width, height };
|
|
734
|
-
}
|
|
735
|
-
function svgNaturalSize(svg) {
|
|
736
|
-
const w2 = svg.clientWidth || svg.getBoundingClientRect && svg.getBoundingClientRect().width || 600;
|
|
737
|
-
const h2 = svg.clientHeight || svg.getBoundingClientRect && svg.getBoundingClientRect().height || 400;
|
|
738
|
-
return { width: Math.round(w2), height: Math.round(h2) };
|
|
739
|
-
}
|
|
740
|
-
function rasterizeSvgToPngDataUrl(svgDataUrl, width, height, opts = {}) {
|
|
741
|
-
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
742
|
-
return new Promise((resolve) => {
|
|
743
|
-
let img;
|
|
744
|
-
try {
|
|
745
|
-
img = new Image();
|
|
746
|
-
} catch (e2) {
|
|
747
|
-
opts.onWarn?.("snapshot-no-image", e2 instanceof Error ? e2.message : String(e2));
|
|
748
|
-
resolve(null);
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
const timer = setTimeout(() => {
|
|
752
|
-
opts.onWarn?.("snapshot-raster-timeout", { width, height, timeoutMs });
|
|
753
|
-
resolve(null);
|
|
754
|
-
}, timeoutMs);
|
|
755
|
-
img.onload = () => {
|
|
756
|
-
clearTimeout(timer);
|
|
757
|
-
try {
|
|
758
|
-
const cap = opts.maxSide && opts.maxSide > 0 ? opts.maxSide : Math.max(width, height);
|
|
759
|
-
const scale = Math.min(1, cap / Math.max(width, height));
|
|
760
|
-
const cw = Math.max(1, Math.round(width * scale));
|
|
761
|
-
const ch = Math.max(1, Math.round(height * scale));
|
|
762
|
-
const canvas = document.createElement("canvas");
|
|
763
|
-
canvas.width = cw;
|
|
764
|
-
canvas.height = ch;
|
|
765
|
-
const c2d = canvas.getContext("2d");
|
|
766
|
-
if (!c2d) {
|
|
767
|
-
resolve(null);
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
c2d.fillStyle = "white";
|
|
771
|
-
c2d.fillRect(0, 0, cw, ch);
|
|
772
|
-
c2d.drawImage(img, 0, 0, cw, ch);
|
|
773
|
-
resolve(canvas.toDataURL("image/png"));
|
|
774
|
-
} catch (e2) {
|
|
775
|
-
opts.onWarn?.("snapshot-raster-draw", e2 instanceof Error ? e2.message : String(e2));
|
|
776
|
-
resolve(null);
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
img.onerror = () => {
|
|
780
|
-
clearTimeout(timer);
|
|
781
|
-
opts.onWarn?.("snapshot-raster-decode", { width, height });
|
|
782
|
-
resolve(null);
|
|
783
|
-
};
|
|
784
|
-
img.src = svgDataUrl;
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
async function captureSvgSnapshot(root, opts = {}) {
|
|
788
|
-
if (!root) return null;
|
|
789
|
-
const table = root instanceof SVGSVGElement ? null : tableHostOf(root);
|
|
790
|
-
const svg = table ? null : root instanceof SVGSVGElement ? root : chartSvgOf(root);
|
|
791
|
-
if (!table && !svg) return null;
|
|
792
|
-
let svgUrl;
|
|
793
|
-
let width, height;
|
|
794
|
-
try {
|
|
795
|
-
if (table) {
|
|
796
|
-
const r2 = htmlToSvgDataUrl(table);
|
|
797
|
-
svgUrl = r2.url;
|
|
798
|
-
width = r2.width;
|
|
799
|
-
height = r2.height;
|
|
800
|
-
} else {
|
|
801
|
-
svgUrl = svgToDataUrl(svg);
|
|
802
|
-
({ width, height } = svgNaturalSize(svg));
|
|
803
|
-
}
|
|
804
|
-
} catch (e2) {
|
|
805
|
-
opts.onWarn?.("snapshot-serialize", e2 instanceof Error ? e2.message : String(e2));
|
|
806
|
-
return null;
|
|
807
|
-
}
|
|
808
|
-
try {
|
|
809
|
-
const png = await rasterizeSvgToPngDataUrl(svgUrl, width, height, opts);
|
|
810
|
-
return png || svgUrl;
|
|
811
|
-
} catch (e2) {
|
|
812
|
-
opts.onWarn?.("snapshot-raster-unexpected", e2 instanceof Error ? e2.message : String(e2));
|
|
813
|
-
return svgUrl;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
616
|
// src/review.ts
|
|
818
617
|
function shouldReview(g2) {
|
|
819
618
|
if (!g2.enabled) return false;
|
|
@@ -1132,7 +931,21 @@ function qualifyGroupHeadingFor(row, state) {
|
|
|
1132
931
|
return null;
|
|
1133
932
|
}
|
|
1134
933
|
function newQualifyRefusalGroupState() {
|
|
1135
|
-
return { poorFit: false, cannotDraw: false };
|
|
934
|
+
return { poorFit: false, tooSmall: false, cannotDraw: false };
|
|
935
|
+
}
|
|
936
|
+
var QUALIFY_TILE_REFUSAL_CODES = Object.freeze([
|
|
937
|
+
"TILE_TOO_NARROW",
|
|
938
|
+
"TILE_TOO_SHORT",
|
|
939
|
+
"TILE_NOT_SQUARE",
|
|
940
|
+
"TILE_NOT_TALL",
|
|
941
|
+
"TILE_TOO_SMALL",
|
|
942
|
+
"EMBED_NOTHING_FITS_TILE",
|
|
943
|
+
"EMBED_BEESWARM_TILE_TOO_SMALL"
|
|
944
|
+
]);
|
|
945
|
+
var QUALIFY_TOO_SMALL_HEADING = "Needs a bigger tile";
|
|
946
|
+
function refusalIsTileBound(row) {
|
|
947
|
+
const code = row?.reasonCode;
|
|
948
|
+
return typeof code === "string" && QUALIFY_TILE_REFUSAL_CODES.includes(code);
|
|
1136
949
|
}
|
|
1137
950
|
function refusalIsSelectable(row) {
|
|
1138
951
|
return !!row && row.isVeto !== true;
|
|
@@ -1140,9 +953,23 @@ function refusalIsSelectable(row) {
|
|
|
1140
953
|
function orderRefusalsForDisplay(rows) {
|
|
1141
954
|
if (!Array.isArray(rows)) return [];
|
|
1142
955
|
const named = rows.filter((r2) => !!r2 && typeof r2.name === "string" && r2.name.trim() !== "");
|
|
1143
|
-
|
|
956
|
+
const tile = named.filter(refusalIsTileBound);
|
|
957
|
+
const rest = named.filter((r2) => !refusalIsTileBound(r2));
|
|
958
|
+
return [
|
|
959
|
+
...rest.filter(refusalIsSelectable),
|
|
960
|
+
...tile.filter(refusalIsSelectable),
|
|
961
|
+
...tile.filter((r2) => !refusalIsSelectable(r2)),
|
|
962
|
+
...rest.filter((r2) => !refusalIsSelectable(r2))
|
|
963
|
+
];
|
|
1144
964
|
}
|
|
1145
965
|
function qualifyRefusalHeadingFor(row, state) {
|
|
966
|
+
if (refusalIsTileBound(row)) {
|
|
967
|
+
if (!state.tooSmall) {
|
|
968
|
+
state.tooSmall = true;
|
|
969
|
+
return "tooSmall";
|
|
970
|
+
}
|
|
971
|
+
return null;
|
|
972
|
+
}
|
|
1146
973
|
if (refusalIsSelectable(row)) {
|
|
1147
974
|
if (!state.poorFit) {
|
|
1148
975
|
state.poorFit = true;
|
|
@@ -2325,6 +2152,7 @@ export {
|
|
|
2325
2152
|
CONTAINER_SLOT_ANIM_STOP,
|
|
2326
2153
|
CONTAINER_SLOT_CLICKED_MARKS,
|
|
2327
2154
|
CONTAINER_SLOT_INITIAL_XF_MARK,
|
|
2155
|
+
CONTAINER_SLOT_PRESS_AT,
|
|
2328
2156
|
CONTAINER_SLOT_UI_STATE,
|
|
2329
2157
|
CONTAINER_SLOT_XF_CLEAR,
|
|
2330
2158
|
CONTROL_CLASS,
|
|
@@ -2334,6 +2162,7 @@ export {
|
|
|
2334
2162
|
DEFAULT_MODEL_SUFFIX,
|
|
2335
2163
|
DIM_OPACITY_DEFAULT,
|
|
2336
2164
|
DIM_OPACITY_VAR,
|
|
2165
|
+
DRAG_NOT_CLICK_PX,
|
|
2337
2166
|
DUPLICATE_GENERATE_WINDOW_MS,
|
|
2338
2167
|
FILTER_MIN_HEIGHT_PX,
|
|
2339
2168
|
FILTER_MIN_TERM_CHARS,
|
|
@@ -2356,6 +2185,22 @@ export {
|
|
|
2356
2185
|
LABEL_CONTRAST_CAP,
|
|
2357
2186
|
LABEL_CONTRAST_DONE_ATTR,
|
|
2358
2187
|
LABEL_PILL_CLASS,
|
|
2188
|
+
LASSO_AXES_SLOT,
|
|
2189
|
+
LASSO_COUNT_CLASS,
|
|
2190
|
+
LASSO_DEFAULT_ACTIONS,
|
|
2191
|
+
LASSO_DRAG_PX,
|
|
2192
|
+
LASSO_EVENT,
|
|
2193
|
+
LASSO_KNOB_KEY,
|
|
2194
|
+
LASSO_MAX_VERTICES,
|
|
2195
|
+
LASSO_MODE_ATTR,
|
|
2196
|
+
LASSO_NOTE_CLASS,
|
|
2197
|
+
LASSO_OUTLINE_CLASS,
|
|
2198
|
+
LASSO_PLOT_CLASS,
|
|
2199
|
+
LASSO_RESTORE_MAX_SHAPES,
|
|
2200
|
+
LASSO_RESTORE_MAX_VERTICES,
|
|
2201
|
+
LASSO_ROW_CAP,
|
|
2202
|
+
LASSO_SAMPLE_PX,
|
|
2203
|
+
LASSO_SURFACE_CLASS,
|
|
2359
2204
|
LEGEND_MARK_CLASS,
|
|
2360
2205
|
LEGIBLE_LIGHTNESS,
|
|
2361
2206
|
LIFT_SELECTED_CLASS,
|
|
@@ -2391,8 +2236,11 @@ export {
|
|
|
2391
2236
|
PRODUCT_FEEDBACK_MAX_CHARS,
|
|
2392
2237
|
PRODUCT_FEEDBACK_MIN_CHARS,
|
|
2393
2238
|
QUALIFY_REFUSAL_UNSPECIFIED,
|
|
2239
|
+
QUALIFY_TILE_REFUSAL_CODES,
|
|
2240
|
+
QUALIFY_TOO_SMALL_HEADING,
|
|
2394
2241
|
RECOVERY_UNREACHABLE_MESSAGE,
|
|
2395
2242
|
ROW_IDX_ATTR,
|
|
2243
|
+
ROW_SET_MAX,
|
|
2396
2244
|
SAME_SHADE_DELTA_E,
|
|
2397
2245
|
SCROLL_SLACK_PX,
|
|
2398
2246
|
SEASONAL_MARKERS_DEFAULT,
|
|
@@ -2441,7 +2289,10 @@ export {
|
|
|
2441
2289
|
chartSvgOf,
|
|
2442
2290
|
chooserFitsViewport,
|
|
2443
2291
|
clearGeoCache,
|
|
2292
|
+
clearLasso,
|
|
2293
|
+
clearPress,
|
|
2444
2294
|
clearSelectionGlyphs,
|
|
2295
|
+
clickWasDrag,
|
|
2445
2296
|
clippedTextFlag,
|
|
2446
2297
|
codeReadsDatesInLocalTime,
|
|
2447
2298
|
codeReadsOption,
|
|
@@ -2464,6 +2315,7 @@ export {
|
|
|
2464
2315
|
decidePendingRecovery,
|
|
2465
2316
|
defaultModelFirst,
|
|
2466
2317
|
deltaEHex,
|
|
2318
|
+
dispatchRowSet,
|
|
2467
2319
|
encodePendingGenerate,
|
|
2468
2320
|
ensureCrossfilterHitTargets,
|
|
2469
2321
|
explainRenderFailure,
|
|
@@ -2478,12 +2330,14 @@ export {
|
|
|
2478
2330
|
generationCancelledMessage,
|
|
2479
2331
|
geoAssetFor,
|
|
2480
2332
|
geoFromCache,
|
|
2333
|
+
gestureWasDrag,
|
|
2481
2334
|
glyphSampleGrid,
|
|
2482
2335
|
hasRefusalsToShow,
|
|
2483
2336
|
hitBandFlag,
|
|
2484
2337
|
htmlNaturalSize,
|
|
2485
2338
|
htmlToSvgDataUrl,
|
|
2486
2339
|
inlineFilterGate,
|
|
2340
|
+
installLasso,
|
|
2487
2341
|
invalidSentinelReason,
|
|
2488
2342
|
isBlankRender,
|
|
2489
2343
|
isBlindMarker,
|
|
@@ -2498,6 +2352,9 @@ export {
|
|
|
2498
2352
|
isPickableModelCode,
|
|
2499
2353
|
isPillBackdropAlpha,
|
|
2500
2354
|
labelBand,
|
|
2355
|
+
lassoActions,
|
|
2356
|
+
lassoRowCap,
|
|
2357
|
+
lassoVerdict,
|
|
2501
2358
|
latePickupAction,
|
|
2502
2359
|
latePickupKeepsMarker,
|
|
2503
2360
|
launchFavorStyle,
|
|
@@ -2536,7 +2393,9 @@ export {
|
|
|
2536
2393
|
planFrameGrow,
|
|
2537
2394
|
planSelectionPaint,
|
|
2538
2395
|
planTrivialChart,
|
|
2396
|
+
pointInShape,
|
|
2539
2397
|
pollGiveUpKeepsMarker,
|
|
2398
|
+
pressOf,
|
|
2540
2399
|
productFeedbackSendable,
|
|
2541
2400
|
qualifyAuto,
|
|
2542
2401
|
qualifyCancel,
|
|
@@ -2562,9 +2421,11 @@ export {
|
|
|
2562
2421
|
recoveryPollRunning,
|
|
2563
2422
|
recoveryProvesNothingCharged,
|
|
2564
2423
|
refusalIsSelectable,
|
|
2424
|
+
refusalIsTileBound,
|
|
2565
2425
|
registerCityTable,
|
|
2566
2426
|
registerGeo,
|
|
2567
2427
|
registerGeoAsset,
|
|
2428
|
+
registerLassoAction,
|
|
2568
2429
|
relativeLuminance,
|
|
2569
2430
|
requiredD3Plugins,
|
|
2570
2431
|
resolveAutoColorScale,
|
|
@@ -2594,9 +2455,11 @@ export {
|
|
|
2594
2455
|
tableHostOf,
|
|
2595
2456
|
toRGBA,
|
|
2596
2457
|
toSourceRows,
|
|
2458
|
+
trackPress,
|
|
2597
2459
|
transportFailureShouldRecover,
|
|
2598
2460
|
unpinScrolledAxis,
|
|
2599
2461
|
updateRowHighWater,
|
|
2462
|
+
validRowSet,
|
|
2600
2463
|
valuePlacementFlag,
|
|
2601
2464
|
vegaSpecReadsDatesInLocalTime,
|
|
2602
2465
|
wireLimitCount,
|