@xgis/xgis-components 0.3.25 → 0.3.35

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 CHANGED
@@ -1,11 +1,9 @@
1
1
  # @xgis/xgis-components
2
2
 
3
- The stock UI for XGIS3D — layer panel, basemap picker, navigation, topic list, map switch, side
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 _available_. Whether it actually renders is decided by the topic
34
- config's `components` map, not by what you registered.
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 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.
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 only the descriptors. The views behind them (`LayerPanelView`,
57
- `NavigationButtons`, `BasemapView`, …) are deliberately not part of it — the Module Federation
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 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.
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 — no classes, no `init()`/`destroy()`
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
- 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.
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
- Full walkthrough: [developer guide](../../docs/developer-guide.md) section 5.
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 — see [LICENSE](./LICENSE).
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;
@@ -0,0 +1,2 @@
1
+ import type { IXgisComponent } from '@xgis/xgis-common';
2
+ export declare const SearchComponent: IXgisComponent;
@@ -0,0 +1,2 @@
1
+ import { IComponentUIProps } from '@xgis/xgis-common';
2
+ export default function SearchView({ layout }: IComponentUIProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { SearchComponent } from './SearchComponent';
@@ -1,8 +1,10 @@
1
- import type { TopicListItem } from '@xgis/xgis-common';
1
+ import type { TopicEntry } from './topicEntries';
2
2
  interface TopicRowProps {
3
- topic: TopicListItem;
4
- isActive: boolean;
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({ topic, isActive, onSelect }: TopicRowProps): import("react/jsx-runtime").JSX.Element;
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.