@bicharts/chart-host 0.6.82 → 0.6.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.mjs +10 -4
- package/dist/card.mjs +2 -2
- package/dist/{chunk-MP5S6MVW.mjs → chunk-2HKO6GEK.mjs} +70 -17
- package/dist/{chunk-ZRSEKV4I.mjs → chunk-2ZUUIZWL.mjs} +112 -112
- package/dist/chunk-7HKVV5T5.mjs +198 -0
- package/dist/{chunk-XIAL6EEC.mjs → chunk-DTOGTKAJ.mjs} +10 -2
- package/dist/{chunk-7HPVGRQ2.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/index.mjs +123 -13
- package/dist/page.mjs +4 -1
- package/dist/react.mjs +7 -5
- package/dist/testing.mjs +1 -1
- package/dist/types/contract.d.ts +35 -1
- package/dist/types/index.d.ts +5 -4
- package/dist/types/lasso.d.ts +143 -0
- package/dist/types/pendingGenerate.d.ts +18 -2
- package/dist/types/qualifyGroups.d.ts +61 -3
- package/dist/types/selection.d.ts +51 -0
- package/package.json +1 -1
|
@@ -44,15 +44,66 @@ export interface QualifyRefusalRow {
|
|
|
44
44
|
reason?: string | null;
|
|
45
45
|
/** True = a required channel is ABSENT. Absent/false = a threshold we are willing to waive. */
|
|
46
46
|
isVeto?: boolean | null;
|
|
47
|
+
/**
|
|
48
|
+
* WHICH GATE wrote `reason`, as the server's stable code. Absent from a server that predates
|
|
49
|
+
* the code, which reads as "not known to be about the tile": the row keeps the grouping the
|
|
50
|
+
* list always had.
|
|
51
|
+
*/
|
|
52
|
+
reasonCode?: string | null;
|
|
47
53
|
}
|
|
48
54
|
/** Which heading to write BEFORE a refused row, if any. */
|
|
49
|
-
export type QualifyRefusalHeading = "poorFit" | "cannotDraw";
|
|
55
|
+
export type QualifyRefusalHeading = "poorFit" | "tooSmall" | "cannotDraw";
|
|
50
56
|
/** Carried across the refusal loop. One per render. */
|
|
51
57
|
export interface QualifyRefusalGroupState {
|
|
52
58
|
poorFit: boolean;
|
|
59
|
+
tooSmall: boolean;
|
|
53
60
|
cannotDraw: boolean;
|
|
54
61
|
}
|
|
55
62
|
export declare function newQualifyRefusalGroupState(): QualifyRefusalGroupState;
|
|
63
|
+
/**
|
|
64
|
+
* THE REFUSAL CODES THAT MEAN "THE TILE", NOT "THE FIELDS".
|
|
65
|
+
*
|
|
66
|
+
* Each refusal carries the code of the gate that wrote its sentence. These gates compare what a
|
|
67
|
+
* chart type needs with the size and shape of the tile and nothing else:
|
|
68
|
+
* - TILE_TOO_NARROW, TILE_TOO_SHORT, TILE_NOT_SQUARE, TILE_NOT_TALL: too narrow, too short, not
|
|
69
|
+
* square enough, not tall enough.
|
|
70
|
+
* - TILE_TOO_SMALL: a type that does not hold up on a small tile, turned down because the tile is
|
|
71
|
+
* under the size the full catalogue needs, whatever the data is.
|
|
72
|
+
* - EMBED_NOTHING_FITS_TILE: a headline-plus-small-drawing type whose drawing has no form that
|
|
73
|
+
* fits the tile; the headline alone is still drawable on a plain card.
|
|
74
|
+
* - EMBED_BEESWARM_TILE_TOO_SMALL: a beeswarm turned down because the tile is under the size it
|
|
75
|
+
* needs.
|
|
76
|
+
* The data can be exactly right and the type is still turned down, and the one thing that changes
|
|
77
|
+
* the answer is a bigger tile.
|
|
78
|
+
*
|
|
79
|
+
* Without this split those rows sat under "Can't be drawn from the fields as bound" or "Poor fit
|
|
80
|
+
* for these fields" - headings that send the reader to rebind data that is fine.
|
|
81
|
+
*
|
|
82
|
+
* ONLY GATES THAT LOOK AT THE TILE ALONE ARE LISTED. A gate that weighs the tile against the data
|
|
83
|
+
* (ROWS_CRAMPED, a row-per-category floor; TOO_MANY_PANELS, a panel budget; CATEGORIES_TOO_WIDE)
|
|
84
|
+
* can be answered by either, so naming it a tile problem would be the same false instruction
|
|
85
|
+
* turned around. A code is added here when the server starts sending one that is purely about the
|
|
86
|
+
* tile; an unknown code keeps the grouping it had.
|
|
87
|
+
*/
|
|
88
|
+
export declare const QUALIFY_TILE_REFUSAL_CODES: readonly string[];
|
|
89
|
+
/**
|
|
90
|
+
* THE HEADING OVER THE TILE BLOCK, in the one place every host reads it from, so the wording
|
|
91
|
+
* cannot drift between them and a test pins it once.
|
|
92
|
+
*
|
|
93
|
+
* It says what the reader can do about it, not what category the row is in, and it says nothing
|
|
94
|
+
* about the fields: the rows under it are exactly the ones the fields are not the problem for.
|
|
95
|
+
* English source text - a host that localizes looks it up like its other headings.
|
|
96
|
+
*/
|
|
97
|
+
export declare const QUALIFY_TOO_SMALL_HEADING = "Needs a bigger tile";
|
|
98
|
+
/**
|
|
99
|
+
* IS THIS REFUSAL ABOUT THE TILE'S SIZE OR SHAPE? Decided from the server's code, never from the
|
|
100
|
+
* sentence: a host that matched the English would go blind the day the sentences are translated,
|
|
101
|
+
* and would re-derive a verdict it was already handed.
|
|
102
|
+
*
|
|
103
|
+
* A row with no code (an older server) is NOT tile-bound. That is the safe direction: it keeps
|
|
104
|
+
* the two-heading grouping the list had before the code existed.
|
|
105
|
+
*/
|
|
106
|
+
export declare function refusalIsTileBound(row: QualifyRefusalRow | null | undefined): boolean;
|
|
56
107
|
/**
|
|
57
108
|
* MAY THE READER PICK THIS ONE? The single place that answers it, in either host.
|
|
58
109
|
*
|
|
@@ -63,15 +114,22 @@ export declare function newQualifyRefusalGroupState(): QualifyRefusalGroupState;
|
|
|
63
114
|
*/
|
|
64
115
|
export declare function refusalIsSelectable(row: QualifyRefusalRow | null | undefined): boolean;
|
|
65
116
|
/**
|
|
66
|
-
* The refused rows in RENDER ORDER:
|
|
117
|
+
* The refused rows in RENDER ORDER: the pickable ones first, then the ones the tile alone turned
|
|
118
|
+
* down, then the vetoes the fields cause.
|
|
67
119
|
*
|
|
68
120
|
* A STABLE PARTITION, not a sort — within each block the server's alphabetical order survives, so
|
|
69
121
|
* two answers over the same shape stay diffable. Rows without a name are dropped: a control
|
|
70
122
|
* labelled with nothing cannot be chosen and a reason with no subject cannot be read.
|
|
71
123
|
*
|
|
72
|
-
* The
|
|
124
|
+
* The blocks are ordered pickable-first because the reader opened this section to DO something.
|
|
73
125
|
* Putting the inert half above the actionable half makes them scroll past every chart they cannot
|
|
74
126
|
* have to reach the ones they can.
|
|
127
|
+
*
|
|
128
|
+
* THE TILE BLOCK SITS BETWEEN THE TWO, and its own rows are pickable-first too. A tile refusal is
|
|
129
|
+
* a veto or a waivable one like any other (the reader may still pick the waivable ones), but what
|
|
130
|
+
* it asks of the reader is different: resize, not rebind. Every row the code marks as about the
|
|
131
|
+
* tile goes there whichever way its veto flag points, so none is left under a heading that names
|
|
132
|
+
* the fields.
|
|
75
133
|
*/
|
|
76
134
|
export declare function orderRefusalsForDisplay<T extends QualifyRefusalRow>(rows: readonly T[] | null | undefined): T[];
|
|
77
135
|
/**
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
* numbers. A token that is not one names no row and is skipped; no attribute, no rows.
|
|
4
4
|
*/
|
|
5
5
|
export declare function rowIdxsFromMark(el: Element | null): number[];
|
|
6
|
+
/** The most rows one published set may name: the largest window any host hands a chart. A set past it
|
|
7
|
+
* is cut there rather than refused, because the cap bounds the work an event can ask for and a table
|
|
8
|
+
* never holds a row beyond it. */
|
|
9
|
+
export declare const ROW_SET_MAX = 250000;
|
|
10
|
+
/** The rows a published set names: whole non-negative numbers only, each once, in the order given, at
|
|
11
|
+
* most ROW_SET_MAX. Anything else in the array is dropped, and a value that is not an array names none. */
|
|
12
|
+
export declare function validRowSet(rows: unknown): number[];
|
|
13
|
+
/**
|
|
14
|
+
* Publish a selection as a row set: fires the cross-filter event on `container`, carrying `rows` (valid
|
|
15
|
+
* ones only) and the `source` the host passes on to its subscribers. An empty set is a clear. For a
|
|
16
|
+
* chart that computes its own selection; a chart that selects by marks needs nothing, the host reads
|
|
17
|
+
* data-row-idx itself.
|
|
18
|
+
*/
|
|
19
|
+
export declare function dispatchRowSet(container: Element, rows: readonly number[], source?: string): void;
|
|
6
20
|
/** The keys held during a click. Cmd counts as Ctrl. */
|
|
7
21
|
export interface SelectionModifiers {
|
|
8
22
|
ctrl?: boolean;
|
|
@@ -89,6 +103,43 @@ export declare function nextClickedMarks(prev: ClickedMarks | null | undefined,
|
|
|
89
103
|
* its parent. A click inside a control is neither a selection nor a click on empty canvas.
|
|
90
104
|
*/
|
|
91
105
|
export declare function isInsideControl(target: EventTarget | Node | null | undefined, container: Element): boolean;
|
|
106
|
+
/** Movement between press and release, in px on either axis, at which a gesture is a drag. */
|
|
107
|
+
export declare const DRAG_NOT_CLICK_PX = 5;
|
|
108
|
+
/** A pointer position in client px. */
|
|
109
|
+
export interface PressPoint {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
}
|
|
113
|
+
/** True when the pointer travelled far enough between press and release to be a drag. */
|
|
114
|
+
export declare function gestureWasDrag(down: PressPoint | null | undefined, up: PressPoint, thresholdPx?: number): boolean;
|
|
115
|
+
/** Where the press is parked: on the CONTAINER, so every reader (the host's click handler, a renderer
|
|
116
|
+
* adapter, the visual's bridge) reads the one record. */
|
|
117
|
+
export declare const CONTAINER_SLOT_PRESS_AT = "__lchPressAt";
|
|
118
|
+
/** The recorded press on `container`, or null when there is none. */
|
|
119
|
+
export declare function pressOf(container: Element | null | undefined): PressPoint | null;
|
|
120
|
+
/** Forget the recorded press: the click it led to has been read. */
|
|
121
|
+
export declare function clearPress(container: Element | null | undefined): void;
|
|
122
|
+
/**
|
|
123
|
+
* Record where the pointer goes down on `container`, in the CAPTURE phase so a renderer that stops
|
|
124
|
+
* propagation on its own handlers still leaves its origin, and whether it then travels 5px or more
|
|
125
|
+
* before it comes up. The travel is what makes a drag that ends where it began (a lasso closed on its
|
|
126
|
+
* own start, a brush returned to its origin) still a drag: the click it leaves has moved nowhere.
|
|
127
|
+
* Returns the function that stops all of it.
|
|
128
|
+
*/
|
|
129
|
+
export declare function trackPress(container: HTMLElement): () => void;
|
|
130
|
+
/**
|
|
131
|
+
* True when `click` ended a press whose pointer travelled DRAG_NOT_CLICK_PX or more, on the way or by where
|
|
132
|
+
* the click landed. Reads the press, never writes it.
|
|
133
|
+
*
|
|
134
|
+
* A click a pointer made carries detail >= 1. A keyboard or scripted click carries detail 0 and no
|
|
135
|
+
* pointer position, so it is compared with nothing: the press on record may be one that never produced a
|
|
136
|
+
* click (released outside the chart), and a stale press must not turn a later keyboard click into a drag.
|
|
137
|
+
*/
|
|
138
|
+
export declare function clickWasDrag(container: Element | null | undefined, click: {
|
|
139
|
+
clientX?: number;
|
|
140
|
+
clientY?: number;
|
|
141
|
+
detail?: number;
|
|
142
|
+
} | null | undefined): boolean;
|
|
92
143
|
export interface MarkResolverEnv {
|
|
93
144
|
root: HTMLElement;
|
|
94
145
|
doc: Document;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.84",
|
|
4
4
|
"description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|