@xgis/xgis-components 0.3.25 → 0.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -31
- package/dist/components/Navigation/CompassButtons.d.ts +1 -1
- package/dist/components/Navigation/HistoryButtons.d.ts +1 -1
- package/dist/components/Navigation/LocationButtons.d.ts +1 -1
- package/dist/components/Navigation/ZoomButtons.d.ts +1 -1
- package/dist/components/Navigation/geolocationUtils.d.ts +1 -0
- package/dist/components/Search/SearchComponent.d.ts +2 -0
- package/dist/components/Search/SearchView.d.ts +2 -0
- package/dist/components/Search/index.d.ts +1 -0
- package/dist/components/TopicList/TopicRow.d.ts +6 -4
- package/dist/components/TopicList/externalApps.d.ts +9 -0
- package/dist/components/TopicList/topicEntries.d.ts +16 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +277 -130
- package/dist/index.js.map +1 -1
- package/dist/style.css +24 -17
- package/package.json +6 -6
- package/dist/components/TopicList/topicSearch.d.ts +0 -3
package/README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# @xgis/xgis-components
|
|
2
2
|
|
|
3
|
-
The stock UI for XGIS3D
|
|
3
|
+
The stock UI for XGIS3D: layer panel, basemap picker, navigation, topic list, map switch, side
|
|
4
4
|
panel and notifications. Every one is an `IXgisComponent` descriptor that declares which slot
|
|
5
5
|
it renders into; the framework owns the layout.
|
|
6
6
|
|
|
7
|
-
Part of the [XGIS3D monorepo](../../README.md).
|
|
8
|
-
|
|
9
7
|
## Install
|
|
10
8
|
|
|
11
9
|
```bash
|
|
@@ -30,8 +28,8 @@ xgis.registerComponent(LayerPanelComponent)
|
|
|
30
28
|
xgis.registerComponent(BasemapComponent)
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
Registration only makes a component
|
|
34
|
-
|
|
31
|
+
Registration only makes a component available. The topic config's `components` list decides whether
|
|
32
|
+
it renders, unless the descriptor sets `alwaysOn`, as `NotificationComponent` does.
|
|
35
33
|
|
|
36
34
|
> `@xgis/xgis-components/style.css` exists on the published package only. In-workspace and under
|
|
37
35
|
> Module Federation the bundler inlines the CSS modules directly, so there is no aggregate
|
|
@@ -49,21 +47,20 @@ config's `components` map, not by what you registered.
|
|
|
49
47
|
| `BasemapComponent` | `xgis.basemap` | slot `xgis.basemaps` |
|
|
50
48
|
| `NotificationComponent` | `xgis.notification` | slot `xgis.overlay` |
|
|
51
49
|
|
|
52
|
-
A component either claims a framework slot
|
|
53
|
-
declares
|
|
54
|
-
panel and topic list fill two of them.
|
|
50
|
+
A component either claims a framework slot or contributes to a slot another component
|
|
51
|
+
declares. `SidePanelComponent` owns the panel shell and publishes three sub-slots, and the layer
|
|
52
|
+
panel and topic list fill two of them.
|
|
55
53
|
|
|
56
|
-
The npm entry point exports
|
|
57
|
-
`NavigationButtons`, `BasemapView`, …) are
|
|
54
|
+
The npm entry point exports the descriptors and `SIDE_PANEL_SLOTS`. The views behind them (`LayerPanelView`,
|
|
55
|
+
`NavigationButtons`, `BasemapView`, …) are not part of it. The Module Federation
|
|
58
56
|
exposures still carry them, because each `./Component` exposure maps to that component's own
|
|
59
|
-
`index.ts`. They are internal
|
|
60
|
-
framework and
|
|
61
|
-
directly
|
|
57
|
+
`index.ts`. They are internal: a view takes `IComponentUIProps` from the
|
|
58
|
+
framework and reads settings keyed by the `componentId` registration assigns, so rendering one
|
|
59
|
+
directly renders nothing useful. Register the descriptor and let the framework place it.
|
|
62
60
|
|
|
63
61
|
## How a component is built
|
|
64
62
|
|
|
65
|
-
Descriptors are plain objects
|
|
66
|
-
([ADR-0002](../../docs/decisions/0002-declarative-components-over-class-based.md)).
|
|
63
|
+
Descriptors are plain objects with no classes and no `init()`/`destroy()`.
|
|
67
64
|
|
|
68
65
|
```typescript
|
|
69
66
|
export const MyComponent: IXgisComponent = {
|
|
@@ -74,28 +71,18 @@ export const MyComponent: IXgisComponent = {
|
|
|
74
71
|
```
|
|
75
72
|
|
|
76
73
|
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
|
-
|
|
79
|
-
|
|
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.
|
|
74
|
+
never calls an OpenLayers or Cesium API, never positions itself, and never creates a React root. The
|
|
75
|
+
framework does all three. Engine features are reached through `useCapability()`, which returns nothing when the active engine
|
|
76
|
+
does not implement one.
|
|
84
77
|
|
|
85
|
-
|
|
78
|
+
Translations are component-scoped; a component ships its own `et` and `en` messages when it has
|
|
79
|
+
text of its own.
|
|
86
80
|
|
|
87
81
|
## Peer dependencies
|
|
88
82
|
|
|
89
83
|
`@xgis/xgis-common` for stores, slots and contracts; `@tedi-design-system/react` for the underlying
|
|
90
84
|
design system (which needs `dayjs`); `react`. No runtime dependencies of its own.
|
|
91
85
|
|
|
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
86
|
## License
|
|
100
87
|
|
|
101
|
-
MIT
|
|
88
|
+
MIT. See the LICENSE file in this package.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IComponentUIProps } from '@xgis/xgis-common';
|
|
2
|
-
export declare function CompassButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CompassButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IComponentUIProps } from '@xgis/xgis-common';
|
|
2
|
-
export declare function HistoryButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function HistoryButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IComponentUIProps } from '@xgis/xgis-common';
|
|
2
|
-
export declare function LocationButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function LocationButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IComponentUIProps } from '@xgis/xgis-common';
|
|
2
|
-
export declare function ZoomButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function ZoomButtons(_props: IComponentUIProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Extent3301, LonLat, Radians } from '@xgis/xgis-common';
|
|
2
2
|
export declare function hasMovedEnough(previous: LonLat | null, next: LonLat): boolean;
|
|
3
3
|
export declare function headingToRadians(headingDegrees: number): Radians;
|
|
4
|
+
export declare function headingToMapRotation(headingDegrees: number): Radians;
|
|
4
5
|
export declare function geolocationErrorMessage(error: GeolocationPositionError): string;
|
|
5
6
|
export interface BoundedFix {
|
|
6
7
|
readonly position: LonLat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchComponent } from './SearchComponent';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TopicEntry } from './topicEntries';
|
|
2
2
|
interface TopicRowProps {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
entry: TopicEntry;
|
|
4
|
+
activeTopicId: string | null;
|
|
5
|
+
isOpen: boolean;
|
|
5
6
|
onSelect: (topicId: string) => void;
|
|
7
|
+
onToggle: (open: boolean) => void;
|
|
6
8
|
}
|
|
7
|
-
export declare function TopicRow({
|
|
9
|
+
export declare function TopicRow({ entry, activeTopicId, isOpen, onSelect, onToggle }: TopicRowProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Extent3301, ExternalLinkTarget } from '@xgis/xgis-common';
|
|
2
|
+
export interface LocalizedExternalApp {
|
|
3
|
+
link: string;
|
|
4
|
+
name: string;
|
|
5
|
+
target: ExternalLinkTarget;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveExternalAppLink(link: string, bbox: Extent3301): string;
|
|
8
|
+
export declare function useExternalApps(): LocalizedExternalApp[];
|
|
9
|
+
export declare function openExternalAppAtCurrentView(app: LocalizedExternalApp): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Locale, TopicListItem } from '@xgis/xgis-common';
|
|
2
|
+
import type { LocalizedExternalApp } from './externalApps';
|
|
3
|
+
export type TopicEntry = {
|
|
4
|
+
kind: 'topic';
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
topic: TopicListItem;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'externalApp';
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
app: LocalizedExternalApp;
|
|
13
|
+
};
|
|
14
|
+
export declare function mergeTopicEntries(topics: readonly TopicListItem[], apps: readonly LocalizedExternalApp[], locale: Locale): TopicEntry[];
|
|
15
|
+
export declare function filterTopicEntries(entries: readonly TopicEntry[], query: string): TopicEntry[];
|
|
16
|
+
export declare function useTopicEntries(query: string): TopicEntry[];
|
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { LayerPanelComponent } from './components/LayerPanel';
|
|
|
4
4
|
import { MapSwitchComponent } from './components/MapSwitch';
|
|
5
5
|
import { NavigationComponent } from './components/Navigation';
|
|
6
6
|
import { NotificationComponent } from './components/Notification';
|
|
7
|
+
import { SearchComponent } from './components/Search';
|
|
7
8
|
import { SIDE_PANEL_SLOTS, SidePanelComponent } from './components/SidePanel';
|
|
8
9
|
import { TopicListComponent } from './components/TopicList';
|
|
9
|
-
export { BasemapComponent, LayerPanelComponent, MapSwitchComponent, NavigationComponent, NotificationComponent, SIDE_PANEL_SLOTS, SidePanelComponent, TopicListComponent, };
|
|
10
|
+
export { BasemapComponent, LayerPanelComponent, MapSwitchComponent, NavigationComponent, NotificationComponent, SearchComponent, SIDE_PANEL_SLOTS, SidePanelComponent, TopicListComponent, };
|
|
10
11
|
/**
|
|
11
12
|
* Every component this package ships, so a consumer can register the full set in one call. Which of
|
|
12
13
|
* them actually render is decided by the topic config, not by registration.
|