@kineviz/gl 0.3.0 → 0.4.0
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 +95 -60
- package/dist/index.d.mts +162 -32
- package/dist/index.d.ts +162 -32
- package/dist/index.js +560 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +620 -237
- package/dist/index.mjs.map +1 -1
- package/dist/kineviz-gl.umd.js +2269 -2249
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4169,9 +4169,26 @@ interface KeepSet {
|
|
|
4169
4169
|
interface HoverEmphasisConfig {
|
|
4170
4170
|
duration: number;
|
|
4171
4171
|
dimOpacity: number;
|
|
4172
|
-
|
|
4173
|
-
|
|
4172
|
+
/**
|
|
4173
|
+
* Dim feature: on hover, fade out everything OUTSIDE the kept set (hovered
|
|
4174
|
+
* node + 1-hop neighbors). Independent of {@link glowEnabled}. Default
|
|
4175
|
+
* `false` — dim is opt-in. This is the flag the legacy `setHoverEnabled`
|
|
4176
|
+
* maps to.
|
|
4177
|
+
*/
|
|
4178
|
+
dimEnabled: boolean;
|
|
4179
|
+
/**
|
|
4180
|
+
* Glow/ring feature: on hover, draw a halo ring on the hovered node (edge
|
|
4181
|
+
* tube glow on a hovered edge). Independent of {@link dimEnabled}. Default
|
|
4182
|
+
* `true` — the hover ring shows by default. When dim is also on, the ring
|
|
4183
|
+
* extends to the kept set (neighbors) the same way trace emphasis does.
|
|
4184
|
+
*/
|
|
4174
4185
|
glowEnabled?: boolean;
|
|
4186
|
+
/**
|
|
4187
|
+
* @deprecated Legacy single master switch that coupled dim+glow. Setting it
|
|
4188
|
+
* now maps to {@link dimEnabled} (the glow ring is governed by
|
|
4189
|
+
* {@link glowEnabled}). Kept so old callers / serialized config still parse.
|
|
4190
|
+
*/
|
|
4191
|
+
enabled?: boolean;
|
|
4175
4192
|
/** Edge tubeGlow strength applied to kept edges. Default 1.0. */
|
|
4176
4193
|
glowStrength?: number;
|
|
4177
4194
|
/** Node halo strength applied to kept nodes. Default 1.0. */
|
|
@@ -4224,6 +4241,21 @@ declare class HoverEmphasisController {
|
|
|
4224
4241
|
get state(): HoverEmphasisState;
|
|
4225
4242
|
get progress(): number;
|
|
4226
4243
|
_computeKeepSet(target: HoverTarget$1 | null): KeepSet | null;
|
|
4244
|
+
/**
|
|
4245
|
+
* Glow-only keep set: just the hovered target, no neighbors. Used when
|
|
4246
|
+
* `dimEnabled` is false — the hover ring is drawn on the node/edge under
|
|
4247
|
+
* the cursor and nothing else lights up or dims.
|
|
4248
|
+
*/
|
|
4249
|
+
_singletonKeepSet(target: HoverTarget$1 | null): KeepSet | null;
|
|
4250
|
+
/**
|
|
4251
|
+
* Pick the keep set for a hover target by feature mode. Dim on → the full
|
|
4252
|
+
* 1-hop neighborhood (so neighbors stay bright); dim off (glow-only) → just
|
|
4253
|
+
* the hovered target so the ring is scoped to that node/edge.
|
|
4254
|
+
*/
|
|
4255
|
+
private _keepSetFor;
|
|
4256
|
+
/** True when at least one hover feature (glow ring or dim) is active, i.e.
|
|
4257
|
+
* hover events should be processed. */
|
|
4258
|
+
private _wantsHover;
|
|
4227
4259
|
/**
|
|
4228
4260
|
* Diff writer: drives the GPU-side bit 16 (hoverDim) on nodes/edges.
|
|
4229
4261
|
* - next == null → hover-leave: clear all bits, drop keep-set.
|
|
@@ -4236,8 +4268,19 @@ declare class HoverEmphasisController {
|
|
|
4236
4268
|
*/
|
|
4237
4269
|
_applyKeepSet(prev: KeepSet | null, next: KeepSet | null): void;
|
|
4238
4270
|
setConfig(partial: Partial<HoverEmphasisConfig>): void;
|
|
4271
|
+
/** Enable/disable the dim feature (fade everything outside the kept set).
|
|
4272
|
+
* Independent of the glow ring. */
|
|
4273
|
+
setDimEnabled(enabled: boolean): void;
|
|
4274
|
+
/** @deprecated Legacy master switch. Maps to {@link setDimEnabled} — the
|
|
4275
|
+
* hover ring is governed independently by `glowEnabled`. */
|
|
4239
4276
|
setEnabled(enabled: boolean): void;
|
|
4277
|
+
/** Reconcile the Disabled state with the two feature flags: the controller
|
|
4278
|
+
* is hard-disabled only when NEITHER glow nor dim wants to act. */
|
|
4279
|
+
private _reconcile;
|
|
4280
|
+
/** @deprecated Returns whether the DIM feature is enabled (legacy name). */
|
|
4240
4281
|
isEnabled(): boolean;
|
|
4282
|
+
isDimEnabled(): boolean;
|
|
4283
|
+
isGlowEnabled(): boolean;
|
|
4241
4284
|
getConfig(): HoverEmphasisConfig;
|
|
4242
4285
|
onHoverEnter(target: HoverTarget$1): void;
|
|
4243
4286
|
onHoverMove(target: HoverTarget$1): void;
|
|
@@ -4255,16 +4298,16 @@ declare class HoverEmphasisController {
|
|
|
4255
4298
|
*/
|
|
4256
4299
|
setExternalKeepSet(keepNodes: Iterable<string>, keepEdges: Iterable<string>): void;
|
|
4257
4300
|
/** Cancel the programmatic dim. Per-instance un-dim ramps fire smoothly.
|
|
4258
|
-
* Restores the pre-external `_config.
|
|
4301
|
+
* Restores the pre-external `_config.dimEnabled` so a trace started with
|
|
4259
4302
|
* hover-dim disabled stays off — even if a click happens MID-ramp.
|
|
4260
|
-
* We set `_config.
|
|
4303
|
+
* We set `_config.dimEnabled` synchronously (rather than deferring to
|
|
4261
4304
|
* `_enterIdle`) because `onMouseDown` unregisters the ramp frame
|
|
4262
4305
|
* callback as part of Suppressed-state housekeeping; without an
|
|
4263
4306
|
* immediate flip, click→mouseup leaves the controller in Idle with
|
|
4264
|
-
* `
|
|
4307
|
+
* `dimEnabled === true`, and the next hover re-triggers dim. The state
|
|
4265
4308
|
* machine still cycles through RampingDown→Idle to play the visual
|
|
4266
|
-
* un-dim animation; `onHoverEnter`/`onHoverMove`
|
|
4267
|
-
*
|
|
4309
|
+
* un-dim animation; `onHoverEnter`/`onHoverMove` scope the kept set by
|
|
4310
|
+
* `dimEnabled` so the intermediate states draw the ring without dimming. */
|
|
4268
4311
|
clearExternalKeepSet(): void;
|
|
4269
4312
|
onMouseDown(button: number): void;
|
|
4270
4313
|
onMouseUp(): void;
|
|
@@ -4550,12 +4593,21 @@ declare class InteractionCoordinator {
|
|
|
4550
4593
|
private pickedNodeIdOnDown;
|
|
4551
4594
|
private graphControlWasEnabled;
|
|
4552
4595
|
private dragHandlerWasEnabled;
|
|
4596
|
+
private _bgGestureExternal;
|
|
4553
4597
|
constructor(picker: Picker, dragHandler: DragHandler, graphControl: GraphControl, selectionManager: SelectionManager, hoverHandler: HoverHandler, config?: InteractionCoordinatorConfig);
|
|
4554
4598
|
/**
|
|
4555
4599
|
* Enable/disable globe mode (affects left-drag behavior on background)
|
|
4556
4600
|
*/
|
|
4557
4601
|
setGlobeMode(enabled: boolean): void;
|
|
4558
4602
|
get globeMode(): boolean;
|
|
4603
|
+
/**
|
|
4604
|
+
* When true, an external control (GlobeControl) owns background pan/rotate
|
|
4605
|
+
* gestures, so the coordinator skips enterPanMode/enterRotateMode on
|
|
4606
|
+
* background mousedown. This keeps the DragHandler enabled so node-drag still
|
|
4607
|
+
* works in globe mode (otherwise enterPanMode disables it). Set by GlobeLayer
|
|
4608
|
+
* on mount, cleared on unmount. Node/group drags are unaffected.
|
|
4609
|
+
*/
|
|
4610
|
+
setBackgroundGestureExternal(enabled: boolean): void;
|
|
4559
4611
|
/**
|
|
4560
4612
|
* Set the PathSelectHandler for Shift+drag path selection.
|
|
4561
4613
|
*/
|
|
@@ -4602,6 +4654,15 @@ declare class InteractionCoordinator {
|
|
|
4602
4654
|
private handlePotentialDragMove;
|
|
4603
4655
|
private handleDragNodeMove;
|
|
4604
4656
|
private resetState;
|
|
4657
|
+
/**
|
|
4658
|
+
* True when the event originated on the renderer canvas itself, not on an
|
|
4659
|
+
* overlay element (panel / toolbar / legend) layered inside the container.
|
|
4660
|
+
* Mirrors the `event.target === renderer.domElement` guard used for
|
|
4661
|
+
* mousedown / click / contextmenu in InteractionManager. When the canvas
|
|
4662
|
+
* element is unavailable we fail open (treat as over-canvas) to avoid
|
|
4663
|
+
* silently disabling hover.
|
|
4664
|
+
*/
|
|
4665
|
+
private isEventOverCanvas;
|
|
4605
4666
|
private debug;
|
|
4606
4667
|
/**
|
|
4607
4668
|
* Force reset to idle state (for external control)
|
|
@@ -10538,16 +10599,30 @@ declare class EmphasisApi {
|
|
|
10538
10599
|
*/
|
|
10539
10600
|
stopAll(type?: EmphasisType): void;
|
|
10540
10601
|
/**
|
|
10541
|
-
* Enable or disable the hover-
|
|
10602
|
+
* Enable or disable the hover-DIM feature (fade everything outside the
|
|
10603
|
+
* hovered node's 1-hop neighborhood).
|
|
10604
|
+
*
|
|
10605
|
+
* **Independent of the hover ring.** The ring/halo is governed by
|
|
10606
|
+
* {@link setEmphasisGlowEnabled} (on by default); this switch only controls
|
|
10607
|
+
* the dimming of non-neighbors. Default `false` — dim is opt-in.
|
|
10542
10608
|
*
|
|
10543
|
-
* When enabled
|
|
10544
|
-
*
|
|
10545
|
-
*
|
|
10609
|
+
* When enabled, hovering a node dims all other nodes and edges except the
|
|
10610
|
+
* hovered node, its 1-hop neighbors, and the connecting edges. When
|
|
10611
|
+
* disabled, hovering still shows the ring (if glow is on) but fades nothing.
|
|
10546
10612
|
*
|
|
10547
10613
|
* Not undoable. Not recorded in history.
|
|
10548
10614
|
*
|
|
10549
10615
|
* @param enabled - `true` to enable hover dimming, `false` to disable.
|
|
10550
10616
|
*/
|
|
10617
|
+
setHoverDimEnabled(enabled: boolean): void;
|
|
10618
|
+
/**
|
|
10619
|
+
* @deprecated Legacy name for {@link setHoverDimEnabled} — historically this
|
|
10620
|
+
* was the single master switch that coupled dim and glow. It now controls
|
|
10621
|
+
* only the dim feature (the ring is governed by
|
|
10622
|
+
* {@link setEmphasisGlowEnabled}). Prefer `setHoverDimEnabled`.
|
|
10623
|
+
*
|
|
10624
|
+
* @param enabled - `true` to enable hover dimming, `false` to disable.
|
|
10625
|
+
*/
|
|
10551
10626
|
setHoverEnabled(enabled: boolean): void;
|
|
10552
10627
|
/**
|
|
10553
10628
|
* Set the opacity of dimmed nodes and edges during hover emphasis.
|
|
@@ -10576,13 +10651,18 @@ declare class EmphasisApi {
|
|
|
10576
10651
|
*/
|
|
10577
10652
|
setHoverDuration(ms: number): void;
|
|
10578
10653
|
/**
|
|
10579
|
-
* Enable or disable the
|
|
10580
|
-
*
|
|
10581
|
-
*
|
|
10654
|
+
* Enable or disable the hover RING (node halo + edge tube glow). Default
|
|
10655
|
+
* `true` — the ring shows on hover out of the box.
|
|
10656
|
+
*
|
|
10657
|
+
* **Independent of the dim feature** ({@link setHoverDimEnabled}). In
|
|
10658
|
+
* glow-only mode (dim off) the ring is drawn on the hovered node alone; when
|
|
10659
|
+
* dim is also on, it extends to the kept set (1-hop neighbors), the same way
|
|
10660
|
+
* trace emphasis lights up its whole keep set. Does not affect the dim
|
|
10661
|
+
* opacity controlled by {@link setHoverDimOpacity}.
|
|
10582
10662
|
*
|
|
10583
10663
|
* Not undoable. Not recorded in history.
|
|
10584
10664
|
*
|
|
10585
|
-
* @param enabled - `true` to enable
|
|
10665
|
+
* @param enabled - `true` to enable the ring, `false` to disable.
|
|
10586
10666
|
*/
|
|
10587
10667
|
setEmphasisGlowEnabled(enabled: boolean): void;
|
|
10588
10668
|
/**
|
|
@@ -10606,11 +10686,12 @@ declare class EmphasisApi {
|
|
|
10606
10686
|
*/
|
|
10607
10687
|
setEmphasisHaloStrength(strength: number): void;
|
|
10608
10688
|
/**
|
|
10609
|
-
* Returns whether the hover-
|
|
10689
|
+
* Returns whether the hover-DIM feature is enabled.
|
|
10610
10690
|
*
|
|
10611
10691
|
* @returns `true` if hover dimming will fire on hover-enter; `false`
|
|
10612
|
-
* otherwise
|
|
10613
|
-
*
|
|
10692
|
+
* otherwise (the ring may still show — see {@link setEmphasisGlowEnabled}).
|
|
10693
|
+
* Also returns `false` when no {@link HoverEmphasisController} is wired
|
|
10694
|
+
* (the API was constructed without a controller).
|
|
10614
10695
|
*/
|
|
10615
10696
|
isHoverEnabled(): boolean;
|
|
10616
10697
|
/**
|
|
@@ -12470,6 +12551,13 @@ interface GlobeControlConfig {
|
|
|
12470
12551
|
* pitch and call api.map.setPitch.
|
|
12471
12552
|
*/
|
|
12472
12553
|
onPitchDelta?: (deltaDegrees: number) => void;
|
|
12554
|
+
/**
|
|
12555
|
+
* Optional hit-test invoked on left-button mousedown. Return true to let
|
|
12556
|
+
* another handler (the engine's node DragHandler) own the gesture — GlobeControl
|
|
12557
|
+
* then skips its orbit so nodes can be dragged in globe mode instead of
|
|
12558
|
+
* rotating the globe. Background mousedowns (return false) still rotate.
|
|
12559
|
+
*/
|
|
12560
|
+
shouldSkipDrag?: (e: MouseEvent) => boolean;
|
|
12473
12561
|
}
|
|
12474
12562
|
declare class GlobeControl {
|
|
12475
12563
|
/** Enable/disable all interaction. */
|
|
@@ -12941,6 +13029,9 @@ declare class MapApi {
|
|
|
12941
13029
|
private _autoFitDuration;
|
|
12942
13030
|
private _autoFitDebounceMs;
|
|
12943
13031
|
private _transitioning;
|
|
13032
|
+
private _inLayerSwap;
|
|
13033
|
+
private _layerSwapArmedAt;
|
|
13034
|
+
private static readonly LAYER_SWAP_SUPPRESS_WINDOW_MS;
|
|
12944
13035
|
private _elevation;
|
|
12945
13036
|
private _appliedElevation;
|
|
12946
13037
|
/**
|
|
@@ -13057,6 +13148,21 @@ declare class MapApi {
|
|
|
13057
13148
|
* Phase 1: records state and emits event. Scene wiring is Phase 2/3.
|
|
13058
13149
|
*/
|
|
13059
13150
|
enableMap(options?: EnableMapOptions): Promise<void>;
|
|
13151
|
+
/**
|
|
13152
|
+
* Mark that the NEXT `disableMap()` is part of a 2D↔3D layer swap
|
|
13153
|
+
* (FlatLayer↔GlobeLayer), not a real map-off, so that single call skips its
|
|
13154
|
+
* teardown (and crucially its geo unpin). Call this immediately before
|
|
13155
|
+
* swapping the auto map layer while the map stays active.
|
|
13156
|
+
*
|
|
13157
|
+
* Self-limiting: the flag is consumed by the next `disableMap()`, cleared by
|
|
13158
|
+
* any `enableMap()` (the incoming layer's mount), AND time-boxed — see
|
|
13159
|
+
* `LAYER_SWAP_SUPPRESS_WINDOW_MS`. The time box guarantees a flag that was
|
|
13160
|
+
* armed but never consumed (layer updated in place rather than
|
|
13161
|
+
* unmount→remount) cannot linger to swallow a later genuine "Hide Map".
|
|
13162
|
+
*
|
|
13163
|
+
* @internal — used by GraphContext's auto-map-layer effect.
|
|
13164
|
+
*/
|
|
13165
|
+
beginLayerSwap(): void;
|
|
13060
13166
|
/**
|
|
13061
13167
|
* Disable map mode and restore the scene to its pre-map state.
|
|
13062
13168
|
*
|
|
@@ -13065,6 +13171,20 @@ declare class MapApi {
|
|
|
13065
13171
|
* Emits `"map:disabled"`.
|
|
13066
13172
|
*/
|
|
13067
13173
|
disableMap(): void;
|
|
13174
|
+
/**
|
|
13175
|
+
* Re-enable + reheat the live force layout so released nodes re-flow.
|
|
13176
|
+
*
|
|
13177
|
+
* Show Map's `stopLayout()` left the controller's `_enable=false`, and
|
|
13178
|
+
* `restartLayout()` early-returns while disabled — so we must RE-ENABLE
|
|
13179
|
+
* first. Critically we use `restartLayout()` (reheat the EXISTING sim in
|
|
13180
|
+
* place), NOT `startLayout()`: startLayout does a full dispose+buildSimulation
|
|
13181
|
+
* that re-seeds pin state from the stale `graph.layoutNodes[].pinned` mirror
|
|
13182
|
+
* (which is never set for geo), which would UNPIN geo and break the map
|
|
13183
|
+
* projection. Routed through the provider's layoutController (the WebGPU /
|
|
13184
|
+
* CPU-adapter wiring); falls back to the legacy `_layoutRuntime` sim handle
|
|
13185
|
+
* for the d3 engine.
|
|
13186
|
+
*/
|
|
13187
|
+
private _reheatLayout;
|
|
13068
13188
|
/**
|
|
13069
13189
|
* Whether map mode is currently active.
|
|
13070
13190
|
*/
|
|
@@ -15045,7 +15165,7 @@ interface GraphRendererProps {
|
|
|
15045
15165
|
*/
|
|
15046
15166
|
cameraZ?: number;
|
|
15047
15167
|
/**
|
|
15048
|
-
* Initial cloudScene position [x, y, z]. Default: [0, 0, -
|
|
15168
|
+
* Initial cloudScene position [x, y, z]. Default: [0, 0, -2]. Use for centering on a region.
|
|
15049
15169
|
* @category Controlled state
|
|
15050
15170
|
*/
|
|
15051
15171
|
initialPosition?: [number, number, number];
|
|
@@ -15198,14 +15318,14 @@ interface GraphRendererProps {
|
|
|
15198
15318
|
*/
|
|
15199
15319
|
minimap?: boolean | MinimapConfig;
|
|
15200
15320
|
/**
|
|
15201
|
-
* Toolbar auto-mount configuration. The toolbar is
|
|
15202
|
-
*
|
|
15203
|
-
*
|
|
15204
|
-
*
|
|
15205
|
-
*
|
|
15321
|
+
* Toolbar auto-mount configuration. The toolbar is **hidden by default** —
|
|
15322
|
+
* opt in by setting `true` (auto-mount with the built-in registry) or by
|
|
15323
|
+
* passing a config object to override individual Toolbar props (registry,
|
|
15324
|
+
* locale, messages, theme, controlled state pairs). You may also render your
|
|
15325
|
+
* own `<Toolbar>` as a child instead.
|
|
15206
15326
|
*
|
|
15207
|
-
* - undefined /
|
|
15208
|
-
* -
|
|
15327
|
+
* - undefined / false: do not mount (default)
|
|
15328
|
+
* - true: auto-mount with `createDefaultRegistry()` and internal state
|
|
15209
15329
|
* - object: auto-mount, but use the provided Toolbar props as overrides
|
|
15210
15330
|
*
|
|
15211
15331
|
* @category Subsystem mount toggles
|
|
@@ -15249,11 +15369,15 @@ interface GraphRendererProps {
|
|
|
15249
15369
|
minimapVisible?: boolean;
|
|
15250
15370
|
}) => void;
|
|
15251
15371
|
/**
|
|
15252
|
-
* Hover-
|
|
15253
|
-
*
|
|
15254
|
-
*
|
|
15255
|
-
*
|
|
15256
|
-
*
|
|
15372
|
+
* Hover-DIM: when true, hovering a node or edge fades all OTHER instances
|
|
15373
|
+
* (and their labels) to make the local neighborhood stand out. Default:
|
|
15374
|
+
* `false` — dim is opt-in.
|
|
15375
|
+
*
|
|
15376
|
+
* **Independent of the hover ring.** The ring/halo on the hovered node is
|
|
15377
|
+
* governed separately and is on by default (see the engine's `glowEnabled`,
|
|
15378
|
+
* `api.emphasis.setEmphasisGlowEnabled`). Setting `hoverDim` only toggles the
|
|
15379
|
+
* dimming of non-neighbors. Equivalent to
|
|
15380
|
+
* `api.emphasis.setHoverDimEnabled(value)`.
|
|
15257
15381
|
*
|
|
15258
15382
|
* @category Global visual scalars
|
|
15259
15383
|
*/
|
|
@@ -16085,8 +16209,14 @@ interface NodeInfoPanelProps {
|
|
|
16085
16209
|
manager: NodeInfoManager;
|
|
16086
16210
|
store: GraphStore;
|
|
16087
16211
|
container?: HTMLElement | null;
|
|
16212
|
+
/** Accepted for backward-compat; theme is driven by `data-gxr-theme` tokens. */
|
|
16213
|
+
isDark?: boolean;
|
|
16214
|
+
/** Show the footer "扩展邻居" button. Default false (hidden). */
|
|
16215
|
+
showExpandNeighbors?: boolean;
|
|
16216
|
+
/** Host callback invoked when the "扩展邻居" button is clicked. */
|
|
16217
|
+
onExpandNeighbors?: (nodeId: string) => void;
|
|
16088
16218
|
}
|
|
16089
|
-
declare function NodeInfoPanel({ manager, store, container }: NodeInfoPanelProps): react_jsx_runtime.JSX.Element;
|
|
16219
|
+
declare function NodeInfoPanel({ manager, store, container, showExpandNeighbors, onExpandNeighbors }: NodeInfoPanelProps): react_jsx_runtime.JSX.Element;
|
|
16090
16220
|
|
|
16091
16221
|
interface GlobeLayerProps {
|
|
16092
16222
|
/** Globe radius in scene units. Default: 5 */
|