@fusedashlabs/widgets 0.4.0 → 0.4.2
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/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.d.ts +1 -0
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.d.ts.map +1 -1
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.js +18 -4
- package/dist/components/chart-renderer/element/ui9000-chart-renderer.js.map +1 -1
- package/dist/components/chart-renderer/lib/registry.d.ts.map +1 -1
- package/dist/components/chart-renderer/lib/registry.js +3 -1
- package/dist/components/chart-renderer/lib/registry.js.map +1 -1
- package/dist/components/kpi-widget/element/styles.d.ts.map +1 -1
- package/dist/components/kpi-widget/element/styles.js +268 -5
- package/dist/components/kpi-widget/element/styles.js.map +1 -1
- package/dist/components/kpi-widget/element/ui9000-kpi-widget.d.ts +10 -1
- package/dist/components/kpi-widget/element/ui9000-kpi-widget.d.ts.map +1 -1
- package/dist/components/kpi-widget/element/ui9000-kpi-widget.js +154 -27
- package/dist/components/kpi-widget/element/ui9000-kpi-widget.js.map +1 -1
- package/dist/components/kpi-widget/index.d.ts +1 -1
- package/dist/components/kpi-widget/index.d.ts.map +1 -1
- package/dist/components/kpi-widget/index.js +7 -4
- package/dist/components/kpi-widget/lib/extract.d.ts +5 -1
- package/dist/components/kpi-widget/lib/extract.d.ts.map +1 -1
- package/dist/components/kpi-widget/lib/extract.js +110 -34
- package/dist/components/kpi-widget/lib/extract.js.map +1 -1
- package/dist/components/kpi-widget/lib/format.d.ts +5 -0
- package/dist/components/kpi-widget/lib/format.d.ts.map +1 -1
- package/dist/components/kpi-widget/lib/format.js +10 -1
- package/dist/components/kpi-widget/lib/format.js.map +1 -1
- package/dist/components/kpi-widget/lib/grid.d.ts +5 -0
- package/dist/components/kpi-widget/lib/grid.d.ts.map +1 -1
- package/dist/components/kpi-widget/lib/grid.js +18 -0
- package/dist/components/kpi-widget/lib/grid.js.map +1 -1
- package/dist/components/kpi-widget/lib/index.d.ts +5 -5
- package/dist/components/kpi-widget/lib/index.d.ts.map +1 -1
- package/dist/components/kpi-widget/lib/normalize.d.ts +2 -0
- package/dist/components/kpi-widget/lib/normalize.d.ts.map +1 -1
- package/dist/components/kpi-widget/lib/normalize.js +73 -12
- package/dist/components/kpi-widget/lib/normalize.js.map +1 -1
- package/dist/components/kpi-widget/lib/types.d.ts +41 -0
- package/dist/components/kpi-widget/lib/types.d.ts.map +1 -1
- package/dist/components/kpi-widget/metadata.json.d.ts +1 -1
- package/dist/components/kpi-widget/metadata.json.js +1 -1
- package/dist/components/map-chart/element/ui9000-map-chart.d.ts +1 -0
- package/dist/components/map-chart/element/ui9000-map-chart.d.ts.map +1 -1
- package/dist/components/map-chart/element/ui9000-map-chart.js +12 -4
- package/dist/components/map-chart/element/ui9000-map-chart.js.map +1 -1
- package/dist/components/map-chart/lib/geojson.d.ts.map +1 -1
- package/dist/components/map-chart/lib/geojson.js +3 -1
- package/dist/components/map-chart/lib/geojson.js.map +1 -1
- package/dist/components/map-chart/metadata.json.d.ts +1 -1
- package/dist/components/map-chart/metadata.json.js +1 -1
- package/dist/components/map-chart/render/draw.d.ts.map +1 -1
- package/dist/components/map-chart/render/draw.js +2 -1
- package/dist/components/map-chart/render/draw.js.map +1 -1
- package/dist/components/partial-dependence-chart/element/styles.d.ts +2 -0
- package/dist/components/partial-dependence-chart/element/styles.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/element/styles.js +48 -0
- package/dist/components/partial-dependence-chart/element/styles.js.map +1 -0
- package/dist/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.d.ts +30 -0
- package/dist/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.js +163 -0
- package/dist/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.js.map +1 -0
- package/dist/components/partial-dependence-chart/index.d.ts +5 -0
- package/dist/components/partial-dependence-chart/index.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/index.js +18 -0
- package/dist/components/partial-dependence-chart/index.js.map +1 -0
- package/dist/components/partial-dependence-chart/lib/domain.d.ts +6 -0
- package/dist/components/partial-dependence-chart/lib/domain.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/lib/domain.js +16 -0
- package/dist/components/partial-dependence-chart/lib/domain.js.map +1 -0
- package/dist/components/partial-dependence-chart/lib/index.d.ts +5 -0
- package/dist/components/partial-dependence-chart/lib/index.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/lib/normalize.d.ts +4 -0
- package/dist/components/partial-dependence-chart/lib/normalize.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/lib/normalize.js +167 -0
- package/dist/components/partial-dependence-chart/lib/normalize.js.map +1 -0
- package/dist/components/partial-dependence-chart/lib/series.d.ts +15 -0
- package/dist/components/partial-dependence-chart/lib/series.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/lib/series.js +63 -0
- package/dist/components/partial-dependence-chart/lib/series.js.map +1 -0
- package/dist/components/partial-dependence-chart/lib/types.d.ts +50 -0
- package/dist/components/partial-dependence-chart/lib/types.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/metadata.json.d.ts +80 -0
- package/dist/components/partial-dependence-chart/metadata.json.js +42 -0
- package/dist/components/partial-dependence-chart/metadata.json.js.map +1 -0
- package/dist/components/partial-dependence-chart/render/draw.d.ts +34 -0
- package/dist/components/partial-dependence-chart/render/draw.d.ts.map +1 -0
- package/dist/components/partial-dependence-chart/render/draw.js +95 -0
- package/dist/components/partial-dependence-chart/render/draw.js.map +1 -0
- package/dist/components/partial-dependence-chart/render/index.d.ts +2 -0
- package/dist/components/partial-dependence-chart/render/index.d.ts.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -10
- package/dist/index.js.map +1 -1
- package/dist/lazy/index.d.ts +2 -1
- package/dist/lazy/index.d.ts.map +1 -1
- package/dist/lazy/index.js +8 -0
- package/dist/lazy/index.js.map +1 -1
- package/dist/lazy/partial-dependence-chart.d.ts +4 -0
- package/dist/lazy/partial-dependence-chart.d.ts.map +1 -0
- package/dist/lazy/partial-dependence-chart.js +5 -0
- package/dist/lazy/partial-dependence-chart.js.map +1 -0
- package/dist/utils/chart-helpers.d.ts +2 -0
- package/dist/utils/chart-helpers.d.ts.map +1 -1
- package/dist/utils/chart-helpers.js +15 -0
- package/dist/utils/chart-helpers.js.map +1 -1
- package/dist/utils/fusedash-visual.d.ts +12 -0
- package/dist/utils/fusedash-visual.d.ts.map +1 -1
- package/dist/utils/fusedash-visual.js +7 -0
- package/dist/utils/fusedash-visual.js.map +1 -1
- package/package.json +11 -2
- package/dist/node_modules/lit-html/directive.js +0 -28
- package/dist/node_modules/lit-html/directive.js.map +0 -1
- package/dist/node_modules/lit-html/directives/style-map.js +0 -37
- package/dist/node_modules/lit-html/directives/style-map.js.map +0 -1
- package/dist/node_modules/lit-html/lit-html.js +0 -231
- package/dist/node_modules/lit-html/lit-html.js.map +0 -1
|
@@ -12,7 +12,7 @@ declare const _default: {
|
|
|
12
12
|
"host": "mcp-chat",
|
|
13
13
|
"notFor": "fusedash-editor",
|
|
14
14
|
"mapsExcluded": false,
|
|
15
|
-
"hostReady":
|
|
15
|
+
"hostReady": true,
|
|
16
16
|
"requires": ["mapbox-token", "geojson", "pmtiles"]
|
|
17
17
|
},
|
|
18
18
|
"allowedActions": ["hover", "pan", "zoom", "resize"],
|
|
@@ -7,7 +7,7 @@ const source = "client/libs/shared/components/src/Widgets/MapBox/";
|
|
|
7
7
|
const stack = "mapbox-gl";
|
|
8
8
|
const lazyImport = "@fusedashlabs/widgets/lazy/map-chart";
|
|
9
9
|
const entry = "@fusedashlabs/widgets/map-chart";
|
|
10
|
-
const usageConditions = { "host": "mcp-chat", "notFor": "fusedash-editor", "mapsExcluded": false, "hostReady":
|
|
10
|
+
const usageConditions = { "host": "mcp-chat", "notFor": "fusedash-editor", "mapsExcluded": false, "hostReady": true, "requires": ["mapbox-token", "geojson", "pmtiles"] };
|
|
11
11
|
const allowedActions = ["hover", "pan", "zoom", "resize"];
|
|
12
12
|
const propsSchema = { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "oneOf": [{ "type": "object", "description": "FuseDash WidgetItem-shaped map payload (layers[].data + geospatialData).", "properties": { "name": { "type": "string" }, "chartType": { "type": "string", "const": "mapChart" }, "layers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "visualisationType": { "type": "string", "enum": ["choropleth", "bubbles", "spike", "markers"] }, "geospatialData": { "type": "array", "items": { "type": "string" } }, "arrangeByMetric": { "type": "array", "items": { "type": "string" } }, "data": { "type": "array", "items": { "type": "object" } } } } } } }, { "type": "array", "description": "Chat rows { label, value } joined as a country choropleth.", "items": { "type": "object", "required": ["label", "value"], "properties": { "label": { "type": "string" }, "value": { "type": "number" } } } }] }, "chart-title": { "type": "string" }, "show-header": { "type": "boolean", "default": true }, "show-legend": { "type": "boolean", "default": true }, "show-tooltip": { "type": "boolean", "default": true }, "mapbox-token": { "type": "string" }, "geojson-base-url": { "type": "string", "description": "Base URL that serves {country,state,county,city,province}.json centroid FeatureCollections used for the data-join / bubbles / spikes." }, "pmtiles-base-url": { "type": "string", "default": "/pmtiles", "description": "Base URL that serves world-countries.pmtiles (and other admin archives). Choropleth fills use these vector tiles — the GeoJSON files are centroids, not polygons." } }, "required": ["data"] };
|
|
13
13
|
const mapChartMeta = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../src/components/map-chart/render/draw.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAA8B,aAAa,EAAiB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE1G,MAAM,MAAM,OAA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AAiB,CAAC;AAE1G,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvC,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;CACvF,CAAC;AAmDF,wBAAgB,YAAY,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAGzD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAK9D;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA2GpC"}
|
|
@@ -24,7 +24,8 @@ async function renderMapChart(container, options) {
|
|
|
24
24
|
if (!options.token) return null;
|
|
25
25
|
let mapbox;
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
const runtime = globalThis.mapboxgl;
|
|
28
|
+
mapbox = runtime ? { default: runtime } : await import("mapbox-gl");
|
|
28
29
|
} catch {
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.js","sources":["../../../../src/components/map-chart/render/draw.ts"],"sourcesContent":["import {\n BUBBLE_RADIUS_STEPS,\n MAP_STYLES,\n MAPBOX_CSS_HREF,\n UNMATCHED_FILL,\n sanitizeKey,\n type MapVisualisation,\n} from '../lib/constants.js';\nimport { collectionBBox } from '../lib/domain.js';\nimport { darkenColor, hexToRgba } from '../lib/format.js';\nimport { getRegionIdFromFeatureProperties } from '../lib/geo-index.js';\nimport { orderedLayers } from '../lib/join.js';\nimport {\n defaultLayerSlider,\n featuresForYear,\n featuresInSliderRange,\n type LayerSlider,\n} from '../lib/legend.js';\nimport {\n choroplethPmtilesSource,\n pmtilesIdExpression,\n toPmtilesFillLayer,\n toPmtilesStrokeLayer,\n type PmtilesLayerConfig,\n} from '../lib/pmtiles.js';\nimport type { ColorRange, GeoJsonFeature, MapHoverEntry, MapLayerModel, MapModel } from '../lib/types.js';\n\nexport type MapMode = 'light' | 'dark';\n\nexport type RenderMapChartOptions = {\n model: MapModel;\n token: string;\n mode?: MapMode;\n showTooltip?: boolean;\n pmtilesBaseUrl?: string;\n activeLayerIds?: string[];\n sliders?: Record<string, LayerSlider>;\n year?: string;\n onHover?: (entry: MapHoverEntry | null) => void;\n};\n\nexport type MapChartController = {\n resize: () => void;\n destroy: () => void;\n setYear: (year: string | undefined) => void;\n applyLegend: (activeLayerIds: string[], sliders: Record<string, LayerSlider>) => void;\n};\n\ntype LiveMapLayer = {\n layerId: string;\n visualisationType: MapVisualisation;\n sourceId: string;\n paintIds: string[];\n fillId?: string;\n yearKey: string;\n features: GeoJsonFeature[];\n colorRanges: ColorRange[];\n pmtilesConfig?: PmtilesLayerConfig;\n};\n\ntype MapboxMap = {\n addSource: (id: string, source: Record<string, unknown>) => void;\n addLayer: (layer: Record<string, unknown>, before?: string) => void;\n addImage: (id: string, image: ImageData, options?: { pixelRatio?: number }) => void;\n getSource: (id: string) => { setData?: (data: unknown) => void } | undefined;\n getLayer: (id: string) => unknown;\n hasImage: (id: string) => boolean;\n removeImage: (id: string) => void;\n setPaintProperty: (id: string, name: string, value: unknown) => void;\n setLayoutProperty: (id: string, name: string, value: unknown) => void;\n setFilter: (id: string, filter: unknown) => void;\n fitBounds: (\n bounds: [[number, number], [number, number]],\n options?: { padding?: number; duration?: number },\n ) => void;\n resize: () => void;\n remove: () => void;\n loaded: () => boolean;\n isStyleLoaded: () => boolean;\n on: (event: string, layerOrHandler: unknown, handler?: unknown) => void;\n off: (event: string, layerOrHandler: unknown, handler?: unknown) => void;\n once: (event: string, handler: () => void) => void;\n queryRenderedFeatures: (\n point: unknown,\n options?: { layers?: string[] },\n ) => Array<{ properties?: Record<string, unknown>; geometry?: { coordinates?: unknown } }>;\n};\n\ntype MapboxModule = {\n default: {\n accessToken: string;\n Map: new (options: Record<string, unknown>) => MapboxMap;\n };\n};\n\nconst controllers = new WeakMap<HTMLElement, MapChartController>();\n\nexport function stopMapChart(container: HTMLElement): void {\n controllers.get(container)?.destroy();\n controllers.delete(container);\n}\n\nexport function resizeMapChart(container: HTMLElement): boolean {\n const ctl = controllers.get(container);\n if (!ctl) return false;\n ctl.resize();\n return true;\n}\n\nexport async function renderMapChart(\n container: HTMLElement,\n options: RenderMapChartOptions,\n): Promise<MapChartController | null> {\n stopMapChart(container);\n container.replaceChildren();\n injectCss(container);\n\n if (!options.token) return null;\n\n let mapbox: MapboxModule;\n try {\n mapbox = (await import('mapbox-gl')) as unknown as MapboxModule;\n } catch {\n return null;\n }\n\n const root = document.createElement('div');\n root.setAttribute('part', 'map');\n root.style.cssText = 'width:100%;height:100%;min-height:inherit;';\n container.append(root);\n\n mapbox.default.accessToken = options.token;\n const map = new mapbox.default.Map({\n container: root,\n style: options.model.terrain\n ? MAP_STYLES.terrain\n : options.mode === 'dark'\n ? MAP_STYLES.dark\n : MAP_STYLES.light,\n center: [0, 20],\n zoom: 1.4,\n attributionControl: true,\n preserveDrawingBuffer: true,\n });\n\n let destroyed = false;\n const layers = orderedLayers(options.model.layers.filter((l) => l.features.length > 0));\n const hover = options.showTooltip === false ? undefined : options.onHover;\n const live: LiveMapLayer[] = [];\n let legend = {\n activeLayerIds: options.activeLayerIds ?? layers.map((layer) => layer.layerId),\n sliders: options.sliders ?? {},\n year: options.year,\n };\n\n const applyLayers = (): void => {\n if (destroyed) return;\n live.length = 0;\n for (const layer of layers) {\n if (layer.visualisationType === 'choropleth') {\n live.push(addChoropleth(map, layer, hover, options.mode, options.pmtilesBaseUrl));\n } else if (layer.visualisationType === 'bubbles') {\n live.push(addCircles(map, layer, 'bubbles', hover));\n } else if (layer.visualisationType === 'markers') {\n live.push(addCircles(map, layer, 'markers', hover));\n } else {\n live.push(addSpikes(map, layer, hover));\n }\n }\n applyLegendState(map, live, legend.activeLayerIds, legend.sliders, legend.year);\n fit(map, layers);\n };\n\n map.once('load', applyLayers);\n if (map.isStyleLoaded() && map.loaded()) applyLayers();\n\n const controller: MapChartController = {\n resize: () => {\n try {\n map.resize();\n } catch {\n /* map already gone */\n }\n },\n destroy: () => {\n destroyed = true;\n try {\n map.remove();\n } catch {\n /* ignore */\n }\n container.replaceChildren();\n },\n setYear: (year) => {\n legend = { ...legend, year };\n if (destroyed) return;\n try {\n if (!map.isStyleLoaded()) return;\n applyLegendState(map, live, legend.activeLayerIds, legend.sliders, legend.year);\n } catch {\n /* style not ready */\n }\n },\n applyLegend: (activeLayerIds, sliders) => {\n legend = { ...legend, activeLayerIds, sliders };\n if (destroyed) return;\n try {\n if (!map.isStyleLoaded()) return;\n applyLegendState(map, live, activeLayerIds, sliders, legend.year);\n } catch {\n /* style not ready */\n }\n },\n };\n controllers.set(container, controller);\n return controller;\n}\n\nfunction injectCss(container: HTMLElement): void {\n const root = container.getRootNode();\n const host = root instanceof ShadowRoot ? root : document.head;\n if (host.querySelector('#ui9000-mapbox-css')) return;\n const link = document.createElement('link');\n link.id = 'ui9000-mapbox-css';\n link.rel = 'stylesheet';\n link.href = MAPBOX_CSS_HREF;\n host.append(link);\n}\n\nfunction addChoropleth(\n map: MapboxMap,\n layer: MapLayerModel,\n onHover: RenderMapChartOptions['onHover'],\n mode?: MapMode,\n pmtilesBaseUrl?: string,\n): LiveMapLayer {\n const queryKey = sanitizeKey(layer.layerId);\n const sourceId = `${layer.mapType}-${queryKey}`;\n const fillId = `${sourceId}-fill-layer`;\n const strokeId = `${sourceId}-selected-stroke-layer`;\n const fillColor = choroplethFillColor(layer, mode);\n const inRangeIds = Object.keys(layer.colorById);\n const pmtiles = choroplethPmtilesSource(layer.mapType, layer.features, pmtilesBaseUrl);\n\n const fillSpec: Record<string, unknown> = {\n id: fillId,\n type: 'fill',\n source: sourceId,\n paint: {\n 'fill-color': fillColor,\n 'fill-opacity': 1,\n },\n };\n const strokeSpec: Record<string, unknown> = {\n id: strokeId,\n type: 'line',\n source: sourceId,\n paint: {\n 'line-color': '#000000',\n 'line-width': 0,\n 'line-opacity': 0,\n },\n };\n\n if (pmtiles) {\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, {\n type: 'vector',\n provider: 'pmtiles',\n url: pmtiles.url,\n });\n }\n addLayerMaybeBefore(\n map,\n toPmtilesFillLayer(fillSpec, pmtiles.config, inRangeIds),\n );\n if (!map.getLayer(strokeId)) {\n map.addLayer(toPmtilesStrokeLayer(strokeSpec, pmtiles.config));\n }\n const idExpr = pmtilesIdExpression(pmtiles.config);\n bindHover(map, fillId, layer, onHover, (id) => {\n map.setPaintProperty(strokeId, 'line-width', ['case', ['==', idExpr, id ?? ''], 2, 0]);\n map.setPaintProperty(strokeId, 'line-opacity', ['case', ['==', idExpr, id ?? ''], 1, 0]);\n });\n return {\n layerId: layer.layerId,\n visualisationType: 'choropleth',\n sourceId,\n paintIds: [fillId, strokeId],\n fillId,\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n pmtilesConfig: pmtiles.config,\n };\n }\n\n const collection = {\n type: 'FeatureCollection',\n features: layer.features,\n };\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, { type: 'geojson', data: collection });\n } else {\n map.getSource(sourceId)?.setData?.(collection);\n }\n\n addLayerMaybeBefore(map, fillSpec);\n if (!map.getLayer(strokeId)) {\n map.addLayer(strokeSpec);\n }\n\n bindHover(map, fillId, layer, onHover, (id) => {\n map.setPaintProperty(strokeId, 'line-width', ['case', ['==', ['get', 'id'], id ?? ''], 2, 0]);\n map.setPaintProperty(strokeId, 'line-opacity', ['case', ['==', ['get', 'id'], id ?? ''], 1, 0]);\n });\n return {\n layerId: layer.layerId,\n visualisationType: 'choropleth',\n sourceId,\n paintIds: [fillId, strokeId],\n fillId,\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n };\n}\n\nfunction choroplethFillColor(layer: MapLayerModel, mode?: MapMode): unknown {\n const fillColor: unknown[] = ['match', ['get', 'id']];\n for (const [id, color] of Object.entries(layer.colorById)) {\n fillColor.push(id, mode === 'dark' ? hexToRgba(darkenColor(rgbaToHex(color), 0.3), 1) : color);\n }\n fillColor.push(UNMATCHED_FILL);\n return fillColor.length > 3 ? fillColor : UNMATCHED_FILL;\n}\n\nfunction addLayerMaybeBefore(map: MapboxMap, layer: Record<string, unknown>): void {\n if (map.getLayer(String(layer.id))) return;\n try {\n map.addLayer(layer, 'road');\n } catch {\n map.addLayer(layer);\n }\n}\n\nfunction addCircles(\n map: MapboxMap,\n layer: MapLayerModel,\n kind: 'bubbles' | 'markers',\n onHover: RenderMapChartOptions['onHover'],\n): LiveMapLayer {\n const queryKey = sanitizeKey(layer.layerId);\n const sourceId = kind === 'bubbles' ? `bubbles-${queryKey}` : `scatterplot-${queryKey}`;\n const layerId = kind === 'bubbles' ? `bubble-layer-${queryKey}` : `scatterplot-layer-${queryKey}`;\n const collection = { type: 'FeatureCollection', features: layer.features };\n\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, { type: 'geojson', data: collection });\n } else {\n map.getSource(sourceId)?.setData?.(collection);\n }\n\n const radius =\n kind === 'markers'\n ? 4\n : bubbleRadiusExpression(layer);\n\n if (!map.getLayer(layerId)) {\n map.addLayer({\n id: layerId,\n type: 'circle',\n source: sourceId,\n paint: {\n 'circle-radius': radius,\n 'circle-color': layer.fillColor,\n 'circle-opacity': kind === 'bubbles' ? 0.6 : 0.8,\n 'circle-stroke-width': 1,\n 'circle-stroke-color': kind === 'markers' ? '#fff' : layer.fillColor,\n },\n });\n }\n\n bindHover(map, layerId, layer, onHover);\n return {\n layerId: layer.layerId,\n visualisationType: kind,\n sourceId,\n paintIds: [layerId],\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n };\n}\n\nfunction addSpikes(\n map: MapboxMap,\n layer: MapLayerModel,\n onHover: RenderMapChartOptions['onHover'],\n): LiveMapLayer {\n const queryKey = sanitizeKey(layer.layerId);\n const sourceId = `spikes-${queryKey}`;\n const layerId = `svg-spikes-layer-${queryKey}`;\n const collection = { type: 'FeatureCollection', features: layer.features };\n\n for (const feature of layer.features) {\n const iconName = feature.properties?.iconName;\n const svg = feature.properties?.svgContent;\n if (typeof iconName !== 'string' || typeof svg !== 'string') continue;\n void loadSpikeIcon(map, iconName, svg);\n }\n\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, { type: 'geojson', data: collection });\n } else {\n map.getSource(sourceId)?.setData?.(collection);\n }\n\n if (!map.getLayer(layerId)) {\n map.addLayer({\n id: layerId,\n type: 'symbol',\n source: sourceId,\n layout: {\n visibility: 'visible',\n 'icon-image': ['get', 'iconName'],\n 'icon-size': 0.9,\n 'icon-allow-overlap': true,\n 'icon-ignore-placement': true,\n 'icon-anchor': 'bottom',\n },\n paint: { 'icon-opacity': 1 },\n });\n }\n\n bindHover(map, layerId, layer, onHover);\n return {\n layerId: layer.layerId,\n visualisationType: 'spike',\n sourceId,\n paintIds: [layerId],\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n };\n}\n\nfunction applyLegendState(\n map: MapboxMap,\n live: LiveMapLayer[],\n activeLayerIds: string[],\n sliders: Record<string, LayerSlider>,\n year?: string,\n): void {\n const active = new Set(activeLayerIds);\n for (const layer of live) {\n const visible = active.has(layer.layerId);\n for (const paintId of layer.paintIds) {\n if (!map.getLayer(paintId)) continue;\n try {\n map.setLayoutProperty(paintId, 'visibility', visible ? 'visible' : 'none');\n } catch {\n /* layer not ready */\n }\n }\n if (!visible) continue;\n const slider = sliders[layer.layerId] ?? defaultLayerSlider(layer.colorRanges.length);\n const inYear = featuresForYear(layer.features, year, layer.yearKey);\n const filtered = featuresInSliderRange(inYear, layer.colorRanges, slider);\n if (layer.visualisationType === 'choropleth' && layer.pmtilesConfig && layer.fillId) {\n const ids = [\n ...new Set(\n filtered\n .map((feature) => feature.properties?.id)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n ),\n ];\n const filter =\n ids.length > 0\n ? ['in', pmtilesIdExpression(layer.pmtilesConfig), ['literal', ids]]\n : ['==', 1, 0];\n try {\n map.setFilter(layer.fillId, filter);\n } catch {\n /* ignore */\n }\n continue;\n }\n try {\n map.getSource(layer.sourceId)?.setData?.({ type: 'FeatureCollection', features: filtered });\n } catch {\n /* source gone */\n }\n }\n}\n\nfunction bubbleRadiusExpression(layer: MapLayerModel): unknown {\n const ranges = [...layer.colorRanges].sort((a, b) => a.start - b.start);\n if (!ranges.length) return BUBBLE_RADIUS_STEPS[0];\n const expr: unknown[] = [\n 'step',\n ['coalesce', ['to-number', ['get', 'value']], ranges[0].start],\n BUBBLE_RADIUS_STEPS[0],\n ];\n for (let i = 1; i < Math.min(ranges.length, BUBBLE_RADIUS_STEPS.length); i++) {\n expr.push(ranges[i].start, BUBBLE_RADIUS_STEPS[i]);\n }\n return expr.length < 4 ? BUBBLE_RADIUS_STEPS[0] : expr;\n}\n\nfunction bindHover(\n map: MapboxMap,\n layerId: string,\n layer: MapLayerModel,\n onHover: RenderMapChartOptions['onHover'],\n onId?: (id: string | null) => void,\n): void {\n if (!onHover) return;\n\n const read = (properties: Record<string, unknown> | undefined): MapHoverEntry | null => {\n if (!properties) return null;\n const regionId = String(\n getRegionIdFromFeatureProperties(properties, layer.mapType) ??\n properties.id ??\n properties.regionId ??\n '',\n );\n if (!regionId) return null;\n const feature = layer.features.find(\n (f) => String(f.properties?.id ?? f.properties?.regionId) === regionId,\n );\n const props = feature?.properties ?? properties;\n const value = Number(props.value ?? 0);\n const regionName = String(props.regionName ?? props.name ?? regionId);\n return {\n regionId,\n regionName,\n value,\n valueKey: layer.valueKey,\n layerName: layer.layerName,\n lngLat: { lng: 0, lat: 0 },\n };\n };\n\n map.on(\n 'mousemove',\n layerId,\n (e: {\n point?: { x: number; y: number };\n lngLat?: { lng: number; lat: number };\n }) => {\n const feature = map.queryRenderedFeatures(e.point, { layers: [layerId] })[0];\n const entry = read(feature?.properties);\n if (!entry) {\n onId?.(null);\n onHover(null);\n return;\n }\n if (e.lngLat) entry.lngLat = e.lngLat;\n if (e.point) entry.point = e.point;\n onId?.(entry.regionId);\n onHover(entry);\n },\n );\n map.on('mouseleave', layerId, () => {\n onId?.(null);\n onHover(null);\n });\n}\n\nfunction fit(map: MapboxMap, layers: MapLayerModel[]): void {\n const features = layers.flatMap((l) => l.features);\n const box = collectionBBox(features);\n if (!box) return;\n try {\n map.fitBounds(\n [\n [box[0], box[1]],\n [box[2], box[3]],\n ],\n { padding: 64, duration: 750 },\n );\n } catch {\n /* empty bounds */\n }\n}\n\nfunction loadSpikeIcon(map: MapboxMap, iconName: string, svgContent: string): void {\n const svgDataUrl = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgContent)}`;\n const img = new Image();\n img.onload = () => {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const pixelRatio = 2;\n canvas.width = (img.width || 30) * pixelRatio;\n canvas.height = (img.height || 30) * pixelRatio;\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n ctx.drawImage(img, 0, 0, img.width || 30, img.height || 30);\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n if (map.hasImage(iconName)) {\n try {\n map.removeImage(iconName);\n } catch {\n /* ignore */\n }\n }\n try {\n map.addImage(iconName, imageData, { pixelRatio: 2 });\n } catch {\n /* already exists */\n }\n };\n img.src = svgDataUrl;\n}\n\nfunction rgbaToHex(color: string): string {\n const match = color.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n if (!match) return color.startsWith('#') ? color : '#473DD9';\n const hex = (n: string) => Number(n).toString(16).padStart(2, '0');\n return `#${hex(match[1])}${hex(match[2])}${hex(match[3])}`;\n}\n"],"names":["_a"],"mappings":";;;;;;;AA+FA,MAAM,kCAAkB,QAAA;AAEjB,SAAS,aAAa,WAA8B;;AACzD,oBAAY,IAAI,SAAS,MAAzB,mBAA4B;AAC5B,cAAY,OAAO,SAAS;AAC9B;AAEO,SAAS,eAAe,WAAiC;AAC9D,QAAM,MAAM,YAAY,IAAI,SAAS;AACrC,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI,OAAA;AACJ,SAAO;AACT;AAEA,eAAsB,eACpB,WACA,SACoC;AACpC,eAAa,SAAS;AACtB,YAAU,gBAAA;AACV,YAAU,SAAS;AAEnB,MAAI,CAAC,QAAQ,MAAO,QAAO;AAE3B,MAAI;AACJ,MAAI;AACF,aAAU,MAAM,OAAO,WAAW;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,SAAS,cAAc,KAAK;AACzC,OAAK,aAAa,QAAQ,KAAK;AAC/B,OAAK,MAAM,UAAU;AACrB,YAAU,OAAO,IAAI;AAErB,SAAO,QAAQ,cAAc,QAAQ;AACrC,QAAM,MAAM,IAAI,OAAO,QAAQ,IAAI;AAAA,IACjC,WAAW;AAAA,IACX,OAAO,QAAQ,MAAM,UACjB,WAAW,UACX,QAAQ,SAAS,SACf,WAAW,OACX,WAAW;AAAA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AG,GAAG,OAAO,OAAO,OAAO,MAAM;AACpE,QAAI,IAAI,SAAS,QAAQ,GAAG;AAC1B,UAAI;AACF,YAAI,YAAY,QAAQ;AAAA,MAC1B,QAAQ;AAAA,MAER;AAAA,IACF;AACA,QAAI;AACF,UAAI,SAAS,UAAU,WAAW,EAAE,YAAY,GAAG;AAAA,IACrD,QAAQ;AAAA,IAER;AAAA,EACF;AACA,MAAI,MAAM;AACZ;AAEA,SAAS,UAAU,OAAuB;AACxC,QAAM,QAAQ,MAAM,MAAM,gCAAgC;AAC1D,MAAI,CAAC,MAAO,QAAO,MAAM,WAAW,GAAG,IAAI,QAAQ;AACnD,QAAM,MAAM,CAAC,MAAc,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AACjE,SAAO,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC;AAC1D;"}
|
|
1
|
+
{"version":3,"file":"draw.js","sources":["../../../../src/components/map-chart/render/draw.ts"],"sourcesContent":["import {\n BUBBLE_RADIUS_STEPS,\n MAP_STYLES,\n MAPBOX_CSS_HREF,\n UNMATCHED_FILL,\n sanitizeKey,\n type MapVisualisation,\n} from '../lib/constants.js';\nimport { collectionBBox } from '../lib/domain.js';\nimport { darkenColor, hexToRgba } from '../lib/format.js';\nimport { getRegionIdFromFeatureProperties } from '../lib/geo-index.js';\nimport { orderedLayers } from '../lib/join.js';\nimport {\n defaultLayerSlider,\n featuresForYear,\n featuresInSliderRange,\n type LayerSlider,\n} from '../lib/legend.js';\nimport {\n choroplethPmtilesSource,\n pmtilesIdExpression,\n toPmtilesFillLayer,\n toPmtilesStrokeLayer,\n type PmtilesLayerConfig,\n} from '../lib/pmtiles.js';\nimport type { ColorRange, GeoJsonFeature, MapHoverEntry, MapLayerModel, MapModel } from '../lib/types.js';\n\nexport type MapMode = 'light' | 'dark';\n\nexport type RenderMapChartOptions = {\n model: MapModel;\n token: string;\n mode?: MapMode;\n showTooltip?: boolean;\n pmtilesBaseUrl?: string;\n activeLayerIds?: string[];\n sliders?: Record<string, LayerSlider>;\n year?: string;\n onHover?: (entry: MapHoverEntry | null) => void;\n};\n\nexport type MapChartController = {\n resize: () => void;\n destroy: () => void;\n setYear: (year: string | undefined) => void;\n applyLegend: (activeLayerIds: string[], sliders: Record<string, LayerSlider>) => void;\n};\n\ntype LiveMapLayer = {\n layerId: string;\n visualisationType: MapVisualisation;\n sourceId: string;\n paintIds: string[];\n fillId?: string;\n yearKey: string;\n features: GeoJsonFeature[];\n colorRanges: ColorRange[];\n pmtilesConfig?: PmtilesLayerConfig;\n};\n\ntype MapboxMap = {\n addSource: (id: string, source: Record<string, unknown>) => void;\n addLayer: (layer: Record<string, unknown>, before?: string) => void;\n addImage: (id: string, image: ImageData, options?: { pixelRatio?: number }) => void;\n getSource: (id: string) => { setData?: (data: unknown) => void } | undefined;\n getLayer: (id: string) => unknown;\n hasImage: (id: string) => boolean;\n removeImage: (id: string) => void;\n setPaintProperty: (id: string, name: string, value: unknown) => void;\n setLayoutProperty: (id: string, name: string, value: unknown) => void;\n setFilter: (id: string, filter: unknown) => void;\n fitBounds: (\n bounds: [[number, number], [number, number]],\n options?: { padding?: number; duration?: number },\n ) => void;\n resize: () => void;\n remove: () => void;\n loaded: () => boolean;\n isStyleLoaded: () => boolean;\n on: (event: string, layerOrHandler: unknown, handler?: unknown) => void;\n off: (event: string, layerOrHandler: unknown, handler?: unknown) => void;\n once: (event: string, handler: () => void) => void;\n queryRenderedFeatures: (\n point: unknown,\n options?: { layers?: string[] },\n ) => Array<{ properties?: Record<string, unknown>; geometry?: { coordinates?: unknown } }>;\n};\n\ntype MapboxModule = {\n default: {\n accessToken: string;\n Map: new (options: Record<string, unknown>) => MapboxMap;\n };\n};\n\nconst controllers = new WeakMap<HTMLElement, MapChartController>();\n\nexport function stopMapChart(container: HTMLElement): void {\n controllers.get(container)?.destroy();\n controllers.delete(container);\n}\n\nexport function resizeMapChart(container: HTMLElement): boolean {\n const ctl = controllers.get(container);\n if (!ctl) return false;\n ctl.resize();\n return true;\n}\n\nexport async function renderMapChart(\n container: HTMLElement,\n options: RenderMapChartOptions,\n): Promise<MapChartController | null> {\n stopMapChart(container);\n container.replaceChildren();\n injectCss(container);\n\n if (!options.token) return null;\n\n let mapbox: MapboxModule;\n try {\n const runtime = (globalThis as unknown as { mapboxgl?: MapboxModule['default'] }).mapboxgl;\n mapbox = runtime\n ? ({ default: runtime } as MapboxModule)\n : ((await import('mapbox-gl')) as unknown as MapboxModule);\n } catch {\n return null;\n }\n\n const root = document.createElement('div');\n root.setAttribute('part', 'map');\n root.style.cssText = 'width:100%;height:100%;min-height:inherit;';\n container.append(root);\n\n mapbox.default.accessToken = options.token;\n const map = new mapbox.default.Map({\n container: root,\n style: options.model.terrain\n ? MAP_STYLES.terrain\n : options.mode === 'dark'\n ? MAP_STYLES.dark\n : MAP_STYLES.light,\n center: [0, 20],\n zoom: 1.4,\n attributionControl: true,\n preserveDrawingBuffer: true,\n });\n\n let destroyed = false;\n const layers = orderedLayers(options.model.layers.filter((l) => l.features.length > 0));\n const hover = options.showTooltip === false ? undefined : options.onHover;\n const live: LiveMapLayer[] = [];\n let legend = {\n activeLayerIds: options.activeLayerIds ?? layers.map((layer) => layer.layerId),\n sliders: options.sliders ?? {},\n year: options.year,\n };\n\n const applyLayers = (): void => {\n if (destroyed) return;\n live.length = 0;\n for (const layer of layers) {\n if (layer.visualisationType === 'choropleth') {\n live.push(addChoropleth(map, layer, hover, options.mode, options.pmtilesBaseUrl));\n } else if (layer.visualisationType === 'bubbles') {\n live.push(addCircles(map, layer, 'bubbles', hover));\n } else if (layer.visualisationType === 'markers') {\n live.push(addCircles(map, layer, 'markers', hover));\n } else {\n live.push(addSpikes(map, layer, hover));\n }\n }\n applyLegendState(map, live, legend.activeLayerIds, legend.sliders, legend.year);\n fit(map, layers);\n };\n\n map.once('load', applyLayers);\n if (map.isStyleLoaded() && map.loaded()) applyLayers();\n\n const controller: MapChartController = {\n resize: () => {\n try {\n map.resize();\n } catch {\n /* map already gone */\n }\n },\n destroy: () => {\n destroyed = true;\n try {\n map.remove();\n } catch {\n /* ignore */\n }\n container.replaceChildren();\n },\n setYear: (year) => {\n legend = { ...legend, year };\n if (destroyed) return;\n try {\n if (!map.isStyleLoaded()) return;\n applyLegendState(map, live, legend.activeLayerIds, legend.sliders, legend.year);\n } catch {\n /* style not ready */\n }\n },\n applyLegend: (activeLayerIds, sliders) => {\n legend = { ...legend, activeLayerIds, sliders };\n if (destroyed) return;\n try {\n if (!map.isStyleLoaded()) return;\n applyLegendState(map, live, activeLayerIds, sliders, legend.year);\n } catch {\n /* style not ready */\n }\n },\n };\n controllers.set(container, controller);\n return controller;\n}\n\nfunction injectCss(container: HTMLElement): void {\n const root = container.getRootNode();\n const host = root instanceof ShadowRoot ? root : document.head;\n if (host.querySelector('#ui9000-mapbox-css')) return;\n const link = document.createElement('link');\n link.id = 'ui9000-mapbox-css';\n link.rel = 'stylesheet';\n link.href = MAPBOX_CSS_HREF;\n host.append(link);\n}\n\nfunction addChoropleth(\n map: MapboxMap,\n layer: MapLayerModel,\n onHover: RenderMapChartOptions['onHover'],\n mode?: MapMode,\n pmtilesBaseUrl?: string,\n): LiveMapLayer {\n const queryKey = sanitizeKey(layer.layerId);\n const sourceId = `${layer.mapType}-${queryKey}`;\n const fillId = `${sourceId}-fill-layer`;\n const strokeId = `${sourceId}-selected-stroke-layer`;\n const fillColor = choroplethFillColor(layer, mode);\n const inRangeIds = Object.keys(layer.colorById);\n const pmtiles = choroplethPmtilesSource(layer.mapType, layer.features, pmtilesBaseUrl);\n\n const fillSpec: Record<string, unknown> = {\n id: fillId,\n type: 'fill',\n source: sourceId,\n paint: {\n 'fill-color': fillColor,\n 'fill-opacity': 1,\n },\n };\n const strokeSpec: Record<string, unknown> = {\n id: strokeId,\n type: 'line',\n source: sourceId,\n paint: {\n 'line-color': '#000000',\n 'line-width': 0,\n 'line-opacity': 0,\n },\n };\n\n if (pmtiles) {\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, {\n type: 'vector',\n provider: 'pmtiles',\n url: pmtiles.url,\n });\n }\n addLayerMaybeBefore(\n map,\n toPmtilesFillLayer(fillSpec, pmtiles.config, inRangeIds),\n );\n if (!map.getLayer(strokeId)) {\n map.addLayer(toPmtilesStrokeLayer(strokeSpec, pmtiles.config));\n }\n const idExpr = pmtilesIdExpression(pmtiles.config);\n bindHover(map, fillId, layer, onHover, (id) => {\n map.setPaintProperty(strokeId, 'line-width', ['case', ['==', idExpr, id ?? ''], 2, 0]);\n map.setPaintProperty(strokeId, 'line-opacity', ['case', ['==', idExpr, id ?? ''], 1, 0]);\n });\n return {\n layerId: layer.layerId,\n visualisationType: 'choropleth',\n sourceId,\n paintIds: [fillId, strokeId],\n fillId,\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n pmtilesConfig: pmtiles.config,\n };\n }\n\n const collection = {\n type: 'FeatureCollection',\n features: layer.features,\n };\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, { type: 'geojson', data: collection });\n } else {\n map.getSource(sourceId)?.setData?.(collection);\n }\n\n addLayerMaybeBefore(map, fillSpec);\n if (!map.getLayer(strokeId)) {\n map.addLayer(strokeSpec);\n }\n\n bindHover(map, fillId, layer, onHover, (id) => {\n map.setPaintProperty(strokeId, 'line-width', ['case', ['==', ['get', 'id'], id ?? ''], 2, 0]);\n map.setPaintProperty(strokeId, 'line-opacity', ['case', ['==', ['get', 'id'], id ?? ''], 1, 0]);\n });\n return {\n layerId: layer.layerId,\n visualisationType: 'choropleth',\n sourceId,\n paintIds: [fillId, strokeId],\n fillId,\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n };\n}\n\nfunction choroplethFillColor(layer: MapLayerModel, mode?: MapMode): unknown {\n const fillColor: unknown[] = ['match', ['get', 'id']];\n for (const [id, color] of Object.entries(layer.colorById)) {\n fillColor.push(id, mode === 'dark' ? hexToRgba(darkenColor(rgbaToHex(color), 0.3), 1) : color);\n }\n fillColor.push(UNMATCHED_FILL);\n return fillColor.length > 3 ? fillColor : UNMATCHED_FILL;\n}\n\nfunction addLayerMaybeBefore(map: MapboxMap, layer: Record<string, unknown>): void {\n if (map.getLayer(String(layer.id))) return;\n try {\n map.addLayer(layer, 'road');\n } catch {\n map.addLayer(layer);\n }\n}\n\nfunction addCircles(\n map: MapboxMap,\n layer: MapLayerModel,\n kind: 'bubbles' | 'markers',\n onHover: RenderMapChartOptions['onHover'],\n): LiveMapLayer {\n const queryKey = sanitizeKey(layer.layerId);\n const sourceId = kind === 'bubbles' ? `bubbles-${queryKey}` : `scatterplot-${queryKey}`;\n const layerId = kind === 'bubbles' ? `bubble-layer-${queryKey}` : `scatterplot-layer-${queryKey}`;\n const collection = { type: 'FeatureCollection', features: layer.features };\n\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, { type: 'geojson', data: collection });\n } else {\n map.getSource(sourceId)?.setData?.(collection);\n }\n\n const radius =\n kind === 'markers'\n ? 4\n : bubbleRadiusExpression(layer);\n\n if (!map.getLayer(layerId)) {\n map.addLayer({\n id: layerId,\n type: 'circle',\n source: sourceId,\n paint: {\n 'circle-radius': radius,\n 'circle-color': layer.fillColor,\n 'circle-opacity': kind === 'bubbles' ? 0.6 : 0.8,\n 'circle-stroke-width': 1,\n 'circle-stroke-color': kind === 'markers' ? '#fff' : layer.fillColor,\n },\n });\n }\n\n bindHover(map, layerId, layer, onHover);\n return {\n layerId: layer.layerId,\n visualisationType: kind,\n sourceId,\n paintIds: [layerId],\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n };\n}\n\nfunction addSpikes(\n map: MapboxMap,\n layer: MapLayerModel,\n onHover: RenderMapChartOptions['onHover'],\n): LiveMapLayer {\n const queryKey = sanitizeKey(layer.layerId);\n const sourceId = `spikes-${queryKey}`;\n const layerId = `svg-spikes-layer-${queryKey}`;\n const collection = { type: 'FeatureCollection', features: layer.features };\n\n for (const feature of layer.features) {\n const iconName = feature.properties?.iconName;\n const svg = feature.properties?.svgContent;\n if (typeof iconName !== 'string' || typeof svg !== 'string') continue;\n void loadSpikeIcon(map, iconName, svg);\n }\n\n if (!map.getSource(sourceId)) {\n map.addSource(sourceId, { type: 'geojson', data: collection });\n } else {\n map.getSource(sourceId)?.setData?.(collection);\n }\n\n if (!map.getLayer(layerId)) {\n map.addLayer({\n id: layerId,\n type: 'symbol',\n source: sourceId,\n layout: {\n visibility: 'visible',\n 'icon-image': ['get', 'iconName'],\n 'icon-size': 0.9,\n 'icon-allow-overlap': true,\n 'icon-ignore-placement': true,\n 'icon-anchor': 'bottom',\n },\n paint: { 'icon-opacity': 1 },\n });\n }\n\n bindHover(map, layerId, layer, onHover);\n return {\n layerId: layer.layerId,\n visualisationType: 'spike',\n sourceId,\n paintIds: [layerId],\n yearKey: layer.yearKey,\n features: layer.features,\n colorRanges: layer.colorRanges,\n };\n}\n\nfunction applyLegendState(\n map: MapboxMap,\n live: LiveMapLayer[],\n activeLayerIds: string[],\n sliders: Record<string, LayerSlider>,\n year?: string,\n): void {\n const active = new Set(activeLayerIds);\n for (const layer of live) {\n const visible = active.has(layer.layerId);\n for (const paintId of layer.paintIds) {\n if (!map.getLayer(paintId)) continue;\n try {\n map.setLayoutProperty(paintId, 'visibility', visible ? 'visible' : 'none');\n } catch {\n /* layer not ready */\n }\n }\n if (!visible) continue;\n const slider = sliders[layer.layerId] ?? defaultLayerSlider(layer.colorRanges.length);\n const inYear = featuresForYear(layer.features, year, layer.yearKey);\n const filtered = featuresInSliderRange(inYear, layer.colorRanges, slider);\n if (layer.visualisationType === 'choropleth' && layer.pmtilesConfig && layer.fillId) {\n const ids = [\n ...new Set(\n filtered\n .map((feature) => feature.properties?.id)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n ),\n ];\n const filter =\n ids.length > 0\n ? ['in', pmtilesIdExpression(layer.pmtilesConfig), ['literal', ids]]\n : ['==', 1, 0];\n try {\n map.setFilter(layer.fillId, filter);\n } catch {\n /* ignore */\n }\n continue;\n }\n try {\n map.getSource(layer.sourceId)?.setData?.({ type: 'FeatureCollection', features: filtered });\n } catch {\n /* source gone */\n }\n }\n}\n\nfunction bubbleRadiusExpression(layer: MapLayerModel): unknown {\n const ranges = [...layer.colorRanges].sort((a, b) => a.start - b.start);\n if (!ranges.length) return BUBBLE_RADIUS_STEPS[0];\n const expr: unknown[] = [\n 'step',\n ['coalesce', ['to-number', ['get', 'value']], ranges[0].start],\n BUBBLE_RADIUS_STEPS[0],\n ];\n for (let i = 1; i < Math.min(ranges.length, BUBBLE_RADIUS_STEPS.length); i++) {\n expr.push(ranges[i].start, BUBBLE_RADIUS_STEPS[i]);\n }\n return expr.length < 4 ? BUBBLE_RADIUS_STEPS[0] : expr;\n}\n\nfunction bindHover(\n map: MapboxMap,\n layerId: string,\n layer: MapLayerModel,\n onHover: RenderMapChartOptions['onHover'],\n onId?: (id: string | null) => void,\n): void {\n if (!onHover) return;\n\n const read = (properties: Record<string, unknown> | undefined): MapHoverEntry | null => {\n if (!properties) return null;\n const regionId = String(\n getRegionIdFromFeatureProperties(properties, layer.mapType) ??\n properties.id ??\n properties.regionId ??\n '',\n );\n if (!regionId) return null;\n const feature = layer.features.find(\n (f) => String(f.properties?.id ?? f.properties?.regionId) === regionId,\n );\n const props = feature?.properties ?? properties;\n const value = Number(props.value ?? 0);\n const regionName = String(props.regionName ?? props.name ?? regionId);\n return {\n regionId,\n regionName,\n value,\n valueKey: layer.valueKey,\n layerName: layer.layerName,\n lngLat: { lng: 0, lat: 0 },\n };\n };\n\n map.on(\n 'mousemove',\n layerId,\n (e: {\n point?: { x: number; y: number };\n lngLat?: { lng: number; lat: number };\n }) => {\n const feature = map.queryRenderedFeatures(e.point, { layers: [layerId] })[0];\n const entry = read(feature?.properties);\n if (!entry) {\n onId?.(null);\n onHover(null);\n return;\n }\n if (e.lngLat) entry.lngLat = e.lngLat;\n if (e.point) entry.point = e.point;\n onId?.(entry.regionId);\n onHover(entry);\n },\n );\n map.on('mouseleave', layerId, () => {\n onId?.(null);\n onHover(null);\n });\n}\n\nfunction fit(map: MapboxMap, layers: MapLayerModel[]): void {\n const features = layers.flatMap((l) => l.features);\n const box = collectionBBox(features);\n if (!box) return;\n try {\n map.fitBounds(\n [\n [box[0], box[1]],\n [box[2], box[3]],\n ],\n { padding: 64, duration: 750 },\n );\n } catch {\n /* empty bounds */\n }\n}\n\nfunction loadSpikeIcon(map: MapboxMap, iconName: string, svgContent: string): void {\n const svgDataUrl = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgContent)}`;\n const img = new Image();\n img.onload = () => {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const pixelRatio = 2;\n canvas.width = (img.width || 30) * pixelRatio;\n canvas.height = (img.height || 30) * pixelRatio;\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n ctx.drawImage(img, 0, 0, img.width || 30, img.height || 30);\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n if (map.hasImage(iconName)) {\n try {\n map.removeImage(iconName);\n } catch {\n /* ignore */\n }\n }\n try {\n map.addImage(iconName, imageData, { pixelRatio: 2 });\n } catch {\n /* already exists */\n }\n };\n img.src = svgDataUrl;\n}\n\nfunction rgbaToHex(color: string): string {\n const match = color.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n if (!match) return color.startsWith('#') ? color : '#473DD9';\n const hex = (n: string) => Number(n).toString(16).padStart(2, '0');\n return `#${hex(match[1])}${hex(match[2])}${hex(match[3])}`;\n}\n"],"names":["_a"],"mappings":";;;;;;;AA+FA,MAAM,kCAAkB,QAAA;AAEjB,SAAS,aAAa,WAA8B;;AACzD,oBAAY,IAAI,SAAS,MAAzB,mBAA4B;AAC5B,cAAY,OAAO,SAAS;AAC9B;AAEO,SAAS,eAAe,WAAiC;AAC9D,QAAM,MAAM,YA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AC,CAAC,CAAC;AAC1D;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/partial-dependence-chart/element/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,yBA0CnC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const partialDependenceStyles = css`
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
min-height: 220px;
|
|
9
|
+
color: var(--ui9000-color-text, #111827);
|
|
10
|
+
font-family: var(--ui9000-font-family, system-ui, sans-serif);
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
.chart-root {
|
|
14
|
+
flex: 1;
|
|
15
|
+
min-height: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
min-height: inherit;
|
|
19
|
+
}
|
|
20
|
+
.tooltip {
|
|
21
|
+
position: absolute;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
z-index: 2;
|
|
24
|
+
padding: 6px 10px;
|
|
25
|
+
border-radius: 6px;
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
line-height: 1.35;
|
|
28
|
+
background: var(--ui9000-color-text, #111827);
|
|
29
|
+
color: #fff;
|
|
30
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
|
|
31
|
+
transform: translate(-50%, calc(-100% - 10px));
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
}
|
|
34
|
+
.empty {
|
|
35
|
+
display: grid;
|
|
36
|
+
place-items: center;
|
|
37
|
+
height: 100%;
|
|
38
|
+
min-height: inherit;
|
|
39
|
+
color: var(--ui9000-color-text-muted, #6b7280);
|
|
40
|
+
font-size: 0.875rem;
|
|
41
|
+
text-align: center;
|
|
42
|
+
padding: 8px;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export {
|
|
46
|
+
partialDependenceStyles
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/partial-dependence-chart/element/styles.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const partialDependenceStyles = css`\n :host {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n min-height: 220px;\n color: var(--ui9000-color-text, #111827);\n font-family: var(--ui9000-font-family, system-ui, sans-serif);\n box-sizing: border-box;\n }\n .chart-root {\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n min-height: inherit;\n }\n .tooltip {\n position: absolute;\n pointer-events: none;\n z-index: 2;\n padding: 6px 10px;\n border-radius: 6px;\n font-size: 12px;\n line-height: 1.35;\n background: var(--ui9000-color-text, #111827);\n color: #fff;\n box-shadow: 0 4px 12px rgb(0 0 0 / 18%);\n transform: translate(-50%, calc(-100% - 10px));\n white-space: nowrap;\n }\n .empty {\n display: grid;\n place-items: center;\n height: 100%;\n min-height: inherit;\n color: var(--ui9000-color-text-muted, #6b7280);\n font-size: 0.875rem;\n text-align: center;\n padding: 8px;\n }\n`;\n"],"names":[],"mappings":";AAEO,MAAM,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { Ui9000ChartElement } from '../../../element/ui9000-chart-base.js';
|
|
3
|
+
import { WidgetScale } from '../../../types/index.js';
|
|
4
|
+
export declare class Ui9000PartialDependenceChart extends Ui9000ChartElement {
|
|
5
|
+
static styles: import('lit').CSSResult[];
|
|
6
|
+
scale: WidgetScale;
|
|
7
|
+
showGrid: boolean;
|
|
8
|
+
showLegend: boolean;
|
|
9
|
+
showTooltip: boolean;
|
|
10
|
+
private _tooltip;
|
|
11
|
+
private _empty;
|
|
12
|
+
private _resizeObserver?;
|
|
13
|
+
private _raf;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
updated(changed: PropertyValues): void;
|
|
17
|
+
private scheduleDraw;
|
|
18
|
+
private parseData;
|
|
19
|
+
/** Client legend carries the single "Average" entry; ICE curves stay unlabelled. */
|
|
20
|
+
private renderLegend;
|
|
21
|
+
private draw;
|
|
22
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'ui9000-partial-dependence-chart': Ui9000PartialDependenceChart;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export declare function registerPartialDependenceChart(): void;
|
|
30
|
+
//# sourceMappingURL=ui9000-partial-dependence-chart.d.ts.map
|
package/dist/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui9000-partial-dependence-chart.d.ts","sourceRoot":"","sources":["../../../../src/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAKzD,OAAO,EAAoB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAiB3D,qBACa,4BAA6B,SAAQ,kBAAkB;IAClE,OAAgB,MAAM,4BAA+C;IAGrE,KAAK,EAAE,WAAW,CAAa;IAG/B,QAAQ,UAAQ;IAGhB,UAAU,UAAQ;IAGlB,WAAW,UAAQ;IAGnB,OAAO,CAAC,QAAQ,CAA0D;IAG1E,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,IAAI,CAAK;IAER,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAI/C,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,SAAS;IAMjB,oFAAoF;IACpF,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,IAAI;IAkDH,MAAM;CA4BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iCAAiC,EAAE,4BAA4B,CAAC;KACjE;CACF;AAED,wBAAgB,8BAA8B,IAAI,IAAI,CAIrD"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { nothing, html } from "lit";
|
|
2
|
+
import { property, state, customElement } from "lit/decorators.js";
|
|
3
|
+
import { readThemeFromElement, readCssVar, CSS_VARS } from "../../../context/widget-context.js";
|
|
4
|
+
import { renderChartLegend } from "../../../element/chart-legend-render.js";
|
|
5
|
+
import { Ui9000ChartElement } from "../../../element/ui9000-chart-base.js";
|
|
6
|
+
import { parseJsonAttr, getPartialDependenceDimensions } from "../../../utils/chart-helpers.js";
|
|
7
|
+
import { chartPropsChanged } from "../../../utils/lit-draw.js";
|
|
8
|
+
import { renderPartialDependenceChart } from "../render/draw.js";
|
|
9
|
+
import { partialDependenceStyles } from "./styles.js";
|
|
10
|
+
import { normalizePartialDependenceData } from "../lib/normalize.js";
|
|
11
|
+
import { chartShellStyles } from "../../../element/chart-shell-styles.js";
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result) __defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
const TOOLTIP_DECIMALS = 3;
|
|
23
|
+
let Ui9000PartialDependenceChart = class extends Ui9000ChartElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.scale = "default";
|
|
27
|
+
this.showGrid = true;
|
|
28
|
+
this.showLegend = true;
|
|
29
|
+
this.showTooltip = true;
|
|
30
|
+
this._tooltip = null;
|
|
31
|
+
this._empty = false;
|
|
32
|
+
this._raf = 0;
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
this._resizeObserver = new ResizeObserver(() => this.scheduleDraw());
|
|
37
|
+
this._resizeObserver.observe(this);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
var _a;
|
|
41
|
+
(_a = this._resizeObserver) == null ? void 0 : _a.disconnect();
|
|
42
|
+
cancelAnimationFrame(this._raf);
|
|
43
|
+
super.disconnectedCallback();
|
|
44
|
+
}
|
|
45
|
+
updated(changed) {
|
|
46
|
+
if (chartPropsChanged(changed)) this.scheduleDraw();
|
|
47
|
+
}
|
|
48
|
+
scheduleDraw() {
|
|
49
|
+
cancelAnimationFrame(this._raf);
|
|
50
|
+
this._raf = requestAnimationFrame(() => this.draw());
|
|
51
|
+
}
|
|
52
|
+
parseData() {
|
|
53
|
+
return normalizePartialDependenceData(
|
|
54
|
+
parseJsonAttr(this.dataJson, null)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
/** Client legend carries the single "Average" entry; ICE curves stay unlabelled. */
|
|
58
|
+
renderLegend(model) {
|
|
59
|
+
if (!this.showLegend || !model.averageSeries.length) return nothing;
|
|
60
|
+
return renderChartLegend([
|
|
61
|
+
{ label: "Average", swatch: { kind: "dashed-line", color: model.color } }
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
draw() {
|
|
65
|
+
var _a, _b, _c, _d, _e;
|
|
66
|
+
const root = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(".chart-root");
|
|
67
|
+
if (!root) return;
|
|
68
|
+
const model = this.parseData();
|
|
69
|
+
this._empty = model.iceSeries.length === 0;
|
|
70
|
+
if (this._empty) {
|
|
71
|
+
root.replaceChildren();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const theme = readThemeFromElement(this);
|
|
75
|
+
const themeMode = readCssVar(this, CSS_VARS.mode, "light") === "dark" ? "dark" : "light";
|
|
76
|
+
const { width, height, margin } = getPartialDependenceDimensions(root, this.scale);
|
|
77
|
+
const xLabel = ((_c = (_b = model.axisDetails) == null ? void 0 : _b[model.xField]) == null ? void 0 : _c.label) ?? model.xField;
|
|
78
|
+
const yLabel = ((_e = (_d = model.axisDetails) == null ? void 0 : _d[model.yField]) == null ? void 0 : _e.label) ?? model.yField;
|
|
79
|
+
renderPartialDependenceChart(root, {
|
|
80
|
+
iceSeries: model.iceSeries,
|
|
81
|
+
averageSeries: model.averageSeries,
|
|
82
|
+
width,
|
|
83
|
+
height,
|
|
84
|
+
margin,
|
|
85
|
+
theme,
|
|
86
|
+
themeMode,
|
|
87
|
+
color: model.color,
|
|
88
|
+
showGrid: this.showGrid,
|
|
89
|
+
showTooltip: this.showTooltip,
|
|
90
|
+
onHover: this.showTooltip ? ({ x, y, event }) => {
|
|
91
|
+
const rect = this.getBoundingClientRect();
|
|
92
|
+
this._tooltip = {
|
|
93
|
+
x: event.clientX - rect.left,
|
|
94
|
+
y: event.clientY - rect.top,
|
|
95
|
+
lines: [
|
|
96
|
+
`${xLabel}: ${x.toFixed(TOOLTIP_DECIMALS)}`,
|
|
97
|
+
`${yLabel}: ${y == null ? "-" : y.toFixed(TOOLTIP_DECIMALS)}`
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
} : void 0,
|
|
101
|
+
onLeave: this.showTooltip ? () => {
|
|
102
|
+
this._tooltip = null;
|
|
103
|
+
} : void 0
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
render() {
|
|
107
|
+
const title = this.headerTitle();
|
|
108
|
+
const model = this._empty ? null : this.parseData();
|
|
109
|
+
return html`
|
|
110
|
+
<div class="widget-shell" part="shell">
|
|
111
|
+
${this.renderShellHeader(title)}
|
|
112
|
+
<div class="widget-body">
|
|
113
|
+
${model ? this.renderLegend(model) : nothing}
|
|
114
|
+
<div class="chart-root" part="chart" ?hidden=${this._empty}></div>
|
|
115
|
+
${this._empty ? html`<div class="empty" part="empty">
|
|
116
|
+
Partial dependence needs numeric X and Y fields with at least one ICE series.
|
|
117
|
+
</div>` : nothing}
|
|
118
|
+
${this._tooltip ? html`<div
|
|
119
|
+
class="tooltip"
|
|
120
|
+
part="tooltip"
|
|
121
|
+
style="left:${this._tooltip.x}px;top:${this._tooltip.y}px"
|
|
122
|
+
>
|
|
123
|
+
${this._tooltip.lines.map((line) => html`<div>${line}</div>`)}
|
|
124
|
+
</div>` : nothing}
|
|
125
|
+
${this.renderShellLabelTooltip()}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
Ui9000PartialDependenceChart.styles = [partialDependenceStyles, chartShellStyles];
|
|
132
|
+
__decorateClass([
|
|
133
|
+
property({ type: String, attribute: "scale" })
|
|
134
|
+
], Ui9000PartialDependenceChart.prototype, "scale", 2);
|
|
135
|
+
__decorateClass([
|
|
136
|
+
property({ type: Boolean, attribute: "show-grid" })
|
|
137
|
+
], Ui9000PartialDependenceChart.prototype, "showGrid", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property({ type: Boolean, attribute: "show-legend" })
|
|
140
|
+
], Ui9000PartialDependenceChart.prototype, "showLegend", 2);
|
|
141
|
+
__decorateClass([
|
|
142
|
+
property({ type: Boolean, attribute: "show-tooltip" })
|
|
143
|
+
], Ui9000PartialDependenceChart.prototype, "showTooltip", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
state()
|
|
146
|
+
], Ui9000PartialDependenceChart.prototype, "_tooltip", 2);
|
|
147
|
+
__decorateClass([
|
|
148
|
+
state()
|
|
149
|
+
], Ui9000PartialDependenceChart.prototype, "_empty", 2);
|
|
150
|
+
Ui9000PartialDependenceChart = __decorateClass([
|
|
151
|
+
customElement("ui9000-partial-dependence-chart")
|
|
152
|
+
], Ui9000PartialDependenceChart);
|
|
153
|
+
function registerPartialDependenceChart() {
|
|
154
|
+
if (!customElements.get("ui9000-partial-dependence-chart")) {
|
|
155
|
+
customElements.define("ui9000-partial-dependence-chart", Ui9000PartialDependenceChart);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
registerPartialDependenceChart();
|
|
159
|
+
export {
|
|
160
|
+
Ui9000PartialDependenceChart,
|
|
161
|
+
registerPartialDependenceChart
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=ui9000-partial-dependence-chart.js.map
|
package/dist/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui9000-partial-dependence-chart.js","sources":["../../../../src/components/partial-dependence-chart/element/ui9000-partial-dependence-chart.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { CSS_VARS, readCssVar, readThemeFromElement } from '../../../context/widget-context.js';\nimport { renderChartLegend } from '../../../element/chart-legend-render.js';\nimport { chartShellStyles, Ui9000ChartElement } from '../../../element/ui9000-chart-base.js';\nimport type { WidgetScale } from '../../../types/index.js';\nimport {\n getPartialDependenceDimensions,\n parseJsonAttr,\n} from '../../../utils/chart-helpers.js';\nimport { chartPropsChanged } from '../../../utils/lit-draw.js';\nimport {\n normalizePartialDependenceData,\n type PartialDependenceChartData,\n type PartialDependenceModel,\n} from '../lib/index.js';\nimport { renderPartialDependenceChart } from '../render/draw.js';\nimport { partialDependenceStyles } from './styles.js';\n\n/** Client tooltip prints three decimals for both axes. */\nconst TOOLTIP_DECIMALS = 3;\n\n@customElement('ui9000-partial-dependence-chart')\nexport class Ui9000PartialDependenceChart extends Ui9000ChartElement {\n static override styles = [partialDependenceStyles, chartShellStyles];\n\n @property({ type: String, attribute: 'scale' })\n scale: WidgetScale = 'default';\n\n @property({ type: Boolean, attribute: 'show-grid' })\n showGrid = true;\n\n @property({ type: Boolean, attribute: 'show-legend' })\n showLegend = true;\n\n @property({ type: Boolean, attribute: 'show-tooltip' })\n showTooltip = true;\n\n @state()\n private _tooltip: { x: number; y: number; lines: string[] } | null = null;\n\n @state()\n private _empty = false;\n\n private _resizeObserver?: ResizeObserver;\n private _raf = 0;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver(() => this.scheduleDraw());\n this._resizeObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n this._resizeObserver?.disconnect();\n cancelAnimationFrame(this._raf);\n super.disconnectedCallback();\n }\n\n override updated(changed: PropertyValues): void {\n if (chartPropsChanged(changed)) this.scheduleDraw();\n }\n\n private scheduleDraw(): void {\n cancelAnimationFrame(this._raf);\n this._raf = requestAnimationFrame(() => this.draw());\n }\n\n private parseData(): PartialDependenceModel {\n return normalizePartialDependenceData(\n parseJsonAttr<PartialDependenceChartData>(this.dataJson, null),\n );\n }\n\n /** Client legend carries the single \"Average\" entry; ICE curves stay unlabelled. */\n private renderLegend(model: PartialDependenceModel) {\n if (!this.showLegend || !model.averageSeries.length) return nothing;\n return renderChartLegend([\n { label: 'Average', swatch: { kind: 'dashed-line', color: model.color } },\n ]);\n }\n\n private draw(): void {\n const root = this.shadowRoot?.querySelector('.chart-root') as HTMLElement | null;\n if (!root) return;\n\n const model = this.parseData();\n this._empty = model.iceSeries.length === 0;\n if (this._empty) {\n root.replaceChildren();\n return;\n }\n\n const theme = readThemeFromElement(this);\n const themeMode =\n readCssVar(this, CSS_VARS.mode, 'light') === 'dark' ? 'dark' : 'light';\n const { width, height, margin } = getPartialDependenceDimensions(root, this.scale);\n const xLabel = model.axisDetails?.[model.xField]?.label ?? model.xField;\n const yLabel = model.axisDetails?.[model.yField]?.label ?? model.yField;\n\n renderPartialDependenceChart(root, {\n iceSeries: model.iceSeries,\n averageSeries: model.averageSeries,\n width,\n height,\n margin,\n theme,\n themeMode,\n color: model.color,\n showGrid: this.showGrid,\n showTooltip: this.showTooltip,\n onHover: this.showTooltip\n ? ({ x, y, event }) => {\n const rect = this.getBoundingClientRect();\n this._tooltip = {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n lines: [\n `${xLabel}: ${x.toFixed(TOOLTIP_DECIMALS)}`,\n `${yLabel}: ${y == null ? '-' : y.toFixed(TOOLTIP_DECIMALS)}`,\n ],\n };\n }\n : undefined,\n onLeave: this.showTooltip\n ? () => {\n this._tooltip = null;\n }\n : undefined,\n });\n }\n\n override render() {\n const title = this.headerTitle();\n const model = this._empty ? null : this.parseData();\n return html`\n <div class=\"widget-shell\" part=\"shell\">\n ${this.renderShellHeader(title)}\n <div class=\"widget-body\">\n ${model ? this.renderLegend(model) : nothing}\n <div class=\"chart-root\" part=\"chart\" ?hidden=${this._empty}></div>\n ${this._empty\n ? html`<div class=\"empty\" part=\"empty\">\n Partial dependence needs numeric X and Y fields with at least one ICE series.\n </div>`\n : nothing}\n ${this._tooltip\n ? html`<div\n class=\"tooltip\"\n part=\"tooltip\"\n style=\"left:${this._tooltip.x}px;top:${this._tooltip.y}px\"\n >\n ${this._tooltip.lines.map((line) => html`<div>${line}</div>`)}\n </div>`\n : nothing}\n ${this.renderShellLabelTooltip()}\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui9000-partial-dependence-chart': Ui9000PartialDependenceChart;\n }\n}\n\nexport function registerPartialDependenceChart(): void {\n if (!customElements.get('ui9000-partial-dependence-chart')) {\n customElements.define('ui9000-partial-dependence-chart', Ui9000PartialDependenceChart);\n }\n}\n\nregisterPartialDependenceChart();\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,mBAAmB;AAGlB,IAAM,+BAAN,cAA2C,mBAAmB;AAAA,EAA9D,cAAA;AAAA,UAAA,GAAA,SAAA;AAIL,SAAA,QAAqB;AAGrB,SAAA,WAAW;AAGX,SAAA,aAAa;AAGb,SAAA,cAAc;AAGd,SAAQ,WAA6D;AAGrE,SAAQ,SAAS;AAGjB,SAAQ,OAAO;AAAA,EAAA;AAAA,EAEN,oBAA0B;AACjC,UAAM,kBAAA;AACN,SAAK,kBAAkB,IAAI,eAAe,MAAM,KAAK,cAAc;AACnE,SAAK,gBAAgB,QAAQ,IAAI;AAAA,EACnC;AAAA,EAES,uBAA6B;;AACpC,eAAK,oBAAL,mBAAsB;AACtB,yBAAqB,KAAK,IAAI;AAC9B,UAAM,qBAAA;AAAA,EACR;AAAA,EAES,QAAQ,SAA+B;AAC9C,QAAI,kBAAkB,OAAO,EAAG,MAAK,aAAA;AAAA,EACvC;AAAA,EAEQ,eAAqB;AAC3B,yBAAqB,KAAK,IAAI;AAC9B,SAAK,OAAO,sBAAsB,MAAM,KAAK,MAAM;AAAA,EACrD;AAAA,EAEQ,YAAoC;AAC1C,WAAO;AAAA,MACL,cAA0C,KAAK,UAAU,IAAI;AAAA,IAAA;AAAA,EAEjE;AAAA;AAAA,EAGQ,aAAa,OAA+B;AAClD,QAAI,CAAC,KAAK,cAAc,CAAC,MAAM,cAAc,OAAQ,QAAO;AAC5D,WAAO,kBAAkB;AAAA,MACvB,EAAE,OAAO,WAAW,QAAQ,EAAE,MAAM,eAAe,OAAO,MAAM,MAAA,EAAM;AAAA,IAAE,CACzE;AAAA,EACH;AAAA,EAEQ,OAAa;;AACnB,UAAM,QAAO,UAAK,eAAL,mBAAiB,cAAc;A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,0 +1,5 @@
|
|
|
1
|
+
export { Ui9000PartialDependenceChart, registerPartialDependenceChart, } from './element/ui9000-partial-dependence-chart.js';
|
|
2
|
+
export { renderPartialDependenceChart } from './render/draw.js';
|
|
3
|
+
export { computeAverageSeries, nearestAveragePoint, normalizePartialDependenceData, pdpLinearDomain, type IcePoint, type IceSeries, type PartialDependenceChartData, type PartialDependenceModel, } from './lib/index.js';
|
|
4
|
+
export { default as partialDependenceChartMetadata } from './metadata.json';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/partial-dependence-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerPartialDependenceChart } from "./element/ui9000-partial-dependence-chart.js";
|
|
2
|
+
import { Ui9000PartialDependenceChart } from "./element/ui9000-partial-dependence-chart.js";
|
|
3
|
+
import { renderPartialDependenceChart } from "./render/draw.js";
|
|
4
|
+
import { default as default2 } from "./metadata.json.js";
|
|
5
|
+
import { computeAverageSeries, nearestAveragePoint } from "./lib/series.js";
|
|
6
|
+
import { normalizePartialDependenceData } from "./lib/normalize.js";
|
|
7
|
+
import { pdpLinearDomain } from "./lib/domain.js";
|
|
8
|
+
export {
|
|
9
|
+
Ui9000PartialDependenceChart,
|
|
10
|
+
computeAverageSeries,
|
|
11
|
+
nearestAveragePoint,
|
|
12
|
+
normalizePartialDependenceData,
|
|
13
|
+
default2 as partialDependenceChartMetadata,
|
|
14
|
+
pdpLinearDomain,
|
|
15
|
+
registerPartialDependenceChart,
|
|
16
|
+
renderPartialDependenceChart
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client PDP axis domain: raw extent, no zero baseline and no padding, with a
|
|
3
|
+
* hairline spread so a flat series still gets a usable scale.
|
|
4
|
+
*/
|
|
5
|
+
export declare function pdpLinearDomain(values: Iterable<number>): [number, number];
|
|
6
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/components/partial-dependence-chart/lib/domain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAW1E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function pdpLinearDomain(values) {
|
|
2
|
+
let min = Infinity;
|
|
3
|
+
let max = -Infinity;
|
|
4
|
+
for (const v of values) {
|
|
5
|
+
if (!Number.isFinite(v)) continue;
|
|
6
|
+
if (v < min) min = v;
|
|
7
|
+
if (v > max) max = v;
|
|
8
|
+
}
|
|
9
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];
|
|
10
|
+
if (min === max) return [min - 1e-6, max + 1e-6];
|
|
11
|
+
return [min, max];
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
pdpLinearDomain
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.js","sources":["../../../../src/components/partial-dependence-chart/lib/domain.ts"],"sourcesContent":["/**\n * Client PDP axis domain: raw extent, no zero baseline and no padding, with a\n * hairline spread so a flat series still gets a usable scale.\n */\nexport function pdpLinearDomain(values: Iterable<number>): [number, number] {\n let min = Infinity;\n let max = -Infinity;\n for (const v of values) {\n if (!Number.isFinite(v)) continue;\n if (v < min) min = v;\n if (v > max) max = v;\n }\n if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];\n if (min === max) return [min - 1e-6, max + 1e-6];\n return [min, max];\n}\n"],"names":[],"mappings":"AAIO,SAAS,gBAAgB,QAA4C;AAC1E,MAAI,MAAM;AACV,MAAI,MAAM;AACV,aAAW,KAAK,QAAQ;AACtB,QAAI,CAAC,OAAO,SAAS,CAAC,EAAG;AACzB,QAAI,IAAI,IAAK,OAAM;AACnB,QAAI,IAAI,IAAK,OAAM;AAAA,EACrB;AACA,MAAI,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,EAAG,QAAO,CAAC,GAAG,CAAC;AAChE,MAAI,QAAQ,IAAK,QAAO,CAAC,MAAM,MAAM,MAAM,IAAI;AAC/C,SAAO,CAAC,KAAK,GAAG;AAClB;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { normalizePartialDependenceData } from './normalize.js';
|
|
2
|
+
export { computeAverageSeries, nearestAveragePoint } from './series.js';
|
|
3
|
+
export { pdpLinearDomain } from './domain.js';
|
|
4
|
+
export type { IcePoint, IceSeries, PartialDependenceChartData, PartialDependenceModel, } from './types.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/partial-dependence-chart/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EACV,QAAQ,EACR,SAAS,EACT,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PartialDependenceChartData, PartialDependenceModel } from './types.js';
|
|
2
|
+
/** Normalize chat / FuseDash WidgetItem payloads into ICE curves plus the average. */
|
|
3
|
+
export declare function normalizePartialDependenceData(input: PartialDependenceChartData): PartialDependenceModel;
|
|
4
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/components/partial-dependence-chart/lib/normalize.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAoKpB,sFAAsF;AACtF,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,0BAA0B,GAChC,sBAAsB,CA2CxB"}
|