@openwebf/react-router 0.24.1 → 1.0.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/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import React, { SyntheticEvent, EventHandler, ReactNode, FC } from 'react';
2
- import { WebFElementWithMethods } from '@openwebf/react-core-ui';
3
2
 
4
3
  type RoutePath = string;
5
4
  type EnsureRouteMountedCallback = (pathname: string) => Promise<void> | void;
@@ -14,7 +13,8 @@ interface HybridRouteStackEntry {
14
13
  }
15
14
  /**
16
15
  * WebF Router object - provides comprehensive navigation APIs
17
- * Combines web-like history management with Flutter-like navigation patterns
16
+ * Combines web-like history management with Flutter-like navigation patterns.
17
+ * Works in both WebF native environment and standard browser environment.
18
18
  */
19
19
  declare const WebFRouter: {
20
20
  /**
@@ -443,9 +443,44 @@ interface WebFHybridRouterProps {
443
443
  onPrerendering?: HybridRouterPrerenderingEventHandler;
444
444
  children?: ReactNode;
445
445
  }
446
- interface WebFRouterLinkElement extends WebFElementWithMethods<{}> {
446
+ interface WebFRouterLinkElement {
447
447
  }
448
+ /**
449
+ * Unified RouterLink component that works in both WebF and browser environments
450
+ */
448
451
  declare const WebFRouterLink: FC<WebFHybridRouterProps>;
449
452
 
450
- export { Route, Routes, WebFRouter, WebFRouterLink, __unstable_setEnsureRouteMountedCallback, matchPath, matchRoutes, pathToRegex, useLocation, useNavigate, useParams, useRouteContext, useRoutes };
451
- export type { HybridRouteStackEntry, HybridRouterChangeEvent, HybridRouterChangeEventHandler, HybridRouterPrerenderingEvent, HybridRouterPrerenderingEventHandler, Location, NavigateFunction, NavigateOptions, NavigationMethods, RouteMatch, RouteObject, RouteParams, RouteProps, RoutesProps, WebFHybridRouterProps, WebFRouterLinkElement };
453
+ /**
454
+ * Platform detection and abstraction layer
455
+ *
456
+ * Detects whether running in WebF or standard browser environment
457
+ * and provides a unified interface for platform-specific APIs.
458
+ *
459
+ * WebF types are provided by @openwebf/webf-enterprise-typings package.
460
+ * In browser environments, the router works without WebF types.
461
+ */
462
+ type PlatformType = 'webf' | 'browser';
463
+ /**
464
+ * Detect the current platform
465
+ */
466
+ declare function detectPlatform(): PlatformType;
467
+ /**
468
+ * Check if running in WebF environment
469
+ */
470
+ declare function isWebF(): boolean;
471
+ /**
472
+ * Check if running in browser environment
473
+ */
474
+ declare function isBrowser(): boolean;
475
+ /**
476
+ * Get the current platform type (evaluated once at module load)
477
+ */
478
+ declare const platform: PlatformType;
479
+
480
+ /**
481
+ * Reset the browser history adapter (for testing)
482
+ */
483
+ declare function resetBrowserHistory(): void;
484
+
485
+ export { Route, Routes, WebFRouter, WebFRouterLink, __unstable_setEnsureRouteMountedCallback, detectPlatform, isBrowser, isWebF, matchPath, matchRoutes, pathToRegex, platform, resetBrowserHistory, useLocation, useNavigate, useParams, useRouteContext, useRoutes };
486
+ export type { HybridRouteStackEntry, HybridRouterChangeEvent, HybridRouterChangeEventHandler, HybridRouterPrerenderingEvent, HybridRouterPrerenderingEventHandler, Location, NavigateFunction, NavigateOptions, NavigationMethods, PlatformType, RouteMatch, RouteObject, RouteParams, RouteProps, RoutesProps, WebFHybridRouterProps, WebFRouterLinkElement };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAC;AAGnC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}