@xgis/xgis-components 0.3.23

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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +101 -0
  3. package/dist/components/Basemap/BasemapComponent.d.ts +2 -0
  4. package/dist/components/Basemap/BasemapIcon.d.ts +6 -0
  5. package/dist/components/Basemap/BasemapView.d.ts +2 -0
  6. package/dist/components/Basemap/index.d.ts +2 -0
  7. package/dist/components/LayerPanel/LayerPanelComponent.d.ts +2 -0
  8. package/dist/components/LayerPanel/LayerPanelView.d.ts +2 -0
  9. package/dist/components/LayerPanel/index.d.ts +2 -0
  10. package/dist/components/MapSwitch/MapSwitchButtons.d.ts +3 -0
  11. package/dist/components/MapSwitch/MapSwitchComponent.d.ts +2 -0
  12. package/dist/components/MapSwitch/MapSwitchDesktop.d.ts +1 -0
  13. package/dist/components/MapSwitch/MapSwitchMobile.d.ts +1 -0
  14. package/dist/components/MapSwitch/index.d.ts +2 -0
  15. package/dist/components/Navigation/CompassButtons.d.ts +2 -0
  16. package/dist/components/Navigation/HistoryButtons.d.ts +2 -0
  17. package/dist/components/Navigation/LocationButtons.d.ts +2 -0
  18. package/dist/components/Navigation/NavigationButtons.d.ts +7 -0
  19. package/dist/components/Navigation/NavigationComponent.d.ts +2 -0
  20. package/dist/components/Navigation/ZoomButtons.d.ts +2 -0
  21. package/dist/components/Navigation/compassUtils.d.ts +11 -0
  22. package/dist/components/Navigation/geolocationUtils.d.ts +9 -0
  23. package/dist/components/Navigation/hooks/useGeolocation.d.ts +9 -0
  24. package/dist/components/Navigation/hooks/useLiveRotation.d.ts +1 -0
  25. package/dist/components/Navigation/hooks/useNavigationHistory.d.ts +8 -0
  26. package/dist/components/Navigation/index.d.ts +6 -0
  27. package/dist/components/Notification/NotificationComponent.d.ts +2 -0
  28. package/dist/components/Notification/NotificationToasts.d.ts +2 -0
  29. package/dist/components/Notification/index.d.ts +2 -0
  30. package/dist/components/SidePanel/MobileSidePanel.d.ts +1 -0
  31. package/dist/components/SidePanel/SidePanelComponent.d.ts +7 -0
  32. package/dist/components/SidePanel/SidePanelView.d.ts +2 -0
  33. package/dist/components/SidePanel/index.d.ts +3 -0
  34. package/dist/components/TopicList/TopicListComponent.d.ts +2 -0
  35. package/dist/components/TopicList/TopicListView.d.ts +2 -0
  36. package/dist/components/TopicList/TopicPicker.d.ts +1 -0
  37. package/dist/components/TopicList/TopicRow.d.ts +8 -0
  38. package/dist/components/TopicList/TopicSelect.d.ts +1 -0
  39. package/dist/components/TopicList/TopicTrigger.d.ts +1 -0
  40. package/dist/components/TopicList/index.d.ts +5 -0
  41. package/dist/components/TopicList/topicSearch.d.ts +3 -0
  42. package/dist/index.d.ts +14 -0
  43. package/dist/index.js +1199 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/style.css +113 -0
  46. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Republic of Estonia Land and Spatial Development Board
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # @xgis/xgis-components
2
+
3
+ The stock UI for XGIS3D — layer panel, basemap picker, navigation, topic list, map switch, side
4
+ panel and notifications. Every one is an `IXgisComponent` descriptor that declares which slot
5
+ it renders into; the framework owns the layout.
6
+
7
+ Part of the [XGIS3D monorepo](../../README.md).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @xgis/xgis-components
13
+ ```
14
+
15
+ ```typescript
16
+ import { XGIS_COMPONENTS } from '@xgis/xgis-components'
17
+ import '@xgis/xgis-components/style.css'
18
+
19
+ for (const component of XGIS_COMPONENTS) {
20
+ xgis.registerComponent(component)
21
+ }
22
+ ```
23
+
24
+ Register the whole set, or cherry-pick:
25
+
26
+ ```typescript
27
+ import { BasemapComponent, LayerPanelComponent } from '@xgis/xgis-components'
28
+
29
+ xgis.registerComponent(LayerPanelComponent)
30
+ xgis.registerComponent(BasemapComponent)
31
+ ```
32
+
33
+ Registration only makes a component _available_. Whether it actually renders is decided by the topic
34
+ config's `components` map, not by what you registered.
35
+
36
+ > `@xgis/xgis-components/style.css` exists on the published package only. In-workspace and under
37
+ > Module Federation the bundler inlines the CSS modules directly, so there is no aggregate
38
+ > stylesheet to import.
39
+
40
+ ## Components
41
+
42
+ | Export | Component id | Renders into |
43
+ | ----------------------- | ------------------- | ------------------------------------------------------------------------------- |
44
+ | `SidePanelComponent` | `xgis.sidePanel` | slot `xgis.sidePanel`; defines the `xgis.sidePanel.*` sub-slots the others fill |
45
+ | `LayerPanelComponent` | `xgis.layerPanel` | contribution to `xgis.sidePanel.layers` |
46
+ | `TopicListComponent` | `xgis.topicList` | contribution to `xgis.sidePanel.topiclist` |
47
+ | `MapSwitchComponent` | `xgis.mapSwitch` | slot `xgis.mapSwitch` |
48
+ | `NavigationComponent` | `xgis.navigation` | slots `xgis.navigationZoom`, `…History`, `…Location`, `…Compass` |
49
+ | `BasemapComponent` | `xgis.basemap` | slot `xgis.basemaps` |
50
+ | `NotificationComponent` | `xgis.notification` | slot `xgis.overlay` |
51
+
52
+ A component either claims a framework slot outright or _contributes_ into a slot another component
53
+ declares — `SidePanelComponent` owns the panel shell and publishes three sub-slots, and the layer
54
+ panel and topic list fill two of them. Neither knows about the other.
55
+
56
+ The npm entry point exports only the descriptors. The views behind them (`LayerPanelView`,
57
+ `NavigationButtons`, `BasemapView`, …) are deliberately not part of it — the Module Federation
58
+ exposures still carry them, because each `./Component` exposure maps to that component's own
59
+ `index.ts`. They are internal because: they take `IComponentUIProps` supplied by the
60
+ framework and read settings keyed by the `componentId` a registration assigns, so rendering one
61
+ directly gives you a component wired to nothing. Compose through slots and contributions instead.
62
+
63
+ ## How a component is built
64
+
65
+ Descriptors are plain objects — no classes, no `init()`/`destroy()`
66
+ ([ADR-0002](../../docs/decisions/0002-declarative-components-over-class-based.md)).
67
+
68
+ ```typescript
69
+ export const MyComponent: IXgisComponent = {
70
+ id: 'xgis.myComponent',
71
+ messages: { et: etMessages, en: enMessages },
72
+ ui: { [SLOTS.TOOLS]: { Component: MyPanel } },
73
+ }
74
+ ```
75
+
76
+ The view reads state through store selectors and writes navigation intent back to the store. It
77
+ never calls an OpenLayers or Cesium API, never positions itself, and never creates a React root —
78
+ the framework does all three. Engine features are reached through `useCapability()`, so a component
79
+ works against both engines or gracefully does not render.
80
+
81
+ Translations are component-scoped
82
+ ([ADR-0015](../../docs/decisions/0015-component-scoped-translations.md)); each component ships its
83
+ own `et` and `en` messages.
84
+
85
+ Full walkthrough: [developer guide](../../docs/developer-guide.md) section 5.
86
+
87
+ ## Peer dependencies
88
+
89
+ `@xgis/xgis-common` for stores, slots and contracts; `@tedi-design-system/react` for the underlying
90
+ design system (which needs `dayjs`); `react`. No runtime dependencies of its own.
91
+
92
+ ## Docs
93
+
94
+ - [Developer guide](../../docs/developer-guide.md) — components, slots, capabilities
95
+ - [Architecture overview](../../docs/architecture.md) — layout system is section 6
96
+ - [Conventions](../../docs/conventions.md)
97
+ - [ADRs](../../docs/decisions/)
98
+
99
+ ## License
100
+
101
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const BasemapComponent: IXgisComponent;
@@ -0,0 +1,6 @@
1
+ interface BasemapIconProps {
2
+ src: string | undefined;
3
+ alt: string;
4
+ }
5
+ export declare function BasemapIcon({ src, alt }: Readonly<BasemapIconProps>): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function BasemapView({ componentId }: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { BasemapComponent } from './BasemapComponent';
2
+ export { BasemapView } from './BasemapView';
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const LayerPanelComponent: IXgisComponent;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function LayerPanelView(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { LayerPanelComponent } from './LayerPanelComponent';
2
+ export { LayerPanelView } from './LayerPanelView';
@@ -0,0 +1,3 @@
1
+ import { type IComponentUIProps, type MapMode } from '@xgis/xgis-common';
2
+ export declare const MODES: MapMode[];
3
+ export declare function MapSwitchButtons({ layout }: IComponentUIProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const MapSwitchComponent: IXgisComponent;
@@ -0,0 +1 @@
1
+ export declare function MapSwitchDesktop(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function MapSwitchMobile(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { MapSwitchComponent } from './MapSwitchComponent';
2
+ export { MapSwitchButtons } from './MapSwitchButtons';
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function CompassButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function HistoryButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function LocationButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ /**
3
+ * @deprecated Navigation is now composed from the individual slot components
4
+ * (ZoomButtons, HistoryButtons, LocationButtons, CompassButtons), each registered
5
+ * to its own slot so the layout decides what renders. Kept for backward compatibility.
6
+ */
7
+ export declare function NavigationButtons(props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const NavigationComponent: IXgisComponent;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function ZoomButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { Radians } from '@xgis/xgis-common';
2
+ /**
3
+ * Convert a counter-clockwise map rotation (radians) into a whole-degree compass bearing
4
+ * normalised to [0, 360).
5
+ */
6
+ export declare function rotationToCompassDegrees(rotation: Radians): number;
7
+ /**
8
+ * CSS rotation (in degrees) for the compass needle icon. It tracks the bearing directly
9
+ * (store rotation is counter-clockwise) and carries the icon's 45° rest offset.
10
+ */
11
+ export declare function compassIconRotationDegrees(compassDegrees: number): number;
@@ -0,0 +1,9 @@
1
+ import type { Extent3301, LonLat, Radians } from '@xgis/xgis-common';
2
+ export declare function hasMovedEnough(previous: LonLat | null, next: LonLat): boolean;
3
+ export declare function headingToRotation(headingDegrees: number): Radians;
4
+ export declare function geolocationErrorMessage(error: GeolocationPositionError): string;
5
+ export interface BoundedFix {
6
+ readonly position: LonLat;
7
+ readonly outsideBounds: boolean;
8
+ }
9
+ export declare function constrainToBounds(position: LonLat, constraintBbox: Extent3301 | null): BoundedFix;
@@ -0,0 +1,9 @@
1
+ interface UseGeolocationResult {
2
+ isLocated: boolean;
3
+ isTracking: boolean;
4
+ locate: () => void;
5
+ toggleTracking: () => void;
6
+ deactivate: () => void;
7
+ }
8
+ export declare function useGeolocation(): UseGeolocationResult;
9
+ export {};
@@ -0,0 +1 @@
1
+ export declare function useLiveRotation(): number;
@@ -0,0 +1,8 @@
1
+ interface UseNavigationHistoryResult {
2
+ canGoBack: boolean;
3
+ canGoForward: boolean;
4
+ back: () => void;
5
+ forward: () => void;
6
+ }
7
+ export declare function useNavigationHistory(): UseNavigationHistoryResult;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ export { NavigationComponent } from './NavigationComponent';
2
+ export { NavigationButtons } from './NavigationButtons';
3
+ export { ZoomButtons } from './ZoomButtons';
4
+ export { HistoryButtons } from './HistoryButtons';
5
+ export { LocationButtons } from './LocationButtons';
6
+ export { CompassButtons } from './CompassButtons';
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const NotificationComponent: IXgisComponent;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function NotificationToasts(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { NotificationComponent } from './NotificationComponent';
2
+ export { NotificationToasts } from './NotificationToasts';
@@ -0,0 +1 @@
1
+ export declare function MobileSidePanel(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const SIDE_PANEL_SLOTS: {
3
+ readonly LAYERS: "xgis.sidePanel.layers";
4
+ readonly BOOKMARKS: "xgis.sidePanel.bookmarks";
5
+ readonly TOPICLIST: "xgis.sidePanel.topiclist";
6
+ };
7
+ export declare const SidePanelComponent: IXgisComponent;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function SidePanelView(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { MobileSidePanel } from './MobileSidePanel';
2
+ export { SidePanelComponent, SIDE_PANEL_SLOTS } from './SidePanelComponent';
3
+ export { SidePanelView } from './SidePanelView';
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const TopicListComponent: IXgisComponent;
@@ -0,0 +1,2 @@
1
+ import type { IComponentUIProps } from '@xgis/xgis-common';
2
+ export declare function TopicListView(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function TopicPicker(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { TopicListItem } from '@xgis/xgis-common';
2
+ interface TopicRowProps {
3
+ topic: TopicListItem;
4
+ isActive: boolean;
5
+ onSelect: (topicId: string) => void;
6
+ }
7
+ export declare function TopicRow({ topic, isActive, onSelect }: TopicRowProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1 @@
1
+ export declare function TopicSelect(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function TopicTrigger(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export { TopicListComponent } from './TopicListComponent';
2
+ export { TopicListView } from './TopicListView';
3
+ export { TopicPicker } from './TopicPicker';
4
+ export { TopicSelect } from './TopicSelect';
5
+ export { TopicTrigger } from './TopicTrigger';
@@ -0,0 +1,3 @@
1
+ import type { TopicListItem } from '@xgis/xgis-common';
2
+ export declare function filterTopics(topics: readonly TopicListItem[], query: string): TopicListItem[];
3
+ export declare function useFilteredTopics(query: string): TopicListItem[];
@@ -0,0 +1,14 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ import { BasemapComponent } from './components/Basemap';
3
+ import { LayerPanelComponent } from './components/LayerPanel';
4
+ import { MapSwitchComponent } from './components/MapSwitch';
5
+ import { NavigationComponent } from './components/Navigation';
6
+ import { NotificationComponent } from './components/Notification';
7
+ import { SIDE_PANEL_SLOTS, SidePanelComponent } from './components/SidePanel';
8
+ import { TopicListComponent } from './components/TopicList';
9
+ export { BasemapComponent, LayerPanelComponent, MapSwitchComponent, NavigationComponent, NotificationComponent, SIDE_PANEL_SLOTS, SidePanelComponent, TopicListComponent, };
10
+ /**
11
+ * Every component this package ships, so a consumer can register the full set in one call. Which of
12
+ * them actually render is decided by the topic config, not by registration.
13
+ */
14
+ export declare const XGIS_COMPONENTS: readonly IXgisComponent[];