@xh/hoist 74.0.0-SNAPSHOT.1747520457711 → 74.0.0-SNAPSHOT.1747677959059

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.
@@ -27,10 +27,6 @@ export interface NavigatorConfig {
27
27
  * See enum for description of supported modes.
28
28
  */
29
29
  refreshMode?: RefreshMode;
30
- /**
31
- * Base route name for this navigator, with the route for each page being "[route]/[page.id]".
32
- */
33
- route?: string;
34
30
  }
35
31
  /**
36
32
  * Model for handling stack-based navigation between pages.
@@ -38,8 +34,6 @@ export interface NavigatorConfig {
38
34
  */
39
35
  export declare class NavigatorModel extends HoistModel {
40
36
  disableAppRefreshButton: boolean;
41
- readonly route: string;
42
- readonly routePrefix: string;
43
37
  stack: PageModel[];
44
38
  pages: PageConfig[];
45
39
  track: boolean;
@@ -55,7 +49,7 @@ export declare class NavigatorModel extends HoistModel {
55
49
  get activePageIdx(): number;
56
50
  get allowSlideNext(): boolean;
57
51
  get allowSlidePrev(): boolean;
58
- constructor({ pages, route, track, pullDownToRefresh, transitionMs, renderMode, refreshMode }: NavigatorConfig);
52
+ constructor({ pages, track, pullDownToRefresh, transitionMs, renderMode, refreshMode }: NavigatorConfig);
59
53
  /**
60
54
  * @param callback - function to execute (once) after the next page transition.
61
55
  */
@@ -144,10 +144,10 @@ export class TabContainerModel extends HoistModel implements Persistable<{active
144
144
  this.refreshContextModel.xhImpl = xhImpl;
145
145
 
146
146
  if (route) {
147
- // if (XH.isMobileApp) {
148
- // this.logWarn('TabContainer routing is not supported for mobile applications.');
149
- // return;
150
- // }
147
+ if (XH.isMobileApp) {
148
+ this.logWarn('TabContainer routing is not supported for mobile applications.');
149
+ return;
150
+ }
151
151
 
152
152
  this.addReaction({
153
153
  track: () => XH.routerState,
@@ -279,6 +279,7 @@ export class ZoneMapperModel extends HoistModel {
279
279
  this.mappings = mappings;
280
280
  }
281
281
 
282
+ @action
282
283
  private removeZoneMapping(zone: Zone, field: string) {
283
284
  let mappings = cloneDeep(this.mappings);
284
285
  mappings[zone] = mappings[zone].filter(it => it.field !== field);
@@ -44,11 +44,6 @@ export interface NavigatorConfig {
44
44
  * See enum for description of supported modes.
45
45
  */
46
46
  refreshMode?: RefreshMode;
47
-
48
- /**
49
- * Base route name for this navigator, with the route for each page being "[route]/[page.id]".
50
- */
51
- route?: string;
52
47
  }
53
48
 
54
49
  /**
@@ -58,9 +53,6 @@ export interface NavigatorConfig {
58
53
  export class NavigatorModel extends HoistModel {
59
54
  @bindable disableAppRefreshButton: boolean;
60
55
 
61
- readonly route: string;
62
- readonly routePrefix: string;
63
-
64
56
  @bindable.ref
65
57
  stack: PageModel[] = [];
66
58
 
@@ -97,7 +89,6 @@ export class NavigatorModel extends HoistModel {
97
89
 
98
90
  constructor({
99
91
  pages,
100
- route,
101
92
  track = false,
102
93
  pullDownToRefresh = true,
103
94
  transitionMs = 500,
@@ -110,9 +101,6 @@ export class NavigatorModel extends HoistModel {
110
101
  ensureNotEmpty(pages, 'NavigatorModel needs at least one page.');
111
102
  ensureUniqueBy(pages, 'id', 'Multiple NavigatorModel PageModels have the same id.');
112
103
 
113
- this.route = route ?? '';
114
- this.routePrefix = route ? route.substring(0, route.lastIndexOf('.') + 1) : '';
115
-
116
104
  this.pages = pages;
117
105
  this.track = track;
118
106
  this.pullDownToRefresh = pullDownToRefresh;
@@ -221,7 +209,7 @@ export class NavigatorModel extends HoistModel {
221
209
  this.stack = this.stack.slice(0, this._swiper.activeIndex + 1);
222
210
 
223
211
  // 2) Sync route to match the current page stack
224
- const newRouteName = this.routePrefix + this.stack.map(it => it.id).join('.'),
212
+ const newRouteName = this.stack.map(it => it.id).join('.'),
225
213
  newRouteParams = mergeDeep({}, ...this.stack.map(it => it.props));
226
214
 
227
215
  XH.navigate(newRouteName, newRouteParams);
@@ -238,17 +226,16 @@ export class NavigatorModel extends HoistModel {
238
226
  };
239
227
 
240
228
  private onRouteChange(init: boolean = false) {
241
- const {route: myRoute, routePrefix: myRoutePrefix, _swiper} = this;
242
- if (!XH.routerState || (myRoute && !XH.router.isActive(myRoute)) || !_swiper) return;
229
+ if (!this._swiper || !XH.routerState) return;
243
230
 
244
- // Break the current route name into parts, only looking at our part of it (myRoute and below).
245
- // Collect any params for each part. Use meta.params to determine which params are associated
246
- // with each route part. Save these params to use as props for the page.
231
+ // Break the current route name into parts, and collect any params for each part.
232
+ // Use meta.params to determine which params are associated with each route part.
233
+ // Save these params to use as props for the page.
247
234
  const {meta, name, params} = XH.routerState,
248
- parts = name.replace(myRoutePrefix, '').split('.');
235
+ parts = name.split('.');
249
236
 
250
237
  const routeParts = parts.map((id, idx) => {
251
- const metaKey = myRoutePrefix + parts.slice(0, idx + 1).join('.'),
238
+ const metaKey = parts.slice(0, idx + 1).join('.'),
252
239
  props = {};
253
240
 
254
241
  // Extract props for this part
@@ -275,7 +262,7 @@ export class NavigatorModel extends HoistModel {
275
262
  // we drop the rest of the route and redirect to the route so far
276
263
  if (init && pageModelCfg.disableDirectLink) {
277
264
  const completedRouteParts = routeParts.slice(0, i),
278
- newRouteName = myRoutePrefix + completedRouteParts.map(it => it.id).join('.'),
265
+ newRouteName = completedRouteParts.map(it => it.id).join('.'),
279
266
  newRouteParams = mergeDeep({}, ...completedRouteParts.map(it => it.props));
280
267
 
281
268
  XH.navigate(newRouteName, newRouteParams, {replace: true});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "74.0.0-SNAPSHOT.1747520457711",
3
+ "version": "74.0.0-SNAPSHOT.1747677959059",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",