@wovvmap/ui-headless 0.0.0-stage → 1.2.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.
- package/README.md +24 -2
- package/dist/HeaderInfoController.d.ts +44 -0
- package/dist/HeaderInfoController.d.ts.map +1 -0
- package/dist/HeaderInfoController.js +112 -0
- package/dist/appearance.d.ts +26 -0
- package/dist/appearance.d.ts.map +1 -0
- package/dist/appearance.js +117 -0
- package/dist/classic/ClassicController.d.ts +124 -0
- package/dist/classic/ClassicController.d.ts.map +1 -0
- package/dist/classic/ClassicController.js +1131 -0
- package/dist/classic/classic.types.d.ts +111 -0
- package/dist/classic/classic.types.d.ts.map +1 -0
- package/dist/classic/classic.types.js +1 -0
- package/dist/classic/index.d.ts +3 -0
- package/dist/classic/index.d.ts.map +1 -0
- package/dist/classic/index.js +2 -0
- package/dist/components.d.ts +253 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +30 -0
- package/dist/directions/DirectionController.d.ts +76 -0
- package/dist/directions/DirectionController.d.ts.map +1 -0
- package/dist/directions/DirectionController.js +467 -0
- package/dist/directions/direction.types.d.ts +81 -0
- package/dist/directions/direction.types.d.ts.map +1 -0
- package/dist/directions/direction.types.js +1 -0
- package/dist/directions/directionPresentation.d.ts +17 -0
- package/dist/directions/directionPresentation.d.ts.map +1 -0
- package/dist/directions/directionPresentation.js +34 -0
- package/dist/flow/DiscoveryFlowController.d.ts +36 -0
- package/dist/flow/DiscoveryFlowController.d.ts.map +1 -0
- package/dist/flow/DiscoveryFlowController.js +162 -0
- package/dist/flow/FlowHistoryController.d.ts +14 -0
- package/dist/flow/FlowHistoryController.d.ts.map +1 -0
- package/dist/flow/FlowHistoryController.js +31 -0
- package/dist/flow/index.d.ts +3 -0
- package/dist/flow/index.d.ts.map +1 -0
- package/dist/flow/index.js +2 -0
- package/dist/gallery/PromotionGalleryController.d.ts +32 -0
- package/dist/gallery/PromotionGalleryController.d.ts.map +1 -0
- package/dist/gallery/PromotionGalleryController.js +80 -0
- package/dist/gallery/index.d.ts +2 -0
- package/dist/gallery/index.d.ts.map +1 -0
- package/dist/gallery/index.js +1 -0
- package/dist/headerInfo.d.ts +27 -0
- package/dist/headerInfo.d.ts.map +1 -0
- package/dist/headerInfo.js +70 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/presentation.d.ts +49 -0
- package/dist/presentation.d.ts.map +1 -0
- package/dist/presentation.js +116 -0
- package/dist/routes/RoutePreviewController.d.ts +61 -0
- package/dist/routes/RoutePreviewController.d.ts.map +1 -0
- package/dist/routes/RoutePreviewController.js +321 -0
- package/dist/routes/playback/RoutePlaybackController.d.ts +26 -0
- package/dist/routes/playback/RoutePlaybackController.d.ts.map +1 -0
- package/dist/routes/playback/RoutePlaybackController.js +115 -0
- package/dist/routes/routePlayback.types.d.ts +38 -0
- package/dist/routes/routePlayback.types.d.ts.map +1 -0
- package/dist/routes/routePlayback.types.js +1 -0
- package/dist/routes/routePreview.types.d.ts +71 -0
- package/dist/routes/routePreview.types.d.ts.map +1 -0
- package/dist/routes/routePreview.types.js +1 -0
- package/dist/routes/routePreviewPresentation.d.ts +8 -0
- package/dist/routes/routePreviewPresentation.d.ts.map +1 -0
- package/dist/routes/routePreviewPresentation.js +26 -0
- package/dist/routes/routeStepIcons.d.ts +15 -0
- package/dist/routes/routeStepIcons.d.ts.map +1 -0
- package/dist/routes/routeStepIcons.js +102 -0
- package/dist/routes/routeStepPresentation.d.ts +5 -0
- package/dist/routes/routeStepPresentation.d.ts.map +1 -0
- package/dist/routes/routeStepPresentation.js +15 -0
- package/dist/routes/routeSteps.types.d.ts +51 -0
- package/dist/routes/routeSteps.types.d.ts.map +1 -0
- package/dist/routes/routeSteps.types.js +1 -0
- package/dist/routes/steps/RouteStepsController.d.ts +49 -0
- package/dist/routes/steps/RouteStepsController.d.ts.map +1 -0
- package/dist/routes/steps/RouteStepsController.js +312 -0
- package/dist/saved-routes/SavedRoutesController.d.ts +76 -0
- package/dist/saved-routes/SavedRoutesController.d.ts.map +1 -0
- package/dist/saved-routes/SavedRoutesController.js +366 -0
- package/dist/storeHours.d.ts +19 -0
- package/dist/storeHours.d.ts.map +1 -0
- package/dist/storeHours.js +155 -0
- package/dist/storeList.d.ts +19 -0
- package/dist/storeList.d.ts.map +1 -0
- package/dist/storeList.js +21 -0
- package/dist/theme.d.ts +42 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +56 -0
- package/package.json +32 -3
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WovVMap portable UI contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Version: 1.1.1. Framework-neutral props, theme tokens and small presentation helpers for
|
|
4
|
+
`@wovvmap/ui-react` and `@wovvmap/ui-react-native`. Angular/Vue adapters can use the same contracts.
|
|
5
|
+
|
|
6
|
+
This package does not fetch, search, rank, select a floor, initialize a viewer or mirror map state.
|
|
7
|
+
Pass existing SDK public records and explicit callbacks. `CatalogStoreRow` keeps group identity;
|
|
8
|
+
formatting a group does not load its members. `getListWindow` only bounds rendering, not catalog paging.
|
|
9
|
+
|
|
10
|
+
Hinglish: Is package mein sirf common UI contracts aur chhote display helpers hain. Map/search ka
|
|
11
|
+
main logic SDK mein hi rahega. Har template ko naya search store nahi banana hai.
|
|
12
|
+
|
|
13
|
+
Themes are explicit per component. `resolveUITheme('dark')` or a token override never changes the map
|
|
14
|
+
theme. Labels/messages are injectable; the host owns language selection. No global mutable provider.
|
|
15
|
+
|
|
16
|
+
## Saved-route commands and UI (8.O.5.4)
|
|
17
|
+
|
|
18
|
+
The default-off `offlineRoutes` capability provides Save/List/Restore/Remove through the shared
|
|
19
|
+
rendering viewer. Save/Remove finish through `offlineRouteChanged`; Restore resolves a fresh preview.
|
|
20
|
+
See [the common React and Native guide](../../docs/SAVED_ROUTES.md) for configuration, all six
|
|
21
|
+
commands, reusable controller/panels, cancellation and parent-map requirements. Private routing and
|
|
22
|
+
signing remain backend-only. CDN CORS and physical-device acceptance remain explicit pending gates.
|
|
23
|
+
|
|
24
|
+
Hinglish: Dono platforms ka flow same hai; opt-in aur trusted public keys/policy chahiye. Saved
|
|
25
|
+
preview par Start/Play explicit rahe. UI/commands ka exact setup linked guide mein hai.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { UIBaseProps } from './components.js';
|
|
2
|
+
import type { HeaderWeatherData } from './headerInfo.js';
|
|
3
|
+
/** The host owns location permission and HTTP; this reader only supplies approved public weather.
|
|
4
|
+
* Hinglish: GPS/API host sambhalta hai; reader se sirf display wala weather data milta hai. */
|
|
5
|
+
export type HeaderWeatherReader = (signal: AbortSignal) => Promise<HeaderWeatherData>;
|
|
6
|
+
export interface HeaderInfoProps extends UIBaseProps {
|
|
7
|
+
locale?: string;
|
|
8
|
+
timeZone?: string;
|
|
9
|
+
weather?: HeaderWeatherData | null;
|
|
10
|
+
loadWeather?: HeaderWeatherReader;
|
|
11
|
+
}
|
|
12
|
+
export interface HeaderInfoSnapshot {
|
|
13
|
+
readonly now: Date;
|
|
14
|
+
readonly weather: HeaderWeatherData | null;
|
|
15
|
+
readonly weatherStatus: 'loading' | 'ready' | 'unavailable';
|
|
16
|
+
}
|
|
17
|
+
/** One UI resource owner shares the clock, refresh cadence and cancellation across platform views.
|
|
18
|
+
* Hinglish: Web/Native mein clock/weather lifetime ka same owner hai; doosra SDK/map store nahi. */
|
|
19
|
+
export declare class HeaderInfoController {
|
|
20
|
+
private readonly loadWeather?;
|
|
21
|
+
private snapshot;
|
|
22
|
+
private readonly listeners;
|
|
23
|
+
private running;
|
|
24
|
+
private connections;
|
|
25
|
+
private releaseVersion;
|
|
26
|
+
private clockTimer;
|
|
27
|
+
private weatherTimer;
|
|
28
|
+
private request;
|
|
29
|
+
constructor(loadWeather?: HeaderWeatherReader | undefined);
|
|
30
|
+
getSnapshot: () => HeaderInfoSnapshot;
|
|
31
|
+
subscribe: (listener: () => void) => (() => void);
|
|
32
|
+
/** An immediate StrictMode reconnect reuses active resources; the last actual release stops them.
|
|
33
|
+
* Hinglish: StrictMode replay par GPS/read dobara nahi; real unmount par timer aur pending read band. */
|
|
34
|
+
connect: () => (() => void);
|
|
35
|
+
retryWeather: () => void;
|
|
36
|
+
private start;
|
|
37
|
+
private stop;
|
|
38
|
+
/** Align the display to each real minute instead of a minute after the component mounted.
|
|
39
|
+
* Hinglish: Clock actual minute boundary par badle; mount ke seconds ki wajah se late na ho. */
|
|
40
|
+
private scheduleClock;
|
|
41
|
+
private readWeather;
|
|
42
|
+
private update;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=HeaderInfoController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderInfoController.d.ts","sourceRoot":"","sources":["../src/HeaderInfoController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAErD;+FAC+F;AAC/F,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAErF,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC1C,QAAQ,CAAC,aAAa,EAAE,SAAS,GAAG,OAAO,GAAG,aAAa,CAAA;CAC5D;AAED;oGACoG;AACpG,qBAAa,oBAAoB;IAUnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IATzC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,UAAU,CAA6C;IAC/D,OAAO,CAAC,YAAY,CAA8C;IAClE,OAAO,CAAC,OAAO,CAA+B;gBAEjB,WAAW,CAAC,EAAE,mBAAmB,YAAA;IAQvD,WAAW,QAAO,kBAAkB,CAAiB;IAErD,SAAS,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAGtD;IAED;6GACyG;IAClG,OAAO,QAAO,CAAC,MAAM,IAAI,CAAC,CAchC;IAEM,YAAY,QAAO,IAAI,CAE7B;IAED,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,IAAI;IAUZ;oGACgG;IAChG,OAAO,CAAC,aAAa;YAYP,WAAW;IAgBzB,OAAO,CAAC,MAAM;CAWf"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/** One UI resource owner shares the clock, refresh cadence and cancellation across platform views.
|
|
2
|
+
* Hinglish: Web/Native mein clock/weather lifetime ka same owner hai; doosra SDK/map store nahi. */
|
|
3
|
+
export class HeaderInfoController {
|
|
4
|
+
loadWeather;
|
|
5
|
+
snapshot;
|
|
6
|
+
listeners = new Set();
|
|
7
|
+
running = false;
|
|
8
|
+
connections = 0;
|
|
9
|
+
releaseVersion = 0;
|
|
10
|
+
clockTimer = null;
|
|
11
|
+
weatherTimer = null;
|
|
12
|
+
request = null;
|
|
13
|
+
constructor(loadWeather) {
|
|
14
|
+
this.loadWeather = loadWeather;
|
|
15
|
+
this.snapshot = {
|
|
16
|
+
now: new Date(),
|
|
17
|
+
weather: null,
|
|
18
|
+
weatherStatus: loadWeather ? 'loading' : 'unavailable',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
getSnapshot = () => this.snapshot;
|
|
22
|
+
subscribe = (listener) => {
|
|
23
|
+
this.listeners.add(listener);
|
|
24
|
+
return () => this.listeners.delete(listener);
|
|
25
|
+
};
|
|
26
|
+
/** An immediate StrictMode reconnect reuses active resources; the last actual release stops them.
|
|
27
|
+
* Hinglish: StrictMode replay par GPS/read dobara nahi; real unmount par timer aur pending read band. */
|
|
28
|
+
connect = () => {
|
|
29
|
+
this.connections++;
|
|
30
|
+
this.releaseVersion++;
|
|
31
|
+
if (!this.running)
|
|
32
|
+
this.start();
|
|
33
|
+
let connected = true;
|
|
34
|
+
return () => {
|
|
35
|
+
if (!connected)
|
|
36
|
+
return;
|
|
37
|
+
connected = false;
|
|
38
|
+
this.connections--;
|
|
39
|
+
const release = ++this.releaseVersion;
|
|
40
|
+
queueMicrotask(() => {
|
|
41
|
+
if (this.connections === 0 && release === this.releaseVersion)
|
|
42
|
+
this.stop();
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
retryWeather = () => {
|
|
47
|
+
void this.readWeather();
|
|
48
|
+
};
|
|
49
|
+
start() {
|
|
50
|
+
this.running = true;
|
|
51
|
+
this.update({ now: new Date() });
|
|
52
|
+
this.scheduleClock();
|
|
53
|
+
if (!this.loadWeather)
|
|
54
|
+
return;
|
|
55
|
+
this.weatherTimer = setInterval(() => {
|
|
56
|
+
void this.readWeather();
|
|
57
|
+
}, 10 * 60000);
|
|
58
|
+
void this.readWeather();
|
|
59
|
+
}
|
|
60
|
+
stop() {
|
|
61
|
+
this.running = false;
|
|
62
|
+
if (this.clockTimer !== null)
|
|
63
|
+
clearTimeout(this.clockTimer);
|
|
64
|
+
if (this.weatherTimer !== null)
|
|
65
|
+
clearInterval(this.weatherTimer);
|
|
66
|
+
this.clockTimer = null;
|
|
67
|
+
this.weatherTimer = null;
|
|
68
|
+
this.request?.abort();
|
|
69
|
+
this.request = null;
|
|
70
|
+
}
|
|
71
|
+
/** Align the display to each real minute instead of a minute after the component mounted.
|
|
72
|
+
* Hinglish: Clock actual minute boundary par badle; mount ke seconds ki wajah se late na ho. */
|
|
73
|
+
scheduleClock() {
|
|
74
|
+
this.clockTimer = setTimeout(() => {
|
|
75
|
+
this.clockTimer = null;
|
|
76
|
+
if (!this.running)
|
|
77
|
+
return;
|
|
78
|
+
this.update({ now: new Date() });
|
|
79
|
+
this.scheduleClock();
|
|
80
|
+
}, 60000 - (Date.now() % 60000));
|
|
81
|
+
}
|
|
82
|
+
async readWeather() {
|
|
83
|
+
if (!this.running || !this.loadWeather || this.request)
|
|
84
|
+
return;
|
|
85
|
+
const request = new AbortController();
|
|
86
|
+
this.request = request;
|
|
87
|
+
this.update({ weatherStatus: 'loading' });
|
|
88
|
+
try {
|
|
89
|
+
const weather = await this.loadWeather(request.signal);
|
|
90
|
+
if (this.running && this.request === request)
|
|
91
|
+
this.update({ weather, weatherStatus: 'ready' });
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
if (this.running && this.request === request)
|
|
95
|
+
this.update({ weather: null, weatherStatus: 'unavailable' });
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
if (this.request === request)
|
|
99
|
+
this.request = null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
update(patch) {
|
|
103
|
+
const next = { ...this.snapshot, ...patch };
|
|
104
|
+
if (next.now.getTime() === this.snapshot.now.getTime() &&
|
|
105
|
+
next.weather === this.snapshot.weather &&
|
|
106
|
+
next.weatherStatus === this.snapshot.weatherStatus)
|
|
107
|
+
return;
|
|
108
|
+
this.snapshot = next;
|
|
109
|
+
for (const listener of this.listeners)
|
|
110
|
+
listener();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MapTheme } from '@wovvmap/contracts';
|
|
2
|
+
import { type UITheme } from './theme.js';
|
|
3
|
+
import type { UIBaseProps } from './components.js';
|
|
4
|
+
/** One appearance resolves renderer and UI tokens together, without another theme store.
|
|
5
|
+
* Hinglish: Ek theme selection se map aur UI dono milte hain; alag writable theme store nahi. */
|
|
6
|
+
export interface ViewerAppearance {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly map: MapTheme;
|
|
10
|
+
readonly ui: Readonly<UITheme>;
|
|
11
|
+
}
|
|
12
|
+
/** Portable, keyed presets; no DOM globals or family-name guessing in either SDK.
|
|
13
|
+
* Hinglish: Web/Native same object use karte hain; lookup se theme milega, extra scan nahi. */
|
|
14
|
+
export declare const viewerAppearancePresets: Readonly<Record<string, ViewerAppearance>>;
|
|
15
|
+
export declare const viewerAppearanceOptions: readonly ViewerAppearance[];
|
|
16
|
+
/** Derive UI from the committed map theme; explicit UI overrides remain per instance.
|
|
17
|
+
* Hinglish: SDK ke committed theme se UI banti hai; themeChange se command dobara nahi bhejte. */
|
|
18
|
+
export declare function resolveViewerAppearance(theme: MapTheme | string, uiOverrides?: Partial<UITheme>): ViewerAppearance;
|
|
19
|
+
export interface ThemeSelectorProps extends UIBaseProps {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onOpenChange: (open: boolean) => void;
|
|
22
|
+
selectedId: string;
|
|
23
|
+
onSelect: (appearance: ViewerAppearance) => void;
|
|
24
|
+
options?: readonly ViewerAppearance[];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=appearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../src/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAA4C,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C;iGACiG;AACjG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAA;IACtB,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC/B;AA4GD;+FAC+F;AAC/F,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAO7E,CAAA;AACF,eAAO,MAAM,uBAAuB,EAAE,SAAS,gBAAgB,EAE9D,CAAA;AAED;kGACkG;AAClG,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,QAAQ,GAAG,MAAM,EACxB,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC7B,gBAAgB,CA0BlB;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAChD,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;CACtC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { NEXUS_DARK_THEME, NEXUS_LIGHT_THEME, resolveMapTheme, } from '@wovvmap/contracts';
|
|
2
|
+
import { darkUITheme, lightUITheme } from './theme.js';
|
|
3
|
+
function chrome(background, inactiveBackground, colors, direction = 'vertical') {
|
|
4
|
+
return Object.freeze({
|
|
5
|
+
background,
|
|
6
|
+
text: '#ffffff',
|
|
7
|
+
inactiveBackground,
|
|
8
|
+
...(colors ? { gradient: Object.freeze({ colors: Object.freeze(colors), direction }) } : {}),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
// Legacy Classic roles are explicit: UI primary is independent of the renderer's anchor color.
|
|
12
|
+
// Hinglish: UI ke magenta buttons aur map ke purple anchors alag roles hain, ek hi appearance mein.
|
|
13
|
+
const classicPalettes = {
|
|
14
|
+
'nexus-light': {
|
|
15
|
+
primary: '#9f1291',
|
|
16
|
+
onPrimary: '#ffffff',
|
|
17
|
+
text: '#0c1020',
|
|
18
|
+
hover: '#f2f2f2',
|
|
19
|
+
chrome: chrome('#570551', 'rgba(255,255,255,0.15)', ['#570551', '#5b2364']),
|
|
20
|
+
},
|
|
21
|
+
'nexus-dark': {
|
|
22
|
+
primary: '#2dd4bf',
|
|
23
|
+
onPrimary: '#022c22',
|
|
24
|
+
surface: '#0f172a',
|
|
25
|
+
text: '#f8fafc',
|
|
26
|
+
hover: 'rgba(255,255,255,0.1)',
|
|
27
|
+
chrome: chrome('#0f172a', 'rgba(255,255,255,0.05)', ['#0f172a', '#042f2e', '#000000'], 'diagonal'),
|
|
28
|
+
},
|
|
29
|
+
'teal-light': {
|
|
30
|
+
primary: '#279289',
|
|
31
|
+
onPrimary: '#ffffff',
|
|
32
|
+
text: '#0E0941',
|
|
33
|
+
hover: 'rgba(39,146,137,0.08)',
|
|
34
|
+
chrome: chrome('#0E0941', 'rgba(255,255,255,0.14)'),
|
|
35
|
+
},
|
|
36
|
+
'teal-dark': {
|
|
37
|
+
primary: '#279289',
|
|
38
|
+
onPrimary: '#ffffff',
|
|
39
|
+
surface: '#0E0941',
|
|
40
|
+
text: '#ffffff',
|
|
41
|
+
hover: 'rgba(255,255,255,0.08)',
|
|
42
|
+
chrome: chrome('#0E0941', 'rgba(255,255,255,0.08)', ['#0E0941', '#071f3d', '#06161b'], 'diagonal'),
|
|
43
|
+
},
|
|
44
|
+
'lavender-light': {
|
|
45
|
+
primary: '#7a4ebb',
|
|
46
|
+
onPrimary: '#ffffff',
|
|
47
|
+
text: '#0c1020',
|
|
48
|
+
hover: '#f2f2f2',
|
|
49
|
+
chrome: chrome('#8b5ec8', 'rgba(0,0,0,0.2)', ['#8b5ec8', '#68a5da']),
|
|
50
|
+
},
|
|
51
|
+
'lavender-dark': {
|
|
52
|
+
primary: '#CFA44E',
|
|
53
|
+
onPrimary: '#000000',
|
|
54
|
+
surface: '#020617',
|
|
55
|
+
text: '#f8fafc',
|
|
56
|
+
hover: 'rgba(255,255,255,0.1)',
|
|
57
|
+
chrome: chrome('#020617', 'rgba(255,255,255,0.05)', ['#020617', '#1e1b4b', '#000000'], 'diagonal'),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
function preset(family, label, mode, accent) {
|
|
61
|
+
const map = mode === 'dark' ? NEXUS_DARK_THEME : NEXUS_LIGHT_THEME;
|
|
62
|
+
const ui = mode === 'dark' ? darkUITheme : lightUITheme;
|
|
63
|
+
const palette = classicPalettes[`${family}-${mode}`];
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
id: `${family}-${mode}`,
|
|
66
|
+
label: `${label} ${mode === 'light' ? 'Light' : 'Dark'}`,
|
|
67
|
+
map: {
|
|
68
|
+
...map,
|
|
69
|
+
id: family,
|
|
70
|
+
spriteBackgroundColor: accent,
|
|
71
|
+
anchorStoreGradient: [accent, accent],
|
|
72
|
+
},
|
|
73
|
+
ui: Object.freeze({
|
|
74
|
+
...ui,
|
|
75
|
+
...palette,
|
|
76
|
+
selected: palette.primary,
|
|
77
|
+
selectedText: palette.onPrimary,
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Portable, keyed presets; no DOM globals or family-name guessing in either SDK.
|
|
82
|
+
* Hinglish: Web/Native same object use karte hain; lookup se theme milega, extra scan nahi. */
|
|
83
|
+
export const viewerAppearancePresets = Object.freeze({
|
|
84
|
+
'nexus-light': preset('nexus', 'Nexus', 'light', '#62236b'),
|
|
85
|
+
'nexus-dark': preset('nexus', 'Nexus', 'dark', '#8b5ca3'),
|
|
86
|
+
'teal-light': preset('teal', 'Teal', 'light', '#0f766e'),
|
|
87
|
+
'teal-dark': preset('teal', 'Teal', 'dark', '#0f766e'),
|
|
88
|
+
'lavender-light': preset('lavender', 'Lavender', 'light', '#7c3aed'),
|
|
89
|
+
'lavender-dark': preset('lavender', 'Lavender', 'dark', '#7c3aed'),
|
|
90
|
+
});
|
|
91
|
+
export const viewerAppearanceOptions = Object.freeze(Object.values(viewerAppearancePresets));
|
|
92
|
+
/** Derive UI from the committed map theme; explicit UI overrides remain per instance.
|
|
93
|
+
* Hinglish: SDK ke committed theme se UI banti hai; themeChange se command dobara nahi bhejte. */
|
|
94
|
+
export function resolveViewerAppearance(theme, uiOverrides) {
|
|
95
|
+
const named = typeof theme === 'string' ? viewerAppearancePresets[theme] : undefined;
|
|
96
|
+
const baseline = typeof theme === 'object' && theme.mode === 'dark' ? NEXUS_DARK_THEME : NEXUS_LIGHT_THEME;
|
|
97
|
+
const sourceMap = resolveMapTheme(named?.map ??
|
|
98
|
+
(typeof theme === 'string'
|
|
99
|
+
? theme
|
|
100
|
+
: {
|
|
101
|
+
...baseline,
|
|
102
|
+
...theme,
|
|
103
|
+
lights: { ...baseline.lights, ...theme.lights },
|
|
104
|
+
textColors: { ...baseline.textColors, ...theme.textColors },
|
|
105
|
+
}));
|
|
106
|
+
// This small JSON-safe config is copied only on appearance changes, never for map nodes or frames.
|
|
107
|
+
// Hinglish: Chhota theme config alag milega; ek viewer ka edit doosre ka theme nahi badlega.
|
|
108
|
+
const map = JSON.parse(JSON.stringify(sourceMap));
|
|
109
|
+
const matched = named ?? viewerAppearancePresets[`${map.id}-${map.mode}`];
|
|
110
|
+
const base = matched?.ui ?? (map.mode === 'dark' ? darkUITheme : lightUITheme);
|
|
111
|
+
return {
|
|
112
|
+
id: `${map.id}-${map.mode}`,
|
|
113
|
+
label: matched?.label ?? map.id,
|
|
114
|
+
map,
|
|
115
|
+
ui: uiOverrides ? { ...base, ...uiOverrides } : base,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { DiscoveryState, CatalogSortMode, CatalogStoreRow, MapLoadedData, MapTheme, NodeClickEvent, NodeGroupSelectionData, PublicAmenityData, PublicNodeData, PublicNodeGroupData } from '@wovvmap/contracts';
|
|
2
|
+
import { DirectionController } from '../directions/DirectionController.js';
|
|
3
|
+
import type { ClassicActions, ClassicCategoryRef, ClassicRootTab, ClassicSnapshot, ClassicSubCategoryRef, ClassicViewerBindings } from './classic.types.js';
|
|
4
|
+
/** Per-instance Classic presentation coordinator, using existing indexed SDK channels.
|
|
5
|
+
* Hinglish: Panel aur clicks ka ek owner; search/index/filter implementation SDK mein hi hai. */
|
|
6
|
+
export declare class ClassicController implements ClassicActions {
|
|
7
|
+
private readonly viewer;
|
|
8
|
+
readonly directions: DirectionController | null;
|
|
9
|
+
private readonly flow;
|
|
10
|
+
private listScrollOffset;
|
|
11
|
+
private readonly stores;
|
|
12
|
+
private readonly categories;
|
|
13
|
+
private readonly subcategories;
|
|
14
|
+
private readonly amenities;
|
|
15
|
+
private readonly listeners;
|
|
16
|
+
private intent;
|
|
17
|
+
private map;
|
|
18
|
+
private snapshot;
|
|
19
|
+
private previousScreen;
|
|
20
|
+
private listReturnScreen;
|
|
21
|
+
private requestId;
|
|
22
|
+
private offerRequestId;
|
|
23
|
+
private catalogEpoch;
|
|
24
|
+
private pendingCatalogRefresh;
|
|
25
|
+
private memberRequestId;
|
|
26
|
+
private selectionRequestId;
|
|
27
|
+
private pendingSelection;
|
|
28
|
+
private readonly pendingClears;
|
|
29
|
+
private filterRequestId;
|
|
30
|
+
private pendingFilterRequest;
|
|
31
|
+
private themeRequestId;
|
|
32
|
+
private controlRequestId;
|
|
33
|
+
private connectionId;
|
|
34
|
+
constructor(viewer: ClassicViewerBindings);
|
|
35
|
+
getSnapshot: () => ClassicSnapshot;
|
|
36
|
+
subscribe: (listener: () => void) => (() => void);
|
|
37
|
+
/** Mount subscriptions only; an immediate StrictMode reconnect keeps the committed query.
|
|
38
|
+
* Hinglish: Hooks sirf lifetime bind karte hain; StrictMode replay map/query ko reset nahi karta. */
|
|
39
|
+
connect: () => (() => void);
|
|
40
|
+
/** A committed map identity initializes footer reads once. Temporary readiness loss does not replay.
|
|
41
|
+
* Hinglish: Naye committed map par hi reads init hoti hain; context restore par repeat nahi. */
|
|
42
|
+
syncMap: (map: MapLoadedData | null, ready: boolean) => void;
|
|
43
|
+
openNodeDirections: (node: PublicNodeData) => void;
|
|
44
|
+
openGroupDirections: (group: PublicNodeGroupData) => void;
|
|
45
|
+
openSearch: () => void;
|
|
46
|
+
closeSearch: () => void;
|
|
47
|
+
changeQuery: (query: string) => void;
|
|
48
|
+
changeSort: (sort: CatalogSortMode) => void;
|
|
49
|
+
selectRootTab: (tab: ClassicRootTab) => void;
|
|
50
|
+
selectCategory: (category: ClassicCategoryRef) => void;
|
|
51
|
+
selectSubcategory: (subcategory: ClassicSubCategoryRef) => void;
|
|
52
|
+
selectAmenity: (amenity: PublicAmenityData) => void;
|
|
53
|
+
toggleOffers: () => void;
|
|
54
|
+
selectRow: (row: CatalogStoreRow) => void;
|
|
55
|
+
/** Expansion is a separate click intent; it never selects a node or moves the camera.
|
|
56
|
+
* Hinglish: Chevron sirf inline locations kholta hai; main row aur member click alag hain. */
|
|
57
|
+
toggleGroup: (row: CatalogStoreRow, index: number) => void;
|
|
58
|
+
selectMember: (node: PublicNodeData) => void;
|
|
59
|
+
handleNodeClick: (event: NodeClickEvent) => void;
|
|
60
|
+
/** External deselection is also authoritative; a detail card must not wait forever for a cleared node.
|
|
61
|
+
* Hinglish: Host selectNode(null) kare to card close ho; selectedNode watcher/effect nahi chahiye. */
|
|
62
|
+
handleNodeSelected: (event: {
|
|
63
|
+
key: string | null;
|
|
64
|
+
source?: "map";
|
|
65
|
+
}) => void;
|
|
66
|
+
/** Group events acknowledge the shared selection owner; they never select a representative node.
|
|
67
|
+
* Hinglish: Group event sirf common selection ko confirm kare; representative ka fake node selection nahi. */
|
|
68
|
+
handleNodeGroupSelected: ({ selection, }: {
|
|
69
|
+
selection: NodeGroupSelectionData | null;
|
|
70
|
+
}) => void;
|
|
71
|
+
/** Event projection only: external commands update presentation/read channels, never echo a command.
|
|
72
|
+
* Hinglish: External filter event se UI/list sync ho; event se filter command wapas na bhejein. */
|
|
73
|
+
handleDiscoveryChanged: (state: DiscoveryState | null) => void;
|
|
74
|
+
private syncFilter;
|
|
75
|
+
closeDetails: () => void;
|
|
76
|
+
private returnFromDetails;
|
|
77
|
+
loadMore: () => void;
|
|
78
|
+
retry: () => void;
|
|
79
|
+
loadMoreFooter: (target?: "categories" | "subcategories" | "amenities") => void;
|
|
80
|
+
retryFooter: (target?: "categories" | "subcategories" | "amenities") => void;
|
|
81
|
+
loadMoreMembers: () => void;
|
|
82
|
+
retryMembers: () => void;
|
|
83
|
+
changeTheme: (theme: MapTheme | string) => void;
|
|
84
|
+
/** Existing SDK controls share the same readiness/error boundary as Classic actions.
|
|
85
|
+
* Hinglish: Zoom/floor jaise controls bhi ready hone par chalte hain; error ka ek owner hai. */
|
|
86
|
+
runCommand: (operation: () => unknown) => void;
|
|
87
|
+
/** Back is one explicit action shared by all templates; no panel/floor watcher drives restoration.
|
|
88
|
+
* Hinglish: Previous filter/list/detail same SDK command se aaye; template apni history na rakhe. */
|
|
89
|
+
back: () => void;
|
|
90
|
+
private restoreBack;
|
|
91
|
+
/** Scroll samples are presentation-only and do not notify subscribers per pixel.
|
|
92
|
+
* Hinglish: Scroll position save ho; har pixel par root re-render ya SDK call na ho. */
|
|
93
|
+
setListScrollOffset: (offset: number) => void;
|
|
94
|
+
private captureFlowContext;
|
|
95
|
+
private beginFlow;
|
|
96
|
+
private acceptFlow;
|
|
97
|
+
private rejectFlow;
|
|
98
|
+
private restoreFlowContext;
|
|
99
|
+
private filter;
|
|
100
|
+
private queryStores;
|
|
101
|
+
private refreshCategories;
|
|
102
|
+
/** Offer availability is a catalog event, not a floor/selection dependency effect.
|
|
103
|
+
* Hinglish: Shared event count refresh kare; doosra timer ya business watcher nahi. */
|
|
104
|
+
handleCatalogChanged: () => void;
|
|
105
|
+
private refreshCatalogPresentation;
|
|
106
|
+
private refreshOffers;
|
|
107
|
+
private refreshSubcategories;
|
|
108
|
+
private footerChannel;
|
|
109
|
+
private listScreen;
|
|
110
|
+
private clearDetail;
|
|
111
|
+
/** The channel supplies the same pinned search/filter scope for selection and member pages.
|
|
112
|
+
* Hinglish: Group selection aur member pages ko wahi query/filter context mile; keys UI mein na nikalein. */
|
|
113
|
+
private selectGroup;
|
|
114
|
+
/** A current selection ACK supersedes older clears; reconcile any later clear before moving the camera.
|
|
115
|
+
* Hinglish: Latest selection ACK purane clears retire kare; SDK empty ho to card/camera dobara na chale. */
|
|
116
|
+
private acknowledgeSelection;
|
|
117
|
+
private dismissSelection;
|
|
118
|
+
private readMembers;
|
|
119
|
+
private perform;
|
|
120
|
+
private update;
|
|
121
|
+
private readSnapshot;
|
|
122
|
+
private publish;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=ClassicController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassicController.d.ts","sourceRoot":"","sources":["../../src/classic/ClassicController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,QAAQ,EACR,cAAc,EACd,sBAAsB,EAEtB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAEvE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EAEd,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AA2DxB;iGACiG;AACjG,qBAAa,iBAAkB,YAAW,cAAc;IA4B1C,OAAO,CAAC,QAAQ,CAAC,MAAM;IA3BnC,SAAgB,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACtD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6C;IAClE,OAAO,CAAC,gBAAgB,CAAI;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAA;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,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