@d3plus/core 4.2.0 → 4.3.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 +374 -296
- package/es/src/charts/Geomap/emit.js +44 -4
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +30 -1
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/Plot/index.js +77 -2
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +24 -3
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/features/shapeEmit.js +3 -1
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/viz/Viz.js +63 -10
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/interactionOpacity.js +4 -1
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +4 -1
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +7 -3
- package/es/src/charts/viz/vizRender.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/shapes/Shape.js +12 -10
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/hitAreaNode.js +31 -5
- package/es/src/shapes/hitAreaNode.js.map +1 -1
- package/es/src/shapes/interactionPoints.js +30 -0
- package/es/src/shapes/interactionPoints.js.map +1 -0
- package/package.json +9 -9
- package/types/src/charts/Plot/index.d.ts +22 -1
- package/types/src/charts/Plot/pipeline.d.ts +2 -1
- package/types/src/charts/viz/Viz.d.ts +31 -1
- package/types/src/charts/viz/vizTypes.d.ts +18 -0
- package/types/src/shapes/Shape.d.ts +2 -2
- package/types/src/shapes/hitAreaNode.d.ts +5 -4
- package/types/src/shapes/interactionPoints.d.ts +15 -0
- package/umd/d3plus-core.full.js +954 -275
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +1285 -1099
- package/umd/d3plus-core.js +267 -39
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +266 -170
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shapes/Shape.ts"],"sourcesContent":["import {color} from \"d3-color\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport {colorContrast} from \"@d3plus/color\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {assign, getSize, isObject} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {SvgRenderer} from \"@d3plus/render\";\nimport type {GroupNode, Paint, SceneNode, Transform} from \"@d3plus/render\";\n\nimport {TextBox} from \"../components/index.js\";\nimport {accessor, BaseClass, constant} from \"../utils/index.js\";\nimport type {AccessorFn, D3plusConfig} from \"../utils/index.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\nimport {buildLabelData} from \"./buildLabelData.js\";\nimport {hitAreaNode} from \"./hitAreaNode.js\";\nimport type {BaseShapeConfig} from \"./shapeConfig.js\";\n\n/** Coerces a value to a finite number, or undefined. @private */\nexport function numOrUndef(v: unknown): number | undefined {\n const n = Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Returns a non-empty string, or undefined. @private */\nexport function strOrUndef(v: unknown): string | undefined {\n return v == null || v === \"\" ? undefined : String(v);\n}\n\n/** Parses an SVG stroke-dasharray value into an array of numbers. @private */\nexport function parseDash(v: unknown): number[] | undefined {\n if (v == null || v === \"none\" || v === \"\") return undefined;\n if (typeof v === \"number\") return [v];\n const parts = String(v)\n .split(/[\\s,]+/)\n .map(Number)\n .filter(n => Number.isFinite(n));\n return parts.length ? parts : undefined;\n}\n\nexport interface ShapeAes {\n width?: number;\n height?: number;\n points?: [number, number][];\n r?: number;\n x?: number;\n y?: number;\n}\n\n\nimport {\n backgroundImageLayout,\n emitBackgroundImages,\n sortRanks,\n type BackgroundImageSpec,\n} from \"./sceneSort.js\";\n\n/** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst shapeSchema: ConfigField[] = [\n {key: \"activeOpacity\", coerce: \"identity\", default: 0.25},\n {key: \"ariaLabel\", coerce: \"const\", default: constant(\"\")},\n {key: \"backgroundImage\", coerce: \"const\", default: constant(false)},\n {key: \"backgroundImageFit\", coerce: \"const\", default: constant(\"cover\")},\n {key: \"discrete\", coerce: \"identity\"},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"fill\", coerce: \"const\", default: constant(\"black\")},\n {key: \"fillOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"hitArea\", coerce: \"const\"},\n {key: \"hoverOpacity\", coerce: \"identity\", default: 0.5},\n {\n key: \"id\",\n coerce: \"accessor\",\n default: (d: DataPoint, i?: number) => (d.id !== void 0 ? d.id : i!),\n },\n {key: \"label\", coerce: \"const\", default: constant(false)},\n {key: \"labelBounds\", coerce: \"const\"},\n {key: \"opacity\", coerce: \"const\", default: constant(1)},\n {key: \"pointerEvents\", coerce: \"const\", default: constant(\"visiblePainted\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"role\", coerce: \"const\", default: constant(\"presentation\")},\n {key: \"rotate\", coerce: \"const\", default: constant(0)},\n {key: \"rx\", coerce: \"const\", default: constant(0)},\n {key: \"ry\", coerce: \"const\", default: constant(0)},\n {key: \"scale\", coerce: \"const\", default: constant(1)},\n {key: \"shapeRendering\", coerce: \"const\", default: constant(\"geometricPrecision\")},\n {key: \"stroke\", coerce: \"const\"},\n {key: \"strokeDasharray\", coerce: \"const\", default: constant(\"0\")},\n {key: \"strokeLinecap\", coerce: \"const\", default: constant(\"butt\")},\n {key: \"strokeOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"strokeWidth\", coerce: \"const\", default: constant(0)},\n {key: \"textAnchor\", coerce: \"const\", default: constant(\"start\")},\n {key: \"texture\", coerce: \"const\", default: constant(false)},\n {key: \"vectorEffect\", coerce: \"const\", default: constant(\"non-scaling-stroke\")},\n {key: \"verticalAlign\", coerce: \"const\", default: constant(\"top\")},\n // \"accessor\" (not \"const\"): a string names a data key (`.x(\"year\")`), a\n // number is a constant (`.x(50)`), and a function passes through — so a\n // standalone shape given string accessors (as the pipeline never does, but\n // direct users do) reads the field instead of treating \"x\" as the literal.\n {key: \"x\", coerce: \"accessor\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"accessor\", default: accessor(\"y\", 0)},\n];\n\n/**\n An abstracted class for generating shapes.\n*/\nexport default class Shape extends BaseClass {\n // installFluent generates the config accessors (fill, x, id, …) at runtime;\n // the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n\n _data: DataPoint[];\n _labelClass: TextBox;\n _name: string;\n _tagName: string;\n _textureDefs: Record<string, Record<string, unknown>>;\n _select!: D3Selection;\n _transition!: ReturnType<typeof transition>;\n /** @param data The raw data array to filter. */\n _dataFilter?(data: DataPoint[]): DataPoint[];\n _group!: D3Selection;\n _update!: D3Selection;\n _enter!: D3Selection;\n _exit!: D3Selection;\n _hoverGroup!: D3Selection;\n _activeGroup!: D3Selection;\n _path!: Record<string, unknown>;\n /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */\n _sceneRenderer?: SvgRenderer;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor(tagName: string = \"g\") {\n super();\n\n installFluent(this, shapeSchema);\n\n this._data = [];\n this._labelClass = new TextBox();\n this._name = \"Shape\";\n this._tagName = tagName;\n this._textureDefs = {};\n\n // stroke defaults to a darker shade of fill — closes over `this.schema`\n // so it tracks the current fill accessor. A fill that doesn't parse as a\n // color (e.g. \"none\"/\"transparent\", a gradient token) has no darker shade,\n // so fall back to the fill value itself.\n this.schema.stroke = (d: DataPoint, i?: number) => {\n const c = color(this.schema.fill(d, i) as string);\n return c ? c.darker(1).formatHex() : (this.schema.fill(d, i) as string);\n };\n\n this.schema.activeStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(1) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 3;\n },\n };\n this.schema.hoverStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(0.5) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 2;\n },\n };\n // Shape's label defaults. These are pushed to `_labelClass` via\n // `_labelClass.config(this.schema.labelConfig)` in render() so the\n // TextBox actually picks them up.\n // textAnchor defaults to \"start\" (left-aligned) — Treemap, Pie,\n // etc. rely on this. Bar overrides to \"middle\" in its constructor.\n this.schema.labelConfig = {\n fontColor: (d: DataPoint, i: number) =>\n colorContrast(this.schema.fill(d, i) as string),\n // Fade labels with their shape's opacity (e.g. an axis tick label hides\n // when `shapeConfig.opacity` is 0). Reads `this.schema.opacity` live —\n // like `fontColor` reads `fill` — which unwraps nested label data.\n fontOpacity: (d: DataPoint, i: number) =>\n this.schema.opacity(d, i) as number,\n fontResize: true,\n fontMax: 50,\n fontMin: 8,\n fontSize: 12,\n padding: 5,\n textAnchor: \"start\",\n verticalAlign: \"top\",\n };\n this.schema.textureDefault = {};\n }\n\n /**\n Given a specific data point and index, returns the aesthetic properties of the shape.\n @param data point*\n @param index @private\n*/\n _aes(_d?: DataPoint, _i?: number): ShapeAes {\n return {};\n }\n\n\n /**\n Returns a full JSON string of the texture config for a given data point.\n\n @private\n*/\n _getTextureKey(d: DataPoint, i: number): string | false {\n const textureVal: unknown = this.schema.texture(d, i);\n if (!textureVal) return false;\n\n /**\n Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.\n @private\n*/\n const styleLogic = (_: unknown): unknown => {\n return typeof _ !== \"function\"\n ? _\n : d.nested && d.key && d.values\n ? (_ as AccessorFn)(\n (d.values as unknown as DataPoint[])[0],\n this._data.indexOf((d.values as unknown as DataPoint[])[0]),\n )\n : (_ as AccessorFn)(d, i);\n };\n\n const fallback = this.schema.textureDefault;\n\n let texture: Record<string, unknown>;\n if (!isObject(textureVal))\n texture = {texture: textureVal} as Record<string, unknown>;\n else texture = textureVal as Record<string, unknown>;\n if (!texture.background) texture.background = styleLogic(this.schema.fill);\n if (!texture.stroke && !fallback.stroke)\n texture.stroke = styleLogic(this.schema.stroke);\n const pathNames = [\n \"squares\",\n \"nylon\",\n \"waves\",\n \"woven\",\n \"crosses\",\n \"caps\",\n \"hexagons\",\n ];\n if (\n pathNames.includes(texture.texture as string) ||\n typeof texture.texture === \"function\"\n ) {\n texture.d = texture.texture;\n texture.texture = \"paths\";\n } else if (texture.texture === \"grid\") {\n if (!texture.orientation && !fallback.orientation)\n texture.orientation = [\"vertical\", \"horizontal\"];\n texture.texture = \"lines\";\n }\n if (!texture.fill && texture.texture !== \"paths\")\n texture.fill = texture.stroke;\n const retObj = assign({}, fallback, texture);\n if (typeof retObj.d === \"function\") {\n retObj.d = retObj.d(retObj.size || 20);\n }\n return JSON.stringify(retObj);\n }\n\n /**\n Checks for nested data and uses the appropriate variables for accessor functions.\n @param elem @private\n*/\n _nestWrapper(\n method: AccessorFn,\n ): (d: DataPoint, i: number) => DataPoint[keyof DataPoint] {\n return (d: DataPoint, i: number) =>\n method(\n d.__d3plusShape__ ? (d.data as DataPoint) : d,\n d.__d3plusShape__ ? (d.i as number) : i,\n );\n }\n\n\n /**\n Adds labels to each shape group.\n @private\n*/\n _buildLabelData(): DataPoint[] {\n // Delegates to the pure `buildLabelData()` helper. The helper\n // takes the same inputs `this` exposes but works without a Shape\n // instance — emit functions or other callers that need only the\n // label-record layout can call it directly without instantiating\n // a Shape in compute mode.\n // All Shape methods bound to `this` before handing them to the pure\n // helper — subclasses (e.g. Line._dataFilter) reach for `this.schema.id`\n // and friends inside their bodies.\n return buildLabelData({\n data: this._data,\n dataFilter: this._dataFilter ? this._dataFilter.bind(this) : undefined,\n label: this.schema.label,\n labelBounds: this.schema.labelBounds\n ? this.schema.labelBounds.bind(this)\n : undefined,\n x: this.schema.x,\n y: this.schema.y,\n aes: this._aes.bind(this),\n rotate: this.schema.rotate,\n id: this.schema.id,\n });\n }\n\n\n /**\n Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.\n @param callback Optional callback invoked after rendering completes.\n*/\n /**\n Resolves a style accessor for a data point, mirroring the nested-data logic\n of _applyStyle so scene output matches DOM rendering.\n @private\n*/\n _styleVal(fn: unknown, d: DataPoint, i: number): unknown {\n if (typeof fn !== \"function\") return fn;\n if (d.nested && d.key && d.values) {\n const first = (d.values as unknown as DataPoint[])[0];\n return (fn as AccessorFn)(first, this._data.indexOf(first));\n }\n return (fn as AccessorFn)(d, i);\n }\n\n /**\n Builds the resolved Transform for a data point, mirroring _applyTransform.\n @private\n*/\n _sceneTransform(d: DataPoint, i: number): Transform {\n const wrapped = Boolean(d.__d3plusShape__);\n const dd = (wrapped ? d.data : d) as DataPoint;\n const ii = wrapped ? (d.i as number) : i;\n let x: number, y: number;\n if (wrapped && d.translate) {\n const [tx, ty] = String(d.translate).split(\",\").map(Number);\n x = tx;\n y = ty;\n } else {\n x = Number(this.schema.x(dd, ii));\n y = Number(this.schema.y(dd, ii));\n }\n const scale =\n wrapped && d.scale !== undefined\n ? Number(d.scale)\n : Number(this.schema.scale(dd, ii));\n const rotate =\n wrapped && d.rotate !== undefined\n ? Number(d.rotate)\n : Number(this.schema.rotate((d.data || d) as DataPoint, ii));\n return {x, y, scale, rotate};\n }\n\n /**\n Builds the resolved Paint for a data point, mirroring _applyStyle.\n Texture fills are encoded as a stable \"pattern:<key>\" token at this\n layer; the backend renderers (`SvgRenderer._resolveFill`,\n `CanvasRenderer._resolveFill`) materialize them into a real SVG\n pattern or a Canvas image pattern. The two-stage resolve is\n intentional — Shapes stay backend-free, and texture\n materialization happens once per renderer instead of per-shape.\n @private\n*/\n _scenePaint(d: DataPoint, i: number): Paint {\n // A texture resolves to a stable \"pattern:<key>\" token (the same JSON config\n // render() uses); each backend materializes or degrades it.\n const textureKey = this._getTextureKey(d, i);\n return {\n fill: textureKey\n ? `pattern:${textureKey}`\n : strOrUndef(this._styleVal(this.schema.fill, d, i)),\n fillOpacity: numOrUndef(this._styleVal(this.schema.fillOpacity, d, i)),\n stroke: strOrUndef(this._styleVal(this.schema.stroke, d, i)),\n strokeWidth: numOrUndef(this._styleVal(this.schema.strokeWidth, d, i)),\n strokeOpacity: numOrUndef(this._styleVal(this.schema.strokeOpacity, d, i)),\n strokeDasharray: parseDash(\n this._styleVal(this.schema.strokeDasharray, d, i),\n ),\n strokeLinecap: strOrUndef(\n this._styleVal(this.schema.strokeLinecap, d, i),\n ) as Paint[\"strokeLinecap\"],\n vectorEffect: strOrUndef(\n this._styleVal(this.schema.vectorEffect, d, i),\n ) as Paint[\"vectorEffect\"],\n shapeRendering: strOrUndef(\n this._nestWrapper(this.schema.shapeRendering)(d, i),\n ),\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n };\n }\n\n /**\n Returns the geometry-specific scene fields for a data point. Overridden by\n each shape subclass; the base provides none.\n @private\n*/\n _sceneGeometry(_d: DataPoint, _i: number): Record<string, unknown> | null {\n return null;\n }\n\n /**\n Produces a backend-agnostic scene graph for this shape's data, reusing the\n same accessors render() applies to the DOM. This is the migration seam toward\n the @d3plus/render pluggable backends; it has no effect on render().\n*/\n toScene(): GroupNode {\n let data: DataPoint[] & {key?: AccessorFn} = this._data;\n if (this._dataFilter)\n data = this._dataFilter(data) as DataPoint[] & {key?: AccessorFn};\n const children: SceneNode[] = [];\n // Collected background images, emitted below (after the geometry) as clipped,\n // transformed groups. Each datum whose `backgroundImage(d, i)` resolves to a\n // truthy URL contributes one spec.\n const bgSpecs: BackgroundImageSpec[] = [];\n // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of\n // `data`: the render backends sort each group's children ascending by `z`\n // (stably), so a lower rank paints first (behind) and a higher rank paints\n // last (on top) — the same back-to-front meaning `.sort()` has always had,\n // without disturbing the keyed data-join order that drives transitions.\n const rank = sortRanks(\n data,\n this.schema.sort as ((a: DataPoint, b: DataPoint) => number) | null,\n );\n data.forEach((d, i) => {\n const geom = this._sceneGeometry(d, i);\n if (!geom) return;\n const key = this._nestWrapper(this.schema.id)(d, i) as string | number;\n const datum = (d.__d3plusShape__ ? d.data : d) as DataPoint;\n const transform = this._sceneTransform(d, i);\n\n // Push the hit area (if any) before the geometry so it sits behind it.\n if (this.schema.hitArea) {\n const ha = hitAreaNode(\n this.schema.hitArea, d, i, this._aes(d, i), key, datum, this._name, transform,\n );\n // Share the datum's rank so the hit area stays paired just behind its\n // own geometry (equal `z`, kept in push order by the stable sort).\n if (ha) children.push(rank ? ({...ha, z: rank[i]} as SceneNode) : ha);\n }\n\n children.push({\n ...geom,\n key,\n datum,\n index: i,\n shapeType: this._name,\n paint: this._scenePaint(d, i),\n transform,\n aria: {\n role: strOrUndef(this._nestWrapper(this.schema.role)(d, i)),\n label: strOrUndef(this._nestWrapper(this.schema.ariaLabel)(d, i)),\n },\n ...(rank ? {z: rank[i]} : {}),\n } as unknown as SceneNode);\n // backgroundImage: collect a per-datum image (see backgroundImageLayout for\n // the cover/contain fit). The wrapping group carries the shape transform,\n // so the image box + clip stay in local space.\n const bg = this._nestWrapper(this.schema.backgroundImage)(d, i) as\n | string\n | false;\n if (bg) {\n const g = geom as Record<string, unknown>;\n // Only Area/Line lack a `d`/box and need polygon points; Path/Rect/Circle\n // derive their layout from `d`/width/r directly.\n const needsPoints =\n typeof g.d !== \"string\" &&\n typeof g.width !== \"number\" &&\n typeof g.r !== \"number\";\n const points = needsPoints\n ? ((this._aes(d, i).points ?? []) as [number, number][])\n : [];\n const fit = this._nestWrapper(this.schema.backgroundImageFit)(d, i);\n const layout = backgroundImageLayout(\n g, points, fit === \"contain\" ? \"contain\" : \"cover\",\n );\n if (layout) {\n bgSpecs.push({\n key,\n index: i,\n datum,\n url: bg,\n box: layout.box,\n clip: layout.clip,\n preserveAspectRatio: layout.preserveAspectRatio,\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n transform,\n });\n }\n }\n });\n // Emit background images AFTER shape children so they paint above the\n // shape's fill — matches the DOM order where the <image> was\n // appended as a sibling of the shape.\n if (bgSpecs.length)\n children.push(...emitBackgroundImages(bgSpecs, rank, data.length));\n // NOTE: Labels are NOT pushed here. The canonical aggregation point is\n // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`\n // AND `shape._labelClass.toScene()` independently. Pushing labels here\n // too would emit them twice in every chart that calls collectComputed\n // (Pie/Donut/Pack/Treemap/Network/Priestley/Radar/RadialMatrix/Geomap…).\n // Standalone shape.render() consumers (no collectComputed wrapper) get\n // labels through Shape.render's own SvgRenderer path below.\n return {type: \"group\", key: `${this._name}-group`, children};\n }\n\n render(callback?: () => void): this {\n // Populate the label TextBox so toScene() reads correct label data. The\n // label class is always in compute mode — the scene path materializes text.\n const lc = this._labelClass as unknown as {renderMode?: (m: string) => unknown};\n if (lc && typeof lc.renderMode === \"function\") lc.renderMode(\"compute\");\n // Apply Shape's labelConfig (fontColor, fontResize, padding, textAnchor,\n // verticalAlign, fontSize, …) to the underlying TextBox. Function\n // accessors receive the LABEL RECORD (with `d.data` = source\n // datum, `d.l` = which label index in a multi-label-per-datum\n // setup, `d.text` = label text, etc.). That gives consumers like\n // Treemap (two labels per cell — title + share %) the context to\n // vary anchor / color / etc. based on which label they're styling.\n // Shape's default `fontColor` uses `this.schema.fill(d, i)` — since\n // `fill` is the configPrep-wrapped accessor, it unwraps `d.data`\n // back to the source datum automatically before invoking the user\n // fill function.\n this._labelClass.config(this.schema.labelConfig as Record<string, unknown>);\n this._labelClass.data(this._buildLabelData());\n\n if (this.schema.renderMode === \"compute\") {\n // A Viz pipeline is driving this shape — Viz.renderScene composes the\n // whole chart's scene itself, so don't spin up our own SvgRenderer.\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n // Standalone shape rendering: route the shape's own toScene() through\n // SvgRenderer. Preserves `new Rect().render()` ergonomics with no\n // d3-selection DOM.\n if (this._select === undefined && typeof document !== \"undefined\") {\n const div = document.createElement(\"div\");\n div.style.cssText = \"display:block;\";\n document.body.appendChild(div);\n this.select(div);\n }\n\n if (this._select) {\n const sel = this._select;\n // `_select` is a D3Selection, but the standalone path historically also\n // accepted a raw element; handle both without widening to `any`.\n const node: Element | null =\n sel && typeof sel.node === \"function\"\n ? (sel.node() as Element | null)\n : (sel as unknown as Element | null);\n if (node) {\n const tag = (node.tagName || \"\").toLowerCase();\n const isSvg = tag === \"svg\";\n // Explicit numeric size first: an <svg>'s width/height attribute, or a\n // non-svg container's client box.\n const rawW = isSvg ? Number(node.getAttribute(\"width\")) : (node as HTMLElement).clientWidth;\n const rawH = isSvg ? Number(node.getAttribute(\"height\")) : (node as HTMLElement).clientHeight;\n // When that isn't a usable number — e.g. width=\"100%\" (Number → NaN)\n // or a 0-size box — measure the container's real rendered size,\n // walking up to the first constrained ancestor. Only fall back to the\n // static 400x300 when nothing is measurable (e.g. no layout in jsdom).\n const [measuredW, measuredH] = rawW && rawH ? [rawW, rawH] : getSize(node as HTMLElement);\n const width = rawW || measuredW || 400;\n const height = rawH || measuredH || 300;\n // Combine the shape's scene + label children. toScene() deliberately\n // omits labels (collectComputed is the canonical aggregator for the\n // chart pipeline); for the standalone render() path we add them here\n // so `new Rect().data(...).render()` still produces label text.\n const shapeGroup = this.toScene();\n const labelChildren: SceneNode[] = [];\n if (\n this._labelClass &&\n typeof (this._labelClass as {toScene?: unknown}).toScene === \"function\" &&\n this._labelClass._data &&\n this._labelClass._data.length\n ) {\n labelChildren.push(\n ...(this._labelClass.toScene().children as SceneNode[]),\n );\n }\n const root: GroupNode = {\n ...shapeGroup,\n children: [...shapeGroup.children, ...labelChildren],\n };\n const scene = {root, width, height};\n // Tear down any previous SvgRenderer so its DOM listeners + timers\n // are cleared instead of leaking on every re-render.\n const prev = this._sceneRenderer;\n if (prev && typeof prev.destroy === \"function\") prev.destroy();\n // Caller's element is preserved (downstream selectors still find it);\n // we mount SvgRenderer INSIDE it. When `node` is a <g> the result is\n // a nested <svg>-in-<g>, which is valid SVG but visually unusual —\n // chart code reaches this path only via the Box/Whisker full-mode\n // fallback, which is not the recommended flow (compute mode is).\n // Only wipe children when this is the FIRST time we're mounting\n // here — re-renders into the same node would otherwise destroy any\n // labels/auxiliary DOM the caller put alongside.\n if (!prev) {\n while (node.firstChild) node.removeChild(node.firstChild);\n }\n const renderer = new SvgRenderer();\n renderer.mount({container: node, width, height});\n renderer.drawScene(scene);\n this._sceneRenderer = renderer;\n }\n }\n\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n /**\n The active callback function for highlighting shapes.\n*/\n active(): ((d: DataPoint, i: number) => boolean) | null;\n active(_: ((d: DataPoint, i: number) => boolean) | null): this;\n active(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === undefined) return this.schema.active;\n this.schema.active = _;\n // v4: active/hover visuals come from the scene path's paint recomputation\n // on the next render(); no DOM mutation here.\n return this;\n }\n\n /**\n The style to apply to active shapes.\n*/\n activeStyle(): Record<string, unknown>;\n activeStyle(_: Record<string, unknown>): this;\n activeStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.activeStyle = assign({}, this.schema.activeStyle, _!)),\n this)\n : this.schema.activeStyle;\n }\n\n /**\n The data array used to create shapes. A shape will be drawn for each object in the array.\n*/\n data(): DataPoint[];\n data(_: DataPoint[]): this;\n data(_?: DataPoint[]): DataPoint[] | this {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n The hover callback function for highlighting shapes on mouseover.\n*/\n hover(): ((d: DataPoint, i: number) => boolean) | null;\n hover(_: ((d: DataPoint, i: number) => boolean) | null): this;\n hover(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === void 0) return this.schema.hover;\n this.schema.hover = _;\n // v4: hover dim comes from the scene path's paint recomputation; no DOM here.\n return this;\n }\n\n /**\n The style to apply to hovered shapes.\n*/\n hoverStyle(): Record<string, unknown>;\n hoverStyle(_: Record<string, unknown>): this;\n hoverStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.hoverStyle = assign({}, this.schema.hoverStyle, _!)), this)\n : this.schema.hoverStyle;\n }\n\n /**\n A pass-through to the config method of the TextBox class used to create a shape's labels.\n*/\n labelConfig(): Record<string, unknown>;\n labelConfig(_: Record<string, unknown>): this;\n labelConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.labelConfig = assign(this.schema.labelConfig, _!)), this)\n : this.schema.labelConfig;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement | SVGElement | null): this;\n select(_?: string | HTMLElement | SVGElement | null): D3Selection | this {\n return arguments.length\n ? ((this._select = select(_ as string) as unknown as D3Selection), this)\n : this._select;\n }\n\n /**\n A comparator function used to sort shapes for layering order.\n*/\n sort(): ((a: DataPoint, b: DataPoint) => number) | null;\n sort(_: ((a: DataPoint, b: DataPoint) => number) | null): this;\n sort(\n _?: ((a: DataPoint, b: DataPoint) => number) | null,\n ): ((a: DataPoint, b: DataPoint) => number) | null | this {\n return arguments.length\n ? ((this.schema.sort = _ ?? null), this)\n : this.schema.sort;\n }\n\n /**\n A series of global texture methods to be used for all textures (ie. `{stroke: \"darkorange\", strokeWidth: 2}`).\n*/\n textureDefault(): Record<string, unknown>;\n textureDefault(_: Record<string, unknown>): this;\n textureDefault(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.textureDefault = assign(this.schema.textureDefault, _!)),\n this)\n : this.schema.textureDefault;\n }\n\n /**\n Narrowed `.config()` for Shape. Inherited surface from\n `BaseClass.config()`; the override exists only to surface per-shape\n keys (e.g. `width`/`height` for Rect) in autocomplete + type checks.\n */\n config(): BaseShapeConfig;\n config(_: Partial<BaseShapeConfig>): this;\n config(_?: Partial<BaseShapeConfig>): BaseShapeConfig | this {\n if (!arguments.length) return super.config() as BaseShapeConfig;\n super.config(_ as D3plusConfig);\n return this;\n }\n}\n"],"names":["color","select","colorContrast","assign","getSize","isObject","SvgRenderer","TextBox","accessor","BaseClass","constant","installFluent","buildLabelData","hitAreaNode","numOrUndef","v","n","Number","isFinite","undefined","strOrUndef","String","parseDash","parts","split","map","filter","length","backgroundImageLayout","emitBackgroundImages","sortRanks","shapeSchema","key","coerce","default","d","i","id","Shape","tagName","_data","_labelClass","_name","_tagName","_textureDefs","_select","_transition","_group","_update","_enter","_exit","_hoverGroup","_activeGroup","_path","_sceneRenderer","schema","stroke","c","fill","darker","formatHex","activeStyle","includes","col","s","strokeWidth","hoverStyle","labelConfig","fontColor","fontOpacity","opacity","fontResize","fontMax","fontMin","fontSize","padding","textAnchor","verticalAlign","textureDefault","_aes","_d","_i","_getTextureKey","textureVal","texture","styleLogic","_","nested","values","indexOf","fallback","background","pathNames","orientation","retObj","size","JSON","stringify","_nestWrapper","method","__d3plusShape__","data","_buildLabelData","dataFilter","_dataFilter","bind","label","labelBounds","x","y","aes","rotate","_styleVal","fn","first","_sceneTransform","wrapped","Boolean","dd","ii","translate","tx","ty","scale","_scenePaint","textureKey","fillOpacity","strokeOpacity","strokeDasharray","strokeLinecap","vectorEffect","shapeRendering","_sceneGeometry","toScene","children","bgSpecs","rank","sort","forEach","geom","datum","transform","hitArea","ha","push","z","index","shapeType","paint","aria","role","ariaLabel","bg","backgroundImage","g","needsPoints","width","r","points","fit","backgroundImageFit","layout","url","box","clip","preserveAspectRatio","type","render","callback","lc","renderMode","config","setTimeout","document","div","createElement","style","cssText","body","appendChild","sel","node","tag","toLowerCase","isSvg","rawW","getAttribute","clientWidth","rawH","clientHeight","measuredW","measuredH","height","shapeGroup","labelChildren","root","scene","prev","destroy","firstChild","removeChild","renderer","mount","container","drawScene","active","arguments","hover"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAC/B,SAAQC,MAAM,QAAO,eAAe;AAGpC,SAAQC,aAAa,QAAO,gBAAgB;AAE5C,SAAQC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,QAAO,cAAc;AAGtD,SAAQC,WAAW,QAAO,iBAAiB;AAG3C,SAAQC,OAAO,QAAO,yBAAyB;AAC/C,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAO,oBAAoB;AAEhE,SAAQC,aAAa,QAAO,eAAe;AAE3C,SAAQC,cAAc,QAAO,sBAAsB;AACnD,SAAQC,WAAW,QAAO,mBAAmB;AAG7C,+DAA+D,GAC/D,OAAO,SAASC,WAAWC,CAAU;IACnC,IAAMC,IAAIC,OAAOF;IACjB,OAAOE,OAAOC,QAAQ,CAACF,KAAKA,IAAIG;AAClC;AAEA,uDAAuD,GACvD,OAAO,SAASC,WAAWL,CAAU;IACnC,OAAOA,KAAK,QAAQA,MAAM,KAAKI,YAAYE,OAAON;AACpD;AAEA,4EAA4E,GAC5E,OAAO,SAASO,UAAUP,CAAU;IAClC,IAAIA,KAAK,QAAQA,MAAM,UAAUA,MAAM,IAAI,OAAOI;IAClD,IAAI,OAAOJ,MAAM,UAAU,OAAO;QAACA;KAAE;IACrC,IAAMQ,QAAQF,OAAON,GAClBS,KAAK,CAAC,UACNC,G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AI,CAACoD,MAAM,CAACY,WAAW,EAAEmB,IAAM,IAAI,AAAD,IACrE,IAAI,CAAC/B,MAAM,CAACY,WAAW;YAC7B;;;YAOAlE,KAAAA;mBAAAA,SAAAA,QAAOqF,CAA4C;gBACjD,OAAOwH,UAAUnL,MAAM,GAClB,CAAA,AAAC,IAAI,CAACkB,OAAO,GAAG5C,OAAOqF,IAAyC,IAAI,AAAD,IACpE,IAAI,CAACzC,OAAO;YAClB;;;YAOA4F,KAAAA;mBAAAA,SAAAA,KACEnD,CAAmD;gBAEnD,OAAOwH,UAAUnL,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC4B,MAAM,CAACkF,IAAI,GAAGnD,cAAAA,eAAAA,IAAK,MAAO,IAAI,AAAD,IACpC,IAAI,CAAC/B,MAAM,CAACkF,IAAI;YACtB;;;YAOA3D,KAAAA;mBAAAA,SAAAA,eAAeQ,CAA2B;gBACxC,OAAOwH,UAAUnL,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC4B,MAAM,CAACuB,cAAc,GAAG3E,OAAO,IAAI,CAACoD,MAAM,CAACuB,cAAc,EAAEQ,IAClE,IAAI,AAAD,IACH,IAAI,CAAC/B,MAAM,CAACuB,cAAc;YAChC;;;YASA6F,KAAAA;mBAAAA,SAAAA,OAAOrF,CAA4B;gBACjC,IAAI,CAACwH,UAAUnL,MAAM,EAAE,OAAO,uBA1nBbW,kBA0nBmBqI,UAAN,IAAK;gBACnC,uBA3nBiBrI,kBA2nBXqI,UAAN,IAAK,aAAQrF;gBACb,OAAO,IAAI;YACb;;;WA7nBmBhD;EAAc7B;AAHnC;;AAEA,GACA,SAAqB6B,mBA8nBpB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/shapes/Shape.ts"],"sourcesContent":["import {color} from \"d3-color\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport {colorContrast} from \"@d3plus/color\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {assign, getSize, isObject} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {SvgRenderer} from \"@d3plus/render\";\nimport type {GroupNode, Paint, SceneNode, Transform} from \"@d3plus/render\";\n\nimport {TextBox} from \"../components/index.js\";\nimport {accessor, BaseClass, constant} from \"../utils/index.js\";\nimport type {AccessorFn, D3plusConfig} from \"../utils/index.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\nimport {buildLabelData} from \"./buildLabelData.js\";\nimport {hitAreaNode} from \"./hitAreaNode.js\";\nimport {interactionPoints} from \"./interactionPoints.js\";\nimport type {BaseShapeConfig} from \"./shapeConfig.js\";\n\n/** Coerces a value to a finite number, or undefined. @private */\nexport function numOrUndef(v: unknown): number | undefined {\n const n = Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** Returns a non-empty string, or undefined. @private */\nexport function strOrUndef(v: unknown): string | undefined {\n return v == null || v === \"\" ? undefined : String(v);\n}\n\n/** Parses an SVG stroke-dasharray value into an array of numbers. @private */\nexport function parseDash(v: unknown): number[] | undefined {\n if (v == null || v === \"none\" || v === \"\") return undefined;\n if (typeof v === \"number\") return [v];\n const parts = String(v)\n .split(/[\\s,]+/)\n .map(Number)\n .filter(n => Number.isFinite(n));\n return parts.length ? parts : undefined;\n}\n\nexport interface ShapeAes {\n width?: number;\n height?: number;\n points?: [number, number][];\n r?: number;\n x?: number;\n y?: number;\n}\n\n\nimport {\n backgroundImageLayout,\n emitBackgroundImages,\n sortRanks,\n type BackgroundImageSpec,\n} from \"./sceneSort.js\";\n\n/** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst shapeSchema: ConfigField[] = [\n {key: \"activeOpacity\", coerce: \"identity\", default: 0.25},\n {key: \"ariaLabel\", coerce: \"const\", default: constant(\"\")},\n {key: \"backgroundImage\", coerce: \"const\", default: constant(false)},\n {key: \"backgroundImageFit\", coerce: \"const\", default: constant(\"cover\")},\n {key: \"discrete\", coerce: \"identity\"},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"fill\", coerce: \"const\", default: constant(\"black\")},\n {key: \"fillOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"hitArea\", coerce: \"const\"},\n {key: \"hoverOpacity\", coerce: \"identity\", default: 0.5},\n {\n key: \"id\",\n coerce: \"accessor\",\n default: (d: DataPoint, i?: number) => (d.id !== void 0 ? d.id : i!),\n },\n {key: \"label\", coerce: \"const\", default: constant(false)},\n {key: \"labelBounds\", coerce: \"const\"},\n {key: \"opacity\", coerce: \"const\", default: constant(1)},\n {key: \"pointerEvents\", coerce: \"const\", default: constant(\"visiblePainted\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"role\", coerce: \"const\", default: constant(\"presentation\")},\n {key: \"rotate\", coerce: \"const\", default: constant(0)},\n {key: \"rx\", coerce: \"const\", default: constant(0)},\n {key: \"ry\", coerce: \"const\", default: constant(0)},\n {key: \"scale\", coerce: \"const\", default: constant(1)},\n {key: \"shapeRendering\", coerce: \"const\", default: constant(\"geometricPrecision\")},\n {key: \"stroke\", coerce: \"const\"},\n {key: \"strokeDasharray\", coerce: \"const\", default: constant(\"0\")},\n {key: \"strokeLinecap\", coerce: \"const\", default: constant(\"butt\")},\n {key: \"strokeOpacity\", coerce: \"const\", default: constant(1)},\n {key: \"strokeWidth\", coerce: \"const\", default: constant(0)},\n {key: \"textAnchor\", coerce: \"const\", default: constant(\"start\")},\n {key: \"texture\", coerce: \"const\", default: constant(false)},\n {key: \"vectorEffect\", coerce: \"const\", default: constant(\"non-scaling-stroke\")},\n {key: \"verticalAlign\", coerce: \"const\", default: constant(\"top\")},\n // \"accessor\" (not \"const\"): a string names a data key (`.x(\"year\")`), a\n // number is a constant (`.x(50)`), and a function passes through — so a\n // standalone shape given string accessors (as the pipeline never does, but\n // direct users do) reads the field instead of treating \"x\" as the literal.\n {key: \"x\", coerce: \"accessor\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"accessor\", default: accessor(\"y\", 0)},\n];\n\n/**\n An abstracted class for generating shapes.\n*/\nexport default class Shape extends BaseClass {\n // installFluent generates the config accessors (fill, x, id, …) at runtime;\n // the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n\n _data: DataPoint[];\n _labelClass: TextBox;\n _name: string;\n _tagName: string;\n _textureDefs: Record<string, Record<string, unknown>>;\n _select!: D3Selection;\n _transition!: ReturnType<typeof transition>;\n /** @param data The raw data array to filter. */\n _dataFilter?(data: DataPoint[]): DataPoint[];\n _group!: D3Selection;\n _update!: D3Selection;\n _enter!: D3Selection;\n _exit!: D3Selection;\n _hoverGroup!: D3Selection;\n _activeGroup!: D3Selection;\n _path!: Record<string, unknown>;\n /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */\n _sceneRenderer?: SvgRenderer;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor(tagName: string = \"g\") {\n super();\n\n installFluent(this, shapeSchema);\n\n this._data = [];\n this._labelClass = new TextBox();\n this._name = \"Shape\";\n this._tagName = tagName;\n this._textureDefs = {};\n\n // stroke defaults to a darker shade of fill — closes over `this.schema`\n // so it tracks the current fill accessor. A fill that doesn't parse as a\n // color (e.g. \"none\"/\"transparent\", a gradient token) has no darker shade,\n // so fall back to the fill value itself.\n this.schema.stroke = (d: DataPoint, i?: number) => {\n const c = color(this.schema.fill(d, i) as string);\n return c ? c.darker(1).formatHex() : (this.schema.fill(d, i) as string);\n };\n\n this.schema.activeStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(1) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 3;\n },\n };\n this.schema.hoverStyle = {\n stroke: (d: DataPoint, i: number) => {\n let c = this.schema.fill(d, i) as string;\n if ([\"transparent\", \"none\"].includes(c))\n c = this.schema.stroke(d, i) as string;\n const col = color(c);\n return col ? col.darker(0.5) : c;\n },\n \"stroke-width\": (d: DataPoint, i: number) => {\n const s = (this.schema.strokeWidth(d, i) as number) || 1;\n return s * 2;\n },\n };\n // Shape's label defaults. These are pushed to `_labelClass` via\n // `_labelClass.config(this.schema.labelConfig)` in render() so the\n // TextBox actually picks them up.\n // textAnchor defaults to \"start\" (left-aligned) — Treemap, Pie,\n // etc. rely on this. Bar overrides to \"middle\" in its constructor.\n this.schema.labelConfig = {\n fontColor: (d: DataPoint, i: number) =>\n colorContrast(this.schema.fill(d, i) as string),\n // Fade labels with their shape's opacity (e.g. an axis tick label hides\n // when `shapeConfig.opacity` is 0). Reads `this.schema.opacity` live —\n // like `fontColor` reads `fill` — which unwraps nested label data.\n fontOpacity: (d: DataPoint, i: number) =>\n this.schema.opacity(d, i) as number,\n fontResize: true,\n fontMax: 50,\n fontMin: 8,\n fontSize: 12,\n padding: 5,\n textAnchor: \"start\",\n verticalAlign: \"top\",\n };\n this.schema.textureDefault = {};\n }\n\n /**\n Given a specific data point and index, returns the aesthetic properties of the shape.\n @param data point*\n @param index @private\n*/\n _aes(_d?: DataPoint, _i?: number): ShapeAes {\n return {};\n }\n\n\n /**\n Returns a full JSON string of the texture config for a given data point.\n\n @private\n*/\n _getTextureKey(d: DataPoint, i: number): string | false {\n const textureVal: unknown = this.schema.texture(d, i);\n if (!textureVal) return false;\n\n /**\n Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.\n @private\n*/\n const styleLogic = (_: unknown): unknown => {\n return typeof _ !== \"function\"\n ? _\n : d.nested && d.key && d.values\n ? (_ as AccessorFn)(\n (d.values as unknown as DataPoint[])[0],\n this._data.indexOf((d.values as unknown as DataPoint[])[0]),\n )\n : (_ as AccessorFn)(d, i);\n };\n\n const fallback = this.schema.textureDefault;\n\n let texture: Record<string, unknown>;\n if (!isObject(textureVal))\n texture = {texture: textureVal} as Record<string, unknown>;\n else texture = textureVal as Record<string, unknown>;\n if (!texture.background) texture.background = styleLogic(this.schema.fill);\n if (!texture.stroke && !fallback.stroke)\n texture.stroke = styleLogic(this.schema.stroke);\n const pathNames = [\n \"squares\",\n \"nylon\",\n \"waves\",\n \"woven\",\n \"crosses\",\n \"caps\",\n \"hexagons\",\n ];\n if (\n pathNames.includes(texture.texture as string) ||\n typeof texture.texture === \"function\"\n ) {\n texture.d = texture.texture;\n texture.texture = \"paths\";\n } else if (texture.texture === \"grid\") {\n if (!texture.orientation && !fallback.orientation)\n texture.orientation = [\"vertical\", \"horizontal\"];\n texture.texture = \"lines\";\n }\n if (!texture.fill && texture.texture !== \"paths\")\n texture.fill = texture.stroke;\n const retObj = assign({}, fallback, texture);\n if (typeof retObj.d === \"function\") {\n retObj.d = retObj.d(retObj.size || 20);\n }\n return JSON.stringify(retObj);\n }\n\n /**\n Checks for nested data and uses the appropriate variables for accessor functions.\n @param elem @private\n*/\n _nestWrapper(\n method: AccessorFn,\n ): (d: DataPoint, i: number) => DataPoint[keyof DataPoint] {\n return (d: DataPoint, i: number) =>\n method(\n d.__d3plusShape__ ? (d.data as DataPoint) : d,\n d.__d3plusShape__ ? (d.i as number) : i,\n );\n }\n\n\n /**\n Adds labels to each shape group.\n @private\n*/\n _buildLabelData(): DataPoint[] {\n // Delegates to the pure `buildLabelData()` helper. The helper\n // takes the same inputs `this` exposes but works without a Shape\n // instance — emit functions or other callers that need only the\n // label-record layout can call it directly without instantiating\n // a Shape in compute mode.\n // All Shape methods bound to `this` before handing them to the pure\n // helper — subclasses (e.g. Line._dataFilter) reach for `this.schema.id`\n // and friends inside their bodies.\n return buildLabelData({\n data: this._data,\n dataFilter: this._dataFilter ? this._dataFilter.bind(this) : undefined,\n label: this.schema.label,\n labelBounds: this.schema.labelBounds\n ? this.schema.labelBounds.bind(this)\n : undefined,\n x: this.schema.x,\n y: this.schema.y,\n aes: this._aes.bind(this),\n rotate: this.schema.rotate,\n id: this.schema.id,\n });\n }\n\n\n /**\n Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.\n @param callback Optional callback invoked after rendering completes.\n*/\n /**\n Resolves a style accessor. For a nested shape (Line/Area) the accessor gets\n the merged aggregate `d.data`/`d.i` — matching `_nestWrapper` + scene datum.\n @private\n*/\n _styleVal(fn: unknown, d: DataPoint, i: number): unknown {\n if (typeof fn !== \"function\") return fn;\n if (d.nested && d.key && d.values)\n return (fn as AccessorFn)(d.data as DataPoint, d.i as number);\n return (fn as AccessorFn)(d, i);\n }\n\n /**\n Builds the resolved Transform for a data point, mirroring _applyTransform.\n @private\n*/\n _sceneTransform(d: DataPoint, i: number): Transform {\n const wrapped = Boolean(d.__d3plusShape__);\n const dd = (wrapped ? d.data : d) as DataPoint;\n const ii = wrapped ? (d.i as number) : i;\n let x: number, y: number;\n if (wrapped && d.translate) {\n const [tx, ty] = String(d.translate).split(\",\").map(Number);\n x = tx;\n y = ty;\n } else {\n x = Number(this.schema.x(dd, ii));\n y = Number(this.schema.y(dd, ii));\n }\n const scale =\n wrapped && d.scale !== undefined\n ? Number(d.scale)\n : Number(this.schema.scale(dd, ii));\n const rotate =\n wrapped && d.rotate !== undefined\n ? Number(d.rotate)\n : Number(this.schema.rotate((d.data || d) as DataPoint, ii));\n return {x, y, scale, rotate};\n }\n\n /**\n Builds the resolved Paint for a data point, mirroring _applyStyle.\n Texture fills are encoded as a stable \"pattern:<key>\" token at this\n layer; the backend renderers (`SvgRenderer._resolveFill`,\n `CanvasRenderer._resolveFill`) materialize them into a real SVG\n pattern or a Canvas image pattern. The two-stage resolve is\n intentional — Shapes stay backend-free, and texture\n materialization happens once per renderer instead of per-shape.\n @private\n*/\n _scenePaint(d: DataPoint, i: number): Paint {\n // A texture resolves to a stable \"pattern:<key>\" token (the same JSON config\n // render() uses); each backend materializes or degrades it.\n const textureKey = this._getTextureKey(d, i);\n return {\n fill: textureKey\n ? `pattern:${textureKey}`\n : strOrUndef(this._styleVal(this.schema.fill, d, i)),\n fillOpacity: numOrUndef(this._styleVal(this.schema.fillOpacity, d, i)),\n stroke: strOrUndef(this._styleVal(this.schema.stroke, d, i)),\n strokeWidth: numOrUndef(this._styleVal(this.schema.strokeWidth, d, i)),\n strokeOpacity: numOrUndef(this._styleVal(this.schema.strokeOpacity, d, i)),\n strokeDasharray: parseDash(\n this._styleVal(this.schema.strokeDasharray, d, i),\n ),\n strokeLinecap: strOrUndef(\n this._styleVal(this.schema.strokeLinecap, d, i),\n ) as Paint[\"strokeLinecap\"],\n vectorEffect: strOrUndef(\n this._styleVal(this.schema.vectorEffect, d, i),\n ) as Paint[\"vectorEffect\"],\n shapeRendering: strOrUndef(\n this._nestWrapper(this.schema.shapeRendering)(d, i),\n ),\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n };\n }\n\n /**\n Returns the geometry-specific scene fields for a data point. Overridden by\n each shape subclass; the base provides none.\n @private\n*/\n _sceneGeometry(_d: DataPoint, _i: number): Record<string, unknown> | null {\n return null;\n }\n\n /**\n Produces a backend-agnostic scene graph for this shape's data, reusing the\n same accessors render() applies to the DOM. This is the migration seam toward\n the @d3plus/render pluggable backends; it has no effect on render().\n*/\n toScene(): GroupNode {\n let data: DataPoint[] & {key?: AccessorFn} = this._data;\n if (this._dataFilter)\n data = this._dataFilter(data) as DataPoint[] & {key?: AccessorFn};\n const children: SceneNode[] = [];\n // Collected background images, emitted below (after the geometry) as clipped,\n // transformed groups. Each datum whose `backgroundImage(d, i)` resolves to a\n // truthy URL contributes one spec.\n const bgSpecs: BackgroundImageSpec[] = [];\n // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of\n // `data`: the render backends sort each group's children ascending by `z`\n // (stably), so a lower rank paints first (behind) and a higher rank paints\n // last (on top) — the same back-to-front meaning `.sort()` has always had,\n // without disturbing the keyed data-join order that drives transitions.\n const rank = sortRanks(\n data,\n this.schema.sort as ((a: DataPoint, b: DataPoint) => number) | null,\n );\n data.forEach((d, i) => {\n const geom = this._sceneGeometry(d, i);\n if (!geom) return;\n const key = this._nestWrapper(this.schema.id)(d, i) as string | number;\n const datum = (d.__d3plusShape__ ? d.data : d) as DataPoint;\n const transform = this._sceneTransform(d, i);\n\n // Per-point positions (Line/Area) shared by the geometry and its hit area\n // so a hover anywhere on either resolves to the nearest point.\n const iPoints = interactionPoints(d, this.schema.x, this.schema.y, this.schema.defined);\n // Push the hit area (if any) before the geometry so it sits behind it.\n // Line's is a fat path built from the geometry `d`; Bar/legend etc. a rect.\n if (this.schema.hitArea) {\n const ha = hitAreaNode(this.schema.hitArea, d, i, this._aes(d, i), key, datum, this._name, transform, geom.d as string);\n // Share the datum's rank so the hit area stays paired just behind its\n // own geometry (equal `z`, kept in push order by the stable sort).\n if (ha) children.push(rank ? ({...ha, ...iPoints, z: rank[i]} as SceneNode) : ({...ha, ...iPoints} as SceneNode));\n }\n\n children.push({\n ...geom,\n key,\n datum,\n index: i,\n shapeType: this._name,\n paint: this._scenePaint(d, i),\n transform,\n aria: {\n role: strOrUndef(this._nestWrapper(this.schema.role)(d, i)),\n label: strOrUndef(this._nestWrapper(this.schema.ariaLabel)(d, i)),\n },\n ...iPoints,\n ...(rank ? {z: rank[i]} : {}),\n } as unknown as SceneNode);\n // backgroundImage: collect a per-datum image (see backgroundImageLayout for\n // the cover/contain fit). The wrapping group carries the shape transform,\n // so the image box + clip stay in local space.\n const bg = this._nestWrapper(this.schema.backgroundImage)(d, i) as\n | string\n | false;\n if (bg) {\n const g = geom as Record<string, unknown>;\n // Only Area/Line lack a `d`/box and need polygon points; Path/Rect/Circle\n // derive their layout from `d`/width/r directly.\n const needsPoints =\n typeof g.d !== \"string\" &&\n typeof g.width !== \"number\" &&\n typeof g.r !== \"number\";\n const points = needsPoints\n ? ((this._aes(d, i).points ?? []) as [number, number][])\n : [];\n const fit = this._nestWrapper(this.schema.backgroundImageFit)(d, i);\n const layout = backgroundImageLayout(\n g, points, fit === \"contain\" ? \"contain\" : \"cover\",\n );\n if (layout) {\n bgSpecs.push({\n key,\n index: i,\n datum,\n url: bg,\n box: layout.box,\n clip: layout.clip,\n preserveAspectRatio: layout.preserveAspectRatio,\n opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i)),\n transform,\n });\n }\n }\n });\n // Emit background images AFTER shape children so they paint above the\n // shape's fill — matches the DOM order where the <image> was\n // appended as a sibling of the shape.\n if (bgSpecs.length)\n children.push(...emitBackgroundImages(bgSpecs, rank, data.length));\n // NOTE: Labels are NOT pushed here. The canonical aggregation point is\n // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`\n // AND `shape._labelClass.toScene()` independently. Pushing labels here\n // too would emit them twice in every chart that calls collectComputed\n // (Pie/Donut/Pack/Treemap/Network/Priestley/Radar/RadialMatrix/Geomap…).\n // Standalone shape.render() consumers (no collectComputed wrapper) get\n // labels through Shape.render's own SvgRenderer path below.\n return {type: \"group\", key: `${this._name}-group`, children};\n }\n\n render(callback?: () => void): this {\n // Populate the label TextBox so toScene() reads correct label data. The\n // label class is always in compute mode — the scene path materializes text.\n const lc = this._labelClass as unknown as {renderMode?: (m: string) => unknown};\n if (lc && typeof lc.renderMode === \"function\") lc.renderMode(\"compute\");\n // Apply Shape's labelConfig (fontColor, fontResize, padding, textAnchor,\n // verticalAlign, fontSize, …) to the underlying TextBox. Function\n // accessors receive the LABEL RECORD (with `d.data` = source\n // datum, `d.l` = which label index in a multi-label-per-datum\n // setup, `d.text` = label text, etc.). That gives consumers like\n // Treemap (two labels per cell — title + share %) the context to\n // vary anchor / color / etc. based on which label they're styling.\n // Shape's default `fontColor` uses `this.schema.fill(d, i)` — since\n // `fill` is the configPrep-wrapped accessor, it unwraps `d.data`\n // back to the source datum automatically before invoking the user\n // fill function.\n this._labelClass.config(this.schema.labelConfig as Record<string, unknown>);\n this._labelClass.data(this._buildLabelData());\n\n if (this.schema.renderMode === \"compute\") {\n // A Viz pipeline is driving this shape — Viz.renderScene composes the\n // whole chart's scene itself, so don't spin up our own SvgRenderer.\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n // Standalone shape rendering: route the shape's own toScene() through\n // SvgRenderer. Preserves `new Rect().render()` ergonomics with no\n // d3-selection DOM.\n if (this._select === undefined && typeof document !== \"undefined\") {\n const div = document.createElement(\"div\");\n div.style.cssText = \"display:block;\";\n document.body.appendChild(div);\n this.select(div);\n }\n\n if (this._select) {\n const sel = this._select;\n // `_select` is a D3Selection, but the standalone path historically also\n // accepted a raw element; handle both without widening to `any`.\n const node: Element | null =\n sel && typeof sel.node === \"function\"\n ? (sel.node() as Element | null)\n : (sel as unknown as Element | null);\n if (node) {\n const tag = (node.tagName || \"\").toLowerCase();\n const isSvg = tag === \"svg\";\n // Explicit numeric size first: an <svg>'s width/height attribute, or a\n // non-svg container's client box.\n const rawW = isSvg ? Number(node.getAttribute(\"width\")) : (node as HTMLElement).clientWidth;\n const rawH = isSvg ? Number(node.getAttribute(\"height\")) : (node as HTMLElement).clientHeight;\n // When that isn't a usable number — e.g. width=\"100%\" (Number → NaN)\n // or a 0-size box — measure the container's real rendered size,\n // walking up to the first constrained ancestor. Only fall back to the\n // static 400x300 when nothing is measurable (e.g. no layout in jsdom).\n const [measuredW, measuredH] = rawW && rawH ? [rawW, rawH] : getSize(node as HTMLElement);\n const width = rawW || measuredW || 400;\n const height = rawH || measuredH || 300;\n // Combine the shape's scene + label children. toScene() deliberately\n // omits labels (collectComputed is the canonical aggregator for the\n // chart pipeline); for the standalone render() path we add them here\n // so `new Rect().data(...).render()` still produces label text.\n const shapeGroup = this.toScene();\n const labelChildren: SceneNode[] = [];\n if (\n this._labelClass &&\n typeof (this._labelClass as {toScene?: unknown}).toScene === \"function\" &&\n this._labelClass._data &&\n this._labelClass._data.length\n ) {\n labelChildren.push(\n ...(this._labelClass.toScene().children as SceneNode[]),\n );\n }\n const root: GroupNode = {\n ...shapeGroup,\n children: [...shapeGroup.children, ...labelChildren],\n };\n const scene = {root, width, height};\n // Tear down any previous SvgRenderer so its DOM listeners + timers\n // are cleared instead of leaking on every re-render.\n const prev = this._sceneRenderer;\n if (prev && typeof prev.destroy === \"function\") prev.destroy();\n // Caller's element is preserved (downstream selectors still find it);\n // we mount SvgRenderer INSIDE it. When `node` is a <g> the result is\n // a nested <svg>-in-<g>, which is valid SVG but visually unusual —\n // chart code reaches this path only via the Box/Whisker full-mode\n // fallback, which is not the recommended flow (compute mode is).\n // Only wipe children when this is the FIRST time we're mounting\n // here — re-renders into the same node would otherwise destroy any\n // labels/auxiliary DOM the caller put alongside.\n if (!prev) {\n while (node.firstChild) node.removeChild(node.firstChild);\n }\n const renderer = new SvgRenderer();\n renderer.mount({container: node, width, height});\n renderer.drawScene(scene);\n this._sceneRenderer = renderer;\n }\n }\n\n if (callback) setTimeout(callback, 0);\n return this;\n }\n\n /**\n The active callback function for highlighting shapes.\n*/\n active(): ((d: DataPoint, i: number) => boolean) | null;\n active(_: ((d: DataPoint, i: number) => boolean) | null): this;\n active(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === undefined) return this.schema.active;\n this.schema.active = _;\n // v4: active/hover visuals come from the scene path's paint recomputation\n // on the next render(); no DOM mutation here.\n return this;\n }\n\n /**\n The style to apply to active shapes.\n*/\n activeStyle(): Record<string, unknown>;\n activeStyle(_: Record<string, unknown>): this;\n activeStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.activeStyle = assign({}, this.schema.activeStyle, _!)),\n this)\n : this.schema.activeStyle;\n }\n\n /**\n The data array used to create shapes. A shape will be drawn for each object in the array.\n*/\n data(): DataPoint[];\n data(_: DataPoint[]): this;\n data(_?: DataPoint[]): DataPoint[] | this {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n The hover callback function for highlighting shapes on mouseover.\n*/\n hover(): ((d: DataPoint, i: number) => boolean) | null;\n hover(_: ((d: DataPoint, i: number) => boolean) | null): this;\n hover(\n _?: ((d: DataPoint, i: number) => boolean) | null,\n ): ((d: DataPoint, i: number) => boolean) | null | this {\n if (!arguments.length || _ === void 0) return this.schema.hover;\n this.schema.hover = _;\n // v4: hover dim comes from the scene path's paint recomputation; no DOM here.\n return this;\n }\n\n /**\n The style to apply to hovered shapes.\n*/\n hoverStyle(): Record<string, unknown>;\n hoverStyle(_: Record<string, unknown>): this;\n hoverStyle(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.hoverStyle = assign({}, this.schema.hoverStyle, _!)), this)\n : this.schema.hoverStyle;\n }\n\n /**\n A pass-through to the config method of the TextBox class used to create a shape's labels.\n*/\n labelConfig(): Record<string, unknown>;\n labelConfig(_: Record<string, unknown>): this;\n labelConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.labelConfig = assign(this.schema.labelConfig, _!)), this)\n : this.schema.labelConfig;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement | SVGElement | null): this;\n select(_?: string | HTMLElement | SVGElement | null): D3Selection | this {\n return arguments.length\n ? ((this._select = select(_ as string) as unknown as D3Selection), this)\n : this._select;\n }\n\n /**\n A comparator function used to sort shapes for layering order.\n*/\n sort(): ((a: DataPoint, b: DataPoint) => number) | null;\n sort(_: ((a: DataPoint, b: DataPoint) => number) | null): this;\n sort(\n _?: ((a: DataPoint, b: DataPoint) => number) | null,\n ): ((a: DataPoint, b: DataPoint) => number) | null | this {\n return arguments.length\n ? ((this.schema.sort = _ ?? null), this)\n : this.schema.sort;\n }\n\n /**\n A series of global texture methods to be used for all textures (ie. `{stroke: \"darkorange\", strokeWidth: 2}`).\n*/\n textureDefault(): Record<string, unknown>;\n textureDefault(_: Record<string, unknown>): this;\n textureDefault(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.textureDefault = assign(this.schema.textureDefault, _!)),\n this)\n : this.schema.textureDefault;\n }\n\n /**\n Narrowed `.config()` for Shape. Inherited surface from\n `BaseClass.config()`; the override exists only to surface per-shape\n keys (e.g. `width`/`height` for Rect) in autocomplete + type checks.\n */\n config(): BaseShapeConfig;\n config(_: Partial<BaseShapeConfig>): this;\n config(_?: Partial<BaseShapeConfig>): BaseShapeConfig | this {\n if (!arguments.length) return super.config() as BaseShapeConfig;\n super.config(_ as D3plusConfig);\n return this;\n }\n}\n"],"names":["color","select","colorContrast","assign","getSize","isObject","SvgRenderer","TextBox","accessor","BaseClass","constant","installFluent","buildLabelData","hitAreaNode","interactionPoints","numOrUndef","v","n","Number","isFinite","undefined","strOrUndef","String","parseDash","parts","split","map","filter","length","backgroundImageLayout","emitBackgroundImages","sortRanks","shapeSchema","key","coerce","default","d","i","id","Shape","tagName","_data","_labelClass","_name","_tagName","_textureDefs","_select","_transition","_group","_update","_enter","_exit","_hoverGroup","_activeGroup","_path","_sceneRenderer","schema","stroke","c","fill","darker","formatHex","activeStyle","includes","col","s","strokeWidth","hoverStyle","labelConfig","fontColor","fontOpacity","opacity","fontResize","fontMax","fontMin","fontSize","padding","textAnchor","verticalAlign","textureDefault","_aes","_d","_i","_getTextureKey","textureVal","texture","styleLogic","_","nested","values","indexOf","fallback","background","pathNames","orientation","retObj","size","JSON","stringify","_nestWrapper","method","__d3plusShape__","data","_buildLabelData","dataFilter","_dataFilter","bind","label","labelBounds","x","y","aes","rotate","_styleVal","fn","_sceneTransform","wrapped","Boolean","dd","ii","translate","tx","ty","scale","_scenePaint","textureKey","fillOpacity","strokeOpacity","strokeDasharray","strokeLinecap","vectorEffect","shapeRendering","_sceneGeometry","toScene","children","bgSpecs","rank","sort","forEach","geom","datum","transform","iPoints","defined","hitArea","ha","push","z","index","shapeType","paint","aria","role","ariaLabel","bg","backgroundImage","g","needsPoints","width","r","points","fit","backgroundImageFit","layout","url","box","clip","preserveAspectRatio","type","render","callback","lc","renderMode","config","setTimeout","document","div","createElement","style","cssText","body","appendChild","sel","node","tag","toLowerCase","isSvg","rawW","getAttribute","clientWidth","rawH","clientHeight","measuredW","measuredH","height","shapeGroup","labelChildren","root","scene","prev","destroy","firstChild","removeChild","renderer","mount","container","drawScene","active","arguments","hover"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,KAAK,QAAO,WAAW;AAC/B,SAAQC,MAAM,QAAO,eAAe;AAGpC,SAAQC,aAAa,QAAO,gBAAgB;AAE5C,SAAQC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,QAAO,cAAc;AAGtD,SAAQC,WAAW,QAAO,iBAAiB;AAG3C,SAAQC,OAAO,QAAO,yBAAyB;AAC/C,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAO,oBAAoB;AAEhE,SAAQC,aAAa,QAAO,eAAe;AAE3C,SAAQC,cAAc,QAAO,sBAAsB;AACnD,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,iBAAiB,QAAO,yBAAyB;AAGzD,+DAA+D,GAC/D,OAAO,SAASC,WAAWC,CAAU;IACnC,IAAMC,IAAIC,OAAOF;IACjB,OAAOE,OAAOC,QAAQ,CAACF,KAAKA,IAAIG;AAClC;AAEA,uDAAuD,GACvD,OAAO,SAASC,WAAWL,CAAU;IACnC,OAAOA,KAAK,QAAQA,MAAM,KAAKI,YAAYE,OAAON;AACpD;AAEA,4EAA4E,GAC5E,OAAO,SAASO,UAAUP,CAAU;IAClC,IAAIA,KAAK,QAAQA,MAAM,UAAUA,MAAM,IAAI,OAAOI;IAClD,IAAI,OAAOJ,MAAM,UAAU,OAAO;QAACA;KAAE;IACrC,IAAMQ,QAAQF,OAAON,GAClBS,KAAK,CAAC,UACNC,GAAG,CAACR,QACJS,MAAM,CAACV,SAAAA;eAAK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ible geometry are siblings, and the SVG keyed join can't hold two nodes
|
|
10
10
|
under one key — sharing it made the geometry re-enter (collapse→grow) on every
|
|
11
|
-
redraw (a "pulse" on e.g. every timeline step). Returns null when no
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
redraw (a "pulse" on e.g. every timeline step). Returns null when no hitArea
|
|
12
|
+
is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses
|
|
13
|
+
the resolved geometry `d`/`transform` so the hover target overlaps the
|
|
14
|
+
visible line exactly while extending past its ~1px stroke.
|
|
15
|
+
*/ export function hitAreaNode(hitArea, d, i, aes, key, datum, name, transform, geomD) {
|
|
15
16
|
var bounds = typeof hitArea === "function" ? hitArea(d, i, aes) : hitArea;
|
|
16
|
-
if (!bounds
|
|
17
|
+
if (!bounds) return null;
|
|
18
|
+
// Path-style hitArea (Line): widen the hover target to a fat transparent
|
|
19
|
+
// stroke over the line's own geometry. `stroke: transparent` (not "none") is
|
|
20
|
+
// painted, so it hit-tests across the full width on both backends.
|
|
21
|
+
if (typeof bounds.width !== "number" && typeof geomD === "string") {
|
|
22
|
+
var sw = typeof bounds["stroke-width"] === "number" ? bounds["stroke-width"] : 10;
|
|
23
|
+
return {
|
|
24
|
+
type: "path",
|
|
25
|
+
d: geomD,
|
|
26
|
+
key: "".concat(key, "::hit"),
|
|
27
|
+
datum: datum,
|
|
28
|
+
index: i,
|
|
29
|
+
shapeType: name,
|
|
30
|
+
paint: {
|
|
31
|
+
fill: "none",
|
|
32
|
+
stroke: "transparent",
|
|
33
|
+
strokeWidth: sw,
|
|
34
|
+
vectorEffect: "non-scaling-stroke"
|
|
35
|
+
},
|
|
36
|
+
transform: transform,
|
|
37
|
+
aria: {
|
|
38
|
+
hidden: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (typeof bounds.width !== "number" || typeof bounds.height !== "number") return null;
|
|
17
43
|
return {
|
|
18
44
|
type: "rect",
|
|
19
45
|
x: typeof bounds.x === "number" ? bounds.x : -bounds.width / 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shapes/hitAreaNode.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode, Transform} from \"@d3plus/render\";\n\ntype HitArea =\n | ((d: DataPoint, i: number, aes: unknown) => Record<string, unknown>)\n | Record<string, unknown>\n | undefined;\n\n/**\n Builds the invisible, interactive \"hit area\" rect for a shape datum — a\n transparent box that can extend past the shape's own geometry (e.g. a legend\n swatch reaching across the padding to its label) so the space between them\n stays one continuous hover target instead of firing mouseleave/mouseenter as\n the pointer crosses the gap. Carries the shape's `datum` (so pointer handlers\n treat it as the same item, and the `mouseleave` same-datum suppressor bridges\n the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the\n visible geometry are siblings, and the SVG keyed join can't hold two nodes\n under one key — sharing it made the geometry re-enter (collapse→grow) on every\n redraw (a \"pulse\" on e.g. every timeline step). Returns null when no\n
|
|
1
|
+
{"version":3,"sources":["../../../src/shapes/hitAreaNode.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode, Transform} from \"@d3plus/render\";\n\ntype HitArea =\n | ((d: DataPoint, i: number, aes: unknown) => Record<string, unknown>)\n | Record<string, unknown>\n | undefined;\n\n/**\n Builds the invisible, interactive \"hit area\" rect for a shape datum — a\n transparent box that can extend past the shape's own geometry (e.g. a legend\n swatch reaching across the padding to its label) so the space between them\n stays one continuous hover target instead of firing mouseleave/mouseenter as\n the pointer crosses the gap. Carries the shape's `datum` (so pointer handlers\n treat it as the same item, and the `mouseleave` same-datum suppressor bridges\n the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the\n visible geometry are siblings, and the SVG keyed join can't hold two nodes\n under one key — sharing it made the geometry re-enter (collapse→grow) on every\n redraw (a \"pulse\" on e.g. every timeline step). Returns null when no hitArea\n is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses\n the resolved geometry `d`/`transform` so the hover target overlaps the\n visible line exactly while extending past its ~1px stroke.\n*/\nexport function hitAreaNode(\n hitArea: HitArea,\n d: DataPoint,\n i: number,\n aes: unknown,\n key: string | number,\n datum: DataPoint,\n name: string,\n transform: Transform,\n geomD?: string,\n): SceneNode | null {\n const bounds = (\n typeof hitArea === \"function\" ? hitArea(d, i, aes) : hitArea\n ) as Record<string, unknown> | null | undefined;\n if (!bounds) return null;\n // Path-style hitArea (Line): widen the hover target to a fat transparent\n // stroke over the line's own geometry. `stroke: transparent` (not \"none\") is\n // painted, so it hit-tests across the full width on both backends.\n if (typeof bounds.width !== \"number\" && typeof geomD === \"string\") {\n const sw = typeof bounds[\"stroke-width\"] === \"number\" ? (bounds[\"stroke-width\"] as number) : 10;\n return {\n type: \"path\",\n d: geomD,\n key: `${key}::hit`,\n datum,\n index: i,\n shapeType: name,\n paint: {fill: \"none\", stroke: \"transparent\", strokeWidth: sw, vectorEffect: \"non-scaling-stroke\"},\n transform,\n aria: {hidden: true},\n } as unknown as SceneNode;\n }\n if (typeof bounds.width !== \"number\" || typeof bounds.height !== \"number\")\n return null;\n return {\n type: \"rect\",\n x: typeof bounds.x === \"number\" ? bounds.x : -bounds.width / 2,\n y: typeof bounds.y === \"number\" ? bounds.y : -bounds.height / 2,\n width: bounds.width,\n height: bounds.height,\n key: `${key}::hit`,\n datum,\n index: i,\n shapeType: name,\n paint: {fill: \"transparent\"},\n transform,\n aria: {hidden: true},\n } as unknown as SceneNode;\n}\n"],"names":["hitAreaNode","hitArea","d","i","aes","key","datum","name","transform","geomD","bounds","width","sw","type","index","shapeType","paint","fill","stroke","strokeWidth","vectorEffect","aria","hidden","height","x","y"],"mappings":"AAQA;;;;;;;;;;;;;;AAcA,GACA,OAAO,SAASA,YACdC,OAAgB,EAChBC,CAAY,EACZC,CAAS,EACTC,GAAY,EACZC,GAAoB,EACpBC,KAAgB,EAChBC,IAAY,EACZC,SAAoB,EACpBC,KAAc;IAEd,IAAMC,SACJ,OAAOT,YAAY,aAAaA,QAAQC,GAAGC,GAAGC,OAAOH;IAEvD,IAAI,CAACS,QAAQ,OAAO;IACpB,yEAAyE;IACzE,6EAA6E;IAC7E,mEAAmE;IACnE,IAAI,OAAOA,OAAOC,KAAK,KAAK,YAAY,OAAOF,UAAU,UAAU;QACjE,IAAMG,KAAK,OAAOF,MAAM,CAAC,eAAe,KAAK,WAAYA,MAAM,CAAC,eAAe,GAAc;QAC7F,OAAO;YACLG,MAAM;YACNX,GAAGO;YACHJ,KAAK,AAAC,GAAM,OAAJA,KAAI;YACZC,OAAAA;YACAQ,OAAOX;YACPY,WAAWR;YACXS,OAAO;gBAACC,MAAM;gBAAQC,QAAQ;gBAAeC,aAAaP;gBAAIQ,cAAc;YAAoB;YAChGZ,WAAAA;YACAa,MAAM;gBAACC,QAAQ;YAAI;QACrB;IACF;IACA,IAAI,OAAOZ,OAAOC,KAAK,KAAK,YAAY,OAAOD,OAAOa,MAAM,KAAK,UAC/D,OAAO;IACT,OAAO;QACLV,MAAM;QACNW,GAAG,OAAOd,OAAOc,CAAC,KAAK,WAAWd,OAAOc,CAAC,GAAG,CAACd,OAAOC,KAAK,GAAG;QAC7Dc,GAAG,OAAOf,OAAOe,CAAC,KAAK,WAAWf,OAAOe,CAAC,GAAG,CAACf,OAAOa,MAAM,GAAG;QAC9DZ,OAAOD,OAAOC,KAAK;QACnBY,QAAQb,OAAOa,MAAM;QACrBlB,KAAK,AAAC,GAAM,OAAJA,KAAI;QACZC,OAAAA;QACAQ,OAAOX;QACPY,WAAWR;QACXS,OAAO;YAACC,MAAM;QAAa;QAC3BT,WAAAA;QACAa,MAAM;YAACC,QAAQ;QAAI;IACrB;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
For a nested shape datum (Line/Area, whose datum wraps many points) returns a
|
|
3
|
+
spreadable scene-node fragment carrying each point's content-space position
|
|
4
|
+
paired with its source datum, so the pointer bridge can report the point
|
|
5
|
+
nearest the cursor rather than the whole-series aggregate. Points the
|
|
6
|
+
`defined` accessor rejects, or whose position isn't finite (a missing value),
|
|
7
|
+
are skipped — so the nearest match is always a real, defined point. Returns
|
|
8
|
+
an empty object for non-nested data (spreads to nothing).
|
|
9
|
+
*/ export function interactionPoints(d, x, y, defined) {
|
|
10
|
+
if (!d.__d3plusShape__ || !Array.isArray(d.values)) return {};
|
|
11
|
+
var values = d.values;
|
|
12
|
+
var points = [];
|
|
13
|
+
values.forEach(function(v, k) {
|
|
14
|
+
if (typeof defined === "function" && defined(v, k) === false) return;
|
|
15
|
+
var px = Number(x(v, k));
|
|
16
|
+
var py = Number(y(v, k));
|
|
17
|
+
if (!Number.isFinite(px) || !Number.isFinite(py)) return;
|
|
18
|
+
points.push({
|
|
19
|
+
x: px,
|
|
20
|
+
y: py,
|
|
21
|
+
datum: v,
|
|
22
|
+
index: typeof v.i === "number" ? v.i : k
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return points.length ? {
|
|
26
|
+
interactionPoints: points
|
|
27
|
+
} : {};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=interactionPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/shapes/interactionPoints.ts"],"sourcesContent":["import type {DataPoint} from \"@d3plus/data\";\nimport type {InteractionPoint} from \"@d3plus/render\";\nimport type {AccessorFn} from \"../utils/index.js\";\n\n/**\n For a nested shape datum (Line/Area, whose datum wraps many points) returns a\n spreadable scene-node fragment carrying each point's content-space position\n paired with its source datum, so the pointer bridge can report the point\n nearest the cursor rather than the whole-series aggregate. Points the\n `defined` accessor rejects, or whose position isn't finite (a missing value),\n are skipped — so the nearest match is always a real, defined point. Returns\n an empty object for non-nested data (spreads to nothing).\n*/\nexport function interactionPoints(\n d: DataPoint,\n x: AccessorFn,\n y: AccessorFn,\n defined?: AccessorFn,\n): {interactionPoints?: InteractionPoint[]} {\n if (!d.__d3plusShape__ || !Array.isArray(d.values)) return {};\n const values = d.values as unknown as DataPoint[];\n const points: InteractionPoint[] = [];\n values.forEach((v, k) => {\n if (typeof defined === \"function\" && defined(v, k) === false) return;\n const px = Number(x(v, k));\n const py = Number(y(v, k));\n if (!Number.isFinite(px) || !Number.isFinite(py)) return;\n points.push({\n x: px,\n y: py,\n datum: v,\n index: typeof v.i === \"number\" ? (v.i as number) : k,\n });\n });\n return points.length ? {interactionPoints: points} : {};\n}\n"],"names":["interactionPoints","d","x","y","defined","__d3plusShape__","Array","isArray","values","points","forEach","v","k","px","Number","py","isFinite","push","datum","index","i","length"],"mappings":"AAIA;;;;;;;;AAQA,GACA,OAAO,SAASA,kBACdC,CAAY,EACZC,CAAa,EACbC,CAAa,EACbC,OAAoB;IAEpB,IAAI,CAACH,EAAEI,eAAe,IAAI,CAACC,MAAMC,OAAO,CAACN,EAAEO,MAAM,GAAG,OAAO,CAAC;IAC5D,IAAMA,SAASP,EAAEO,MAAM;IACvB,IAAMC,SAA6B,EAAE;IACrCD,OAAOE,OAAO,CAAC,SAACC,GAAGC;QACjB,IAAI,OAAOR,YAAY,cAAcA,QAAQO,GAAGC,OAAO,OAAO;QAC9D,IAAMC,KAAKC,OAAOZ,EAAES,GAAGC;QACvB,IAAMG,KAAKD,OAAOX,EAAEQ,GAAGC;QACvB,IAAI,CAACE,OAAOE,QAAQ,CAACH,OAAO,CAACC,OAAOE,QAAQ,CAACD,KAAK;QAClDN,OAAOQ,IAAI,CAAC;YACVf,GAAGW;YACHV,GAAGY;YACHG,OAAOP;YACPQ,OAAO,OAAOR,EAAES,CAAC,KAAK,WAAYT,EAAES,CAAC,GAAcR;QACrD;IACF;IACA,OAAOH,OAAOY,MAAM,GAAG;QAACrB,mBAAmBS;IAAM,IAAI,CAAC;AACxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3plus/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"open-color": "^1.9.1",
|
|
63
63
|
"textures": "^1.2.3",
|
|
64
64
|
"topojson-client": "^3.1.0",
|
|
65
|
-
"@d3plus/
|
|
66
|
-
"@d3plus/
|
|
67
|
-
"@d3plus/
|
|
68
|
-
"@d3plus/
|
|
69
|
-
"@d3plus/
|
|
70
|
-
"@d3plus/
|
|
71
|
-
"@d3plus/
|
|
72
|
-
"@d3plus/
|
|
65
|
+
"@d3plus/dom": "4.3.0",
|
|
66
|
+
"@d3plus/color": "4.3.0",
|
|
67
|
+
"@d3plus/format": "4.3.0",
|
|
68
|
+
"@d3plus/data": "4.3.0",
|
|
69
|
+
"@d3plus/locales": "4.3.0",
|
|
70
|
+
"@d3plus/math": "4.3.0",
|
|
71
|
+
"@d3plus/render": "4.3.0",
|
|
72
|
+
"@d3plus/text": "4.3.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"playwright": "1.59.1"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type StackOffsetFn, type StackOrderFn, type StackOrderInput } from "./stackHelpers.js";
|
|
2
2
|
import { type PlotPaintContext } from "../features/plotPaint.js";
|
|
3
3
|
import Viz from "../viz/Viz.js";
|
|
4
|
-
import type { Scene } from "@d3plus/render";
|
|
4
|
+
import type { InteractionPoint, PickResult, Scene, SceneEvent } from "@d3plus/render";
|
|
5
5
|
import type { DataPoint } from "@d3plus/data";
|
|
6
6
|
import type { VizInstance } from "../viz/vizTypes.js";
|
|
7
7
|
/** Accessor function or string key for a plotted value. */
|
|
@@ -47,6 +47,27 @@ export default class Plot extends Viz {
|
|
|
47
47
|
_wirePlotShapeEvents(shape: {
|
|
48
48
|
on(event: string, handler: unknown): unknown;
|
|
49
49
|
}, shapeKey: string, events: string[]): void;
|
|
50
|
+
/**
|
|
51
|
+
For a multi-point shape (Line/Area) reports the point nearest the cursor
|
|
52
|
+
along the discrete axis, so every mouse event (tooltip, click, user
|
|
53
|
+
handlers) reflects the hovered x rather than the whole-series aggregate.
|
|
54
|
+
Non-nested shapes and legend swatches fall through to the base (aggregate)
|
|
55
|
+
behavior.
|
|
56
|
+
@private
|
|
57
|
+
*/
|
|
58
|
+
_interactionDatum(pick: PickResult, event: SceneEvent): {
|
|
59
|
+
d: unknown;
|
|
60
|
+
i: number;
|
|
61
|
+
x: unknown;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
Picks the interaction point closest to a surface-local cursor position
|
|
65
|
+
along the discrete axis. `event.point` is post-zoom surface space while the
|
|
66
|
+
points are in pre-zoom content space (they live under the `viz-zoom`
|
|
67
|
+
group), so the cursor is un-zoomed by `_zoomTransform` before comparing.
|
|
68
|
+
@private
|
|
69
|
+
*/
|
|
70
|
+
_nearestInteractionPoint(points: InteractionPoint[], point: [number, number]): InteractionPoint | null;
|
|
50
71
|
/**
|
|
51
72
|
Extends the draw behavior of the abstract Viz class.
|
|
52
73
|
@private
|
|
@@ -6,7 +6,8 @@ export { measurePlotLineLabels } from "./pipelineLineLabels.js";
|
|
|
6
6
|
`formatPlotData` — first stage of Plot's chart-specific pipeline. Detects
|
|
7
7
|
time axes (sets viz._xTime / _x2Time / _yTime / _y2Time), maps the
|
|
8
8
|
filtered data through `prepData` to produce the per-row PlotDatum shape
|
|
9
|
-
(x/y/x2/y2 + id + group + shape + lci/hci + discrete),
|
|
9
|
+
(x/y/x2/y2 + id + group + shape + lci/hci + discrete), drops rows whose
|
|
10
|
+
axis values can't be plotted (`isPlottableRow` — see #776), and constructs
|
|
10
11
|
the `_sizeScaleD3` if `_size` is set.
|
|
11
12
|
|
|
12
13
|
Pure compute. Returns `{formattedData, axisData, x2Exists, y2Exists}`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataPoint } from "@d3plus/data";
|
|
2
|
-
import type { Renderer, Scene, SceneEvent } from "@d3plus/render";
|
|
2
|
+
import type { PickResult, Renderer, Scene, SceneEvent } from "@d3plus/render";
|
|
3
3
|
import VizBase from "./VizBase.js";
|
|
4
4
|
/**
|
|
5
5
|
Creates an x/y plot based on an array of data. See [this example](https://d3plus.org/examples/d3plus-treemap/getting-started/) for help getting started using the treemap generator.
|
|
@@ -46,6 +46,21 @@ export default class Viz extends VizBase {
|
|
|
46
46
|
@param callback Optional callback invoked after rendering completes.
|
|
47
47
|
*/
|
|
48
48
|
render(callback?: () => void): this;
|
|
49
|
+
/**
|
|
50
|
+
Serializes the most recently rendered output to an SVG string. Returns
|
|
51
|
+
`""` if the chart has not been rendered yet. Both backends support this:
|
|
52
|
+
the SVG backend returns its live `<svg>`, the canvas backend re-renders the
|
|
53
|
+
retained scene through a throwaway SVG backend. Primarily used for
|
|
54
|
+
server-side rendering (see `@d3plus/ssr`).
|
|
55
|
+
*/
|
|
56
|
+
toSVGString(): string;
|
|
57
|
+
/**
|
|
58
|
+
Returns the underlying canvas element of the most recent render when the
|
|
59
|
+
canvas backend is active (`renderer("canvas")`), or `undefined` otherwise.
|
|
60
|
+
Server-side callers cast this to their native canvas to encode a raster
|
|
61
|
+
(see `@d3plus/ssr`).
|
|
62
|
+
*/
|
|
63
|
+
toCanvas(): unknown;
|
|
49
64
|
/**
|
|
50
65
|
Selects which @d3plus/render backend paints the visible output.
|
|
51
66
|
`"svg"` = SvgRenderer (default), `"canvas"` = CanvasRenderer.
|
|
@@ -83,6 +98,21 @@ export default class Viz extends VizBase {
|
|
|
83
98
|
svg's children get cleared so only the scene output is visible.
|
|
84
99
|
*/
|
|
85
100
|
_drawSceneToTarget(durationOverride?: number): void;
|
|
101
|
+
/**
|
|
102
|
+
Resolves the `(d, i, x)` a picked scene node reports to interaction
|
|
103
|
+
handlers (tooltip, click, user `on` handlers). `pick.datum` is the raw
|
|
104
|
+
scene datum; for a Plot shape that's the wrapped record `{data, i}`, which
|
|
105
|
+
handlers expect unwrapped to `(d.data, d.i, wrapped)`. The base does that
|
|
106
|
+
unwrap; Plot overrides this to report the point nearest the cursor for
|
|
107
|
+
multi-point shapes (Line/Area) so a series tooltip reflects the hovered
|
|
108
|
+
x rather than the whole-series aggregate.
|
|
109
|
+
@private
|
|
110
|
+
*/
|
|
111
|
+
_interactionDatum(pick: PickResult, _event: SceneEvent): {
|
|
112
|
+
d: unknown;
|
|
113
|
+
i: number;
|
|
114
|
+
x: unknown;
|
|
115
|
+
};
|
|
86
116
|
/**
|
|
87
117
|
Routes a renderer pointer event to the matching `viz.schema.on` handlers.
|
|
88
118
|
Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where
|
|
@@ -69,6 +69,9 @@ export interface VizRenderer {
|
|
|
69
69
|
} | undefined;
|
|
70
70
|
destroy(): void;
|
|
71
71
|
drawScene(scene: any, opts?: any): any;
|
|
72
|
+
toSVGString?(): string;
|
|
73
|
+
toCanvas?(): HTMLCanvasElement;
|
|
74
|
+
whenSettled?(): Promise<void>;
|
|
72
75
|
[key: string]: any;
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
@@ -231,6 +234,21 @@ export interface VizInstance {
|
|
|
231
234
|
_zoomSet?: boolean;
|
|
232
235
|
_zoomToBounds?: (bounds: number[][] | null, duration?: number) => void;
|
|
233
236
|
_renderTiles?: (transform?: ZoomTransform, duration?: number) => void;
|
|
237
|
+
/**
|
|
238
|
+
Geomap only: the static (identity-transform) basemap tile list — URLs and
|
|
239
|
+
projection-pixel positions — used by @d3plus/ssr to fetch + inline tiles.
|
|
240
|
+
*/
|
|
241
|
+
_computeTileList?: () => Array<{
|
|
242
|
+
key: string;
|
|
243
|
+
url: string;
|
|
244
|
+
x: number;
|
|
245
|
+
y: number;
|
|
246
|
+
size: number;
|
|
247
|
+
}>;
|
|
248
|
+
/** Set by @d3plus/ssr: emit ocean/tiles into the scene for a complete server render. */
|
|
249
|
+
_ssr?: boolean;
|
|
250
|
+
/** Set by @d3plus/ssr: pre-fetched basemap tiles keyed by `${x}-${y}-${z}` → data URI. */
|
|
251
|
+
_ssrTiles?: Map<string, string>;
|
|
234
252
|
_wirePlotShapeEvents?: (shape: Shape, shapeKey: string, events: string[]) => void;
|
|
235
253
|
_uuid: string;
|
|
236
254
|
_preDraw(): void;
|
|
@@ -76,8 +76,8 @@ export default class Shape extends BaseClass {
|
|
|
76
76
|
@param callback Optional callback invoked after rendering completes.
|
|
77
77
|
*/
|
|
78
78
|
/**
|
|
79
|
-
Resolves a style accessor
|
|
80
|
-
|
|
79
|
+
Resolves a style accessor. For a nested shape (Line/Area) the accessor gets
|
|
80
|
+
the merged aggregate `d.data`/`d.i` — matching `_nestWrapper` + scene datum.
|
|
81
81
|
@private
|
|
82
82
|
*/
|
|
83
83
|
_styleVal(fn: unknown, d: DataPoint, i: number): unknown;
|
|
@@ -11,9 +11,10 @@ type HitArea = ((d: DataPoint, i: number, aes: unknown) => Record<string, unknow
|
|
|
11
11
|
the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the
|
|
12
12
|
visible geometry are siblings, and the SVG keyed join can't hold two nodes
|
|
13
13
|
under one key — sharing it made the geometry re-enter (collapse→grow) on every
|
|
14
|
-
redraw (a "pulse" on e.g. every timeline step). Returns null when no
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
redraw (a "pulse" on e.g. every timeline step). Returns null when no hitArea
|
|
15
|
+
is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses
|
|
16
|
+
the resolved geometry `d`/`transform` so the hover target overlaps the
|
|
17
|
+
visible line exactly while extending past its ~1px stroke.
|
|
17
18
|
*/
|
|
18
|
-
export declare function hitAreaNode(hitArea: HitArea, d: DataPoint, i: number, aes: unknown, key: string | number, datum: DataPoint, name: string, transform: Transform): SceneNode | null;
|
|
19
|
+
export declare function hitAreaNode(hitArea: HitArea, d: DataPoint, i: number, aes: unknown, key: string | number, datum: DataPoint, name: string, transform: Transform, geomD?: string): SceneNode | null;
|
|
19
20
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DataPoint } from "@d3plus/data";
|
|
2
|
+
import type { InteractionPoint } from "@d3plus/render";
|
|
3
|
+
import type { AccessorFn } from "../utils/index.js";
|
|
4
|
+
/**
|
|
5
|
+
For a nested shape datum (Line/Area, whose datum wraps many points) returns a
|
|
6
|
+
spreadable scene-node fragment carrying each point's content-space position
|
|
7
|
+
paired with its source datum, so the pointer bridge can report the point
|
|
8
|
+
nearest the cursor rather than the whole-series aggregate. Points the
|
|
9
|
+
`defined` accessor rejects, or whose position isn't finite (a missing value),
|
|
10
|
+
are skipped — so the nearest match is always a real, defined point. Returns
|
|
11
|
+
an empty object for non-nested data (spreads to nothing).
|
|
12
|
+
*/
|
|
13
|
+
export declare function interactionPoints(d: DataPoint, x: AccessorFn, y: AccessorFn, defined?: AccessorFn): {
|
|
14
|
+
interactionPoints?: InteractionPoint[];
|
|
15
|
+
};
|