@xh/hoist 73.0.0-SNAPSHOT.1744142206373 → 73.0.0-SNAPSHOT.1744144713361

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## v73.0.0-SNAPSHOT - unreleased
4
4
 
5
+ ### 🎁 New Features
6
+
7
+ `ViewManagerConfig` takes new key `viewRouteParam` to allow ViewManagers implemented with routing to
8
+ have the view buttons on their menu items be right clickable/Ctrl+ Click to open views in new tabs or windows.
9
+
5
10
  ## v72.3.0 - 2025-04-08
6
11
 
7
12
  ### 🎁 New Features
@@ -305,7 +305,12 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
305
305
 
306
306
  throwIf(
307
307
  !enableDefault && !initialViewSpec,
308
- "ViewManagerModel requires 'initialViewSpec' if `enableDefault` is false."
308
+ "ViewManagerModel requires 'initialViewSpec' if 'enableDefault' is false."
309
+ );
310
+
311
+ throwIf(
312
+ viewRouteParam && isNil(XH.routerState),
313
+ "Cannot use 'viewRouteParam' if your app does not define a router."
309
314
  );
310
315
 
311
316
  this.type = type;
@@ -158,7 +158,7 @@ function getGroupedMenuItems(
158
158
  function viewMenuItem(view: ViewInfo, model: ViewManagerModel): ReactNode {
159
159
  const icon = view.isCurrentView ? Icon.check() : Icon.placeholder(),
160
160
  title = [],
161
- usingRouting = XH.routerState && model.viewRouteParam;
161
+ usingRouting = !!(XH.routerState && model.viewRouteParam);
162
162
 
163
163
  if (!view.isOwned && view.owner) title.push(view.owner);
164
164
  if (view.description) title.push(view.description);
@@ -178,18 +178,12 @@ function viewMenuItem(view: ViewInfo, model: ViewManagerModel): ReactNode {
178
178
  icon,
179
179
  href,
180
180
  onClick: e => {
181
- if (!usingRouting) {
181
+ if (!usingRouting || (e.button === 0 && !e.ctrlKey && !e.metaKey)) {
182
182
  consumeEvent(e);
183
183
  model.selectViewAsync(view).catchDefault();
184
184
  return false;
185
185
  }
186
186
 
187
- if (e.button === 0 && !e.ctrlKey && !e.metaKey) {
188
- consumeEvent(e);
189
- XH.navigate(href);
190
- return false;
191
- }
192
-
193
187
  return true;
194
188
  }
195
189
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1744142206373",
3
+ "version": "73.0.0-SNAPSHOT.1744144713361",
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",