@bicharts/chart-host 0.6.83 → 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.
@@ -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.83",
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",