@fjader/svelte 0.2.0 → 0.2.2
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/components/charts/ChartCell.svelte +191 -34
- package/dist/components/charts/ChartContainer.svelte +3 -0
- package/dist/components/marks/RectYMark.svelte +0 -1
- package/dist/components/rendering/Areas.svelte +2 -3
- package/dist/components/rendering/Lines.svelte +2 -3
- package/dist/components/rendering/ParallelLines.svelte +2 -1
- package/dist/data/DataAccessor.js +1 -1
- package/dist/gpu/ColorScaleShaderLib.d.ts +1 -1
- package/dist/gpu/ColorScaleShaderLib.js +3 -2
- package/dist/gpu/NanShaderLib.d.ts +30 -0
- package/dist/gpu/NanShaderLib.js +42 -0
- package/dist/gpu/ResolveShader.d.ts +1 -1
- package/dist/gpu/ResolveShader.js +4 -3
- package/dist/gpu/SizeScaleShaderLib.d.ts +1 -1
- package/dist/gpu/SizeScaleShaderLib.js +2 -1
- package/dist/gpu/decimation/M4Shader.d.ts +13 -7
- package/dist/gpu/decimation/M4Shader.js +79 -64
- package/dist/interactors/BrushOverlay.svelte +17 -10
- package/dist/interactors/BrushOverlay.svelte.d.ts +2 -2
- package/dist/interactors/DerivedInterval1D.svelte +28 -17
- package/dist/interactors/Interval1D.svelte +52 -46
- package/dist/interactors/Interval2D.svelte +48 -53
- package/dist/interactors/ParallelBrushes.svelte +52 -52
- package/dist/interactors/brush-utils.d.ts +21 -1
- package/dist/interactors/brush-utils.js +36 -8
- package/dist/query-engine/index.d.ts +13 -3
- package/dist/query-engine/index.js +16 -7
- package/dist/spec/index.js +2 -4
- package/dist/types.d.ts +23 -1
- package/package.json +1 -1
|
@@ -5,24 +5,33 @@
|
|
|
5
5
|
* import { setQueryContext } from './';
|
|
6
6
|
* setQueryContext(wasm.getConnection()); // Promise OK — resolves lazily
|
|
7
7
|
*
|
|
8
|
-
* Usage
|
|
9
|
-
*
|
|
10
|
-
* context.set('
|
|
8
|
+
* Usage outside a component (the spec renderer), passing contexts to mount():
|
|
9
|
+
* const { filterGroups } = createQueryServices(queryEngine);
|
|
10
|
+
* context.set('query-engine', queryEngine);
|
|
11
|
+
* context.set('filter-groups', filterGroups);
|
|
11
12
|
*/
|
|
12
13
|
import { setContext, getContext } from 'svelte';
|
|
13
14
|
import { QueryEngine } from './QueryEngine';
|
|
14
15
|
import { FilterGroupRegistry } from './FilterGroupRegistry.svelte';
|
|
15
16
|
import { tableSchemaService } from '../data/TableSchemaService.svelte';
|
|
17
|
+
/**
|
|
18
|
+
* Create the FilterGroupRegistry for an engine and wire both to the schema
|
|
19
|
+
* service. Brushes and toggles reach the engine only through this wiring:
|
|
20
|
+
* a FilterGroup without an engine updates its selection but never re-queries.
|
|
21
|
+
*/
|
|
22
|
+
export function createQueryServices(queryEngine) {
|
|
23
|
+
const filterGroups = new FilterGroupRegistry();
|
|
24
|
+
filterGroups.setEngine(queryEngine);
|
|
25
|
+
tableSchemaService.setQueryEngine(queryEngine);
|
|
26
|
+
return { queryEngine, filterGroups };
|
|
27
|
+
}
|
|
16
28
|
/**
|
|
17
29
|
* Create QueryEngine + FilterGroupRegistry and set Svelte contexts.
|
|
18
30
|
* Call this synchronously in a component's <script> block.
|
|
19
31
|
* Accepts a Promise<DuckDBConnection> — queries defer until it resolves.
|
|
20
32
|
*/
|
|
21
33
|
export function setQueryContext(connection) {
|
|
22
|
-
const queryEngine = new QueryEngine(connection);
|
|
23
|
-
const filterGroups = new FilterGroupRegistry();
|
|
24
|
-
filterGroups.setEngine(queryEngine);
|
|
25
|
-
tableSchemaService.setQueryEngine(queryEngine);
|
|
34
|
+
const { queryEngine, filterGroups } = createQueryServices(new QueryEngine(connection));
|
|
26
35
|
setContext('query-engine', queryEngine);
|
|
27
36
|
setContext('filter-groups', filterGroups);
|
|
28
37
|
return { queryEngine, filterGroups };
|
package/dist/spec/index.js
CHANGED
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
import { mount, unmount } from 'svelte';
|
|
18
18
|
import { ScaleRegistry } from '../scales/ScaleRegistry.svelte';
|
|
19
19
|
import { GPUCoordinator } from '../gpu/GPUCoordinator.svelte';
|
|
20
|
-
import {
|
|
21
|
-
import { tableSchemaService } from '../data/TableSchemaService.svelte';
|
|
20
|
+
import { createQueryServices } from '../query-engine';
|
|
22
21
|
import { getOrCreateQueryEngine, loadData } from './LazyQueryEngine';
|
|
23
22
|
import LayoutFromSpec from './LayoutFromSpec.svelte';
|
|
24
23
|
/**
|
|
@@ -47,8 +46,7 @@ export async function render(target, spec, options = {}) {
|
|
|
47
46
|
}
|
|
48
47
|
// 4. Build context map — injected into Svelte mount() so child components
|
|
49
48
|
// find these via getContext() calls (same keys as initFjader())
|
|
50
|
-
const filterGroups =
|
|
51
|
-
tableSchemaService.setQueryEngine(queryEngine);
|
|
49
|
+
const { filterGroups } = createQueryServices(queryEngine);
|
|
52
50
|
const context = new Map();
|
|
53
51
|
context.set('query-engine', queryEngine);
|
|
54
52
|
context.set('filter-groups', filterGroups);
|
package/dist/types.d.ts
CHANGED
|
@@ -338,12 +338,34 @@ export interface ChartContext {
|
|
|
338
338
|
readonly fxDomain?: DimValue[] | null;
|
|
339
339
|
readonly config: ChartConfig;
|
|
340
340
|
onChartClick: ((event: PointerEvent) => void) | null;
|
|
341
|
-
|
|
341
|
+
/**
|
|
342
|
+
* A press, offered to the interactor before the chart pans. `target` is the
|
|
343
|
+
* element under the pointer, which a brush reads for the handle it is on
|
|
344
|
+
* (brushHandleAt); `innerPoint` is in plot-area coordinates. Returns true when
|
|
345
|
+
* the interactor takes the press. Called again when the chart re-routes a
|
|
346
|
+
* press under way (reroutePress).
|
|
347
|
+
*/
|
|
348
|
+
onInteractorPointerDown: ((target: Element, pointerId: number, innerPoint: Point) => boolean) | null;
|
|
342
349
|
/** Every pointer move but a pan; `innerPoint` is the pointer in plot-area coordinates (a
|
|
343
350
|
* shared buffer: read it before calling back into the layout). Returns true when the
|
|
344
351
|
* interactor handled the move (a drag it captured). */
|
|
345
352
|
onInteractorPointerMove: ((event: PointerEvent, innerPoint: Point) => boolean) | null;
|
|
346
353
|
onInteractorPointerUp: ((event: PointerEvent) => boolean) | null;
|
|
354
|
+
/**
|
|
355
|
+
* End the interactor's drag where it is, as a pointer up would but without
|
|
356
|
+
* treating a drag that never moved as a click (which clears a brush). The
|
|
357
|
+
* chart calls it when it re-routes the press.
|
|
358
|
+
*/
|
|
359
|
+
onInteractorDragEnd: (() => void) | null;
|
|
360
|
+
/**
|
|
361
|
+
* Route the press under way again, as if it began now where the pointer is:
|
|
362
|
+
* end what it is doing (a pan, or the interactor's drag), then offer it to
|
|
363
|
+
* the interactor and pan if declined, as a new press would be. Brushes call
|
|
364
|
+
* it when Space changes, since one press can outlast that: with three-finger
|
|
365
|
+
* drag on a trackpad it goes on for seconds after the fingers lift. Without a
|
|
366
|
+
* press under way it does nothing.
|
|
367
|
+
*/
|
|
368
|
+
reroutePress: () => void;
|
|
347
369
|
/**
|
|
348
370
|
* Selection sources to activate when the pointer enters the chart, so their
|
|
349
371
|
* preagg tables exist before the first gesture. Interactors add their
|