@open-pioneer/map 1.4.0-dev.20260625074633 → 1.4.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +46 -22
  2. package/LayerFactory.d.ts +1 -1
  3. package/LayerFactory.js.map +1 -1
  4. package/MapRegistry.js +1 -1
  5. package/MapRegistry.js.map +1 -1
  6. package/README.md +8 -14
  7. package/_virtual/source-info.js +8 -6
  8. package/_virtual/source-info.js.map +1 -1
  9. package/layers/AbstractLayer.d.ts +36 -3
  10. package/layers/AbstractLayer.js +123 -79
  11. package/layers/AbstractLayer.js.map +1 -1
  12. package/layers/AbstractLayerBase.d.ts +2 -2
  13. package/layers/AbstractLayerBase.js.map +1 -1
  14. package/layers/GroupLayer.d.ts +2 -1
  15. package/layers/GroupLayer.js +4 -1
  16. package/layers/GroupLayer.js.map +1 -1
  17. package/layers/SimpleLayer.d.ts +1 -1
  18. package/layers/SimpleLayer.js +1 -1
  19. package/layers/SimpleLayer.js.map +1 -1
  20. package/layers/WMSLayer.js +59 -11
  21. package/layers/WMSLayer.js.map +1 -1
  22. package/layers/WMTSLayer.d.ts +1 -1
  23. package/layers/WMTSLayer.js +11 -5
  24. package/layers/WMTSLayer.js.map +1 -1
  25. package/layers/group/GroupLayerCollection.d.ts +2 -2
  26. package/layers/group/GroupLayerCollection.js +1 -1
  27. package/layers/group/GroupLayerCollection.js.map +1 -1
  28. package/layers/shared/SublayerBaseType.d.ts +9 -0
  29. package/layers/shared/SublayersCollection.js.map +1 -1
  30. package/layers/shared/getRecursiveLayers.d.ts +1 -1
  31. package/layers/shared/getRecursiveLayers.js +12 -5
  32. package/layers/shared/getRecursiveLayers.js.map +1 -1
  33. package/layers/shared/internals.d.ts +3 -2
  34. package/layers/shared/internals.js +2 -1
  35. package/layers/shared/internals.js.map +1 -1
  36. package/layers/unions.js.map +1 -1
  37. package/layers/wms/WMSSublayer.d.ts +14 -1
  38. package/layers/wms/WMSSublayer.js +29 -2
  39. package/layers/wms/WMSSublayer.js.map +1 -1
  40. package/layers/wms/getAttributions.js.map +1 -1
  41. package/layers/wms/getLegendUrl.js +1 -1
  42. package/layers/wms/getLegendUrl.js.map +1 -1
  43. package/layers/wmts/getAttributions.js.map +1 -1
  44. package/layers/wmts/getLegendUrl.js +1 -1
  45. package/layers/wmts/getLegendUrl.js.map +1 -1
  46. package/model/Highlights.js.map +1 -1
  47. package/model/LayerCollection.js.map +1 -1
  48. package/model/MapAttributions.js.map +1 -1
  49. package/model/MapModel.d.ts +5 -5
  50. package/model/MapModel.js +4 -4
  51. package/model/MapModel.js.map +1 -1
  52. package/model/Overlays.d.ts +2 -2
  53. package/model/Overlays.js +2 -2
  54. package/model/Overlays.js.map +1 -1
  55. package/model/createMapModel.js +23 -23
  56. package/model/createMapModel.js.map +1 -1
  57. package/model/getGeometries.js.map +1 -1
  58. package/package.json +10 -10
  59. package/ui/DefaultMapProvider.js.map +1 -1
  60. package/ui/MapAnchor.js.map +1 -1
  61. package/ui/MapContainer.js +2 -2
  62. package/ui/MapContainer.js.map +1 -1
  63. package/ui/MapContainerContext.js.map +1 -1
  64. package/ui/OverlaysRenderer.js.map +1 -1
  65. package/ui/computeMapAnchorStyles.js.map +1 -1
  66. package/ui/hooks/useMapModel.d.ts +7 -0
  67. package/ui/hooks/useMapModel.js +10 -1
  68. package/ui/hooks/useMapModel.js.map +1 -1
  69. package/ui/styles.css +0 -2
  70. package/ui/styles.css.map +1 -1
  71. package/utils/fetch.js.map +1 -1
  72. package/utils/geometry-utils.js.map +1 -1
  73. package/utils/ol-test-support.js.map +1 -1
  74. package/utils/projections.js.map +1 -1
  75. package/utils/sanitize.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MapContainer.js","sources":["MapContainer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { BoxProps, chakra, SystemStyleObject } from \"@chakra-ui/react\";\nimport { createLogger, Resource } from \"@open-pioneer/core\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport type OlMap from \"ol/Map\";\nimport { Extent } from \"ol/extent\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ReactNode, RefObject, useEffect, useMemo, useRef, useState } from \"react\";\nimport { DISPLAY_STATUS, MapModel, MapPadding } from \"../model/MapModel\";\nimport { MapContainerContextProvider, MapContainerContextType } from \"./MapContainerContext\";\nimport { MapModelProps, useMapModelValue } from \"./hooks/useMapModel\";\nimport { OverlaysRenderer } from \"./OverlaysRenderer\";\nimport { Coordinate } from \"ol/coordinate\";\n\nconst LOG = createLogger(sourceId);\n\n/**\n * @group UI Components and Hooks\n */\nexport interface MapContainerProps extends CommonComponentProps, MapModelProps {\n /**\n * Sets the map's padding directly.\n * Do not use the view's padding property directly on the OL map.\n *\n * See: https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#padding)\n */\n viewPadding?: MapPadding | undefined;\n\n /**\n * Behavior performed by the map when the view padding changes.\n *\n * - `none`: Do nothing.\n * - `preserve-center`: Ensures that the center point remains the same by animating the view.\n * - `preserve-extent`: Ensures that the extent remains the same by zooming.\n *\n * @default \"preserve-center\"\n */\n viewPaddingChangeBehavior?: \"none\" | \"preserve-center\" | \"preserve-extent\";\n\n children?: ReactNode;\n\n /**\n * Optional role property.\n *\n * This property is directly applied to the map's container div element.\n *\n * @default \"application\"\n */\n role?: string;\n\n /**\n * Optional aria-labelledby property.\n * Do not use together with aria-label.\n *\n * This property is directly applied to the map's container div element.\n */\n \"aria-labelledby\"?: string;\n\n /**\n * Optional aria-label property.\n * Do not use together with aria-label.\n *\n * This property is directly applied to the map's container div element.\n */\n \"aria-label\"?: string;\n\n /**\n * Arbitrary html properties that will be applied to the map container's _root_ element.\n * This is the element that contains the map container and any UI elements (like map anchors, for example).\n *\n * Use these at your own risk since they may be overwritten by the map container root itself.\n *\n * Use cases: setting custom data attributes, registering custom event handlers, ...\n */\n rootProps?: BoxProps;\n\n /**\n * Arbitrary html properties that will be applied to the map container's element.\n * This is the element that _renders_ the OpenLayers map.\n *\n * Use these at your own risk since they may be overwritten by the map container itself.\n *\n * Use cases: setting custom data attributes, registering custom event handlers, ...\n */\n containerProps?: BoxProps;\n}\n\n/**\n * Displays the map with the given id.\n *\n * There can only be at most one MapContainer for every map.\n *\n * @group UI Components and Hooks\n */\nexport function MapContainer(props: MapContainerProps) {\n const {\n viewPadding: viewPaddingProp,\n viewPaddingChangeBehavior,\n children,\n role = \"application\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n rootProps,\n containerProps,\n ...restProps\n } = props;\n const { containerProps: rootContainerProps } = useCommonComponentProps(\n \"map-container-root\",\n restProps // hide role, aria label etc from helper\n );\n const mapContainer = useRef<HTMLDivElement>(null);\n const mapAnchorsHost = useRef<HTMLDivElement>(null);\n const map = useMapModelValue(props);\n const viewPadding = useViewPadding(viewPaddingProp);\n const [ready, setReady] = useState(false);\n\n // Register as renderer for map model\n useMapContainerRegistration(mapContainer, map);\n\n // Wait for mount to make sure that the map anchors host is available\n useEffect(() => {\n setReady(true);\n }, []);\n\n const css = useRootCss(viewPadding);\n const mergedRootProps = useMemo(\n () => mergeChakraProps<BoxProps>({ css }, rootContainerProps, rootProps ?? {}),\n [css, rootProps, rootContainerProps]\n );\n const mergedContainerProps = useMemo(\n () =>\n mergeChakraProps<BoxProps>(\n {\n className: \"map-container\",\n role,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n h: \"100%\",\n w: \"100%\",\n tabIndex: 0\n },\n containerProps ?? {}\n ),\n [role, ariaLabel, ariaLabelledBy, containerProps]\n );\n return (\n <chakra.div {...mergedRootProps}>\n {/* Used by open layers to mount the map. This node receives the keyboard focus when interacting with the map. */}\n <chakra.div ref={mapContainer} {...mergedContainerProps} />\n\n {/* Contains user widgets (map anchors and raw children). These are separate from the map so they don't interfere with mouse/keyboard events. */}\n <chakra.div ref={mapAnchorsHost} className=\"map-anchors\">\n {ready && map && (\n <MapContainerReady\n map={map}\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n mapAnchorsHost={mapAnchorsHost.current!}\n viewPadding={viewPadding}\n viewPaddingChangeBehavior={viewPaddingChangeBehavior}\n >\n {children}\n </MapContainerReady>\n )}\n </chakra.div>\n </chakra.div>\n );\n}\n\n/**\n * This inner component is rendered when the map has been loaded.\n *\n * It provides the map instance and additional properties down the component tree.\n */\nfunction MapContainerReady(\n props: {\n map: MapModel;\n mapAnchorsHost: HTMLElement;\n viewPadding: Required<MapPadding>;\n } & Omit<MapContainerProps, \"mapId\" | \"map\" | \"className\">\n): ReactNode {\n const {\n map,\n mapAnchorsHost,\n viewPadding,\n viewPaddingChangeBehavior = \"preserve-center\",\n children\n } = props;\n\n // Apply view padding\n useSyncViewPadding(viewPadding, viewPaddingChangeBehavior, map);\n\n const mapContext = useMemo((): MapContainerContextType => {\n return {\n mapAnchorsHost\n };\n }, [mapAnchorsHost]);\n return (\n <MapContainerContextProvider value={mapContext}>\n <OverlaysRenderer map={map} />\n {children}\n </MapContainerContextProvider>\n );\n}\n\n/**\n * Registers the map container as the map's renderer.\n * This can only be done once at a time: there cannot be two renderers for the same map model.\n */\nfunction useMapContainerRegistration(\n mapContainer: RefObject<HTMLDivElement | null>,\n map: MapModel\n) {\n useEffect(() => {\n // Mount the map into the DOM\n if (mapContainer.current) {\n const resource = registerMapTarget(map, mapContainer.current);\n return () => resource?.destroy();\n }\n }, [mapContainer, map]);\n}\n\n/**\n * Custom CSS rules for the root element.\n */\nfunction useRootCss(viewPadding: Required<MapPadding>) {\n return useMemo((): SystemStyleObject => {\n return {\n height: \"100%\",\n position: \"relative\",\n\n // set css variables according to view padding\n \"--map-padding-top\": `${viewPadding.top}px`,\n \"--map-padding-bottom\": `${viewPadding.bottom}px`,\n \"--map-padding-left\": `${viewPadding.left}px`,\n \"--map-padding-right\": `${viewPadding.right}px`\n };\n }, [viewPadding]);\n}\n\n/**\n * Normalizes the view padding property.\n */\nfunction useViewPadding(viewPaddingProp: MapPadding | undefined): Required<MapPadding> {\n return useMemo<Required<MapPadding>>(() => {\n return {\n left: viewPaddingProp?.left ?? 0,\n right: viewPaddingProp?.right ?? 0,\n top: viewPaddingProp?.top ?? 0,\n bottom: viewPaddingProp?.bottom ?? 0\n };\n }, [\n viewPaddingProp?.left,\n viewPaddingProp?.right,\n viewPaddingProp?.top,\n viewPaddingProp?.bottom\n ]);\n}\n\ninterface TargetViewPoint {\n center: Coordinate;\n extent: Extent | undefined;\n}\n\n/**\n * Applies the current view padding to the view.\n */\nfunction useSyncViewPadding(\n viewPadding: Required<MapPadding>,\n viewPaddingChangeBehavior: MapContainerProps[\"viewPaddingChangeBehavior\"],\n map: MapModel\n) {\n const mapView = useReactiveSnapshot(() => map.olView, [map]);\n\n // Tracks target state for in-progress animations.\n const targetViewPoint = useRef<TargetViewPoint>(undefined);\n\n useEffect(() => {\n const olMap = map.olMap;\n if (!mapView) {\n return;\n }\n\n const oldPadding = fromOlPadding(mapView.padding);\n const paddingNotChanged = isPaddingEqual(viewPadding, oldPadding);\n if (paddingNotChanged) {\n return;\n }\n\n let target = targetViewPoint.current;\n if (!target || !mapView.getAnimating()) {\n const currentCenter = mapView.getCenter();\n if (!currentCenter) {\n return;\n }\n targetViewPoint.current = target = {\n center: currentCenter,\n extent: extentIncludingPadding(olMap, oldPadding)\n };\n }\n mapView.padding = toOlPadding(viewPadding);\n\n const shouldAnimate = map[DISPLAY_STATUS] === \"ready\";\n switch (viewPaddingChangeBehavior) {\n case \"preserve-center\": {\n if (shouldAnimate) {\n mapView.animate({ center: target.center, duration: 300 }, (done) => {\n if (done) {\n targetViewPoint.current = undefined;\n }\n });\n } else {\n mapView.setCenter(target.center);\n targetViewPoint.current = undefined;\n }\n break;\n }\n case \"preserve-extent\": {\n if (target.extent) {\n const res = mapView.getResolutionForExtent(target.extent);\n if (shouldAnimate) {\n mapView.animate(\n {\n center: target.center,\n resolution: res,\n duration: 300\n },\n (done) => {\n if (done) {\n targetViewPoint.current = undefined;\n }\n }\n );\n } else {\n mapView.setCenter(target.center);\n mapView.setResolution(res);\n targetViewPoint.current = undefined;\n }\n }\n break;\n }\n case \"none\":\n }\n }, [viewPadding, viewPaddingChangeBehavior, map, mapView]);\n}\n\nfunction registerMapTarget(mapModel: MapModel, target: HTMLDivElement): Resource | undefined {\n const mapId = mapModel.id;\n const olMap = mapModel.olMap;\n if (olMap.getTarget()) {\n LOG.error(\n `Failed to display the map: the map already has a target. There may be more than one <MapContainer />.`\n );\n return undefined;\n }\n\n LOG.isDebug() && LOG.debug(`Setting target of map '${mapId}':`, target);\n if (!(\"keyboardEventTarget_\" in olMap)) {\n throw new Error(\n \"Internal error: failed to override keyboard event target. The property is no longer present.\"\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (olMap as any).keyboardEventTarget_ = target;\n olMap.setTarget(target);\n\n let unregistered = false;\n return {\n destroy() {\n if (!unregistered) {\n LOG.isDebug() && LOG.debug(`Removing target of map '${mapId}':`, target);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (olMap as any).keyboardEventTarget_ = undefined;\n olMap.setTarget(undefined);\n unregistered = true;\n }\n }\n };\n}\n\n/**\n * Returns the extent visible in the non-padded region of the map.\n */\nfunction extentIncludingPadding(map: OlMap, padding: Required<MapPadding>): Extent | undefined {\n const size = map.getSize();\n if (!size || size.length < 2) {\n return undefined;\n }\n\n const [width, height] = size as [number, number];\n const bottomLeft = map.getCoordinateFromPixel([padding.left, padding.bottom]);\n const topRight = map.getCoordinateFromPixel([\n Math.max(0, width - padding.right),\n Math.max(0, height - padding.top)\n ]);\n if (!bottomLeft || !topRight) {\n return undefined;\n }\n\n const [xmin, ymin] = bottomLeft;\n const [xmax, ymax] = topRight;\n return [xmin, ymin, xmax, ymax] as Extent;\n}\n\nfunction fromOlPadding(padding: number[] | undefined): Required<MapPadding> {\n // top, right, bottom, left\n return {\n top: padding?.[0] ?? 0,\n right: padding?.[1] ?? 0,\n bottom: padding?.[2] ?? 0,\n left: padding?.[3] ?? 0\n };\n}\n\nfunction toOlPadding(padding: Required<MapPadding>): number[] {\n // top, right, bottom, left\n const { top, right, bottom, left } = padding;\n return [top, right, bottom, left];\n}\n\nfunction isPaddingEqual(a: Required<MapPadding>, b: Required<MapPadding>): boolean {\n return a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAgF1B,SAAS,aAAa,KAAA,EAA0B;AACnD,EAAA,MAAM;AAAA,IACF,WAAA,EAAa,eAAA;AAAA,IACb,yBAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA,GAAO,aAAA;AAAA,IACP,YAAA,EAAc,SAAA;AAAA,IACd,iBAAA,EAAmB,cAAA;AAAA,IACnB,SAAA;AAAA,IACA,cAAA;AAAA,IACA,GAAG;AAAA,GACP,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,cAAA,EAAgB,kBAAA,EAAmB,GAAI,uBAAA;AAAA,IAC3C,oBAAA;AAAA,IACA;AAAA;AAAA,GACJ;AACA,EAAA,MAAM,YAAA,GAAe,OAAuB,IAAI,CAAA;AAChD,EAAA,MAAM,cAAA,GAAiB,OAAuB,IAAI,CAAA;AAClD,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,WAAA,GAAc,eAAe,eAAe,CAAA;AAClD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,KAAK,CAAA;AAGxC,EAAA,2BAAA,CAA4B,cAAc,GAAG,CAAA;AAG7C,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,QAAA,CAAS,IAAI,CAAA;AAAA,EACjB,CAAA,E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1D,EAAA,MAAM,EAAE,GAAA,EAAK,KAAA,EAAO,MAAA,EAAQ,MAAK,GAAI,OAAA;AACrC,EAAA,OAAO,CAAC,GAAA,EAAK,KAAA,EAAO,MAAA,EAAQ,IAAI,CAAA;AACpC;AAEA,SAAS,cAAA,CAAe,GAAyB,CAAA,EAAkC;AAC/E,EAAA,OAAO,CAAA,CAAE,GAAA,KAAQ,CAAA,CAAE,GAAA,IAAO,EAAE,KAAA,KAAU,CAAA,CAAE,KAAA,IAAS,CAAA,CAAE,MAAA,KAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,SAAS,CAAA,CAAE,IAAA;AAC3F;;;;"}
1
+ {"version":3,"file":"MapContainer.js","sources":["MapContainer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BoxProps, chakra, SystemStyleObject } from \"@chakra-ui/react\";\nimport { createLogger, Resource } from \"@open-pioneer/core\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { Extent } from \"ol/extent\";\nimport type OlMap from \"ol/Map\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ReactNode, RefObject, useEffect, useMemo, useRef, useState } from \"react\";\nimport { DISPLAY_STATUS, MapModel, MapPadding } from \"../model/MapModel\";\nimport { MapModelProps, useMapModelValue } from \"./hooks/useMapModel\";\nimport { MapContainerContextProvider, MapContainerContextType } from \"./MapContainerContext\";\nimport { OverlaysRenderer } from \"./OverlaysRenderer\";\n\nconst LOG = createLogger(sourceId);\n\n/**\n * @group UI Components and Hooks\n */\nexport interface MapContainerProps extends CommonComponentProps, MapModelProps {\n /**\n * Sets the map's padding directly.\n * Do not use the view's padding property directly on the OL map.\n *\n * See: https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#padding)\n */\n viewPadding?: MapPadding | undefined;\n\n /**\n * Behavior performed by the map when the view padding changes.\n *\n * - `none`: Do nothing.\n * - `preserve-center`: Ensures that the center point remains the same by animating the view.\n * - `preserve-extent`: Ensures that the extent remains the same by zooming.\n *\n * @default \"preserve-center\"\n */\n viewPaddingChangeBehavior?: \"none\" | \"preserve-center\" | \"preserve-extent\";\n\n children?: ReactNode;\n\n /**\n * Optional role property.\n *\n * This property is directly applied to the map's container div element.\n *\n * @default \"application\"\n */\n role?: string;\n\n /**\n * Optional aria-labelledby property.\n * Do not use together with aria-label.\n *\n * This property is directly applied to the map's container div element.\n */\n \"aria-labelledby\"?: string;\n\n /**\n * Optional aria-label property.\n * Do not use together with aria-label.\n *\n * This property is directly applied to the map's container div element.\n */\n \"aria-label\"?: string;\n\n /**\n * Arbitrary html properties that will be applied to the map container's _root_ element.\n * This is the element that contains the map container and any UI elements (like map anchors, for example).\n *\n * Use these at your own risk since they may be overwritten by the map container root itself.\n *\n * Use cases: setting custom data attributes, registering custom event handlers, ...\n */\n rootProps?: BoxProps;\n\n /**\n * Arbitrary html properties that will be applied to the map container's element.\n * This is the element that _renders_ the OpenLayers map.\n *\n * Use these at your own risk since they may be overwritten by the map container itself.\n *\n * Use cases: setting custom data attributes, registering custom event handlers, ...\n */\n containerProps?: BoxProps;\n}\n\n/**\n * Displays the map with the given id.\n *\n * There can only be at most one MapContainer for every map.\n *\n * @group UI Components and Hooks\n */\nexport function MapContainer(props: MapContainerProps) {\n const {\n viewPadding: viewPaddingProp,\n viewPaddingChangeBehavior,\n children,\n role = \"application\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n rootProps,\n containerProps,\n ...restProps\n } = props;\n const { containerProps: rootContainerProps } = useCommonComponentProps(\n \"map-container-root\",\n restProps // hide role, aria label etc from helper\n );\n const mapContainer = useRef<HTMLDivElement>(null);\n const mapAnchorsHost = useRef<HTMLDivElement>(null);\n const map = useMapModelValue(props);\n const viewPadding = useViewPadding(viewPaddingProp);\n const [ready, setReady] = useState(false);\n\n // Register as renderer for map model\n useMapContainerRegistration(mapContainer, map);\n\n // Wait for mount to make sure that the map anchors host is available\n useEffect(() => {\n setReady(true);\n }, []);\n\n const css = useRootCss(viewPadding);\n const mergedRootProps = useMemo(\n () => mergeChakraProps<BoxProps>({ css }, rootContainerProps, rootProps ?? {}),\n [css, rootProps, rootContainerProps]\n );\n const mergedContainerProps = useMemo(\n () =>\n mergeChakraProps<BoxProps>(\n {\n className: \"map-container\",\n role,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n h: \"100%\",\n w: \"100%\",\n tabIndex: 0\n },\n containerProps ?? {}\n ),\n [role, ariaLabel, ariaLabelledBy, containerProps]\n );\n return (\n <chakra.div {...mergedRootProps}>\n {/* Used by open layers to mount the map. This node receives the keyboard focus when interacting with the map. */}\n <chakra.div ref={mapContainer} {...mergedContainerProps} />\n\n {/* Contains user widgets (map anchors and raw children). These are separate from the map so they don't interfere with mouse/keyboard events. */}\n <chakra.div ref={mapAnchorsHost} className=\"map-anchors\">\n {ready && map && (\n <MapContainerReady\n map={map}\n // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion\n mapAnchorsHost={mapAnchorsHost.current!}\n viewPadding={viewPadding}\n viewPaddingChangeBehavior={viewPaddingChangeBehavior}\n >\n {children}\n </MapContainerReady>\n )}\n </chakra.div>\n </chakra.div>\n );\n}\n\n/**\n * This inner component is rendered when the map has been loaded.\n *\n * It provides the map instance and additional properties down the component tree.\n */\nfunction MapContainerReady(\n props: {\n map: MapModel;\n mapAnchorsHost: HTMLElement;\n viewPadding: Required<MapPadding>;\n } & Omit<MapContainerProps, \"mapId\" | \"map\" | \"className\">\n): ReactNode {\n const {\n map,\n mapAnchorsHost,\n viewPadding,\n viewPaddingChangeBehavior = \"preserve-center\",\n children\n } = props;\n\n // Apply view padding\n useSyncViewPadding(viewPadding, viewPaddingChangeBehavior, map);\n\n const mapContext = useMemo((): MapContainerContextType => {\n return {\n mapAnchorsHost\n };\n }, [mapAnchorsHost]);\n return (\n <MapContainerContextProvider value={mapContext}>\n <OverlaysRenderer map={map} />\n {children}\n </MapContainerContextProvider>\n );\n}\n\n/**\n * Registers the map container as the map's renderer.\n * This can only be done once at a time: there cannot be two renderers for the same map model.\n */\nfunction useMapContainerRegistration(\n mapContainer: RefObject<HTMLDivElement | null>,\n map: MapModel\n) {\n useEffect(() => {\n // Mount the map into the DOM\n if (mapContainer.current) {\n const resource = registerMapTarget(map, mapContainer.current);\n return () => resource?.destroy();\n }\n }, [mapContainer, map]);\n}\n\n/**\n * Custom CSS rules for the root element.\n */\nfunction useRootCss(viewPadding: Required<MapPadding>) {\n return useMemo((): SystemStyleObject => {\n return {\n height: \"100%\",\n position: \"relative\",\n\n // set css variables according to view padding\n \"--map-padding-top\": `${viewPadding.top}px`,\n \"--map-padding-bottom\": `${viewPadding.bottom}px`,\n \"--map-padding-left\": `${viewPadding.left}px`,\n \"--map-padding-right\": `${viewPadding.right}px`\n };\n }, [viewPadding]);\n}\n\n/**\n * Normalizes the view padding property.\n */\nfunction useViewPadding(viewPaddingProp: MapPadding | undefined): Required<MapPadding> {\n return useMemo<Required<MapPadding>>(() => {\n return {\n left: viewPaddingProp?.left ?? 0,\n right: viewPaddingProp?.right ?? 0,\n top: viewPaddingProp?.top ?? 0,\n bottom: viewPaddingProp?.bottom ?? 0\n };\n }, [\n viewPaddingProp?.left,\n viewPaddingProp?.right,\n viewPaddingProp?.top,\n viewPaddingProp?.bottom\n ]);\n}\n\ninterface TargetViewPoint {\n center: Coordinate;\n extent: Extent | undefined;\n}\n\n/**\n * Applies the current view padding to the view.\n */\nfunction useSyncViewPadding(\n viewPadding: Required<MapPadding>,\n viewPaddingChangeBehavior: MapContainerProps[\"viewPaddingChangeBehavior\"],\n map: MapModel\n) {\n const mapView = useReactiveSnapshot(() => map.olView, [map]);\n\n // Tracks target state for in-progress animations.\n const targetViewPoint = useRef<TargetViewPoint>(undefined);\n\n useEffect(() => {\n const olMap = map.olMap;\n if (!mapView) {\n return;\n }\n\n const oldPadding = fromOlPadding(mapView.padding);\n const paddingNotChanged = isPaddingEqual(viewPadding, oldPadding);\n if (paddingNotChanged) {\n return;\n }\n\n let target = targetViewPoint.current;\n if (!target || !mapView.getAnimating()) {\n const currentCenter = mapView.getCenter();\n if (!currentCenter) {\n return;\n }\n targetViewPoint.current = target = {\n center: currentCenter,\n extent: extentIncludingPadding(olMap, oldPadding)\n };\n }\n mapView.padding = toOlPadding(viewPadding);\n\n const shouldAnimate = map[DISPLAY_STATUS] === \"ready\";\n switch (viewPaddingChangeBehavior) {\n case \"preserve-center\": {\n if (shouldAnimate) {\n mapView.animate({ center: target.center, duration: 300 }, (done) => {\n if (done) {\n targetViewPoint.current = undefined;\n }\n });\n } else {\n mapView.setCenter(target.center);\n targetViewPoint.current = undefined;\n }\n break;\n }\n case \"preserve-extent\": {\n if (target.extent) {\n const res = mapView.getResolutionForExtent(target.extent);\n if (shouldAnimate) {\n mapView.animate(\n {\n center: target.center,\n resolution: res,\n duration: 300\n },\n (done) => {\n if (done) {\n targetViewPoint.current = undefined;\n }\n }\n );\n } else {\n mapView.setCenter(target.center);\n mapView.setResolution(res);\n targetViewPoint.current = undefined;\n }\n }\n break;\n }\n case \"none\":\n }\n }, [viewPadding, viewPaddingChangeBehavior, map, mapView]);\n}\n\nfunction registerMapTarget(mapModel: MapModel, target: HTMLDivElement): Resource | undefined {\n const mapId = mapModel.id;\n const olMap = mapModel.olMap;\n if (olMap.getTarget()) {\n LOG.error(\n `Failed to display the map: the map already has a target. There may be more than one <MapContainer />.`\n );\n return undefined;\n }\n\n LOG.isDebug() && LOG.debug(`Setting target of map '${mapId}':`, target);\n if (!(\"keyboardEventTarget_\" in olMap)) {\n throw new Error(\n \"Internal error: failed to override keyboard event target. The property is no longer present.\"\n );\n }\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n (olMap as any).keyboardEventTarget_ = target;\n olMap.setTarget(target);\n\n let unregistered = false;\n return {\n destroy() {\n if (!unregistered) {\n LOG.isDebug() && LOG.debug(`Removing target of map '${mapId}':`, target);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n (olMap as any).keyboardEventTarget_ = undefined;\n olMap.setTarget(undefined);\n unregistered = true;\n }\n }\n };\n}\n\n/**\n * Returns the extent visible in the non-padded region of the map.\n */\nfunction extentIncludingPadding(map: OlMap, padding: Required<MapPadding>): Extent | undefined {\n const size = map.getSize();\n if (!size || size.length < 2) {\n return undefined;\n }\n\n const [width, height] = size as [number, number];\n const bottomLeft = map.getCoordinateFromPixel([padding.left, padding.bottom]);\n const topRight = map.getCoordinateFromPixel([\n Math.max(0, width - padding.right),\n Math.max(0, height - padding.top)\n ]);\n if (!bottomLeft || !topRight) {\n return undefined;\n }\n\n const [xmin, ymin] = bottomLeft;\n const [xmax, ymax] = topRight;\n return [xmin, ymin, xmax, ymax] as Extent;\n}\n\nfunction fromOlPadding(padding: number[] | undefined): Required<MapPadding> {\n // top, right, bottom, left\n return {\n top: padding?.[0] ?? 0,\n right: padding?.[1] ?? 0,\n bottom: padding?.[2] ?? 0,\n left: padding?.[3] ?? 0\n };\n}\n\nfunction toOlPadding(padding: Required<MapPadding>): number[] {\n // top, right, bottom, left\n const { top, right, bottom, left } = padding;\n return [top, right, bottom, left];\n}\n\nfunction isPaddingEqual(a: Required<MapPadding>, b: Required<MapPadding>): boolean {\n return a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAgF1B,SAAS,aAAa,KAAA,EAA0B;AACnD,EAAA,MAAM;AAAA,IACF,WAAA,EAAa,eAAA;AAAA,IACb,yBAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA,GAAO,aAAA;AAAA,IACP,YAAA,EAAc,SAAA;AAAA,IACd,iBAAA,EAAmB,cAAA;AAAA,IACnB,SAAA;AAA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C1B,IAAA,OAAO,MAAA;AAAA,EACX;AAEA,EAAA,MAAM,CAAC,IAAA,EAAM,IAAI,CAAA,GAAI,UAAA;AACrB,EAAA,MAAM,CAAC,IAAA,EAAM,IAAI,CAAA,GAAI,QAAA;AACrB,EAAA,OAAO,CAAC,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAI,CAAA;AAClC;AAEA,SAAS,cAAc,OAAA,EAAqD;AAExE,EAAA,OAAO;AAAA,IACH,GAAA,EAAK,OAAA,GAAU,CAAC,CAAA,IAAK,CAAA;AAAA,IACrB,KAAA,EAAO,OAAA,GAAU,CAAC,CAAA,IAAK,CAAA;AAAA,IACvB,MAAA,EAAQ,OAAA,GAAU,CAAC,CAAA,IAAK,CAAA;AAAA,IACxB,IAAA,EAAM,OAAA,GAAU,CAAC,CAAA,IAAK;AAAA,GAC1B;AACJ;AAEA,SAAS,YAAY,OAAA,EAAyC;AAE1D,EAAA,MAAM,EAAE,GAAA,EAAK,KAAA,EAAO,MAAA,EAAQ,MAAK,GAAI,OAAA;AACrC,EAAA,OAAO,CAAC,GAAA,EAAK,KAAA,EAAO,MAAA,EAAQ,IAAI,CAAA;AACpC;AAEA,SAAS,cAAA,CAAe,GAAyB,CAAA,EAAkC;AAC/E,EAAA,OAAO,CAAA,CAAE,GAAA,KAAQ,CAAA,CAAE,GAAA,IAAO,EAAE,KAAA,KAAU,CAAA,CAAE,KAAA,IAAS,CAAA,CAAE,MAAA,KAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,SAAS,CAAA,CAAE,IAAA;AAC3F;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MapContainerContext.js","sources":["MapContainerContext.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Provider, createContext, useContext } from \"react\";\n\n/** Values provided to children of {@link MapContainer}. */\nexport interface MapContainerContextType {\n mapAnchorsHost: HTMLElement;\n}\n\nconst MapContainerContext = createContext<MapContainerContextType | undefined>(undefined);\nMapContainerContext.displayName = \"MapContainerContext\";\n\nexport const MapContainerContextProvider: Provider<MapContainerContextType> =\n MapContainerContext.Provider as Provider<MapContainerContextType>;\n\nexport function useMapContainerContext(): MapContainerContextType {\n const contextValue = useContext(MapContainerContext);\n if (!contextValue) {\n throw new Error(\n `Map container context is not available. The component must be a child of the <MapContainer /> component.`\n );\n }\n return contextValue;\n}\n"],"names":[],"mappings":";;AASA,MAAM,mBAAA,GAAsB,cAAmD,MAAS,CAAA;AACxF,mBAAA,CAAoB,WAAA,GAAc,qBAAA;AAE3B,MAAM,8BACT,mBAAA,CAAoB;AAEjB,SAAS,sBAAA,GAAkD;AAC9D,EAAA,MAAM,YAAA,GAAe,WAAW,mBAAmB,CAAA;AACnD,EAAA,IAAI,CAAC,YAAA,EAAc;AACf,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,wGAAA;AAAA,KACJ;AAAA,EACJ;AACA,EAAA,OAAO,YAAA;AACX;;;;"}
1
+ {"version":3,"file":"MapContainerContext.js","sources":["MapContainerContext.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Provider, createContext, useContext } from \"react\";\n\n/** Values provided to children of {@link MapContainer}. */\nexport interface MapContainerContextType {\n mapAnchorsHost: HTMLElement;\n}\n\nconst MapContainerContext = createContext<MapContainerContextType | undefined>(undefined);\nMapContainerContext.displayName = \"MapContainerContext\";\n\nexport const MapContainerContextProvider: Provider<MapContainerContextType> =\n MapContainerContext.Provider as Provider<MapContainerContextType>;\n\nexport function useMapContainerContext(): MapContainerContextType {\n const contextValue = useContext(MapContainerContext);\n if (!contextValue) {\n throw new Error(\n `Map container context is not available. The component must be a child of the <MapContainer /> component.`\n );\n }\n return contextValue;\n}\n"],"names":[],"mappings":";;AAUA,MAAM,mBAAA,GAAsB,cAAmD,MAAS,CAAA;AACxF,mBAAA,CAAoB,WAAA,GAAc,qBAAA;AAE3B,MAAM,8BACT,mBAAA,CAAoB;AAEjB,SAAS,sBAAA,GAAkD;AAC9D,EAAA,MAAM,YAAA,GAAe,WAAW,mBAAmB,CAAA;AACnD,EAAA,IAAI,CAAC,YAAA,EAAc;AACf,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,wGAAA;AAAA,KACJ;AAAA,EACJ;AACA,EAAA,OAAO,YAAA;AACX;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OverlaysRenderer.js","sources":["OverlaysRenderer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { MapModel } from \"../model/MapModel\";\nimport { Overlay } from \"../model/Overlays\";\nimport { createPortal } from \"react-dom\";\n\nexport function OverlaysRenderer(props: { map: MapModel }) {\n const { map } = props;\n const overlays = useReactiveSnapshot(() => {\n return map.overlays.getAll();\n }, [map]);\n return overlays.map((overlay) => <OverlayRenderer key={overlay.id} overlay={overlay} />);\n}\n\nfunction OverlayRenderer(props: { overlay: Overlay }) {\n const { overlay } = props;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const target = overlay.olOverlay.getElement()!; // not reactive, always the same\n const content = useReactiveSnapshot(() => overlay.content, [overlay]);\n return createPortal(content, target);\n}\n"],"names":[],"mappings":";;;;AAOO,SAAS,iBAAiB,KAAA,EAA0B;AACvD,EAAA,MAAM,EAAE,KAAI,GAAI,KAAA;AAChB,EAAA,MAAM,QAAA,GAAW,oBAAoB,MAAM;AACvC,IAAA,OAAO,GAAA,CAAI,SAAS,MAAA,EAAO;AAAA,EAC/B,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AACR,EAAA,OAAO,QAAA,CAAS,IAAI,CAAC,OAAA,yBAAa,eAAA,EAAA,EAAiC,OAAA,EAAA,EAAZ,OAAA,CAAQ,EAAsB,CAAE,CAAA;AAC3F;AAEA,SAAS,gBAAgB,KAAA,EAA6B;AAClD,EAAA,MAAM,EAAE,SAAQ,GAAI,KAAA;AAEpB,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,SAAA,CAAU,UAAA,EAAW;AAC5C,EAAA,MAAM,UAAU,mBAAA,CAAoB,MAAM,QAAQ,OAAA,EAAS,CAAC,OAAO,CAAC,CAAA;AACpE,EAAA,OAAO,YAAA,CAAa,SAAS,MAAM,CAAA;AACvC;;;;"}
1
+ {"version":3,"file":"OverlaysRenderer.js","sources":["OverlaysRenderer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { createPortal } from \"react-dom\";\nimport { MapModel } from \"../model/MapModel\";\nimport { Overlay } from \"../model/Overlays\";\n\nexport function OverlaysRenderer(props: { map: MapModel }) {\n const { map } = props;\n const overlays = useReactiveSnapshot(() => {\n return map.overlays.getAll();\n }, [map]);\n return overlays.map((overlay) => <OverlayRenderer key={overlay.id} overlay={overlay} />);\n}\n\nfunction OverlayRenderer(props: { overlay: Overlay }) {\n const { overlay } = props;\n // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion\n const target = overlay.olOverlay.getElement()!; // not reactive, always the same\n const content = useReactiveSnapshot(() => overlay.content, [overlay]);\n return createPortal(content, target);\n}\n"],"names":[],"mappings":";;;;AAQO,SAAS,iBAAiB,KAAA,EAA0B;AACvD,EAAA,MAAM,EAAE,KAAI,GAAI,KAAA;AAChB,EAAA,MAAM,QAAA,GAAW,oBAAoB,MAAM;AACvC,IAAA,OAAO,GAAA,CAAI,SAAS,MAAA,EAAO;AAAA,EAC/B,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AACR,EAAA,OAAO,QAAA,CAAS,IAAI,CAAC,OAAA,yBAAa,eAAA,EAAA,EAAiC,OAAA,EAAA,EAAZ,OAAA,CAAQ,EAAsB,CAAE,CAAA;AAC3F;AAEA,SAAS,gBAAgB,KAAA,EAA6B;AAClD,EAAA,MAAM,EAAE,SAAQ,GAAI,KAAA;AAEpB,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,SAAA,CAAU,UAAA,EAAW;AAC5C,EAAA,MAAM,UAAU,mBAAA,CAAoB,MAAM,QAAQ,OAAA,EAAS,CAAC,OAAO,CAAC,CAAA;AACpE,EAAA,OAAO,YAAA,CAAa,SAAS,MAAM,CAAA;AACvC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"computeMapAnchorStyles.js","sources":["computeMapAnchorStyles.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { SystemStyleObject } from \"@chakra-ui/react\";\nimport { MapAnchorPosition } from \"./MapAnchor\";\n\nexport function computeMapAnchorStyles(\n position: MapAnchorPosition,\n horizontalGap?: number | undefined,\n verticalGap?: number | undefined\n): SystemStyleObject {\n const horizontal = horizontalGap ?? 0;\n const vertical = verticalGap ?? 0;\n const attributionGap = verticalGap == null ? ATTR_GAP : 0;\n\n const styleProps: SystemStyleObject = {};\n switch (position) {\n case \"top-left\":\n styleProps.left = `${horizontal}px`;\n styleProps.top = `${vertical}px`;\n break;\n case \"top-right\":\n styleProps.right = `${horizontal}px`;\n styleProps.top = `${vertical}px`;\n break;\n case \"bottom-left\":\n styleProps.left = `${horizontal}px`;\n styleProps.bottom = `${vertical + attributionGap}px`;\n break;\n case \"bottom-right\":\n styleProps.right = `${horizontal}px`;\n styleProps.bottom = `${vertical + attributionGap}px`;\n break;\n case \"top-center\":\n styleProps.top = `${vertical}px`;\n styleProps.left = `calc((100% - ${horizontal}px) / 2)`;\n styleProps.transform = \"translateX(-50%)\";\n break;\n case \"bottom-center\":\n styleProps.bottom = `${vertical + attributionGap}px`;\n styleProps.left = `calc((100% - ${horizontal}px) / 2)`;\n styleProps.transform = \"translateX(-50%)\";\n break;\n case \"left-center\":\n styleProps.left = `${horizontal}px`;\n styleProps.top = `calc((100% - ${vertical}px) / 2)`;\n styleProps.transform = \"translateY(-50%)\";\n break;\n case \"right-center\":\n styleProps.right = `${horizontal}px`;\n styleProps.top = `calc((100% - ${vertical}px) / 2)`;\n styleProps.transform = \"translateY(-50%)\";\n break;\n case \"center\":\n styleProps.top = `calc((100% - ${vertical}px) / 2)`;\n styleProps.left = `calc((100% - ${horizontal}px) / 2)`;\n styleProps.transform = \"translate(-50%, -50%)\";\n break;\n }\n\n styleProps.maxW = `calc((100%) - ${2 * horizontal}px)`;\n styleProps.maxH = `calc((100%) - ${attributionGap}px - ${2 * vertical}px)`;\n return styleProps;\n}\n\n/**\n * height of the ol attribution component\n * improvement: Get height directly from `Attribution` HTMLDivElement\n */\nconst ATTR_HEIGHT = 20;\n\n/**\n * additional space between attribution and map anchor container\n */\nconst ATTR_SPACE = 10;\nconst ATTR_GAP = ATTR_HEIGHT + ATTR_SPACE;\n"],"names":[],"mappings":"AAKO,SAAS,sBAAA,CACZ,QAAA,EACA,aAAA,EACA,WAAA,EACiB;AACjB,EAAA,MAAM,aAAa,aAAA,IAAiB,CAAA;AACpC,EAAA,MAAM,WAAW,WAAA,IAAe,CAAA;AAChC,EAAA,MAAM,cAAA,GAAiB,WAAA,IAAe,IAAA,GAAO,QAAA,GAAW,CAAA;AAExD,EAAA,MAAM,aAAgC,EAAC;AACvC,EAAA,QAAQ,QAAA;AAAU,IACd,KAAK,UAAA;AACD,MAAA,UAAA,CAAW,IAAA,GAAO,GAAG,UAAU,CAAA,EAAA,CAAA;AAC/B,MAAA,UAAA,CAAW,GAAA,GAAM,GAAG,QAAQ,CAAA,EAAA,CAAA;AAC5B,MAAA;AAAA,IACJ,KAAK,WAAA;AACD,MAAA,UAAA,CAAW,KAAA,GAAQ,GAAG,UAAU,CAAA,EAAA,CAAA;AAChC,MAAA,UAAA,CAAW,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Q,CAAA,QAAA,CAAA;AACzC,MAAA,UAAA,CAAW,SAAA,GAAY,kBAAA;AACvB,MAAA;AAAA,IACJ,KAAK,QAAA;AACD,MAAA,UAAA,CAAW,GAAA,GAAM,gBAAgB,QAAQ,CAAA,QAAA,CAAA;AACzC,MAAA,UAAA,CAAW,IAAA,GAAO,gBAAgB,UAAU,CAAA,QAAA,CAAA;AAC5C,MAAA,UAAA,CAAW,SAAA,GAAY,uBAAA;AACvB,MAAA;AAAA;AAGR,EAAA,UAAA,CAAW,IAAA,GAAO,CAAA,cAAA,EAAiB,CAAA,GAAI,UAAU,CAAA,GAAA,CAAA;AACjD,EAAA,UAAA,CAAW,IAAA,GAAO,CAAA,cAAA,EAAiB,cAAc,CAAA,KAAA,EAAQ,IAAI,QAAQ,CAAA,GAAA,CAAA;AACrE,EAAA,OAAO,UAAA;AACX;AAMA,MAAM,WAAA,GAAc,EAAA;AAKpB,MAAM,UAAA,GAAa,EAAA;AACnB,MAAM,WAAW,WAAA,GAAc,UAAA;;;;"}
1
+ {"version":3,"file":"computeMapAnchorStyles.js","sources":["computeMapAnchorStyles.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SystemStyleObject } from \"@chakra-ui/react\";\nimport { MapAnchorPosition } from \"./MapAnchor\";\n\nexport function computeMapAnchorStyles(\n position: MapAnchorPosition,\n horizontalGap?: number | undefined,\n verticalGap?: number | undefined\n): SystemStyleObject {\n const horizontal = horizontalGap ?? 0;\n const vertical = verticalGap ?? 0;\n const attributionGap = verticalGap == null ? ATTR_GAP : 0;\n\n const styleProps: SystemStyleObject = {};\n switch (position) {\n case \"top-left\":\n styleProps.left = `${horizontal}px`;\n styleProps.top = `${vertical}px`;\n break;\n case \"top-right\":\n styleProps.right = `${horizontal}px`;\n styleProps.top = `${vertical}px`;\n break;\n case \"bottom-left\":\n styleProps.left = `${horizontal}px`;\n styleProps.bottom = `${vertical + attributionGap}px`;\n break;\n case \"bottom-right\":\n styleProps.right = `${horizontal}px`;\n styleProps.bottom = `${vertical + attributionGap}px`;\n break;\n case \"top-center\":\n styleProps.top = `${vertical}px`;\n styleProps.left = `calc((100% - ${horizontal}px) / 2)`;\n styleProps.transform = \"translateX(-50%)\";\n break;\n case \"bottom-center\":\n styleProps.bottom = `${vertical + attributionGap}px`;\n styleProps.left = `calc((100% - ${horizontal}px) / 2)`;\n styleProps.transform = \"translateX(-50%)\";\n break;\n case \"left-center\":\n styleProps.left = `${horizontal}px`;\n styleProps.top = `calc((100% - ${vertical}px) / 2)`;\n styleProps.transform = \"translateY(-50%)\";\n break;\n case \"right-center\":\n styleProps.right = `${horizontal}px`;\n styleProps.top = `calc((100% - ${vertical}px) / 2)`;\n styleProps.transform = \"translateY(-50%)\";\n break;\n case \"center\":\n styleProps.top = `calc((100% - ${vertical}px) / 2)`;\n styleProps.left = `calc((100% - ${horizontal}px) / 2)`;\n styleProps.transform = \"translate(-50%, -50%)\";\n break;\n }\n\n styleProps.maxW = `calc((100%) - ${2 * horizontal}px)`;\n styleProps.maxH = `calc((100%) - ${attributionGap}px - ${2 * vertical}px)`;\n return styleProps;\n}\n\n/**\n * height of the ol attribution component\n * improvement: Get height directly from `Attribution` HTMLDivElement\n */\nconst ATTR_HEIGHT = 20;\n\n/**\n * additional space between attribution and map anchor container\n */\nconst ATTR_SPACE = 10;\nconst ATTR_GAP = ATTR_HEIGHT + ATTR_SPACE;\n"],"names":[],"mappings":"AAMO,SAAS,sBAAA,CACZ,QAAA,EACA,aAAA,EACA,WAAA,EACiB;AACjB,EAAA,MAAM,aAAa,aAAA,IAAiB,CAAA;AACpC,EAAA,MAAM,WAAW,WAAA,IAAe,CAAA;AAChC,EAAA,MAAM,cAAA,GAAiB,WAAA,IAAe,IAAA,GAAO,QAAA,GAAW,CAAA;AAExD,EAAA,MAAM,aAAgC,EAAC;AACvC,EAAA,QAAQ,QAAA;AAAU,IACd,KAAK,UA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AAC/B,MAAA,UAAA,CAAW,GAAA,GAAM,gBAAgB,QAAQ,CAAA,QAAA,CAAA;AACzC,MAAA,UAAA,CAAW,SAAA,GAAY,kBAAA;AACvB,MAAA;AAAA,IACJ,KAAK,cAAA;AACD,MAAA,UAAA,CAAW,KAAA,GAAQ,GAAG,UAAU,CAAA,EAAA,CAAA;AAChC,MAAA,UAAA,CAAW,GAAA,GAAM,gBAAgB,QAAQ,CAAA,QAAA,CAAA;AACzC,MAAA,UAAA,CAAW,SAAA,GAAY,kBAAA;AACvB,MAAA;AAAA,IACJ,KAAK,QAAA;AACD,MAAA,UAAA,CAAW,GAAA,GAAM,gBAAgB,QAAQ,CAAA,QAAA,CAAA;AACzC,MAAA,UAAA,CAAW,IAAA,GAAO,gBAAgB,UAAU,CAAA,QAAA,CAAA;AAC5C,MAAA,UAAA,CAAW,SAAA,GAAY,uBAAA;AACvB,MAAA;AAAA;AAGR,EAAA,UAAA,CAAW,IAAA,GAAO,CAAA,cAAA,EAAiB,CAAA,GAAI,UAAU,CAAA,GAAA,CAAA;AACjD,EAAA,UAAA,CAAW,IAAA,GAAO,CAAA,cAAA,EAAiB,cAAc,CAAA,KAAA,EAAQ,IAAI,QAAQ,CAAA,GAAA,CAAA;AACrE,EAAA,OAAO,UAAA;AACX;AAMA,MAAM,WAAA,GAAc,EAAA;AAKpB,MAAM,UAAA,GAAa,EAAA;AACnB,MAAM,WAAW,WAAA,GAAc,UAAA;;;;"}
@@ -39,6 +39,9 @@ export declare function useMapModel(): UseMapModelResult;
39
39
  *
40
40
  * The map model cannot be returned directly because it may not have completed its initialization yet.
41
41
  *
42
+ * An error message will be logged if the map model's creation has failed.
43
+ * Use the option `quiet: true` to suppress this message.
44
+ *
42
45
  * @group UI Components and Hooks
43
46
  */
44
47
  export declare function useMapModel(mapId: string): UseMapModelResult;
@@ -50,10 +53,14 @@ export declare function useMapModel(mapId: string): UseMapModelResult;
50
53
  *
51
54
  * The map model cannot be returned directly because it may not have completed its initialization yet.
52
55
  *
56
+ * An error message will be logged if the map model's creation has failed.
57
+ * Use the option `quiet: true` to suppress this message.
58
+ *
53
59
  * @group UI Components and Hooks
54
60
  */
55
61
  export declare function useMapModel(props: {
56
62
  mapId: string;
63
+ quiet?: boolean;
57
64
  }): UseMapModelResult;
58
65
  /**
59
66
  * Options that specify which map to use. See {@link useMapModelValue}.
@@ -1,9 +1,12 @@
1
+ import { createLogger } from '@open-pioneer/core';
1
2
  import { useService } from '../../_virtual/hooks.js';
2
- import { useMemo } from 'react';
3
+ import { sourceId$4 as sourceId } from '../../_virtual/source-info.js';
4
+ import { useMemo, useEffect } from 'react';
3
5
  import { useAsync } from 'react-use';
4
6
  import { MapModel } from '../../model/MapModel.js';
5
7
  import { useDefaultMap } from '../DefaultMapProvider.js';
6
8
 
9
+ const LOG = createLogger(sourceId);
7
10
  function useMapModel(props) {
8
11
  if (props instanceof MapModel) {
9
12
  throw new Error(
@@ -38,6 +41,12 @@ function useMapModel(props) {
38
41
  }
39
42
  return { kind: "resolved", map: state.value };
40
43
  }, [state]);
44
+ const quiet = (typeof props === "object" ? props.quiet : void 0) ?? false;
45
+ useEffect(() => {
46
+ if (!quiet && result.error) {
47
+ LOG.error("Failed to construct map", result.error);
48
+ }
49
+ }, [quiet, result.error]);
41
50
  return result;
42
51
  }
43
52
  function useMapModelValue(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"useMapModel.js","sources":["useMapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { useService } from \"open-pioneer:react-hooks\";\nimport { useMemo } from \"react\";\nimport { useAsync } from \"react-use\";\nimport { MapRegistry } from \"../../MapRegistry\";\nimport { MapModel } from \"../../model/MapModel\";\nimport { useDefaultMap } from \"../DefaultMapProvider\";\n\n/**\n * Return value of {@link useMapModel}.\n *\n * @group UI Components and Hooks\n **/\nexport type UseMapModelResult = UseMapModelLoading | UseMapModelResolved | UseMapModelRejected;\n\n/** @group UI Components and Hooks */\nexport interface UseMapModelLoading {\n kind: \"loading\";\n map?: undefined;\n error?: undefined;\n}\n\n/** @group UI Components and Hooks */\nexport interface UseMapModelResolved {\n kind: \"resolved\";\n map: MapModel;\n error?: undefined;\n}\n\n/** @group UI Components and Hooks */\nexport interface UseMapModelRejected {\n kind: \"rejected\";\n map?: undefined;\n error: Error;\n}\n\n/**\n * React hook that returns the default map model (if available, see {@link DefaultMapProvider}).\n *\n * @deprecated Use {@link useMapModelValue} instead.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModel(): UseMapModelResult;\n\n/**\n * React hook that looks up the map with the given id in the `map.MapRegistry` service.\n *\n * Returns an object representing the progress, which will eventually represent either\n * the map model value or an initialization error.\n *\n * The map model cannot be returned directly because it may not have completed its initialization yet.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModel(mapId: string): UseMapModelResult;\n\n/**\n * React hook that resolves a map model specified by the given `props`.\n *\n * Returns an object representing the progress, which will eventually represent either\n * the map model value or an initialization error.\n *\n * The map model cannot be returned directly because it may not have completed its initialization yet.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModel(props: { mapId: string }): UseMapModelResult;\n\nexport function useMapModel(props?: undefined | string | { mapId: string }): UseMapModelResult {\n if (props instanceof MapModel) {\n // This cannot happen in valid typescript code, but it might be a common mistake.\n throw new Error(\n `Map model instances cannot be passed directly to 'useMapModel' (see TypeScript signature).`\n );\n }\n\n const defaultMap = useDefaultMap();\n const mapRegistry = useService<MapRegistry>(\"map.MapRegistry\");\n\n let mapId: string | undefined;\n if (typeof props === \"string\") {\n mapId = props;\n } else if (typeof props === \"object\") {\n mapId = props.mapId;\n }\n\n if (mapId == null && !defaultMap) {\n throw new Error(\n \"No map specified. Either configure a mapId or use the DefaultMapProvider.\"\n );\n }\n\n const state = useAsync(async () => {\n if (mapId == null) {\n // For backwards compatibility\n return defaultMap;\n }\n\n return await mapRegistry.expectMapModel(mapId);\n }, [mapRegistry, mapId]);\n\n const result = useMemo((): UseMapModelResult => {\n if (state.loading) {\n return { kind: \"loading\" };\n }\n if (state.error) {\n return { kind: \"rejected\", error: state.error };\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return { kind: \"resolved\", map: state.value! };\n }, [state]);\n return result;\n}\n\n/**\n * Options that specify which map to use. See {@link useMapModelValue}.\n *\n * When not setting any of these properties on a component, the default map (from the `DefaultMapProvider`) will be used.\n * If that is not available either, an error will be thrown.\n *\n * @see {@link DefaultMapProvider}\n *\n * @group UI Components and Hooks\n */\nexport interface MapModelProps {\n /**\n * The map model to use.\n */\n map?: MapModel | undefined;\n}\n\n/**\n * Returns the configured map model.\n *\n * The map model is either directly configured or specified via a {@link DefaultMapProvider}.\n * If neither has been specified, an error will be thrown.\n *\n * This hook is preferable to {@link useMapModel} because it can return the map model directly, without waiting.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModelValue(props?: MapModelProps): MapModel {\n if (props instanceof MapModel) {\n // This cannot happen in valid typescript code, but it might be a common mistake.\n throw new Error(\n `Map model instances cannot be passed directly to 'useMapModelValue' (see TypeScript signature).`\n );\n }\n\n const localMap = props?.map;\n const defaultMap = useDefaultMap();\n const map = localMap ?? defaultMap;\n if (!map) {\n throw new Error(\n `No map specified. ` +\n `You must either specify the map via a DefaultMapProvider parent or configure it explicitly.`\n );\n }\n return map;\n}\n"],"names":[],"mappings":";;;;;;AAsEO,SAAS,YAAY,KAAA,EAAmE;AAC3F,EAAA,IAAI,iBAAiB,QAAA,EAAU;AAE3B,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,0FAAA;AAAA,KACJ;AAAA,EACJ;AAEA,EAAA,MAAM,aAAa,aAAA,EAAc;AACjC,EAAA,MAAM,WAAA,GAAc,WAAwB,iBAAiB,CAAA;AAE7D,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC3B,IAAA,KAAA,GAAQ,KAAA;AAAA,EACZ,CAAA,MAAA,I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AAAA,KAEJ;AAAA,EACJ;AACA,EAAA,OAAO,GAAA;AACX;;;;"}
1
+ {"version":3,"file":"useMapModel.js","sources":["useMapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createLogger } from \"@open-pioneer/core\";\nimport { useService } from \"open-pioneer:react-hooks\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { useEffect, useMemo } from \"react\";\nimport { useAsync } from \"react-use\";\nimport { MapRegistry } from \"../../MapRegistry\";\nimport { MapModel } from \"../../model/MapModel\";\nimport { useDefaultMap } from \"../DefaultMapProvider\";\n\nconst LOG = createLogger(sourceId);\n\n/**\n * Return value of {@link useMapModel}.\n *\n * @group UI Components and Hooks\n **/\nexport type UseMapModelResult = UseMapModelLoading | UseMapModelResolved | UseMapModelRejected;\n\n/** @group UI Components and Hooks */\nexport interface UseMapModelLoading {\n kind: \"loading\";\n map?: undefined;\n error?: undefined;\n}\n\n/** @group UI Components and Hooks */\nexport interface UseMapModelResolved {\n kind: \"resolved\";\n map: MapModel;\n error?: undefined;\n}\n\n/** @group UI Components and Hooks */\nexport interface UseMapModelRejected {\n kind: \"rejected\";\n map?: undefined;\n error: Error;\n}\n\n/**\n * React hook that returns the default map model (if available, see {@link DefaultMapProvider}).\n *\n * @deprecated Use {@link useMapModelValue} instead.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModel(): UseMapModelResult;\n\n/**\n * React hook that looks up the map with the given id in the `map.MapRegistry` service.\n *\n * Returns an object representing the progress, which will eventually represent either\n * the map model value or an initialization error.\n *\n * The map model cannot be returned directly because it may not have completed its initialization yet.\n *\n * An error message will be logged if the map model's creation has failed.\n * Use the option `quiet: true` to suppress this message.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModel(mapId: string): UseMapModelResult;\n\n/**\n * React hook that resolves a map model specified by the given `props`.\n *\n * Returns an object representing the progress, which will eventually represent either\n * the map model value or an initialization error.\n *\n * The map model cannot be returned directly because it may not have completed its initialization yet.\n *\n * An error message will be logged if the map model's creation has failed.\n * Use the option `quiet: true` to suppress this message.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModel(props: { mapId: string; quiet?: boolean }): UseMapModelResult;\n\nexport function useMapModel(\n props?: undefined | string | { mapId: string; quiet?: boolean }\n): UseMapModelResult {\n if (props instanceof MapModel) {\n // This cannot happen in valid typescript code, but it might be a common mistake.\n throw new Error(\n `Map model instances cannot be passed directly to 'useMapModel' (see TypeScript signature).`\n );\n }\n\n const defaultMap = useDefaultMap();\n const mapRegistry = useService<MapRegistry>(\"map.MapRegistry\");\n\n let mapId: string | undefined;\n if (typeof props === \"string\") {\n mapId = props;\n } else if (typeof props === \"object\") {\n mapId = props.mapId;\n }\n\n if (mapId == null && !defaultMap) {\n throw new Error(\n \"No map specified. Either configure a mapId or use the DefaultMapProvider.\"\n );\n }\n\n const state = useAsync(async () => {\n if (mapId == null) {\n // For backwards compatibility\n return defaultMap;\n }\n\n return await mapRegistry.expectMapModel(mapId);\n }, [mapRegistry, mapId]);\n\n const result = useMemo((): UseMapModelResult => {\n if (state.loading) {\n return { kind: \"loading\" };\n }\n if (state.error) {\n return { kind: \"rejected\", error: state.error };\n }\n // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion\n return { kind: \"resolved\", map: state.value! };\n }, [state]);\n\n const quiet = (typeof props === \"object\" ? props.quiet : undefined) ?? false;\n useEffect(() => {\n if (!quiet && result.error) {\n LOG.error(\"Failed to construct map\", result.error);\n }\n }, [quiet, result.error]);\n return result;\n}\n\n/**\n * Options that specify which map to use. See {@link useMapModelValue}.\n *\n * When not setting any of these properties on a component, the default map (from the `DefaultMapProvider`) will be used.\n * If that is not available either, an error will be thrown.\n *\n * @see {@link DefaultMapProvider}\n *\n * @group UI Components and Hooks\n */\nexport interface MapModelProps {\n /**\n * The map model to use.\n */\n map?: MapModel | undefined;\n}\n\n/**\n * Returns the configured map model.\n *\n * The map model is either directly configured or specified via a {@link DefaultMapProvider}.\n * If neither has been specified, an error will be thrown.\n *\n * This hook is preferable to {@link useMapModel} because it can return the map model directly, without waiting.\n *\n * @group UI Components and Hooks\n */\nexport function useMapModelValue(props?: MapModelProps): MapModel {\n if (props instanceof MapModel) {\n // This cannot happen in valid typescript code, but it might be a common mistake.\n throw new Error(\n `Map model instances cannot be passed directly to 'useMapModelValue' (see TypeScript signature).`\n );\n }\n\n const localMap = props?.map;\n const defaultMap = useDefaultMap();\n const map = localMap ?? defaultMap;\n if (!map) {\n throw new Error(\n `No map specified. ` +\n `You must either specify the map via a DefaultMapProvider parent or configure it explicitly.`\n );\n }\n return map;\n}\n"],"names":[],"mappings":";;;;;;;;AAYA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAqE1B,SAAS,YACZ,KAAA,EACiB;AACjB,EAAA,IAAI,iBAAiB,QAAA,EAAU;AAE3B,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,0FAAA;AAAA,KACJ;AAAA,EACJ;AAEA,EAAA,MAAM,aAAa,aAAA,EAAc;AACjC,EAAA,MAAM,WAAA,GAAc,WAAwB,iBAAiB,CAAA;AAE7D,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC3B,IAAA,KAAA,GAAQ,KAAA;AAAA,EACZ,CAAA,MAAA,IAAW,OAAO,KAAA,KAAU,QAAA,EAAU;AAClC,IAAA,KAAA,GAAQ,KAAA,CAAM,KAAA;AAAA,EAClB;AAEA,EAAA,IAAI,KAAA,IAAS,IAAA,IAAQ,CAAC,UAAA,EAAY;AAC9B,IAAA,MAAM,IAAI,KAAA;AAAA,MACN;AAAA,KACJ;AAAA,EACJ;AAEA,EAAA,MAAM,KAAA,GAAQ,SAAS,YAAY;AAC/B,IAAA,IAAI,SAAS,IAAA,EAAM;AAEf,MAAA,OAAO,UAAA;AAAA,IACX;AAEA,IAAA,OAAO,MAAM,WAAA,CAAY,cAAA,CAAe,KAAK,C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;AACX;;;;"}
package/ui/styles.css CHANGED
@@ -1,7 +1,6 @@
1
1
  @import "ol/ol.css";
2
2
 
3
3
  /* Move attribution according to map view's padding */
4
-
5
4
  .map-container-root .map-container .ol-viewport .ol-attribution {
6
5
  bottom: var(--map-padding-bottom);
7
6
  right: var(--map-padding-right);
@@ -35,7 +34,6 @@
35
34
  }
36
35
 
37
36
  /* Set map focus style on map-anchor container to respect map padding inset 0*/
38
-
39
37
  .map-container-root:has(> .map-container:focus-visible) .map-anchors::after {
40
38
  content: "";
41
39
  position: absolute;
package/ui/styles.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["styles.css"],"names":[],"mappings":"AAAA,mBAAmB;;AAEnB,qDAAqD;;AACrD;IACI,iCAAiC;IACjC,+BAA+B;AACnC;;AAEA;IACI,oBAAoB;IACpB,gBAAgB;;IAEhB,kBAAkB;IAClB,2BAA2B;IAC3B,iCAAiC;IACjC,6BAA6B;IAC7B,+BAA+B;;IAE/B,6CAA6C;IAC7C,0BAA0B;IAC1B,uCAAuC;AAC3C;;AAEA;IACI,UAAU;IACV,gBAAgB;;IAEhB,kBAAkB;IAClB,yFAAyF;AAC7F;;AAEA;IACI,oBAAoB;AACxB;;AAEA,8EAA8E;;AAC9E;IACI,WAAW;IACX,kBAAkB;IAClB,QAAQ;IACR,aAAa;IACb,oDAAoD;IACpD,oBAAoB;AACxB;;AAEA;IACI,aAAa;AACjB","file":"styles.css","sourcesContent":["@import \"ol/ol.css\";\n\n/* Move attribution according to map view's padding */\n.map-container-root .map-container .ol-viewport .ol-attribution {\n bottom: var(--map-padding-bottom);\n right: var(--map-padding-right);\n}\n\n.map-container-root .map-anchors {\n pointer-events: none;\n overflow: hidden;\n\n position: absolute;\n top: var(--map-padding-top);\n bottom: var(--map-padding-bottom);\n left: var(--map-padding-left);\n right: var(--map-padding-right);\n\n transition-property: left, right, top, bottom;\n transition-duration: 200ms;\n transition-timing-function: ease-in-out;\n}\n\n.map-container-root .map-anchors .map-anchor {\n z-index: 1;\n overflow: hidden;\n\n position: absolute;\n /* positioned absolute in .map-anchors, but actual coordinates are currently set via JS */\n}\n\n.map-container-root .map-anchors > * {\n pointer-events: auto;\n}\n\n/* Set map focus style on map-anchor container to respect map padding inset 0*/\n.map-container-root:has(> .map-container:focus-visible) .map-anchors::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 9999;\n outline: var(--chakra-colors-trails-solid) solid 2px;\n outline-offset: -2px;\n}\n\n.map-container:focus-visible {\n outline: none;\n}\n"]}
1
+ {"version":3,"sources":["styles.css"],"names":[],"mappings":"AAAA,mBAAmB;;AAEnB,qDAAqD;AACrD;IACI,iCAAiC;IACjC,+BAA+B;AACnC;;AAEA;IACI,oBAAoB;IACpB,gBAAgB;;IAEhB,kBAAkB;IAClB,2BAA2B;IAC3B,iCAAiC;IACjC,6BAA6B;IAC7B,+BAA+B;;IAE/B,6CAA6C;IAC7C,0BAA0B;IAC1B,uCAAuC;AAC3C;;AAEA;IACI,UAAU;IACV,gBAAgB;;IAEhB,kBAAkB;IAClB,yFAAyF;AAC7F;;AAEA;IACI,oBAAoB;AACxB;;AAEA,8EAA8E;AAC9E;IACI,WAAW;IACX,kBAAkB;IAClB,QAAQ;IACR,aAAa;IACb,oDAAoD;IACpD,oBAAoB;AACxB;;AAEA;IACI,aAAa;AACjB","file":"styles.css","sourcesContent":["@import \"ol/ol.css\";\n\n/* Move attribution according to map view's padding */\n.map-container-root .map-container .ol-viewport .ol-attribution {\n bottom: var(--map-padding-bottom);\n right: var(--map-padding-right);\n}\n\n.map-container-root .map-anchors {\n pointer-events: none;\n overflow: hidden;\n\n position: absolute;\n top: var(--map-padding-top);\n bottom: var(--map-padding-bottom);\n left: var(--map-padding-left);\n right: var(--map-padding-right);\n\n transition-property: left, right, top, bottom;\n transition-duration: 200ms;\n transition-timing-function: ease-in-out;\n}\n\n.map-container-root .map-anchors .map-anchor {\n z-index: 1;\n overflow: hidden;\n\n position: absolute;\n /* positioned absolute in .map-anchors, but actual coordinates are currently set via JS */\n}\n\n.map-container-root .map-anchors > * {\n pointer-events: auto;\n}\n\n/* Set map focus style on map-anchor container to respect map padding inset 0*/\n.map-container-root:has(> .map-container:focus-visible) .map-anchors::after {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: 9999;\n outline: var(--chakra-colors-trails-solid) solid 2px;\n outline-offset: -2px;\n}\n\n.map-container:focus-visible {\n outline: none;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["fetch.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { HttpService } from \"@open-pioneer/http\";\n\nexport async function fetchText(\n url: string,\n httpService: HttpService,\n signal: AbortSignal\n): Promise<string> {\n const response = await httpService.fetch(url, { signal });\n if (!response.ok) {\n throw new Error(\"Request failed: \" + response.status);\n }\n const result = await response.text();\n return result;\n}\n"],"names":[],"mappings":"AAIA,eAAsB,SAAA,CAClB,GAAA,EACA,WAAA,EACA,MAAA,EACe;AACf,EAAA,MAAM,WAAW,MAAM,WAAA,CAAY,MAAM,GAAA,EAAK,EAAE,QAAQ,CAAA;AACxD,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,kBAAA,GAAqB,QAAA,CAAS,MAAM,CAAA;AAAA,EACxD;AACA,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,IAAA,EAAK;AACnC,EAAA,OAAO,MAAA;AACX;;;;"}
1
+ {"version":3,"file":"fetch.js","sources":["fetch.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { HttpService } from \"@open-pioneer/http\";\n\nexport async function fetchText(\n url: string,\n httpService: HttpService,\n signal: AbortSignal\n): Promise<string> {\n const response = await httpService.fetch(url, { signal });\n if (!response.ok) {\n throw new Error(\"Request failed: \" + response.status);\n }\n const result = await response.text();\n return result;\n}\n"],"names":[],"mappings":"AAKA,eAAsB,SAAA,CAClB,GAAA,EACA,WAAA,EACA,MAAA,EACe;AACf,EAAA,MAAM,WAAW,MAAM,WAAA,CAAY,MAAM,GAAA,EAAK,EAAE,QAAQ,CAAA;AACxD,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,kBAAA,GAAqB,QAAA,CAAS,MAAM,CAAA;AAAA,EACxD;AACA,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,IAAA,EAAK;AACnC,EAAA,OAAO,MAAA;AACX;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-utils.js","sources":["geometry-utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Extent, getHeight, getWidth } from \"ol/extent\";\n\nconst DEFAULT_BUFFER_FACTOR = 1.2;\n\n/**\n * Computes a buffered extent using the given original extent.\n *\n * Use the `factor` (`1.2` by default) to specify the size increase.\n *\n * @group Utilities\n */\nexport function calculateBufferedExtent(extent: Extent, factor = DEFAULT_BUFFER_FACTOR): Extent {\n checkExtent(extent);\n const width = getHeight(extent);\n const height = getWidth(extent);\n const bufferWidth = width * factor;\n const bufferHeight = height * factor;\n const bufferedExtent = [\n extent[0] - (bufferWidth - width) / 2,\n extent[1] - (bufferHeight - height) / 2,\n extent[2] + (bufferWidth - width) / 2,\n extent[3] + (bufferHeight - height) / 2\n ];\n return bufferedExtent;\n}\n\nfunction checkExtent(extent: Extent): asserts extent is [number, number, number, number] {\n if (extent.length !== 4) {\n throw new Error(`Invalid extent (expected length 4, but got length ${extent.length}).`);\n }\n}\n"],"names":[],"mappings":";;AAIA,MAAM,qBAAA,GAAwB,GAAA;AASvB,SAAS,uBAAA,CAAwB,MAAA,EAAgB,MAAA,GAAS,qBAAA,EAA+B;AAC5F,EAAA,WAAA,CAAY,MAAM,CAAA;AAClB,EAAA,MAAM,KAAA,GAAQ,UAAU,MAAM,CAAA;AAC9B,EAAA,MAAM,MAAA,GAAS,SAAS,MAAM,CAAA;AAC9B,EAAA,MAAM,cAAc,KAAA,GAAQ,MAAA;AAC5B,EAAA,MAAM,eAAe,MAAA,GAAS,MAAA;AAC9B,EAAA,MAAM,cAAA,GAAiB;AAAA,IACnB,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,WAAA,GAAc,KAAA,IAAS,CAAA;AAAA,IACpC,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,YAAA,GAAe,MAAA,IAAU,CAAA;AAAA,IACtC,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,WAAA,GAAc,KAAA,IAAS,CAAA;AAAA,IACpC,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,YAAA,GAAe,MAAA,IAAU;AAAA,GAC1C;AACA,EAAA,OAAO,cAAA;AACX;AAEA,SAAS,YAAY,MAAA,EAAoE;AACrF,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kDAAA,EAAqD,MAAA,CAAO,MAAM,CAAA,EAAA,CAAI,CAAA;AAAA,EAC1F;AACJ;;;;"}
1
+ {"version":3,"file":"geometry-utils.js","sources":["geometry-utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Extent, getHeight, getWidth } from \"ol/extent\";\n\nconst DEFAULT_BUFFER_FACTOR = 1.2;\n\n/**\n * Computes a buffered extent using the given original extent.\n *\n * Use the `factor` (`1.2` by default) to specify the size increase.\n *\n * @group Utilities\n */\nexport function calculateBufferedExtent(extent: Extent, factor = DEFAULT_BUFFER_FACTOR): Extent {\n checkExtent(extent);\n const width = getHeight(extent);\n const height = getWidth(extent);\n const bufferWidth = width * factor;\n const bufferHeight = height * factor;\n const bufferedExtent = [\n extent[0] - (bufferWidth - width) / 2,\n extent[1] - (bufferHeight - height) / 2,\n extent[2] + (bufferWidth - width) / 2,\n extent[3] + (bufferHeight - height) / 2\n ];\n return bufferedExtent;\n}\n\nfunction checkExtent(extent: Extent): asserts extent is [number, number, number, number] {\n if (extent.length !== 4) {\n throw new Error(`Invalid extent (expected length 4, but got length ${extent.length}).`);\n }\n}\n"],"names":[],"mappings":";;AAKA,MAAM,qBAAA,GAAwB,GAAA;AASvB,SAAS,uBAAA,CAAwB,MAAA,EAAgB,MAAA,GAAS,qBAAA,EAA+B;AAC5F,EAAA,WAAA,CAAY,MAAM,CAAA;AAClB,EAAA,MAAM,KAAA,GAAQ,UAAU,MAAM,CAAA;AAC9B,EAAA,MAAM,MAAA,GAAS,SAAS,MAAM,CAAA;AAC9B,EAAA,MAAM,cAAc,KAAA,GAAQ,MAAA;AAC5B,EAAA,MAAM,eAAe,MAAA,GAAS,MAAA;AAC9B,EAAA,MAAM,cAAA,GAAiB;AAAA,IACnB,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,WAAA,GAAc,KAAA,IAAS,CAAA;AAAA,IACpC,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,YAAA,GAAe,MAAA,IAAU,CAAA;AAAA,IACtC,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,WAAA,GAAc,KAAA,IAAS,CAAA;AAAA,IACpC,MAAA,CAAO,CAAC,CAAA,GAAA,CAAK,YAAA,GAAe,MAAA,IAAU;AAAA,GAC1C;AACA,EAAA,OAAO,cAAA;AACX;AAEA,SAAS,YAAY,MAAA,EAAoE;AACrF,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kDAAA,EAAqD,MAAA,CAAO,MAAM,CAAA,EAAA,CAAI,CAAA;AAAA,EAC1F;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ol-test-support.js","sources":["ol-test-support.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { equals as extentEquals } from \"ol/extent\";\nimport OlMap from \"ol/Map\";\n\nlet setupDone = false;\n\n/** @internal */\nexport function patchOpenLayersClassesForTesting() {\n if (setupDone) {\n return;\n }\n\n // Test support: OpenLayers relies on div.offsetHeight (and Width)\n // plus getComputedStyle(div), which do not work as expected in happy dom.\n // The following snippet fakes a size so tests can work with the map.\n OlMap.prototype.updateSize = function () {\n const target = this.getTargetElement();\n const height = 500;\n const width = 500;\n const size = target ? [width, height] : undefined;\n const oldSize = this.getSize();\n if (size && (!oldSize || !extentEquals(size, oldSize))) {\n this.setSize(size);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).updateViewportSize_();\n }\n };\n setupDone = true;\n}\n"],"names":["extentEquals"],"mappings":";;;AAKA,IAAI,SAAA,GAAY,KAAA;AAGT,SAAS,gCAAA,GAAmC;AAC/C,EAAA,IAAI,SAAA,EAAW;AACX,IAAA;AAAA,EACJ;AAKA,EAAA,KAAA,CAAM,SAAA,CAAU,aAAa,WAAY;AACrC,IAAA,MAAM,MAAA,GAAS,KAAK,gBAAA,EAAiB;AACrC,IAAA,MAAM,MAAA,GAAS,GAAA;AACf,IAAA,MAAM,KAAA,GAAQ,GAAA;AACd,IAAA,MAAM,IAAA,GAAO,MAAA,GAAS,CAAC,KAAA,EAAO,MAAM,CAAA,GAAI,MAAA;AACxC,IAAA,MAAM,OAAA,GAAU,KAAK,OAAA,EAAQ;AAC7B,IAAA,IAAI,SAAS,CAAC,OAAA,IAAW,CAACA,MAAA,CAAa,IAAA,EAAM,OAAO,CAAA,CAAA,EAAI;AACpD,MAAA,IAAA,CAAK,QAAQ,IAAI,CAAA;AAEjB,MAAC,KAAa,mBAAA,EAAoB;AAAA,IACtC;AAAA,EACJ,CAAA;AACA,EAAA,SAAA,GAAY,IAAA;AAChB;;;;"}
1
+ {"version":3,"file":"ol-test-support.js","sources":["ol-test-support.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { equals as extentEquals } from \"ol/extent\";\nimport OlMap from \"ol/Map\";\n\nlet setupDone = false;\n\n/** @internal */\nexport function patchOpenLayersClassesForTesting() {\n if (setupDone) {\n return;\n }\n\n // Test support: OpenLayers relies on div.offsetHeight (and Width)\n // plus getComputedStyle(div), which do not work as expected in happy dom.\n // The following snippet fakes a size so tests can work with the map.\n OlMap.prototype.updateSize = function () {\n const target = this.getTargetElement();\n const height = 500;\n const width = 500;\n const size = target ? [width, height] : undefined;\n const oldSize = this.getSize();\n if (size && (!oldSize || !extentEquals(size, oldSize))) {\n this.setSize(size);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).updateViewportSize_();\n }\n };\n setupDone = true;\n}\n"],"names":["extentEquals"],"mappings":";;;AAMA,IAAI,SAAA,GAAY,KAAA;AAGT,SAAS,gCAAA,GAAmC;AAC/C,EAAA,IAAI,SAAA,EAAW;AACX,IAAA;AAAA,EACJ;AAKA,EAAA,KAAA,CAAM,SAAA,CAAU,aAAa,WAAY;AACrC,IAAA,MAAM,MAAA,GAAS,KAAK,gBAAA,EAAiB;AACrC,IAAA,MAAM,MAAA,GAAS,GAAA;AACf,IAAA,MAAM,KAAA,GAAQ,GAAA;AACd,IAAA,MAAM,IAAA,GAAO,MAAA,GAAS,CAAC,KAAA,EAAO,MAAM,CAAA,GAAI,MAAA;AACxC,IAAA,MAAM,OAAA,GAAU,KAAK,OAAA,EAAQ;AAC7B,IAAA,IAAI,SAAS,CAAC,OAAA,IAAW,CAACA,MAAA,CAAa,IAAA,EAAM,OAAO,CAAA,CAAA,EAAI;AACpD,MAAA,IAAA,CAAK,QAAQ,IAAI,CAAA;AAEjB,MAAC,KAAa,mBAAA,EAAoB;AAAA,IACtC;AAAA,EACJ,CAAA;AACA,EAAA,SAAA,GAAY,IAAA;AAChB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"projections.js","sources":["projections.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { register } from \"ol/proj/proj4\";\nimport proj4 from \"proj4\";\n\n// Select return type of (name: string) => ProjectionDefinition overload since ProjectionDefinition is not exported\ntype Proj4ProjectionDefinition = typeof proj4.defs extends infer R\n ? R extends (name: string) => unknown\n ? ReturnType<R>\n : never\n : never;\n\n/** @group Utilities */\nexport type ProjectionDefinition = string | Proj4ProjectionDefinition;\n\n/**\n * Adds new registrations to the global [proj4js](https://github.com/proj4js/proj4js) definition set.\n *\n * See the proj4js documentation for more details.\n *\n * Example:\n *\n * ```ts\n * import { registerProjections } from \"@open-pioneer/map\";\n *\n * registerProjections({\n * \"EPSG:25832\": \"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs\",\n * // ... more projections\n * });\n * ```\n *\n * @param projections\n * An object containing (key, definition) pairs. The key must be projection name (such as `\"EPSG:4326\"`).\n * The value can be a string defining the projection or an existing proj4 definition object.\n *\n * @group Utilities\n */\nexport function registerProjections(projections: Record<string, ProjectionDefinition>): void {\n for (const [name, definition] of Object.entries(projections)) {\n proj4.defs(name, definition);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(proj4 as any);\n}\n\n/**\n * Searches the global [proj4js](https://github.com/proj4js/proj4js) definition set for a definition with the given name.\n *\n * @group Utilities\n */\nexport function getProjection(name: string): Proj4ProjectionDefinition {\n return proj4.defs(name);\n}\n"],"names":[],"mappings":";;;AAqCO,SAAS,oBAAoB,WAAA,EAAyD;AACzF,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,UAAU,KAAK,MAAA,CAAO,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC1D,IAAA,KAAA,CAAM,IAAA,CAAK,MAAM,UAAU,CAAA;AAAA,EAC/B;AAEA,EAAA,QAAA,CAAS,KAAY,CAAA;AACzB;AAOO,SAAS,cAAc,IAAA,EAAyC;AACnE,EAAA,OAAO,KAAA,CAAM,KAAK,IAAI,CAAA;AAC1B;;;;"}
1
+ {"version":3,"file":"projections.js","sources":["projections.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { register } from \"ol/proj/proj4\";\nimport proj4 from \"proj4\";\n\n// Select return type of (name: string) => ProjectionDefinition overload since ProjectionDefinition is not exported\ntype Proj4ProjectionDefinition = typeof proj4.defs extends infer R\n ? R extends (name: string) => unknown\n ? ReturnType<R>\n : never\n : never;\n\n/** @group Utilities */\nexport type ProjectionDefinition = string | Proj4ProjectionDefinition;\n\n/**\n * Adds new registrations to the global [proj4js](https://github.com/proj4js/proj4js) definition set.\n *\n * See the proj4js documentation for more details.\n *\n * Example:\n *\n * ```ts\n * import { registerProjections } from \"@open-pioneer/map\";\n *\n * registerProjections({\n * \"EPSG:25832\": \"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs\",\n * // ... more projections\n * });\n * ```\n *\n * @param projections\n * An object containing (key, definition) pairs. The key must be projection name (such as `\"EPSG:4326\"`).\n * The value can be a string defining the projection or an existing proj4 definition object.\n *\n * @group Utilities\n */\nexport function registerProjections(projections: Record<string, ProjectionDefinition>): void {\n for (const [name, definition] of Object.entries(projections)) {\n proj4.defs(name, definition);\n }\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n register(proj4 as any);\n}\n\n/**\n * Searches the global [proj4js](https://github.com/proj4js/proj4js) definition set for a definition with the given name.\n *\n * @group Utilities\n */\nexport function getProjection(name: string): Proj4ProjectionDefinition {\n return proj4.defs(name);\n}\n"],"names":[],"mappings":";;;AAsCO,SAAS,oBAAoB,WAAA,EAAyD;AACzF,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,UAAU,KAAK,MAAA,CAAO,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC1D,IAAA,KAAA,CAAM,IAAA,CAAK,MAAM,UAAU,CAAA;AAAA,EAC/B;AAEA,EAAA,QAAA,CAAS,KAAY,CAAA;AACzB;AAOO,SAAS,cAAc,IAAA,EAAyC;AACnE,EAAA,OAAO,KAAA,CAAM,KAAK,IAAI,CAAA;AAC1B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","sources":["sanitize.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Sanitizer } from \"@esri/arcgis-html-sanitizer\";\n\nconst sanitizer = new Sanitizer();\n\n/**\n * Sanitizes the given raw html string.\n *\n * The result is safe to use as raw HTML in properties like `innerHTML`.\n */\nexport function sanitizeHtml(rawHtml: string): string {\n return sanitizer.sanitize(rawHtml);\n}\n"],"names":[],"mappings":";;AAIA,MAAM,SAAA,GAAY,IAAI,SAAA,EAAU;AAOzB,SAAS,aAAa,OAAA,EAAyB;AAClD,EAAA,OAAO,SAAA,CAAU,SAAS,OAAO,CAAA;AACrC;;;;"}
1
+ {"version":3,"file":"sanitize.js","sources":["sanitize.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Sanitizer } from \"@esri/arcgis-html-sanitizer\";\n\nconst sanitizer = new Sanitizer();\n\n/**\n * Sanitizes the given raw html string.\n *\n * The result is safe to use as raw HTML in properties like `innerHTML`.\n */\nexport function sanitizeHtml(rawHtml: string): string {\n return sanitizer.sanitize(rawHtml);\n}\n"],"names":[],"mappings":";;AAKA,MAAM,SAAA,GAAY,IAAI,SAAA,EAAU;AAOzB,SAAS,aAAa,OAAA,EAAyB;AAClD,EAAA,OAAO,SAAA,CAAU,SAAS,OAAO,CAAA;AACrC;;;;"}