/** Skip children */ export const VISIT_SKIP: "VISIT_SKIP"; /** Stop further visits */ export const VISIT_STOP: "VISIT_STOP"; /** * @typedef {VISIT_SKIP|VISIT_STOP|void} VisitResult * * @callback VisitorCallback * @param {View} view * @returns {VisitResult} * * @typedef {VisitorCallback & { * postOrder?: function(View):void, * beforeChildren?: function(View):void, * afterChildren?: function(View):void} * } Visitor * * @typedef {object} BroadcastMessage * @prop {import("../genomeSpy.js").BroadcastEventType} type Broadcast type * @prop {any} [payload] Anything */ /** * Internal listener contract for view interactions. * * Listeners receive a single `Interaction` object. They are attached per * event type and may run either in the capture phase or in the bubbling * phase, depending on how the containing view routes the interaction. * * Ordinary pointer events are routed by container views, which may do hit * testing, scrollbar dispatch, zoom policy, or other view-specific work * before or after child propagation. In addition, `mouseenter` and * `mouseleave` are synthesized by `InteractionDispatcher` from changes in the * pointed view path. * * `stopPropagation()` prevents further routing to later views, but it does * not provide DOM-style stop-immediate semantics for sibling listeners on the * same view. * * @callback InteractionListener * @param {import("../utils/interaction.js").default} event */ /** * @typedef {object} ViewOptions * @prop {boolean} [blockEncodingInheritance] * Don't inherit encodings from parent. Default: false. * @prop {"own" | "inherit"} [layoutSizeParams] * Whether the view should introduce local layout-driven width/height params. * Default: "own". */ /** * @template {import("../spec/view.js").ViewSpec} [TSpec=import("../spec/view.js").ViewSpec] */ export default class View { /** * * @param {TSpec} spec * @param {import("../types/viewContext.js").default} context * @param {import("./containerView.js").default} layoutParent Parent that handles rendering of this view * @param {import("./view.js").default} dataParent Parent that provides data, encodings, and is used in scale resolution * @param {string} name * @param {ViewOptions} [options] * */ constructor(spec: TSpec, context: import("../types/viewContext.js").default, layoutParent: import("./containerView.js").default, dataParent: import("./view.js").default, name: string, options?: ViewOptions); /** @type {TSpec} */ spec: TSpec; /** * @type {function(number):number} */ opacityFunction: (arg0: number) => number; /** * Coords of the view for each facet, recorded during the last layout rendering pass. * Most views have only one facet, so the map is usually of size 1. * * @type {Map} */ facetCoords: Map; context: import("../types/viewContext.js").default; layoutParent: import("./containerView.js").default; dataParent: View; resolutions: { /** * Channel-specific scale resolutions * @type {Partial>} */ scale: Partial>; /** * Channel-specific axis resolutions * @type {Partial>} */ axis: Partial>; }; options: { /** * Don't inherit encodings from parent. Default: false. */ blockEncodingInheritance: boolean; /** * Whether the view should introduce local layout-driven width/height params. * Default: "own". */ layoutSizeParams: string; }; /** * @type {import("../data/flowHandle.js").FlowHandle | undefined} */ flowHandle: import("../data/flowHandle.js").FlowHandle | undefined; /** * Whether GridView or equivalent should draw axis and grid lines for this view. * TODO: Use view options for this. * @type {Record} */ needsAxes: Record; /** @type {ViewParamRuntime} */ paramRuntime: ViewParamRuntime; /** * Effective view name. Equals the explicit name (`spec.name`) when provided, * otherwise falls back to an auto-generated default name. */ get name(): string; /** * The explicit name from the spec (`spec.name`), if any. */ get explicitName(): string; /** * The auto-generated default name that was assigned by the parent/factory. * Intended for debugging only. */ get defaultName(): string; getConfig(): import("../spec/config.js").GenomeSpyConfig; getCursorSpec(): string | import("../spec/parameter.js").ExprRef; getCursor(): any; /** * @param {() => void} listener * @param {(disposer: () => void) => void} [registerDisposer] */ watchCursor(listener: () => void, registerDisposer?: (disposer: () => void) => void): void; getConfigScopes(): import("../spec/config.js").GenomeSpyConfig[]; /** * Returns the coords of the view. If view has been faceted, returns the coords * of an arbitrary facet. If all or specific facet coords are needed, use `facetCoords`. * * @returns {import("./layout/rectangle.js").default} */ get coords(): import("./layout/rectangle.js").default; getPadding(): Padding; /** * Returns a padding that indicates how much axes and titles extend over the plot area. * * @returns {Padding} */ getOverhang(): Padding; /** * Returns true if the view has explicit viewport size specified and should be * scrollable. * * @returns {boolean} */ isScrollable(): boolean; /** * Returns the configured size, if present. Otherwise a computed or default * height is returned. * * @returns {FlexDimensions} */ getSize(): FlexDimensions; /** * @returns {FlexDimensions} */ getViewportSize(): FlexDimensions; registerStepSizeInvalidation(): void; isConfiguredVisible(): boolean; isVisibleInSpec(): boolean; /** * Returns the effective visibility of this view, e.g., whether this view * and all its ancestors are visible. * * When doing a depth-first traversal on the view hierarchy, it's best to * use `isConfiguredVisible()` instead of this method. * * @returns {boolean} */ isVisible(): boolean; /** * Returns true if this view or any ancestor is marked as domain inert. * * @returns {boolean} */ isDomainInert(): boolean; /** * @returns {"none" | "pending" | "ready"} */ getDataInitializationState(): "none" | "pending" | "ready"; /** * Internal hook for lazy dataflow initialization. * Use only from flow initialization helpers to avoid inconsistent state. * * @param {"none" | "pending" | "ready"} state */ _setDataInitializationState(state: "none" | "pending" | "ready"): void; isDataInitialized(): boolean; /** * Returns the effective opacity of this view, e.g., view's opacity multiplied * by opacities of its ancestors. * * TODO: This methods makes sense only in Unit and Layer views. * * @returns {number} */ getEffectiveOpacity(): number; getPathString(): string; /** * Returns the ancestor views, starting with this view. */ getLayoutAncestors(): View[]; /** * Returns the ancestor views, starting with this view. */ getDataAncestors(): View[]; /** * Handles a broadcast message that is intended for the whole view hierarchy. * * @param {BroadcastMessage} message */ handleBroadcast(message: BroadcastMessage): void; /** * * @param {string} type * @param {function(BroadcastMessage):void} handler * @returns {() => void} */ _addBroadcastHandler(type: string, handler: (arg0: BroadcastMessage) => void): () => void; /** * Invokes this view's listeners for the current interaction phase. * * This method does not route the event to children or parents. Container * subclasses implement that routing in `propagateInteraction(...)` * and call `handleInteraction(...)` when the current phase reaches * this view. * * @param {import("../utils/interaction.js").default} event * @param {boolean} capturing */ handleInteraction(event: import("../utils/interaction.js").default, capturing: boolean): void; /** * Registers an internal interaction listener. * * Interaction listeners are internal view-hierarchy hooks, not part of * the supported embed API. They receive the refactored `Interaction` * object directly, without the removed legacy `coords` argument. * * @param {string} type * @param {InteractionListener} listener * @param {boolean} [useCapture] */ addInteractionListener(type: string, listener: InteractionListener, useCapture?: boolean): void; /** * Removes a previously registered interaction listener. * * @param {string} type * @param {InteractionListener} listener * @param {boolean} [useCapture] */ removeInteractionListener(type: string, listener: InteractionListener, useCapture?: boolean): void; /** * Visits child views in depth-first order. Visitor's return value * controls the traversal. * * @param {Visitor} visitor * @returns {VisitResult} * */ visit(visitor: Visitor): VisitResult; /** * Get this view and all descendants in depth-first order. */ getDescendants(): View[]; /** * Release resources owned by this view. */ dispose(): void; /** * @param {() => void} disposer */ registerDisposer(disposer: () => void): void; /** * Dispose this view and all descendants in post-order. */ disposeSubtree(): void; /** * Called after all scales in the view hierarchy have been resolved. */ configureViewOpacity(): void; /** * ViewRenderingContext calls this method once for each view during each rendering * pass. The order is depth first, pre order. */ onBeforeRender(): void; hasRendered(): boolean; render(context: import("./renderingContext/viewRenderingContext.js").default, coords: import("./layout/rectangle.js").default, options?: import("../types/rendering.js").RenderingOptions): void; /** * Returns the encodings specified in this view combined with the inherited * encodings. However, this does not contain any defaults or inferred/adjusted/fixed * encodings. Those are available in Mark's encoding property. * * @return {import("../spec/channel.js").Encoding} */ getEncoding(): import("../spec/channel.js").Encoding; /** * @param {View} [whoIsAsking] Passed to the immediate parent. Allows for * selectively breaking the inheritance. * @return {function(object):any} */ getFacetAccessor(whoIsAsking?: View): (arg0: object) => any; /** * Returns the fields that should be used for partitioning the data for facets. * * @param {View} [whoIsAsking] * @returns {string[]} */ getFacetFields(whoIsAsking?: View): string[]; /** * Returns a texture that has a mapping for the sample locations. This is implemented * only in the SampleView of GenomeSpy App. * * Background: * There are to ways to manage how sample facets are drawn in the App: * * 1) Use one draw call for each facet and pass the location data as a uniform. * 2) Draw all facets with one call and pass the facet locations as a texture. * * The former is suitable for large datasets, which can be subsetted for better * performance. The latter one is more performant for cases where each facet * consists of few data items (sample attributes / metadata). * * @return {WebGLTexture} */ getSampleFacetTexture(): WebGLTexture; /** * @param {import("../spec/channel.js").ChannelWithScale} channel */ getScaleResolution(channel: import("../spec/channel.js").ChannelWithScale): import("../scales/scaleResolution.js").default; /** * @param {import("../spec/channel.js").PositionalChannel} channel */ getAxisResolution(channel: import("../spec/channel.js").PositionalChannel): import("../scales/axisResolution.js").default; /** * @param {import("../spec/channel.js").Channel | "default"} channel * @param {import("../spec/view.js").ResolutionTarget} resolutionType * @returns {import("../spec/view.js").ResolutionBehavior} */ getConfiguredResolution(channel: import("../spec/channel.js").Channel | "default", resolutionType: import("../spec/view.js").ResolutionTarget): import("../spec/view.js").ResolutionBehavior; /** * @param {import("../spec/channel.js").Channel} channel * @param {import("../spec/view.js").ResolutionTarget} resolutionType * @returns {import("../spec/view.js").ResolutionBehavior} */ getConfiguredOrDefaultResolution(channel: import("../spec/channel.js").Channel, resolutionType: import("../spec/view.js").ResolutionTarget): import("../spec/view.js").ResolutionBehavior; /** * @param {import("../spec/channel.js").Channel} channel * @param {import("../spec/view.js").ResolutionTarget} resolutionType * @returns {import("../spec/view.js").ResolutionBehavior} */ getDefaultResolution(channel: import("../spec/channel.js").Channel, resolutionType: import("../spec/view.js").ResolutionTarget): import("../spec/view.js").ResolutionBehavior; /** * @returns {string} */ getBaseUrl(): string; /** * Returns `true` if this view and its children supports picking. */ isPickingSupported(): boolean; getTitleText(): any; /** * @param {any} key string * @param {function(key?):T} callable A function that produces a value to be cached * @returns {T} * @template T * @protected */ protected _cache(key: any, callable: (arg0: any | null) => T): T; /** * * @param {string} key * @param {"self" | "progeny" | "ancestors"} [direction] */ _invalidateCacheByPrefix(key: string, direction?: "self" | "progeny" | "ancestors"): void; invalidateSizeCache(): void; /** * Broadcasts a message to views that include the given (x, y) point. * This is mainly intended for mouse events. * * @param {import("../utils/interaction.js").default} event */ propagateInteraction(event: import("../utils/interaction.js").default): void; #private; } export function isStepSize(size: any): size is import("../spec/view.js").Step; export type VisitResult = "VISIT_SKIP" | "VISIT_STOP" | void; export type VisitorCallback = (view: View) => VisitResult; export type Visitor = VisitorCallback & { postOrder?: (arg0: View) => void; beforeChildren?: (arg0: View) => void; afterChildren?: (arg0: View) => void; }; export type BroadcastMessage = { /** * Broadcast type */ type: import("../genomeSpy.js").BroadcastEventType; /** * Anything */ payload?: any; }; /** * Internal listener contract for view interactions. * * Listeners receive a single `Interaction` object. They are attached per * event type and may run either in the capture phase or in the bubbling * phase, depending on how the containing view routes the interaction. * * Ordinary pointer events are routed by container views, which may do hit * testing, scrollbar dispatch, zoom policy, or other view-specific work * before or after child propagation. In addition, `mouseenter` and * `mouseleave` are synthesized by `InteractionDispatcher` from changes in the * pointed view path. * * `stopPropagation()` prevents further routing to later views, but it does * not provide DOM-style stop-immediate semantics for sibling listeners on the * same view. */ export type InteractionListener = (event: import("../utils/interaction.js").default) => any; export type ViewOptions = { /** * Don't inherit encodings from parent. Default: false. */ blockEncodingInheritance?: boolean; /** * Whether the view should introduce local layout-driven width/height params. * Default: "own". */ layoutSizeParams?: "own" | "inherit"; }; import ViewParamRuntime from "../paramRuntime/viewParamRuntime.js"; import Padding from "./layout/padding.js"; import { FlexDimensions } from "./layout/flexLayout.js"; //# sourceMappingURL=view.d.ts.map