import { n as __export, r as __reExport } from "./chunk-Aot3_GBM.js"; import * as base from "@atlas-viewer/dna"; import { Strand } from "@atlas-viewer/dna"; import { ImageService } from "@iiif/presentation-3"; //#region src/modules/maps/types.d.ts type MapBounds = { west: number; south: number; east: number; north: number; }; type LngLatPoint = { lng: number; lat: number; }; type WorldPoint = { x: number; y: number; }; type WorldRect = { x: number; y: number; width: number; height: number; }; type MapProjection = { lngLatToWorld: (lng: number, lat: number) => WorldPoint; worldToLngLat: (x: number, y: number) => LngLatPoint; lngLatBoundsToWorldRect: (bounds: MapBounds) => WorldRect; worldRectToLngLatBounds: (rect: WorldRect) => MapBounds; projectRing: (ring: Array<[number, number]>) => Array<[number, number]>; }; type MapTileUrlContext = { z: number; x: number; y: number; s?: string; subdomains?: string[]; tileSize?: number; /** Used to resolve the `{r}` token (`@2x` when true, empty otherwise). */ retina?: boolean; }; type MapTileSource = string | ((ctx: MapTileUrlContext) => string); type GeoJSONPoint = { type: 'Point'; coordinates: [number, number]; }; type GeoJSONMultiPoint = { type: 'MultiPoint'; coordinates: Array<[number, number]>; }; type GeoJSONLineString = { type: 'LineString'; coordinates: Array<[number, number]>; }; type GeoJSONMultiLineString = { type: 'MultiLineString'; coordinates: Array>; }; type GeoJSONPolygon = { type: 'Polygon'; coordinates: Array>; }; type GeoJSONMultiPolygon = { type: 'MultiPolygon'; coordinates: Array>>; }; type GeoJSONGeometryCollection = { type: 'GeometryCollection'; geometries: MapGeoJSONGeometry[]; }; type MapGeoJSONGeometry = GeoJSONPoint | GeoJSONMultiPoint | GeoJSONLineString | GeoJSONMultiLineString | GeoJSONPolygon | GeoJSONMultiPolygon | GeoJSONGeometryCollection; type MapGeoJSONFeature | null> = { type: 'Feature'; id?: string | number; geometry: TGeometry; properties?: TProperties; }; type MapGeoJSONFeatureCollection | null> = { type: 'FeatureCollection'; features: Array>; }; type MapGeoJSONInput = MapGeoJSONGeometry | MapGeoJSONFeature | MapGeoJSONFeatureCollection; //#endregion //#region src/modules/maps/warped/types.d.ts type WarpControlPoint = { /** Position on the (full resolution) image, in pixels. */ image: { x: number; y: number; }; /** Position on the map. */ map: { lng: number; lat: number; }; }; /** * - `straight`: translation + uniform scale (2+ points) * - `helmert`: translation + rotation + uniform scale (2+ points) * - `affine` / `polynomial1`: affine (3+ points) * - `polynomial2` / `polynomial3`: higher order polynomials (6+ / 10+ points) * - `projective`: perspective (4+ points) * - `thinPlateSpline`: exact through all points, smooth in between (3+ points) */ type WarpTransformationType = 'straight' | 'helmert' | 'affine' | 'polynomial1' | 'polynomial2' | 'polynomial3' | 'projective' | 'thinPlateSpline'; type WarpUpdateReason = 'gcps' | 'transformation' | 'manual'; type WarpAdapterHooks = { onControlPointsChange?: (controlPoints: WarpControlPoint[]) => void; onTransformationTypeChange?: (type: WarpTransformationType) => void; onUpdate?: (reason: WarpUpdateReason) => void; }; /** Bridge to an external warping implementation (e.g. an Allmaps layer). */ type WarpAdapter = { setMapGcps(controlPoints: WarpControlPoint[]): void; setMapTransformationType(type: WarpTransformationType): void; update(reason?: WarpUpdateReason): void; }; /** Maps image pixel coordinates to lng/lat. */ type WarpTransformer = { type: WarpTransformationType | 'custom'; toGeo(x: number, y: number): [number, number]; toResource?(lng: number, lat: number): [number, number]; }; //#endregion //#region src/modules/maps/warped/mesh.d.ts /** One source tile of a warped image. Coordinates are pixels of the full resolution image. */ type WarpSourceTile = { x1: number; y1: number; x2: number; y2: number; /** Decoded pixel size of this tile's image (defaults to the tile size in image pixels). */ pixelWidth?: number; pixelHeight?: number; }; type WarpMeshTile = { /** Optional clip in destination coordinates, relative to bounds (used by map overlays). */ destinationMask?: Float32Array; /** Clipping polygon in this tile's decoded pixel coordinates, before warping. */ resourceMask?: Float32Array; /** Triangle vertices in tile image pixels: u0, v0, u1, v1, ... */ src: Float32Array; /** The same vertices in map-frame units, relative to `bounds.x1 / y1`. */ dst: Float32Array; indices: Uint32Array; /** Where this tile lands in the map frame. */ bounds: { x1: number; y1: number; x2: number; y2: number; }; /** * When the tile maps affinely (u, v) => (a u + c v + e, b u + d v + f), relative to `bounds`, a * single transformed draw can be used instead of triangles. */ affine?: [number, number, number, number, number, number]; /** Square root of (mapped area / source pixel area). Used to estimate the display scale. */ unitsPerPixel: number; }; type WarpMeshOptions = { /** Single polygon in full-resolution image pixels; an omitted mask renders the full image. */ resourceMask?: ReadonlyArray; tiles: WarpSourceTile[]; /** Full resolution image size (the size the control points refer to). */ imageWidth: number; imageHeight: number; transformer: WarpTransformer; /** Image pixels (lng/lat -> map frame) projection of the owning MapObject. */ lngLatToWorld: (lng: number, lat: number) => { x: number; y: number; }; type?: WarpTransformationType | 'custom'; /** * Target number of mesh cells along the longest side of the image. Smooth, non-affine * transformations need more. Defaults to 1 for affine types, 12 for projective and 24 otherwise. */ resolution?: number; maxCellsPerTile?: number; }; declare function validateResourceMask(mask: WarpMeshOptions['resourceMask']): void; declare function defaultWarpResolution(type: WarpTransformationType | 'custom' | undefined): number; /** * Builds a textured triangle mesh for every tile, mapping image pixels to the map frame through the * transformer. Triangles with non-finite vertices (e.g. past the horizon of a projective map) are * dropped. */ declare function buildWarpMesh(options: WarpMeshOptions): WarpMeshTile[]; /** Area-weighted world units per full-resolution image pixel, over all tiles. */ declare function meshUnitsPerImagePixel(mesh: WarpMeshTile[], tiles: WarpSourceTile[]): number; //#endregion //#region src/modules/maps/warped/adapter.d.ts type WarpControllerState = { controlPoints: WarpControlPoint[]; transformationType: WarpTransformationType; }; /** * Owns the control points and transformation type for a warped image, and builds the * transformer from them. * * It can also forward every change to an external {@link WarpAdapter}, so the same state can drive * e.g. an Allmaps layer alongside Atlas. */ declare class WarpAdapterController { private readonly adapter?; private readonly hooks; private controlPoints; private transformationType; private transformer; private transformerError; private transformerDirty; private readonly listeners; constructor(adapter?: WarpAdapter | undefined, hooks?: WarpAdapterHooks); getState(): WarpControllerState; /** * The current transformer, or `null` if the control points / type can not produce one yet * (see {@link getError}). */ getTransformer(): WarpTransformer | null; getError(): Error | null; /** Subscribe to changes. Returns an unsubscribe function. */ subscribe(listener: (reason: WarpUpdateReason) => void): () => void; setControlPoints(controlPoints: WarpControlPoint[]): void; setTransformationType(type: WarpTransformationType): void; update(reason?: WarpUpdateReason): void; } declare function createWarpAdapterController(adapter?: WarpAdapter, hooks?: WarpAdapterHooks): WarpAdapterController; declare namespace precise_dna_d_exports { export { DnaFactory$1 as DnaFactory, compose, dna$1 as dna, getIntersection, scale$1 as scale, scaleAtOrigin, transform$1 as transform, translate$1 as translate }; } import * as import___atlas_viewer_dna from "@atlas-viewer/dna"; declare function dna$1(values: number | ArrayLike): Strand; declare class DnaFactory$1 extends base.DnaFactory { static singleBox(width: number, height: number, x?: number, y?: number): Strand; static projection(box: { width: number; height: number; x?: number; y?: number; }): Strand; static positionPair(box: { x1: number; y1: number; x2: number; y2: number; }): Strand; static point(x: number, y: number): Strand; } declare const translate$1: (x: number, y: number) => Strand; declare const scale$1: (factor: number) => Strand; declare const compose: (a: Strand, b: Strand, buffer?: Strand) => Strand; declare const scaleAtOrigin: (factor: number, x: number, y: number) => Strand; declare const transform$1: (points: Strand, operation: Strand, buffer?: Strand) => Strand; declare const getIntersection: (a: Strand, b: Strand, buffer?: Strand) => Strand; //#endregion //#region src/aom.d.ts interface AtlasObjectModel { applyProps(props: Props): void; appendChild(item: SupportedChildElements): void; removeChild(item: SupportedChildElements): void; insertBefore(item: SupportedChildElements, before: SupportedChildElements): void; hideInstance(): void; } //#endregion //#region src/modules/react-reconciler/devtools/types.d.ts type RuntimeDebugEvent = RuntimeFrameStartEvent | RuntimePaintEvent | RuntimeFrameEndEvent; type RuntimeFrameStartEvent = { type: 'frame-start'; at: number; runtimeId: string; frame: number; delta: number; mode: string; pendingUpdate: boolean; rendererPendingUpdate: boolean; target: [number, number, number, number]; }; type RuntimePaintEvent = { type: 'paint'; at: number; runtimeId: string; frame: number; layerIndex: number; tileIndex: number; x: number; y: number; width: number; height: number; paintId: string; paintType: string; ownerId?: string; compositeId?: string; imageUrl?: string; }; type RuntimeFrameEndEvent = { type: 'frame-end'; at: number; runtimeId: string; frame: number; delta: number; scaleFactor: number; paintCount: number; ready: boolean; pendingUpdate: boolean; worldWidth: number; worldHeight: number; target: [number, number, number, number]; }; type WorldDebugEvent = WorldTriggerDebugEvent | WorldPointerDebugEvent | WorldTouchDebugEvent; type WorldTriggerDebugEvent = { type: 'trigger'; at: number; event: string; data?: unknown; }; type WorldPointerDebugEvent = { type: 'pointer'; at: number; event: string; x: number; y: number; targets: number; }; type WorldTouchDebugEvent = { type: 'touch'; at: number; event: string; touches: number; }; type DevToolsTab = 'Overview' | 'World' | 'Inspector' | 'Events' | 'Images' | 'Actions'; //#endregion //#region src/modules/shared/ready-events.d.ts type AtlasReadyResetReason = 'initial' | 'manual' | 'ready-reset-key-change' | 'resource-transition-key-change' | 'runtime-reset'; type AtlasReadyRenderer = 'canvas' | 'webgl' | 'static' | 'composite' | 'unknown'; type AtlasReadyEvent = { runtimeId: string; cycle: number; reason: AtlasReadyResetReason; renderer: AtlasReadyRenderer; timestamp: number; }; //#endregion //#region src/utility/easing-functions.d.ts type EasingFunction = (progress: number) => number; declare const bounceOut: EasingFunction; type EasingFunctionNames = 'linear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeInQuart' | 'easeOutQuart' | 'easeInOutQuart' | 'easeInQuint' | 'easeOutQuint' | 'easeInOutQuint' | 'easeInSine' | 'easeOutSine' | 'easeInOutSine' | 'easeInExpo' | 'easeOutExpo' | 'easeInOutExpo' | 'easeInCirc' | 'easeOutCirc' | 'easeInOutCirc' | 'easeInBack' | 'easeOutBack' | 'easeInOutBack' | 'easeInElastic' | 'easeOutElastic' | 'easeInOutElastic' | 'easeInBounce' | 'easeOutBounce' | 'easeInOutBounce'; declare const easingFunctions: { [key in EasingFunctionNames]: EasingFunction }; //#endregion //#region src/modules/transition-manager/transition-manager.d.ts type PendingTransition = { from: precise_dna_d_exports.Strand; to: precise_dna_d_exports.Strand; elapsed_time: number; total_time: number; timingFunction: EasingFunction; done: boolean; constrain: boolean; callback?: () => void; rotation?: { from: number; to: number; origin: Position; }; }; declare class TransitionManager { runtime: Runtime; readonly pendingTransition: PendingTransition; constructor(runtime: Runtime); hasPending(): boolean; getPendingTransition(): PendingTransition; getPendingFrom(): precise_dna_d_exports.Strand; customTransition(func: (transition: PendingTransition) => void): void; stopTransition(): void; runTransition(target: precise_dna_d_exports.Strand, delta: number): void; /** Animate camera rotation along the shortest arc, then settle zoom/pan constraints. */ rotateTo(degrees: number, { origin, panPadding, transition }?: { origin?: Position; panPadding?: number; transition?: { duration?: number; easing?: EasingFunction; }; }): void; lastZoomTo: { factor: number; options: any; } | null; resumeTransition(): void; zoomTo(factor: number, options?: { origin?: Position; stream?: boolean; minZoomFactor?: number; transition?: { duration?: number; easing?: EasingFunction; }; }): void; isConstraining: boolean; constrainBounds({ transition, panPadding }?: { panPadding?: number; transition?: { duration?: number; easing?: EasingFunction; }; }): void; constrainTarget(target: precise_dna_d_exports.Strand, { origin, transition, panPadding }?: { origin?: Position; panPadding?: number; transition?: { duration?: number; easing?: EasingFunction; }; }): void; applyTransition(target: precise_dna_d_exports.Strand, transition?: { duration?: number; easing?: EasingFunction; constrain?: boolean; }, defaults?: { duration: number; easing: EasingFunction; constrain?: boolean; callback?: () => void; }, { stream }?: { stream?: boolean; }): void; lastGoToRegion: null | { target: any; options: any; }; goToRegion(target: { x: number; y: number; width: number; height: number; padding?: number; }, { transition }?: { transition?: { duration?: number; easing?: EasingFunction; }; }): void; } //#endregion //#region src/events.d.ts declare const supportedEventAttributes: readonly ["onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onPointerDown", "onPointerMove", "onPointerUp", "onPointerCancel", "onPointerEnter", "onPointerLeave", "onPointerOver", "onPointerOut", "onScroll", "onWheel", "onClick", "onDragStart", "onDragEnd", "onDragEnter", "onDragExit", "onDrag", "onDragOver", "onContextMenu"]; declare function createDefaultEventMap(): SupportedEventMap; declare const supportedEventMap: { mousedown: keyof SupportedEvents; mouseenter: keyof SupportedEvents; mouseleave: keyof SupportedEvents; mousemove: keyof SupportedEvents; mouseout: keyof SupportedEvents; mouseover: keyof SupportedEvents; mouseup: keyof SupportedEvents; touchcancel: keyof SupportedEvents; touchend: keyof SupportedEvents; touchmove: keyof SupportedEvents; touchstart: keyof SupportedEvents; pointerdown: keyof SupportedEvents; pointermove: keyof SupportedEvents; pointerup: keyof SupportedEvents; pointercancel: keyof SupportedEvents; pointerenter: keyof SupportedEvents; pointerleave: keyof SupportedEvents; pointerover: keyof SupportedEvents; pointerout: keyof SupportedEvents; scroll: keyof SupportedEvents; wheel: keyof SupportedEvents; click: keyof SupportedEvents; dragstart: keyof SupportedEvents; dragend: keyof SupportedEvents; dragenter: keyof SupportedEvents; dragexit: keyof SupportedEvents; drag: keyof SupportedEvents; dragover: keyof SupportedEvents; contextmenu: keyof SupportedEvents; }; type SupportedEvents = { onMouseDown(e: any): void; onMouseEnter(e: any): void; onMouseLeave(e: any): void; onMouseMove(e: any): void; onMouseOut(e: any): void; onMouseOver(e: any): void; onMouseUp(e: any): void; onTouchCancel(e: any): void; onTouchEnd(e: any): void; onTouchMove(e: any): void; onTouchStart(e: any): void; onPointerDown(e: any): void; onPointerMove(e: any): void; onPointerUp(e: any): void; onPointerCancel(e: any): void; onPointerEnter(e: any): void; onPointerLeave(e: any): void; onPointerOver(e: any): void; onPointerOut(e: any): void; onScroll(e: any): void; onWheel(e: any): void; onClick(e: any): void; onDragStart(e: any): void; onDragEnd(e: any): void; onDragEnter(e: any): void; onDragExit(e: any): void; onDrag(e: any): void; onDragOver(e: any): void; onContextMenu(e: any): void; }; type SupportedEventNames = 'mousedown' | 'mouseenter' | 'mouseleave' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'touchcancel' | 'touchend' | 'touchmove' | 'touchstart' | 'pointerdown' | 'pointermove' | 'pointerup' | 'pointercancel' | 'pointerenter' | 'pointerleave' | 'pointerover' | 'pointerout' | 'scroll' | 'wheel' | 'click' | 'dragstart' | 'dragend' | 'dragenter' | 'dragexit' | 'drag' | 'dragover' | 'contextmenu'; type SupportedEventMap = { [Name in keyof SupportedEvents]: Array }; //#endregion //#region src/world-objects/abstract-object.d.ts interface AbstractObject { id: string; height: number; width: number; layers: Paintable[]; } //#endregion //#region src/world-objects/render-pipeline.d.ts interface RenderPipeline { getAllPointsAt(target: Strand, aggregate: Strand, scale: number): Paint[]; transform(op: Strand): void; } //#endregion //#region src/world-objects/abstract-world-object.d.ts /** * @deprecated */ interface AbstractWorldObject extends AbstractObject, RenderPipeline { x: number; y: number; scale: number; time: WorldTime[]; points: Strand; worldPoints: Strand; atScale(factor: number): void; translate(x: number, y: number): void; getScheduledUpdates(target: Strand, scaleFactor: number): Array<() => Promise>; } //#endregion //#region src/world-objects/world-object.d.ts /** * Borrowing logic for rotating a point around the center axis: https://danceswithcode.net/engineeringnotes/rotations_in_2d/rotations_in_2d.html * @param x * @param y * @param cx * @param cy * @param angleDegree * @returns */ declare function rotatePoint(x: number, //X coords to rotate - replaced on return y: number, //Y coords to rotate - replaced on return cx: number, //X coordinate of center of rotation cy: number, //Y coordinate of center of rotation angleDegree: number): number[]; type WorldObjectProps = { id: string; width: number; height: number; scale?: number; x?: number; y?: number; rotation?: number; }; type TileSelectionDebugEvent = { ownerId: string; rotation: number; /** The target actually used by getAllPointsAt to select content -- see its comment for why this is intentionally unrotated. */ rawTarget: precise_dna_d_exports.Strand; /** * applyRotation(rawTarget) -- the same rotation-aware bounding target * already used (and tested) for culling in getObjectsAt. NOT necessarily * the "correct" target for content/tile selection (that's an open * question -- see world-object-rotated-tile-selection.test.ts), just the * one candidate reference already trusted elsewhere in this file. */ rotationAwareTarget: precise_dna_d_exports.Strand; /** This object's own (unrotated) bounds in world space. */ objectPoints: precise_dna_d_exports.Strand; }; type HitTestCullingDebugEvent = { ownerId: string; rotation: number; /** The raw click/touch point (or hit-test box) in un-rotated world space, before applyRotation. */ rawTarget: precise_dna_d_exports.Strand; /** applyRotation(rawTarget) -- rawTarget mapped into this object's own local space, which is what getObjectsAt actually intersects against selectionBounds(). */ rotatedTarget: precise_dna_d_exports.Strand; /** This object's own bounds, widened to cover an offset descendant -- see WorldObject#selectionBounds. Equal to this.points when nothing below this node has been offset. */ objectPoints: precise_dna_d_exports.Strand; /** Whether rotatedTarget missed selectionBounds() entirely, i.e. the click did not land on this object. */ culled: boolean; }; declare class WorldObject extends BaseObject { id: string; type: string; scale: number; layers: Paintable[]; /** * Optional debug hook, set by tests/tooling, fired from getAllPointsAt() * whenever a rotated object selects content. Exists to make a real, * reported bug detectable: content/tile selection intentionally ignores * rotation entirely (see getAllPointsAt's own comment), which is correct * for *whether* the object is visible at all, but once zoomed in close to * an edge of a rotated object, the selected sub-region silently stops * matching what's actually on screen -- the renderer then falls back to a * lower-resolution layer for that patch, seen as blur. This hook doesn't * decide what's "correct" itself (that's the real fix, and depends on the * rotation pivot sweep); it just exposes the raw inputs so a test can * check them independently. No-op unless a test/tool sets it. */ static debugTileSelection: ((event: TileSelectionDebugEvent) => void) | undefined; /** Reports object-local hit testing for tests and debug tooling. */ static debugHitTestCulling: ((event: HitTestCullingDebugEvent) => void) | undefined; /** * This position in the world local to the scale of the object. * So a 1000x1000 drawn at 0.1 scale at x=5, y=10 on the world would have world points 50,100,1000,1000 * * To get it's world-relative position you need to multiple the scale out. */ points: precise_dna_d_exports.Strand; /** * These are relative to where to object is in the world at the scale of the world. * So a 1000x1000 drawn at 0.1 scale at x=5, y=10 on the world would have world points 0,0,100,100 */ worldPoints: precise_dna_d_exports.Strand; intersectionBuffer: precise_dna_d_exports.Strand; selectionBoundsBuffer: precise_dna_d_exports.Strand; unionTargetBuffer: precise_dna_d_exports.Strand; hitTargetBuffer: precise_dna_d_exports.Strand; aggregateBuffer: precise_dna_d_exports.Strand; invertedBuffer: precise_dna_d_exports.Strand; rotation: number; filteredPointsBuffer: precise_dna_d_exports.Strand; _updatedList: any[]; geometry?: any; private boxSelection?; private selectionLayers?; private selectionLayerCount; /** Eagerly invalidate a child's layout/paint-footprint cache. Mutable point edits are also detected at query time. */ invalidateLayerSelection(): void; private getBoxSelection; constructor(props?: AbstractObject, position?: { x: number; y: number; }); static createWithProps(props: WorldObjectProps): WorldObject; applyProps(props: WorldObjectProps): void; appendChild(item: Paintable): void; removeChild(item: Paintable): void; insertBefore(item: Paintable, before: Paintable): void; hideInstance(): void; getObjectsAt(target: precise_dna_d_exports.Strand, all?: boolean): Paintable[]; /** * The rotation angle getAllPointsAt's selection widening should use -- * ordinarily this.rotation, but falls back to a descendant's rotation * when this node itself isn't rotated. * * Render-time rotation is applied by whichever WorldObject is the * *nearest* owner of the paint (see CanvasRenderer#applyTransform), which * is not necessarily this node -- e.g. ImageService renders its rotation * onto its own nested wrapper (see TileSet.tsx), which can itself sit * *two* plain, unrotated levels below where a story * places it (confirmed live: a bare wrapper around an ImageService, whose * own wrapper is what actually carries the rotation). Each unrotated * level's own this.rotation is 0, so without this fallback its * getAllPointsAt skips rotation-aware widening entirely (applyRotation is * a no-op when rotation is falsy) and hands its child an * already-narrowed, zero-rotation-aware target -- no amount of a * *descendant's* own correct widening can recover content already * clipped away higher up by an ancestor's getIntersection. Recursing into * this same method on each child (rather than reading child.rotation * directly) is what lets this see through any number of intermediate * unrotated wrappers to the rotation that's actually being rendered, * however many levels down it lives -- confirmed as the real depth * needed here, not merely one level, against the actual failing case * (see world-object-nested-rotation-selection.test.ts). * * Deliberately not folded into applyRotation() itself: that method also * backs getObjectsAt's hit-testing, which already has its own carefully * verified (and differently-shaped) rotation handling -- see * world-object-hit-test-rotation-culling.test.ts. This only widens * *selection*, leaving hit-testing untouched. * * Not private: World#getObjectsAt calls this too, on every top-level * object, for the exact same reason one level up -- see its own comment. */ selectionRotation(): number; /** Includes descendant world-object bounds, mapped through each ancestor's position and scale. */ selectionBounds(): precise_dna_d_exports.Strand; /** * getAllPointsAt needs both selectionRotation() and selectionBounds() * every call, and each independently walks this node's *entire* child * subtree -- calling both back-to-back (as getAllPointsAt used to) means * two full traversals per node per frame, on top of each child's own * getAllPointsAt call independently redoing the same two traversals one * level down. This computes both in a single walk instead, halving that * specific redundancy. * * Purely an internal optimization: selectionRotation() and * selectionBounds() above keep their own existing behavior and signature * unchanged (so a caller that only wants one of the two, like * World#forceIncludeRotatedObjects wanting only rotation, isn't made to * pay for the other), and this method's own per-layer conditions * (typeof layer.selectionRotationAndBounds/rotation, typeof * layer.selectionBounds) mirror theirs exactly, so results match call * for call. Not exposed beyond getAllPointsAt: two independent recursive * implementations of the same walk is exactly the kind of thing that * silently drifts (see this file's own rotate()/rotatePoint() history), * so there is deliberately only one -- selectionRotation() and * selectionBounds() stay as the source of truth for anything outside * this hot path. */ private selectionRotationAndBounds; applyRotation(target: precise_dna_d_exports.Strand, rotationOverride?: number): precise_dna_d_exports.Strand; getAllPointsAt(target: precise_dna_d_exports.Strand, aggregate: precise_dna_d_exports.Strand, scaleFactor: number, options?: PaintSelectionOptions): Paint[]; addLayers(paintables: Paintable[]): void; getScheduledUpdates(target: precise_dna_d_exports.Strand, scaleFactor: number): Array<() => void | Promise>; } //#endregion //#region src/world-objects/image.d.ts declare function fromImage(image: { src: string; height: number; width: number; target?: { width: number; height: number; }; }): WorldObject; //#endregion //#region src/world-objects/zone.d.ts interface ZoneInterface { id: string; config: ZoneResolvedConfig; objects: WorldObject[]; points: Strand; recalculateBounds(): void; getPointsAt(target: Strand, aggregate: Strand, scaleFactor: number): Paint[]; } type ZoneConfig = { margin?: number; x?: number; y?: number; width?: number; height?: number; }; type ZoneResolvedConfig = { margin: number; x?: number; y?: number; width?: number; height?: number; }; declare class Zone implements ZoneInterface { id: string; config: ZoneResolvedConfig; points: Strand; objects: WorldObject[]; constructor(objects: [WorldObject, ...WorldObject[]], config?: ZoneConfig); constructor(config: ZoneConfig & { id: string; objects?: WorldObject[]; }); applyProps(config: ZoneConfig & { id?: string; }): void; addObject(object: WorldObject): void; removeObject(object: WorldObject): void; recalculateBounds(): void; getPointsAt(target: Strand, aggregate: Strand, scaleFactor: number): Paint[]; } //#endregion //#region src/spacial-content/spacial-content.d.ts interface SpacialContent { readonly id: string; readonly type: 'spacial-content'; readonly display: DisplayData; __id?: string; __parent?: CompositeResource; __owner: { value: WorldObject | undefined; }; __host?: any; priority?: boolean; dispose?(): void; points: Strand; crop?: Strand; cropData?: { x: number; y: number; width: number; height: number; }; style?: { opacity: number; }; getScheduledUpdates(target: Strand, scaleFactor: number): Array<() => void | Promise>; getAllPointsAt(target: Strand, aggregate?: Strand, scale?: number): Paint[]; transform(op: Strand): void; loadFullResource?(): Promise; dispatchEvent(event: string, e: any): void; getImageUrl?: (index: number) => string; getTexture?: UpdateTextureFunction; } //#endregion //#region src/spacial-content/image-texture.d.ts type UpdateTextureFunction = () => { source: TexImageSource | undefined; hash: any; }; type ImageTextureProps = { id: string; display?: { width: number; height: number; }; target: { width: number; height: number; }; scale?: number; getTexture: UpdateTextureFunction; }; declare class ImageTexture extends BaseObject implements SpacialContent { readonly type = "spacial-content"; id: string; uri: string; display: DisplayData; points: Strand; getTexture: UpdateTextureFunction; constructor(data?: { id?: string; uri: string; width: number; height: number; scale?: number; }); applyProps(props: ImageTextureProps): void; getAllPointsAt(target: Strand, aggregate?: Strand, scale?: number): Paint[]; } //#endregion //#region src/spacial-content/tiled-image.d.ts declare class TiledImage extends BaseObject implements SpacialContent { readonly id: string; readonly type = "spacial-content"; readonly display: DisplayData; tileWidth: number; tileHeight: number; columns: number; rows: number; style: { opacity: number; }; points: Strand; service?: ImageService; format: string; crop2?: Strand; version3?: boolean; private windowed?; private tileWindow?; tileUrl: string; constructor(data: { url: string; scaleFactor: number; points: Strand; displayPoints?: Strand; tileWidth: number; tileHeight: number; width: number; height: number; columns: number; rows: number; format?: string; id?: string; version3?: boolean; }); applyProps(props: any): void; static fromTile(url: string, canvas: { width: number; height: number; }, tile: { width: number; height?: number; }, scaleFactor: number, service?: ImageService, format?: string, useFloorCalc?: boolean, version3?: boolean): TiledImage; /** Renderer indices refer to the allocated grid, not the full virtual image. */ get renderColumns(): number; get renderRows(): number; getImageUrl(index: number): string; getAllPointsAt(target: Strand, aggregate?: Strand, scaleFactor?: number): Paint[]; private updateTileWindow; transform(op: Strand): void; getScheduledUpdates(target: Strand, scaleFactor: number): Array<() => Promise>; } //#endregion //#region src/spacial-content/map-tiled-image.d.ts type MapTileCoordinate = { x: number; y: number; z: number; }; type MapTileGrid = { /** Tile rectangles in world units. */ points: precise_dna_d_exports.Strand; /** Tile rectangles in whole source pixels (`tileSize` square), laid out as a grid. */ pixelPoints: precise_dna_d_exports.Strand; tiles: MapTileCoordinate[]; columns: number; rows: number; count: number; minTileX: number; maxTileX: number; minTileY: number; maxTileY: number; }; type MapTileGridCoverage = Omit & { westTile: number; eastTile: number; northTile: number; southTile: number; tileSpanX: number; tileSpanY: number; }; type MapTiledImageProps = { id?: string; bounds: MapBounds; worldWidth: number; worldHeight: number; zoom: number; tileSize?: number; scaleFactor?: number; tileSource?: MapTileSource; tileUrlTemplate?: string; subdomains?: string[]; /** Request `@2x` style tiles when the template uses `{r}`. */ retina?: boolean; /** * Restrict the generated grid to the tiles intersecting this lng/lat region. * Tile positions are still projected against the full `bounds`, so a windowed * image lines up exactly with a full-bounds image at the same zoom. */ region?: MapBounds; /** Throw if the generated grid would exceed this many tiles. */ maxTiles?: number; }; declare function intersectMapBounds(a: MapBounds, b: MapBounds): MapBounds | null; declare function estimateFiniteTileGridCoverage(config: { bounds: MapBounds; zoom: number; /** Optional sub-region (lng/lat). Only the tile range is affected; the tile span always describes `bounds`. */ region?: MapBounds; }): MapTileGridCoverage; declare function createFiniteTileGrid(config: { bounds: MapBounds; zoom: number; worldWidth: number; worldHeight: number; maxTiles?: number; region?: MapBounds; tileSize?: number; }): MapTileGrid; declare class MapTiledImage extends TiledImage { readonly zoom: number; readonly bounds: MapBounds; readonly worldWidth: number; readonly worldHeight: number; readonly tileSize: number; readonly tileSource: MapTileSource; readonly subdomains: string[]; readonly retina: boolean; readonly region?: MapBounds; readonly tileCoordinates: MapTileCoordinate[]; readonly minTileX: number; readonly maxTileX: number; readonly minTileY: number; readonly maxTileY: number; constructor(props: MapTiledImageProps); applyProps(props: any): void; getImageUrl(index: number): string; } //#endregion //#region src/spacial-content/map-tile-pyramid.d.ts declare const DEFAULT_MAP_MAX_TILES_PER_LAYER = 16000; declare const DEFAULT_MAP_MAX_TOTAL_TILES = 120000; declare const DEFAULT_MAP_MAX_QUALITY_LEVELS = 12; declare const DEFAULT_MAP_MAX_TILES_PER_WINDOW = 2048; declare const DEFAULT_MAP_WINDOW_MARGIN = 2; type MapTileLevel = { zoom: number; coverage: MapTileGridCoverage; /** World units per source pixel at this zoom. */ scaleFactor: number; }; type MapTilePlanConfig = { bounds: MapBounds; worldWidth: number; worldHeight: number; tileSize?: number; minZoom?: number; maxZoom?: number; maxQualityLevels?: number; maxTilesPerLayer?: number; maxTotalTiles?: number; }; type MapTilePlan = { /** Levels that cover the whole bounds, ordered coarse -> fine. */ levels: MapTileLevel[]; minZoom: number; maxZoom: number; /** World units per source pixel at zoom 0. Level scale factor is `zoomZeroScale / 2^zoom`. */ zoomZeroScale: number; }; /** * Decides which zoom levels can be built eagerly (covering the whole bounds) within the configured * tile budgets. Deeper zooms are served by viewport windows (see MapTilePyramid). */ declare function planMapTileLevels(config: MapTilePlanConfig): MapTilePlan; type MapTilePyramidProps = { id: string; bounds: MapBounds; /** Size of the map in the layer's own coordinate frame. */ worldWidth: number; worldHeight: number; tileSize?: number; tileSource?: MapTileSource; tileUrlTemplate?: string; /** Changes whenever `tileSource` behaves differently (functions can not be compared meaningfully). */ sourceKey?: string; subdomains?: string[]; retina?: boolean; minZoom?: number; maxZoom?: number; maxQualityLevels?: number; maxTilesPerLayer?: number; maxTotalTiles?: number; /** * Build deeper-than-budget zoom levels on demand, covering only the area around the viewport. * Without this, `maxZoom` is capped by `maxTilesPerLayer` for the bounds' footprint. */ viewportWindows?: boolean; maxTilesPerWindow?: number; /** Extra area kept around the viewport, as a multiple of the viewport size. */ windowMargin?: number; renderOptions?: CompositeResourceProps; }; declare const MAP_TILE_PYRAMID_RENDER_OPTIONS: CompositeResourceProps; /** * A multi-zoom OSM-style tile layer. * * - Zoom levels that fit the tile budget are built up-front for the whole bounds. * - Deeper levels are built lazily as "windows": a tile grid for just the region around the * viewport, rebuilt when the viewport leaves it. This is what makes street level zoom * reachable over large bounds. * - Geometry / source changes rebuild the levels in place, so React does not have to remount. */ declare class MapTilePyramid extends CompositeResource { private config; private plan; private windows; private staticImages; private lastTarget?; private lastScale; private windowsDirty; private readonly baseId; /** Number of times the static levels were (re)built. Mostly useful for diagnostics and tests. */ buildCount: number; private validateWindows; constructor(props: MapTilePyramidProps); get tileSize(): number; get bounds(): MapBounds; get zoomLevels(): number[]; get windowZooms(): number[]; get staticMaxZoom(): number; getPlan(): MapTilePlan; private get tileSource(); private rebuildStaticLevels; applyProps(props: any): void; getAllPointsAt(target: Strand, aggregate?: Strand, scale?: number): Paint[]; getScheduledUpdates(target: Strand, scaleFactor: number): Array<() => Promise>; /** Deepest zoom that is worth having a window for at the current viewport scale. */ private desiredWindowZoom; private requiredWindowZooms; private needsWindowRefresh; private windowCovers; private buildWindow; refreshWindows: () => void; } //#endregion //#region src/spacial-content/single-image.d.ts type SingleImageProps = { uri: string; id?: string; display?: { width: number; height: number; rotation?: number; }; target: { width: number; height: number; x?: number; y?: number; }; crop?: { x: number; y: number; width: number; height: number; }; scale?: number; priority?: boolean; style?: any; }; declare class SingleImage extends BaseObject implements SpacialContent { readonly type = "spacial-content"; /** * An identifier for this image. Will default to the image URI. */ id: string; /** * The URI of the image being painted. */ uri: string; /** * The real height and width of the image. For example a 1000x1000 painted at 100x100 would contain * the display data for 1000x1000 and `this.points` would scale that down to 100x100. This is used to * calculate the scale. */ display: DisplayData; /** * Points are relative to the world object. * Does not change when viewport moves * Does not change if world object position changes. * */ points: Strand; /** * Displayed as priority */ priority?: boolean; /** * Some simple styling options */ style: { opacity: number; }; constructor(data?: { id?: string; uri: string; width: number; height: number; scale?: number; x?: number; y?: number; rotation?: number; }); applyProps(props: SingleImageProps): void; getAllPointsAt(target: Strand, aggregate?: Strand, scale?: number): Paint[]; static fromSvg(svg: string, target: SpacialSize, display?: SpacialSize, id?: string): SingleImage; static fromImage(uri: string, target: SpacialSize, display?: SpacialSize, id?: string): SingleImage; getImageUrl(): string; } //#endregion //#region src/spacial-content/warped-image.d.ts type WarpedImageTile = WarpSourceTile & { url: string; }; type WarpedImageProps = { resourceMask?: WarpMeshOptions['resourceMask']; id?: string; /** Tiles of one level of the image. A plain image is a single tile covering the whole image. */ tiles: WarpedImageTile[]; /** Full resolution image size; control points and tile coordinates refer to it. */ imageWidth: number; imageHeight: number; /** Full resolution pixels per tile pixel at this level (1 for the full resolution level). */ scaleFactor?: number; transformer: WarpTransformer; /** Projection from lng/lat into the frame that contains this image (usually a MapObject). */ lngLatToWorld: (lng: number, lat: number) => { x: number; y: number; }; transformationType?: WarpTransformationType | 'custom'; /** Mesh cells along the longest image side. See `defaultWarpResolution`. */ resolution?: number; format?: string; }; /** * An image (single or tiled) drawn through a georeferencing transformation, rather than as * axis-aligned rectangles. * * It is a `TiledImage` for everything that selects and loads tiles. The canvas renderer draws each * tile as a textured triangle mesh (see `getWarpTile`); the WebGL fast path ignores warped images * so they are drawn by the canvas renderer in the WebGL preset. */ declare class WarpedImage extends TiledImage { readonly isWarped = true; readonly compositeOpacity = true; readonly sourceTiles: WarpedImageTile[]; readonly imageWidth: number; readonly imageHeight: number; readonly levelScale: number; mesh: WarpMeshTile[]; private meshResolution?; private meshType?; private currentTransformer; private currentProjection; private resourceMask?; constructor(props: WarpedImageProps); getImageUrl(index: number): string; getWarpTile(index: number): WarpMeshTile | undefined; /** * Re-fit the mesh in place, e.g. after control points changed. Tile images stay loaded. */ setTransform(config: { transformer: WarpTransformer; lngLatToWorld: (lng: number, lat: number) => { x: number; y: number; }; transformationType?: WarpTransformationType | 'custom'; resolution?: number; resourceMask?: WarpedImageProps['resourceMask']; }): void; applyProps(props: any): void; } declare function isWarpedImage(value: unknown): value is TiledImage & { compositeOpacity?: boolean; getWarpTile(index: number): WarpMeshTile | undefined; }; //#endregion //#region src/spacial-content/warped-map-layer.d.ts type WarpedMapResourceProps = { id: string; /** Full-resolution IIIF image dimensions. The layer uses these image pixel coordinates. */ imageWidth: number; imageHeight: number; transformer: WarpTransformer; tileSource?: MapTileSource; /** Change this to invalidate tiles supplied by a function source. */ tileSourceKey?: string | number; tileSize?: number; minZoom?: number; maxZoom?: number; maxTiles?: number; /** Mesh cells along the longest side of the viewport window (1..256). */ resolution?: number; resourceMask?: WarpMeshOptions['resourceMask']; opacity?: number; useDevicePixelRatio?: boolean; onError?: (error: Error) => void; }; declare function validateWarpedMapLayer(props: WarpedMapResourceProps): void; /** An OSM/XYZ overlay whose destination is an unchanged IIIF image. */ declare class WarpedMapResource extends CompositeResource { private config; private target?; private windowRect?; private viewportScale; private builtScale; private dirty; private generation; private loadedFallback?; zoom: number; private replaceImages; constructor(props: WarpedMapResourceProps); applyProps(props: WarpedMapResourceProps): void; getAllPointsAt(target: precise_dna_d_exports.Strand, aggregate?: precise_dna_d_exports.Strand, scale?: number): Paint[]; isImageActive(image: SpacialContent): boolean; getScheduledUpdates(target: precise_dna_d_exports.Strand, scale: number): Array<() => Promise>; private refresh; } //#endregion //#region src/world-objects/paint.d.ts type Paintable = SpacialContent; type Paint = [Paintable, Strand, Strand | undefined]; /** Lets image-only consumers omit annotation traversal rather than discard collected paints. */ type PaintSelectionOptions = { includeAnnotations?: boolean; }; //#endregion //#region src/objects/base-object.d.ts declare abstract class BaseObject implements AtlasObjectModel { __id: string; __revision: number; __host: any; __onCreate?: () => void; __parent?: CompositeResource; __owner: { value: WorldObject | undefined; }; __state: any; eventHandlers: SupportedEventMap; scale: number; layers: SupportedChildElements[]; time: WorldTime[]; _crop?: precise_dna_d_exports.Strand; cropData?: { x: number; y: number; width: number; height: number; }; get crop(): precise_dna_d_exports.Strand | undefined; set crop(crop: precise_dna_d_exports.Strand | undefined); id: string; abstract points: precise_dna_d_exports.Strand; getObjectsAt(target: precise_dna_d_exports.Strand): SupportedChildElements[] | Array<[SupportedChildElements, any[]]>; getAllPointsAt(target: precise_dna_d_exports.Strand, aggregate: precise_dna_d_exports.Strand, scale: number): Paint[]; getScheduledUpdates(target: precise_dna_d_exports.Strand, scaleFactor: number): Array<() => void | Promise>; protected constructor(); addEventListener: (name: Name$1, cb: (e: any) => void, options?: { capture: boolean; passive: boolean; }) => void; removeEventListener: (name: Name$1, cb: (e: any) => void) => void; dispatchEvent(name: Name$1, e: any): boolean; get x(): number; get y(): number; get width(): number; get height(): number; translate(x: number, y: number): void; atScale(factor: number): void; transform(op: precise_dna_d_exports.Strand): void; applyProps(props: Props): void; /** Release renderer resources when this object leaves the scene. Safe to call again. */ dispose(): void; appendChild(item: SupportedChildElements): void; removeChild(item: SupportedChildElements): void; insertBefore(item: SupportedChildElements, before: SupportedChildElements): void; hideInstance(): void; } //#endregion //#region src/world.d.ts type WorldTarget = { x: number; y: number; width?: number; height?: number; }; type WorldProps = { width: number; height: number; viewingDirection: ViewingDirection$1; }; declare class World extends BaseObject { id: string; _width: number; _height: number; aspectRatio: number; viewingDirection: ViewingDirection$1; aggregateBuffer: precise_dna_d_exports.Strand; isDirty: boolean; zones: ZoneInterface[]; filteredPointsBuffer: precise_dna_d_exports.Strand; selectedZone?: number; triggerQueue: Array<[string, any]>; activatedEvents: string[]; _updatedList: any[]; translationBuffer: precise_dna_d_exports.Strand; needsRecalculate: boolean; emptyPaintables: never[]; renderOrder: number[]; debugSubscribers: Set<(event: WorldDebugEvent) => void>; zoneVisibilityFadeDurationMs: number; zoneOutsideOpacity: number; zoneVisibilityFade?: { zoneId: string; startedAt: number; }; get x(): number; get y(): number; get width(): number; get height(): number; points: precise_dna_d_exports.Strand; private objects; subscriptions: Array<(type: string, changes?: unknown) => void>; constructor(width?: number, height?: number, worldObjectCount?: number, viewingDirection?: ViewingDirection$1); static withProps(props: WorldProps): World; applyProps(props: WorldProps): void; propagateTouchEvent(eventName: string, e: TouchEvent, touchTargets: Array<{ x: number; y: number; }>): any[][]; propagatePointerEvent(eventName: Name$1, e: any, x: number, y: number, opts?: { bubbles?: boolean; cancelable?: boolean; }): any[]; _propagateEventTargets: any[]; propagateEvent(eventName: string, e: any, worldObjects: [WorldObject, SpacialContent[]][], { bubbles, cancelable }?: { bubbles?: boolean; cancelable?: boolean; }): any[]; appendChild(item: WorldObject): void; removeChild(item: WorldObject): void; insertBefore(item: WorldObject, before: WorldObject): void; hideInstance(): void; asWorldObject(): WorldObject | null; addZone(zone: ZoneInterface): void; removeZone(zone: ZoneInterface): void; getZoneById(id: string): ZoneInterface | undefined; hasZone(id: string): boolean; selectZone(id: string | number): void; deselectZone(): void; getActiveZone(): ZoneInterface | undefined; hasActiveZone(): boolean; private checkResizeInternalBuffer; appendWorldObject(object: WorldObject): number; recalculateWorldSize(): boolean; /** * @deprecated */ addObjectAt(object: AbstractObject, target: WorldTarget): WorldObject; scaleWorldObject(index: number, factor: number): void; translateWorldObject(index: number, x: number, y: number): void; resize(width: number, height: number): this; getObjects(): (WorldObject | null)[]; getPoints(): precise_dna_d_exports.Strand; getPointsFromViewer(target: Viewer, aggregate?: precise_dna_d_exports.Strand): Paint[]; addLayoutSubscriber(subscription: (type: string, data: unknown) => void): () => void; /** Let rotated objects perform their own culling: their rendered bounds can extend beyond their raw bounds. */ private forceIncludeRotatedObjects; getScheduledUpdates(target: precise_dna_d_exports.Strand, scaleFactor: number): Array<() => void | Promise>; private isZoneOutsideVisibilityFading; private getZoneOutsideVisibility; getObjectsAt(target: precise_dna_d_exports.Strand, all?: boolean, includeZoneFade?: boolean): Array<[WorldObject, Paintable[]]>; getPointsAt(target: precise_dna_d_exports.Strand, aggregate?: precise_dna_d_exports.Strand, scaleFactor?: number, selectionTarget?: precise_dna_d_exports.Strand, options?: PaintSelectionOptions): Paint[]; _alreadyFlushed: any; flushSubscriptions(): void; trigger(type: string, data?: T): void; triggerEventActivation(): void; triggerRepaint(): void; gotoRegion(data: { x: number; y: number; height: number; width: number; padding?: number; paddingPx?: number | { left?: number; right?: number; top?: number; bottom?: number; }; nudge?: boolean; immediate?: boolean; }): void; goHome(immediate?: boolean, paddingPx?: number | { left?: number; right?: number; top?: number; bottom?: number; }): void; zoomTo(factor: number, point?: { x: number; y: number; }, stream?: boolean): void; zoomIn(point?: { x: number; y: number; }): void; zoomOut(point?: { x: number; y: number; }): void; /** Animate view rotation by a relative angle; defaults to a clockwise quarter turn. */ rotateBy(degrees?: number, point?: { x: number; y: number; }, immediate?: boolean): void; constraintBounds(immediate?: boolean): void; hasPendingAnimation(): boolean; addDebugSubscriber(callback: (event: WorldDebugEvent) => void): () => void; removeDebugSubscriber(callback: (event: WorldDebugEvent) => void): void; private emitDebug; } //#endregion //#region src/modules/shared/image-request-pool.d.ts type AcquireResult = { requestKey: string; promise: Promise; release: (opts?: { silent?: boolean; }) => void; }; type ImagePreloadOptions = { signal?: AbortSignal; }; type ImageRequestPoolOptions = { timeoutMs: number; crossOrigin?: 'anonymous' | 'use-credentials'; useFetch?: boolean; cache?: Map | false; }; declare class ImageRequestPool { private readonly timeoutMs; private readonly crossOrigin?; private readonly useFetch; private readonly cache?; private readonly inFlight; private readonly knownConsumers; private readonly preloaded; private preloadPixels; private preloadGeneration; getCachedImage(url: string): HTMLImageElement | undefined; preload(urls: readonly string[], { signal }?: ImagePreloadOptions): Promise; constructor(options: ImageRequestPoolOptions); acquire(url: string, consumerId: string): AcquireResult; release(url: string, consumerId: string, opts?: { silent?: boolean; }): void; releaseConsumer(consumerId: string, opts?: { silent?: boolean; }): void; cancelAll(opts?: { silent?: boolean; }): void; private normalizeRequestError; private createRequest; } //#endregion //#region src/renderer/renderer.d.ts interface Renderer { beforeFrame(world: World, delta: number, target: Strand, options: HookOptions): void; paint(paint: SpacialContent, index: number, x: number, y: number, width: number, height: number): void; afterFrame(world: World, delta: number, target: Strand, options: HookOptions): void; getScale(width: number, height: number, dpi?: boolean): number; prepareLayer(paint: SpacialContent, point: Strand): void; finishLayer(paint: SpacialContent, point: Strand): void; afterPaintLayer(paint: SpacialContent, transform?: Strand): void; pendingUpdate(): boolean; getPointsAt(world: World, target: Strand, aggregate: Strand, scaleFactor: number, selectionTarget?: Strand): Paint[]; getViewportBounds(world: World, target: Strand, padding: number): PositionPair | null; isReady(): boolean; resize(): void; resize(width?: number, height?: number): void; triggerResize?: () => void; resetReadyState?: (reason?: AtlasReadyResetReason) => void; resetImageFadeState?: () => void; setIdle?: (idle: boolean) => void; preloadImages?: (urls: readonly string[], options?: ImagePreloadOptions) => Promise; reset(): void; getRendererScreenPosition(): { x: number; y: number; width: number; height: number; top: number; left: number; } | undefined; } //#endregion //#region src/renderer/runtime.d.ts type RuntimeHooks = { useFrame: Array<(time: number) => void>; useBeforeFrame: Array<(time: number) => void>; useAfterFrame: Array<(time: number) => void>; useAfterPaint: Array<(paint: Paint) => void>; }; type UnwrapHook = T extends Array ? R : never; type UnwrapHookArg = T extends Array<(arg: infer R) => any> ? R : never; type ViewerMode = 'static' | 'explore' | 'sketch'; type ViewportChangeEvent = { viewport: Projection$1; center: { x: number; y: number; }; /** CSS pixels per world unit. Invert this for world units per CSS pixel. */ scaleFactor: number; rotation: number; }; type ViewerFilters = { grayscale: number; contrast: number; brightness: number; saturate: number; hueRotate: number; sepia: number; invert: number; blur: number; }; type HookOptions = { viewRotation?: number; /** Mirror the camera horizontally in screen space, after rotation. */ viewFlip?: boolean; viewCenter?: { x: number; y: number; }; enableFilters?: boolean; filters: ViewerFilters; }; type RuntimeOptions = { visibilityRatio: number; maxOverZoom: number; maxUnderZoom: number; }; type RuntimeZoneState = { zoneId: string; exists: boolean; active: boolean; visibleInViewport: boolean; }; declare class Runtime { id: string; ready: boolean; idle: boolean; readyCycle: number; readyReason: AtlasReadyResetReason; readyTimestamp: number | undefined; resourceTransitionKey: string | number | undefined; private hasResourceTransitionKey; get x(): number; set x(x: number); get y(): number; set y(y: number); get x2(): number; set x2(x2: number); get y2(): number; set y2(y2: number); get width(): number; set width(width: number); get height(): number; set height(height: number); panMomentumActive: boolean; /** Whether touch gestures may rotate the view. Programmatic rotation remains available. */ touchRotationEnabled: boolean; setTouchRotationEnabled(enabled: boolean): void; private _viewFlip; /** Horizontal camera reflection. Scene coordinates and tile selection remain unchanged. */ get viewFlip(): boolean; set viewFlip(flipped: boolean); private _viewRotation; /** Clockwise camera rotation in degrees. Scene geometry is unchanged. */ get viewRotation(): number; set viewRotation(degrees: number); rotateBy(degrees: number, origin?: { x: number; y: number; }): void; /** Conservative world-space footprint of the rotated viewport, used for tile selection. */ getVisibleWorldBounds(target?: precise_dna_d_exports.Strand): precise_dna_d_exports.Strand; renderer: Renderer; world: World; target: precise_dna_d_exports.Strand; homePosition: precise_dna_d_exports.Strand; manualHomePosition: boolean; manualFocalPosition: boolean; focalPosition: precise_dna_d_exports.Strand; homePaddingPx: number | { left?: number; right?: number; top?: number; bottom?: number; } | undefined; transitionManager: TransitionManager; aggregate: precise_dna_d_exports.Strand; transformBuffer: precise_dna_d_exports.Strand; lastTarget: precise_dna_d_exports.Strand; zoomBuffer: precise_dna_d_exports.Strand; logNextRender: boolean; pendingUpdate: boolean; isCommitting: boolean; firstRender: boolean; lastTime: number; stopId?: number; mode: ViewerMode; /** Set by the touch controller. Opt in without changing sketch tool ownership. */ sketchTouchNavigation: 'none' | 'two-finger'; sketchPanOverride: boolean; private viewportSubscribers; private lastViewportState; controllers: RuntimeController[]; controllersRunning: boolean; controllerStopFunctions: Array<() => void>; maxScaleFactor: number; _viewerToWorld: { x: number; y: number; }; _lastGoodScale: number; debugFrame: number; debugSubscribers: Set<(event: RuntimeDebugEvent) => void>; hooks: RuntimeHooks; fpsLimit: number | undefined; options: RuntimeOptions; private unsubscribeWorld; private disposed; hookOptions: HookOptions; constructor(renderer: Renderer, world: World, target: Viewer, controllers?: RuntimeController[], options?: Partial); setHomePosition(position?: Projection$1): void; setHomePaddingPx(px?: number | { left?: number; right?: number; top?: number; bottom?: number; }): void; getHomePaddingPx(): number | { left?: number; right?: number; top?: number; bottom?: number; } | undefined; startControllers(): void; stopControllers(): void; updateControllerPosition(): void; triggerResize(): void; addController(controller: RuntimeController): void; cover(): void; getRendererScreenPosition(): { x: number; y: number; width: number; height: number; top: number; left: number; } | undefined; updateRendererScreenPosition(): void; setOptions(options: Partial): void; setResourceTransitionKey(key: string | number | undefined): void; preloadImages(urls: readonly string[], options?: { signal?: AbortSignal; }): Promise; /** * Normalize padding input to a consistent per-side format. */ private normalizePadding; /** * Calculate the viewport region that fits the target content within the available * canvas area (accounting for CSS pixel padding). */ getHomeTarget(options?: { cover?: boolean; position?: precise_dna_d_exports.Strand; paddingPx?: number | { left?: number; right?: number; top?: number; bottom?: number; }; }): { x: number; y: number; width: number; height: number; }; isViewportAtHome(options?: { cover?: boolean; tolerance?: number; target?: Projection$1; }): boolean; isViewportAtHomeZoomLevel(options?: { cover?: boolean; tolerance?: number; target?: Projection$1; }): boolean; goHome(options?: { cover?: boolean; position?: precise_dna_d_exports.Strand; paddingPx?: number | { left?: number; right?: number; top?: number; bottom?: number; }; }): void; /** * Resize world * * This is generally called when the world is re-sized. This recalculates the current target accordingly. It needs to * be improved, tested and planned. * * @param fromWidth * @param toWidth * @param fromHeight * @param toHeight */ resize(fromWidth: number, toWidth: number, fromHeight: number, toHeight: number): void; updateFocalPosition(widthDiff?: number, heightDiff?: number): void; _viewport: { x: number; y: number; width: number; height: number; }; /** * Get Viewport * * Returns a projection based on the current target. * * @todo rename to getProjection. * @todo evaluate if we actually need this. */ getViewport(): Projection$1; /** The world coordinate under the centre of the viewer, including rotated views. */ getViewportCenter(): { x: number; y: number; }; /** Hand/Draw toolbar override; does not remount or change the active tool. */ setSketchPanOverride(enabled: boolean): void; /** Subscribe once per changed rendered viewport, including live sketch pinches and pans. */ addViewportChangeListener(listener: (event: ViewportChangeEvent) => void): () => void; private notifyViewportChange; /** Fit a world-space box with CSS-pixel padding, using the existing camera transition. */ zoomToRegion(box: Projection$1, options?: { padding?: number | { left?: number; right?: number; top?: number; bottom?: number; }; transition?: NonNullable[1]>['transition']; }): void; /** * Set Viewport * * This is a helper for setting the viewport based on x, y, width and height, opposed to the x1, y1, x2, y2 native * co-ordinates of the target. * * @param data */ setViewport: (data: { x?: number; y?: number; width?: number; height?: number; }) => void; constrainBounds(target: precise_dna_d_exports.Strand, { panPadding, ref }?: { ref?: boolean; panPadding?: number; }): readonly [boolean, precise_dna_d_exports.Strand]; /** * Get bounds * * Returns the minimum and maximum bounds. This absolutely needs improved. With the addition of zones this is becoming * more of an issue. It has to take into account the current layout. There also needs to be a new method for creating * a "home" view that will fit the content to the view. */ getBounds(options: { padding: number; target?: precise_dna_d_exports.Strand; }): { readonly minX: number; readonly maxX: number; readonly minY: number; readonly maxY: number; }; /** CSS pixels per world unit (or device pixels when dpi=true). Use 1 / scale for editor hit radii. */ getScaleFactor(dpi?: boolean): number; private copyStrandValues; private getZoomConstraintState; constrainTarget(target: precise_dna_d_exports.Strand, { origin, panPadding, ref }?: { origin?: { x: number; y: number; }; panPadding?: number; ref?: boolean; }): readonly [boolean, precise_dna_d_exports.Strand]; /** * Zoom */ getZoomedPosition(factor: number, { origin, fromPos: _fromPos }: { origin?: { x: number; y: number; }; fromPos?: precise_dna_d_exports.Strand; }): precise_dna_d_exports.Strand; clampRegion({ x, y, width, height, padding }: { x: number; y: number; width: number; height: number; padding?: number; }): { x: number; y: number; width: number; height: number; }; /** * Converts units from the viewer to the world. * * Needs to be tested, as this will become more important with the event system. * * @param x * @param y */ viewerToWorld(x: number, y: number): { x: number; y: number; }; /** * Converts units from the viewer to the world. * * Needs to be tested, as this will become more important with the event system. * * @param x * @param y * @param width * @param height */ worldToViewer(x: number, y: number, width: number, height: number): { x: number; y: number; width: number; height: number; strand: precise_dna_d_exports.Strand; }; /** * Set scale * * This will set the scale of the target, with an optional origin. * * @param scaleFactor * @param origin */ setScale(scaleFactor: number, origin?: { x: number; y: number; }): void; /** * Sync runtime instances * * Allows a single controller to drive 2 runtime instances, or 2 controllers to both * control each other. * * @param runtime */ syncTo(runtime: Runtime): () => void; /** * Stop the runtime * * Stops the internal clock, where no more updates will occur. Returns a function to restart it. */ stop(): () => void; reset(): void; /** Permanently release this runtime. Use stop() for a temporary pause. */ dispose(): void; /** Pause rendering and image requests while retaining the current view. */ setIdle(idle: boolean): void; resetReadyState(reason?: AtlasReadyResetReason): void; getReadyState(): { ready: boolean; cycle: number; reason: AtlasReadyResetReason; timestamp?: number; }; selectZone(zone: number | string): void; goToZone(id: string, options?: { paddingPx?: number | { left?: number; right?: number; top?: number; bottom?: number; }; immediate?: boolean; }): boolean; deselectZone(): void; getZoneRuntimeState(zoneId: string, viewport?: Projection$1): RuntimeZoneState; hook>(name: keyof RuntimeHooks, arg: Arg): void; registerHook>(name: Name$1, hook: Hook): () => void; /** * Render * * The hottest path in the runtime, called every 16.7ms, if possible in the future be double-timed on 120hz monitors. * * @ param t */ render: (t: number) => void; updateNextFrame(): void; addDebugSubscriber(callback: (event: RuntimeDebugEvent) => void): () => void; removeDebugSubscriber(callback: (event: RuntimeDebugEvent) => void): void; private hasDebugSubscribers; private emitDebug; } //#endregion //#region src/types.d.ts type RuntimeController = { start(runtime: Runtime): () => void; updatePosition(x: number, y: number, width: number, height: number): void; }; interface Position { x: number; y: number; } interface PositionPair { x1: number; y1: number; x2: number; y2: number; } interface SpacialSize { width: number; height: number; } interface Scaled { scale: number; } interface Projection$1 extends Position, SpacialSize {} interface Viewer extends Projection$1, Scaled {} interface DisplayData extends SpacialSize, Position, Scaled { points: Strand; rotation?: number; } interface WorldTime { start: number; end: number; } type ViewingDirection$1 = 'left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top'; /** @internal */ type PointerEvents = { onClick(e: any): void; onWheel(e: any): void; onPointerDown(e: any): void; onPointerUp(e: any): void; onMouseLeave(e: any): void; onMouseMove(e: any): void; onTouchCancel(e: any): void; onTouchEnd(e: any): void; onTouchMove(e: any): void; onTouchStart(e: any): void; }; interface TextWrapperOptions { /** * Text style that includes font size (in px), font weight, font family, etc. */ font?: string; /** * Number - 'n' times font size where 1 is equivalent to '100%'. Also the property can be set in '%' or 'px'. */ lineHeight?: string | number; /** * Horizontal alignment of each line. */ textAlign?: 'left' | 'center' | 'right'; /** * Vertical alignment of the whole text block. */ verticalAlign?: 'top' | 'middle' | 'bottom'; /** * Horizontal padding (in px) that is equally set on left and right sides. */ paddingX?: number; /** * Vertical padding (in px) that is equally set on top and bottoms. */ paddingY?: number; /** * Fit canvas' container size instead of its own size. */ fitParent?: boolean; /** * "auto" - text goes to the next line on a whole word when there's no room * "word" - each next word is placed on a new line */ lineBreak?: 'auto' | 'word'; /** * Ignore given font size and line height and resize text to fill its padded container. */ sizeToFill?: boolean; /** * If above option is true text won't be bigger than set. */ maxFontSizeToFill?: number; /** * Allow text outline based on canvas context configuration. */ strokeText?: boolean; /** * All lines will try to match the same width with flexed spaces between the words. */ justifyLines?: boolean; /** * Text breaks on a new line character "\n". Supports multiple consecutive new lines. */ allowNewLine?: boolean; /** * Text is rendered based on device pixel ratio. */ renderHDPI?: boolean; /** * Text is underlined according to context.strokeStyle and context.lineWidth */ textDecoration?: 'none' | 'underline'; } //#endregion //#region src/spacial-content/abstract-content.d.ts /** * @deprecated */ declare abstract class AbstractContent extends BaseObject implements SpacialContent { abstract readonly id: string; readonly type: 'spacial-content'; abstract points: Strand; abstract readonly display: DisplayData; getAllPointsAt(target: Strand, aggregate?: Strand, scale?: number): Paint[]; } //#endregion //#region src/spacial-content/composite-resource.d.ts type RenderOptions = { renderSmallestFallback: boolean; /** Number of fully loaded visible layers; loading layers do not consume this limit. */ renderLayers: number; minSize: number; maxImageSize: number; quality: number; useDevicePixelRatio: boolean; layerPolicy: 'fallback-only' | 'always-blend' | 'active-only'; loadingBias: 'balanced' | 'speed' | 'data'; prefetchRadius?: number; fadeInMs: number; fadeFallbackTiles: boolean; fadeOnLayerChange: boolean; clipToBounds: boolean; /** * Layers whose `display.scale` differs by less than this are treated as the same * quality level, and only one of them is kept. The default suits IIIF scale factors * (1, 2, 4, ...). Content whose scales are fractional (e.g. map tile pyramids, where * scale is world units per source pixel) should set this to `0` to keep every level. */ minScaleGap: number; }; type CompositeResourceProps = Partial; declare class CompositeResource extends AbstractContent implements SpacialContent, AtlasObjectModel { readonly id: string; readonly display: DisplayData; points: precise_dna_d_exports.Strand; images: SpacialContent[]; allImages: SpacialContent[]; scaleFactors: number[]; aggregateBuffer: precise_dna_d_exports.Strand; lazyLoader?: () => Promise; isFullyLoaded: boolean; isLoadingFullResource: boolean; maxScaleFactor: number; private layerSelection; private layerSelectionFrame; renderOptions: RenderOptions; constructor(data: { id: string; width: number; height: number; images: SpacialContent[]; loadFullImages?: () => Promise; renderOptions?: CompositeResourceProps; }); applyProps(props: CompositeResourceProps): void; appendChild(item: SpacialContent): void; removeChild(item: SpacialContent): void; dispose(): void; insertBefore(item: SpacialContent, before: SpacialContent): void; hideInstance(): void; addImages(images: SpacialContent[]): void; private getImageDedupeKey; sortByScales(): void; _scheduleSortByScales: boolean; _sortByScales: () => void; loadFullResource: () => Promise; fallback: (() => Promise)[]; getScheduledUpdates(target: precise_dna_d_exports.Strand, scaleFactor: number): Array<() => Promise>; getAllPointsAt(target: precise_dna_d_exports.Strand, aggregate?: precise_dna_d_exports.Strand, scale?: number): Paint[]; protected isImageLoaded(image: SpacialContent, target: precise_dna_d_exports.Strand): boolean; isImageActive(image: SpacialContent): boolean; getImageActivatedAt(image: SpacialContent): number | undefined; private getNow; } //#endregion export { MapTileGridCoverage as $, WarpAdapter as $t, Paintable as A, easingFunctions as At, DEFAULT_MAP_MAX_TILES_PER_LAYER as B, WorldPointerDebugEvent as Bt, Renderer as C, SupportedEvents as Ct, BaseObject as D, EasingFunction as Dt, World as E, supportedEventMap as Et, WarpedImageProps as F, RuntimeDebugEvent as Ft, MapTileLevel as G, createWarpAdapterController as Gt, DEFAULT_MAP_MAX_TOTAL_TILES as H, WorldTriggerDebugEvent as Ht, WarpedImageTile as I, RuntimeFrameEndEvent as It, MapTilePyramid as J, WarpSourceTile as Jt, MapTilePlan as K, WarpMeshOptions as Kt, isWarpedImage as L, RuntimeFrameStartEvent as Lt, WarpedMapResourceProps as M, AtlasReadyRenderer as Mt, validateWarpedMapLayer as N, AtlasReadyResetReason as Nt, Paint as O, EasingFunctionNames as Ot, WarpedImage as P, DevToolsTab as Pt, MapTileGrid as Q, validateResourceMask as Qt, SingleImage as R, RuntimePaintEvent as Rt, ViewportChangeEvent as S, WorldRect as Sn, SupportedEventNames as St, ImageRequestPool as T, supportedEventAttributes as Tt, DEFAULT_MAP_WINDOW_MARGIN as U, WarpAdapterController as Ut, DEFAULT_MAP_MAX_TILES_PER_WINDOW as V, WorldTouchDebugEvent as Vt, MAP_TILE_PYRAMID_RENDER_OPTIONS as W, WarpControllerState as Wt, planMapTileLevels as X, defaultWarpResolution as Xt, MapTilePyramidProps as Y, buildWarpMesh as Yt, MapTileCoordinate as Z, meshUnitsPerImagePixel as Zt, RuntimeHooks as _, MapGeoJSONInput as _n, WorldObject as _t, Position as a, GeoJSONGeometryCollection as an, TiledImage as at, ViewerFilters as b, MapTileUrlContext as bn, AbstractObject as bt, RuntimeController as c, GeoJSONMultiPoint as cn, UpdateTextureFunction as ct, TextWrapperOptions as d, GeoJSONPolygon as dn, ZoneConfig as dt, WarpAdapterHooks as en, MapTiledImage as et, Viewer as f, LngLatPoint as fn, ZoneInterface as ft, Runtime as g, MapGeoJSONGeometry as gn, TileSelectionDebugEvent as gt, HookOptions as h, MapGeoJSONFeatureCollection as hn, HitTestCullingDebugEvent as ht, PointerEvents as i, WarpUpdateReason as in, intersectMapBounds as it, WarpedMapResource as j, AtlasReadyEvent as jt, PaintSelectionOptions as k, bounceOut as kt, Scaled as l, GeoJSONMultiPolygon as ln, SpacialContent as lt, WorldTime as m, MapGeoJSONFeature as mn, fromImage as mt, CompositeResourceProps as n, WarpTransformationType as nn, createFiniteTileGrid as nt, PositionPair as o, GeoJSONLineString as on, ImageTexture as ot, ViewingDirection$1 as p, MapBounds as pn, ZoneResolvedConfig as pt, MapTilePlanConfig as q, WarpMeshTile as qt, DisplayData as r, WarpTransformer as rn, estimateFiniteTileGridCoverage as rt, Projection$1 as s, GeoJSONMultiLineString as sn, ImageTextureProps as st, CompositeResource as t, WarpControlPoint as tn, MapTiledImageProps as tt, SpacialSize as u, GeoJSONPoint as un, Zone as ut, RuntimeOptions as v, MapProjection as vn, rotatePoint as vt, ImagePreloadOptions as w, createDefaultEventMap as wt, ViewerMode as x, WorldPoint as xn, SupportedEventMap as xt, RuntimeZoneState as y, MapTileSource as yn, AbstractWorldObject as yt, DEFAULT_MAP_MAX_QUALITY_LEVELS as z, WorldDebugEvent as zt }; //# sourceMappingURL=composite-resource-DMR9HfIl.d.ts.map