@d3plus/core 4.6.0 → 4.7.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 +728 -1454
- package/es/index.js.map +1 -1
- package/es/internal.js +5 -0
- package/es/internal.js.map +1 -1
- package/es/src/charts/Chord/index.js +2 -0
- package/es/src/charts/Chord/index.js.map +1 -1
- package/es/src/charts/Geomap/applyLayout.js +3 -1
- package/es/src/charts/Geomap/applyLayout.js.map +1 -1
- package/es/src/charts/Geomap/index.js +3 -1
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/Matrix/emit.js +5 -4
- package/es/src/charts/Matrix/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +4 -0
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +6 -6
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +2 -0
- package/es/src/charts/Pack/index.js.map +1 -1
- package/es/src/charts/Pie/emit.js +5 -6
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +2 -0
- package/es/src/charts/Pie/index.js.map +1 -1
- package/es/src/charts/Plot/index.js +15 -1
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/insetRegion.js +21 -0
- package/es/src/charts/Plot/insetRegion.js.map +1 -0
- package/es/src/charts/Plot/sharedHover.js +117 -16
- package/es/src/charts/Plot/sharedHover.js.map +1 -1
- package/es/src/charts/Plot/sharedTooltip.js +35 -15
- package/es/src/charts/Plot/sharedTooltip.js.map +1 -1
- package/es/src/charts/Plot/trendLines.js +140 -38
- package/es/src/charts/Plot/trendLines.js.map +1 -1
- package/es/src/charts/Plot/trendProjection.js +120 -0
- package/es/src/charts/Plot/trendProjection.js.map +1 -0
- package/es/src/charts/Plot/trendScene.js +33 -19
- package/es/src/charts/Plot/trendScene.js.map +1 -1
- package/es/src/charts/Plot/trendTooltip.js +79 -17
- package/es/src/charts/Plot/trendTooltip.js.map +1 -1
- package/es/src/charts/Priestley/emit.js +3 -4
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +4 -4
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +5 -1
- package/es/src/charts/Rings/index.js.map +1 -1
- package/es/src/charts/Sankey/index.js +2 -0
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/Tree/index.js +2 -0
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/emit.js +3 -4
- package/es/src/charts/Treemap/emit.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/definition/makeChart.js +8 -2
- package/es/src/charts/definition/makeChart.js.map +1 -1
- package/es/src/charts/drawSteps/bottomRightControls.js +3 -0
- package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -1
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +135 -4
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -1
- package/es/src/charts/drawSteps/searchControlsMarkup.js +15 -38
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -1
- package/es/src/charts/events/click.legend.js +10 -5
- package/es/src/charts/events/click.legend.js.map +1 -1
- package/es/src/charts/events/mousemove.shape.js +8 -1
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/features/emitHelpers.js +19 -5
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/features.js +3 -108
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresColorScale.js +161 -0
- package/es/src/charts/features/featuresColorScale.js.map +1 -0
- package/es/src/charts/features/featuresLegend.js +145 -32
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/insetState.js +174 -0
- package/es/src/charts/features/insetState.js.map +1 -0
- package/es/src/charts/features/sceneBounds.js +271 -0
- package/es/src/charts/features/sceneBounds.js.map +1 -0
- package/es/src/charts/features/tooltipSwatch.js +73 -0
- package/es/src/charts/features/tooltipSwatch.js.map +1 -0
- package/es/src/charts/pipeline/insetPlacement.js +406 -0
- package/es/src/charts/pipeline/insetPlacement.js.map +1 -0
- package/es/src/charts/pipeline/runVizPipeline.js +6 -2
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/viz/Viz.js +18 -3
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +20 -24
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/interactionOpacity.js +21 -13
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/linkGroup.js +386 -0
- package/es/src/charts/viz/linkGroup.js.map +1 -0
- package/es/src/charts/viz/sceneRows.js +33 -0
- package/es/src/charts/viz/sceneRows.js.map +1 -0
- package/es/src/charts/viz/vizDefaults.js +13 -8
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/components/Axis/AxisBottom.js +1 -1
- package/es/src/components/Axis/AxisBottom.js.map +1 -1
- package/es/src/components/Axis/AxisLeft.js +1 -1
- package/es/src/components/Axis/AxisLeft.js.map +1 -1
- package/es/src/components/Axis/AxisRight.js +1 -1
- package/es/src/components/Axis/AxisRight.js.map +1 -1
- package/es/src/components/Axis/AxisTop.js +1 -1
- package/es/src/components/Axis/AxisTop.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +13 -1
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
- package/es/src/components/ColorScale/ColorScale.js.map +1 -1
- package/es/src/components/Legend/legendConfig.js +2 -1
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/components/Legend/legendRender.js +42 -5
- package/es/src/components/Legend/legendRender.js.map +1 -1
- package/es/src/components/TextBox.js +1 -1
- package/es/src/components/TextBox.js.map +1 -1
- package/es/src/shapes/Bar.js +1 -1
- package/es/src/shapes/Bar.js.map +1 -1
- package/es/src/shapes/Box.js +1 -1
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Rect.js +1 -1
- package/es/src/shapes/Rect.js.map +1 -1
- package/es/src/shapes/Shape.js +9 -36
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +1 -1
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/textureKey.js +104 -0
- package/es/src/shapes/textureKey.js.map +1 -0
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/package.json +10 -9
- package/types/index.d.ts +1 -0
- package/types/internal.d.ts +7 -0
- package/types/src/charts/Plot/index.d.ts +8 -0
- package/types/src/charts/Plot/insetRegion.d.ts +4 -0
- package/types/src/charts/Plot/sharedHover.d.ts +5 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +10 -0
- package/types/src/charts/Plot/trendLines.d.ts +23 -3
- package/types/src/charts/Plot/trendProjection.d.ts +28 -0
- package/types/src/charts/Plot/trendScene.d.ts +2 -1
- package/types/src/charts/Plot/trendTooltip.d.ts +16 -5
- package/types/src/charts/definition/ChartDefinition.d.ts +9 -0
- package/types/src/charts/definition/makeChart.d.ts +2 -2
- package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +2 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +7 -5
- package/types/src/charts/features/emitHelpers.d.ts +10 -4
- package/types/src/charts/features/features.d.ts +1 -8
- package/types/src/charts/features/featuresColorScale.d.ts +24 -0
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/insetState.d.ts +95 -0
- package/types/src/charts/features/sceneBounds.d.ts +18 -0
- package/types/src/charts/features/tooltipSwatch.d.ts +31 -0
- package/types/src/charts/pipeline/insetPlacement.d.ts +45 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +2 -1
- package/types/src/charts/viz/Viz.d.ts +9 -1
- package/types/src/charts/viz/VizBaseConfig.d.ts +8 -12
- package/types/src/charts/viz/linkGroup.d.ts +96 -0
- package/types/src/charts/viz/sceneRows.d.ts +13 -0
- package/types/src/charts/viz/vizTypes.d.ts +17 -0
- package/types/src/components/Axis/AxisBottom.d.ts +1 -1
- package/types/src/components/Axis/AxisLeft.d.ts +1 -1
- package/types/src/components/Axis/AxisRight.d.ts +1 -1
- package/types/src/components/Axis/AxisTop.d.ts +1 -1
- package/types/src/components/ColorScale/ColorScale.d.ts +4 -4
- package/types/src/components/Legend/legendRender.d.ts +1 -1
- package/types/src/components/TextBox.d.ts +1 -1
- package/types/src/shapes/Bar.d.ts +1 -1
- package/types/src/shapes/Box.d.ts +1 -1
- package/types/src/shapes/Rect.d.ts +1 -1
- package/types/src/shapes/Whisker.d.ts +1 -1
- package/types/src/shapes/textureKey.d.ts +9 -0
- package/types/src/utils/D3plusConfig.d.ts +42 -1
- package/umd/d3plus-core.full.js +2393 -594
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +1945 -1601
- package/umd/d3plus-core.js +1744 -404
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1401 -1087
|
@@ -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 {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, this.schema.colorDefaults),\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","colorDefaults","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAAOuF,CAA4C;gBACjD,OAAOyH,UAAUrL,MAAM,GAClB,CAAA,AAAC,IAAI,CAACkB,OAAO,GAAG7C,OAAOuF,IAAyC,IAAI,AAAD,IACpE,IAAI,CAAC1C,OAAO;YAClB;;;YAOA4F,KAAAA;mBAAAA,SAAAA,KACElD,CAAmD;gBAEnD,OAAOyH,UAAUrL,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC4B,MAAM,CAACkF,IAAI,GAAGlD,cAAAA,eAAAA,IAAK,MAAO,IAAI,AAAD,IACpC,IAAI,CAAChC,MAAM,CAACkF,IAAI;YACtB;;;YAOA1D,KAAAA;mBAAAA,SAAAA,eAAeQ,CAA2B;gBACxC,OAAOyH,UAAUrL,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC4B,MAAM,CAACwB,cAAc,GAAG7E,OAAO,IAAI,CAACqD,MAAM,CAACwB,cAAc,EAAEQ,IAClE,IAAI,AAAD,IACH,IAAI,CAAChC,MAAM,CAACwB,cAAc;YAChC;;;YASA8F,KAAAA;mBAAAA,SAAAA,OAAOtF,CAA4B;gBACjC,IAAI,CAACyH,UAAUrL,MAAM,EAAE,OAAO,uBA3nBbW,kBA2nBmBuI,UAAN,IAAK;gBACnC,uBA5nBiBvI,kBA4nBXuI,UAAN,IAAK,aAAQtF;gBACb,OAAO,IAAI;YACb;;;WA9nBmBjD;EAAc9B;AAHnC;;AAEA,GACA,SAAqB8B,mBA+nBpB"}
|
|
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} 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 {textureKey} from \"./textureKey.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).toString() : 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).toString() : 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, this.schema.colorDefaults),\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 return textureKey(\n textureVal,\n () => styleLogic(this.schema.fill),\n () => styleLogic(this.schema.stroke),\n this.schema.textureDefault,\n );\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","SvgRenderer","TextBox","accessor","BaseClass","constant","installFluent","buildLabelData","hitAreaNode","interactionPoints","textureKey","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","toString","s","strokeWidth","hoverStyle","labelConfig","fontColor","colorDefaults","fontOpacity","opacity","fontResize","fontMax","fontMin","fontSize","padding","textAnchor","verticalAlign","textureDefault","_aes","_d","_i","_getTextureKey","textureVal","texture","styleLogic","_","nested","values","indexOf","_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","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,QAAO,cAAc;AAG5C,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;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,CAAA,AAAC,IAAI,CAACkB,OAAO,GAAG7C,OAAOwF,IAAyC,IAAI,AAAD,IACpE,IAAI,CAAC3C,OAAO;YAClB;;;YAOAoF,KAAAA;mBAAAA,SAAAA,KACEzC,CAAmD;gBAEnD,OAAOgH,UAAU7K,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC4B,MAAM,CAAC0E,IAAI,GAAGzC,cAAAA,eAAAA,IAAK,MAAO,IAAI,AAAD,IACpC,IAAI,CAACjC,MAAM,CAAC0E,IAAI;YACtB;;;YAOAjD,KAAAA;mBAAAA,SAAAA,eAAeQ,CAA2B;gBACxC,OAAOgH,UAAU7K,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC4B,MAAM,CAACyB,cAAc,GAAG9E,OAAO,IAAI,CAACqD,MAAM,CAACyB,cAAc,EAAEQ,IAClE,IAAI,AAAD,IACH,IAAI,CAACjC,MAAM,CAACyB,cAAc;YAChC;;;YASAqF,KAAAA;mBAAAA,SAAAA,OAAO7E,CAA4B;gBACjC,IAAI,CAACgH,UAAU7K,MAAM,EAAE,OAAO,uBA7lBbW,kBA6lBmB+H,UAAN,IAAK;gBACnC,uBA9lBiB/H,kBA8lBX+H,UAAN,IAAK,aAAQ7E;gBACb,OAAO,IAAI;YACb;;;WAhmBmBlD;EAAc/B;AAHnC;;AAEA,GACA,SAAqB+B,mBAimBpB"}
|
package/es/src/shapes/Whisker.js
CHANGED
|
@@ -421,7 +421,7 @@ var Whisker = /*#__PURE__*/ function(BaseClass) {
|
|
|
421
421
|
return Whisker;
|
|
422
422
|
}(BaseClass);
|
|
423
423
|
/**
|
|
424
|
-
Creates SVG
|
|
424
|
+
Creates SVG whiskers based on an array of data: a line from each point in a given direction, capped with an endpoint shape.
|
|
425
425
|
*/ export { Whisker as default };
|
|
426
426
|
|
|
427
427
|
//# sourceMappingURL=Whisker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shapes/Whisker.ts"],"sourcesContent":["import {groups} from \"d3-array\";\nimport {select} from \"d3-selection\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport {assign, elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\nimport type {GroupNode, SceneNode} from \"@d3plus/render\";\n\nimport {accessor, BaseClass, configPrep} from \"../utils/index.js\";\nimport type {D3plusConfig} from \"../utils/index.js\";\nimport type {VizContext} from \"../utils/configPrep.js\";\nimport {markSharedConfig} from \"../utils/configWarnings.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\n\nimport Circle from \"./Circle.js\";\nimport Line from \"./Line.js\";\nimport Rect from \"./Rect.js\";\nimport type {WhiskerConfig} from \"./shapeConfig.js\";\n\nconst shapes: Record<string, typeof Circle | typeof Rect> = {Circle, Rect};\n\n/** Whisker's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst whiskerSchema: ConfigField[] = [\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"endpoint\", coerce: \"const\", default: accessor(\"endpoint\", \"Rect\")},\n {key: \"length\", coerce: \"const\", default: accessor(\"length\", 25)},\n {key: \"orient\", coerce: \"const\", default: accessor(\"orient\", \"top\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"x\", coerce: \"const\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"const\", default: accessor(\"y\", 0)},\n];\n\n/**\n Creates SVG whisker based on an array of data.\n*/\nexport default class Whisker extends BaseClass {\n // installFluent generates the config accessors (length, orient, x, …) at\n // runtime; 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 _data!: DataPoint[];\n _select!: D3Selection;\n _line!: Line;\n _whiskerEndpoint: (Circle | Rect)[];\n\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.\n @private\n*/\n constructor() {\n super();\n installFluent(this, whiskerSchema);\n this.schema.endpointConfig = {Circle: {r: accessor(\"r\", 5)}};\n this.schema.lineConfig = {};\n this._whiskerEndpoint = [];\n }\n\n /**\n Draws the whisker.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: () => void): this {\n const compute = this.schema.renderMode === \"compute\";\n if (this._select === void 0 && !compute) {\n this.select(\n select(\"body\")\n .append(\"svg\")\n .style(\"width\", `${window.innerWidth}px`)\n .style(\"height\", `${window.innerHeight}px`)\n .style(\"display\", \"block\")\n .node(),\n );\n }\n const mountInner = (parent: string): D3Selection[\"node\"] | null => {\n if (compute) return null as unknown as D3Selection[\"node\"];\n return elem(parent, {parent: this._select}).node() as unknown as D3Selection[\"node\"];\n };\n\n const lineData: DataPoint[] = [];\n this._data.forEach((d: DataPoint, i: number) => {\n const orient = this.schema.orient(d, i) as string;\n const x = this.schema.x(d, i) as number;\n const y = this.schema.y(d, i) as number;\n\n let endpointX = x;\n if (orient === \"left\") endpointX -= this.schema.length(d, i) as number;\n else if (orient === \"right\") endpointX += this.schema.length(d, i) as number;\n\n let endpointY = y;\n if (orient === \"top\") endpointY -= this.schema.length(d, i) as number;\n else if (orient === \"bottom\") endpointY += this.schema.length(d, i) as number;\n\n lineData.push({\n __d3plus__: true,\n data: d,\n i,\n id: i,\n x,\n y,\n } as unknown as DataPoint);\n lineData.push({\n __d3plus__: true,\n data: d,\n i,\n id: i,\n x: endpointX,\n y: endpointY,\n } as unknown as DataPoint);\n });\n\n // Draw whisker line. Don't pass `callback` to the inner Line —\n // doing so would fire the caller's done-callback after the LINE\n // finished but BEFORE endpoint shapes (below) are rendered.\n this._line = new Line()\n .data(lineData)\n .renderMode(compute ? \"compute\" : \"full\")\n .select(mountInner(\"g.d3plus-Whisker\") as never)\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.lineConfig, \"shape\")!)\n .render();\n\n const whiskerData = this._data.map((d: DataPoint, i: number) => {\n const dataObj: DataPoint = {} as DataPoint;\n (dataObj as Record<string, unknown>).__d3plus__ = true;\n (dataObj as Record<string, unknown>).data = d;\n (dataObj as Record<string, unknown>).i = i;\n (dataObj as Record<string, unknown>).endpoint = this.schema.endpoint(d, i);\n (dataObj as Record<string, unknown>).length = this.schema.length(d, i);\n (dataObj as Record<string, unknown>).orient = this.schema.orient(d, i);\n\n let endpointX = this.schema.x(d, i) as number;\n if (dataObj.orient === \"left\") endpointX -= dataObj.length as number;\n else if (dataObj.orient === \"right\")\n endpointX += dataObj.length as number;\n\n let endpointY = this.schema.y(d, i) as number;\n if (dataObj.orient === \"top\") endpointY -= dataObj.length as number;\n else if (dataObj.orient === \"bottom\")\n endpointY += dataObj.length as number;\n\n (dataObj as Record<string, unknown>).x = endpointX;\n (dataObj as Record<string, unknown>).y = endpointY;\n\n return dataObj;\n });\n\n // Draw whisker endpoint.\n this._whiskerEndpoint = [];\n groups(whiskerData, (d: DataPoint) => d.endpoint).forEach(\n ([shapeName, values]: [DataPoint[keyof DataPoint], DataPoint[]]) => {\n this._whiskerEndpoint.push(\n new shapes[shapeName as string]()\n .data(values)\n .renderMode(compute ? \"compute\" : \"full\")\n .select(mountInner(`g.d3plus-Whisker-Endpoint-${shapeName}`) as never)\n .config(markSharedConfig({\n height: (d: DataPoint) =>\n d.orient === \"top\" || d.orient === \"bottom\" ? 5 : 20,\n width: (d: DataPoint) =>\n d.orient === \"top\" || d.orient === \"bottom\" ? 20 : 5,\n }))\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.endpointConfig, \"shape\", shapeName as string)!)\n .render(),\n );\n },\n );\n\n // Fire the user's done-callback only after endpoints render. The inner\n // shapes don't share one transition queue, so schedule against\n // `duration + 100`.\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n Compute-mode scene aggregation, mirroring Box.toScene(). Returns a\n GroupNode containing the inner Line's scene children plus each\n endpoint shape's scene children.\n */\n toScene(): GroupNode {\n const children: SceneNode[] = [];\n const push = (shape: {toScene?: () => GroupNode | null | undefined} | undefined): void => {\n const g = shape && typeof shape.toScene === \"function\" ? shape.toScene() : null;\n if (g && Array.isArray(g.children)) children.push(...g.children);\n };\n push(this._line);\n if (Array.isArray(this._whiskerEndpoint))\n for (const ep of this._whiskerEndpoint) push(ep);\n return {type: \"group\", key: \"d3plus-Whisker-scene\", children};\n }\n\n /**\n The active highlight state for all sub-shapes in this Whisker.\n*/\n active(_: ((d: DataPoint, i: number) => boolean) | null): void {\n if (this._line) this._line.active(_);\n if (this._whiskerEndpoint)\n this._whiskerEndpoint.forEach((endPoint: Circle | Rect) =>\n endPoint.active(_),\n );\n }\n\n /**\n The data array used to create shapes.\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 Configuration object for each endpoint.\n*/\n endpointConfig(): Record<string, unknown>;\n endpointConfig(_: Record<string, unknown>): this;\n endpointConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.endpointConfig = assign(this.schema.endpointConfig, _!)), this)\n : this.schema.endpointConfig;\n }\n\n /**\n The hover highlight state for all sub-shapes in this Whisker.\n*/\n hover(_: ((d: DataPoint, i: number) => boolean) | null): void {\n if (this._line) this._line.hover(_);\n if (this._whiskerEndpoint)\n this._whiskerEndpoint.forEach((endPoint: Circle | Rect) =>\n endPoint.hover(_),\n );\n }\n\n /**\n Configuration object for the line shape.\n*/\n lineConfig(): Record<string, unknown>;\n lineConfig(_: Record<string, unknown>): this;\n lineConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.lineConfig = assign(this.schema.lineConfig, _!)), this)\n : this.schema.lineConfig;\n }\n\n /**\n The SVG container element for this visualization. 3 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 Narrowed `.config()` for Whisker. 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(): WhiskerConfig;\n config(_: Partial<WhiskerConfig>): this;\n config(_?: Partial<WhiskerConfig>): WhiskerConfig | this {\n if (!arguments.length) return super.config() as WhiskerConfig;\n super.config(_ as D3plusConfig);\n return this;\n }\n}\n"],"names":["groups","select","assign","elem","accessor","BaseClass","configPrep","markSharedConfig","installFluent","Circle","Line","Rect","shapes","whiskerSchema","key","coerce","default","Whisker","_data","_select","_line","_whiskerEndpoint","schema","endpointConfig","r","lineConfig","render","callback","compute","renderMode","append","style","window","innerWidth","innerHeight","node","mountInner","parent","lineData","forEach","d","i","orient","x","y","endpointX","length","endpointY","push","__d3plus__","data","id","config","bind","whiskerData","map","dataObj","endpoint","shapeName","values","height","width","setTimeout","duration","toScene","children","shape","g","Array","isArray","ep","type","active","_","endPoint","arguments","hover"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,WAAW;AAChC,SAAQC,MAAM,QAAO,eAAe;AAGpC,SAAQC,MAAM,EAAEC,IAAI,QAAO,cAAc;AAIzC,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAO,oBAAoB;AAGlE,SAAQC,gBAAgB,QAAO,6BAA6B;AAC5D,SAAQC,aAAa,QAAO,eAAe;AAG3C,OAAOC,YAAY,cAAc;AACjC,OAAOC,UAAU,YAAY;AAC7B,OAAOC,UAAU,YAAY;AAG7B,IAAMC,SAAsD;IAACH,QAAAA;IAAQE,MAAAA;AAAI;AAEzE,mFAAmF,GACnF,IAAME,gBAA+B;IACnC;QAACC,KAAK;QAAYC,QAAQ;QAAYC,SAAS;IAAG;IAClD;QAACF,KAAK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YAClB;;;YASAiC,KAAAA;mBAAAA,SAAAA,OAAOqB,CAA0B;gBAC/B,IAAI,CAACE,UAAU7B,MAAM,EAAE,OAAO,uBApOb7B,oBAoOmBmC,UAAN,IAAK;gBACnC,uBArOiBnC,oBAqOXmC,UAAN,IAAK,aAAQqB;gBACb,OAAO,IAAI;YACb;;;WAvOmBxD;EAAgBZ;AAHrC;;AAEA,GACA,SAAqBY,qBAwOpB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/shapes/Whisker.ts"],"sourcesContent":["import {groups} from \"d3-array\";\nimport {select} from \"d3-selection\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport {assign, elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\nimport type {GroupNode, SceneNode} from \"@d3plus/render\";\n\nimport {accessor, BaseClass, configPrep} from \"../utils/index.js\";\nimport type {D3plusConfig} from \"../utils/index.js\";\nimport type {VizContext} from \"../utils/configPrep.js\";\nimport {markSharedConfig} from \"../utils/configWarnings.js\";\nimport {installFluent} from \"../fluent.js\";\nimport type {ConfigField} from \"../fluent.js\";\n\nimport Circle from \"./Circle.js\";\nimport Line from \"./Line.js\";\nimport Rect from \"./Rect.js\";\nimport type {WhiskerConfig} from \"./shapeConfig.js\";\n\nconst shapes: Record<string, typeof Circle | typeof Rect> = {Circle, Rect};\n\n/** Whisker's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst whiskerSchema: ConfigField[] = [\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"endpoint\", coerce: \"const\", default: accessor(\"endpoint\", \"Rect\")},\n {key: \"length\", coerce: \"const\", default: accessor(\"length\", 25)},\n {key: \"orient\", coerce: \"const\", default: accessor(\"orient\", \"top\")},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"x\", coerce: \"const\", default: accessor(\"x\", 0)},\n {key: \"y\", coerce: \"const\", default: accessor(\"y\", 0)},\n];\n\n/**\n Creates SVG whiskers based on an array of data: a line from each point in a given direction, capped with an endpoint shape.\n*/\nexport default class Whisker extends BaseClass {\n // installFluent generates the config accessors (length, orient, x, …) at\n // runtime; 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 _data!: DataPoint[];\n _select!: D3Selection;\n _line!: Line;\n _whiskerEndpoint: (Circle | Rect)[];\n\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.\n @private\n*/\n constructor() {\n super();\n installFluent(this, whiskerSchema);\n this.schema.endpointConfig = {Circle: {r: accessor(\"r\", 5)}};\n this.schema.lineConfig = {};\n this._whiskerEndpoint = [];\n }\n\n /**\n Draws the whisker.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: () => void): this {\n const compute = this.schema.renderMode === \"compute\";\n if (this._select === void 0 && !compute) {\n this.select(\n select(\"body\")\n .append(\"svg\")\n .style(\"width\", `${window.innerWidth}px`)\n .style(\"height\", `${window.innerHeight}px`)\n .style(\"display\", \"block\")\n .node(),\n );\n }\n const mountInner = (parent: string): D3Selection[\"node\"] | null => {\n if (compute) return null as unknown as D3Selection[\"node\"];\n return elem(parent, {parent: this._select}).node() as unknown as D3Selection[\"node\"];\n };\n\n const lineData: DataPoint[] = [];\n this._data.forEach((d: DataPoint, i: number) => {\n const orient = this.schema.orient(d, i) as string;\n const x = this.schema.x(d, i) as number;\n const y = this.schema.y(d, i) as number;\n\n let endpointX = x;\n if (orient === \"left\") endpointX -= this.schema.length(d, i) as number;\n else if (orient === \"right\") endpointX += this.schema.length(d, i) as number;\n\n let endpointY = y;\n if (orient === \"top\") endpointY -= this.schema.length(d, i) as number;\n else if (orient === \"bottom\") endpointY += this.schema.length(d, i) as number;\n\n lineData.push({\n __d3plus__: true,\n data: d,\n i,\n id: i,\n x,\n y,\n } as unknown as DataPoint);\n lineData.push({\n __d3plus__: true,\n data: d,\n i,\n id: i,\n x: endpointX,\n y: endpointY,\n } as unknown as DataPoint);\n });\n\n // Draw whisker line. Don't pass `callback` to the inner Line —\n // doing so would fire the caller's done-callback after the LINE\n // finished but BEFORE endpoint shapes (below) are rendered.\n this._line = new Line()\n .data(lineData)\n .renderMode(compute ? \"compute\" : \"full\")\n .select(mountInner(\"g.d3plus-Whisker\") as never)\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.lineConfig, \"shape\")!)\n .render();\n\n const whiskerData = this._data.map((d: DataPoint, i: number) => {\n const dataObj: DataPoint = {} as DataPoint;\n (dataObj as Record<string, unknown>).__d3plus__ = true;\n (dataObj as Record<string, unknown>).data = d;\n (dataObj as Record<string, unknown>).i = i;\n (dataObj as Record<string, unknown>).endpoint = this.schema.endpoint(d, i);\n (dataObj as Record<string, unknown>).length = this.schema.length(d, i);\n (dataObj as Record<string, unknown>).orient = this.schema.orient(d, i);\n\n let endpointX = this.schema.x(d, i) as number;\n if (dataObj.orient === \"left\") endpointX -= dataObj.length as number;\n else if (dataObj.orient === \"right\")\n endpointX += dataObj.length as number;\n\n let endpointY = this.schema.y(d, i) as number;\n if (dataObj.orient === \"top\") endpointY -= dataObj.length as number;\n else if (dataObj.orient === \"bottom\")\n endpointY += dataObj.length as number;\n\n (dataObj as Record<string, unknown>).x = endpointX;\n (dataObj as Record<string, unknown>).y = endpointY;\n\n return dataObj;\n });\n\n // Draw whisker endpoint.\n this._whiskerEndpoint = [];\n groups(whiskerData, (d: DataPoint) => d.endpoint).forEach(\n ([shapeName, values]: [DataPoint[keyof DataPoint], DataPoint[]]) => {\n this._whiskerEndpoint.push(\n new shapes[shapeName as string]()\n .data(values)\n .renderMode(compute ? \"compute\" : \"full\")\n .select(mountInner(`g.d3plus-Whisker-Endpoint-${shapeName}`) as never)\n .config(markSharedConfig({\n height: (d: DataPoint) =>\n d.orient === \"top\" || d.orient === \"bottom\" ? 5 : 20,\n width: (d: DataPoint) =>\n d.orient === \"top\" || d.orient === \"bottom\" ? 20 : 5,\n }))\n .config(configPrep.bind(this as unknown as VizContext)(this.schema.endpointConfig, \"shape\", shapeName as string)!)\n .render(),\n );\n },\n );\n\n // Fire the user's done-callback only after endpoints render. The inner\n // shapes don't share one transition queue, so schedule against\n // `duration + 100`.\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n Compute-mode scene aggregation, mirroring Box.toScene(). Returns a\n GroupNode containing the inner Line's scene children plus each\n endpoint shape's scene children.\n */\n toScene(): GroupNode {\n const children: SceneNode[] = [];\n const push = (shape: {toScene?: () => GroupNode | null | undefined} | undefined): void => {\n const g = shape && typeof shape.toScene === \"function\" ? shape.toScene() : null;\n if (g && Array.isArray(g.children)) children.push(...g.children);\n };\n push(this._line);\n if (Array.isArray(this._whiskerEndpoint))\n for (const ep of this._whiskerEndpoint) push(ep);\n return {type: \"group\", key: \"d3plus-Whisker-scene\", children};\n }\n\n /**\n The active highlight state for all sub-shapes in this Whisker.\n*/\n active(_: ((d: DataPoint, i: number) => boolean) | null): void {\n if (this._line) this._line.active(_);\n if (this._whiskerEndpoint)\n this._whiskerEndpoint.forEach((endPoint: Circle | Rect) =>\n endPoint.active(_),\n );\n }\n\n /**\n The data array used to create shapes.\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 Configuration object for each endpoint.\n*/\n endpointConfig(): Record<string, unknown>;\n endpointConfig(_: Record<string, unknown>): this;\n endpointConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.endpointConfig = assign(this.schema.endpointConfig, _!)), this)\n : this.schema.endpointConfig;\n }\n\n /**\n The hover highlight state for all sub-shapes in this Whisker.\n*/\n hover(_: ((d: DataPoint, i: number) => boolean) | null): void {\n if (this._line) this._line.hover(_);\n if (this._whiskerEndpoint)\n this._whiskerEndpoint.forEach((endPoint: Circle | Rect) =>\n endPoint.hover(_),\n );\n }\n\n /**\n Configuration object for the line shape.\n*/\n lineConfig(): Record<string, unknown>;\n lineConfig(_: Record<string, unknown>): this;\n lineConfig(_?: Record<string, unknown>): Record<string, unknown> | this {\n return arguments.length\n ? ((this.schema.lineConfig = assign(this.schema.lineConfig, _!)), this)\n : this.schema.lineConfig;\n }\n\n /**\n The SVG container element for this visualization. 3 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 Narrowed `.config()` for Whisker. 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(): WhiskerConfig;\n config(_: Partial<WhiskerConfig>): this;\n config(_?: Partial<WhiskerConfig>): WhiskerConfig | this {\n if (!arguments.length) return super.config() as WhiskerConfig;\n super.config(_ as D3plusConfig);\n return this;\n }\n}\n"],"names":["groups","select","assign","elem","accessor","BaseClass","configPrep","markSharedConfig","installFluent","Circle","Line","Rect","shapes","whiskerSchema","key","coerce","default","Whisker","_data","_select","_line","_whiskerEndpoint","schema","endpointConfig","r","lineConfig","render","callback","compute","renderMode","append","style","window","innerWidth","innerHeight","node","mountInner","parent","lineData","forEach","d","i","orient","x","y","endpointX","length","endpointY","push","__d3plus__","data","id","config","bind","whiskerData","map","dataObj","endpoint","shapeName","values","height","width","setTimeout","duration","toScene","children","shape","g","Array","isArray","ep","type","active","_","endPoint","arguments","hover"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,WAAW;AAChC,SAAQC,MAAM,QAAO,eAAe;AAGpC,SAAQC,MAAM,EAAEC,IAAI,QAAO,cAAc;AAIzC,SAA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,UAAU7B,MAAM,GAClB,CAAA,AAAC,IAAI,CAACxB,MAAM,CAACG,UAAU,GAAGvB,OAAO,IAAI,CAACoB,MAAM,CAACG,UAAU,EAAEgD,IAAM,IAAI,AAAD,IACnE,IAAI,CAACnD,MAAM,CAACG,UAAU;YAC5B;;;YAOAxB,KAAAA;mBAAAA,SAAAA,QAAOwE,CAA4C;gBACjD,OAAOE,UAAU7B,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC3B,OAAO,GAAGlB,OAAOwE,IAAyC,IAAI,AAAD,IACpE,IAAI,CAACtD,OAAO;YAClB;;;YASAiC,KAAAA;mBAAAA,SAAAA,OAAOqB,CAA0B;gBAC/B,IAAI,CAACE,UAAU7B,MAAM,EAAE,OAAO,uBApOb7B,oBAoOmBmC,UAAN,IAAK;gBACnC,uBArOiBnC,oBAqOXmC,UAAN,IAAK,aAAQqB;gBACb,OAAO,IAAI;YACb;;;WAvOmBxD;EAAgBZ;AAHrC;;AAEA,GACA,SAAqBY,qBAwOpB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function _type_of(obj) {
|
|
30
|
+
"@swc/helpers - typeof";
|
|
31
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
32
|
+
}
|
|
33
|
+
import { assign, isObject } from "@d3plus/dom";
|
|
34
|
+
/** textures.js path-based texture names, drawn by its `paths()` generator. */ var pathNames = [
|
|
35
|
+
"squares",
|
|
36
|
+
"nylon",
|
|
37
|
+
"waves",
|
|
38
|
+
"woven",
|
|
39
|
+
"crosses",
|
|
40
|
+
"caps",
|
|
41
|
+
"hexagons"
|
|
42
|
+
];
|
|
43
|
+
/** Color-valued texture keys; a d3-color object is reduced to its CSS string. */ var colorKeys = [
|
|
44
|
+
"background",
|
|
45
|
+
"fill",
|
|
46
|
+
"stroke"
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
Builds the JSON key of a textures.js config for one datum, or `false` when
|
|
50
|
+
the datum has no texture or no fill (`"none"`, e.g. a line or link). The key is what a `pattern:<key>` scene fill
|
|
51
|
+
carries for the renderer backends to materialize. `fill` and `stroke` are
|
|
52
|
+
the shape's resolved fill and stroke for the datum, used as the texture's
|
|
53
|
+
default background and line colors.
|
|
54
|
+
@private
|
|
55
|
+
*/ export function textureKey(textureVal, fill, stroke) {
|
|
56
|
+
var textureDefault = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
57
|
+
if (!textureVal) return false;
|
|
58
|
+
var background = fill();
|
|
59
|
+
if (background === "none") return false;
|
|
60
|
+
var texture = isObject(textureVal) ? _object_spread({}, textureVal) : {
|
|
61
|
+
texture: textureVal
|
|
62
|
+
};
|
|
63
|
+
if (!texture.background) texture.background = background;
|
|
64
|
+
if (!texture.stroke && !textureDefault.stroke) texture.stroke = stroke();
|
|
65
|
+
if (pathNames.includes(texture.texture) || typeof texture.texture === "function") {
|
|
66
|
+
texture.d = texture.texture;
|
|
67
|
+
texture.texture = "paths";
|
|
68
|
+
} else if (texture.texture === "grid") {
|
|
69
|
+
if (!texture.orientation && !textureDefault.orientation) texture.orientation = [
|
|
70
|
+
"vertical",
|
|
71
|
+
"horizontal"
|
|
72
|
+
];
|
|
73
|
+
texture.texture = "lines";
|
|
74
|
+
}
|
|
75
|
+
if (!texture.fill && texture.texture !== "paths") texture.fill = texture.stroke;
|
|
76
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
77
|
+
try {
|
|
78
|
+
for(var _iterator = colorKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
79
|
+
var key = _step.value;
|
|
80
|
+
var v = texture[key];
|
|
81
|
+
if (v && (typeof v === "undefined" ? "undefined" : _type_of(v)) === "object") texture[key] = String(v);
|
|
82
|
+
}
|
|
83
|
+
} catch (err) {
|
|
84
|
+
_didIteratorError = true;
|
|
85
|
+
_iteratorError = err;
|
|
86
|
+
} finally{
|
|
87
|
+
try {
|
|
88
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
89
|
+
_iterator.return();
|
|
90
|
+
}
|
|
91
|
+
} finally{
|
|
92
|
+
if (_didIteratorError) {
|
|
93
|
+
throw _iteratorError;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
var retObj = assign({}, textureDefault, texture);
|
|
98
|
+
if (typeof retObj.d === "function") {
|
|
99
|
+
retObj.d = retObj.d(retObj.size || 20);
|
|
100
|
+
}
|
|
101
|
+
return JSON.stringify(retObj);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=textureKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/shapes/textureKey.ts"],"sourcesContent":["import {assign, isObject} from \"@d3plus/dom\";\n\n/** textures.js path-based texture names, drawn by its `paths()` generator. */\nconst pathNames = [\n \"squares\",\n \"nylon\",\n \"waves\",\n \"woven\",\n \"crosses\",\n \"caps\",\n \"hexagons\",\n];\n\n/** Color-valued texture keys; a d3-color object is reduced to its CSS string. */\nconst colorKeys = [\"background\", \"fill\", \"stroke\"];\n\n/**\n Builds the JSON key of a textures.js config for one datum, or `false` when\n the datum has no texture or no fill (`\"none\"`, e.g. a line or link). The key is what a `pattern:<key>` scene fill\n carries for the renderer backends to materialize. `fill` and `stroke` are\n the shape's resolved fill and stroke for the datum, used as the texture's\n default background and line colors.\n @private\n*/\nexport function textureKey(\n textureVal: unknown,\n fill: () => unknown,\n stroke: () => unknown,\n textureDefault: Record<string, unknown> = {},\n): string | false {\n if (!textureVal) return false;\n const background = fill();\n if (background === \"none\") return false;\n const texture: Record<string, unknown> = isObject(textureVal)\n ? {...(textureVal as Record<string, unknown>)}\n : {texture: textureVal};\n if (!texture.background) texture.background = background;\n if (!texture.stroke && !textureDefault.stroke) texture.stroke = stroke();\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 && !textureDefault.orientation)\n texture.orientation = [\"vertical\", \"horizontal\"];\n texture.texture = \"lines\";\n }\n if (!texture.fill && texture.texture !== \"paths\")\n texture.fill = texture.stroke;\n for (const key of colorKeys) {\n const v = texture[key];\n if (v && typeof v === \"object\") texture[key] = String(v);\n }\n const retObj = assign({}, textureDefault, texture);\n if (typeof retObj.d === \"function\") {\n retObj.d = retObj.d(retObj.size || 20);\n }\n return JSON.stringify(retObj);\n}\n"],"names":["assign","isObject","pathNames","colorKeys","textureKey","textureVal","fill","stroke","textureDefault","background","texture","includes","d","orientation","key","v","String","retObj","size","JSON","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,EAAEC,QAAQ,QAAO,cAA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